Show More
@@ -1,818 +1,818 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 << EOF >> $HGRCPATH |
|
4 | $ cat << EOF >> $HGRCPATH | |
5 | > [experimental] |
|
5 | > [experimental] | |
6 | > # drop me once bundle2 is the default, |
|
6 | > # drop me once bundle2 is the default, | |
7 | > # added to get test change early. |
|
7 | > # added to get test change early. | |
8 | > bundle2-exp = True |
|
8 | > bundle2-exp = True | |
9 | > EOF |
|
9 | > EOF | |
10 |
|
10 | |||
11 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF |
|
11 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF | |
12 | > def showargs(ui, repo, hooktype, **kwargs): |
|
12 | > def showargs(ui, repo, hooktype, **kwargs): | |
13 | > ui.write('%s python hook: %s\n' % (hooktype, ','.join(sorted(kwargs)))) |
|
13 | > ui.write('%s python hook: %s\n' % (hooktype, ','.join(sorted(kwargs)))) | |
14 | > EOF |
|
14 | > EOF | |
15 |
|
15 | |||
16 | $ hg init a |
|
16 | $ hg init a | |
17 | $ cd a |
|
17 | $ cd a | |
18 | $ cat > .hg/hgrc <<EOF |
|
18 | $ cat > .hg/hgrc <<EOF | |
19 | > [hooks] |
|
19 | > [hooks] | |
20 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" |
|
20 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" | |
21 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" |
|
21 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" | |
22 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" |
|
22 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" | |
23 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" |
|
23 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" | |
24 | > pretxncommit.tip = hg -q tip |
|
24 | > pretxncommit.tip = hg -q tip | |
25 | > pre-identify = printenv.py pre-identify 1 |
|
25 | > pre-identify = printenv.py pre-identify 1 | |
26 | > pre-cat = printenv.py pre-cat |
|
26 | > pre-cat = printenv.py pre-cat | |
27 | > post-cat = printenv.py post-cat |
|
27 | > post-cat = printenv.py post-cat | |
28 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" |
|
28 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" | |
29 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" |
|
29 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" | |
30 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" |
|
30 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" | |
31 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs |
|
31 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs | |
32 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" |
|
32 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" | |
33 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" |
|
33 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" | |
34 | > EOF |
|
34 | > EOF | |
35 | $ echo a > a |
|
35 | $ echo a > a | |
36 | $ hg add a |
|
36 | $ hg add a | |
37 | $ hg commit -m a |
|
37 | $ hg commit -m a | |
38 | precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 |
|
38 | precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 | |
39 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
39 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
40 | pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a |
|
40 | pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a | |
41 | 0:cb9a9f314b8b |
|
41 | 0:cb9a9f314b8b | |
42 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
42 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
43 | txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
43 | txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
44 | commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
44 | commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
45 | commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
45 | commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
46 |
|
46 | |||
47 | $ hg clone . ../b |
|
47 | $ hg clone . ../b | |
48 | updating to branch default |
|
48 | updating to branch default | |
49 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
49 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
50 | $ cd ../b |
|
50 | $ cd ../b | |
51 |
|
51 | |||
52 | changegroup hooks can see env vars |
|
52 | changegroup hooks can see env vars | |
53 |
|
53 | |||
54 | $ cat > .hg/hgrc <<EOF |
|
54 | $ cat > .hg/hgrc <<EOF | |
55 | > [hooks] |
|
55 | > [hooks] | |
56 | > prechangegroup = printenv.py prechangegroup |
|
56 | > prechangegroup = printenv.py prechangegroup | |
57 | > changegroup = printenv.py changegroup |
|
57 | > changegroup = printenv.py changegroup | |
58 | > incoming = printenv.py incoming |
|
58 | > incoming = printenv.py incoming | |
59 | > EOF |
|
59 | > EOF | |
60 |
|
60 | |||
61 | pretxncommit and commit hooks can see both parents of merge |
|
61 | pretxncommit and commit hooks can see both parents of merge | |
62 |
|
62 | |||
63 | $ cd ../a |
|
63 | $ cd ../a | |
64 | $ echo b >> a |
|
64 | $ echo b >> a | |
65 | $ hg commit -m a1 -d "1 0" |
|
65 | $ hg commit -m a1 -d "1 0" | |
66 | precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
66 | precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
67 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
67 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
68 | pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
68 | pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
69 | 1:ab228980c14d |
|
69 | 1:ab228980c14d | |
70 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
70 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
71 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
71 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
72 | commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
72 | commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
73 | commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
73 | commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
74 | $ hg update -C 0 |
|
74 | $ hg update -C 0 | |
75 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 | $ echo b > b |
|
76 | $ echo b > b | |
77 | $ hg add b |
|
77 | $ hg add b | |
78 | $ hg commit -m b -d '1 0' |
|
78 | $ hg commit -m b -d '1 0' | |
79 | precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
79 | precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
80 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
80 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
81 | pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
81 | pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
82 | 2:ee9deb46ab31 |
|
82 | 2:ee9deb46ab31 | |
83 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
83 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
84 | created new head |
|
84 | created new head | |
85 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
85 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
86 | commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
86 | commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
87 | commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
87 | commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
88 | $ hg merge 1 |
|
88 | $ hg merge 1 | |
89 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
89 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
90 | (branch merge, don't forget to commit) |
|
90 | (branch merge, don't forget to commit) | |
91 | $ hg commit -m merge -d '2 0' |
|
91 | $ hg commit -m merge -d '2 0' | |
92 | precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
92 | precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
93 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
93 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
94 | pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a |
|
94 | pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a | |
95 | 3:07f3376c1e65 |
|
95 | 3:07f3376c1e65 | |
96 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
96 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
97 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
97 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
98 | commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
98 | commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
99 | commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
99 | commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
100 |
|
100 | |||
101 | test generic hooks |
|
101 | test generic hooks | |
102 |
|
102 | |||
103 | $ hg id |
|
103 | $ hg id | |
104 | pre-identify hook: HG_ARGS=id HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[] |
|
104 | pre-identify hook: HG_ARGS=id HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[] | |
105 | abort: pre-identify hook exited with status 1 |
|
105 | abort: pre-identify hook exited with status 1 | |
106 | [255] |
|
106 | [255] | |
107 | $ hg cat b |
|
107 | $ hg cat b | |
108 | pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] |
|
108 | pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] | |
109 | b |
|
109 | b | |
110 | post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0 |
|
110 | post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0 | |
111 |
|
111 | |||
112 | $ cd ../b |
|
112 | $ cd ../b | |
113 | $ hg pull ../a |
|
113 | $ hg pull ../a | |
114 | pulling from ../a |
|
114 | pulling from ../a | |
115 | searching for changes |
|
115 | searching for changes | |
116 | prechangegroup hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
116 | prechangegroup hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
117 | adding changesets |
|
117 | adding changesets | |
118 | adding manifests |
|
118 | adding manifests | |
119 | adding file changes |
|
119 | adding file changes | |
120 | added 3 changesets with 2 changes to 2 files |
|
120 | added 3 changesets with 2 changes to 2 files | |
121 | changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
121 | changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
122 | incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
122 | incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
123 | incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
123 | incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
124 | incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
124 | incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
125 | (run 'hg update' to get a working copy) |
|
125 | (run 'hg update' to get a working copy) | |
126 |
|
126 | |||
127 | tag hooks can see env vars |
|
127 | tag hooks can see env vars | |
128 |
|
128 | |||
129 | $ cd ../a |
|
129 | $ cd ../a | |
130 | $ cat >> .hg/hgrc <<EOF |
|
130 | $ cat >> .hg/hgrc <<EOF | |
131 | > pretag = printenv.py pretag |
|
131 | > pretag = printenv.py pretag | |
132 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" |
|
132 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" | |
133 | > EOF |
|
133 | > EOF | |
134 | $ hg tag -d '3 0' a |
|
134 | $ hg tag -d '3 0' a | |
135 | pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
135 | pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
136 | precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
136 | precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
137 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
137 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
138 | pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a |
|
138 | pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a | |
139 | 4:539e4b31b6dc |
|
139 | 4:539e4b31b6dc | |
140 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
140 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
141 | tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
141 | tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
142 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
142 | txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
143 | commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
143 | commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
144 | commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
144 | commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
145 | $ hg tag -l la |
|
145 | $ hg tag -l la | |
146 | pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
146 | pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la | |
147 | tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
147 | tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la | |
148 |
|
148 | |||
149 | pretag hook can forbid tagging |
|
149 | pretag hook can forbid tagging | |
150 |
|
150 | |||
151 | $ echo "pretag.forbid = printenv.py pretag.forbid 1" >> .hg/hgrc |
|
151 | $ echo "pretag.forbid = printenv.py pretag.forbid 1" >> .hg/hgrc | |
152 | $ hg tag -d '4 0' fa |
|
152 | $ hg tag -d '4 0' fa | |
153 | pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
153 | pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa | |
154 | pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
154 | pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa | |
155 | abort: pretag.forbid hook exited with status 1 |
|
155 | abort: pretag.forbid hook exited with status 1 | |
156 | [255] |
|
156 | [255] | |
157 | $ hg tag -l fla |
|
157 | $ hg tag -l fla | |
158 | pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
158 | pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla | |
159 | pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
159 | pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla | |
160 | abort: pretag.forbid hook exited with status 1 |
|
160 | abort: pretag.forbid hook exited with status 1 | |
161 | [255] |
|
161 | [255] | |
162 |
|
162 | |||
163 | pretxncommit hook can see changeset, can roll back txn, changeset no |
|
163 | pretxncommit hook can see changeset, can roll back txn, changeset no | |
164 | more there after |
|
164 | more there after | |
165 |
|
165 | |||
166 | $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc |
|
166 | $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc | |
167 | $ echo "pretxncommit.forbid1 = printenv.py pretxncommit.forbid 1" >> .hg/hgrc |
|
167 | $ echo "pretxncommit.forbid1 = printenv.py pretxncommit.forbid 1" >> .hg/hgrc | |
168 | $ echo z > z |
|
168 | $ echo z > z | |
169 | $ hg add z |
|
169 | $ hg add z | |
170 | $ hg -q tip |
|
170 | $ hg -q tip | |
171 | 4:539e4b31b6dc |
|
171 | 4:539e4b31b6dc | |
172 | $ hg commit -m 'fail' -d '4 0' |
|
172 | $ hg commit -m 'fail' -d '4 0' | |
173 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
173 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
174 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
174 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
175 | pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
175 | pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
176 | 5:6f611f8018c1 |
|
176 | 5:6f611f8018c1 | |
177 | 5:6f611f8018c1 |
|
177 | 5:6f611f8018c1 | |
178 | pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
178 | pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
179 | transaction abort! |
|
179 | transaction abort! | |
180 | txnabort python hook: txnid,txnname |
|
180 | txnabort python hook: txnid,txnname | |
181 | txnabort hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
|
181 | txnabort hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
182 | rollback completed |
|
182 | rollback completed | |
183 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
183 | abort: pretxncommit.forbid1 hook exited with status 1 | |
184 | [255] |
|
184 | [255] | |
185 | $ hg -q tip |
|
185 | $ hg -q tip | |
186 | 4:539e4b31b6dc |
|
186 | 4:539e4b31b6dc | |
187 |
|
187 | |||
188 | (Check that no 'changelog.i.a' file were left behind) |
|
188 | (Check that no 'changelog.i.a' file were left behind) | |
189 |
|
189 | |||
190 | $ ls -1 .hg/store/ |
|
190 | $ ls -1 .hg/store/ | |
191 | 00changelog.i |
|
191 | 00changelog.i | |
192 | 00manifest.i |
|
192 | 00manifest.i | |
193 | data |
|
193 | data | |
194 | fncache |
|
194 | fncache | |
195 | journal.phaseroots |
|
195 | journal.phaseroots | |
196 | phaseroots |
|
196 | phaseroots | |
197 | undo |
|
197 | undo | |
198 | undo.backup.fncache |
|
198 | undo.backup.fncache | |
199 | undo.backupfiles |
|
199 | undo.backupfiles | |
200 | undo.phaseroots |
|
200 | undo.phaseroots | |
201 |
|
201 | |||
202 |
|
202 | |||
203 | precommit hook can prevent commit |
|
203 | precommit hook can prevent commit | |
204 |
|
204 | |||
205 | $ echo "precommit.forbid = printenv.py precommit.forbid 1" >> .hg/hgrc |
|
205 | $ echo "precommit.forbid = printenv.py precommit.forbid 1" >> .hg/hgrc | |
206 | $ hg commit -m 'fail' -d '4 0' |
|
206 | $ hg commit -m 'fail' -d '4 0' | |
207 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
207 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
208 | precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
208 | precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
209 | abort: precommit.forbid hook exited with status 1 |
|
209 | abort: precommit.forbid hook exited with status 1 | |
210 | [255] |
|
210 | [255] | |
211 | $ hg -q tip |
|
211 | $ hg -q tip | |
212 | 4:539e4b31b6dc |
|
212 | 4:539e4b31b6dc | |
213 |
|
213 | |||
214 | preupdate hook can prevent update |
|
214 | preupdate hook can prevent update | |
215 |
|
215 | |||
216 | $ echo "preupdate = printenv.py preupdate" >> .hg/hgrc |
|
216 | $ echo "preupdate = printenv.py preupdate" >> .hg/hgrc | |
217 | $ hg update 1 |
|
217 | $ hg update 1 | |
218 | preupdate hook: HG_PARENT1=ab228980c14d |
|
218 | preupdate hook: HG_PARENT1=ab228980c14d | |
219 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
219 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
220 |
|
220 | |||
221 | update hook |
|
221 | update hook | |
222 |
|
222 | |||
223 | $ echo "update = printenv.py update" >> .hg/hgrc |
|
223 | $ echo "update = printenv.py update" >> .hg/hgrc | |
224 | $ hg update |
|
224 | $ hg update | |
225 | preupdate hook: HG_PARENT1=539e4b31b6dc |
|
225 | preupdate hook: HG_PARENT1=539e4b31b6dc | |
226 | update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc |
|
226 | update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc | |
227 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
227 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
228 |
|
228 | |||
229 | pushkey hook |
|
229 | pushkey hook | |
230 |
|
230 | |||
231 | $ echo "pushkey = printenv.py pushkey" >> .hg/hgrc |
|
231 | $ echo "pushkey = printenv.py pushkey" >> .hg/hgrc | |
232 | $ cd ../b |
|
232 | $ cd ../b | |
233 | $ hg bookmark -r null foo |
|
233 | $ hg bookmark -r null foo | |
234 | $ hg push -B foo ../a |
|
234 | $ hg push -B foo ../a | |
235 | pushing to ../a |
|
235 | pushing to ../a | |
236 | searching for changes |
|
236 | searching for changes | |
237 | no changes found |
|
237 | no changes found | |
238 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob) |
|
238 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob) | |
239 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob) |
|
239 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob) | |
240 | pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 |
|
240 | pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 | |
241 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob) |
|
241 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob) | |
242 | exporting bookmark foo |
|
242 | exporting bookmark foo | |
243 | [1] |
|
243 | [1] | |
244 | $ cd ../a |
|
244 | $ cd ../a | |
245 |
|
245 | |||
246 | listkeys hook |
|
246 | listkeys hook | |
247 |
|
247 | |||
248 | $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc |
|
248 | $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc | |
249 | $ hg bookmark -r null bar |
|
249 | $ hg bookmark -r null bar | |
250 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
250 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |
251 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
251 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |
252 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
252 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |
253 | $ cd ../b |
|
253 | $ cd ../b | |
254 | $ hg pull -B bar ../a |
|
254 | $ hg pull -B bar ../a | |
255 | pulling from ../a |
|
255 | pulling from ../a | |
256 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
256 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} | |
257 | no changes found |
|
257 | no changes found | |
258 | listkeys hook: HG_NAMESPACE=phase HG_VALUES={} |
|
258 | listkeys hook: HG_NAMESPACE=phase HG_VALUES={} | |
259 | adding remote bookmark bar |
|
259 | adding remote bookmark bar | |
260 | listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} |
|
260 | listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} | |
261 | $ cd ../a |
|
261 | $ cd ../a | |
262 |
|
262 | |||
263 | test that prepushkey can prevent incoming keys |
|
263 | test that prepushkey can prevent incoming keys | |
264 |
|
264 | |||
265 | $ echo "prepushkey = printenv.py prepushkey.forbid 1" >> .hg/hgrc |
|
265 | $ echo "prepushkey = printenv.py prepushkey.forbid 1" >> .hg/hgrc | |
266 | $ cd ../b |
|
266 | $ cd ../b | |
267 | $ hg bookmark -r null baz |
|
267 | $ hg bookmark -r null baz | |
268 | $ hg push -B baz ../a |
|
268 | $ hg push -B baz ../a | |
269 | pushing to ../a |
|
269 | pushing to ../a | |
270 | searching for changes |
|
270 | searching for changes | |
271 | listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} |
|
271 | listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} | |
272 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
272 | listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} | |
273 | no changes found |
|
273 | no changes found | |
274 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob) |
|
274 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob) | |
275 | prepushkey.forbid hook: HG_BUNDLE2=1 HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:* HG_URL=push (glob) |
|
275 | prepushkey.forbid hook: HG_BUNDLE2=1 HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:* HG_URL=push (glob) | |
276 | pushkey-abort: prepushkey hook exited with status 1 |
|
276 | pushkey-abort: prepushkey hook exited with status 1 | |
277 | abort: exporting bookmark baz failed! |
|
277 | abort: exporting bookmark baz failed! | |
278 | [255] |
|
278 | [255] | |
279 | $ cd ../a |
|
279 | $ cd ../a | |
280 |
|
280 | |||
281 | test that prelistkeys can prevent listing keys |
|
281 | test that prelistkeys can prevent listing keys | |
282 |
|
282 | |||
283 | $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc |
|
283 | $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc | |
284 | $ hg bookmark -r null quux |
|
284 | $ hg bookmark -r null quux | |
285 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
285 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |
286 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
286 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |
287 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) |
|
287 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob) | |
288 | $ cd ../b |
|
288 | $ cd ../b | |
289 | $ hg pull -B quux ../a |
|
289 | $ hg pull -B quux ../a | |
290 | pulling from ../a |
|
290 | pulling from ../a | |
291 | prelistkeys.forbid hook: HG_NAMESPACE=bookmarks |
|
291 | prelistkeys.forbid hook: HG_NAMESPACE=bookmarks | |
292 | abort: prelistkeys hook exited with status 1 |
|
292 | abort: prelistkeys hook exited with status 1 | |
293 | [255] |
|
293 | [255] | |
294 | $ cd ../a |
|
294 | $ cd ../a | |
295 | $ rm .hg/hgrc |
|
295 | $ rm .hg/hgrc | |
296 |
|
296 | |||
297 | prechangegroup hook can prevent incoming changes |
|
297 | prechangegroup hook can prevent incoming changes | |
298 |
|
298 | |||
299 | $ cd ../b |
|
299 | $ cd ../b | |
300 | $ hg -q tip |
|
300 | $ hg -q tip | |
301 | 3:07f3376c1e65 |
|
301 | 3:07f3376c1e65 | |
302 | $ cat > .hg/hgrc <<EOF |
|
302 | $ cat > .hg/hgrc <<EOF | |
303 | > [hooks] |
|
303 | > [hooks] | |
304 | > prechangegroup.forbid = printenv.py prechangegroup.forbid 1 |
|
304 | > prechangegroup.forbid = printenv.py prechangegroup.forbid 1 | |
305 | > EOF |
|
305 | > EOF | |
306 | $ hg pull ../a |
|
306 | $ hg pull ../a | |
307 | pulling from ../a |
|
307 | pulling from ../a | |
308 | searching for changes |
|
308 | searching for changes | |
309 | prechangegroup.forbid hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
309 | prechangegroup.forbid hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
310 | abort: prechangegroup.forbid hook exited with status 1 |
|
310 | abort: prechangegroup.forbid hook exited with status 1 | |
311 | [255] |
|
311 | [255] | |
312 |
|
312 | |||
313 | pretxnchangegroup hook can see incoming changes, can roll back txn, |
|
313 | pretxnchangegroup hook can see incoming changes, can roll back txn, | |
314 | incoming changes no longer there after |
|
314 | incoming changes no longer there after | |
315 |
|
315 | |||
316 | $ cat > .hg/hgrc <<EOF |
|
316 | $ cat > .hg/hgrc <<EOF | |
317 | > [hooks] |
|
317 | > [hooks] | |
318 | > pretxnchangegroup.forbid0 = hg tip -q |
|
318 | > pretxnchangegroup.forbid0 = hg tip -q | |
319 | > pretxnchangegroup.forbid1 = printenv.py pretxnchangegroup.forbid 1 |
|
319 | > pretxnchangegroup.forbid1 = printenv.py pretxnchangegroup.forbid 1 | |
320 | > EOF |
|
320 | > EOF | |
321 | $ hg pull ../a |
|
321 | $ hg pull ../a | |
322 | pulling from ../a |
|
322 | pulling from ../a | |
323 | searching for changes |
|
323 | searching for changes | |
324 | adding changesets |
|
324 | adding changesets | |
325 | adding manifests |
|
325 | adding manifests | |
326 | adding file changes |
|
326 | adding file changes | |
327 | added 1 changesets with 1 changes to 1 files |
|
327 | added 1 changesets with 1 changes to 1 files | |
328 | 4:539e4b31b6dc |
|
328 | 4:539e4b31b6dc | |
329 | pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) |
|
329 | pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) | |
330 | transaction abort! |
|
330 | transaction abort! | |
331 | rollback completed |
|
331 | rollback completed | |
332 | abort: pretxnchangegroup.forbid1 hook exited with status 1 |
|
332 | abort: pretxnchangegroup.forbid1 hook exited with status 1 | |
333 | [255] |
|
333 | [255] | |
334 | $ hg -q tip |
|
334 | $ hg -q tip | |
335 | 3:07f3376c1e65 |
|
335 | 3:07f3376c1e65 | |
336 |
|
336 | |||
337 | outgoing hooks can see env vars |
|
337 | outgoing hooks can see env vars | |
338 |
|
338 | |||
339 | $ rm .hg/hgrc |
|
339 | $ rm .hg/hgrc | |
340 | $ cat > ../a/.hg/hgrc <<EOF |
|
340 | $ cat > ../a/.hg/hgrc <<EOF | |
341 | > [hooks] |
|
341 | > [hooks] | |
342 | > preoutgoing = printenv.py preoutgoing |
|
342 | > preoutgoing = printenv.py preoutgoing | |
343 | > outgoing = printenv.py outgoing |
|
343 | > outgoing = printenv.py outgoing | |
344 | > EOF |
|
344 | > EOF | |
345 | $ hg pull ../a |
|
345 | $ hg pull ../a | |
346 | pulling from ../a |
|
346 | pulling from ../a | |
347 | searching for changes |
|
347 | searching for changes | |
348 | preoutgoing hook: HG_SOURCE=pull |
|
348 | preoutgoing hook: HG_SOURCE=pull | |
349 | outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull |
|
349 | outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull | |
350 | adding changesets |
|
350 | adding changesets | |
351 | adding manifests |
|
351 | adding manifests | |
352 | adding file changes |
|
352 | adding file changes | |
353 | added 1 changesets with 1 changes to 1 files |
|
353 | added 1 changesets with 1 changes to 1 files | |
354 | adding remote bookmark quux |
|
354 | adding remote bookmark quux | |
355 | (run 'hg update' to get a working copy) |
|
355 | (run 'hg update' to get a working copy) | |
356 | $ hg rollback |
|
356 | $ hg rollback | |
357 | repository tip rolled back to revision 3 (undo pull) |
|
357 | repository tip rolled back to revision 3 (undo pull) | |
358 |
|
358 | |||
359 | preoutgoing hook can prevent outgoing changes |
|
359 | preoutgoing hook can prevent outgoing changes | |
360 |
|
360 | |||
361 | $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> ../a/.hg/hgrc |
|
361 | $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> ../a/.hg/hgrc | |
362 | $ hg pull ../a |
|
362 | $ hg pull ../a | |
363 | pulling from ../a |
|
363 | pulling from ../a | |
364 | searching for changes |
|
364 | searching for changes | |
365 | preoutgoing hook: HG_SOURCE=pull |
|
365 | preoutgoing hook: HG_SOURCE=pull | |
366 | preoutgoing.forbid hook: HG_SOURCE=pull |
|
366 | preoutgoing.forbid hook: HG_SOURCE=pull | |
367 | abort: preoutgoing.forbid hook exited with status 1 |
|
367 | abort: preoutgoing.forbid hook exited with status 1 | |
368 | [255] |
|
368 | [255] | |
369 |
|
369 | |||
370 | outgoing hooks work for local clones |
|
370 | outgoing hooks work for local clones | |
371 |
|
371 | |||
372 | $ cd .. |
|
372 | $ cd .. | |
373 | $ cat > a/.hg/hgrc <<EOF |
|
373 | $ cat > a/.hg/hgrc <<EOF | |
374 | > [hooks] |
|
374 | > [hooks] | |
375 | > preoutgoing = printenv.py preoutgoing |
|
375 | > preoutgoing = printenv.py preoutgoing | |
376 | > outgoing = printenv.py outgoing |
|
376 | > outgoing = printenv.py outgoing | |
377 | > EOF |
|
377 | > EOF | |
378 | $ hg clone a c |
|
378 | $ hg clone a c | |
379 | preoutgoing hook: HG_SOURCE=clone |
|
379 | preoutgoing hook: HG_SOURCE=clone | |
380 | outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone |
|
380 | outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone | |
381 | updating to branch default |
|
381 | updating to branch default | |
382 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
383 | $ rm -rf c |
|
383 | $ rm -rf c | |
384 |
|
384 | |||
385 | preoutgoing hook can prevent outgoing changes for local clones |
|
385 | preoutgoing hook can prevent outgoing changes for local clones | |
386 |
|
386 | |||
387 | $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> a/.hg/hgrc |
|
387 | $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> a/.hg/hgrc | |
388 | $ hg clone a zzz |
|
388 | $ hg clone a zzz | |
389 | preoutgoing hook: HG_SOURCE=clone |
|
389 | preoutgoing hook: HG_SOURCE=clone | |
390 | preoutgoing.forbid hook: HG_SOURCE=clone |
|
390 | preoutgoing.forbid hook: HG_SOURCE=clone | |
391 | abort: preoutgoing.forbid hook exited with status 1 |
|
391 | abort: preoutgoing.forbid hook exited with status 1 | |
392 | [255] |
|
392 | [255] | |
393 |
|
393 | |||
394 | $ cd "$TESTTMP/b" |
|
394 | $ cd "$TESTTMP/b" | |
395 |
|
395 | |||
396 | $ cat > hooktests.py <<EOF |
|
396 | $ cat > hooktests.py <<EOF | |
397 | > from mercurial import error |
|
397 | > from mercurial import error | |
398 | > |
|
398 | > | |
399 | > uncallable = 0 |
|
399 | > uncallable = 0 | |
400 | > |
|
400 | > | |
401 | > def printargs(args): |
|
401 | > def printargs(args): | |
402 | > args.pop('ui', None) |
|
402 | > args.pop('ui', None) | |
403 | > args.pop('repo', None) |
|
403 | > args.pop('repo', None) | |
404 | > a = list(args.items()) |
|
404 | > a = list(args.items()) | |
405 | > a.sort() |
|
405 | > a.sort() | |
406 | > print 'hook args:' |
|
406 | > print 'hook args:' | |
407 | > for k, v in a: |
|
407 | > for k, v in a: | |
408 | > print ' ', k, v |
|
408 | > print ' ', k, v | |
409 | > |
|
409 | > | |
410 | > def passhook(**args): |
|
410 | > def passhook(**args): | |
411 | > printargs(args) |
|
411 | > printargs(args) | |
412 | > |
|
412 | > | |
413 | > def failhook(**args): |
|
413 | > def failhook(**args): | |
414 | > printargs(args) |
|
414 | > printargs(args) | |
415 | > return True |
|
415 | > return True | |
416 | > |
|
416 | > | |
417 | > class LocalException(Exception): |
|
417 | > class LocalException(Exception): | |
418 | > pass |
|
418 | > pass | |
419 | > |
|
419 | > | |
420 | > def raisehook(**args): |
|
420 | > def raisehook(**args): | |
421 | > raise LocalException('exception from hook') |
|
421 | > raise LocalException('exception from hook') | |
422 | > |
|
422 | > | |
423 | > def aborthook(**args): |
|
423 | > def aborthook(**args): | |
424 | > raise error.Abort('raise abort from hook') |
|
424 | > raise error.Abort('raise abort from hook') | |
425 | > |
|
425 | > | |
426 | > def brokenhook(**args): |
|
426 | > def brokenhook(**args): | |
427 | > return 1 + {} |
|
427 | > return 1 + {} | |
428 | > |
|
428 | > | |
429 | > def verbosehook(ui, **args): |
|
429 | > def verbosehook(ui, **args): | |
430 | > ui.note('verbose output from hook\n') |
|
430 | > ui.note('verbose output from hook\n') | |
431 | > |
|
431 | > | |
432 | > def printtags(ui, repo, **args): |
|
432 | > def printtags(ui, repo, **args): | |
433 | > print sorted(repo.tags()) |
|
433 | > print sorted(repo.tags()) | |
434 | > |
|
434 | > | |
435 | > class container: |
|
435 | > class container: | |
436 | > unreachable = 1 |
|
436 | > unreachable = 1 | |
437 | > EOF |
|
437 | > EOF | |
438 |
|
438 | |||
439 | $ cat > syntaxerror.py << EOF |
|
439 | $ cat > syntaxerror.py << EOF | |
440 | > (foo |
|
440 | > (foo | |
441 | > EOF |
|
441 | > EOF | |
442 |
|
442 | |||
443 | test python hooks |
|
443 | test python hooks | |
444 |
|
444 | |||
445 | #if windows |
|
445 | #if windows | |
446 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" |
|
446 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" | |
447 | #else |
|
447 | #else | |
448 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" |
|
448 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" | |
449 | #endif |
|
449 | #endif | |
450 | $ export PYTHONPATH |
|
450 | $ export PYTHONPATH | |
451 |
|
451 | |||
452 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
452 | $ echo '[hooks]' > ../a/.hg/hgrc | |
453 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc |
|
453 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc | |
454 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
454 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
455 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
455 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
456 |
|
456 | |||
457 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
457 | $ echo '[hooks]' > ../a/.hg/hgrc | |
458 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc |
|
458 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc | |
459 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
459 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
460 | error: preoutgoing.raise hook raised an exception: exception from hook |
|
460 | error: preoutgoing.raise hook raised an exception: exception from hook | |
461 |
|
461 | |||
462 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
462 | $ echo '[hooks]' > ../a/.hg/hgrc | |
463 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc |
|
463 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc | |
464 | $ hg pull ../a |
|
464 | $ hg pull ../a | |
465 | pulling from ../a |
|
465 | pulling from ../a | |
466 | searching for changes |
|
466 | searching for changes | |
467 | error: preoutgoing.abort hook failed: raise abort from hook |
|
467 | error: preoutgoing.abort hook failed: raise abort from hook | |
468 | abort: raise abort from hook |
|
468 | abort: raise abort from hook | |
469 | [255] |
|
469 | [255] | |
470 |
|
470 | |||
471 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
471 | $ echo '[hooks]' > ../a/.hg/hgrc | |
472 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc |
|
472 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc | |
473 | $ hg pull ../a |
|
473 | $ hg pull ../a | |
474 | pulling from ../a |
|
474 | pulling from ../a | |
475 | searching for changes |
|
475 | searching for changes | |
476 | hook args: |
|
476 | hook args: | |
477 | hooktype preoutgoing |
|
477 | hooktype preoutgoing | |
478 | source pull |
|
478 | source pull | |
479 | abort: preoutgoing.fail hook failed |
|
479 | abort: preoutgoing.fail hook failed | |
480 | [255] |
|
480 | [255] | |
481 |
|
481 | |||
482 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
482 | $ echo '[hooks]' > ../a/.hg/hgrc | |
483 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc |
|
483 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc | |
484 | $ hg pull ../a |
|
484 | $ hg pull ../a | |
485 | pulling from ../a |
|
485 | pulling from ../a | |
486 | searching for changes |
|
486 | searching for changes | |
487 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable |
|
487 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable | |
488 | [255] |
|
488 | [255] | |
489 |
|
489 | |||
490 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
490 | $ echo '[hooks]' > ../a/.hg/hgrc | |
491 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc |
|
491 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc | |
492 | $ hg pull ../a |
|
492 | $ hg pull ../a | |
493 | pulling from ../a |
|
493 | pulling from ../a | |
494 | searching for changes |
|
494 | searching for changes | |
495 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined |
|
495 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined | |
496 | [255] |
|
496 | [255] | |
497 |
|
497 | |||
498 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
498 | $ echo '[hooks]' > ../a/.hg/hgrc | |
499 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc |
|
499 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc | |
500 | $ hg pull ../a |
|
500 | $ hg pull ../a | |
501 | pulling from ../a |
|
501 | pulling from ../a | |
502 | searching for changes |
|
502 | searching for changes | |
503 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module |
|
503 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module | |
504 | [255] |
|
504 | [255] | |
505 |
|
505 | |||
506 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
506 | $ echo '[hooks]' > ../a/.hg/hgrc | |
507 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc |
|
507 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc | |
508 | $ hg pull ../a |
|
508 | $ hg pull ../a | |
509 | pulling from ../a |
|
509 | pulling from ../a | |
510 | searching for changes |
|
510 | searching for changes | |
511 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed |
|
511 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed | |
512 | (run with --traceback for stack trace) |
|
512 | (run with --traceback for stack trace) | |
513 | [255] |
|
513 | [255] | |
514 |
|
514 | |||
515 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
515 | $ echo '[hooks]' > ../a/.hg/hgrc | |
516 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc |
|
516 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc | |
517 | $ hg pull ../a |
|
517 | $ hg pull ../a | |
518 | pulling from ../a |
|
518 | pulling from ../a | |
519 | searching for changes |
|
519 | searching for changes | |
520 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed |
|
520 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed | |
521 | (run with --traceback for stack trace) |
|
521 | (run with --traceback for stack trace) | |
522 | [255] |
|
522 | [255] | |
523 |
|
523 | |||
524 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
524 | $ echo '[hooks]' > ../a/.hg/hgrc | |
525 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc |
|
525 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc | |
526 | $ hg pull ../a |
|
526 | $ hg pull ../a | |
527 | pulling from ../a |
|
527 | pulling from ../a | |
528 | searching for changes |
|
528 | searching for changes | |
529 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
529 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
530 | (run with --traceback for stack trace) |
|
530 | (run with --traceback for stack trace) | |
531 | [255] |
|
531 | [255] | |
532 |
|
532 | |||
533 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' |
|
533 | The second egrep is to filter out lines like ' ^', which are slightly | |
|
534 | different between Python 2.6 and Python 2.7. | |||
|
535 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' | |||
534 | pulling from ../a |
|
536 | pulling from ../a | |
535 | searching for changes |
|
537 | searching for changes | |
536 | exception from first failed import attempt: |
|
538 | exception from first failed import attempt: | |
537 | Traceback (most recent call last): |
|
539 | Traceback (most recent call last): | |
538 |
|
||||
539 | ^ |
|
|||
540 | SyntaxError: invalid syntax |
|
540 | SyntaxError: invalid syntax | |
541 | exception from second failed import attempt: |
|
541 | exception from second failed import attempt: | |
542 | Traceback (most recent call last): |
|
542 | Traceback (most recent call last): | |
543 | ImportError: No module named hgext_syntaxerror |
|
543 | ImportError: No module named hgext_syntaxerror | |
544 | Traceback (most recent call last): |
|
544 | Traceback (most recent call last): | |
545 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
545 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
546 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
546 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
547 |
|
547 | |||
548 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
548 | $ echo '[hooks]' > ../a/.hg/hgrc | |
549 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc |
|
549 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc | |
550 | $ hg pull ../a |
|
550 | $ hg pull ../a | |
551 | pulling from ../a |
|
551 | pulling from ../a | |
552 | searching for changes |
|
552 | searching for changes | |
553 | hook args: |
|
553 | hook args: | |
554 | hooktype preoutgoing |
|
554 | hooktype preoutgoing | |
555 | source pull |
|
555 | source pull | |
556 | adding changesets |
|
556 | adding changesets | |
557 | adding manifests |
|
557 | adding manifests | |
558 | adding file changes |
|
558 | adding file changes | |
559 | added 1 changesets with 1 changes to 1 files |
|
559 | added 1 changesets with 1 changes to 1 files | |
560 | adding remote bookmark quux |
|
560 | adding remote bookmark quux | |
561 | (run 'hg update' to get a working copy) |
|
561 | (run 'hg update' to get a working copy) | |
562 |
|
562 | |||
563 | post- python hooks that fail to *run* don't cause an abort |
|
563 | post- python hooks that fail to *run* don't cause an abort | |
564 | $ rm ../a/.hg/hgrc |
|
564 | $ rm ../a/.hg/hgrc | |
565 | $ echo '[hooks]' > .hg/hgrc |
|
565 | $ echo '[hooks]' > .hg/hgrc | |
566 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc |
|
566 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc | |
567 | $ hg pull ../a |
|
567 | $ hg pull ../a | |
568 | pulling from ../a |
|
568 | pulling from ../a | |
569 | searching for changes |
|
569 | searching for changes | |
570 | no changes found |
|
570 | no changes found | |
571 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
571 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
572 | (run with --traceback for stack trace) |
|
572 | (run with --traceback for stack trace) | |
573 |
|
573 | |||
574 | but post- python hooks that fail to *load* do |
|
574 | but post- python hooks that fail to *load* do | |
575 | $ echo '[hooks]' > .hg/hgrc |
|
575 | $ echo '[hooks]' > .hg/hgrc | |
576 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc |
|
576 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc | |
577 | $ hg pull ../a |
|
577 | $ hg pull ../a | |
578 | pulling from ../a |
|
578 | pulling from ../a | |
579 | searching for changes |
|
579 | searching for changes | |
580 | no changes found |
|
580 | no changes found | |
581 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module |
|
581 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module | |
582 | [255] |
|
582 | [255] | |
583 |
|
583 | |||
584 | $ echo '[hooks]' > .hg/hgrc |
|
584 | $ echo '[hooks]' > .hg/hgrc | |
585 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc |
|
585 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc | |
586 | $ hg pull ../a |
|
586 | $ hg pull ../a | |
587 | pulling from ../a |
|
587 | pulling from ../a | |
588 | searching for changes |
|
588 | searching for changes | |
589 | no changes found |
|
589 | no changes found | |
590 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed |
|
590 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed | |
591 | (run with --traceback for stack trace) |
|
591 | (run with --traceback for stack trace) | |
592 | [255] |
|
592 | [255] | |
593 |
|
593 | |||
594 | $ echo '[hooks]' > .hg/hgrc |
|
594 | $ echo '[hooks]' > .hg/hgrc | |
595 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc |
|
595 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc | |
596 | $ hg pull ../a |
|
596 | $ hg pull ../a | |
597 | pulling from ../a |
|
597 | pulling from ../a | |
598 | searching for changes |
|
598 | searching for changes | |
599 | no changes found |
|
599 | no changes found | |
600 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined |
|
600 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined | |
601 | [255] |
|
601 | [255] | |
602 |
|
602 | |||
603 | make sure --traceback works |
|
603 | make sure --traceback works | |
604 |
|
604 | |||
605 | $ echo '[hooks]' > .hg/hgrc |
|
605 | $ echo '[hooks]' > .hg/hgrc | |
606 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc |
|
606 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc | |
607 |
|
607 | |||
608 | $ echo aa > a |
|
608 | $ echo aa > a | |
609 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' |
|
609 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' | |
610 | Traceback (most recent call last): |
|
610 | Traceback (most recent call last): | |
611 |
|
611 | |||
612 | $ cd .. |
|
612 | $ cd .. | |
613 | $ hg init c |
|
613 | $ hg init c | |
614 | $ cd c |
|
614 | $ cd c | |
615 |
|
615 | |||
616 | $ cat > hookext.py <<EOF |
|
616 | $ cat > hookext.py <<EOF | |
617 | > def autohook(**args): |
|
617 | > def autohook(**args): | |
618 | > print "Automatically installed hook" |
|
618 | > print "Automatically installed hook" | |
619 | > |
|
619 | > | |
620 | > def reposetup(ui, repo): |
|
620 | > def reposetup(ui, repo): | |
621 | > repo.ui.setconfig("hooks", "commit.auto", autohook) |
|
621 | > repo.ui.setconfig("hooks", "commit.auto", autohook) | |
622 | > EOF |
|
622 | > EOF | |
623 | $ echo '[extensions]' >> .hg/hgrc |
|
623 | $ echo '[extensions]' >> .hg/hgrc | |
624 | $ echo 'hookext = hookext.py' >> .hg/hgrc |
|
624 | $ echo 'hookext = hookext.py' >> .hg/hgrc | |
625 |
|
625 | |||
626 | $ touch foo |
|
626 | $ touch foo | |
627 | $ hg add foo |
|
627 | $ hg add foo | |
628 | $ hg ci -d '0 0' -m 'add foo' |
|
628 | $ hg ci -d '0 0' -m 'add foo' | |
629 | Automatically installed hook |
|
629 | Automatically installed hook | |
630 | $ echo >> foo |
|
630 | $ echo >> foo | |
631 | $ hg ci --debug -d '0 0' -m 'change foo' |
|
631 | $ hg ci --debug -d '0 0' -m 'change foo' | |
632 | committing files: |
|
632 | committing files: | |
633 | foo |
|
633 | foo | |
634 | committing manifest |
|
634 | committing manifest | |
635 | committing changelog |
|
635 | committing changelog | |
636 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 |
|
636 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 | |
637 | calling hook commit.auto: hgext_hookext.autohook |
|
637 | calling hook commit.auto: hgext_hookext.autohook | |
638 | Automatically installed hook |
|
638 | Automatically installed hook | |
639 |
|
639 | |||
640 | $ hg showconfig hooks |
|
640 | $ hg showconfig hooks | |
641 | hooks.commit.auto=<function autohook at *> (glob) |
|
641 | hooks.commit.auto=<function autohook at *> (glob) | |
642 |
|
642 | |||
643 | test python hook configured with python:[file]:[hook] syntax |
|
643 | test python hook configured with python:[file]:[hook] syntax | |
644 |
|
644 | |||
645 | $ cd .. |
|
645 | $ cd .. | |
646 | $ mkdir d |
|
646 | $ mkdir d | |
647 | $ cd d |
|
647 | $ cd d | |
648 | $ hg init repo |
|
648 | $ hg init repo | |
649 | $ mkdir hooks |
|
649 | $ mkdir hooks | |
650 |
|
650 | |||
651 | $ cd hooks |
|
651 | $ cd hooks | |
652 | $ cat > testhooks.py <<EOF |
|
652 | $ cat > testhooks.py <<EOF | |
653 | > def testhook(**args): |
|
653 | > def testhook(**args): | |
654 | > print 'hook works' |
|
654 | > print 'hook works' | |
655 | > EOF |
|
655 | > EOF | |
656 | $ echo '[hooks]' > ../repo/.hg/hgrc |
|
656 | $ echo '[hooks]' > ../repo/.hg/hgrc | |
657 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc |
|
657 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc | |
658 |
|
658 | |||
659 | $ cd ../repo |
|
659 | $ cd ../repo | |
660 | $ hg commit -d '0 0' |
|
660 | $ hg commit -d '0 0' | |
661 | hook works |
|
661 | hook works | |
662 | nothing changed |
|
662 | nothing changed | |
663 | [1] |
|
663 | [1] | |
664 |
|
664 | |||
665 | $ echo '[hooks]' > .hg/hgrc |
|
665 | $ echo '[hooks]' > .hg/hgrc | |
666 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc |
|
666 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc | |
667 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc |
|
667 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc | |
668 |
|
668 | |||
669 | $ hg up null |
|
669 | $ hg up null | |
670 | loading update.ne hook failed: |
|
670 | loading update.ne hook failed: | |
671 | abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py |
|
671 | abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py | |
672 | [255] |
|
672 | [255] | |
673 |
|
673 | |||
674 | $ hg id |
|
674 | $ hg id | |
675 | loading pre-identify.npmd hook failed: |
|
675 | loading pre-identify.npmd hook failed: | |
676 | abort: No module named repo! |
|
676 | abort: No module named repo! | |
677 | [255] |
|
677 | [255] | |
678 |
|
678 | |||
679 | $ cd ../../b |
|
679 | $ cd ../../b | |
680 |
|
680 | |||
681 | make sure --traceback works on hook import failure |
|
681 | make sure --traceback works on hook import failure | |
682 |
|
682 | |||
683 | $ cat > importfail.py <<EOF |
|
683 | $ cat > importfail.py <<EOF | |
684 | > import somebogusmodule |
|
684 | > import somebogusmodule | |
685 | > # dereference something in the module to force demandimport to load it |
|
685 | > # dereference something in the module to force demandimport to load it | |
686 | > somebogusmodule.whatever |
|
686 | > somebogusmodule.whatever | |
687 | > EOF |
|
687 | > EOF | |
688 |
|
688 | |||
689 | $ echo '[hooks]' > .hg/hgrc |
|
689 | $ echo '[hooks]' > .hg/hgrc | |
690 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc |
|
690 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc | |
691 |
|
691 | |||
692 | $ echo a >> a |
|
692 | $ echo a >> a | |
693 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' |
|
693 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' | |
694 | exception from first failed import attempt: |
|
694 | exception from first failed import attempt: | |
695 | Traceback (most recent call last): |
|
695 | Traceback (most recent call last): | |
696 | ImportError: No module named somebogusmodule |
|
696 | ImportError: No module named somebogusmodule | |
697 | exception from second failed import attempt: |
|
697 | exception from second failed import attempt: | |
698 | Traceback (most recent call last): |
|
698 | Traceback (most recent call last): | |
699 | ImportError: No module named hgext_importfail |
|
699 | ImportError: No module named hgext_importfail | |
700 | Traceback (most recent call last): |
|
700 | Traceback (most recent call last): | |
701 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed |
|
701 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed | |
702 | abort: precommit.importfail hook is invalid: import of "importfail" failed |
|
702 | abort: precommit.importfail hook is invalid: import of "importfail" failed | |
703 |
|
703 | |||
704 | Issue1827: Hooks Update & Commit not completely post operation |
|
704 | Issue1827: Hooks Update & Commit not completely post operation | |
705 |
|
705 | |||
706 | commit and update hooks should run after command completion. The largefiles |
|
706 | commit and update hooks should run after command completion. The largefiles | |
707 | use demonstrates a recursive wlock, showing the hook doesn't run until the |
|
707 | use demonstrates a recursive wlock, showing the hook doesn't run until the | |
708 | final release (and dirstate flush). |
|
708 | final release (and dirstate flush). | |
709 |
|
709 | |||
710 | $ echo '[hooks]' > .hg/hgrc |
|
710 | $ echo '[hooks]' > .hg/hgrc | |
711 | $ echo 'commit = hg id' >> .hg/hgrc |
|
711 | $ echo 'commit = hg id' >> .hg/hgrc | |
712 | $ echo 'update = hg id' >> .hg/hgrc |
|
712 | $ echo 'update = hg id' >> .hg/hgrc | |
713 | $ echo bb > a |
|
713 | $ echo bb > a | |
714 | $ hg ci -ma |
|
714 | $ hg ci -ma | |
715 | 223eafe2750c tip |
|
715 | 223eafe2750c tip | |
716 | $ hg up 0 --config extensions.largefiles= |
|
716 | $ hg up 0 --config extensions.largefiles= | |
717 | cb9a9f314b8b |
|
717 | cb9a9f314b8b | |
718 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
718 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
719 |
|
719 | |||
720 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui |
|
720 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui | |
721 | that is passed to pre/post hooks |
|
721 | that is passed to pre/post hooks | |
722 |
|
722 | |||
723 | $ echo '[hooks]' > .hg/hgrc |
|
723 | $ echo '[hooks]' > .hg/hgrc | |
724 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc |
|
724 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc | |
725 | $ hg id |
|
725 | $ hg id | |
726 | cb9a9f314b8b |
|
726 | cb9a9f314b8b | |
727 | $ hg id --verbose |
|
727 | $ hg id --verbose | |
728 | calling hook pre-identify: hooktests.verbosehook |
|
728 | calling hook pre-identify: hooktests.verbosehook | |
729 | verbose output from hook |
|
729 | verbose output from hook | |
730 | cb9a9f314b8b |
|
730 | cb9a9f314b8b | |
731 |
|
731 | |||
732 | Ensure hooks can be prioritized |
|
732 | Ensure hooks can be prioritized | |
733 |
|
733 | |||
734 | $ echo '[hooks]' > .hg/hgrc |
|
734 | $ echo '[hooks]' > .hg/hgrc | |
735 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc |
|
735 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc | |
736 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc |
|
736 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc | |
737 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc |
|
737 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc | |
738 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc |
|
738 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc | |
739 | $ hg id --verbose |
|
739 | $ hg id --verbose | |
740 | calling hook pre-identify.b: hooktests.verbosehook |
|
740 | calling hook pre-identify.b: hooktests.verbosehook | |
741 | verbose output from hook |
|
741 | verbose output from hook | |
742 | calling hook pre-identify.a: hooktests.verbosehook |
|
742 | calling hook pre-identify.a: hooktests.verbosehook | |
743 | verbose output from hook |
|
743 | verbose output from hook | |
744 | calling hook pre-identify.c: hooktests.verbosehook |
|
744 | calling hook pre-identify.c: hooktests.verbosehook | |
745 | verbose output from hook |
|
745 | verbose output from hook | |
746 | cb9a9f314b8b |
|
746 | cb9a9f314b8b | |
747 |
|
747 | |||
748 | new tags must be visible in pretxncommit (issue3210) |
|
748 | new tags must be visible in pretxncommit (issue3210) | |
749 |
|
749 | |||
750 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc |
|
750 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc | |
751 | $ hg tag -f foo |
|
751 | $ hg tag -f foo | |
752 | ['a', 'foo', 'tip'] |
|
752 | ['a', 'foo', 'tip'] | |
753 |
|
753 | |||
754 | post-init hooks must not crash (issue4983) |
|
754 | post-init hooks must not crash (issue4983) | |
755 | This also creates the `to` repo for the next test block. |
|
755 | This also creates the `to` repo for the next test block. | |
756 |
|
756 | |||
757 | $ cd .. |
|
757 | $ cd .. | |
758 | $ cat << EOF >> hgrc-with-post-init-hook |
|
758 | $ cat << EOF >> hgrc-with-post-init-hook | |
759 | > [hooks] |
|
759 | > [hooks] | |
760 | > post-init = printenv.py post-init |
|
760 | > post-init = printenv.py post-init | |
761 | > EOF |
|
761 | > EOF | |
762 | $ HGRCPATH=hgrc-with-post-init-hook hg init to |
|
762 | $ HGRCPATH=hgrc-with-post-init-hook hg init to | |
763 | post-init hook: HG_ARGS=init to HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 |
|
763 | post-init hook: HG_ARGS=init to HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 | |
764 |
|
764 | |||
765 | new commits must be visible in pretxnchangegroup (issue3428) |
|
765 | new commits must be visible in pretxnchangegroup (issue3428) | |
766 |
|
766 | |||
767 | $ echo '[hooks]' >> to/.hg/hgrc |
|
767 | $ echo '[hooks]' >> to/.hg/hgrc | |
768 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
768 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc | |
769 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
769 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc | |
770 | $ echo a >> to/a |
|
770 | $ echo a >> to/a | |
771 | $ hg --cwd to ci -Ama |
|
771 | $ hg --cwd to ci -Ama | |
772 | adding a |
|
772 | adding a | |
773 | $ hg clone to from |
|
773 | $ hg clone to from | |
774 | updating to branch default |
|
774 | updating to branch default | |
775 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
775 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
776 | $ echo aa >> from/a |
|
776 | $ echo aa >> from/a | |
777 | $ hg --cwd from ci -mb |
|
777 | $ hg --cwd from ci -mb | |
778 | $ hg --cwd from push |
|
778 | $ hg --cwd from push | |
779 | pushing to $TESTTMP/to (glob) |
|
779 | pushing to $TESTTMP/to (glob) | |
780 | searching for changes |
|
780 | searching for changes | |
781 | changeset: 0:cb9a9f314b8b |
|
781 | changeset: 0:cb9a9f314b8b | |
782 | tag: tip |
|
782 | tag: tip | |
783 | user: test |
|
783 | user: test | |
784 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
784 | date: Thu Jan 01 00:00:00 1970 +0000 | |
785 | summary: a |
|
785 | summary: a | |
786 |
|
786 | |||
787 | adding changesets |
|
787 | adding changesets | |
788 | adding manifests |
|
788 | adding manifests | |
789 | adding file changes |
|
789 | adding file changes | |
790 | added 1 changesets with 1 changes to 1 files |
|
790 | added 1 changesets with 1 changes to 1 files | |
791 | changeset: 1:9836a07b9b9d |
|
791 | changeset: 1:9836a07b9b9d | |
792 | tag: tip |
|
792 | tag: tip | |
793 | user: test |
|
793 | user: test | |
794 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
794 | date: Thu Jan 01 00:00:00 1970 +0000 | |
795 | summary: b |
|
795 | summary: b | |
796 |
|
796 | |||
797 | $ cd .. |
|
797 | $ cd .. | |
798 |
|
798 | |||
799 | pretxnclose hook failure should abort the transaction |
|
799 | pretxnclose hook failure should abort the transaction | |
800 |
|
800 | |||
801 | $ hg init txnfailure |
|
801 | $ hg init txnfailure | |
802 | $ cd txnfailure |
|
802 | $ cd txnfailure | |
803 | $ touch a && hg commit -Aqm a |
|
803 | $ touch a && hg commit -Aqm a | |
804 | $ cat >> .hg/hgrc <<EOF |
|
804 | $ cat >> .hg/hgrc <<EOF | |
805 | > [hooks] |
|
805 | > [hooks] | |
806 | > pretxnclose.error = exit 1 |
|
806 | > pretxnclose.error = exit 1 | |
807 | > EOF |
|
807 | > EOF | |
808 | $ hg strip -r 0 --config extensions.strip= |
|
808 | $ hg strip -r 0 --config extensions.strip= | |
809 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
809 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
810 | saved backup bundle to * (glob) |
|
810 | saved backup bundle to * (glob) | |
811 | transaction abort! |
|
811 | transaction abort! | |
812 | rollback completed |
|
812 | rollback completed | |
813 | strip failed, full bundle stored in * (glob) |
|
813 | strip failed, full bundle stored in * (glob) | |
814 | abort: pretxnclose.error hook exited with status 1 |
|
814 | abort: pretxnclose.error hook exited with status 1 | |
815 | [255] |
|
815 | [255] | |
816 | $ hg recover |
|
816 | $ hg recover | |
817 | no interrupted transaction available |
|
817 | no interrupted transaction available | |
818 | [1] |
|
818 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now