comparison hgext/notify.py @ 7127:9df67ee30ef5

help: better documentation intro for a few extensions
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sat, 18 Oct 2008 16:56:39 +0200
parents e981725da3fe
children b6f5490effbf
comparison
equal deleted inserted replaced
7126:111813de4188 7127:9df67ee30ef5
2 # 2 #
3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> 3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 # 7
8 # hook extension to email notifications to people when changesets are 8 '''hook extension to email notifications on commits/pushes
9 # committed to a repo they subscribe to. 9
10 # 10 Subscriptions can be managed through hgrc. Default mode is to print
11 # default mode is to print messages to stdout, for testing and 11 messages to stdout, for testing and configuring.
12 # configuring. 12
13 # 13 To use, configure notify extension and enable in hgrc like this:
14 # to use, configure notify extension and enable in hgrc like this: 14
15 # 15 [extensions]
16 # [extensions] 16 hgext.notify =
17 # hgext.notify = 17
18 # 18 [hooks]
19 # [hooks] 19 # one email for each incoming changeset
20 # # one email for each incoming changeset 20 incoming.notify = python:hgext.notify.hook
21 # incoming.notify = python:hgext.notify.hook 21 # batch emails when many changesets incoming at one time
22 # # batch emails when many changesets incoming at one time 22 changegroup.notify = python:hgext.notify.hook
23 # changegroup.notify = python:hgext.notify.hook 23
24 # 24 [notify]
25 # [notify] 25 # config items go in here
26 # # config items go in here 26
27 # 27 config items:
28 # config items: 28
29 # 29 REQUIRED:
30 # REQUIRED: 30 config = /path/to/file # file containing subscriptions
31 # config = /path/to/file # file containing subscriptions 31
32 # 32 OPTIONAL:
33 # OPTIONAL: 33 test = True # print messages to stdout for testing
34 # test = True # print messages to stdout for testing 34 strip = 3 # number of slashes to strip for url paths
35 # strip = 3 # number of slashes to strip for url paths 35 domain = example.com # domain to use if committer missing domain
36 # domain = example.com # domain to use if committer missing domain 36 style = ... # style file to use when formatting email
37 # style = ... # style file to use when formatting email 37 template = ... # template to use when formatting email
38 # template = ... # template to use when formatting email 38 incoming = ... # template to use when run as incoming hook
39 # incoming = ... # template to use when run as incoming hook 39 changegroup = ... # template when run as changegroup hook
40 # changegroup = ... # template when run as changegroup hook 40 maxdiff = 300 # max lines of diffs to include (0=none, -1=all)
41 # maxdiff = 300 # max lines of diffs to include (0=none, -1=all) 41 maxsubject = 67 # truncate subject line longer than this
42 # maxsubject = 67 # truncate subject line longer than this 42 diffstat = True # add a diffstat before the diff content
43 # diffstat = True # add a diffstat before the diff content 43 sources = serve # notify if source of incoming changes in this list
44 # sources = serve # notify if source of incoming changes in this list 44 # (serve == ssh or http, push, pull, bundle)
45 # # (serve == ssh or http, push, pull, bundle) 45 [email]
46 # [email] 46 from = user@host.com # email address to send as if none given
47 # from = user@host.com # email address to send as if none given 47 [web]
48 # [web] 48 baseurl = http://hgserver/... # root of hg web site for browsing commits
49 # baseurl = http://hgserver/... # root of hg web site for browsing commits 49
50 # 50 notify config file has same format as regular hgrc. it has two
51 # notify config file has same format as regular hgrc. it has two 51 sections so you can express subscriptions in whatever way is handier
52 # sections so you can express subscriptions in whatever way is handier 52 for you.
53 # for you. 53
54 # 54 [usersubs]
55 # [usersubs] 55 # key is subscriber email, value is ","-separated list of glob patterns
56 # # key is subscriber email, value is ","-separated list of glob patterns 56 user@host = pattern
57 # user@host = pattern 57
58 # 58 [reposubs]
59 # [reposubs] 59 # key is glob pattern, value is ","-separated list of subscriber emails
60 # # key is glob pattern, value is ","-separated list of subscriber emails 60 pattern = user@host
61 # pattern = user@host 61
62 # 62 glob patterns are matched against path to repo root.
63 # glob patterns are matched against path to repo root. 63
64 # 64 if you like, you can put notify config file in repo that users can
65 # if you like, you can put notify config file in repo that users can 65 push changes to, they can manage their own subscriptions.'''
66 # push changes to, they can manage their own subscriptions.
67 66
68 from mercurial.i18n import _ 67 from mercurial.i18n import _
69 from mercurial.node import bin, short 68 from mercurial.node import bin, short
70 from mercurial import patch, cmdutil, templater, util, mail 69 from mercurial import patch, cmdutil, templater, util, mail
71 import email.Parser, fnmatch, socket, time 70 import email.Parser, fnmatch, socket, time