tests/test-hook.t
changeset 12156 4c94b6d0fb1c
parent 11794 80c63b2a29a8
child 12316 4134686b83e1
equal deleted inserted replaced
12155:94ad12aa0530 12156:4c94b6d0fb1c
    13   $ echo 'pre-identify = python ../printenv.py pre-identify 1' >> .hg/hgrc
    13   $ echo 'pre-identify = python ../printenv.py pre-identify 1' >> .hg/hgrc
    14   $ echo 'pre-cat = python ../printenv.py pre-cat' >> .hg/hgrc
    14   $ echo 'pre-cat = python ../printenv.py pre-cat' >> .hg/hgrc
    15   $ echo 'post-cat = python ../printenv.py post-cat' >> .hg/hgrc
    15   $ echo 'post-cat = python ../printenv.py post-cat' >> .hg/hgrc
    16   $ echo a > a
    16   $ echo a > a
    17   $ hg add a
    17   $ hg add a
    18   $ hg commit -m a -d "1000000 0"
    18   $ hg commit -m a
    19   precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 
    19   precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 
    20   pretxncommit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$HGTMP/test-hook.t/a 
    20   pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$HGTMP/test-hook.t/a 
    21   0:29b62aeb769f
    21   0:cb9a9f314b8b
    22   commit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 
    22   commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 
    23   commit.b hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 
    23   commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 
    24 
    24 
    25   $ hg clone . ../b
    25   $ hg clone . ../b
    26   updating to branch default
    26   updating to branch default
    27   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    27   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    28   $ cd ../b
    28   $ cd ../b
    37 # pretxncommit and commit hooks can see both parents of merge
    37 # pretxncommit and commit hooks can see both parents of merge
    38 
    38 
    39   $ cd ../a
    39   $ cd ../a
    40   $ echo b >> a
    40   $ echo b >> a
    41   $ hg commit -m a1 -d "1 0"
    41   $ hg commit -m a1 -d "1 0"
    42   precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b 
    42   precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 
    43   pretxncommit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=$HGTMP/test-hook.t/a 
    43   pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$HGTMP/test-hook.t/a 
    44   1:b702efe96888
    44   1:ab228980c14d
    45   commit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b 
    45   commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 
    46   commit.b hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b 
    46   commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 
    47   $ hg update -C 0
    47   $ hg update -C 0
    48   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    48   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    49   $ echo b > b
    49   $ echo b > b
    50   $ hg add b
    50   $ hg add b
    51   $ hg commit -m b -d '1 0'
    51   $ hg commit -m b -d '1 0'
    52   precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b 
    52   precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 
    53   pretxncommit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=$HGTMP/test-hook.t/a 
    53   pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$HGTMP/test-hook.t/a 
    54   2:1324a5531bac
    54   2:ee9deb46ab31
    55   commit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b 
    55   commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 
    56   commit.b hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b 
    56   commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 
    57   created new head
    57   created new head
    58   $ hg merge 1
    58   $ hg merge 1
    59   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    59   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    60   (branch merge, don't forget to commit)
    60   (branch merge, don't forget to commit)
    61   $ hg commit -m merge -d '2 0'
    61   $ hg commit -m merge -d '2 0'
    62   precommit hook: HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 
    62   precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd 
    63   pretxncommit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PENDING=$HGTMP/test-hook.t/a 
    63   pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$HGTMP/test-hook.t/a 
    64   3:4c52fb2e4022
    64   3:07f3376c1e65
    65   commit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 
    65   commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd 
    66   commit.b hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 
    66   commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd 
    67 
    67 
    68 # test generic hooks
    68 # test generic hooks
    69 
    69 
    70   $ hg id
    70   $ hg id
    71   pre-identify hook: HG_ARGS=id HG_OPTS={'tags': None, 'rev': '', 'num': None, 'branch': None, 'id': None} HG_PATS=[] 
    71   pre-identify hook: HG_ARGS=id HG_OPTS={'tags': None, 'rev': '', 'num': None, 'branch': None, 'id': None} HG_PATS=[] 
    76   b
    76   b
    77 
    77 
    78   $ cd ../b
    78   $ cd ../b
    79   $ hg pull ../a
    79   $ hg pull ../a
    80   prechangegroup hook: HG_SOURCE=pull HG_URL=file: 
    80   prechangegroup hook: HG_SOURCE=pull HG_URL=file: 
    81   changegroup hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_SOURCE=pull HG_URL=file: 
    81   changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file: 
    82   incoming hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_SOURCE=pull HG_URL=file: 
    82   incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file: 
    83   incoming hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_SOURCE=pull HG_URL=file: 
    83   incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file: 
    84   incoming hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_SOURCE=pull HG_URL=file: 
    84   incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file: 
    85   pulling from ../a
    85   pulling from ../a
    86   searching for changes
    86   searching for changes
    87   adding changesets
    87   adding changesets
    88   adding manifests
    88   adding manifests
    89   adding file changes
    89   adding file changes
    94 
    94 
    95   $ cd ../a
    95   $ cd ../a
    96   $ echo 'pretag = python ../printenv.py pretag' >> .hg/hgrc
    96   $ echo 'pretag = python ../printenv.py pretag' >> .hg/hgrc
    97   $ echo 'tag = unset HG_PARENT1 HG_PARENT2; python ../printenv.py tag' >> .hg/hgrc
    97   $ echo 'tag = unset HG_PARENT1 HG_PARENT2; python ../printenv.py tag' >> .hg/hgrc
    98   $ hg tag -d '3 0' a
    98   $ hg tag -d '3 0' a
    99   pretag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a 
    99   pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a 
   100   precommit hook: HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 
   100   precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 
   101   pretxncommit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 HG_PENDING=$HGTMP/test-hook.t/a 
   101   pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$HGTMP/test-hook.t/a 
   102   4:8ea2ef7ad3e8
   102   4:539e4b31b6dc
   103   commit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 
   103   commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 
   104   commit.b hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 
   104   commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 
   105   tag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a 
   105   tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a 
   106   $ hg tag -l la
   106   $ hg tag -l la
   107   pretag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=la 
   107   pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la 
   108   tag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=la 
   108   tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la 
   109 
   109 
   110 # pretag hook can forbid tagging
   110 # pretag hook can forbid tagging
   111 
   111 
   112   $ echo 'pretag.forbid = python ../printenv.py pretag.forbid 1' >> .hg/hgrc
   112   $ echo 'pretag.forbid = python ../printenv.py pretag.forbid 1' >> .hg/hgrc
   113   $ hg tag -d '4 0' fa
   113   $ hg tag -d '4 0' fa
   114   pretag hook: HG_LOCAL=0 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fa 
   114   pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa 
   115   pretag.forbid hook: HG_LOCAL=0 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fa 
   115   pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa 
   116   abort: pretag.forbid hook exited with status 1
   116   abort: pretag.forbid hook exited with status 1
   117   $ hg tag -l fla
   117   $ hg tag -l fla
   118   pretag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fla 
   118   pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla 
   119   pretag.forbid hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fla 
   119   pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla 
   120   abort: pretag.forbid hook exited with status 1
   120   abort: pretag.forbid hook exited with status 1
   121 
   121 
   122 # pretxncommit hook can see changeset, can roll back txn, changeset
   122 # pretxncommit hook can see changeset, can roll back txn, changeset
   123 # no more there after
   123 # no more there after
   124 
   124 
   125   $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc
   125   $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc
   126   $ echo 'pretxncommit.forbid1 = python ../printenv.py pretxncommit.forbid 1' >> .hg/hgrc
   126   $ echo 'pretxncommit.forbid1 = python ../printenv.py pretxncommit.forbid 1' >> .hg/hgrc
   127   $ echo z > z
   127   $ echo z > z
   128   $ hg add z
   128   $ hg add z
   129   $ hg -q tip
   129   $ hg -q tip
   130   4:8ea2ef7ad3e8
   130   4:539e4b31b6dc
   131   $ hg commit -m 'fail' -d '4 0'
   131   $ hg commit -m 'fail' -d '4 0'
   132   precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 
   132   precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 
   133   pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook.t/a 
   133   pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$HGTMP/test-hook.t/a 
   134   5:fad284daf8c0
   134   5:6f611f8018c1
   135   5:fad284daf8c0
   135   5:6f611f8018c1
   136   pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook.t/a 
   136   pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$HGTMP/test-hook.t/a 
   137   transaction abort!
   137   transaction abort!
   138   rollback completed
   138   rollback completed
   139   abort: pretxncommit.forbid1 hook exited with status 1
   139   abort: pretxncommit.forbid1 hook exited with status 1
   140   $ hg -q tip
   140   $ hg -q tip
   141   4:8ea2ef7ad3e8
   141   4:539e4b31b6dc
   142 
   142 
   143 # precommit hook can prevent commit
   143 # precommit hook can prevent commit
   144 
   144 
   145   $ echo 'precommit.forbid = python ../printenv.py precommit.forbid 1' >> .hg/hgrc
   145   $ echo 'precommit.forbid = python ../printenv.py precommit.forbid 1' >> .hg/hgrc
   146   $ hg commit -m 'fail' -d '4 0'
   146   $ hg commit -m 'fail' -d '4 0'
   147   precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 
   147   precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 
   148   precommit.forbid hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 
   148   precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 
   149   abort: precommit.forbid hook exited with status 1
   149   abort: precommit.forbid hook exited with status 1
   150   $ hg -q tip
   150   $ hg -q tip
   151   4:8ea2ef7ad3e8
   151   4:539e4b31b6dc
   152 
   152 
   153 # preupdate hook can prevent update
   153 # preupdate hook can prevent update
   154 
   154 
   155   $ echo 'preupdate = python ../printenv.py preupdate' >> .hg/hgrc
   155   $ echo 'preupdate = python ../printenv.py preupdate' >> .hg/hgrc
   156   $ hg update 1
   156   $ hg update 1
   157   preupdate hook: HG_PARENT1=b702efe96888 
   157   preupdate hook: HG_PARENT1=ab228980c14d 
   158   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   158   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   159 
   159 
   160 # update hook
   160 # update hook
   161 
   161 
   162   $ echo 'update = python ../printenv.py update' >> .hg/hgrc
   162   $ echo 'update = python ../printenv.py update' >> .hg/hgrc
   163   $ hg update
   163   $ hg update
   164   preupdate hook: HG_PARENT1=8ea2ef7ad3e8 
   164   preupdate hook: HG_PARENT1=539e4b31b6dc 
   165   update hook: HG_ERROR=0 HG_PARENT1=8ea2ef7ad3e8 
   165   update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc 
   166   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   166   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   167 
   167 
   168 # prechangegroup hook can prevent incoming changes
   168 # prechangegroup hook can prevent incoming changes
   169 
   169 
   170   $ cd ../b
   170   $ cd ../b
   171   $ hg -q tip
   171   $ hg -q tip
   172   3:4c52fb2e4022
   172   3:07f3376c1e65
   173   $ echo '[hooks]' > .hg/hgrc
   173   $ echo '[hooks]' > .hg/hgrc
   174   $ echo 'prechangegroup.forbid = python ../printenv.py prechangegroup.forbid 1' >> .hg/hgrc
   174   $ echo 'prechangegroup.forbid = python ../printenv.py prechangegroup.forbid 1' >> .hg/hgrc
   175   $ hg pull ../a
   175   $ hg pull ../a
   176   prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file: 
   176   prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file: 
   177   pulling from ../a
   177   pulling from ../a
   183 
   183 
   184   $ echo '[hooks]' > .hg/hgrc
   184   $ echo '[hooks]' > .hg/hgrc
   185   $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc
   185   $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc
   186   $ echo 'pretxnchangegroup.forbid1 = python ../printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc
   186   $ echo 'pretxnchangegroup.forbid1 = python ../printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc
   187   $ hg pull ../a
   187   $ hg pull ../a
   188   4:8ea2ef7ad3e8
   188   4:539e4b31b6dc
   189   pretxnchangegroup.forbid hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook.t/b HG_SOURCE=pull HG_URL=file: 
   189   pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$HGTMP/test-hook.t/b HG_SOURCE=pull HG_URL=file: 
   190   pulling from ../a
   190   pulling from ../a
   191   searching for changes
   191   searching for changes
   192   adding changesets
   192   adding changesets
   193   adding manifests
   193   adding manifests
   194   adding file changes
   194   adding file changes
   195   added 1 changesets with 1 changes to 1 files
   195   added 1 changesets with 1 changes to 1 files
   196   transaction abort!
   196   transaction abort!
   197   rollback completed
   197   rollback completed
   198   abort: pretxnchangegroup.forbid1 hook exited with status 1
   198   abort: pretxnchangegroup.forbid1 hook exited with status 1
   199   $ hg -q tip
   199   $ hg -q tip
   200   3:4c52fb2e4022
   200   3:07f3376c1e65
   201 
   201 
   202 # outgoing hooks can see env vars
   202 # outgoing hooks can see env vars
   203 
   203 
   204   $ rm .hg/hgrc
   204   $ rm .hg/hgrc
   205   $ echo '[hooks]' > ../a/.hg/hgrc
   205   $ echo '[hooks]' > ../a/.hg/hgrc
   206   $ echo 'preoutgoing = python ../printenv.py preoutgoing' >> ../a/.hg/hgrc
   206   $ echo 'preoutgoing = python ../printenv.py preoutgoing' >> ../a/.hg/hgrc
   207   $ echo 'outgoing = python ../printenv.py outgoing' >> ../a/.hg/hgrc
   207   $ echo 'outgoing = python ../printenv.py outgoing' >> ../a/.hg/hgrc
   208   $ hg pull ../a
   208   $ hg pull ../a
   209   preoutgoing hook: HG_SOURCE=pull 
   209   preoutgoing hook: HG_SOURCE=pull 
   210   outgoing hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull 
   210   outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull 
   211   pulling from ../a
   211   pulling from ../a
   212   searching for changes
   212   searching for changes
   213   adding changesets
   213   adding changesets
   214   adding manifests
   214   adding manifests
   215   adding file changes
   215   adding file changes
   439 
   439 
   440   $ echo '[hooks]' > .hg/hgrc
   440   $ echo '[hooks]' > .hg/hgrc
   441   $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
   441   $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
   442 
   442 
   443   $ echo a >> a
   443   $ echo a >> a
   444   $ hg --traceback commit -d '0 0' -ma 2>&1 | egrep '^(exception|Traceback|ImportError)'
   444   $ hg --traceback commit -ma 2>&1 | egrep '^(exception|Traceback|ImportError)'
   445   exception from first failed import attempt:
   445   exception from first failed import attempt:
   446   Traceback (most recent call last):
   446   Traceback (most recent call last):
   447   ImportError: No module named somebogusmodule
   447   ImportError: No module named somebogusmodule
   448   exception from second failed import attempt:
   448   exception from second failed import attempt:
   449   Traceback (most recent call last):
   449   Traceback (most recent call last):
   454 
   454 
   455   $ echo '[hooks]' > .hg/hgrc
   455   $ echo '[hooks]' > .hg/hgrc
   456   $ echo 'commit = hg id' >> .hg/hgrc
   456   $ echo 'commit = hg id' >> .hg/hgrc
   457   $ echo 'update = hg id' >> .hg/hgrc
   457   $ echo 'update = hg id' >> .hg/hgrc
   458   $ echo bb > a
   458   $ echo bb > a
   459   $ hg ci -d '0 0' -ma
   459   $ hg ci -ma
   460   8da618c33484 tip
   460   223eafe2750c tip
   461   $ hg up 0
   461   $ hg up 0
   462   29b62aeb769f
   462   cb9a9f314b8b
   463   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   463   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   464 
   464 
   465   $ exit 0
   465   $ exit 0