403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/hgext/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/__pycache__/notify.cpython-39.opt-1.pyc
a

�+�bmP�@s�dZddlmZddlmZddlmZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZmZmZmZmZmZmZmZddlmZmZdZiZe�e�Zedd	dd
�edddd
�eddd
d
�edddd
�edddd
�edddd
�edddd
�edddd
�edddd
�edddd
�edddd
�eddd
d
�edddd
�edddd
�edddd
�edddd
�edd dd
�edd!dd
�edd"dd
�edd#d
d
�d$��Z d%Z!d	e!iZ"Gd&d'�d'e#�Z$d,d(d)�Z%d*d+�Z&dS)-a�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.
  It is also used for the domain part of the ``Message-Id`` when using
  ``notify.messageidseed``.

notify.messageidseed
  Create deterministic ``Message-Id`` headers for the mails based on the seed
  and the revision identifier of the first commit in the changeset.

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.maxdiffstat
  Maximum number of diffstat lines to include in notification email. Set to -1
  to include all of it. Default: -1.

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.showfunc
  If set, override ``diff.showfunc`` for the diff content. Default: None.

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.

notify.reply-to-predecessor (EXPERIMENTAL)
  If set and the changeset has a predecessor in the repository, try to thread
  the notification mail with the predecessor. This adds the "In-Reply-To" header
  to the notification mail with a reference to the predecessor with the smallest
  revision number. Mail threads can still be torn, especially when changesets
  are folded.

  This option must  be used in combination with ``notify.messageidseed``.

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``.

�)�absolute_importN)�_)	�encoding�error�
logcmdutil�mail�obsutil�patch�pycompat�	registrar�util)�dateutil�
stringutilsships-with-hg-core�notify�changegroup)�default�config�diffstatT�domain�
messageidseed�
fromauthorsincoming�maxdiffi,�maxdiffstat����
maxsubject�C�mbox�merge�outgoing�reply-to-predecessorF�sourcessserve�showfunc�strip�style�template�tests�
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}
c@sReZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�ZdS)�notifierzemail notification class.cCs�||_|j�dd�}|r,|jj|ddgd�||_t|j�dd��|_|�|jj�|_|j�dd�|_|j�dd�|_	|j�
dd	�|_t�
|j�|_|��|_|j�
dd
�|_|j�
dd�|_|j�dd�|_|j�
dd
�|_|jr�|js�t�td���|jdu�r|j�
dd�|_d}|j�d|��p4|j�dd�}|�sJ|j�dd�}|�sf|�sft�|��pdt}t�||�}t�|j|j|�|_dS)Nrr�usersubs�reposubs)Zsectionsr"rrr%rr!rrs=notify.reply-to-predecessor used without notify.messageidseedsdiffr$r#)�ui�configZ
readconfig�repo�int�
stripcount�strip�root�domain�mbox�
configbool�testrZ	_charsets�charsets�subscribers�subs�merge�showfunc�
messageidseed�replyr�Abortr�deftemplates�get�single_templaterZtemplatespecZchangesettemplater�t)�selfr)r+�hooktypeZcfgZmapfile�template�spec�rD�2/usr/lib64/python3.9/site-packages/hgext/notify.py�__init__AsD
���znotifier.__init__cCsJt�|�}|j}|dkrF|�d�}|dkr,qF||dd�}|d8}q|S)z?strip leading slashes from local path, turn into web-safe path.r�/r�N)rZpconvertr-�find)r@�path�count�crDrDrEr.is


znotifier.stripcCsLt�|���}|jrH|�d�}|dkr2|d|�}d|vrH|d|jS|S)z try to clean up email addresses.�
@localhostrN�@)rZemailr.r0rI)r@Zaddr�arDrDrE�fixmailvs
znotifier.fixmailcs�t�}�j�d�D]^\}}|�d�D]J}d|vrB|�dd�\}}nd}t��jj|���r$|���	|�|f�q$q�j�d�D]Z\}}d|vr�|�dd�\}}nd}t��jj|�r~|�d�D]}|���	|�|f�q�q~�fdd�t
|�D�S)	z;return list of email addresses of subscribers to this repo.r'�,�#rHNr(cs*g|]"\}}t��j|�j�j�|f�qSrD)r�
addressencoder)r4r3)�.0�s�r�r@rDrE�
<listcomp>�s�z(notifier.subscribers.<locals>.<listcomp>)�setr)Zconfigitems�split�fnmatchr+r/r.�addrP�sorted)r@r6�userZpats�pat�revsZusersrDrWrEr5�s$
�znotifier.subscriberscKsP|jst|���dkrdS|jj|f|��|j�dd�|jj	|j	d�|��dS)z6format one changeset, unless it is a suppressed merge.rHFswebsbaseurl)ZchangesZbaseurlr/ZwebrootT)
r7�len�parentsr?ZshowZ	changesetr)r*r+r/)r@�ctxZpropsrDrDrE�node�s���z
notifier.nodecCs|j�dd���}||vS)z<true if incoming changes from this source should be skipped.rr )r)r*rZ)r@�sourceZ
ok_sourcesrDrDrE�
skipsource�sznotifier.skipsourcec
s�t�}|jD]b\}}|dur(|�|�qz|j�d|����}WntjyXYqYn0t|�r|�|�qqt|�dkr�|j	�
d�dSzt�|�}Wn0t
jy�}	zt�|	��WYd}	~	n
d}	~	00|d}
|d}|
dur�t�|
�}
|du�rt�|�}|d=|d=|���s\|��}|jtjd�}
t�|j	|
|j|j�}|D]\}}|||<�qHt�tjdd	��|d
<|�s�|dk�r�td�|j|f}n*���� ��!d
d�d�"�}d|j|f}t#|j	�$dd��}|�r�t%�&||�}t�'|j	||j|j�|d<|
�s|j	�$dd��p|j	�(�}
d|
v�s2d|
v�r<|�)|
�}
t�*|j	|
|j|j�|d<d�|d<|d�s�t+�|j,|j-�|d<|j.�r�|j�/���j0j1j2����fdd�t3�4�j5��6�g�D�}|�r�t7|dd�d�}t+||j,|j-�|d<d�8t9|��|d<tj�r|�:�n|�;�}|j�rD|j	�<|�|�=d
��s�|j	�<d
�nB|j	�>td �t|�|f�tj?|j	t@�A|d�d|||jBd!�dS)"z
send message.Ns
%r and %d:rs3notify: no subscribers to selected repo and revset
ZFromZSubject)�decodes%a, %d %b %Y %H:%M:%S %1%2)�formatZDaterHs%s: %d new changesets�
s%s: %srrsemailsfromrNrMzchangeset %szX-Hg-Notificationz
Message-Idcs(g|] }|���kr�|�r�|�qSrD)rd)rTZctx2�rc�has_nodeZunfirDrErX�s�z!notifier.send.<locals>.<listcomp>cSs|��S)N)�rev)rcrDrDrE�<lambda>
�znotifier.send.<locals>.<lambda>)�keyzIn-Reply-Toz, ZTos*notify: sending %d subscribers %d changes
)r1)CrYr6r\r+r`rlrZRepoLookupErrorrar)�debugrZ
parsebytes�emailerrorsZMessageParseErrorr;Z
headdecodeZis_multipart�itemsZget_payloadr
Zispy3Z
mimeencoder4r3r�strfromlocalr
Zdatestrrr/�description�lstriprZ�rstripr,r*rZellipsisZ
headencode�usernamerPrS�	messageidr0r9r:�
unfiltered�	changelog�indexrkrZallpredecessorsZobsstorerd�min�joinr]Zas_bytesZ	as_string�write�endswith�statusZsendmail�
emailutilsZ	parseaddrr1)r@rcrK�datar6�subrCr`�msg�instZsenderZsubjectZheadersZpayload�k�vrUZ
maxsubjectZpredecessorsZpredZmsgtextrDrjrE�send�s�


� 




�
�
�


�
�
���z
notifier.sendNcCs�t|j�dd��}|����}|r,|��}n|��}t�|j�}|j|_tj|j	|||d�}d�
|���}|j�dd��r$t|j�dd��}t�
|�}	|	�r$|dk�r|	�d�|d	k�r|	�d�}	td
�}
|j�|
t|	�d|f�|j�d�
|	d|�|	dd���n|j�td
�|	�|dk�r2dS|dk�rxt|�|k�rxtd�}
|j�|
t|�|f�|d|�}n|�r�|j�td�t|��|j�d�
|��dS)Nrr)ZoptsrnrrrrirHs,
diffstat (truncated from %d to %d lines):

����s
diffstat:

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

s
diffs (%d lines):

)r,r)r*Zp1rdr	Zdiffalloptsr8�diffr+r}�
splitlinesr2ZdiffstatrKrZrr~ra)r@rc�refZmaxdiff�prevZdiffopts�chunksZ	difflinesZmaxdiffstatrUr�rDrDrEr�"s8


(
z
notifier.diff)N)�__name__�
__module__�__qualname__�__doc__rFr.rPr5rdrfr�r�rDrDrDrEr&>s(
ur&c
Ks�t|||�}|��|}|js2|�d|j�dS|�|�rN|�d|�dS|��d}d}	d}
|dkst|dk�r|jj|�	�d�D]f}|�
||�r�|	d	7}	|
s�||��}
q�||��7}|�
td
�|||��dd�f�|��q�|	�rr|�||d�nl|�	�|v�rr|�
|��sR|��|�
td
�|�	�|��dd�f�dS|	d	7}	|�|�|
�sr|��}
||��7}|�d
d�}|
�r�|�r�d�d|
|g�}|	�r�|�||	|�dS)z�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
rnrrr)�startrHs1notify: suppressing notification for merge %d:%s
�stiprrrisFrom: %s)r&ryr6rpr/rfZ
pushbufferrzr`rlrdr^Z	popbufferZnoter�hexr�r*r}r�)
r)r+rArdre�kwargs�nrcr�rKZauthorrlZ
fromauthorrDrDrE�hookHs\
��
��
r�cCs~|r|r|}nt�t���}|rRt�|��|�}dt�|�	�dd��|f}n"d|t
t���t|�
�j�|f}t�|�S)Ns
<hg.%s@%s>�@s<hg.%s.%d.%d@%s>)rZ
strtolocal�socketZgetfqdn�hashlibZsha512r�r
Zsysbytes�	hexdigestr,�time�hashr+r/rs)rcr0r9�hostZmessagehashrxrDrDrErx�s �
�rx)NN)'r�Z
__future__rZemail.errors�errorsrqZemail.utilsZutilsr�r[r�r�r�Zmercurial.i18nrZ	mercurialrrrrrr	r
rrZmercurial.utilsr
rZ
testedwithZconfigtableZ
configitemrur>Zmultiple_templater<�objectr&r�rxrDrDrDrE�<module>s�,	
��������������������
�
9

Youez - 2016 - github.com/yon3zu
LinuXploit