Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: git_rebase_update.py

Issue 1331263002: Add a --keep-going flag for people who run rebase-update infrequently. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix typo. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | man/html/git-rebase-update.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_rebase_update.py
diff --git a/git_rebase_update.py b/git_rebase_update.py
index f98b8b2d925cc9dab303e8927c631870bb41b759..992bb195dbd2a383d3c606e8e73dfb9d93bbcbc4 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -196,6 +196,8 @@ def rebase_branch(branch, parent, start_hash):
def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', action='store_true')
+ parser.add_argument('--keep-going', '-k', action='store_true',
+ help='Keep processing past failed rebases.')
parser.add_argument('--no_fetch', '--no-fetch', '-n',
action='store_true',
help='Skip fetching remotes.')
@@ -245,6 +247,7 @@ def main(args=None):
logging.debug('merge_base: %s' % pformat(merge_base))
retcode = 0
+ unrebased_branches = []
# Rebase each branch starting with the root-most branches and working
# towards the leaves.
for branch, parent in git.topo_iter(branch_tree):
@@ -254,7 +257,23 @@ def main(args=None):
ret = rebase_branch(branch, parent, merge_base[branch])
if not ret:
retcode = 1
- break
+
+ if opts.keep_going:
+ print '--keep-going set, continuing with next branch.'
+ unrebased_branches.append(branch)
+ if git.in_rebase():
+ git.run_with_retcode('rebase', '--abort')
+ if git.in_rebase(): # pragma: no cover
+ print 'Failed to abort rebase. Something is really wrong.'
+ break
+ else:
+ break
+
+ if unrebased_branches:
+ print
+ print 'The following branches could not be cleanly rebased:'
+ for branch in unrebased_branches:
+ print ' %s' % branch
if not retcode:
remove_empty_branches(branch_tree)
« no previous file with comments | « no previous file | man/html/git-rebase-update.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698