Use get_or_create_merge_base in git-cl-upload to correctly deal with rebased
upstreams.
In the event that users are NOT using the enhanced tooling, this is equivalent
to `git merge-base "@{u}" HEAD`. In the event that they are, this will catch
the case where their parent branch got rebased, but this branch hasn't been
rebased on the parent yet.
R=agable@chromium.org, szager@chromium.org
BUG=
Review URL: https://codereview.chromium.org/224703002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@261601 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 1a1c648..9dabe20 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -35,13 +35,14 @@
import clang_format
import fix_encoding
import gclient_utils
+import git_common
+import owners_finder
import presubmit_support
import rietveld
import scm
import subcommand
import subprocess2
import watchlists
-import owners_finder
__version__ = '1.0'
@@ -551,7 +552,8 @@
return remote, upstream_branch
def GetCommonAncestorWithUpstream(self):
- return RunGit(['merge-base', self.GetUpstreamBranch(), 'HEAD']).strip()
+ return git_common.get_or_create_merge_base(self.GetBranch(),
+ self.GetUpstreamBranch())
def GetUpstreamBranch(self):
if self.upstream_branch is None:
@@ -2155,7 +2157,7 @@
"-bwin_rel:base_unittests:ValuesTest.*Value"))
group.add_option(
"-m", "--master", default='',
- help=("Specify a try master where to run the tries."))
+ help=("Specify a try master where to run the tries."))
group.add_option(
"-r", "--revision",
help="Revision to use for the try job; default: the "