annotate tests/test-hook.t @ 34980:705d0f2bb677 stable

pathutil: add doctests for canonpath() This is a followup to f445b10dc7fb. Since there's no way to ensure that more drive letters than C: exist, this seems like the only way to test it. This is enough to catch the f445b10dc7fb scenario, as well as CWD outside of the repo when the path isn't prefixed with path/to/repo.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 03 Nov 2017 22:22:50 -0400
parents eb586ed5d8ce
children feecfefeba25
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
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
5 $ 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
6 > def showargs(ui, repo, hooktype, **kwargs):
33261
be49f3fdcd10 tests: capitalize Python when it's not used as a command name
Augie Fackler <augie@google.com>
parents: 33212
diff changeset
7 > ui.write('%s Python hook: %s\n' % (hooktype, ','.join(sorted(kwargs))))
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
8 > EOF
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
9
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
10 $ hg init a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
11 $ cd a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
12 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
13 > [hooks]
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
14 > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
15 > 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
16 > 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
17 > 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
18 > pretxncommit.tip = hg -q tip
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
19 > pre-identify = sh -c "printenv.py pre-identify 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
20 > pre-cat = sh -c "printenv.py pre-cat"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
21 > post-cat = sh -c "printenv.py post-cat"
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
22 > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
23 > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
24 > 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
25 > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
26 > 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
27 > txnclose.checklock = sh -c "hg debuglock > /dev/null"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
28 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
29 $ echo a > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
30 $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
31 $ hg commit -m a
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
32 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
33 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
34 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit 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
35 0:cb9a9f314b8b
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
36 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
37 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
38 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
39 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
40
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
41 $ hg clone . ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
42 updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
43 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
44 $ 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
45
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
46 changegroup hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
47
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
48 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
49 > [hooks]
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
50 > prechangegroup = sh -c "printenv.py prechangegroup"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
51 > changegroup = sh -c "printenv.py changegroup"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
52 > incoming = sh -c "printenv.py incoming"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
53 > EOF
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
54
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
55 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
56
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
57 $ cd ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
58 $ echo b >> a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
59 $ hg commit -m a1 -d "1 0"
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
60 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
61 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
62 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit 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
63 1:ab228980c14d
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
64 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
65 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
66 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
67 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
68 $ hg update -C 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
69 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
70 $ echo b > b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
71 $ hg add b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
72 $ hg commit -m b -d '1 0'
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
73 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
74 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
75 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit 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
76 2:ee9deb46ab31
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
77 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
27192
a01d3d32b53a commands: make commit acquire locks before processing (issue4368)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26861
diff changeset
78 created new head
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
79 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
80 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
81 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
82 $ hg merge 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
83 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
84 (branch merge, don't forget to commit)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
85 $ hg commit -m merge -d '2 0'
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
86 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
87 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
88 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit 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
89 3:07f3376c1e65
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
90 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
91 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
92 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
93 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit 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
94
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
95 test generic hooks
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
96
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
97 $ hg id
33051
15a79ac823e8 identify: add template support
Matt Harbison <matt_harbison@yahoo.com>
parents: 32584
diff changeset
98 pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[]
19011
12acbea17625 dispatch: print 'abort:' when a pre-command hook fails (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 18851
diff changeset
99 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
100 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
101 $ hg cat b
32584
746e12a767b3 cat: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 32267
diff changeset
102 pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b']
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
103 b
32584
746e12a767b3 cat: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 32267
diff changeset
104 post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0
4630
e6d105a51ec7 dispatch: add generic pre- and post-command hooks
Matt Mackall <mpm@selenic.com>
parents: 4368
diff changeset
105
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
106 $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
107 $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
108 pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
109 searching for changes
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
110 prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
111 adding changesets
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
112 adding manifests
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
113 adding file changes
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
114 added 3 changesets with 2 changes to 2 files
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 34452
diff changeset
115 new changesets ab228980c14d:07f3376c1e65
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
116 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
117 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
118 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
119 incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
120 (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
121
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
122 tag hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
123
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
124 $ cd ../a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
125 $ cat >> .hg/hgrc <<EOF
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
126 > pretag = sh -c "printenv.py pretag"
25478
d19787db6fe0 tests: simplify printenv calls
Matt Mackall <mpm@selenic.com>
parents: 25446
diff changeset
127 > 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
128 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
129 $ hg tag -d '3 0' a
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
130 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
131 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
132 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
133 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit 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
134 4:539e4b31b6dc
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
135 pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
136 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
137 txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
138 commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
139 commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
140 $ hg tag -l la
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
141 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
142 tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag 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
143
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
144 pretag hook can forbid tagging
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
145
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
146 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
147 > pretag.forbid = sh -c "printenv.py pretag.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
148 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
149 $ hg tag -d '4 0' fa
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
150 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
151 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag 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
152 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
153 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
154 $ hg tag -l fla
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
155 pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
156 pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag 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
157 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
158 [255]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
159
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
160 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
161 more there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
162
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
163 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
164 > pretxncommit.forbid0 = sh -c "hg tip -q"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
165 > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
166 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
167 $ echo z > z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
168 $ hg add z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
169 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
170 4:539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
171 $ hg commit -m 'fail' -d '4 0'
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
172 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
173 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
174 pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit 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
175 5:6f611f8018c1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
176 5:6f611f8018c1
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
177 pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit 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
178 transaction abort!
33261
be49f3fdcd10 tests: capitalize Python when it's not used as a command name
Augie Fackler <augie@google.com>
parents: 33212
diff changeset
179 txnabort Python hook: txnid,txnname
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
180 txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
181 rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
182 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
183 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
184 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
185 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
186
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
187 (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
188
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
189 $ 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
190 00changelog.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
191 00manifest.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
192 data
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
193 fncache
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
194 journal.phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
195 phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
196 undo
23904
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23749
diff changeset
197 undo.backup.fncache
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23749
diff changeset
198 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
199 undo.phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
200
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
201
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
202 precommit hook can prevent commit
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
203
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
204 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
205 > precommit.forbid = sh -c "printenv.py precommit.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
206 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
207 $ hg commit -m 'fail' -d '4 0'
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
208 precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
209 precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
210 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
211 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
212 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
213 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
214
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
215 preupdate hook can prevent update
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
216
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
217 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
218 > preupdate = sh -c "printenv.py preupdate"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
219 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
220 $ hg update 1
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
221 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
222 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
223
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
224 update hook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
225
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
226 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
227 > update = sh -c "printenv.py update"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
228 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
229 $ hg update
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
230 preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
231 update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update 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
232 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
233
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
234 pushkey hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
235
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
236 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
237 > pushkey = sh -c "printenv.py pushkey"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
238 > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
239 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
240 $ hg bookmark -r null foo
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
241 $ hg push -B foo ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
242 pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
243 searching for changes
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
244 no changes found
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
245 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
246 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
247 pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
248 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
249 exporting bookmark foo
16038
dad96e752079 push: don't treat bookmark as a found change
Matt Mackall <mpm@selenic.com>
parents: 15956
diff changeset
250 [1]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
251 $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
252
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
253 listkeys hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
254
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
255 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
256 > listkeys = sh -c "printenv.py listkeys"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
257 > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
258 $ hg bookmark -r null bar
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
259 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
260 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
261 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
262 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
263 $ hg pull -B bar ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
264 pulling from ../a
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
265 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys 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
266 no changes found
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
267 adding remote bookmark bar
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
268 $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
269
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
270 test that prepushkey can prevent incoming keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
271
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
272 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
273 > prepushkey = sh -c "printenv.py prepushkey.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
274 > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
275 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
276 $ hg bookmark -r null baz
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
277 $ hg push -B baz ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
278 pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
279 searching for changes
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
280 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
281 listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys 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
282 no changes found
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
283 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
284 prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
285 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
286 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
287 [255]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
288 $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
289
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
290 test that prelistkeys can prevent listing keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
291
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
292 $ cat >> .hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
293 > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
294 > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
295 $ hg bookmark -r null quux
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
296 pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
297 pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
298 txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
299 $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
300 $ hg pull -B quux ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
301 pulling from ../a
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
302 prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
303 abort: prelistkeys hook exited with status 1
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
304 [255]
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
305 $ cd ../a
18850
442c0cb8287a test-hook.t: remove prelistkeys.forbid hook before moving on
Siddharth Agarwal <sid0@fb.com>
parents: 18377
diff changeset
306 $ rm .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
307
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
308 prechangegroup hook can prevent incoming changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
309
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
310 $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
311 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
312 3:07f3376c1e65
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
313 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
314 > [hooks]
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
315 > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
316 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
317 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
318 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
319 searching for changes
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
320 prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
321 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
322 [255]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
323
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
324 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
325 incoming changes no longer there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
326
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
327 $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
328 > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
329 > pretxnchangegroup.forbid0 = hg tip -q
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
330 > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
331 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
332 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
333 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
334 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
335 adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
336 adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
337 adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
338 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
339 4:539e4b31b6dc
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
340 pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
341 transaction abort!
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
342 rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
343 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
344 [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
345 $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
346 3:07f3376c1e65
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
347
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
348 outgoing hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
349
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
350 $ rm .hg/hgrc
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
351 $ cat > ../a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
352 > [hooks]
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
353 > preoutgoing = sh -c "printenv.py preoutgoing"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
354 > outgoing = sh -c "printenv.py outgoing"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
355 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
356 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
357 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
358 searching for changes
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
359 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
360 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
361 adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
362 adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
363 adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
364 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
365 adding remote bookmark quux
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 34452
diff changeset
366 new changesets 539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
367 (run 'hg update' to get a working copy)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
368 $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13439
diff changeset
369 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
370
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
371 preoutgoing hook can prevent outgoing changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
372
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
373 $ cat >> ../a/.hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
374 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
375 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
376 $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
377 pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
378 searching for changes
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
379 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
380 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
381 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
382 [255]
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
383
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
384 outgoing hooks work for local clones
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
385
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
386 $ cd ..
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
387 $ cat > a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
388 > [hooks]
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
389 > preoutgoing = sh -c "printenv.py preoutgoing"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
390 > outgoing = sh -c "printenv.py outgoing"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
391 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
392 $ hg clone a c
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
393 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
394 outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
395 updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
396 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
397 $ rm -rf c
8907
e9ef409e6399 Add (pre)outgoing hooks for local clones.
Fred Wulff <frew@cs.stanford.edu>
parents: 4659
diff changeset
398
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
399 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
400
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
401 $ cat >> a/.hg/hgrc <<EOF
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
402 > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1"
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
403 > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
404 $ hg clone a zzz
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
405 preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
406 preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
407 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
408 [255]
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
409
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
410 $ cd "$TESTTMP/b"
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
411
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
412 $ cat > hooktests.py <<EOF
33721
24849d53697d tests: clean up many print statements to be print functions instead
Augie Fackler <augie@google.com>
parents: 33261
diff changeset
413 > from __future__ import print_function
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26028
diff changeset
414 > from mercurial import error
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
415 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
416 > uncallable = 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
417 >
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
418 > def printargs(ui, args):
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
419 > a = list(args.items())
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
420 > a.sort()
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
421 > ui.write('hook args:\n')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
422 > for k, v in a:
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
423 > ui.write(' %s %s\n' % (k, v))
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
424 >
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
425 > def passhook(ui, repo, **args):
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
426 > printargs(ui, args)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
427 >
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
428 > def failhook(ui, repo, **args):
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
429 > printargs(ui, args)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
430 > return True
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
431 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
432 > class LocalException(Exception):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
433 > pass
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
434 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
435 > def raisehook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
436 > raise LocalException('exception from hook')
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
437 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
438 > 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
439 > raise error.Abort('raise abort from hook')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
440 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
441 > def brokenhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
442 > return 1 + {}
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
443 >
14601
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
444 > def verbosehook(ui, **args):
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
445 > 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
446 >
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
447 > def printtags(ui, repo, **args):
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
448 > ui.write('%s\n' % sorted(repo.tags()))
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
449 >
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
450 > class container:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
451 > unreachable = 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
452 > EOF
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
453
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
454 $ cat > syntaxerror.py << EOF
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
455 > (foo
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
456 > EOF
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
457
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
458 test python hooks
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
459
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
460 #if windows
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
461 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
462 #else
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
463 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
464 #endif
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
465 $ export PYTHONPATH
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.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
469 $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
470 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
471
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
472 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
473 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
474 $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
475 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
476
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
477 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
478 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
479 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
480 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
481 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
482 error: preoutgoing.abort hook failed: raise abort from hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
483 abort: raise abort from hook
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.fail = python:hooktests.failhook' >> ../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 hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
492 hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
493 source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
494 abort: preoutgoing.fail hook failed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
495 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
496
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
497 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
498 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
499 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
500 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
501 searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
502 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
503 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
504
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
505 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
506 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
507 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
508 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
509 searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
510 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
511 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
512
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
513 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
514 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
515 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
516 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
517 searching for changes
28106
cedbe8723d99 hook: even fewer parentheses for load errors
Siddharth Agarwal <sid0@fb.com>
parents: 28080
diff changeset
518 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
519 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
520
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
521 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
522 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
523 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
524 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
525 searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
526 abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed
28080
37b818cad146 hook: for python hook ImportErrors, add note to run with --traceback
Siddharth Agarwal <sid0@fb.com>
parents: 28079
diff changeset
527 (run with --traceback for stack trace)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
528 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
529
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
530 $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
531 $ 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
532 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
533 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
534 searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
535 abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed
28080
37b818cad146 hook: for python hook ImportErrors, add note to run with --traceback
Siddharth Agarwal <sid0@fb.com>
parents: 28079
diff changeset
536 (run with --traceback for stack trace)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
537 [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
538
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
539 $ echo '[hooks]' > ../a/.hg/hgrc
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
540 $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
541 $ hg pull ../a
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
542 pulling from ../a
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
543 searching for changes
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
544 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
545 (run with --traceback for stack trace)
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
546 [255]
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
547
28444
12fdf49fa4dd hook: filter out unstable output in tests
Siddharth Agarwal <sid0@fb.com>
parents: 28109
diff changeset
548 The second egrep is to filter out lines like ' ^', which are slightly
12fdf49fa4dd hook: filter out unstable output in tests
Siddharth Agarwal <sid0@fb.com>
parents: 28109
diff changeset
549 different between Python 2.6 and Python 2.7.
12fdf49fa4dd hook: filter out unstable output in tests
Siddharth Agarwal <sid0@fb.com>
parents: 28109
diff changeset
550 $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$'
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
551 pulling from ../a
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
552 searching for changes
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
553 exception from first failed import attempt:
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
554 Traceback (most recent call last):
28737
a3a01194a337 pypy: fix overspecific test checks
Maciej Fijalkowski <fijall@gmail.com>
parents: 28444
diff changeset
555 SyntaxError: * (glob)
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
556 exception from second failed import attempt:
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
557 Traceback (most recent call last):
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
558 ImportError: No module named hgext_syntaxerror
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
559 Traceback (most recent call last):
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
560 HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
561 abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
562
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
563 $ echo '[hooks]' > ../a/.hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
564 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
565 $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
566 pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
567 searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
568 hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
569 hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
570 source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
571 adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
572 adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
573 adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
574 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
575 adding remote bookmark quux
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 34452
diff changeset
576 new changesets 539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
577 (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
578
28107
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
579 post- python hooks that fail to *run* don't cause an abort
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
580 $ rm ../a/.hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
581 $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
582 $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
583 $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
584 pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
585 searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
586 no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
587 error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
28108
2a71d9483199 hook: for python hook exceptions, add note to run with --traceback
Siddharth Agarwal <sid0@fb.com>
parents: 28107
diff changeset
588 (run with --traceback for stack trace)
28107
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
589
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
590 but post- python hooks that fail to *load* do
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
591 $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
592 $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
593 $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
594 pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
595 searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
596 no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
597 abort: post-pull.nomodule hook is invalid: "nomodule" not in a module
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
598 [255]
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
599
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
600 $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
601 $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
602 $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
603 pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
604 searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
605 no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
606 abort: post-pull.badmodule hook is invalid: import of "nomodule" failed
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
607 (run with --traceback for stack trace)
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
608 [255]
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
609
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
610 $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
611 $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
612 $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
613 pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
614 searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
615 no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
616 abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
617 [255]
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
618
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
619 make sure --traceback works
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
620
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
621 $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
622 $ 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
623
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
624 $ echo aa > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
625 $ 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
626 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
627
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
628 $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
629 $ hg init c
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
630 $ 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
631
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
632 $ cat > hookext.py <<EOF
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
633 > def autohook(ui, **args):
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
634 > ui.write('Automatically installed hook\n')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
635 >
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
636 > def reposetup(ui, repo):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
637 > repo.ui.setconfig("hooks", "commit.auto", autohook)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
638 > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
639 $ echo '[extensions]' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
640 $ 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
641
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
642 $ touch foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
643 $ hg add foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
644 $ hg ci -d '0 0' -m 'add foo'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
645 Automatically installed hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
646 $ echo >> foo
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
647 $ 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
648 committing files:
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
649 foo
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
650 committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
651 committing changelog
32267
c2380b448265 caches: move the 'updating the branch cache' message in 'updatecaches'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31767
diff changeset
652 updating the branch cache
27192
a01d3d32b53a commands: make commit acquire locks before processing (issue4368)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26861
diff changeset
653 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
654 calling hook commit.auto: hgext_hookext.autohook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
655 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
656
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
657 $ hg showconfig hooks
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
658 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
659
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
660 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
661
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
662 $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
663 $ mkdir d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
664 $ cd d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
665 $ hg init repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
666 $ mkdir hooks
9014
87c05a78e588 test python hook configured with python:[file]:[hook] syntax
Henri Wiechers <hwiechers@gmail.com>
parents: 8907
diff changeset
667
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
668 $ cd hooks
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
669 $ cat > testhooks.py <<EOF
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
670 > def testhook(ui, **args):
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
671 > ui.write('hook works\n')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
672 > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
673 $ echo '[hooks]' > ../repo/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
674 $ 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
675
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
676 $ cd ../repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
677 $ hg commit -d '0 0'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
678 hook works
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
679 nothing changed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
680 [1]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
681
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
682 $ echo '[hooks]' > .hg/hgrc
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
683 $ 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
684 $ 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
685
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
686 $ hg up null
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
687 loading update.ne hook failed:
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
688 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
689 [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
690
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
691 $ hg id
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
692 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
693 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
694 [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
695
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
696 $ cd ../../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
697
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
698 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
699
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
700 $ cat > importfail.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
701 > import somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
702 > # 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
703 > somebogusmodule.whatever
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
704 > 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
705
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
706 $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
707 $ 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
708
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
709 $ 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
710 $ 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
711 exception from first failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
712 Traceback (most recent call last):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
713 ImportError: No module named somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
714 exception from second failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
715 Traceback (most recent call last):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
716 ImportError: No module named hgext_importfail
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
717 Traceback (most recent call last):
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
718 HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
719 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
720
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
721 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
722
24881
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
723 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
724 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
725 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
726
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
727 $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
728 $ echo 'commit = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
729 $ echo 'update = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
730 $ echo bb > a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
731 $ hg ci -ma
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
732 223eafe2750c tip
24881
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
733 $ hg up 0 --config extensions.largefiles=
33212
fe0667cc521e tests: add fsmonitor specific output lines at enabling largefiles
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33051
diff changeset
734 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
26752
949e8c626d19 merge: make in-memory changes visible to external update hooks
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26692
diff changeset
735 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
736 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
737
17508
57fb8c9509f4 spelling: propagated
timeless@mozdev.org
parents: 17492
diff changeset
738 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
739 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
740
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
741 $ echo '[hooks]' > .hg/hgrc
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
742 $ 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
743 $ hg id
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
744 cb9a9f314b8b
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
745 $ hg id --verbose
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
746 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
747 verbose output from hook
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
748 cb9a9f314b8b
15896
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
749
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
750 Ensure hooks can be prioritized
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
751
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
752 $ echo '[hooks]' > .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
753 $ 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
754 $ 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
755 $ 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
756 $ 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
757 $ hg id --verbose
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
758 calling hook pre-identify.b: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
759 verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
760 calling hook pre-identify.a: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
761 verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
762 calling hook pre-identify.c: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
763 verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
764 cb9a9f314b8b
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
765
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
766 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
767
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
768 $ 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
769 $ hg tag -f foo
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
770 ['a', 'foo', 'tip']
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
771
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
772 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
773 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
774
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
775 $ cd ..
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
776 $ 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
777 > [hooks]
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
778 > post-init = sh -c "printenv.py post-init"
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
779 > EOF
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
780 $ HGRCPATH=hgrc-with-post-init-hook hg init to
31747
aff7b32b3c05 hook: add hook name information to external hook
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31746
diff changeset
781 post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
782
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
783 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
784
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
785 $ 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
786 $ 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
787 $ 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
788 $ echo a >> to/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
789 $ hg --cwd to ci -Ama
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
790 adding a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
791 $ hg clone to from
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
792 updating to branch default
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
793 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
794 $ echo aa >> from/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
795 $ hg --cwd from ci -mb
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
796 $ hg --cwd from push
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
797 pushing to $TESTTMP/to (glob)
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
798 searching for changes
26859
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
799 changeset: 0:cb9a9f314b8b
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
800 tag: tip
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
801 user: test
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
802 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
803 summary: a
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
804
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
805 adding changesets
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
806 adding manifests
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
807 adding file changes
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
808 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
809 changeset: 1:9836a07b9b9d
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
810 tag: tip
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
811 user: test
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
812 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
813 summary: b
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
814
27924
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
815
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
816 pretxnclose hook failure should abort the transaction
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
817
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
818 $ hg init txnfailure
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
819 $ cd txnfailure
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
820 $ touch a && hg commit -Aqm a
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
821 $ cat >> .hg/hgrc <<EOF
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
822 > [hooks]
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
823 > pretxnclose.error = exit 1
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
824 > EOF
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
825 $ hg strip -r 0 --config extensions.strip=
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
826 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
827 saved backup bundle to * (glob)
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
828 transaction abort!
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
829 rollback completed
29954
769aee32fae0 strip: don't use "full" and "partial" to describe bundles
Martin von Zweigbergk <martinvonz@google.com>
parents: 29780
diff changeset
830 strip failed, backup bundle stored in * (glob)
27924
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
831 abort: pretxnclose.error hook exited with status 1
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
832 [255]
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
833 $ hg recover
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
834 no interrupted transaction available
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
835 [1]
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
836 $ cd ..
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
837
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
838 check whether HG_PENDING makes pending changes only in related
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
839 repositories visible to an external hook.
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
840
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
841 (emulate a transaction running concurrently by copied
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
842 .hg/store/00changelog.i.a in subsequent test)
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
843
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
844 $ cat > $TESTTMP/savepending.sh <<EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
845 > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
846 > exit 1 # to avoid adding new revision for subsequent tests
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
847 > EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
848 $ cd a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
849 $ hg tip -q
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
850 4:539e4b31b6dc
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
851 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible"
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
852 transaction abort!
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
853 rollback completed
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
854 abort: pretxnclose hook exited with status 1
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
855 [255]
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
856 $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
857
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
858 (check (in)visibility of new changeset while transaction running in
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
859 repo)
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
860
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
861 $ cat > $TESTTMP/checkpending.sh <<EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
862 > echo '@a'
31767
6c800688afe1 tests: quote paths in shell script hooks
Matt Harbison <matt_harbison@yahoo.com>
parents: 31747
diff changeset
863 > hg -R "$TESTTMP/a" tip -q
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
864 > echo '@a/nested'
31767
6c800688afe1 tests: quote paths in shell script hooks
Matt Harbison <matt_harbison@yahoo.com>
parents: 31747
diff changeset
865 > hg -R "$TESTTMP/a/nested" tip -q
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
866 > exit 1 # to avoid adding new revision for subsequent tests
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
867 > EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
868 $ hg init nested
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
869 $ cd nested
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
870 $ echo a > a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
871 $ hg add a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
872 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0'
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
873 @a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
874 4:539e4b31b6dc
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
875 @a/nested
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
876 0:bf5e395ced2c
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
877 transaction abort!
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
878 rollback completed
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
879 abort: pretxnclose hook exited with status 1
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
880 [255]
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
881
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
882 Hook from untrusted hgrc are reported as failure
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
883 ================================================
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
884
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
885 $ cat << EOF > $TESTTMP/untrusted.py
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
886 > from mercurial import scmutil, util
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
887 > def uisetup(ui):
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
888 > class untrustedui(ui.__class__):
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
889 > def _trusted(self, fp, f):
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
890 > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'):
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
891 > return False
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
892 > return super(untrustedui, self)._trusted(fp, f)
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
893 > ui.__class__ = untrustedui
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
894 > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
895 $ cat << EOF >> $HGRCPATH
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
896 > [extensions]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
897 > untrusted=$TESTTMP/untrusted.py
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
898 > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
899 $ hg init untrusted
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
900 $ cd untrusted
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
901
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
902 Non-blocking hook
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
903 -----------------
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
904
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
905 $ cat << EOF >> .hg/hgrc
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
906 > [hooks]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
907 > txnclose.testing=echo txnclose hook called
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
908 > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
909 $ touch a && hg commit -Aqm a
31743
f610c3220eec hook: fix name used in untrusted message
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31741
diff changeset
910 warning: untrusted hook txnclose.testing not executed
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
911 $ hg log
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
912 changeset: 0:3903775176ed
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
913 tag: tip
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
914 user: test
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
915 date: Thu Jan 01 00:00:00 1970 +0000
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
916 summary: a
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
917
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
918
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
919 Non-blocking hook
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
920 -----------------
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
921
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
922 $ cat << EOF >> .hg/hgrc
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
923 > [hooks]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
924 > pretxnclose.testing=echo pre-txnclose hook called
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
925 > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
926 $ touch b && hg commit -Aqm a
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
927 transaction abort!
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
928 rollback completed
31743
f610c3220eec hook: fix name used in untrusted message
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31741
diff changeset
929 abort: untrusted hook pretxnclose.testing not executed
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
930 (see 'hg help config.trusted')
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
931 [255]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
932 $ hg log
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
933 changeset: 0:3903775176ed
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
934 tag: tip
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
935 user: test
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
936 date: Thu Jan 01 00:00:00 1970 +0000
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
937 summary: a
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
938