Remember what branches we delete and do not try to reparent them in cleanup.
R=agable@chromium.org
BUG=357367
Review URL: https://codereview.chromium.org/214133006
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@260704 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_rebase_update.py b/git_rebase_update.py
index 37f3066..b0c5bf4 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -74,6 +74,7 @@
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 @@
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 @@
print ('Reparented %s to track %s (was tracking %s)'
% (down, parent, branch))
+ deletions.add(branch)
print git.run('branch', '-d', branch)