--- a/tests/test-hook.t Sat Feb 09 01:19:43 2019 +0100
+++ b/tests/test-hook.t Sat Feb 09 01:20:03 2019 +0100
@@ -14,32 +14,63 @@
$ cd a
$ cat > .hg/hgrc <<EOF
> [hooks]
- > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
- > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
- > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
- > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
+ > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit"
+ > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit.b"
+ > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py --line precommit"
+ > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxncommit"
> pretxncommit.tip = hg -q tip
- > pre-identify = sh -c "printenv.py pre-identify 1"
- > pre-cat = sh -c "printenv.py pre-cat"
- > post-cat = sh -c "printenv.py post-cat"
- > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
- > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
- > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
+ > pre-identify = sh -c "printenv.py --line pre-identify 1"
+ > pre-cat = sh -c "printenv.py --line pre-cat"
+ > post-cat = sh -c "printenv.py --line post-cat"
+ > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnopen"
+ > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnclose"
+ > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnclose"
> txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
- > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
+ > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnabort"
> txnclose.checklock = sh -c "hg debuglock > /dev/null"
> EOF
$ echo a > a
$ hg add a
$ hg commit -m a
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=0000000000000000000000000000000000000000
+
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ pretxncommit hook: HG_HOOKNAME=pretxncommit
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ HG_PARENT1=0000000000000000000000000000000000000000
+ HG_PENDING=$TESTTMP/a
+
0:cb9a9f314b8b
- pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
- commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
+ pretxnclose hook: HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_PHASES_MOVED=1
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ txnclose hook: HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_PHASES_MOVED=1
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ commit hook: HG_HOOKNAME=commit
+ HG_HOOKTYPE=commit
+ HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ HG_PARENT1=0000000000000000000000000000000000000000
+
+ commit.b hook: HG_HOOKNAME=commit.b
+ HG_HOOKTYPE=commit
+ HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ HG_PARENT1=0000000000000000000000000000000000000000
+
$ hg clone . ../b
updating to branch default
@@ -50,9 +81,9 @@
$ cat > .hg/hgrc <<EOF
> [hooks]
- > prechangegroup = sh -c "printenv.py prechangegroup"
- > changegroup = sh -c "printenv.py changegroup"
- > incoming = sh -c "printenv.py incoming"
+ > prechangegroup = sh -c "printenv.py --line prechangegroup"
+ > changegroup = sh -c "printenv.py --line changegroup"
+ > incoming = sh -c "printenv.py --line incoming"
> EOF
pretxncommit and commit hooks can see both parents of merge
@@ -60,103 +91,309 @@
$ cd ../a
$ echo b >> a
$ hg commit -m a1 -d "1 0"
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ pretxncommit hook: HG_HOOKNAME=pretxncommit
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ HG_PENDING=$TESTTMP/a
+
1:ab228980c14d
- pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
- commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ pretxnclose hook: HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ txnclose hook: HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ commit hook: HG_HOOKNAME=commit
+ HG_HOOKTYPE=commit
+ HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+
+ commit.b hook: HG_HOOKNAME=commit.b
+ HG_HOOKTYPE=commit
+ HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+
$ hg update -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo b > b
$ hg add b
$ hg commit -m b -d '1 0'
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ pretxncommit hook: HG_HOOKNAME=pretxncommit
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ HG_PENDING=$TESTTMP/a
+
2:ee9deb46ab31
- pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
+ pretxnclose hook: HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
created new head
- txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
- commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+ txnclose hook: HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ commit hook: HG_HOOKNAME=commit
+ HG_HOOKTYPE=commit
+ HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+
+ commit.b hook: HG_HOOKNAME=commit.b
+ HG_HOOKTYPE=commit
+ HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+
$ hg merge 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m merge -d '2 0'
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
+
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ pretxncommit hook: HG_HOOKNAME=pretxncommit
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
+ HG_PENDING=$TESTTMP/a
+
3:07f3376c1e65
- pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
- commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
+ pretxnclose hook: HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ txnclose hook: HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ commit hook: HG_HOOKNAME=commit
+ HG_HOOKTYPE=commit
+ HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
+
+ commit.b hook: HG_HOOKNAME=commit.b
+ HG_HOOKTYPE=commit
+ HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
+
test generic hooks
$ hg id
- pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[]
+ pre-identify hook: HG_ARGS=id
+ HG_HOOKNAME=pre-identify
+ HG_HOOKTYPE=pre-identify
+ HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''}
+ HG_PATS=[]
+
abort: pre-identify hook exited with status 1
[255]
$ hg cat b
- pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b']
+ pre-cat hook: HG_ARGS=cat b
+ HG_HOOKNAME=pre-cat
+ HG_HOOKTYPE=pre-cat
+ HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''}
+ HG_PATS=['b']
+
b
- post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0
+ post-cat hook: HG_ARGS=cat b
+ HG_HOOKNAME=post-cat
+ HG_HOOKTYPE=post-cat
+ HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''}
+ HG_PATS=['b']
+ HG_RESULT=0
+
$ cd ../b
$ hg pull ../a
pulling from ../a
searching for changes
- prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
+ prechangegroup hook: HG_HOOKNAME=prechangegroup
+ HG_HOOKTYPE=prechangegroup
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
adding changesets
adding manifests
adding file changes
added 3 changesets with 2 changes to 2 files
new changesets ab228980c14d:07f3376c1e65
- changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
- incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
- incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
- incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
+ changegroup hook: HG_HOOKNAME=changegroup
+ HG_HOOKTYPE=changegroup
+ HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
+ HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
+ incoming hook: HG_HOOKNAME=incoming
+ HG_HOOKTYPE=incoming
+ HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
+ incoming hook: HG_HOOKNAME=incoming
+ HG_HOOKTYPE=incoming
+ HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
+ incoming hook: HG_HOOKNAME=incoming
+ HG_HOOKTYPE=incoming
+ HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
(run 'hg update' to get a working copy)
tag hooks can see env vars
$ cd ../a
$ cat >> .hg/hgrc <<EOF
- > pretag = sh -c "printenv.py pretag"
- > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
+ > pretag = sh -c "printenv.py --line pretag"
+ > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py --line tag"
> EOF
$ hg tag -d '3 0' a
- pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
+ pretag hook: HG_HOOKNAME=pretag
+ HG_HOOKTYPE=pretag
+ HG_LOCAL=0
+ HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_TAG=a
+
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
+
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ pretxncommit hook: HG_HOOKNAME=pretxncommit
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_PENDING=$TESTTMP/a
+
4:539e4b31b6dc
- pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
- txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
- commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
+ pretxnclose hook: HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ tag hook: HG_HOOKNAME=tag
+ HG_HOOKTYPE=tag
+ HG_LOCAL=0
+ HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
+ HG_TAG=a
+
+ txnclose hook: HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ commit hook: HG_HOOKNAME=commit
+ HG_HOOKTYPE=commit
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
+
+ commit.b hook: HG_HOOKNAME=commit.b
+ HG_HOOKTYPE=commit
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
+
$ hg tag -l la
- pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
- tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
+ pretag hook: HG_HOOKNAME=pretag
+ HG_HOOKTYPE=pretag
+ HG_LOCAL=1
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_TAG=la
+
+ tag hook: HG_HOOKNAME=tag
+ HG_HOOKTYPE=tag
+ HG_LOCAL=1
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_TAG=la
+
pretag hook can forbid tagging
$ cat >> .hg/hgrc <<EOF
- > pretag.forbid = sh -c "printenv.py pretag.forbid 1"
+ > pretag.forbid = sh -c "printenv.py --line pretag.forbid 1"
> EOF
$ hg tag -d '4 0' fa
- pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
- pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
+ pretag hook: HG_HOOKNAME=pretag
+ HG_HOOKTYPE=pretag
+ HG_LOCAL=0
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_TAG=fa
+
+ pretag.forbid hook: HG_HOOKNAME=pretag.forbid
+ HG_HOOKTYPE=pretag
+ HG_LOCAL=0
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_TAG=fa
+
abort: pretag.forbid hook exited with status 1
[255]
$ hg tag -l fla
- pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
- pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
+ pretag hook: HG_HOOKNAME=pretag
+ HG_HOOKTYPE=pretag
+ HG_LOCAL=1
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_TAG=fla
+
+ pretag.forbid hook: HG_HOOKNAME=pretag.forbid
+ HG_HOOKTYPE=pretag
+ HG_LOCAL=1
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_TAG=fla
+
abort: pretag.forbid hook exited with status 1
[255]
@@ -165,22 +402,43 @@
$ cat >> .hg/hgrc <<EOF
> pretxncommit.forbid0 = sh -c "hg tip -q"
- > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
+ > pretxncommit.forbid1 = sh -c "printenv.py --line pretxncommit.forbid 1"
> EOF
$ echo z > z
$ hg add z
$ hg -q tip
4:539e4b31b6dc
$ hg commit -m 'fail' -d '4 0'
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
- pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
+ pretxncommit hook: HG_HOOKNAME=pretxncommit
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567
+ HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_PENDING=$TESTTMP/a
+
5:6f611f8018c1
5:6f611f8018c1
- pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
+ pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1
+ HG_HOOKTYPE=pretxncommit
+ HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567
+ HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_PENDING=$TESTTMP/a
+
transaction abort!
txnabort Python hook: txnid,txnname
- txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
+ txnabort hook: HG_HOOKNAME=txnabort.1
+ HG_HOOKTYPE=txnabort
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=commit
+
rollback completed
abort: pretxncommit.forbid1 hook exited with status 1
[255]
@@ -205,11 +463,17 @@
precommit hook can prevent commit
$ cat >> .hg/hgrc <<EOF
- > precommit.forbid = sh -c "printenv.py precommit.forbid 1"
+ > precommit.forbid = sh -c "printenv.py --line precommit.forbid 1"
> EOF
$ hg commit -m 'fail' -d '4 0'
- precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
- precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ precommit hook: HG_HOOKNAME=precommit
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+
+ precommit.forbid hook: HG_HOOKNAME=precommit.forbid
+ HG_HOOKTYPE=precommit
+ HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+
abort: precommit.forbid hook exited with status 1
[255]
$ hg -q tip
@@ -218,26 +482,36 @@
preupdate hook can prevent update
$ cat >> .hg/hgrc <<EOF
- > preupdate = sh -c "printenv.py preupdate"
+ > preupdate = sh -c "printenv.py --line preupdate"
> EOF
$ hg update 1
- preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d
+ preupdate hook: HG_HOOKNAME=preupdate
+ HG_HOOKTYPE=preupdate
+ HG_PARENT1=ab228980c14d
+
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
update hook
$ cat >> .hg/hgrc <<EOF
- > update = sh -c "printenv.py update"
+ > update = sh -c "printenv.py --line update"
> EOF
$ hg update
- preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc
- update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc
+ preupdate hook: HG_HOOKNAME=preupdate
+ HG_HOOKTYPE=preupdate
+ HG_PARENT1=539e4b31b6dc
+
+ update hook: HG_ERROR=0
+ HG_HOOKNAME=update
+ HG_HOOKTYPE=update
+ HG_PARENT1=539e4b31b6dc
+
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
pushkey hook
$ cat >> .hg/hgrc <<EOF
- > pushkey = sh -c "printenv.py pushkey"
+ > pushkey = sh -c "printenv.py --line pushkey"
> EOF
$ cd ../b
$ hg bookmark -r null foo
@@ -245,10 +519,41 @@
pushing to ../a
searching for changes
no changes found
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
- pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
- pushkey hook: HG_BUNDLE2=1 HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
- txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=push
+
+ pretxnclose hook: HG_BOOKMARK_MOVED=1
+ HG_BUNDLE2=1
+ HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_SOURCE=push
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=push
+ HG_URL=file:$TESTTMP/a
+
+ pushkey hook: HG_BUNDLE2=1
+ HG_HOOKNAME=pushkey
+ HG_HOOKTYPE=pushkey
+ HG_KEY=foo
+ HG_NAMESPACE=bookmarks
+ HG_NEW=0000000000000000000000000000000000000000
+ HG_PUSHKEYCOMPAT=1
+ HG_SOURCE=push
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
+ txnclose hook: HG_BOOKMARK_MOVED=1
+ HG_BUNDLE2=1
+ HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_SOURCE=push
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=push
+ HG_URL=file:$TESTTMP/a
+
exporting bookmark foo
[1]
$ cd ../a
@@ -256,16 +561,35 @@
listkeys hook
$ cat >> .hg/hgrc <<EOF
- > listkeys = sh -c "printenv.py listkeys"
+ > listkeys = sh -c "printenv.py --line listkeys"
> EOF
$ hg bookmark -r null bar
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
- pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
- txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=bookmark
+
+ pretxnclose hook: HG_BOOKMARK_MOVED=1
+ HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=bookmark
+
+ txnclose hook: HG_BOOKMARK_MOVED=1
+ HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=bookmark
+
$ cd ../b
$ hg pull -B bar ../a
pulling from ../a
- listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
+ listkeys hook: HG_HOOKNAME=listkeys
+ HG_HOOKTYPE=listkeys
+ HG_NAMESPACE=bookmarks
+ HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
+
no changes found
adding remote bookmark bar
$ cd ../a
@@ -273,18 +597,40 @@
test that prepushkey can prevent incoming keys
$ cat >> .hg/hgrc <<EOF
- > prepushkey = sh -c "printenv.py prepushkey.forbid 1"
+ > prepushkey = sh -c "printenv.py --line prepushkey.forbid 1"
> EOF
$ cd ../b
$ hg bookmark -r null baz
$ hg push -B baz ../a
pushing to ../a
searching for changes
- listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
- listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
+ listkeys hook: HG_HOOKNAME=listkeys
+ HG_HOOKTYPE=listkeys
+ HG_NAMESPACE=phases
+ HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
+
+ listkeys hook: HG_HOOKNAME=listkeys
+ HG_HOOKTYPE=listkeys
+ HG_NAMESPACE=bookmarks
+ HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
+
no changes found
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
- prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PUSHKEYCOMPAT=1 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=push
+
+ prepushkey.forbid hook: HG_BUNDLE2=1
+ HG_HOOKNAME=prepushkey
+ HG_HOOKTYPE=prepushkey
+ HG_KEY=baz
+ HG_NAMESPACE=bookmarks
+ HG_NEW=0000000000000000000000000000000000000000
+ HG_PUSHKEYCOMPAT=1
+ HG_SOURCE=push
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
abort: prepushkey hook exited with status 1
[255]
$ cd ../a
@@ -292,16 +638,34 @@
test that prelistkeys can prevent listing keys
$ cat >> .hg/hgrc <<EOF
- > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1"
+ > prelistkeys = sh -c "printenv.py --line prelistkeys.forbid 1"
> EOF
$ hg bookmark -r null quux
- pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
- pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
- txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
+ pretxnopen hook: HG_HOOKNAME=pretxnopen
+ HG_HOOKTYPE=pretxnopen
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=bookmark
+
+ pretxnclose hook: HG_BOOKMARK_MOVED=1
+ HG_HOOKNAME=pretxnclose
+ HG_HOOKTYPE=pretxnclose
+ HG_PENDING=$TESTTMP/a
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=bookmark
+
+ txnclose hook: HG_BOOKMARK_MOVED=1
+ HG_HOOKNAME=txnclose
+ HG_HOOKTYPE=txnclose
+ HG_TXNID=TXN:$ID$
+ HG_TXNNAME=bookmark
+
$ cd ../b
$ hg pull -B quux ../a
pulling from ../a
- prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks
+ prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys
+ HG_HOOKTYPE=prelistkeys
+ HG_NAMESPACE=bookmarks
+
abort: prelistkeys hook exited with status 1
[255]
$ cd ../a
@@ -314,12 +678,17 @@
3:07f3376c1e65
$ cat > .hg/hgrc <<EOF
> [hooks]
- > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1"
+ > prechangegroup.forbid = sh -c "printenv.py --line prechangegroup.forbid 1"
> EOF
$ hg pull ../a
pulling from ../a
searching for changes
- prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
+ prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid
+ HG_HOOKTYPE=prechangegroup
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
abort: prechangegroup.forbid hook exited with status 1
[255]
@@ -329,7 +698,7 @@
$ cat > .hg/hgrc <<EOF
> [hooks]
> pretxnchangegroup.forbid0 = hg tip -q
- > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1"
+ > pretxnchangegroup.forbid1 = sh -c "printenv.py --line pretxnchangegroup.forbid 1"
> EOF
$ hg pull ../a
pulling from ../a
@@ -339,7 +708,15 @@
adding file changes
added 1 changesets with 1 changes to 1 files
4:539e4b31b6dc
- pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
+ pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1
+ HG_HOOKTYPE=pretxnchangegroup
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_PENDING=$TESTTMP/b
+ HG_SOURCE=pull
+ HG_TXNID=TXN:$ID$
+ HG_URL=file:$TESTTMP/a
+
transaction abort!
rollback completed
abort: pretxnchangegroup.forbid1 hook exited with status 1
@@ -352,14 +729,21 @@
$ rm .hg/hgrc
$ cat > ../a/.hg/hgrc <<EOF
> [hooks]
- > preoutgoing = sh -c "printenv.py preoutgoing"
- > outgoing = sh -c "printenv.py outgoing"
+ > preoutgoing = sh -c "printenv.py --line preoutgoing"
+ > outgoing = sh -c "printenv.py --line outgoing"
> EOF
$ hg pull ../a
pulling from ../a
searching for changes
- preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
- outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
+ preoutgoing hook: HG_HOOKNAME=preoutgoing
+ HG_HOOKTYPE=preoutgoing
+ HG_SOURCE=pull
+
+ outgoing hook: HG_HOOKNAME=outgoing
+ HG_HOOKTYPE=outgoing
+ HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
+ HG_SOURCE=pull
+
adding changesets
adding manifests
adding file changes
@@ -373,13 +757,19 @@
preoutgoing hook can prevent outgoing changes
$ cat >> ../a/.hg/hgrc <<EOF
- > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
+ > preoutgoing.forbid = sh -c "printenv.py --line preoutgoing.forbid 1"
> EOF
$ hg pull ../a
pulling from ../a
searching for changes
- preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
- preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
+ preoutgoing hook: HG_HOOKNAME=preoutgoing
+ HG_HOOKTYPE=preoutgoing
+ HG_SOURCE=pull
+
+ preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid
+ HG_HOOKTYPE=preoutgoing
+ HG_SOURCE=pull
+
abort: preoutgoing.forbid hook exited with status 1
[255]
@@ -388,12 +778,19 @@
$ cd ..
$ cat > a/.hg/hgrc <<EOF
> [hooks]
- > preoutgoing = sh -c "printenv.py preoutgoing"
- > outgoing = sh -c "printenv.py outgoing"
+ > preoutgoing = sh -c "printenv.py --line preoutgoing"
+ > outgoing = sh -c "printenv.py --line outgoing"
> EOF
$ hg clone a c
- preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
- outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
+ preoutgoing hook: HG_HOOKNAME=preoutgoing
+ HG_HOOKTYPE=preoutgoing
+ HG_SOURCE=clone
+
+ outgoing hook: HG_HOOKNAME=outgoing
+ HG_HOOKTYPE=outgoing
+ HG_NODE=0000000000000000000000000000000000000000
+ HG_SOURCE=clone
+
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ rm -rf c
@@ -401,11 +798,17 @@
preoutgoing hook can prevent outgoing changes for local clones
$ cat >> a/.hg/hgrc <<EOF
- > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
+ > preoutgoing.forbid = sh -c "printenv.py --line preoutgoing.forbid 1"
> EOF
$ hg clone a zzz
- preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
- preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
+ preoutgoing hook: HG_HOOKNAME=preoutgoing
+ HG_HOOKTYPE=preoutgoing
+ HG_SOURCE=clone
+
+ preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid
+ HG_HOOKTYPE=preoutgoing
+ HG_SOURCE=clone
+
abort: preoutgoing.forbid hook exited with status 1
[255]
@@ -780,10 +1183,16 @@
$ cd ..
$ cat << EOF >> hgrc-with-post-init-hook
> [hooks]
- > post-init = sh -c "printenv.py post-init"
+ > post-init = sh -c "printenv.py --line post-init"
> EOF
$ HGRCPATH=hgrc-with-post-init-hook hg init to
- post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
+ post-init hook: HG_ARGS=init to
+ HG_HOOKNAME=post-init
+ HG_HOOKTYPE=post-init
+ HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''}
+ HG_PATS=['to']
+ HG_RESULT=0
+
new commits must be visible in pretxnchangegroup (issue3428)