summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2014-07-18 21:04:56 -0400
committerShenghou Ma <minux@golang.org>2014-07-18 21:04:56 -0400
commit9e58256ca58ab5a844200b573853fcf0d7ea0eb1 (patch)
treeed1ef879c35ee15a07a3e375d2a54fee2ff543b8 /lib
parentd3c59f0f76cd8dcd70e130aad855e41cfd4d2999 (diff)
downloadgo-9e58256ca58ab5a844200b573853fcf0d7ea0eb1.tar.gz
codereview: abort 'hg commit' before entering commit message.
Hook pre-commit runs before 'hg commit' command whereas hook precommit runs after the user has entered commit message. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/106320043
Diffstat (limited to 'lib')
-rw-r--r--lib/codereview/codereview.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py
index 8445555fa..116d313b0 100644
--- a/lib/codereview/codereview.py
+++ b/lib/codereview/codereview.py
@@ -2289,6 +2289,10 @@ codereview_init = False
def uisetup(ui):
global testing
testing = ui.config("codereview", "testing")
+ # Disable the Mercurial commands that might change the repository.
+ # Only commands in this extension are supposed to do that.
+ ui.setconfig("hooks", "pre-commit.codereview", precommithook) # runs before 'hg commit'
+ ui.setconfig("hooks", "precommit.codereview", precommithook) # catches all cases
def reposetup(ui, repo):
global codereview_disabled
@@ -2338,10 +2342,6 @@ def reposetup(ui, repo):
InstallMatch(ui, repo)
RietveldSetup(ui, repo)
- # Disable the Mercurial commands that might change the repository.
- # Only commands in this extension are supposed to do that.
- ui.setconfig("hooks", "precommit.codereview", precommithook)
-
# Rollback removes an existing commit. Don't do that either.
global real_rollback
real_rollback = repo.rollback