gitmopy.git =========== .. py:module:: gitmopy.git .. autoapi-nested-parse:: `gitmopy`'s Git-related utility functions. Module Contents --------------- .. py:class:: CatchRemoteException(remote) Context manager to catch GitCommandError when pushing to a remote. Also stores whether the issue is that the remote has no upstream branch. :param remote: Name of the remote repository that is being pushed to. :type remote: str .. py:attribute:: error :value: False .. py:attribute:: remote .. py:attribute:: set_upsteam :value: False .. py:function:: commits_ahead(repo) Get the number of commits the local current branch is behind for each remote. :param repo: GitPython repository object. :type repo: Repo :returns: Number of commits the local current branch is behind for each remote. :rtype: int .. py:function:: commits_behind(repo) Get the number of commits the local current branch is behind for each remote. :param repo: GitPython repository object. :type repo: Repo :returns: Number of commits the local current branch is behind for each remote. :rtype: int .. py:function:: fetch_all(repo) Fetch all remotes of a GitPython repository. :param repo: Repository to fetch remotes from. :type repo: git.Repo .. py:function:: format_remotes_diff(repo) Format the remotes diff. :param repo: GitPython repository object. :type repo: Repo :returns: Formatted remotes diff. :rtype: str .. py:function:: get_files_status(repo) Make a dictionnary of the files' status in a GitPython repository. Keys are "staged", "unstaged" and "untracked". Values are lists of file paths. :param repo: Repository to get files' status from. :type repo: git.Repo :returns: Dictionnary of files' status. :rtype: Dict[str, List[str]] .. py:function:: get_staged(repo) Get staged files from a GitPython repository. :param repo: Repository to get staged files from. :type repo: git.Repo :returns: File paths of staged files. :rtype: List[str] .. py:function:: get_unstaged(repo) Get unstaged files from a GitPython repository. :param repo: Repository to get unstaged files from. :type repo: git.Repo :returns: File paths of unstaged files. :rtype: List[str] .. py:function:: get_untracked(repo) Get untracked files from a GitPython repository. :param repo: Repository to get untracked files from. :type repo: git.Repo :returns: File paths of untracked files. :rtype: List[str] .. py:function:: has_upstreams(repo, remotes, branch_name) Check which remotes have a branch with a given name. :param repo: Repository to check branches from. :type repo: git.Repo :param remotes: List of remotes to check. :type remotes: List[Union[str, Remote]] :param branch_name: Name of the branch to check. :type branch_name: str :returns: Dictionnary of booleans indicating if each remote has the branch. :rtype: Dict[str, bool] .. py:function:: unstage(repo, files) Unstage files from the index. :param repo: GitPython repository object. :type repo: Repo :param files: List of files to unstage. :type files: List[str]