tests/test-hook.t
author Raphaël Gomès <rgomes@octobus.net>
Tue, 01 Oct 2024 13:49:11 +0200
changeset 52060 8b7123c8947b
parent 51181 dcaa2df1f688
permissions -rw-r--r--
update: add a Rust fast-path when updating from null (and clean) This case is easy to detect and we have all we need to generate a valid working copy and dirstate entirely in Rust, which speeds things up considerably: On my machine updating a repo of ~300k files goes from 10.00s down to 4.2s, all while consuming 50% less system time, with all caches hot. Something to note is that further improvements will probably happen with the upcoming `InnerRevlog` series that does smarter mmap hanlding, especially for filelogs. Here are benchmark numbers on a machine with only 4 cores (and no SMT enabled) ``` ### data-env-vars.name = heptapod-public-2024-03-25-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 5.328762 ~~~~~ rust: 1.308654 (-75.44%, -4.02) ### data-env-vars.name = mercurial-devel-2024-03-22-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 1.693271 ~~~~~ rust: 1.151053 (-32.02%, -0.54) ### data-env-vars.name = mozilla-unified-2024-03-22-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 38.901613 ~~~~~ rust: 11.637880 (-70.08%, -27.26) ### data-env-vars.name = netbsd-xsrc-public-2024-09-19-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 4.793727 ~~~~~ rust: 1.505905 (-68.59%, -3.29) ```
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
     6
  > from mercurial import pycompat
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
     7
  > def showargs(ui, repo, hooktype, **kwargs):
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
     8
  >     kwargs = pycompat.byteskwargs(kwargs)
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
     9
  >     ui.write(b'%s Python hook: %s\n' % (hooktype,
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
    10
  >                                         b','.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
    11
  > EOF
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
    12
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    13
  $ hg init a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    14
  $ cd a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    15
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    16
  > [hooks]
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    17
  > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    18
  > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit.b"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    19
  > precommit = sh -c  "HG_LOCAL= HG_NODE= HG_TAG= printenv.py --line precommit"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    20
  > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxncommit"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    21
  > pretxncommit.tip = hg -q tip
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    22
  > pre-identify = sh -c "printenv.py --line pre-identify 1"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    23
  > pre-cat = sh -c "printenv.py --line pre-cat"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    24
  > post-cat = sh -c "printenv.py --line post-cat"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    25
  > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnopen"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    26
  > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnclose"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    27
  > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnclose"
25218
00d905a12bb6 localrepo: rename hook argument from TXNID to txnid (BC)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 24881
diff changeset
    28
  > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    29
  > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py --line 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
    30
  > txnclose.checklock = sh -c "hg debuglock > /dev/null"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    31
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    32
  $ echo a > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    33
  $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    34
  $ hg commit -m a
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    35
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    36
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    37
  HG_PARENT1=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    38
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    39
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    40
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    41
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    42
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    43
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    44
  pretxncommit hook: HG_HOOKNAME=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    45
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    46
  HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    47
  HG_PARENT1=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    48
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    49
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    50
  0:cb9a9f314b8b
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    51
  pretxnclose hook: HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    52
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    53
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    54
  HG_PHASES_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    55
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    56
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    57
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    58
  txnclose hook: HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    59
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    60
  HG_PHASES_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    61
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    62
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    63
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    64
  commit hook: HG_HOOKNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    65
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    66
  HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    67
  HG_PARENT1=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    68
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    69
  commit.b hook: HG_HOOKNAME=commit.b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    70
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    71
  HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    72
  HG_PARENT1=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    73
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    74
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    75
  $ hg clone . ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    76
  updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    77
  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
    78
  $ 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
    79
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    80
changegroup hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    81
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    82
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    83
  > [hooks]
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    84
  > prechangegroup = sh -c "printenv.py --line prechangegroup"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    85
  > changegroup = sh -c "printenv.py --line changegroup"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    86
  > incoming = sh -c "printenv.py --line incoming"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    87
  > EOF
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
    88
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    89
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
    90
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    91
  $ cd ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    92
  $ echo b >> a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    93
  $ hg commit -m a1 -d "1 0"
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    94
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    95
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    96
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    97
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    98
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
    99
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   100
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   101
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   102
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   103
  pretxncommit hook: HG_HOOKNAME=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   104
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   105
  HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   106
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   107
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   108
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   109
  1:ab228980c14d
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   110
  pretxnclose hook: HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   111
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   112
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   113
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   114
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   115
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   116
  txnclose hook: HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   117
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   118
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   119
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   120
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   121
  commit hook: HG_HOOKNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   122
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   123
  HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   124
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   125
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   126
  commit.b hook: HG_HOOKNAME=commit.b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   127
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   128
  HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   129
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   130
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   131
  $ hg update -C 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   132
  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
   133
  $ echo b > b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   134
  $ hg add b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   135
  $ hg commit -m b -d '1 0'
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   136
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   137
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   138
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   139
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   140
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   141
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   142
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   143
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   144
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   145
  pretxncommit hook: HG_HOOKNAME=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   146
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   147
  HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   148
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   149
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   150
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   151
  2:ee9deb46ab31
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   152
  pretxnclose hook: HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   153
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   154
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   155
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   156
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   157
  
27192
a01d3d32b53a commands: make commit acquire locks before processing (issue4368)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26861
diff changeset
   158
  created new head
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   159
  txnclose hook: HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   160
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   161
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   162
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   163
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   164
  commit hook: HG_HOOKNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   165
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   166
  HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   167
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   168
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   169
  commit.b hook: HG_HOOKNAME=commit.b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   170
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   171
  HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   172
  HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   173
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   174
  $ hg merge 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   175
  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
   176
  (branch merge, don't forget to commit)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   177
  $ hg commit -m merge -d '2 0'
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   178
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   179
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   180
  HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   181
  HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   182
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   183
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   184
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   185
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   186
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   187
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   188
  pretxncommit hook: HG_HOOKNAME=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   189
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   190
  HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   191
  HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   192
  HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   193
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   194
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   195
  3:07f3376c1e65
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   196
  pretxnclose hook: HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   197
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   198
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   199
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   200
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   201
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   202
  txnclose hook: HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   203
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   204
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   205
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   206
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   207
  commit hook: HG_HOOKNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   208
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   209
  HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   210
  HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   211
  HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   212
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   213
  commit.b hook: HG_HOOKNAME=commit.b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   214
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   215
  HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   216
  HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   217
  HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   218
  
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   219
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   220
test generic hooks
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   221
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   222
  $ hg id
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   223
  pre-identify hook: HG_ARGS=id
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   224
  HG_HOOKNAME=pre-identify
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   225
  HG_HOOKTYPE=pre-identify
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   226
  HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   227
  HG_PATS=[]
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   228
  
19011
12acbea17625 dispatch: print 'abort:' when a pre-command hook fails (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 18851
diff changeset
   229
  abort: pre-identify hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   230
  [40]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   231
  $ hg cat b
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   232
  pre-cat hook: HG_ARGS=cat b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   233
  HG_HOOKNAME=pre-cat
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   234
  HG_HOOKTYPE=pre-cat
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   235
  HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   236
  HG_PATS=['b']
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   237
  
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
   238
  b
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   239
  post-cat hook: HG_ARGS=cat b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   240
  HG_HOOKNAME=post-cat
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   241
  HG_HOOKTYPE=post-cat
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   242
  HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   243
  HG_PATS=['b']
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   244
  HG_RESULT=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   245
  
4630
e6d105a51ec7 dispatch: add generic pre- and post-command hooks
Matt Mackall <mpm@selenic.com>
parents: 4368
diff changeset
   246
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   247
  $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   248
  $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   249
  pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   250
  searching for changes
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   251
  prechangegroup hook: HG_HOOKNAME=prechangegroup
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   252
  HG_HOOKTYPE=prechangegroup
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   253
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   254
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   255
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   256
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   257
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   258
  
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   259
  adding changesets
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   260
  adding manifests
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   261
  adding file changes
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   262
  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
   263
  new changesets ab228980c14d:07f3376c1e65
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   264
  changegroup hook: HG_HOOKNAME=changegroup
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   265
  HG_HOOKTYPE=changegroup
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   266
  HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   267
  HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   268
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   269
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   270
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   271
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   272
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   273
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   274
  incoming hook: HG_HOOKNAME=incoming
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   275
  HG_HOOKTYPE=incoming
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   276
  HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   277
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   278
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   279
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   280
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   281
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   282
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   283
  incoming hook: HG_HOOKNAME=incoming
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   284
  HG_HOOKTYPE=incoming
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   285
  HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   286
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   287
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   288
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   289
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   290
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   291
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   292
  incoming hook: HG_HOOKNAME=incoming
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   293
  HG_HOOKTYPE=incoming
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   294
  HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   295
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   296
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   297
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   298
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   299
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   300
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   301
  (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
   302
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   303
tag hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   304
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   305
  $ cd ../a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   306
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   307
  > pretag = sh -c "printenv.py --line pretag"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   308
  > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py --line tag"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   309
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   310
  $ hg tag -d '3 0' a
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   311
  pretag hook: HG_HOOKNAME=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   312
  HG_HOOKTYPE=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   313
  HG_LOCAL=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   314
  HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   315
  HG_TAG=a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   316
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   317
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   318
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   319
  HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   320
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   321
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   322
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   323
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   324
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   325
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   326
  pretxncommit hook: HG_HOOKNAME=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   327
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   328
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   329
  HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   330
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   331
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   332
  4:539e4b31b6dc
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   333
  pretxnclose hook: HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   334
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   335
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   336
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   337
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   338
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   339
  tag hook: HG_HOOKNAME=tag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   340
  HG_HOOKTYPE=tag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   341
  HG_LOCAL=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   342
  HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   343
  HG_TAG=a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   344
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   345
  txnclose hook: HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   346
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   347
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   348
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   349
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   350
  commit hook: HG_HOOKNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   351
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   352
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   353
  HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   354
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   355
  commit.b hook: HG_HOOKNAME=commit.b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   356
  HG_HOOKTYPE=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   357
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   358
  HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   359
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   360
  $ hg tag -l la
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   361
  pretag hook: HG_HOOKNAME=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   362
  HG_HOOKTYPE=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   363
  HG_LOCAL=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   364
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   365
  HG_TAG=la
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   366
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   367
  tag hook: HG_HOOKNAME=tag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   368
  HG_HOOKTYPE=tag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   369
  HG_LOCAL=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   370
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   371
  HG_TAG=la
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   372
  
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   373
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   374
pretag hook can forbid tagging
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   375
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   376
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   377
  > pretag.forbid = sh -c "printenv.py --line pretag.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   378
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   379
  $ hg tag -d '4 0' fa
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   380
  pretag hook: HG_HOOKNAME=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   381
  HG_HOOKTYPE=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   382
  HG_LOCAL=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   383
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   384
  HG_TAG=fa
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   385
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   386
  pretag.forbid hook: HG_HOOKNAME=pretag.forbid
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   387
  HG_HOOKTYPE=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   388
  HG_LOCAL=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   389
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   390
  HG_TAG=fa
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   391
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   392
  abort: pretag.forbid hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   393
  [40]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   394
  $ hg tag -l fla
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   395
  pretag hook: HG_HOOKNAME=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   396
  HG_HOOKTYPE=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   397
  HG_LOCAL=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   398
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   399
  HG_TAG=fla
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   400
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   401
  pretag.forbid hook: HG_HOOKNAME=pretag.forbid
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   402
  HG_HOOKTYPE=pretag
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   403
  HG_LOCAL=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   404
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   405
  HG_TAG=fla
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   406
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   407
  abort: pretag.forbid hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   408
  [40]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   409
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   410
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
   411
more there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   412
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   413
  $ 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
   414
  > pretxncommit.forbid0 = sh -c "hg tip -q"
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   415
  > pretxncommit.forbid1 = sh -c "printenv.py --line pretxncommit.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   416
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   417
  $ echo z > z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   418
  $ hg add z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   419
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   420
  4:539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   421
  $ hg commit -m 'fail' -d '4 0'
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   422
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   423
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   424
  HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   425
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   426
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   427
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   428
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   429
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   430
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   431
  pretxncommit hook: HG_HOOKNAME=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   432
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   433
  HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   434
  HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   435
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   436
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   437
  5:6f611f8018c1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   438
  5:6f611f8018c1
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   439
  pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   440
  HG_HOOKTYPE=pretxncommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   441
  HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   442
  HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   443
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   444
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   445
  transaction abort!
44835
09da5cf44772 hooks: provide access to transaction changes for internal hooks
Joerg Sonnenberger <joerg@bec.de>
parents: 44121
diff changeset
   446
  txnabort Python hook: changes,txnid,txnname
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   447
  txnabort hook: HG_HOOKNAME=txnabort.1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   448
  HG_HOOKTYPE=txnabort
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   449
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   450
  HG_TXNNAME=commit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   451
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   452
  rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   453
  abort: pretxncommit.forbid1 hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   454
  [40]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   455
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   456
  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
   457
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   458
(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
   459
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   460
  $ ls -1 .hg/store/
51181
dcaa2df1f688 changelog: never inline changelog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50923
diff changeset
   461
  00changelog-1335303a.nd (rust !)
dcaa2df1f688 changelog: never inline changelog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50923
diff changeset
   462
  00changelog.d
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   463
  00changelog.i
51181
dcaa2df1f688 changelog: never inline changelog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50923
diff changeset
   464
  00changelog.n (rust !)
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   465
  00manifest.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   466
  data
51181
dcaa2df1f688 changelog: never inline changelog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50923
diff changeset
   467
  fncache
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   468
  phaseroots
48669
7ee07e1a25c0 share-safe: enable by default (BC)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46868
diff changeset
   469
  requires
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   470
  undo
51181
dcaa2df1f688 changelog: never inline changelog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50923
diff changeset
   471
  undo.backup.00changelog.n.bck (rust !)
dcaa2df1f688 changelog: never inline changelog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50923
diff changeset
   472
  undo.backup.fncache.bck
23904
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23749
diff changeset
   473
  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
   474
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   475
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   476
precommit hook can prevent commit
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   477
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   478
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   479
  > precommit.forbid = sh -c "printenv.py --line precommit.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   480
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   481
  $ hg commit -m 'fail' -d '4 0'
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   482
  precommit hook: HG_HOOKNAME=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   483
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   484
  HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   485
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   486
  precommit.forbid hook: HG_HOOKNAME=precommit.forbid
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   487
  HG_HOOKTYPE=precommit
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   488
  HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   489
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   490
  abort: precommit.forbid hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   491
  [40]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   492
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   493
  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
   494
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   495
preupdate hook can prevent update
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   496
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   497
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   498
  > preupdate = sh -c "printenv.py --line preupdate"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   499
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   500
  $ hg update 1
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   501
  preupdate hook: HG_HOOKNAME=preupdate
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   502
  HG_HOOKTYPE=preupdate
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   503
  HG_PARENT1=ab228980c14d
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   504
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   505
  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
   506
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   507
update hook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   508
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   509
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   510
  > update = sh -c "printenv.py --line update"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   511
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   512
  $ hg update
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   513
  preupdate hook: HG_HOOKNAME=preupdate
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   514
  HG_HOOKTYPE=preupdate
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   515
  HG_PARENT1=539e4b31b6dc
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   516
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   517
  update hook: HG_ERROR=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   518
  HG_HOOKNAME=update
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   519
  HG_HOOKTYPE=update
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   520
  HG_PARENT1=539e4b31b6dc
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   521
  
26028
6fbe35588433 update: wlock the repo for the whole 'hg update' command
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25744
diff changeset
   522
  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
   523
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   524
pushkey hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   525
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   526
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   527
  > pushkey = sh -c "printenv.py --line pushkey"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   528
  > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   529
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   530
  $ hg bookmark -r null foo
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   531
  $ hg push -B foo ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   532
  pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   533
  searching for changes
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   534
  no changes found
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   535
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   536
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   537
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   538
  HG_TXNNAME=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   539
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   540
  pretxnclose hook: HG_BOOKMARK_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   541
  HG_BUNDLE2=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   542
  HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   543
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   544
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   545
  HG_SOURCE=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   546
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   547
  HG_TXNNAME=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   548
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   549
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   550
  pushkey hook: HG_BUNDLE2=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   551
  HG_HOOKNAME=pushkey
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   552
  HG_HOOKTYPE=pushkey
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   553
  HG_KEY=foo
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   554
  HG_NAMESPACE=bookmarks
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   555
  HG_NEW=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   556
  HG_PUSHKEYCOMPAT=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   557
  HG_SOURCE=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   558
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   559
  HG_TXNNAME=push
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   560
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   561
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   562
  txnclose hook: HG_BOOKMARK_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   563
  HG_BUNDLE2=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   564
  HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   565
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   566
  HG_SOURCE=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   567
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   568
  HG_TXNNAME=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   569
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   570
  
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   571
  exporting bookmark foo
16038
dad96e752079 push: don't treat bookmark as a found change
Matt Mackall <mpm@selenic.com>
parents: 15956
diff changeset
   572
  [1]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   573
  $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   574
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   575
listkeys hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   576
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   577
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   578
  > listkeys = sh -c "printenv.py --line listkeys"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   579
  > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   580
  $ hg bookmark -r null bar
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   581
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   582
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   583
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   584
  HG_TXNNAME=bookmark
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   585
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   586
  pretxnclose hook: HG_BOOKMARK_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   587
  HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   588
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   589
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   590
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   591
  HG_TXNNAME=bookmark
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   592
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   593
  txnclose hook: HG_BOOKMARK_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   594
  HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   595
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   596
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   597
  HG_TXNNAME=bookmark
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   598
  
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   599
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   600
  $ hg pull -B bar ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   601
  pulling from ../a
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   602
  listkeys hook: HG_HOOKNAME=listkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   603
  HG_HOOKTYPE=listkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   604
  HG_NAMESPACE=bookmarks
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   605
  HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   606
  
25370
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
   607
  no changes found
faed8e52b81f tests: use bundle2 for test-hook
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25268
diff changeset
   608
  adding remote bookmark bar
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   609
  $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   610
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   611
test that prepushkey can prevent incoming keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   612
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   613
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   614
  > prepushkey = sh -c "printenv.py --line prepushkey.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   615
  > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   616
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   617
  $ hg bookmark -r null baz
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   618
  $ hg push -B baz ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   619
  pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   620
  searching for changes
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   621
  listkeys hook: HG_HOOKNAME=listkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   622
  HG_HOOKTYPE=listkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   623
  HG_NAMESPACE=phases
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   624
  HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   625
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   626
  listkeys hook: HG_HOOKNAME=listkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   627
  HG_HOOKTYPE=listkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   628
  HG_NAMESPACE=bookmarks
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   629
  HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   630
  
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   631
  no changes found
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   632
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   633
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   634
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   635
  HG_TXNNAME=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   636
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   637
  prepushkey.forbid hook: HG_BUNDLE2=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   638
  HG_HOOKNAME=prepushkey
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   639
  HG_HOOKTYPE=prepushkey
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   640
  HG_KEY=baz
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   641
  HG_NAMESPACE=bookmarks
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   642
  HG_NEW=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   643
  HG_PUSHKEYCOMPAT=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   644
  HG_SOURCE=push
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   645
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   646
  HG_TXNNAME=push
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   647
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   648
  
49994
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   649
  txnabort Python hook: bundle2,changes,source,txnid,txnname,url
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   650
  txnabort hook: HG_BUNDLE2=1
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   651
  HG_HOOKNAME=txnabort.1
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   652
  HG_HOOKTYPE=txnabort
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   653
  HG_SOURCE=push
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   654
  HG_TXNID=TXN:$ID$
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   655
  HG_TXNNAME=push
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   656
  HG_URL=file:$TESTTMP/a
3128018e878b transaction: run abort callback in all cases
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49877
diff changeset
   657
  
35264
a1e70c1dbec0 bookmark: use the 'bookmarks' bundle2 part to push bookmark update (issue5165)
Boris Feld <boris.feld@octobus.net>
parents: 35230
diff changeset
   658
  abort: prepushkey hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   659
  [40]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   660
  $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   661
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   662
test that prelistkeys can prevent listing keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   663
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   664
  $ cat >> .hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   665
  > prelistkeys = sh -c "printenv.py --line prelistkeys.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   666
  > EOF
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   667
  $ hg bookmark -r null quux
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   668
  pretxnopen hook: HG_HOOKNAME=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   669
  HG_HOOKTYPE=pretxnopen
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   670
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   671
  HG_TXNNAME=bookmark
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   672
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   673
  pretxnclose hook: HG_BOOKMARK_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   674
  HG_HOOKNAME=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   675
  HG_HOOKTYPE=pretxnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   676
  HG_PENDING=$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   677
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   678
  HG_TXNNAME=bookmark
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   679
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   680
  txnclose hook: HG_BOOKMARK_MOVED=1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   681
  HG_HOOKNAME=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   682
  HG_HOOKTYPE=txnclose
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   683
  HG_TXNID=TXN:$ID$
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   684
  HG_TXNNAME=bookmark
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   685
  
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   686
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   687
  $ hg pull -B quux ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   688
  pulling from ../a
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   689
  prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   690
  HG_HOOKTYPE=prelistkeys
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   691
  HG_NAMESPACE=bookmarks
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   692
  
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   693
  abort: prelistkeys hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   694
  [40]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   695
  $ cd ../a
18850
442c0cb8287a test-hook.t: remove prelistkeys.forbid hook before moving on
Siddharth Agarwal <sid0@fb.com>
parents: 18377
diff changeset
   696
  $ rm .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
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
prechangegroup hook can prevent incoming changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   699
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   700
  $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   701
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   702
  3:07f3376c1e65
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   703
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   704
  > [hooks]
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   705
  > prechangegroup.forbid = sh -c "printenv.py --line prechangegroup.forbid 1"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   706
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   707
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   708
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   709
  searching for changes
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   710
  prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   711
  HG_HOOKTYPE=prechangegroup
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   712
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   713
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   714
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   715
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   716
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   717
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   718
  abort: prechangegroup.forbid hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   719
  [40]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   720
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   721
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
   722
incoming changes no longer there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   723
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   724
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   725
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   726
  > pretxnchangegroup.forbid0 = hg tip -q
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   727
  > pretxnchangegroup.forbid1 = sh -c "printenv.py --line pretxnchangegroup.forbid 1"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   728
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   729
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   730
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   731
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   732
  adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   733
  adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   734
  adding file changes
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   735
  4:539e4b31b6dc
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   736
  pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   737
  HG_HOOKTYPE=pretxnchangegroup
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   738
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   739
  HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   740
  HG_PENDING=$TESTTMP/b
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   741
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   742
  HG_TXNID=TXN:$ID$
41896
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   743
  HG_TXNNAME=pull
94faa2e84094 transaction: include txnname in the hookargs dictionary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41733
diff changeset
   744
  file:/*/$TESTTMP/a (glob)
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   745
  HG_URL=file:$TESTTMP/a
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   746
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   747
  transaction abort!
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   748
  rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   749
  abort: pretxnchangegroup.forbid1 hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   750
  [40]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   751
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   752
  3:07f3376c1e65
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
   753
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   754
outgoing hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   755
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   756
  $ rm .hg/hgrc
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   757
  $ cat > ../a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   758
  > [hooks]
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   759
  > preoutgoing = sh -c "printenv.py --line preoutgoing"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   760
  > outgoing = sh -c "printenv.py --line outgoing"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   761
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   762
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   763
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   764
  searching for changes
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   765
  preoutgoing hook: HG_HOOKNAME=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   766
  HG_HOOKTYPE=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   767
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   768
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   769
  outgoing hook: HG_HOOKNAME=outgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   770
  HG_HOOKTYPE=outgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   771
  HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   772
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   773
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   774
  adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   775
  adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   776
  adding file changes
42897
d7304434390f changegroup: move message about added changes to transaction summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41896
diff changeset
   777
  adding remote bookmark quux
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   778
  added 1 changesets with 1 changes to 1 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
   779
  new changesets 539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   780
  (run 'hg update' to get a working copy)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   781
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13439
diff changeset
   782
  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
   783
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   784
preoutgoing hook can prevent outgoing changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   785
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   786
  $ cat >> ../a/.hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   787
  > preoutgoing.forbid = sh -c "printenv.py --line preoutgoing.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   788
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   789
  $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   790
  pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   791
  searching for changes
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   792
  preoutgoing hook: HG_HOOKNAME=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   793
  HG_HOOKTYPE=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   794
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   795
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   796
  preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   797
  HG_HOOKTYPE=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   798
  HG_SOURCE=pull
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   799
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   800
  abort: preoutgoing.forbid hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   801
  [40]
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
   802
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   803
outgoing hooks work for local clones
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   804
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   805
  $ cd ..
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   806
  $ cat > a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   807
  > [hooks]
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   808
  > preoutgoing = sh -c "printenv.py --line preoutgoing"
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   809
  > outgoing = sh -c "printenv.py --line outgoing"
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   810
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   811
  $ hg clone a c
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   812
  preoutgoing hook: HG_HOOKNAME=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   813
  HG_HOOKTYPE=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   814
  HG_SOURCE=clone
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   815
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   816
  outgoing hook: HG_HOOKNAME=outgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   817
  HG_HOOKTYPE=outgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   818
  HG_NODE=0000000000000000000000000000000000000000
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   819
  HG_SOURCE=clone
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   820
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   821
  updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   822
  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
   823
  $ rm -rf c
8907
e9ef409e6399 Add (pre)outgoing hooks for local clones.
Fred Wulff <frew@cs.stanford.edu>
parents: 4659
diff changeset
   824
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   825
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
   826
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   827
  $ cat >> a/.hg/hgrc <<EOF
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   828
  > preoutgoing.forbid = sh -c "printenv.py --line preoutgoing.forbid 1"
30234
34a5f6c66bc5 tests: invoke printenv.py via sh -c for test portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29954
diff changeset
   829
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   830
  $ hg clone a zzz
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   831
  preoutgoing hook: HG_HOOKNAME=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   832
  HG_HOOKTYPE=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   833
  HG_SOURCE=clone
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   834
  
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   835
  preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   836
  HG_HOOKTYPE=preoutgoing
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   837
  HG_SOURCE=clone
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
   838
  
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   839
  abort: preoutgoing.forbid hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   840
  [40]
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   841
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   842
  $ cd "$TESTTMP/b"
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   843
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   844
  $ cat > hooktests.py <<EOF
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
   845
  > from mercurial import (
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
   846
  >     error,
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
   847
  >     pycompat,
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
   848
  > )
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   849
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   850
  > uncallable = 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   851
  > 
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
   852
  > def printargs(ui, args):
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
   853
  >     a = list(pycompat.byteskwargs(args).items())
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   854
  >     a.sort()
36109
361276a36d49 py3: use bytes literals for test extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35811
diff changeset
   855
  >     ui.write(b'hook args:\n')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   856
  >     for k, v in a:
36109
361276a36d49 py3: use bytes literals for test extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35811
diff changeset
   857
  >        ui.write(b'  %s %s\n' % (k, v))
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   858
  > 
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
   859
  > def passhook(ui, repo, **args):
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
   860
  >     printargs(ui, args)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   861
  > 
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
   862
  > def failhook(ui, repo, **args):
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
   863
  >     printargs(ui, args)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   864
  >     return True
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   865
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   866
  > class LocalException(Exception):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   867
  >     pass
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   868
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   869
  > def raisehook(**args):
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
   870
  >     raise LocalException('exception from hook')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   871
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   872
  > def aborthook(**args):
36109
361276a36d49 py3: use bytes literals for test extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35811
diff changeset
   873
  >     raise error.Abort(b'raise abort from hook')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   874
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   875
  > def brokenhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   876
  >     return 1 + {}
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   877
  > 
14601
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   878
  > def verbosehook(ui, **args):
36109
361276a36d49 py3: use bytes literals for test extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35811
diff changeset
   879
  >     ui.note(b'verbose output from hook\n')
14601
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   880
  > 
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   881
  > def printtags(ui, repo, **args):
37753
f450a3be62ec tests: manually print list in test-hook.t
Augie Fackler <augie@google.com>
parents: 37415
diff changeset
   882
  >     ui.write(b'[%s]\n' % b', '.join(sorted(repo.tags())))
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   883
  > 
41733
d7ce1ea7a5f2 tests: define class in modern style to avoid check-code.py error
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 41639
diff changeset
   884
  > class container(object):
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   885
  >     unreachable = 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   886
  > EOF
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   887
40205
89ba51c3e4f1 tests: use NO_CHECK_EOF for fragments having intentional error
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 37754
diff changeset
   888
  $ cat > syntaxerror.py << NO_CHECK_EOF
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   889
  > (foo
40205
89ba51c3e4f1 tests: use NO_CHECK_EOF for fragments having intentional error
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 37754
diff changeset
   890
  > NO_CHECK_EOF
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   891
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   892
test python hooks
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   893
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   894
#if windows
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   895
  $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   896
#else
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   897
  $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   898
#endif
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   899
  $ export PYTHONPATH
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   900
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   901
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   902
  $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   903
  $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   904
  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
   905
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   906
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   907
  $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   908
  $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   909
  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
   910
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   911
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   912
  $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   913
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   914
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   915
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   916
  error: preoutgoing.abort hook failed: raise abort from hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   917
  abort: raise abort from hook
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   918
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   919
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   920
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   921
  $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   922
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   923
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   924
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   925
  hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   926
    hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   927
    source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   928
  abort: preoutgoing.fail hook failed
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
   929
  [40]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   930
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   931
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   932
  $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   933
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   934
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   935
  searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
   936
  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
   937
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   938
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   939
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   940
  $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   941
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   942
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   943
  searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
   944
  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
   945
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   946
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   947
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   948
  $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   949
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   950
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   951
  searching for changes
28106
cedbe8723d99 hook: even fewer parentheses for load errors
Siddharth Agarwal <sid0@fb.com>
parents: 28080
diff changeset
   952
  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
   953
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   954
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   955
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   956
  $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   957
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   958
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   959
  searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
   960
  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
   961
  (run with --traceback for stack trace)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   962
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   963
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   964
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   965
  $ 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
   966
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   967
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   968
  searching for changes
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
   969
  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
   970
  (run with --traceback for stack trace)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   971
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   972
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   973
  $ 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
   974
  $ 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
   975
  $ hg pull ../a
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   976
  pulling from ../a
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   977
  searching for changes
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   978
  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
   979
  (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
   980
  [255]
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   981
50725
7e5be4a7cda7 tests: use grep -E instead of obsolescent egrep
Mads Kiilerich <mads@kiilerich.com>
parents: 50465
diff changeset
   982
  $ hg pull ../a --traceback 2>&1 | grep -E 'pulling|searching|^exception|Traceback|SyntaxError|ImportError|ModuleNotFoundError|HookLoadError|abort'
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   983
  pulling from ../a
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   984
  searching for changes
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   985
  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
   986
  Traceback (most recent call last):
28737
a3a01194a337 pypy: fix overspecific test checks
Maciej Fijalkowski <fijall@gmail.com>
parents: 28444
diff changeset
   987
  SyntaxError: * (glob)
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   988
  exception from second failed import attempt:
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
   989
  Traceback (most recent call last):
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
   990
  SyntaxError: * (glob)
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   991
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
   992
  ModuleNotFoundError: No module named 'hgext_syntaxerror'
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
   993
  Traceback (most recent call last):
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
   994
  SyntaxError: * (glob)
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
   995
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
   996
  ModuleNotFoundError: No module named 'hgext_syntaxerror'
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
   997
  Traceback (most recent call last):
50923
c642c03969ff dynamic-import: use sysstr for importing extension and others
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50725
diff changeset
   998
      raise error.HookLoadError(msg, hint=tracebackhint) (py37 !)
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
   999
  mercurial.error.HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed
28109
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
  1000
  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
  1001
b892e424f88c hook: don't crash on syntax errors in python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28108
diff changeset
  1002
  $ echo '[hooks]' > ../a/.hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1003
  $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1004
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1005
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1006
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1007
  hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1008
    hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1009
    source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1010
  adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1011
  adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1012
  adding file changes
42897
d7304434390f changegroup: move message about added changes to transaction summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41896
diff changeset
  1013
  adding remote bookmark quux
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1014
  added 1 changesets with 1 changes to 1 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
  1015
  new changesets 539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1016
  (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
  1017
28107
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1018
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
  1019
  $ rm ../a/.hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1020
  $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1021
  $ 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
  1022
  $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1023
  pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1024
  searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1025
  no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1026
  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
  1027
  (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
  1028
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1029
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
  1030
  $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1031
  $ 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
  1032
  $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1033
  pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1034
  searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1035
  no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1036
  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
  1037
  [255]
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1038
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1039
  $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1040
  $ 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
  1041
  $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1042
  pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1043
  searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1044
  no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1045
  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
  1046
  (run with --traceback for stack trace)
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1047
  [255]
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1048
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1049
  $ echo '[hooks]' > .hg/hgrc
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1050
  $ 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
  1051
  $ hg pull ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1052
  pulling from ../a
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1053
  searching for changes
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1054
  no changes found
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1055
  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
  1056
  [255]
88e309a0c133 hook: add tests for failing post- python hooks
Siddharth Agarwal <sid0@fb.com>
parents: 28106
diff changeset
  1057
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
  1058
make sure --traceback works
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
  1059
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1060
  $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1061
  $ 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
  1062
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1063
  $ echo aa > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1064
  $ 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
  1065
  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
  1066
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1067
  $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1068
  $ hg init c
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1069
  $ 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
  1070
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1071
  $ cat > hookext.py <<EOF
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
  1072
  > def autohook(ui, **args):
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
  1073
  >     ui.write(b'Automatically installed hook\n')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1074
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1075
  > def reposetup(ui, repo):
37754
9bbb13c0f982 tests: port inline extensions in test-hook.t to py3
Augie Fackler <augie@google.com>
parents: 37753
diff changeset
  1076
  >     repo.ui.setconfig(b"hooks", b"commit.auto", autohook)
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1077
  > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1078
  $ echo '[extensions]' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1079
  $ 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
  1080
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1081
  $ touch foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1082
  $ hg add foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1083
  $ hg ci -d '0 0' -m 'add foo'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1084
  Automatically installed hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1085
  $ echo >> foo
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
  1086
  $ 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
  1087
  committing files:
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1088
  foo
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
  1089
  committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
  1090
  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
  1091
  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
  1092
  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
  1093
  calling hook commit.auto: hgext_hookext.autohook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1094
  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
  1095
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
  1096
  $ hg showconfig hooks
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
  1097
  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
  1098
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
  1099
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
  1100
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1101
  $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1102
  $ mkdir d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1103
  $ cd d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1104
  $ hg init repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1105
  $ mkdir hooks
9014
87c05a78e588 test python hook configured with python:[file]:[hook] syntax
Henri Wiechers <hwiechers@gmail.com>
parents: 8907
diff changeset
  1106
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1107
  $ cd hooks
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1108
  $ cat > testhooks.py <<EOF
34452
26c879bbf4ee test-hook: make test compatible with chg
Saurabh Singh <singhsrb@fb.com>
parents: 34322
diff changeset
  1109
  > def testhook(ui, **args):
36109
361276a36d49 py3: use bytes literals for test extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35811
diff changeset
  1110
  >     ui.write(b'hook works\n')
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1111
  > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1112
  $ echo '[hooks]' > ../repo/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1113
  $ 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
  1114
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1115
  $ cd ../repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1116
  $ hg commit -d '0 0'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1117
  hook works
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1118
  nothing changed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
  1119
  [1]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1120
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1121
  $ echo '[hooks]' > .hg/hgrc
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
  1122
  $ 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
  1123
  $ 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
  1124
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1125
  $ hg up null
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1126
  loading update.ne hook failed:
41420
b6673e9bdcf6 dispatch: quote filename in IOError as well
Yuya Nishihara <yuya@tcha.org>
parents: 40205
diff changeset
  1127
  abort: $ENOENT$: '$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
  1128
  [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1129
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1130
  $ hg id
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1131
  loading pre-identify.npmd hook failed:
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
  1132
  abort: No module named 'repo'
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1133
  [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
  1134
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1135
  $ cd ../../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1136
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
  1137
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
  1138
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1139
  $ cat > importfail.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1140
  > import somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1141
  > # 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
  1142
  > somebogusmodule.whatever
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1143
  > 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
  1144
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1145
  $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1146
  $ 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
  1147
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1148
  $ echo a >> a
50725
7e5be4a7cda7 tests: use grep -E instead of obsolescent egrep
Mads Kiilerich <mads@kiilerich.com>
parents: 50465
diff changeset
  1149
  $ hg --traceback commit -ma 2>&1 | grep -E '^exception|ImportError|ModuleNotFoundError|Traceback|HookLoadError|abort'
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1150
  exception from first failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1151
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
  1152
  ModuleNotFoundError: No module named 'somebogusmodule'
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1153
  exception from second failed import attempt:
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
  1154
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
  1155
  ModuleNotFoundError: No module named 'somebogusmodule'
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
  1156
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
  1157
  ModuleNotFoundError: No module named 'hgext_importfail'
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
  1158
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
  1159
  ModuleNotFoundError: No module named 'somebogusmodule'
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1160
  Traceback (most recent call last):
50383
bcc8b351bcf2 tests: drop py36 conditionals in test-hook.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 50193
diff changeset
  1161
  ModuleNotFoundError: No module named 'hgext_importfail'
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1162
  Traceback (most recent call last):
50923
c642c03969ff dynamic-import: use sysstr for importing extension and others
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50725
diff changeset
  1163
      raise error.HookLoadError(msg, hint=tracebackhint) (py37 !)
49876
950c39918bd2 tests: drop `(py3 !)` output matching predicates
Matt Harbison <matt_harbison@yahoo.com>
parents: 48876
diff changeset
  1164
  mercurial.error.HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed
28079
0c9e914029be hook: fewer parentheses for hook load errors
Siddharth Agarwal <sid0@fb.com>
parents: 27924
diff changeset
  1165
  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
  1166
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
  1167
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
  1168
24881
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
  1169
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
  1170
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
  1171
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
  1172
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1173
  $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1174
  $ echo 'commit = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1175
  $ echo 'update = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
  1176
  $ echo bb > a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
  1177
  $ hg ci -ma
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
  1178
  223eafe2750c tip
24881
51844b8b5017 merge: run update hook after the last wlock release
Matt Harbison <matt_harbison@yahoo.com>
parents: 24827
diff changeset
  1179
  $ 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
  1180
  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
  1181
  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
  1182
  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
  1183
17508
57fb8c9509f4 spelling: propagated
timeless@mozdev.org
parents: 17492
diff changeset
  1184
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
  1185
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
  1186
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
  1187
  $ echo '[hooks]' > .hg/hgrc
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
  1188
  $ 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
  1189
  $ hg id
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
  1190
  cb9a9f314b8b
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
  1191
  $ hg id --verbose
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
  1192
  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
  1193
  verbose output from hook
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
  1194
  cb9a9f314b8b
15896
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1195
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1196
Ensure hooks can be prioritized
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1197
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1198
  $ echo '[hooks]' > .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1199
  $ 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
  1200
  $ 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
  1201
  $ 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
  1202
  $ 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
  1203
  $ hg id --verbose
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1204
  calling hook pre-identify.b: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1205
  verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1206
  calling hook pre-identify.a: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1207
  verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1208
  calling hook pre-identify.c: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1209
  verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
  1210
  cb9a9f314b8b
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
  1211
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
  1212
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
  1213
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
  1214
  $ 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
  1215
  $ hg tag -f foo
37753
f450a3be62ec tests: manually print list in test-hook.t
Augie Fackler <augie@google.com>
parents: 37415
diff changeset
  1216
  [a, foo, tip]
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
  1217
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
  1218
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
  1219
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
  1220
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
  1221
  $ cd ..
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
  1222
  $ 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
  1223
  > [hooks]
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1224
  > post-init = sh -c "printenv.py --line post-init"
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
  1225
  > EOF
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
  1226
  $ HGRCPATH=hgrc-with-post-init-hook hg init to
41639
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1227
  post-init hook: HG_ARGS=init to
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1228
  HG_HOOKNAME=post-init
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1229
  HG_HOOKTYPE=post-init
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1230
  HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''}
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1231
  HG_PATS=['to']
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1232
  HG_RESULT=0
f8443db3032e test: use `printenv.py --line` in `test-hook.t`
Boris Feld <boris.feld@octobus.net>
parents: 41420
diff changeset
  1233
  
27228
10695f8f3323 dirstate: don't write repo.currenttransaction to repo.dirstate if repo
Sietse Brouwer <sbbrouwer@gmail.com>
parents: 26861
diff changeset
  1234
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1235
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
  1236
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1237
  $ 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
  1238
  $ 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
  1239
  $ 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
  1240
  $ echo a >> to/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1241
  $ hg --cwd to ci -Ama
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1242
  adding a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1243
  $ hg clone to from
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1244
  updating to branch default
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1245
  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
  1246
  $ echo aa >> from/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1247
  $ hg --cwd from ci -mb
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1248
  $ hg --cwd from push
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35264
diff changeset
  1249
  pushing to $TESTTMP/to
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1250
  searching for changes
26859
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
  1251
  changeset:   0:cb9a9f314b8b
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
  1252
  tag:         tip
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
  1253
  user:        test
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
  1254
  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
  1255
  summary:     a
e7c618cee8df hooks: fix hooks not firing if prechangegroup was set (issue4934)
Durham Goode <durham@fb.com>
parents: 26858
diff changeset
  1256
  
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1257
  adding changesets
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1258
  adding manifests
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1259
  adding file changes
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1260
  changeset:   1:9836a07b9b9d
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1261
  tag:         tip
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1262
  user:        test
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1263
  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
  1264
  summary:     b
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
  1265
  
42897
d7304434390f changegroup: move message about added changes to transaction summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 41896
diff changeset
  1266
  added 1 changesets with 1 changes to 1 files
27924
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1267
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1268
pretxnclose hook failure should abort the transaction
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1269
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1270
  $ hg init txnfailure
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1271
  $ cd txnfailure
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1272
  $ touch a && hg commit -Aqm a
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1273
  $ cat >> .hg/hgrc <<EOF
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1274
  > [hooks]
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1275
  > pretxnclose.error = exit 1
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1276
  > EOF
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1277
  $ hg strip -r 0 --config extensions.strip=
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1278
  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
  1279
  saved backup bundle to * (glob)
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1280
  transaction abort!
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1281
  rollback completed
29954
769aee32fae0 strip: don't use "full" and "partial" to describe bundles
Martin von Zweigbergk <martinvonz@google.com>
parents: 29780
diff changeset
  1282
  strip failed, backup bundle stored in * (glob)
27924
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1283
  abort: pretxnclose.error hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
  1284
  [40]
27924
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1285
  $ hg recover
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1286
  no interrupted transaction available
24361fb68cba transaction: abort transaction during hook exception
Durham Goode <durham@fb.com>
parents: 27739
diff changeset
  1287
  [1]
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1288
  $ cd ..
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1289
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1290
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
  1291
repositories visible to an external hook.
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1292
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1293
(emulate a transaction running concurrently by copied
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1294
.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
  1295
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1296
  $ cat > $TESTTMP/savepending.sh <<EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1297
  > 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
  1298
  > 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
  1299
  > EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1300
  $ cd a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1301
  $ hg tip -q
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1302
  4:539e4b31b6dc
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1303
  $ 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
  1304
  transaction abort!
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1305
  rollback completed
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1306
  abort: pretxnclose hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
  1307
  [40]
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1308
  $ 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
  1309
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1310
(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
  1311
repo)
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1312
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1313
  $ cat > $TESTTMP/checkpending.sh <<EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1314
  > echo '@a'
31767
6c800688afe1 tests: quote paths in shell script hooks
Matt Harbison <matt_harbison@yahoo.com>
parents: 31747
diff changeset
  1315
  > hg -R "$TESTTMP/a" tip -q
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1316
  > echo '@a/nested'
31767
6c800688afe1 tests: quote paths in shell script hooks
Matt Harbison <matt_harbison@yahoo.com>
parents: 31747
diff changeset
  1317
  > 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
  1318
  > 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
  1319
  > EOF
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1320
  $ hg init nested
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1321
  $ cd nested
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1322
  $ echo a > a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1323
  $ hg add a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1324
  $ 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
  1325
  @a
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1326
  4:539e4b31b6dc
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1327
  @a/nested
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1328
  0:bf5e395ced2c
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1329
  transaction abort!
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1330
  rollback completed
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1331
  abort: pretxnclose hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
  1332
  [40]
31054
59e69ed81776 localrepo: check HG_PENDING strictly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30234
diff changeset
  1333
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1334
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
  1335
================================================
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1336
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1337
  $ 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
  1338
  > 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
  1339
  > 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
  1340
  >     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
  1341
  >         def _trusted(self, fp, f):
36109
361276a36d49 py3: use bytes literals for test extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35811
diff changeset
  1342
  >             if util.normpath(fp.name).endswith(b'untrusted/.hg/hgrc'):
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1343
  >                 return False
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1344
  >             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
  1345
  >     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
  1346
  > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1347
  $ 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
  1348
  > [extensions]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1349
  > 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
  1350
  > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1351
  $ 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
  1352
  $ cd untrusted
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1353
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1354
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
  1355
-----------------
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1356
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1357
  $ 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
  1358
  > [hooks]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1359
  > 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
  1360
  > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1361
  $ 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
  1362
  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
  1363
  $ hg log
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1364
  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
  1365
  tag:         tip
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1366
  user:        test
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1367
  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
  1368
  summary:     a
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1369
  
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1370
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1371
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
  1372
-----------------
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1373
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1374
  $ 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
  1375
  > [hooks]
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1376
  > 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
  1377
  > EOF
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1378
  $ 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
  1379
  transaction abort!
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1380
  rollback completed
31743
f610c3220eec hook: fix name used in untrusted message
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31741
diff changeset
  1381
  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
  1382
  (see 'hg help config.trusted')
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
  1383
  [40]
28938
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1384
  $ hg log
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1385
  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
  1386
  tag:         tip
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1387
  user:        test
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1388
  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
  1389
  summary:     a
ea1fec3e9aba hook: report untrusted hooks as failure (issue5110) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 28737
diff changeset
  1390
  
46491
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1391
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1392
unsetup the test
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1393
----------------
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1394
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1395
# touch the file to unconfuse chg with a diffrent mtime
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1396
  $ sleep 1
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1397
  $ touch $TESTTMP/untrusted.py
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1398
  $ cat << EOF >> $HGRCPATH
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1399
  > [extensions]
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1400
  > untrusted=!
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1401
  > EOF
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1402
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1403
HGPLAIN setting in hooks
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1404
========================
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1405
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1406
  $ cat << EOF >> .hg/hgrc
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1407
  > [hooks]
46868
802ba3c81507 tests: stablize test-hook.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 46494
diff changeset
  1408
  > pre-version.testing-default=sh -c "echo '### default ###' plain: \${HGPLAIN:-'<unset>'}"
802ba3c81507 tests: stablize test-hook.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 46494
diff changeset
  1409
  > pre-version.testing-yes=sh -c "echo '### yes #######' plain: \${HGPLAIN:-'<unset>'}"
46492
7289eac777ec hooks: introduce a `:run-with-plain` option for hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46491
diff changeset
  1410
  > pre-version.testing-yes:run-with-plain=yes
46868
802ba3c81507 tests: stablize test-hook.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 46494
diff changeset
  1411
  > pre-version.testing-no=sh -c "echo '### no ########' plain: \${HGPLAIN:-'<unset>'}"
46492
7289eac777ec hooks: introduce a `:run-with-plain` option for hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46491
diff changeset
  1412
  > pre-version.testing-no:run-with-plain=no
46868
802ba3c81507 tests: stablize test-hook.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 46494
diff changeset
  1413
  > pre-version.testing-auto=sh -c "echo '### auto ######' plain: \${HGPLAIN:-'<unset>'}"
46493
b910be772eb9 hooks: add a `auto` value for `hooks.*run-with-plain`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46492
diff changeset
  1414
  > pre-version.testing-auto:run-with-plain=auto
46491
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1415
  > EOF
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1416
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1417
  $ (unset HGPLAIN; hg version --quiet)
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1418
  ### default ### plain: 1
46492
7289eac777ec hooks: introduce a `:run-with-plain` option for hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46491
diff changeset
  1419
  ### yes ####### plain: 1
7289eac777ec hooks: introduce a `:run-with-plain` option for hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46491
diff changeset
  1420
  ### no ######## plain: <unset>
46493
b910be772eb9 hooks: add a `auto` value for `hooks.*run-with-plain`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46492
diff changeset
  1421
  ### auto ###### plain: <unset>
46491
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1422
  Mercurial Distributed SCM (*) (glob)
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1423
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1424
  $ HGPLAIN=1 hg version --quiet
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1425
  ### default ### plain: 1
46492
7289eac777ec hooks: introduce a `:run-with-plain` option for hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46491
diff changeset
  1426
  ### yes ####### plain: 1
7289eac777ec hooks: introduce a `:run-with-plain` option for hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46491
diff changeset
  1427
  ### no ######## plain: <unset>
46493
b910be772eb9 hooks: add a `auto` value for `hooks.*run-with-plain`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46492
diff changeset
  1428
  ### auto ###### plain: 1
46491
0760282995cf hooks: add some test about HGPLAIN setting and hooks
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
  1429
  Mercurial Distributed SCM (*) (glob)
50322
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1430
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1431
Test hook that change the underlying repo
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1432
=========================================
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1433
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1434
blackbox access the dirstate afterward and can see a changelog / dirstate
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1435
desync.
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1436
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1437
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1438
  $ cd $TESTTMP
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1439
  $ cat <<EOF >> $HGRCPATH
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1440
  > [extensions]
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1441
  > blackbox=
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1442
  > [hooks]
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1443
  > post-merge = hg commit -m "auto merge"
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1444
  > EOF
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1445
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1446
  $ hg init t
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1447
  $ cd t
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1448
  $ touch ".hgignore"
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1449
  $ hg commit -Am "initial" -d'0 0'
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1450
  adding .hgignore
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1451
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1452
  $ echo This is file a1 > a
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1453
  $ hg commit -Am "commit #1" -d'0 0'
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1454
  adding a
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1455
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1456
  $ hg update 0
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1457
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1458
  $ echo This is file b1 > b
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1459
  $ hg commit -Am "commit #2" -d'0 0'
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1460
  adding b
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1461
  created new head
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1462
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1463
  $ hg merge 1
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1464
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1465
  (branch merge, don't forget to commit)
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1466
08f3875020d1 dirstate: add a test to highlight another changelog / dirstate race
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 50193
diff changeset
  1467
  $ cd ..