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

Unified Diff: git_rebase_update.py

Issue 214133006: Remember what branches we delete and do not try to reparent them in cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 9 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 | tests/git_rebase_update_test.py » ('j') | tests/git_rebase_update_test.py » ('J')
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 37f306658188e688cc6cdccc1341b375307b3c14..b0c5bf4dc31cffc33bceb547fa7141469eacb5c0 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -74,6 +74,7 @@ def remove_empty_branches(branch_tree):
tag_set = git.tags()
ensure_root_checkout = git.once(lambda: git.run('checkout', git.root()))
+ deletions = set()
downstreams = collections.defaultdict(list)
for branch, parent in git.topo_iter(branch_tree, top_down=False):
downstreams[parent].append(branch)
@@ -84,6 +85,9 @@ def remove_empty_branches(branch_tree):
logging.debug('branch %s merged to %s', branch, parent)
for down in downstreams[branch]:
+ if down in deletions:
+ continue
+
if parent in tag_set:
git.set_branch_config(down, 'remote', '.')
git.set_branch_config(down, 'merge', 'refs/tags/%s' % parent)
@@ -94,6 +98,7 @@ def remove_empty_branches(branch_tree):
print ('Reparented %s to track %s (was tracking %s)'
% (down, parent, branch))
+ deletions.add(branch)
print git.run('branch', '-d', branch)
« no previous file with comments | « no previous file | tests/git_rebase_update_test.py » ('j') | tests/git_rebase_update_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698