-=[ Mr. Bumblebee ]=-
_Indonesia_
ó
Ì\,Tc @ sÈ d Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z m
Z
m Z m Z d d l
Z
d Z d j ƒ Z d Z i e d 6Z d e f d
„ ƒ YZ d d d „ Z d S( sú hooks for sending email push notifications
This extension implements hooks to send email notifications when
changesets are sent from or received by the local repository.
First, enable the extension as explained in :hg:`help extensions`, and
register the hook you want to run. ``incoming`` and ``changegroup`` hooks
are run when changesets are received, while ``outgoing`` hooks are for
changesets sent to another repository::
[hooks]
# one email for each incoming changeset
incoming.notify = python:hgext.notify.hook
# one email for all incoming changesets
changegroup.notify = python:hgext.notify.hook
# one email for all outgoing changesets
outgoing.notify = python:hgext.notify.hook
This registers the hooks. To enable notification, subscribers must
be assigned to repositories. The ``[usersubs]`` section maps multiple
repositories to a given recipient. The ``[reposubs]`` section maps
multiple recipients to a single repository::
[usersubs]
# key is subscriber email, value is a comma-separated list of repo patterns
user@host = pattern
[reposubs]
# key is repo pattern, value is a comma-separated list of subscriber emails
pattern = user@host
A ``pattern`` is a ``glob`` matching the absolute path to a repository,
optionally combined with a revset expression. A revset expression, if
present, is separated from the glob by a hash. Example::
[reposubs]
*/widgets#branch(release) = qa-team@example.com
This sends to ``qa-team@example.com`` whenever a changeset on the ``release``
branch triggers a notification in any repository ending in ``widgets``.
In order to place them under direct user management, ``[usersubs]`` and
``[reposubs]`` sections may be placed in a separate ``hgrc`` file and
incorporated by reference::
[notify]
config = /path/to/subscriptionsfile
Notifications will not be sent until the ``notify.test`` value is set
to ``False``; see below.
Notifications content can be tweaked with the following configuration entries:
notify.test
If ``True``, print messages to stdout instead of sending them. Default: True.
notify.sources
Space-separated list of change sources. Notifications are activated only
when a changeset's source is in this list. Sources may be:
:``serve``: changesets received via http or ssh
:``pull``: changesets received via ``hg pull``
:``unbundle``: changesets received via ``hg unbundle``
:``push``: changesets sent or received via ``hg push``
:``bundle``: changesets sent via ``hg unbundle``
Default: serve.
notify.strip
Number of leading slashes to strip from url paths. By default, notifications
reference repositories with their absolute path. ``notify.strip`` lets you
turn them into relative paths. For example, ``notify.strip=3`` will change
``/long/path/repository`` into ``repository``. Default: 0.
notify.domain
Default email domain for sender or recipients with no explicit domain.
notify.style
Style file to use when formatting emails.
notify.template
Template to use when formatting emails.
notify.incoming
Template to use when run as an incoming hook, overriding ``notify.template``.
notify.outgoing
Template to use when run as an outgoing hook, overriding ``notify.template``.
notify.changegroup
Template to use when running as a changegroup hook, overriding
``notify.template``.
notify.maxdiff
Maximum number of diff lines to include in notification email. Set to 0
to disable the diff, or -1 to include all of it. Default: 300.
notify.maxsubject
Maximum number of characters in email's subject line. Default: 67.
notify.diffstat
Set to True to include a diffstat before diff content. Default: True.
notify.merge
If True, send notifications for merge changesets. Default: True.
notify.mbox
If set, append mails to this mbox file instead of sending. Default: None.
notify.fromauthor
If set, use the committer of the first changeset in a changegroup for
the "From" field of the notification mail. If not set, take the user
from the pushing repo. Default: False.
If set, the following entries will also be used to customize the
notifications:
email.from
Email ``From`` address to use if none can be found in the generated
email content.
web.baseurl
Root repository URL to combine with repository paths when making
references. See also ``notify.strip``.
iÿÿÿÿN( t _( t patcht cmdutilt templatert utilt mailt internalsË
Subject: changeset in {webroot}: {desc|firstline|strip}
From: {author}
changeset {node|short} in {root}
details: {baseurl}{webroot}?cmd=changeset;node={node|short}
description:
{desc|tabindent|strip}
sx
changeset {node|short} in {root}
details: {baseurl}{webroot}?cmd=changeset;node={node|short}
summary: {desc|firstline}
t changegroupt notifierc B sY e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d d „ Z RS(
s email notification class.c C sÀ | | _ | j j d d ƒ } | rC | j j | d d d g ƒn | | _ t | j j d d d ƒ ƒ | _ | j | j j ƒ | _ | j j d d ƒ | _ | j j d d ƒ | _ | j j
d d
t ƒ | _ t
j | j ƒ | _ | j ƒ | _ | j j
d d t ƒ | _ | j j d d ƒ } | j j d | ƒ pK| j j d d
ƒ } | rt| rtt j | ƒ pnt } n | r’t j | d t ƒ} n t j | j | j t d | | t ƒ | _ d S( Nt notifyt configt sectionst usersubst reposubst stripi t domaint mboxt testt merget stylet templatet quoted( t uiR
t
readconfigt repot intt
stripcountR t rootR R t
configboolt TrueR R t _charsetst charsetst subscriberst subsR t deftemplatest gett single_templateR t parsestringt FalseR t changeset_templatert Nonet t( t selfR R t hooktypet cfgt mapfileR ( ( s0 /usr/lib/python2.7/dist-packages/hgext/notify.pyt __init__ s, !c C sf t j | ƒ } | j } xG | d k ra | j d ƒ } | d k rF Pn | | d } | d 8} q W| S( s? strip leading slashes from local path, turn into web-safe path.i t /iÿÿÿÿi ( R t pconvertR t find( R* t patht countt c( ( s0 /usr/lib/python2.7/dist-packages/hgext/notify.pyR Æ s c C sh t j | j ƒ ƒ } | j rd | j d ƒ } | d k rF | | } n d | k rd | d | j Sn | S( s try to clean up email addresses.s
@localhostiÿÿÿÿt @( R t emailR R R1 ( R* t addrt a( ( s0 /usr/lib/python2.7/dist-packages/hgext/notify.pyt fixmailÓ s
c C s• t ƒ } x¤ | j j d ƒ D] \ } } x | j d ƒ D]p } d | k re | j d d ƒ \ } } n d } t j | j j | j ƒ ƒ r8 | j | j
| ƒ | f ƒ q8 q8 Wq Wxž | j j d ƒ D]Š \ } } d | k rö | j d d ƒ \ } } n d } t j | j j | ƒ rà x6 | j d ƒ D]"