diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 9bc4460c..346eb9cd 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py @@ -37,6 +37,9 @@ branch but need to incorporate new upstream changes "underneath" them. dest="interactive", action="store_true", help="interactive rebase (single project only)") + p.add_option('--fail-fast', + dest='fail_fast', action='store_true', + help='Stop rebasing after first error is hit') p.add_option('-f', '--force-rebase', dest='force_rebase', action='store_true', help='Pass --force-rebase to git rebase') @@ -88,7 +91,11 @@ branch but need to incorporate new upstream changes "underneath" them. if opt.interactive: common_args.append('-i') + ret = 0 for project in all_projects: + if ret and opt.fail_fast: + break + cb = project.CurrentBranch if not cb: if one_project: @@ -127,13 +134,19 @@ branch but need to incorporate new upstream changes "underneath" them. stash_args = ["stash"] if GitCommand(project, stash_args).Wait() != 0: - return 1 + ret += 1 + continue if GitCommand(project, args).Wait() != 0: - return 1 + ret += 1 + continue if needs_stash: stash_args.append('pop') stash_args.append('--quiet') if GitCommand(project, stash_args).Wait() != 0: - return 1 + ret += 1 + + if ret: + print('error: %i projects had errors' % (ret,), file=sys.stderr) + return ret