utils – Misc. helper methods

exception gitrevise.utils.EditorError
gitrevise.utils.commit_range(base: gitrevise.odb.Commit, tip: gitrevise.odb.Commit) → List[gitrevise.odb.Commit]

Oldest-first iterator over the given commit range, not including the commit base

gitrevise.utils.cut_commit(commit: gitrevise.odb.Commit) → gitrevise.odb.Commit

Perform a cut operation on the given commit, and return the modified commit.

gitrevise.utils.edit_commit_message(commit: gitrevise.odb.Commit) → gitrevise.odb.Commit

Launch an editor to edit the commit message of commit, returning a modified commit

gitrevise.utils.local_commits(repo: gitrevise.odb.Repository, tip: gitrevise.odb.Commit) → Tuple[gitrevise.odb.Commit, List[gitrevise.odb.Commit]]

Returns an oldest-first iterator over the local commits which are parents of the specified commit. May return an empty list. A commit is considered local if it is not present on any remote.

gitrevise.utils.run_editor(repo: gitrevise.odb.Repository, filename: str, text: bytes, comments: Optional[str] = None, allow_empty: bool = False) → bytes

Run the editor configured for git to edit the given text

gitrevise.utils.run_sequence_editor(repo: gitrevise.odb.Repository, filename: str, text: bytes, comments: Optional[str] = None, allow_empty: bool = False) → bytes

Run the editor configured for git to edit the given rebase/revise sequence

gitrevise.utils.run_specific_editor(editor: str, repo: gitrevise.odb.Repository, filename: str, text: bytes, comments: Optional[str] = None, allow_empty: bool = False, allow_whitespace_before_comments: bool = False) → bytes

Run the editor configured for git to edit the given text