]> Cypherpunks repositories - gostls13.git/commitdiff
codereview: abort 'hg commit' before entering commit message.
authorShenghou Ma <minux@golang.org>
Sat, 19 Jul 2014 01:04:56 +0000 (21:04 -0400)
committerShenghou Ma <minux@golang.org>
Sat, 19 Jul 2014 01:04:56 +0000 (21:04 -0400)
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://golang.org/cl/106320043

lib/codereview/codereview.py

index 8445555fa217ffd415d803ab196b7e7bee9cc47a..116d313b01b1252b4b559f063d6e8e645c002aa5 100644 (file)
@@ -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