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

Unified Diff: git_common.py

Issue 288323002: Make marked merge base invalid when the upstream changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 7 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 | git_map.py » ('j') | git_map.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_common.py
diff --git a/git_common.py b/git_common.py
index 6952c1ee318765ebe40622ec9a7b5d10334c888f..298ecc4ff3a8c9ee8f9263130b3751167b5eb5fa 100644
--- a/git_common.py
+++ b/git_common.py
@@ -352,9 +352,16 @@ def get_or_create_merge_base(branch, parent=None):
If parent is supplied, it's used instead of calling upstream(branch).
"""
base = branch_config(branch, 'base')
+ base_upstream = branch_config(branch, 'base-upstream')
parent = parent or upstream(branch)
+ if not parent:
+ return None
actual_merge_base = run('merge-base', parent, branch)
+ if base_upstream != parent:
+ base = None
+ base_upstream = None
+
def is_ancestor(a, b):
return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0
@@ -370,7 +377,7 @@ def get_or_create_merge_base(branch, parent=None):
if not base:
base = actual_merge_base
- manual_merge_base(branch, base)
+ manual_merge_base(branch, base, parent)
return base
@@ -409,8 +416,9 @@ def is_dormant(branch):
return branch_config(branch, 'dormant', 'false') != 'false'
-def manual_merge_base(branch, base):
+def manual_merge_base(branch, base, parent):
set_branch_config(branch, 'base', base)
+ set_branch_config(branch, 'base-upstream', parent)
def mktree(treedict):
@@ -475,6 +483,7 @@ def rebase(parent, start, branch, abort=False):
def remove_merge_base(branch):
del_branch_config(branch, 'base')
+ del_branch_config(branch, 'base-upstream')
def root():
« no previous file with comments | « no previous file | git_map.py » ('j') | git_map.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698