tests/test-hook.t
author Mads Kiilerich <madski@unity3d.com>
Fri, 18 Apr 2014 13:33:20 +0200
changeset 23749 a387b0390082
parent 23426 19ebd2f88fc7
child 23904 d251da5e0e84
permissions -rw-r--r--
localrepo: show headline notes in commitctx before showing filenames commitctx already showed notes with filenames but didn't provide any context. It is just as relevant to know when manifest or changelog is committed. So, in addition to filenames, also show headlines 'committing files:', 'committing manifest' and 'committing changelog'.
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
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
     2
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
     3
  $ hg init a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
     4
  $ cd a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
     5
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
     6
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
     7
  > commit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
     8
  > commit.b = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit.b"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
     9
  > precommit = sh -c  "HG_LOCAL= HG_NODE= HG_TAG= python \"$TESTDIR/printenv.py\" precommit"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    10
  > pretxncommit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxncommit"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    11
  > pretxncommit.tip = hg -q tip
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    12
  > pre-identify = python "$TESTDIR/printenv.py" pre-identify 1
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    13
  > pre-cat = python "$TESTDIR/printenv.py" pre-cat
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    14
  > post-cat = python "$TESTDIR/printenv.py" post-cat
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    15
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    16
  $ echo a > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    17
  $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    18
  $ hg commit -m a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    19
  precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    20
  pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    21
  0:cb9a9f314b8b
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    22
  commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    23
  commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    24
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    25
  $ hg clone . ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    26
  updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    27
  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
    28
  $ 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
    29
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    30
changegroup hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    31
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    32
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    33
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    34
  > prechangegroup = python "$TESTDIR/printenv.py" prechangegroup
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    35
  > changegroup = python "$TESTDIR/printenv.py" changegroup
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    36
  > incoming = python "$TESTDIR/printenv.py" incoming
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    37
  > EOF
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
    38
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    39
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
    40
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    41
  $ cd ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    42
  $ echo b >> a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    43
  $ hg commit -m a1 -d "1 0"
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    44
  precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    45
  pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    46
  1:ab228980c14d
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    47
  commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    48
  commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    49
  $ hg update -C 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    50
  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
    51
  $ echo b > b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    52
  $ hg add b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    53
  $ hg commit -m b -d '1 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    54
  precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    55
  pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    56
  2:ee9deb46ab31
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    57
  commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    58
  commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    59
  created new head
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    60
  $ hg merge 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    61
  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
    62
  (branch merge, don't forget to commit)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    63
  $ hg commit -m merge -d '2 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    64
  precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    65
  pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
    66
  3:07f3376c1e65
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    67
  commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    68
  commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
    69
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    70
test generic hooks
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    71
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    72
  $ hg id
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    73
  pre-identify hook: HG_ARGS=id HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[]
19011
12acbea17625 dispatch: print 'abort:' when a pre-command hook fails (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 18851
diff changeset
    74
  abort: pre-identify hook exited with status 1
12acbea17625 dispatch: print 'abort:' when a pre-command hook fails (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 18851
diff changeset
    75
  [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    76
  $ hg cat b
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    77
  pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
13121
bf763946f8b0 make_file: always return a fresh file handle that can be closed
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 12640
diff changeset
    78
  b
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    79
  post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
4630
e6d105a51ec7 dispatch: add generic pre- and post-command hooks
Matt Mackall <mpm@selenic.com>
parents: 4368
diff changeset
    80
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    81
  $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    82
  $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
    83
  pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
    84
  searching for changes
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    85
  prechangegroup hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
    86
  adding changesets
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
    87
  adding manifests
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
    88
  adding file changes
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
    89
  added 3 changesets with 2 changes to 2 files
22960
7c13c9404c2c changegroup: use a copy of hookargs when invoking the changegroup hook
Mike Hommey <mh@glandium.org>
parents: 22940
diff changeset
    90
  changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    91
  incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    92
  incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
    93
  incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    94
  (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
    95
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
    96
tag hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    97
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
    98
  $ cd ../a
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
    99
  $ cat >> .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   100
  > pretag = python "$TESTDIR/printenv.py" pretag
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   101
  > tag = sh -c "HG_PARENT1= HG_PARENT2= python \"$TESTDIR/printenv.py\" tag"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   102
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   103
  $ hg tag -d '3 0' a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   104
  pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   105
  precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   106
  pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   107
  4:539e4b31b6dc
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   108
  tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   109
  commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   110
  commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   111
  $ hg tag -l la
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   112
  pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   113
  tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   114
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   115
pretag hook can forbid tagging
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   116
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   117
  $ echo "pretag.forbid = python \"$TESTDIR/printenv.py\" pretag.forbid 1" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   118
  $ hg tag -d '4 0' fa
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   119
  pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   120
  pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   121
  abort: pretag.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   122
  [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   123
  $ hg tag -l fla
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   124
  pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   125
  pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   126
  abort: pretag.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   127
  [255]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   128
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   129
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
   130
more there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   131
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   132
  $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   133
  $ echo "pretxncommit.forbid1 = python \"$TESTDIR/printenv.py\" pretxncommit.forbid 1" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   134
  $ echo z > z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   135
  $ hg add z
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   136
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   137
  4:539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   138
  $ hg commit -m 'fail' -d '4 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   139
  precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   140
  pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   141
  5:6f611f8018c1
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   142
  5:6f611f8018c1
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   143
  pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   144
  transaction abort!
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   145
  rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   146
  abort: pretxncommit.forbid1 hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   147
  [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   148
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   149
  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
   150
23292
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   151
(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
   152
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   153
  $ ls -1 .hg/store/
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   154
  00changelog.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   155
  00manifest.i
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   156
  data
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   157
  fncache
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   158
  journal.phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   159
  phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   160
  undo
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   161
  undo.phaseroots
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   162
e44399c494ab changelog: register changelog.i.a as a temporary file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   163
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   164
precommit hook can prevent commit
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   165
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   166
  $ echo "precommit.forbid = python \"$TESTDIR/printenv.py\" precommit.forbid 1" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   167
  $ hg commit -m 'fail' -d '4 0'
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   168
  precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   169
  precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   170
  abort: precommit.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   171
  [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   172
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   173
  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
   174
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   175
preupdate hook can prevent update
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   176
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   177
  $ echo "preupdate = python \"$TESTDIR/printenv.py\" preupdate" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   178
  $ hg update 1
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   179
  preupdate hook: HG_PARENT1=ab228980c14d
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   180
  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
   181
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   182
update hook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   183
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   184
  $ echo "update = python \"$TESTDIR/printenv.py\" update" >> .hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   185
  $ hg update
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   186
  preupdate hook: HG_PARENT1=539e4b31b6dc
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   187
  update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   188
  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
   189
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   190
pushkey hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   191
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   192
  $ echo "pushkey = python \"$TESTDIR/printenv.py\" pushkey" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   193
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   194
  $ hg bookmark -r null foo
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   195
  $ hg push -B foo ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   196
  pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   197
  searching for changes
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   198
  no changes found
22651
b901645a8784 push: gather all bookmark decisions together
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22645
diff changeset
   199
  pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   200
  exporting bookmark foo
16038
dad96e752079 push: don't treat bookmark as a found change
Matt Mackall <mpm@selenic.com>
parents: 15956
diff changeset
   201
  [1]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   202
  $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   203
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   204
listkeys hook
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   205
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   206
  $ echo "listkeys = python \"$TESTDIR/printenv.py\" listkeys" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   207
  $ hg bookmark -r null bar
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   208
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   209
  $ hg pull -B bar ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   210
  pulling from ../a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   211
  listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
22645
6e431e1635b6 pull: move bookmark movements inside the `exchange.pull`
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22239
diff changeset
   212
  listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
14164
cb98fed52495 discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 14102
diff changeset
   213
  no changes found
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   214
  listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
16697
c285aae10f6c bookmarks: pull new bookmarks from remote by default (BC)
Levi Bard <levi@unity3d.com>
parents: 16619
diff changeset
   215
  adding remote bookmark bar
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   216
  $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   217
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   218
test that prepushkey can prevent incoming keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   219
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   220
  $ echo "prepushkey = python \"$TESTDIR/printenv.py\" prepushkey.forbid 1" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   221
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   222
  $ hg bookmark -r null baz
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   223
  $ hg push -B baz ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   224
  pushing to ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   225
  searching for changes
22019
9fcf772f15ff push: perform phases discovery before the push
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20548
diff changeset
   226
  listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
22239
0688010ee38f push: move bookmark discovery with other discovery steps
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22019
diff changeset
   227
  listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   228
  no changes found
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   229
  listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   230
  prepushkey.forbid hook: HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000
23416
53a65929ef1f pushkey: gracefully handle prepushkey hook failure (issue4455)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   231
  pushkey-abort: prepushkey hook exited with status 1
53a65929ef1f pushkey: gracefully handle prepushkey hook failure (issue4455)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   232
  exporting bookmark baz failed!
53a65929ef1f pushkey: gracefully handle prepushkey hook failure (issue4455)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22960
diff changeset
   233
  [1]
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   234
  $ cd ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   235
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   236
test that prelistkeys can prevent listing keys
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   237
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   238
  $ echo "prelistkeys = python \"$TESTDIR/printenv.py\" prelistkeys.forbid 1" >> .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   239
  $ hg bookmark -r null quux
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   240
  $ cd ../b
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   241
  $ hg pull -B quux ../a
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   242
  pulling from ../a
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   243
  prelistkeys.forbid hook: HG_NAMESPACE=bookmarks
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   244
  abort: prelistkeys hook exited with status 1
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   245
  [255]
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   246
  $ cd ../a
18850
442c0cb8287a test-hook.t: remove prelistkeys.forbid hook before moving on
Siddharth Agarwal <sid0@fb.com>
parents: 18377
diff changeset
   247
  $ rm .hg/hgrc
14102
7f45b1911893 pushkey: add hooks for pushkey/listkeys
Brodie Rao <brodie@bitheap.org>
parents: 13477
diff changeset
   248
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   249
prechangegroup hook can prevent incoming changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   250
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   251
  $ cd ../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   252
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   253
  3:07f3376c1e65
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   254
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   255
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   256
  > prechangegroup.forbid = python "$TESTDIR/printenv.py" prechangegroup.forbid 1
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   257
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   258
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   259
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   260
  searching for changes
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   261
  prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   262
  abort: prechangegroup.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   263
  [255]
1734
9488d53233b5 tests for new hooks. fix things i found when writing tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1481
diff changeset
   264
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   265
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
   266
incoming changes no longer there after
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   267
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   268
  $ cat > .hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   269
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   270
  > pretxnchangegroup.forbid0 = hg tip -q
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   271
  > pretxnchangegroup.forbid1 = python "$TESTDIR/printenv.py" pretxnchangegroup.forbid 1
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   272
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   273
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   274
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   275
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   276
  adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   277
  adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   278
  adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   279
  added 1 changesets with 1 changes to 1 files
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   280
  4:539e4b31b6dc
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   281
  pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   282
  transaction abort!
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   283
  rollback completed
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   284
  abort: pretxnchangegroup.forbid1 hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   285
  [255]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   286
  $ hg -q tip
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   287
  3:07f3376c1e65
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
   288
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   289
outgoing hooks can see env vars
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   290
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   291
  $ rm .hg/hgrc
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   292
  $ cat > ../a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   293
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   294
  > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   295
  > outgoing = python "$TESTDIR/printenv.py" outgoing
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   296
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   297
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   298
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   299
  searching for changes
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   300
  preoutgoing hook: HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   301
  adding changesets
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   302
  outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   303
  adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   304
  adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   305
  added 1 changesets with 1 changes to 1 files
16697
c285aae10f6c bookmarks: pull new bookmarks from remote by default (BC)
Levi Bard <levi@unity3d.com>
parents: 16619
diff changeset
   306
  adding remote bookmark quux
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   307
  (run 'hg update' to get a working copy)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   308
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 13439
diff changeset
   309
  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
   310
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   311
preoutgoing hook can prevent outgoing changes
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   312
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   313
  $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> ../a/.hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   314
  $ hg pull ../a
13439
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   315
  pulling from ../a
d724a69309e0 util: flush stdout before calling external processes
Mads Kiilerich <mads@kiilerich.com>
parents: 13405
diff changeset
   316
  searching for changes
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   317
  preoutgoing hook: HG_SOURCE=pull
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   318
  preoutgoing.forbid hook: HG_SOURCE=pull
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   319
  abort: preoutgoing.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   320
  [255]
1736
50de0887bbcd add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1734
diff changeset
   321
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   322
outgoing hooks work for local clones
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   323
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   324
  $ cd ..
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   325
  $ cat > a/.hg/hgrc <<EOF
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   326
  > [hooks]
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   327
  > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   328
  > outgoing = python "$TESTDIR/printenv.py" outgoing
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   329
  > EOF
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   330
  $ hg clone a c
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   331
  preoutgoing hook: HG_SOURCE=clone
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   332
  outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   333
  updating to branch default
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   334
  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
   335
  $ rm -rf c
8907
e9ef409e6399 Add (pre)outgoing hooks for local clones.
Fred Wulff <frew@cs.stanford.edu>
parents: 4659
diff changeset
   336
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   337
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
   338
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   339
  $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> a/.hg/hgrc
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   340
  $ hg clone a zzz
16982
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   341
  preoutgoing hook: HG_SOURCE=clone
9c892c830a72 tests/printenv.py: eliminate trailing spaces on output
Adrian Buehlmann <adrian@cadifra.com>
parents: 16964
diff changeset
   342
  preoutgoing.forbid hook: HG_SOURCE=clone
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   343
  abort: preoutgoing.forbid hook exited with status 1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   344
  [255]
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   345
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   346
  $ cd "$TESTTMP/b"
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   347
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   348
  $ cat > hooktests.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   349
  > from mercurial import util
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   350
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   351
  > uncallable = 0
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   352
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   353
  > def printargs(args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   354
  >     args.pop('ui', None)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   355
  >     args.pop('repo', None)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   356
  >     a = list(args.items())
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   357
  >     a.sort()
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   358
  >     print 'hook args:'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   359
  >     for k, v in a:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   360
  >        print ' ', k, v
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   361
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   362
  > def passhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   363
  >     printargs(args)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   364
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   365
  > def failhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   366
  >     printargs(args)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   367
  >     return True
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   368
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   369
  > class LocalException(Exception):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   370
  >     pass
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   371
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   372
  > def raisehook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   373
  >     raise LocalException('exception from hook')
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   374
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   375
  > def aborthook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   376
  >     raise util.Abort('raise abort from hook')
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   377
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   378
  > def brokenhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   379
  >     return 1 + {}
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   380
  > 
14601
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   381
  > def verbosehook(ui, **args):
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   382
  >     ui.note('verbose output from hook\n')
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   383
  > 
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   384
  > def printtags(ui, repo, **args):
18377
56b805306955 tests: make test-hook.t output more stable
Mads Kiilerich <mads@kiilerich.com>
parents: 17508
diff changeset
   385
  >     print sorted(repo.tags())
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   386
  > 
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   387
  > class container:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   388
  >     unreachable = 1
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   389
  > EOF
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   390
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   391
test python hooks
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   392
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   393
#if windows
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   394
  $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   395
#else
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   396
  $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   397
#endif
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   398
  $ export PYTHONPATH
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   399
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   400
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   401
  $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   402
  $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   403
  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
   404
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   405
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   406
  $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   407
  $ hg pull ../a 2>&1 | grep 'raised an exception'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   408
  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
   409
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   410
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   411
  $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   412
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   413
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   414
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   415
  error: preoutgoing.abort hook failed: raise abort from hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   416
  abort: raise abort from hook
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   417
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   418
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   419
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   420
  $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   421
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   422
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   423
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   424
  hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   425
    hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   426
    source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   427
  abort: preoutgoing.fail hook failed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   428
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   429
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   430
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   431
  $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   432
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   433
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   434
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   435
  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
   436
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   437
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   438
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   439
  $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   440
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   441
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   442
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   443
  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
   444
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   445
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   446
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   447
  $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   448
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   449
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   450
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   451
  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
   452
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   453
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   454
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   455
  $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   456
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   457
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   458
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   459
  abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   460
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   461
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   462
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   463
  $ 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
   464
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   465
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   466
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   467
  abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   468
  [255]
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   469
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   470
  $ echo '[hooks]' > ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   471
  $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   472
  $ hg pull ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   473
  pulling from ../a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   474
  searching for changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   475
  hook args:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   476
    hooktype preoutgoing
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   477
    source pull
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   478
  adding changesets
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   479
  adding manifests
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   480
  adding file changes
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   481
  added 1 changesets with 1 changes to 1 files
16697
c285aae10f6c bookmarks: pull new bookmarks from remote by default (BC)
Levi Bard <levi@unity3d.com>
parents: 16619
diff changeset
   482
  adding remote bookmark quux
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   483
  (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
   484
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   485
make sure --traceback works
2155
ff255b41b4aa support hooks written in python.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
   486
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   487
  $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   488
  $ 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
   489
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   490
  $ echo aa > a
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   491
  $ 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
   492
  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
   493
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   494
  $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   495
  $ hg init c
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   496
  $ 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
   497
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   498
  $ cat > hookext.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   499
  > def autohook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   500
  >     print "Automatically installed hook"
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   501
  > 
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   502
  > def reposetup(ui, repo):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   503
  >     repo.ui.setconfig("hooks", "commit.auto", autohook)
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   504
  > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   505
  $ echo '[extensions]' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   506
  $ 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
   507
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   508
  $ touch foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   509
  $ hg add foo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   510
  $ hg ci -d '0 0' -m 'add foo'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   511
  Automatically installed hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   512
  $ echo >> foo
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
   513
  $ 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
   514
  committing files:
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   515
  foo
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
   516
  committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23426
diff changeset
   517
  committing changelog
20548
5bd6a9fec103 hooks: for python hooks, consistently use __name__ etc as name, not the repr
Mads Kiilerich <madski@unity3d.com>
parents: 19011
diff changeset
   518
  calling hook commit.auto: hgext_hookext.autohook
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   519
  Automatically installed hook
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   520
  committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
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
   521
11794
80c63b2a29a8 tests: remove useless sed in test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11793
diff changeset
   522
  $ hg showconfig hooks
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   523
  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
   524
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   525
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
   526
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   527
  $ cd ..
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   528
  $ mkdir d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   529
  $ cd d
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   530
  $ hg init repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   531
  $ mkdir hooks
9014
87c05a78e588 test python hook configured with python:[file]:[hook] syntax
Henri Wiechers <hwiechers@gmail.com>
parents: 8907
diff changeset
   532
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   533
  $ cd hooks
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   534
  $ cat > testhooks.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   535
  > def testhook(**args):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   536
  >     print 'hook works'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   537
  > EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   538
  $ echo '[hooks]' > ../repo/.hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   539
  $ 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
   540
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   541
  $ cd ../repo
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   542
  $ hg commit -d '0 0'
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   543
  hook works
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   544
  nothing changed
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   545
  [1]
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   546
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   547
  $ echo '[hooks]' > .hg/hgrc
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
   548
  $ 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
   549
  $ 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
   550
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   551
  $ hg up null
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   552
  loading update.ne hook failed:
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17298
diff changeset
   553
  abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
17217
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   554
  [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   555
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   556
  $ hg id
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   557
  loading pre-identify.npmd hook failed:
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   558
  abort: No module named repo!
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   559
  [255]
1b2b727a885f hooks: print out more information when loading a python hook fails
Simon Heimberg <simohe@besonet.ch>
parents: 17183
diff changeset
   560
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   561
  $ cd ../../b
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   562
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12327
diff changeset
   563
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
   564
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   565
  $ cat > importfail.py <<EOF
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   566
  > import somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   567
  > # 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
   568
  > somebogusmodule.whatever
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   569
  > 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
   570
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   571
  $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   572
  $ 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
   573
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   574
  $ echo a >> a
17283
a4034b866f80 test-hook.t: Solaris /usr/bin/egrep do not support {4}
Mads Kiilerich <mads@kiilerich.com>
parents: 17252
diff changeset
   575
  $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File|    [a-zA-Z(])'
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   576
  exception from first failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   577
  Traceback (most recent call last):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   578
  ImportError: No module named somebogusmodule
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   579
  exception from second failed import attempt:
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   580
  Traceback (most recent call last):
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   581
  ImportError: No module named hgext_importfail
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   582
  Traceback (most recent call last):
17166
c1a3b151782a tests: do exclude what is expected
Simon Heimberg <simohe@besonet.ch>
parents: 17075
diff changeset
   583
  Abort: precommit.importfail hook is invalid (import of "importfail" failed)
c1a3b151782a tests: do exclude what is expected
Simon Heimberg <simohe@besonet.ch>
parents: 17075
diff changeset
   584
  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
   585
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
   586
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
   587
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
   588
commit and update hooks should run after command completion
10492
0e64d814d7d0 run commit and update hooks after command completion (issue1827)
Sune Foldager <cryo@cyanite.org>
parents: 10079
diff changeset
   589
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   590
  $ echo '[hooks]' > .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   591
  $ echo 'commit = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   592
  $ echo 'update = hg id' >> .hg/hgrc
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   593
  $ echo bb > a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   594
  $ hg ci -ma
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   595
  223eafe2750c tip
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   596
  $ hg up 0
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11794
diff changeset
   597
  cb9a9f314b8b
11793
a03ce716495d tests: unify test-hook
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10492
diff changeset
   598
  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
   599
17508
57fb8c9509f4 spelling: propagated
timeless@mozdev.org
parents: 17492
diff changeset
   600
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
   601
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
   602
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   603
  $ echo '[hooks]' > .hg/hgrc
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   604
  $ 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
   605
  $ hg id
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   606
  cb9a9f314b8b
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   607
  $ hg id --verbose
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   608
  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
   609
  verbose output from hook
25c1f3ddd927 dispatch: propagate ui command options to the local ui (issue2523)
Idan Kamara <idankk86@gmail.com>
parents: 14164
diff changeset
   610
  cb9a9f314b8b
15896
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   611
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   612
Ensure hooks can be prioritized
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   613
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   614
  $ echo '[hooks]' > .hg/hgrc
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   615
  $ 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
   616
  $ 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
   617
  $ 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
   618
  $ 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
   619
  $ hg id --verbose
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   620
  calling hook pre-identify.b: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   621
  verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   622
  calling hook pre-identify.a: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   623
  verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   624
  calling hook pre-identify.c: hooktests.verbosehook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   625
  verbose output from hook
30c34fde40cc hooks: prioritize run order of hooks
Matt Zuba <matt.zuba@goodwillaz.org>
parents: 15651
diff changeset
   626
  cb9a9f314b8b
15929
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   627
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   628
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
   629
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   630
  $ 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
   631
  $ hg tag -f foo
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   632
  ['a', 'foo', 'tip']
4091660dc130 tag: invalidate tag cache immediately after adding new tag (issue3210)
Mads Kiilerich <mads@kiilerich.com>
parents: 15896
diff changeset
   633
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   634
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
   635
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   636
  $ cd ..
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   637
  $ hg init to
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   638
  $ echo '[hooks]' >> to/.hg/hgrc
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   639
  $ 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
   640
  $ echo a >> to/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   641
  $ hg --cwd to ci -Ama
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   642
  adding a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   643
  $ hg clone to from
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   644
  updating to branch default
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   645
  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
   646
  $ echo aa >> from/a
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   647
  $ hg --cwd from ci -mb
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   648
  $ hg --cwd from push
16964
eecaeeca2106 test-hook: adapt for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16699
diff changeset
   649
  pushing to $TESTTMP/to (glob)
16619
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   650
  searching for changes
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   651
  adding changesets
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   652
  adding manifests
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   653
  adding file changes
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   654
  added 1 changesets with 1 changes to 1 files
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   655
  changeset:   1:9836a07b9b9d
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   656
  tag:         tip
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   657
  user:        test
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   658
  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
   659
  summary:     b
bc84a1aeaf5a changelog: ensure that nodecache is valid (issue3428)
Bryan O'Sullivan <bryano@fb.com>
parents: 16107
diff changeset
   660