Show More
@@ -985,7 +985,7 b' class localrepository(object):' | |||||
985 | validator=validate) |
|
985 | validator=validate) | |
986 |
|
986 | |||
987 | trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest() |
|
987 | trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest() | |
988 |
tr.hookargs[' |
|
988 | tr.hookargs['txnid'] = trid | |
989 | # note: writing the fncache only during finalize mean that the file is |
|
989 | # note: writing the fncache only during finalize mean that the file is | |
990 | # outdated when running hooks. As fncache is used for streaming clone, |
|
990 | # outdated when running hooks. As fncache is used for streaming clone, | |
991 | # this is not expected to break anything that happen during the hooks. |
|
991 | # this is not expected to break anything that happen during the hooks. |
@@ -1,6 +1,11 b'' | |||||
1 | commit hooks can see env vars |
|
1 | commit hooks can see env vars | |
2 | (and post-transaction one are run unlocked) |
|
2 | (and post-transaction one are run unlocked) | |
3 |
|
3 | |||
|
4 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF | |||
|
5 | > def showargs(ui, repo, hooktype, **kwargs): | |||
|
6 | > ui.write('%s python hook: %s\n' % (hooktype, ','.join(sorted(kwargs)))) | |||
|
7 | > EOF | |||
|
8 | ||||
4 |
$ |
|
9 | $ hg init a | |
5 | $ cd a |
|
10 | $ cd a | |
6 | $ cat > .hg/hgrc <<EOF |
|
11 | $ cat > .hg/hgrc <<EOF | |
@@ -16,7 +21,8 b' commit hooks can see env vars' | |||||
16 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen" |
|
21 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen" | |
17 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose" |
|
22 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose" | |
18 | > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose" |
|
23 | > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose" | |
19 | > txnabort = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort" |
|
24 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs | |
|
25 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort" | |||
20 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" |
|
26 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" | |
21 | > EOF |
|
27 | > EOF | |
22 | $ echo a > a |
|
28 | $ echo a > a | |
@@ -164,6 +170,7 b' more there after' | |||||
164 | 5:6f611f8018c1 |
|
170 | 5:6f611f8018c1 | |
165 | pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
171 | pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
166 | transaction abort! |
|
172 | transaction abort! | |
|
173 | txnabort python hook: txnid,txnname | |||
167 | txnabort hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
174 | txnabort hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
168 | rollback completed |
|
175 | rollback completed | |
169 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
176 | abort: pretxncommit.forbid1 hook exited with status 1 |
General Comments 0
You need to be logged in to leave comments.
Login now