-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/hgext/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/hgext/notify.pyc

ó
Ì\,Tc@sÈdZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZddl
Z
dZdjƒZdZied6Zd	efd
„ƒYZddd„ZdS(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_(tpatchtcmdutilt	templatertutiltmailtinternalsË
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}
tchangegrouptnotifiercBsYeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d	d„ZRS(
semail notification class.cCsÀ||_|jjddƒ}|rC|jj|dddgƒn||_t|jjdddƒƒ|_|j|jjƒ|_|jjddƒ|_|jjdd	ƒ|_	|jj
dd
tƒ|_t
j|jƒ|_|jƒ|_|jj
ddtƒ|_|jjddƒ}|jjd|ƒpK|jjdd
ƒ}|rt|rttj|ƒpnt}n|r’tj|dtƒ}ntj|j|jtd||tƒ|_dS(Ntnotifytconfigtsectionstusersubstreposubststripitdomaintmboxttesttmergetstylettemplatetquoted(tuiR
t
readconfigtrepotintt
stripcountRtrootRRt
configbooltTrueRRt	_charsetstcharsetstsubscriberstsubsRtdeftemplatestgettsingle_templateRtparsestringtFalseRtchangeset_templatertNonett(tselfRRthooktypetcfgtmapfileR((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyt__init__­s,		!cCsftj|ƒ}|j}xG|dkra|jdƒ}|dkrFPn||d}|d8}qW|S(s?strip leading slashes from local path, turn into web-safe path.it/iÿÿÿÿi(RtpconvertRtfind(R*tpathtcounttc((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyRÆs	cCshtj|jƒƒ}|jrd|jdƒ}|dkrF|| }nd|krd|d|jSn|S(s try to clean up email addresses.s
@localhostiÿÿÿÿt@(RtemailRRR1(R*taddrta((s0/usr/lib/python2.7/dist-packages/hgext/notify.pytfixmailÓs	
c	Cs•tƒ}x¤|jjdƒD]\}}x|jdƒD]p}d|kre|jddƒ\}}nd}tj|jj|jƒƒr8|j	|j
|ƒ|fƒq8q8WqWxž|jjdƒD]Š\}}d|krö|jddƒ\}}nd}tj|jj|ƒrÃx6|jdƒD]"}|j	|j
|ƒ|fƒq$WqÃqÃWgt|ƒD]3\}}tj
|j||j|jƒ|f^q^S(s;return list of email addresses of subscribers to this repo.Rt,t#iR
N(tsetRtconfigitemstsplitR(tfnmatchRRRtaddR9tsortedRt
addressencodeRR(	R*R!tusertpatstpattrevstuserststr((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyR ßs"	''cKss|jr&t|jƒƒdkr&tS|jj|d|jƒd|jjddƒd|j	j
d|j
|tS(s6format one changeset, unless it is a suppressed merge.itchangestbaseurltwebRtwebroot(RtlentparentsR&R)tshowt	changesetRR
RRR(R*tctxtprops((s0/usr/lib/python2.7/dist-packages/hgext/notify.pytnodeõs"cCs(|jjdddƒjƒ}||kS(s<true if incoming changes from this source should be skipped.R	tsourcestserve(RR
R>(R*tsourcet
ok_sources((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyt
skipsourceþscCsétƒ}xs|jD]h\}}|dkr>|j|ƒqn|jjd||jƒƒ}t|ƒr|j|ƒqqqWt|ƒdkr¥|jj	dƒdSt
jjƒ}y|j|ƒ}	Wn(t
j
jk
rñ}
tj|
ƒ‚nX|	d|	d}}|	d=|	d=|	jƒs~|	jƒ}
|	jƒ}tj|j||j|jƒ}	x!|
D]\}}||	|<qaWntjddƒ|	d	<|s|d
krÂtdƒ|j|f}q|jƒjƒjdd
ƒdjƒ}d
|j|f}nt|jj dddƒƒ}|r9tj!||ƒ}ntj"|j||j|jƒ|	d<|s‹|jj ddƒp…|jj#ƒ}nd|ks£d|krµ|j$|ƒ}ntj%|j||j|jƒ|	d<d||	d<|	ds-d|tt&j&ƒƒt'|jjƒt(j)ƒf|	d<ndj*t+|ƒƒ|	d<|	j,ƒ}|jr|jj-|ƒ|j.dƒså|jj-dƒqånU|jj/tdƒt|ƒ|fƒtj0|jtj
|	dƒ||d|j1ƒdS(s
send message.s
%r and %d:is3notify: no subscribers to selected repo and revset
NtFromtSubjecttformats%a, %d %b %Y %H:%M:%S %1%2tDateis%s: %d new changesetss
s%s: %sR	t
maxsubjectiCR6tfromR5s
@localhostschangeset %ssX-Hg-Notifications
Message-Ids<hg.%s.%s.%s@%s>s, tTos*notify: sending %d subscribers %d changes
R(2R<R!R(R@RRFtrevRNRtdebugR6tParsertparsestrtErrorstMessageParseErrorRtAborttis_multiparttitemstget_payloadRt
mimeencodeRRtdatestrRRtdescriptiontlstripR>trstripRR
tellipsist
headencodetusernameR9RBttimethashtsockettgetfqdntjoinRAt	as_stringtwritetendswithtstatustsendmailR(R*RRR3tdataR!tsubtspecRFtptmsgtinsttsendertsubjecttheaderstpayloadtktvRHR^tmsgtext((s0/usr/lib/python2.7/dist-packages/hgext/notify.pytsendsr	


!('
&	c	Cst|jjdddƒƒ}|jƒjƒ}|rB|jƒpK|jƒ}tj|j||dtj|jƒƒ}dj	|ƒj
ƒ}|jjddtƒrÔtj
|ƒ}|rÔ|jjd|ƒqÔn|dkrädS|dkr;t|ƒ|kr;td	ƒ}|jj|t|ƒ|fƒ|| }n)|rd|jjtd
ƒt|ƒƒn|jjdj	|ƒƒdS(NR	tmaxdiffi,toptsttdiffstats
diffstat:

%sis)
diffs (truncated from %d to %d lines):

s
diffs (%d lines):

s
(RRR
tp1RTRtdiffRtdiffoptsRwt
splitlinesRRRŽRyRNR(	R*RRtrefR‹tprevtchunkst	difflinesRHR((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyRSs$* 
#N(t__name__t
__module__t__doc__R.RR9R RTRYRŠR(R(((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyRªs		
						PcKs1t|||ƒ}||}|js=|jd|jƒdS|j|ƒra|jd|ƒdS|jƒd}d}	d}
|dks•|dkrf|jƒt|ƒ}}x•t||ƒD]„}
|j	||
ƒrý|	d7}	|
sB||
j
ƒ}
qBq¾||jƒ7}|jt
d	ƒ|
||
jƒd
 fƒ|jƒq¾W|	rÇ|j||dƒqÇna|j	|ƒs°|jƒ|jt
d	ƒ|jƒ|jƒd
 fƒdS|	d7}	|j|ƒ||jƒ7}|jdd
ƒ}|
r|rdjd|
|gƒ}n|	r-|j||	|ƒndS(s®send email notifications to interested subscribers.

    if used as changegroup hook, send one email for all changesets in
    changegroup. else send one email per changeset.s(notify: no subscribers to repository %s
Ns,notify: changes have source "%s" - skipping
RiRtoutgoingis1notify: suppressing notification for merge %d:%s
ittipR	t
fromauthors
sFrom: %s(RR!RbRRYt
pushbufferRaRNtxrangeRTRCt	popbuffertnoteRthexRR
RwRŠ(RRR+RTRWtkwargstnRRR}R3tauthortstarttendRaRœ((s0/usr/lib/python2.7/dist-packages/hgext/notify.pythooklsL
	




(R™R6RuRstemail.Parsertmercurial.i18nRt	mercurialRRRRRR?t
testedwithRnR$tmultiple_templateR"tobjectRR(R§(((s0/usr/lib/python2.7/dist-packages/hgext/notify.pyt<module>†s$(	
Â

Copyright © 2017 || Recoded By Mr.Bumblebee