annotate tests/test-hook.t @ 27785:ba427b51f1d8

util: rename ctxmanager's __call__ method to enter
author Bryan O'Sullivan <bryano@fb.com>
date Thu, 14 Jan 2016 09:31:01 -0800
parents d6d3cf5fda6f
children 24361fb68cba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
1 commit hooks can see env vars
24821
57f1dbc99631 afterlock: add the callback to the top level lock (issue4608)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24792
diff changeset
2 (and post-transaction one are run unlocked)
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
3
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
4 $ cat << EOF >> $HGRCPATH
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
5 > [experimental]
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
6 > # drop me once bundle2 is the default,
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
7 > # added to get test change early.
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
8 > bundle2-exp = True
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
9 > EOF
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
10
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
11 $ cat > $TESTTMP/txnabort.checkargs.py <<EOF
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
12 > def showargs(ui, repo, hooktype, **kwargs):
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
13 > ui.write('%s python hook: %s\n' % (hooktype, ','.join(sorted(kwargs))))
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
14 > EOF
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
15
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
16 $ hg init a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
17 $ cd a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
18 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
19 > [hooks]
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
20 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
21 > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
22 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
23 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
24 > pretxncommit.tip = hg -q tip
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
25 > pre-identify = printenv.py pre-identify 1
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
26 > pre-cat = printenv.py pre-cat
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
27 > post-cat = printenv.py post-cat
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
28 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
29 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
30 > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
31 > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
32 > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
24827
2f2de8a7f97f test-hook.t: don't directly use redirect to /dev/null in hook for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 24821
diff changeset
33 > txnclose.checklock = sh -c "hg debuglock > /dev/null"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
34 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
35 $ echo a > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
36 $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
37 $ hg commit -m a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
38 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
25268
a973b050621d localrepo: pass hook argument txnid to pretxnopen hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25219
diff changeset
39 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
40 pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
41 0:cb9a9f314b8b
25219
2664f536a97e localrepo: use correct argument name for pretxnclose hooks (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25218
diff changeset
42 pretxnclose hook: HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
24740
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
43 txnclose hook: HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
44 commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
45 commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
46
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
47 $ hg clone . ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
48 updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
50 $ cd ../b
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
51
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
52 changegroup hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
53
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
54 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
55 > [hooks]
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
56 > prechangegroup = printenv.py prechangegroup
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
57 > changegroup = printenv.py changegroup
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
58 > incoming = printenv.py incoming
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
59 > EOF
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
60
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
61 pretxncommit and commit hooks can see both parents of merge
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
62
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
63 $ cd ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
64 $ echo b >> a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
65 $ hg commit -m a1 -d "1 0"
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
66 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
25268
a973b050621d localrepo: pass hook argument txnid to pretxnopen hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25219
diff changeset
67 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
68 pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
69 1:ab228980c14d
25219
2664f536a97e localrepo: use correct argument name for pretxnclose hooks (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25218
diff changeset
70 pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
24740
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
71 txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
72 commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
73 commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
74 $ hg update -C 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
76 $ echo b > b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
77 $ hg add b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
78 $ hg commit -m b -d '1 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
79 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
25268
a973b050621d localrepo: pass hook argument txnid to pretxnopen hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25219
diff changeset
80 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
81 pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
82 2:ee9deb46ab31
25219
2664f536a97e localrepo: use correct argument name for pretxnclose hooks (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25218
diff changeset
83 pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
27192
a01d3d32b53a commands: make commit acquire locks before processing (issue4368)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26861
diff changeset
84 created new head
24740
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
85 txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
86 commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
87 commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
88 $ hg merge 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
90 (branch merge, don't forget to commit)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
91 $ hg commit -m merge -d '2 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
92 precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
25268
a973b050621d localrepo: pass hook argument txnid to pretxnopen hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25219
diff changeset
93 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
94 pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
95 3:07f3376c1e65
25219
2664f536a97e localrepo: use correct argument name for pretxnclose hooks (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25218
diff changeset
96 pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
24740
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
97 txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
98 commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
99 commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
100
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
101 test generic hooks
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
102
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
103 $ hg id
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
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=[]
19011
12acbea17625 dispatch: print 'abort:' when a pre-command hook fails (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 18851
diff changeset
105 abort: pre-identify hook exited with status 1
12acbea17625 dispatch: print 'abort:' when a pre-command hook fails (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 18851
diff changeset
106 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
107 $ hg cat b
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
108 pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
13121
bf763946f8b0 make_file: always return a fresh file handle that can be closed
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12640
diff changeset
109 b
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
110 post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
4630
e6d105a51ec7 dispatch: add generic pre- and post-command hooks
Matt Mackall <mpm@selenic.com>
parents: 4368
diff changeset
111
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
112 $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
113 $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
114 pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
115 searching for changes
26861
10a1a4b3e775 hooks: back 9f272bf3b342 out
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26859
diff changeset
116 prechangegroup hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob)
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
117 adding changesets
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
118 adding manifests
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
119 adding file changes
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
120 added 3 changesets with 2 changes to 2 files
27739
d6d3cf5fda6f hooks: add HG_NODE_LAST to txnclose and changegroup hook environments
Mateusz Kwapich <mitrandir@fb.com>
parents: 27278
diff changeset
121 changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob)
24740
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
122 incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob)
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
123 incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob)
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
124 incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
125 (run 'hg update' to get a working copy)
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
126
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
127 tag hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
128
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
129 $ cd ../a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
130 $ cat >> .hg/hgrc <<EOF
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
131 > pretag = printenv.py pretag
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
132 > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
133 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
134 $ hg tag -d '3 0' a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
135 pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
136 precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
25268
a973b050621d localrepo: pass hook argument txnid to pretxnopen hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25219
diff changeset
137 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
138 pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
139 4:539e4b31b6dc
25219
2664f536a97e localrepo: use correct argument name for pretxnclose hooks (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25218
diff changeset
140 pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
141 tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
24740
d283517b260b transaction: introduce a transaction ID, to be available to all hooks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24739
diff changeset
142 txnclose hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
143 commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
144 commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
145 $ hg tag -l la
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
146 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
147 tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
148
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
149 pretag hook can forbid tagging
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
150
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
151 $ echo "pretag.forbid = printenv.py pretag.forbid 1" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
152 $ hg tag -d '4 0' fa
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
153 pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
154 pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
155 abort: pretag.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
156 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
157 $ hg tag -l fla
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
158 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
159 pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
160 abort: pretag.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
161 [255]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
162
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
163 pretxncommit hook can see changeset, can roll back txn, changeset no
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
164 more there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
165
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
166 $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
167 $ echo "pretxncommit.forbid1 = printenv.py pretxncommit.forbid 1" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
168 $ echo z > z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
169 $ hg add z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
170 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
171 4:539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
172 $ hg commit -m 'fail' -d '4 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
173 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
25268
a973b050621d localrepo: pass hook argument txnid to pretxnopen hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25219
diff changeset
174 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
175 pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
176 5:6f611f8018c1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
177 5:6f611f8018c1
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
178 pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
179 transaction abort!
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
180 txnabort python hook: txnid,txnname
24792
7d0421de8de3 hooks: add a 'txnabort' hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24740
diff changeset
181 txnabort hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
182 rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
183 abort: pretxncommit.forbid1 hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
184 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
185 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
186 4:539e4b31b6dc
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
187
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
188 (Check that no 'changelog.i.a' file were left behind)
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
189
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
190 $ ls -1 .hg/store/
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
191 00changelog.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
192 00manifest.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
193 data
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
194 fncache
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
195 journal.phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
196 phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
197 undo
23904
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23749
diff changeset
198 undo.backup.fncache
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23749
diff changeset
199 undo.backupfiles
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
200 undo.phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
201
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
202
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
203 precommit hook can prevent commit
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
204
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
205 $ echo "precommit.forbid = printenv.py precommit.forbid 1" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
206 $ hg commit -m 'fail' -d '4 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
207 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
208 precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
209 abort: precommit.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
210 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
211 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
212 4:539e4b31b6dc
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
213
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
214 preupdate hook can prevent update
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
215
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
216 $ echo "preupdate = printenv.py preupdate" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
217 $ hg update 1
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
218 preupdate hook: HG_PARENT1=ab228980c14d
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
219 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2266
3f7692b0ff13 hooks: add preupdate and update hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2227
diff changeset
220
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
221 update hook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
222
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
223 $ echo "update = printenv.py update" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
224 $ hg update
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
225 preupdate hook: HG_PARENT1=539e4b31b6dc
26752
949e8c626d19 merge: make in-memory changes visible to external update hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26692
diff changeset
226 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
26028
6fbe35588433 update: wlock the repo for the whole 'hg update' command
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25744
diff changeset
227 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
2266
3f7692b0ff13 hooks: add preupdate and update hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2227
diff changeset
228
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
229 pushkey hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
230
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
231 $ echo "pushkey = printenv.py pushkey" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
232 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
233 $ hg bookmark -r null foo
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
234 $ hg push -B foo ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
235 pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
236 searching for changes
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
237 no changes found
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
238 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob)
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
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)
22651
b901645a8784 push: gather all bookmark decisions together
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22645
diff changeset
240 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
241 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob)
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
242 exporting bookmark foo
16038
dad96e752079 push: don't treat bookmark as a found change
Matt Mackall <mpm@selenic.com>
parents: 15956
diff changeset
243 [1]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
244 $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
245
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
246 listkeys hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
247
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
248 $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
249 $ hg bookmark -r null bar
25744
e78a80f8f51e bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25501
diff changeset
250 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob)
e78a80f8f51e bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25501
diff changeset
251 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob)
e78a80f8f51e bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25501
diff changeset
252 txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob)
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
253 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
254 $ hg pull -B bar ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
255 pulling from ../a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
256 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
257 no changes found
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
258 listkeys hook: HG_NAMESPACE=phase HG_VALUES={}
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
259 adding remote bookmark bar
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
260 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
261 $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
262
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
263 test that prepushkey can prevent incoming keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
264
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
265 $ echo "prepushkey = printenv.py prepushkey.forbid 1" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
266 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
267 $ hg bookmark -r null baz
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
268 $ hg push -B baz ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
269 pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
270 searching for changes
22019
9fcf772f15ff push: perform phases discovery before the push
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20548
diff changeset
271 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
22239
0688010ee38f push: move bookmark discovery with other discovery steps
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22019
diff changeset
272 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
273 no changes found
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
274 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob)
26861
10a1a4b3e775 hooks: back 9f272bf3b342 out
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26859
diff changeset
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)
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
276 pushkey-abort: prepushkey hook exited with status 1
25501
a99fee62611d bookmarks: abort the whole push if bookmarks fails to update (BC)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25478
diff changeset
277 abort: exporting bookmark baz failed!
a99fee62611d bookmarks: abort the whole push if bookmarks fails to update (BC)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25478
diff changeset
278 [255]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
279 $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
280
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
281 test that prelistkeys can prevent listing keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
282
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
283 $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
284 $ hg bookmark -r null quux
25744
e78a80f8f51e bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25501
diff changeset
285 pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob)
e78a80f8f51e bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25501
diff changeset
286 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob)
e78a80f8f51e bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25501
diff changeset
287 txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmark (glob)
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
288 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
289 $ hg pull -B quux ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
290 pulling from ../a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
291 prelistkeys.forbid hook: HG_NAMESPACE=bookmarks
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
292 abort: prelistkeys hook exited with status 1
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
293 [255]
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
294 $ cd ../a
18850
442c0cb8287a test-hook.t: remove prelistkeys.forbid hook before moving on
Siddharth Agarwal <sid0@fb.com>
parents: 18377
diff changeset
295 $ rm .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
296
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
297 prechangegroup hook can prevent incoming changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
298
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
299 $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
300 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
301 3:07f3376c1e65
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
302 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
303 > [hooks]
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
304 > prechangegroup.forbid = printenv.py prechangegroup.forbid 1
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
305 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
306 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
307 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
308 searching for changes
26861
10a1a4b3e775 hooks: back 9f272bf3b342 out
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26859
diff changeset
309 prechangegroup.forbid hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
310 abort: prechangegroup.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
311 [255]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
312
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
313 pretxnchangegroup hook can see incoming changes, can roll back txn,
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
314 incoming changes no longer there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
315
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
316 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
317 > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
318 > pretxnchangegroup.forbid0 = hg tip -q
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
319 > pretxnchangegroup.forbid1 = printenv.py pretxnchangegroup.forbid 1
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
320 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
321 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
322 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
323 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
324 adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
325 adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
326 adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
327 added 1 changesets with 1 changes to 1 files
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
328 4:539e4b31b6dc
27739
d6d3cf5fda6f hooks: add HG_NODE_LAST to txnclose and changegroup hook environments
Mateusz Kwapich <mitrandir@fb.com>
parents: 27278
diff changeset
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)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
330 transaction abort!
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
331 rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
332 abort: pretxnchangegroup.forbid1 hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
333 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
334 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
335 3:07f3376c1e65
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
336
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
337 outgoing hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
338
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
339 $ rm .hg/hgrc
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
340 $ cat > ../a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
341 > [hooks]
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
342 > preoutgoing = printenv.py preoutgoing
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
343 > outgoing = printenv.py outgoing
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
344 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
345 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
346 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
347 searching for changes
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
348 preoutgoing hook: HG_SOURCE=pull
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
349 outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
350 adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
351 adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
352 adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
353 added 1 changesets with 1 changes to 1 files
16697
c285aae10f6c bookmarks: pull new bookmarks from remote by default (BC)
Levi Bard <levi@unity3d.com>
parents: 16619
diff changeset
354 adding remote bookmark quux
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
355 (run 'hg update' to get a working copy)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
356 $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13439
diff changeset
357 repository tip rolled back to revision 3 (undo pull)
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
358
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
359 preoutgoing hook can prevent outgoing changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
360
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
361 $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> ../a/.hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
362 $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
363 pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
364 searching for changes
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
365 preoutgoing hook: HG_SOURCE=pull
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
366 preoutgoing.forbid hook: HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
367 abort: preoutgoing.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
368 [255]
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
369
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
370 outgoing hooks work for local clones
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
371
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
372 $ cd ..
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
373 $ cat > a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
374 > [hooks]
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
375 > preoutgoing = printenv.py preoutgoing
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
376 > outgoing = printenv.py outgoing
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
377 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
378 $ hg clone a c
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
379 preoutgoing hook: HG_SOURCE=clone
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
380 outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
381 updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
382 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
383 $ rm -rf c
8907
e9ef409e6399 Add (pre)outgoing hooks for local clones.
Fred Wulff <frew@cs.stanford.edu>
parents: 4659
diff changeset
384
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
385 preoutgoing hook can prevent outgoing changes for local clones
8907
e9ef409e6399 Add (pre)outgoing hooks for local clones.
Fred Wulff <frew@cs.stanford.edu>
parents: 4659
diff changeset
386
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
387 $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> a/.hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
388 $ hg clone a zzz
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
389 preoutgoing hook: HG_SOURCE=clone
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
390 preoutgoing.forbid hook: HG_SOURCE=clone
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
391 abort: preoutgoing.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
392 [255]
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
393
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
394 $ cd "$TESTTMP/b"
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
395
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
396 $ cat > hooktests.py <<EOF
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26028
diff changeset
397 > from mercurial import error
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
398 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
399 > uncallable = 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
400 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
401 > def printargs(args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
402 > args.pop('ui', None)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
403 > args.pop('repo', None)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
404 > a = list(args.items())
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
405 > a.sort()
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
406 > print 'hook args:'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
407 > for k, v in a:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
408 > print ' ', k, v
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
409 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
410 > def passhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
411 > printargs(args)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
412 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
413 > def failhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
414 > printargs(args)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
415 > return True
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
416 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
417 > class LocalException(Exception):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
418 > pass
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
419 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
420 > def raisehook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
421 > raise LocalException('exception from hook')
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
422 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
423 > def aborthook(**args):
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26028
diff changeset
424 > raise error.Abort('raise abort from hook')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
425 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
426 > def brokenhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
427 > return 1 + {}
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
428 >
14601
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
429 > def verbosehook(ui, **args):
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
430 > ui.note('verbose output from hook\n')
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
431 >
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
432 > def printtags(ui, repo, **args):
18377
56b805306955 tests: make test-hook.t output more stable
Mads Kiilerich <mads@kiilerich.com>
parents: 17508
diff changeset
433 > print sorted(repo.tags())
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
434 >
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
435 > class container:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
436 > unreachable = 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
437 > EOF
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
438
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
439 test python hooks
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
440
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
441 #if windows
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
442 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
443 #else
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
444 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
445 #endif
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
446 $ export PYTHONPATH
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
447
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
448 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
449 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
450 $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
451 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
452
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
453 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
454 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
455 $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
456 error: preoutgoing.raise hook raised an exception: exception from hook
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
457
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
458 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
459 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
460 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
461 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
462 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
463 error: preoutgoing.abort hook failed: raise abort from hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
464 abort: raise abort from hook
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
465 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
466
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
467 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
468 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
469 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
470 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
471 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
472 hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
473 hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
474 source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
475 abort: preoutgoing.fail hook failed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
476 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
477
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
478 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
479 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
480 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
481 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
482 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
483 abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
484 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
485
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
486 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
487 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
488 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
489 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
490 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
491 abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
492 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
493
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
494 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
495 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
496 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
497 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
498 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
499 abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
500 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
501
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
502 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
503 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
504 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
505 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
506 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
507 abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
508 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
509
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
510 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
511 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
512 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
513 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
514 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
515 abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
516 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
517
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
518 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
519 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
520 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
521 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
522 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
523 hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
524 hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
525 source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
526 adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
527 adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
528 adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
529 added 1 changesets with 1 changes to 1 files
16697
c285aae10f6c bookmarks: pull new bookmarks from remote by default (BC)
Levi Bard <levi@unity3d.com>
parents: 16619
diff changeset
530 adding remote bookmark quux
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
531 (run 'hg update' to get a working copy)
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
532
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
533 make sure --traceback works
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
534
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
535 $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
536 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
537
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
538 $ echo aa > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
539 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
540 Traceback (most recent call last):
4070
961ccb615cf7 Handle functions as the value of a hooks.<name> config variable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2673
diff changeset
541
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
542 $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
543 $ hg init c
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
544 $ cd c
4070
961ccb615cf7 Handle functions as the value of a hooks.<name> config variable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2673
diff changeset
545
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
546 $ cat > hookext.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
547 > def autohook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
548 > print "Automatically installed hook"
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
549 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
550 > def reposetup(ui, repo):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
551 > repo.ui.setconfig("hooks", "commit.auto", autohook)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
552 > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
553 $ echo '[extensions]' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
554 $ echo 'hookext = hookext.py' >> .hg/hgrc
4070
961ccb615cf7 Handle functions as the value of a hooks.<name> config variable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2673
diff changeset
555
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
556 $ touch foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
557 $ hg add foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
558 $ hg ci -d '0 0' -m 'add foo'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
559 Automatically installed hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
560 $ echo >> foo
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
561 $ hg ci --debug -d '0 0' -m 'change foo'
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
562 committing files:
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
563 foo
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
564 committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
565 committing changelog
27192
a01d3d32b53a commands: make commit acquire locks before processing (issue4368)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26861
diff changeset
566 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
20548
5bd6a9fec103 hooks: for python hooks, consistently use __name__ etc as name, not the repr
Mads Kiilerich <madski@unity3d.com>
parents: 19011
diff changeset
567 calling hook commit.auto: hgext_hookext.autohook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
568 Automatically installed hook
4070
961ccb615cf7 Handle functions as the value of a hooks.<name> config variable
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2673
diff changeset
569
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
570 $ hg showconfig hooks
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
571 hooks.commit.auto=<function autohook at *> (glob)
4085
719488a98ebe Fix hg showconfig traceback with values that aren't strings
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4070
diff changeset
572
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
573 test python hook configured with python:[file]:[hook] syntax
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
574
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
575 $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
576 $ mkdir d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
577 $ cd d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
578 $ hg init repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
579 $ mkdir hooks
9014
87c05a78e588 test python hook configured with python:[file]:[hook] syntax
Henri Wiechers <hwiechers@gmail.com>
parents: 8907
diff changeset
580
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
581 $ cd hooks
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
582 $ cat > testhooks.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
583 > def testhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
584 > print 'hook works'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
585 > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
586 $ echo '[hooks]' > ../repo/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
587 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
9014
87c05a78e588 test python hook configured with python:[file]:[hook] syntax
Henri Wiechers <hwiechers@gmail.com>
parents: 8907
diff changeset
588
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
589 $ cd ../repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
590 $ hg commit -d '0 0'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
591 hook works
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
592 nothing changed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
593 [1]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
594
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
595 $ echo '[hooks]' > .hg/hgrc
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
596 $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
597 $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
598
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
599 $ hg up null
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
600 loading update.ne hook failed:
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
601 abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
602 [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
603
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
604 $ hg id
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
605 loading pre-identify.npmd hook failed:
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
606 abort: No module named repo!
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
607 [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
608
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
609 $ cd ../../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
610
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
611 make sure --traceback works on hook import failure
9014
87c05a78e588 test python hook configured with python:[file]:[hook] syntax
Henri Wiechers <hwiechers@gmail.com>
parents: 8907
diff changeset
612
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
613 $ cat > importfail.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
614 > import somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
615 > # dereference something in the module to force demandimport to load it
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
616 > somebogusmodule.whatever
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
617 > EOF
9851
9e7b2c49d25d Make it possible to debug failed hook imports via use of --traceback
Bryan O'Sullivan <bos@serpentine.com>
parents: 9014
diff changeset
618
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
619 $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
620 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
9851
9e7b2c49d25d Make it possible to debug failed hook imports via use of --traceback
Bryan O'Sullivan <bos@serpentine.com>
parents: 9014
diff changeset
621
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
622 $ echo a >> a
17283
a4034b866f80 test-hook.t: Solaris /usr/bin/egrep do not support {4}
Mads Kiilerich <mads@kiilerich.com>
parents: 17252
diff changeset
623 $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])'
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
624 exception from first failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
625 Traceback (most recent call last):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
626 ImportError: No module named somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
627 exception from second failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
628 Traceback (most recent call last):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
629 ImportError: No module named hgext_importfail
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
630 Traceback (most recent call last):
26692
8d1cfd77b64f hook: raise a separate exception for when loading a hook fails
Siddharth Agarwal <sid0@fb.com>
parents: 26587
diff changeset
631 HookLoadError: precommit.importfail hook is invalid (import of "importfail" failed)
17166
c1a3b151782a tests: do exclude what is expected
Simon Heimberg <simohe@besonet.ch>
parents: 17075
diff changeset
632 abort: precommit.importfail hook is invalid (import of "importfail" failed)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
633
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
634 Issue1827: Hooks Update & Commit not completely post operation
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
635
24881
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
636 commit and update hooks should run after command completion. The largefiles
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
637 use demonstrates a recursive wlock, showing the hook doesn't run until the
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
638 final release (and dirstate flush).
10492
0e64d814d7d0 run commit and update hooks after command completion (issue1827)
Sune Foldager <cryo@cyanite.org>
parents: 10079
diff changeset
639
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
640 $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
641 $ echo 'commit = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
642 $ echo 'update = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
643 $ echo bb > a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
644 $ hg ci -ma
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
645 223eafe2750c tip
24881
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
646 $ hg up 0 --config extensions.largefiles=
26752
949e8c626d19 merge: make in-memory changes visible to external update hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26692
diff changeset
647 cb9a9f314b8b
26028
6fbe35588433 update: wlock the repo for the whole 'hg update' command
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25744
diff changeset
648 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9851
9e7b2c49d25d Make it possible to debug failed hook imports via use of --traceback
Bryan O'Sullivan <bos@serpentine.com>
parents: 9014
diff changeset
649
17508
57fb8c9509f4 spelling: propagated
timeless@mozdev.org
parents: 17492
diff changeset
650 make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui
14601
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
651 that is passed to pre/post hooks
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
652
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
653 $ echo '[hooks]' > .hg/hgrc
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
654 $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
655 $ hg id
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
656 cb9a9f314b8b
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
657 $ hg id --verbose
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
658 calling hook pre-identify: hooktests.verbosehook
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
659 verbose output from hook
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
660 cb9a9f314b8b
15896
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
661
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
662 Ensure hooks can be prioritized
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
663
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
664 $ echo '[hooks]' > .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
665 $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
666 $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
667 $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
668 $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
669 $ hg id --verbose
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
670 calling hook pre-identify.b: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
671 verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
672 calling hook pre-identify.a: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
673 verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
674 calling hook pre-identify.c: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
675 verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
676 cb9a9f314b8b
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
677
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
678 new tags must be visible in pretxncommit (issue3210)
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
679
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
680 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
681 $ hg tag -f foo
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
682 ['a', 'foo', 'tip']
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
683
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
684 post-init hooks must not crash (issue4983)
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
685 This also creates the `to` repo for the next test block.
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
686
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
687 $ cd ..
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
688 $ cat << EOF >> hgrc-with-post-init-hook
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
689 > [hooks]
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
690 > post-init = printenv.py post-init
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
691 > EOF
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
692 $ HGRCPATH=hgrc-with-post-init-hook hg init to
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
693 post-init hook: HG_ARGS=init to HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
694
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
695 new commits must be visible in pretxnchangegroup (issue3428)
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
696
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
697 $ echo '[hooks]' >> to/.hg/hgrc
26859
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
698 $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
699 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
700 $ echo a >> to/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
701 $ hg --cwd to ci -Ama
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
702 adding a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
703 $ hg clone to from
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
704 updating to branch default
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
705 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
706 $ echo aa >> from/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
707 $ hg --cwd from ci -mb
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
708 $ hg --cwd from push
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
709 pushing to $TESTTMP/to (glob)
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
710 searching for changes
26859
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
711 changeset: 0:cb9a9f314b8b
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
712 tag: tip
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
713 user: test
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
714 date: Thu Jan 01 00:00:00 1970 +0000
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
715 summary: a
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
716
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
717 adding changesets
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
718 adding manifests
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
719 adding file changes
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
720 added 1 changesets with 1 changes to 1 files
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
721 changeset: 1:9836a07b9b9d
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
722 tag: tip
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
723 user: test
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
724 date: Thu Jan 01 00:00:00 1970 +0000
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
725 summary: b
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
726