Make marked merge base invalid when the upstream changes.

This should let the base marker transparently work with plain-old-git tools
which was the idea in the first place. Specifically `git branch -u` without a
corresponding rebase.

R=agable@chromium.org
BUG=373977

Review URL: https://codereview.chromium.org/288323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@271112 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_reparent_branch.py b/git_reparent_branch.py
index 9b7dace..f9bf9c5 100755
--- a/git_reparent_branch.py
+++ b/git_reparent_branch.py
@@ -11,7 +11,7 @@
 import subprocess2
 
 from git_common import upstream, current_branch, run, tags, set_branch_config
-from git_common import get_or_create_merge_base, root
+from git_common import get_or_create_merge_base, root, manual_merge_base
 
 import git_rebase_update
 
@@ -44,7 +44,7 @@
   if new_parent == cur_parent:
     parser.error('Cannot reparent a branch to its existing parent')
 
-  get_or_create_merge_base(branch, cur_parent)
+  mbase = get_or_create_merge_base(branch, cur_parent)
 
   all_tags = tags()
   if cur_parent in all_tags:
@@ -66,6 +66,8 @@
            % (branch, new_parent, cur_parent))
     run('branch', '--set-upstream-to', new_parent, branch)
 
+  manual_merge_base(branch, mbase, new_parent)
+
   # TODO(iannucci): ONLY rebase-update the branch which moved (and dependants)
   return git_rebase_update.main(['--no_fetch'])