aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2013-06-04 15:02:28 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2013-06-04 15:02:28 -0700
commit2bcc30891ca4f2c04daf4aa07d78cb8868a6fa40 (patch)
treeaad6499d71741798c91cff0e9e39d0de3bfc6784 /lib
parent251baea1afc07f3ca7ca10935aaba1476cfd34d9 (diff)
downloadgo-2bcc30891ca4f2c04daf4aa07d78cb8868a6fa40.tar.gz
go-2bcc30891ca4f2c04daf4aa07d78cb8868a6fa40.zip
codereview: don't warn about secret commits
Normally the codereview plugin disables adding new commits when not using the submit command. Unfortunately this makes it impossible to use the Mercurial Queues extension at the same time. A feature called "Phases" was introduced in Mercurial 2.1 that allows marking commits as being secret; this means they will never be pushed to the upstream repository. We can take advantage of this feature to allow the use of Mercurial Queues if the mq.secret option has been set in hgrc(5) and a recent version of Mercurial is used. R=golang-dev, rsc, minux.ma CC=golang-dev https://golang.org/cl/7398055
Diffstat (limited to 'lib')
-rw-r--r--lib/codereview/codereview.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py
index f8edbcde00..6cf99d8a3c 100644
--- a/lib/codereview/codereview.py
+++ b/lib/codereview/codereview.py
@@ -1028,12 +1028,12 @@ def FindContributor(ui, repo, user=None, warn=True):
hgversion = hg_util.version()
-# We require Mercurial 1.9 and suggest Mercurial 2.0.
+# We require Mercurial 1.9 and suggest Mercurial 2.1.
# The details of the scmutil package changed then,
# so allowing earlier versions would require extra band-aids below.
# Ubuntu 11.10 ships with Mercurial 1.9.1 as the default version.
hg_required = "1.9"
-hg_suggested = "2.0"
+hg_suggested = "2.1"
old_message = """
@@ -1187,6 +1187,10 @@ def hg_commit(ui, repo, *pats, **opts):
commit_okay = False
def precommithook(ui, repo, **opts):
+ if hgversion >= "2.1":
+ from mercurial import phases
+ if repo.ui.config('phases', 'new-commit') >= phases.secret:
+ return False
if commit_okay:
return False # False means okay.
ui.write("\ncodereview extension enabled; use mail, upload, or submit instead of commit\n\n")