tests/test-notify.out
changeset 12473 52aac5c5c2a6
parent 12472 17c62039cadd
child 12474 f213af8211cc
equal deleted inserted replaced
12472:17c62039cadd 12473:52aac5c5c2a6
     1 notify extension - hooks for sending email notifications at commit/push time
       
     2 
       
     3 Subscriptions can be managed through a hgrc file. Default mode is to print
       
     4 messages to stdout, for testing and configuring.
       
     5 
       
     6 To use, configure the notify extension and enable it in hgrc like this:
       
     7 
       
     8   [extensions]
       
     9   notify =
       
    10 
       
    11   [hooks]
       
    12   # one email for each incoming changeset
       
    13   incoming.notify = python:hgext.notify.hook
       
    14   # batch emails when many changesets incoming at one time
       
    15   changegroup.notify = python:hgext.notify.hook
       
    16 
       
    17   [notify]
       
    18   # config items go here
       
    19 
       
    20 Required configuration items:
       
    21 
       
    22   config = /path/to/file # file containing subscriptions
       
    23 
       
    24 Optional configuration items:
       
    25 
       
    26   test = True            # print messages to stdout for testing
       
    27   strip = 3              # number of slashes to strip for url paths
       
    28   domain = example.com   # domain to use if committer missing domain
       
    29   style = ...            # style file to use when formatting email
       
    30   template = ...         # template to use when formatting email
       
    31   incoming = ...         # template to use when run as incoming hook
       
    32   changegroup = ...      # template when run as changegroup hook
       
    33   maxdiff = 300          # max lines of diffs to include (0=none, -1=all)
       
    34   maxsubject = 67        # truncate subject line longer than this
       
    35   diffstat = True        # add a diffstat before the diff content
       
    36   sources = serve        # notify if source of incoming changes in this list
       
    37                          # (serve == ssh or http, push, pull, bundle)
       
    38   merge = False          # send notification for merges (default True)
       
    39   [email]
       
    40   from = user@host.com   # email address to send as if none given
       
    41   [web]
       
    42   baseurl = http://hgserver/... # root of hg web site for browsing commits
       
    43 
       
    44 The notify config file has same format as a regular hgrc file. It has two
       
    45 sections so you can express subscriptions in whatever way is handier for you.
       
    46 
       
    47   [usersubs]
       
    48   # key is subscriber email, value is ","-separated list of glob patterns
       
    49   user@host = pattern
       
    50 
       
    51   [reposubs]
       
    52   # key is glob pattern, value is ","-separated list of subscriber emails
       
    53   pattern = user@host
       
    54 
       
    55 Glob patterns are matched against path to repository root.
       
    56 
       
    57 If you like, you can put notify config file in repository that users can push
       
    58 changes to, they can manage their own subscriptions.
       
    59 
       
    60 no commands defined
       
    61 % commit
       
    62 adding a
       
    63 % clone
       
    64 updating to branch default
       
    65 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    66 % commit
       
    67 % pull (minimal config)
       
    68 pulling from ../a
       
    69 searching for changes
       
    70 adding changesets
       
    71 adding manifests
       
    72 adding file changes
       
    73 added 1 changesets with 1 changes to 1 files
       
    74 Content-Type: text/plain; charset="us-ascii"
       
    75 MIME-Version: 1.0
       
    76 Content-Transfer-Encoding: 7bit
       
    77 Date:
       
    78 Subject: changeset in test-notify/b: b
       
    79 From: test
       
    80 X-Hg-Notification: changeset 0647d048b600
       
    81 Message-Id:
       
    82 To: baz, foo@bar
       
    83 
       
    84 changeset 0647d048b600 in test-notify/b
       
    85 details: test-notify/b?cmd=changeset;node=0647d048b600
       
    86 description: b
       
    87 
       
    88 diffs (6 lines):
       
    89 
       
    90 diff -r cb9a9f314b8b -r 0647d048b600 a
       
    91 --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
    92 +++ b/a	Thu Jan 01 00:00:01 1970 +0000
       
    93 @@ -1,1 +1,2 @@
       
    94  a
       
    95 +a
       
    96 (run 'hg update' to get a working copy)
       
    97 % fail for config file is missing
       
    98 rolling back to revision 0 (undo pull)
       
    99 pull failed
       
   100 % pull
       
   101 rolling back to revision 0 (undo pull)
       
   102 pulling from ../a
       
   103 searching for changes
       
   104 adding changesets
       
   105 adding manifests
       
   106 adding file changes
       
   107 added 1 changesets with 1 changes to 1 files
       
   108 Content-Type: text/plain; charset="us-ascii"
       
   109 MIME-Version: 1.0
       
   110 Content-Transfer-Encoding: 7bit
       
   111 X-Test: foo
       
   112 Date:
       
   113 Subject: b
       
   114 From: test@test.com
       
   115 X-Hg-Notification: changeset 0647d048b600
       
   116 Message-Id:
       
   117 To: baz@test.com, foo@bar
       
   118 
       
   119 changeset 0647d048b600
       
   120 description:
       
   121 	b
       
   122 diffs (6 lines):
       
   123 
       
   124 diff -r cb9a9f314b8b -r 0647d048b600 a
       
   125 --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   126 +++ b/a	Thu Jan 01 00:00:01 1970 +0000
       
   127 @@ -1,1 +1,2 @@
       
   128  a
       
   129 +a
       
   130 (run 'hg update' to get a working copy)
       
   131 % pull
       
   132 rolling back to revision 0 (undo pull)
       
   133 pulling from ../a
       
   134 searching for changes
       
   135 adding changesets
       
   136 adding manifests
       
   137 adding file changes
       
   138 added 1 changesets with 1 changes to 1 files
       
   139 Content-Type: text/plain; charset="us-ascii"
       
   140 MIME-Version: 1.0
       
   141 Content-Transfer-Encoding: 7bit
       
   142 X-Test: foo
       
   143 Date:
       
   144 Subject: b
       
   145 From: test@test.com
       
   146 X-Hg-Notification: changeset 0647d048b600
       
   147 Message-Id:
       
   148 To: baz@test.com, foo@bar
       
   149 
       
   150 changeset 0647d048b600
       
   151 description:
       
   152 	b
       
   153 diffstat:
       
   154 
       
   155  a |  1 +
       
   156  1 files changed, 1 insertions(+), 0 deletions(-)
       
   157 
       
   158 diffs (6 lines):
       
   159 
       
   160 diff -r cb9a9f314b8b -r 0647d048b600 a
       
   161 --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   162 +++ b/a	Thu Jan 01 00:00:01 1970 +0000
       
   163 @@ -1,1 +1,2 @@
       
   164  a
       
   165 +a
       
   166 (run 'hg update' to get a working copy)
       
   167 % test merge
       
   168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   169 created new head
       
   170 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   171 (branch merge, don't forget to commit)
       
   172 pulling from ../a
       
   173 searching for changes
       
   174 adding changesets
       
   175 adding manifests
       
   176 adding file changes
       
   177 added 2 changesets with 0 changes to 0 files
       
   178 Content-Type: text/plain; charset="us-ascii"
       
   179 MIME-Version: 1.0
       
   180 Content-Transfer-Encoding: 7bit
       
   181 X-Test: foo
       
   182 Date:
       
   183 Subject: adda2
       
   184 From: test@test.com
       
   185 X-Hg-Notification: changeset 0a184ce6067f
       
   186 Message-Id:
       
   187 To: baz@test.com, foo@bar
       
   188 
       
   189 changeset 0a184ce6067f
       
   190 description:
       
   191 	adda2
       
   192 diffstat:
       
   193 
       
   194  a |  1 +
       
   195  1 files changed, 1 insertions(+), 0 deletions(-)
       
   196 
       
   197 diffs (6 lines):
       
   198 
       
   199 diff -r cb9a9f314b8b -r 0a184ce6067f a
       
   200 --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   201 +++ b/a	Thu Jan 01 00:00:02 1970 +0000
       
   202 @@ -1,1 +1,2 @@
       
   203  a
       
   204 +a
       
   205 Content-Type: text/plain; charset="us-ascii"
       
   206 MIME-Version: 1.0
       
   207 Content-Transfer-Encoding: 7bit
       
   208 X-Test: foo
       
   209 Date:
       
   210 Subject: merge
       
   211 From: test@test.com
       
   212 X-Hg-Notification: changeset 22c88b85aa27
       
   213 Message-Id:
       
   214 To: baz@test.com, foo@bar
       
   215 
       
   216 changeset 22c88b85aa27
       
   217 description:
       
   218 	merge
       
   219 (run 'hg update' to get a working copy)