jacebrowning/gitman

Add a '--skip-changes' option to 'update'

daniel-brosche opened this issue · 1 comments

The current behaviour is that an update command does sequentially iterate though the gitman.yml and updates all repositories if there are no uncommited changes present. If gitman detects a repository with uncommited changes then the update process will be aborted with an message and all successor repositories in the list won't be updated.
If the first defined repository in the gitman.yml has uncommited changes then the majority of the defined repositories won't be updated.

The --skip-changes option allows to update all repositories besides the repositories with uncommited changes. At the end of the process the user gets a summary which repositories are ignored in due to uncommited changes. A special return code in this case should be considered.

Maybe, this option is a candidate to be the default behaviour of gitman update command and instead an option --abort-changes should be introduced to activate the current behaviour.

I'm in favor of adding a --skip-changesoption to both install and update as part of this parser:

gitman/gitman/cli.py

Lines 33 to 37 in 9b9c715

options = argparse.ArgumentParser(add_help=False)
options.add_argument('-f', '--force', action='store_true',
help="overwrite uncommitted changes in dependencies")
options.add_argument('-c', '--clean', action='store_true',
help="delete ignored files in dependencies")

If changes are detected, this new option should also be recommended:

gitman/gitman/cli.py

Lines 190 to 192 in 9b9c715

except exceptions.UncommittedChanges as exception:
_show_error(exception)
exit_message = "Run again with '--force' to discard changes"