comparison tests/test-hooklib-changeset_published.t @ 44413:4cabeea6d214

hgext: start building a library for simple hooks Many workflows depend on hooks to enforce certain policies, e.g. to prevent forced pushes. The Mercurial Guide includes some cases and Google can help finding others, but it can save users a lot of time if hg itself has a couple of examples for further customization. Differential Revision: https://phab.mercurial-scm.org/D6825
author Joerg Sonnenberger <joerg@bec.de>
date Sat, 07 Sep 2019 14:50:39 +0200
parents
children
comparison
equal deleted inserted replaced
44412:edc8504bc26b 44413:4cabeea6d214
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > notify =
4 > hooklib =
5 >
6 > [phases]
7 > publish = False
8 >
9 > [notify]
10 > sources = pull
11 > diffstat = False
12 > messageidseed = example
13 > domain = example.com
14 >
15 > [reposubs]
16 > * = baz
17 > EOF
18 $ hg init a
19 $ hg --cwd a debugbuilddag .
20 $ hg init b
21 $ cat <<EOF >> b/.hg/hgrc
22 > [hooks]
23 > incoming.notify = python:hgext.notify.hook
24 > txnclose-phase.changeset_published = python:hgext.hooklib.changeset_published.hook
25 > EOF
26 $ hg --cwd b pull ../a | "$PYTHON" $TESTDIR/unwrap-message-id.py
27 pulling from ../a
28 requesting all changes
29 adding changesets
30 adding manifests
31 adding file changes
32 added 1 changesets with 0 changes to 0 files
33 new changesets 1ea73414a91b (1 drafts)
34 MIME-Version: 1.0
35 Content-Type: text/plain; charset="us-ascii"
36 Content-Transfer-Encoding: 7bit
37 Date: * (glob)
38 Subject: changeset in * (glob)
39 From: debugbuilddag@example.com
40 X-Hg-Notification: changeset 1ea73414a91b
41 Message-Id: <hg.81c297828fd2d5afaadf2775a6a71b74143b6451dfaac09fac939e9107a50d01@example.com>
42 To: baz@example.com
43
44 changeset 1ea73414a91b in $TESTTMP/b
45 details: $TESTTMP/b?cmd=changeset;node=1ea73414a91b
46 description:
47 r0
48 (run 'hg update' to get a working copy)
49 $ hg --cwd a phase --public 0
50 $ hg --cwd b pull ../a | "$PYTHON" $TESTDIR/unwrap-message-id.py
51 pulling from ../a
52 searching for changes
53 no changes found
54 1 local changesets published
55 Subject: changeset published
56 In-reply-to: <hg.81c297828fd2d5afaadf2775a6a71b74143b6451dfaac09fac939e9107a50d01@example.com>
57 Message-Id: <hg.2ec19bbddee5b542442bf5e1aed97bf706afff6aa765629883fbd1f4edd6fcb0@example.com>
58 Date: * (glob)
59 From: test@example.com
60 To: baz@example.com
61
62 This changeset has been published.
63 $ hg --cwd b phase --force --draft 0
64 $ cat <<EOF >> b/.hg/hgrc
65 > [notify_published]
66 > messageidseed = example2
67 > domain = alt.example.com
68 > template = Subject: changeset published
69 > From: hg@example.com\n
70 > This draft changeset has been published.\n
71 > EOF
72 $ hg --cwd b pull ../a | "$PYTHON" $TESTDIR/unwrap-message-id.py
73 pulling from ../a
74 searching for changes
75 no changes found
76 1 local changesets published
77 Subject: changeset published
78 From: hg@example.com
79 In-reply-to: <hg.e3381dc41c051215e50b1c166a72949d0fff99609eb373420bcb763af80ef230@alt.example.com>
80 Message-Id: <hg.c927f3d324e645a4245bfed20b0efb5b9582999d6be9bef45a37e7ec21208b24@alt.example.com>
81 Date: * (glob)
82 To: baz@example.com
83
84 This draft changeset has been published.