summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-08-06 15:25:17 -0400
committerRuss Cox <rsc@golang.org>2014-08-06 15:25:17 -0400
commit69ff935d27eaaf430fa3041fd1a0ef6628d5b991 (patch)
treee1dd8fb9b85326b9e8dfd6e1ea3836fa4946493c /lib
parent5d4df03383c7b05f4332f00701b31f108543faec (diff)
downloadgo-69ff935d27eaaf430fa3041fd1a0ef6628d5b991.tar.gz
codereview: handle upload of merge
LGTM=minux R=minux CC=golang-codereviews https://codereview.appspot.com/118690043
Diffstat (limited to 'lib')
-rw-r--r--lib/codereview/codereview.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py
index 1b4551889..a64401533 100644
--- a/lib/codereview/codereview.py
+++ b/lib/codereview/codereview.py
@@ -3478,11 +3478,23 @@ class MercurialVCS(VersionControlSystem):
if not err and mqparent != "":
self.base_rev = mqparent
else:
- out = RunShell(["hg", "parents", "-q"], silent_ok=True).strip()
+ out = RunShell(["hg", "parents", "-q", "--template={node} {branch}"], silent_ok=True).strip()
if not out:
# No revisions; use 0 to mean a repository with nothing.
- out = "0:0"
- self.base_rev = out.split(':')[1].strip()
+ out = "0:0 default"
+
+ # Find parent along current branch.
+ branch = repo[None].branch()
+ base = ""
+ for line in out.splitlines():
+ fields = line.strip().split(' ')
+ if fields[1] == branch:
+ base = fields[0]
+ break
+ if base == "":
+ # Use the first parent
+ base = out.strip().split(' ')[0]
+ self.base_rev = base
def _GetRelPath(self, filename):
"""Get relative path of a file according to the current directory,