Functions§
- assure_
repo_ in_ normal_ state - Checks that repo is in “RepositoryState::Clean” state. This means there is no rebase, cherry-pick, merge, etc is in progress. Confusingly, this is different from no uncommitted or staged changes being present in the repo. For this, see [fn.assure_workspace_is_clean].
- cherrypick_
commit_ onto_ new_ branch - The main functional function.
- get_
default_ branch - Resolve the default branch name on the ‘origin’ remote. First tries looking for where origin/HEAD is pointing to. If that fails tries a hardcoded list of possible branches.
- push_
new_ commit - Pushes
as new branch to origin
. Other remote names are currently not supported. If there is a need, please let us know. - stash
- Returns Ok(true) if stashing was successful. Ok(false) if stashing was not needed.
- wrapper_
pick_ and_ clean - Wraps the three steps below into one, such that any error can be caught and the git stash can be popped before exiting. In many ways this is a poor-person’s try-finally (or context manager in Python). Using Drop led to multiple borrowing errors. Any improvements along those lines are more than welcome.