| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>notify</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="notify"> |
| 12 |
<span id="ext-notify"></span> |
| 13 |
<h1 class="title">notify</h1> |
| 14 |
|
| 15 |
<div class="contents htmlonly topic" id="contents"> |
| 16 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 17 |
<ul class="simple"> |
| 18 |
<li><a class="reference internal" href="#description" id="toc-entry-1">Description</a></li> |
| 19 |
</ul> |
| 20 |
</div> |
| 21 |
<p>hooks for sending email push notifications</p> |
| 22 |
<div class="section" id="description"> |
| 23 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 24 |
<p>This extension implements hooks to send email notifications when |
| 25 |
changesets are sent from or received by the local repository.</p> |
| 26 |
<p>First, enable the extension as explained in <a class="reference external" href="topic-extensions.html"><tt class="docutils literal">hg help extensions</tt></a>, and |
| 27 |
register the hook you want to run. <tt class="docutils literal">incoming</tt> and <tt class="docutils literal">changegroup</tt> hooks |
| 28 |
are run when changesets are received, while <tt class="docutils literal">outgoing</tt> hooks are for |
| 29 |
changesets sent to another repository:</p> |
| 30 |
<pre class="literal-block"> |
| 31 |
[hooks] |
| 32 |
# one email for each incoming changeset |
| 33 |
incoming.notify = python:hgext.notify.hook |
| 34 |
# one email for all incoming changesets |
| 35 |
changegroup.notify = python:hgext.notify.hook |
| 36 |
|
| 37 |
# one email for all outgoing changesets |
| 38 |
outgoing.notify = python:hgext.notify.hook |
| 39 |
</pre> |
| 40 |
<p>This registers the hooks. To enable notification, subscribers must |
| 41 |
be assigned to repositories. The <tt class="docutils literal">[usersubs]</tt> section maps multiple |
| 42 |
repositories to a given recipient. The <tt class="docutils literal">[reposubs]</tt> section maps |
| 43 |
multiple recipients to a single repository:</p> |
| 44 |
<pre class="literal-block"> |
| 45 |
[usersubs] |
| 46 |
# key is subscriber email, value is a comma-separated list of repo patterns |
| 47 |
user@host = pattern |
| 48 |
|
| 49 |
[reposubs] |
| 50 |
# key is repo pattern, value is a comma-separated list of subscriber emails |
| 51 |
pattern = user@host |
| 52 |
</pre> |
| 53 |
<p>A <tt class="docutils literal">pattern</tt> is a <tt class="docutils literal">glob</tt> matching the absolute path to a repository, |
| 54 |
optionally combined with a revset expression. A revset expression, if |
| 55 |
present, is separated from the glob by a hash. Example:</p> |
| 56 |
<pre class="literal-block"> |
| 57 |
[reposubs] |
| 58 |
*/widgets#branch(release) = qa-team@example.com |
| 59 |
</pre> |
| 60 |
<p>This sends to <tt class="docutils literal"><span class="pre">qa-team@example.com</span></tt> whenever a changeset on the <tt class="docutils literal">release</tt> |
| 61 |
branch triggers a notification in any repository ending in <tt class="docutils literal">widgets</tt>.</p> |
| 62 |
<p>In order to place them under direct user management, <tt class="docutils literal">[usersubs]</tt> and |
| 63 |
<tt class="docutils literal">[reposubs]</tt> sections may be placed in a separate <tt class="docutils literal">hgrc</tt> file and |
| 64 |
incorporated by reference:</p> |
| 65 |
<pre class="literal-block"> |
| 66 |
[notify] |
| 67 |
config = /path/to/subscriptionsfile |
| 68 |
</pre> |
| 69 |
<p>Notifications will not be sent until the <tt class="docutils literal">notify.test</tt> value is set |
| 70 |
to <tt class="docutils literal">False</tt>; see below.</p> |
| 71 |
<p>Notifications content can be tweaked with the following configuration entries:</p> |
| 72 |
<dl class="docutils"> |
| 73 |
<dt>notify.test</dt> |
| 74 |
<dd>If <tt class="docutils literal">True</tt>, print messages to stdout instead of sending them. Default: True.</dd> |
| 75 |
<dt>notify.sources</dt> |
| 76 |
<dd><p class="first">Space-separated list of change sources. Notifications are activated only |
| 77 |
when a changeset's source is in this list. Sources may be:</p> |
| 78 |
<table class="docutils field-list" frame="void" rules="none"> |
| 79 |
<col class="field-name" /> |
| 80 |
<col class="field-body" /> |
| 81 |
<tbody valign="top"> |
| 82 |
<tr class="field"><th class="field-name"><tt class="docutils literal">serve</tt>:</th><td class="field-body">changesets received via http or ssh</td> |
| 83 |
</tr> |
| 84 |
<tr class="field"><th class="field-name"><tt class="docutils literal">pull</tt>:</th><td class="field-body">changesets received via <tt class="docutils literal">hg pull</tt></td> |
| 85 |
</tr> |
| 86 |
<tr class="field"><th class="field-name"><tt class="docutils literal">unbundle</tt>:</th><td class="field-body">changesets received via <tt class="docutils literal">hg unbundle</tt></td> |
| 87 |
</tr> |
| 88 |
<tr class="field"><th class="field-name"><tt class="docutils literal">push</tt>:</th><td class="field-body">changesets sent or received via <tt class="docutils literal">hg push</tt></td> |
| 89 |
</tr> |
| 90 |
<tr class="field"><th class="field-name"><tt class="docutils literal">bundle</tt>:</th><td class="field-body">changesets sent via <tt class="docutils literal">hg unbundle</tt></td> |
| 91 |
</tr> |
| 92 |
</tbody> |
| 93 |
</table> |
| 94 |
<p class="last">Default: serve.</p> |
| 95 |
</dd> |
| 96 |
<dt>notify.strip</dt> |
| 97 |
<dd>Number of leading slashes to strip from url paths. By default, notifications |
| 98 |
reference repositories with their absolute path. <tt class="docutils literal">notify.strip</tt> lets you |
| 99 |
turn them into relative paths. For example, <tt class="docutils literal">notify.strip=3</tt> will change |
| 100 |
<tt class="docutils literal">/long/path/repository</tt> into <tt class="docutils literal">repository</tt>. Default: 0.</dd> |
| 101 |
<dt>notify.domain</dt> |
| 102 |
<dd>Default email domain for sender or recipients with no explicit domain. |
| 103 |
It is also used for the domain part of the <tt class="docutils literal"><span class="pre">Message-Id</span></tt> when using |
| 104 |
<tt class="docutils literal">notify.messageidseed</tt>.</dd> |
| 105 |
<dt>notify.messageidseed</dt> |
| 106 |
<dd>Create deterministic <tt class="docutils literal"><span class="pre">Message-Id</span></tt> headers for the mails based on the seed |
| 107 |
and the revision identifier of the first commit in the changeset.</dd> |
| 108 |
<dt>notify.style</dt> |
| 109 |
<dd>Style file to use when formatting emails.</dd> |
| 110 |
<dt>notify.template</dt> |
| 111 |
<dd>Template to use when formatting emails.</dd> |
| 112 |
<dt>notify.incoming</dt> |
| 113 |
<dd>Template to use when run as an incoming hook, overriding <tt class="docutils literal">notify.template</tt>.</dd> |
| 114 |
<dt>notify.outgoing</dt> |
| 115 |
<dd>Template to use when run as an outgoing hook, overriding <tt class="docutils literal">notify.template</tt>.</dd> |
| 116 |
<dt>notify.changegroup</dt> |
| 117 |
<dd>Template to use when running as a changegroup hook, overriding |
| 118 |
<tt class="docutils literal">notify.template</tt>.</dd> |
| 119 |
<dt>notify.maxdiff</dt> |
| 120 |
<dd>Maximum number of diff lines to include in notification email. Set to 0 |
| 121 |
to disable the diff, or -1 to include all of it. Default: 300.</dd> |
| 122 |
<dt>notify.maxdiffstat</dt> |
| 123 |
<dd>Maximum number of diffstat lines to include in notification email. Set to -1 |
| 124 |
to include all of it. Default: -1.</dd> |
| 125 |
<dt>notify.maxsubject</dt> |
| 126 |
<dd>Maximum number of characters in email's subject line. Default: 67.</dd> |
| 127 |
<dt>notify.diffstat</dt> |
| 128 |
<dd>Set to True to include a diffstat before diff content. Default: True.</dd> |
| 129 |
<dt>notify.showfunc</dt> |
| 130 |
<dd>If set, override <tt class="docutils literal">diff.showfunc</tt> for the diff content. Default: None.</dd> |
| 131 |
<dt>notify.merge</dt> |
| 132 |
<dd>If True, send notifications for merge changesets. Default: True.</dd> |
| 133 |
<dt>notify.mbox</dt> |
| 134 |
<dd>If set, append mails to this mbox file instead of sending. Default: None.</dd> |
| 135 |
<dt>notify.fromauthor</dt> |
| 136 |
<dd>If set, use the committer of the first changeset in a changegroup for |
| 137 |
the "From" field of the notification mail. If not set, take the user |
| 138 |
from the pushing repo. Default: False.</dd> |
| 139 |
<dt>notify.reply-to-predecessor (EXPERIMENTAL)</dt> |
| 140 |
<dd><p class="first">If set and the changeset has a predecessor in the repository, try to thread |
| 141 |
the notification mail with the predecessor. This adds the "In-Reply-To" header |
| 142 |
to the notification mail with a reference to the predecessor with the smallest |
| 143 |
revision number. Mail threads can still be torn, especially when changesets |
| 144 |
are folded.</p> |
| 145 |
<p class="last">This option must be used in combination with <tt class="docutils literal">notify.messageidseed</tt>.</p> |
| 146 |
</dd> |
| 147 |
</dl> |
| 148 |
<p>If set, the following entries will also be used to customize the |
| 149 |
notifications:</p> |
| 150 |
<dl class="docutils"> |
| 151 |
<dt>email.from</dt> |
| 152 |
<dd>Email <tt class="docutils literal">From</tt> address to use if none can be found in the generated |
| 153 |
email content.</dd> |
| 154 |
<dt>web.baseurl</dt> |
| 155 |
<dd>Root repository URL to combine with repository paths when making |
| 156 |
references. See also <tt class="docutils literal">notify.strip</tt>.</dd> |
| 157 |
</dl> |
| 158 |
</div> |
| 159 |
</div> |
| 160 |
</body> |
| 161 |
</html> |