From e75854552eb1984e0f18f1f7334547a69fbed28c Mon Sep 17 00:00:00 2001 From: "mmoss@chromium.org" Date: Sun, 24 Aug 2014 01:41:11 +0000 Subject: [PATCH] Fix git-cl when working on branches. This updates various assumptions to coincide with how gclient fetches branch-heads refs from chromium repos. R=iannucci@google.com BUG=406858 Review URL: https://codereview.chromium.org/498013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291586 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cl.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git_cl.py b/git_cl.py index 1f4b01b039..01a12a82c8 100755 --- a/git_cl.py +++ b/git_cl.py @@ -581,7 +581,10 @@ or verify this branch is set up to track another (via the --track argument to if self.upstream_branch is None: remote, upstream_branch = self.FetchUpstreamTuple(self.GetBranch()) if remote is not '.': - upstream_branch = upstream_branch.replace('heads', 'remotes/' + remote) + upstream_branch = upstream_branch.replace('refs/heads/', + 'refs/remotes/%s/' % remote) + upstream_branch = upstream_branch.replace('refs/branch-heads/', + 'refs/remotes/branch-heads/') self.upstream_branch = upstream_branch return self.upstream_branch @@ -615,6 +618,8 @@ or verify this branch is set up to track another (via the --track argument to branch = 'HEAD' if branch.startswith('refs/remotes'): self._remote = (remote, branch) + elif branch.startswith('refs/branch-heads/'): + self._remote = (remote, branch.replace('refs/', 'refs/remotes/')) else: self._remote = (remote, 'refs/remotes/%s/%s' % (remote, branch)) return self._remote