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__/releasenotes.cpython-39.pyc
a

�+�b�W�	@sFdZddlmZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZddlmZmZiZe�e�ZzXddlZe���4ejd	d
edd�ddlmZej Wd�n1s�0YWne!�ydZYn0d
Z"ded�fded�fded�fded�fded�fgZ#e�$d�Z%dZ&ed�Z'Gdd�de(�Z)Gdd�de(�Z*dd �Z+d!d"�Z,d#d$�Z-d%d&�Z.d'd(�Z/d)d*�Z0d+d,�Z1d-d.�Z2d/d0�Z3d1d2�Z4d3d4�Z5d5d6�Z6ed7d8d9d:ed;�ed<�fd=d>d?ed@�ed<�fdAdBd?edC�dfgedD�ej7dE�dMdFdG��Z8edHdIdJ�dNdKdL��Z9dS)Oa/generate release notes from commit messages (EXPERIMENTAL)

It is common to maintain files detailing changes in a project between
releases. Maintaining these files can be difficult and time consuming.
The :hg:`releasenotes` command provided by this extension makes the
process simpler by automating it.
�)�absolute_importN)�_)�open)�hex)�cmdutil�config�error�
logcmdutil�minirst�pycompat�	registrar�util)�procutil�
stringutil�ignorez.*python-Levenshtein.*zfuzzywuzzy.fuzz)�action�message�category�modulesships-with-hg-coresfeaturesNew FeaturessbcsBackwards Compatibility Changes�fixs	Bug FixessperfsPerformance ImprovementssapisAPI Changess#^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$s\bissue ?[0-9]{4,6}(?![0-9])\bs
Other Changesc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�parsedreleasenotescCs
i|_dS�N��sections��self�r�8/usr/lib64/python3.9/site-packages/hgext/releasenotes.py�__init__Rszparsedreleasenotes.__init__cCs
||jvSrr�r�sectionrrr�__contains__Uszparsedreleasenotes.__contains__cCstt|j��Sr)�iter�sortedrrrrr�__iter__Xszparsedreleasenotes.__iter__cCs.|j�|ggf�|j|d�||f�dS)z Add a titled release note entry.rN�r�
setdefault�append)rr �title�
paragraphsrrr�
addtitleditem[sz parsedreleasenotes.addtitleditemcCs*|j�|ggf�|j|d�|�dS)z[Adds a non-titled release note entry.

        Will be rendered as a bullet point.
        �Nr%)rr r)rrr�addnontitleditem`sz#parsedreleasenotes.addnontitleditemcCs|j�|ggf�dS)z|Returns titled entries in a section.

        Returns a list of (title, paragraphs) tuples describing sub-sections.
        r�r�getrrrr�titledforsectionhsz#parsedreleasenotes.titledforsectioncCs|j�|ggf�dS)z5Returns non-titled, bulleted paragraphs in a section.r+r-rrrr�nontitledforsectionosz&parsedreleasenotes.nontitledforsectioncst�fdd�|�|�D��S)Nc3s|]}|d�kVqdS)rNr��.0�t�r(rr�	<genexpr>t�z8parsedreleasenotes.hastitledinsection.<locals>.<genexpr>)�anyr/)rr r(rr4r�hastitledinsectionssz%parsedreleasenotes.hastitledinsectionc	Cs8ts|�td��|D�]}t|�|��t|�|��}|�|�D]|\}}|�||�rn|�td�||f�qBt||fg�d}|dkr�t	|�}|r�t
|||�r�qBt|||�r�qB|�|||�qB|�|�D]f}||�|�vr�q�t|g�d}|dk�rt	|�}|�rt
|||��rq�t|||��r$q�|�
||�q�qdS)z{Merge another instance into this one.

        This is used to combine multiple sources of release notes together.
        sKmodule 'fuzzywuzzy' not found, merging of similar releasenotes is disabled
s*%s already exists in %s section; ignoring
rrN)�fuzz�warnr�
converttitledr/�convertnontitledr0r8�write�getissuenum�	findissue�similarr*r,)	r�ui�otherr �
existingnotesr(r)�incoming_str�issuerrr�mergevsR��
����
zparsedreleasenotes.mergeN)�__name__�
__module__�__qualname__rr!r$r*r,r/r0r8rFrrrrrQsrc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�releasenotessectionsNcCsD|r6t�t�}t|�}|r$|�|�tt�|��|_n
tt�|_dSr)	r
Zsortdict�DEFAULT_SECTIONS�getcustomadmonitions�update�listrZ	iteritems�	_sections)rrA�reporZcustom_sectionsrrrr�s

zreleasenotessections.__init__cCs
t|j�Sr)r"rOrrrrr$�szreleasenotessections.__iter__cCsdd�|jD�S)NcSsg|]}|d�qS)rrr1rrr�
<listcomp>�r6z.releasenotessections.names.<locals>.<listcomp>�rOrrrr�names�szreleasenotessections.namescCs$|jD]\}}||kr|SqdSrrR)rr(�name�valuerrr�sectionfromtitle�s
z%releasenotessections.sectionfromtitle)N)rGrHrIrr$rSrVrrrrrJ�s

rJcCs>g}|D]0\}}g}|D]}|�|�q|�d�|��q|S)z.
    Convert titled paragraphs to strings
    � ��extendr'�join)Ztitledparagraphs�string_listr(r)�lines�pararrrr;�sr;cCs:g}|D],}g}|D]}|�|�q|�d�|��q|S)z/
    Convert non-titled bullets to strings
    rWrX)Znontitledparagraphsr[r)r\r]rrrr<�sr<cCs t�t|tj�}|r|��}|S)zD
    Returns issue number from the incoming string if it exists
    )�re�search�RE_ISSUE�
IGNORECASE�group)rDrErrrr>�sr>cs4t�fdd�|D��r,|�td���dSdSdS)z?
    Returns true if issue number already exists in notes.
    c3s|]}�|vVqdSrr�r2�s�rErrr5�r6zfindissue.<locals>.<genexpr>s'"%s" already exists in notes; ignoring
TFN)r7r=r)rA�existingrErrerr?�sr?cCsBt|���dkr:t||�}|s4|�td�|�dSdSndSdS)z?
    Returns true if similar note found in existing notes.
    �
s,"%s" already exists in notes file; ignoring
TFN)�len�split�similaritycheckr=r)rArfrDrFrrrr@�s
��r@cCs6tsdSd}|D] }t�||�}|dkrd}q2q|S)zK
    Returns false when note fragment can be merged to existing notes.
    T�KF)r9�token_set_ratio)rDrCrFZbulletZscorerrrrjsrjcs>�d�t���d����fdd�	�d�vr4�d���d�S)N�.csD|�vr(�|��}��||||��nt�td���|���dS)Ns#.hgreleasenotes file '%s' not found)�data�parser�AbortrZpathto)�frZremaprn��ctx�p�readrPrrrus�z"getcustomadmonitions.<locals>.reads.hgreleasenotesssections)NN)r�items)rPrrrrrLs	rLcs�|D]�}||}t�t|�����r��d�|vr6qq|�td���d�|��dd�f��fdd���fdd�|D�}t|�dkr�|�td	�|d
�q|rd�	t
|��}|�td�|�qdS)
a`
    Checks the commit messages for admonitions and their validity.

    .. abcd::

       First paragraph under this admonition

    For this commit message, using `hg releasenotes -r . --check`
    returns: Invalid admonition 'abcd' present in changeset 3ea92981e103

    As admonition 'abcd' is neither present in default nor custom admonitions
    r+s0Invalid admonition '%s' present in changeset %s
N�cst�d��d�|���S)Nr+)�difflibZSequenceMatcherrbZratio)�x)�
admonitionrr�<lambda>Cs�z"checkadmonitions.<locals>.<lambda>csg|]}�|�dkr|�qS)g333333�?rrc)�simrrrQGr6z$checkadmonitions.<locals>.<listcomp>s(did you mean %s?)
rs, s(did you mean one of %s?)
)r^r_�RE_DIRECTIVE�descriptionrbr=rrrhrZr#)rArP�
directives�revs�revrsr@�ssr)rzr|r�checkadmonitions+s$
��r�cCs(|D]}|�d|d|df�qdS)Ns%s: %s
rr+)r=)rArr rrr�_getadmonitionlistOsr�cCspt�}|D�]^}||}tj|��|d�\}}t|�D�]0\}}	|	ddkrNq6|	d}
|	drn|	dd��nd}|dt|�kr�t�t	d�||
f��g}t
|dt|��D]t}
||
}|dd	kr�q�|ddkr��q$|dd
kr�|j�t	d�||
f�|ddk�r|�
|d�q��q$q�|�sF|j�t	d
�t|����|�r\|�|
||�q6|�|
|�q6q
|S)N)Zadmonitions�types
admonitionsadmonitiontitle�linesrr+s6changeset %s: release notes directive %s lacks content�margin�	paragraphs=changeset %s: unexpected block in release notes directive %s
�indents.error parsing releasenotes for revision: '%s'
)rr
ror~�	enumerate�striprhrrpr�rangerAr:r'rZnoder*r,)rPrr��notesr�rs�blocksZpruned�i�blockZ	directiver(r)�jZpblockrrr�parsenotesfromrevisionsTs^
�
���
���
��r�cs
t�}t�|�d�d�fdd�	}d}t��D]�\}}|ddkrDq.|dd}|d	d
kr�|�|�}|s|t�td�|��|}||�}	|	r�|	D]}
|�||
�q�q.|d	dkr�|t	kr�||�}	|	D]}
|�||
�q�n||d
�}|�
|||�q.t�td�|��q.|S)z6Parse text content containing generated release notes.rFcs0g}t|dt���D�]}�|}|ddkr4qn�|ddkrH�q,n�|ddkr�|ddkrnt�td���|r�d	d
�|dD�}|�|�qn`dd
�|dD�g}�|dd�D].}|dd
vr�q�|ddkr�|�|d�q�|�|�qn$|ddk�rt�td�|d��|r|�|d�q|S)Nr+r�r��section�bulletr�rs#indented bullet lists not supportedcSsg|]}|dd����qS�r+N�r��r2�lrrrrQ�r6zJparsereleasenotesfile.<locals>.gatherparagraphsbullets.<locals>.<listcomp>r�cSsg|]}|dd����qSr�r�r�rrrrQ�r6)r�r�r�s*unexpected block type in release notes: %s)r�rhrrprr')�offsetr(Znotefragmentr�r�r\�r�rr�gatherparagraphsbullets�s>

��z6parsereleasenotesfile.<locals>.gatherparagraphsbulletsNr�r�r�s	underline�=s!unknown release notes section: %s�-Tsunsupported section type for %s)F)rr
ror�rVrrprr,�BULLET_SECTIONr*)r�textr�r�Zcurrentsectionr�r�r(rTZ
bullet_pointsr]r)rr�r�parsereleasenotesfile�s8%

�
r�c
Cs�g}|D�]x\}}||vrq|�|�|�dt|��|�d�|�|�D]v\}}|�|�|�dt|��|�d�t|�D]4\}}|r�|�d�|�tjd�|�dd����q�|�d�qL|�	|�}	|�|��r|	�r|�t
�|�dtt
��|�d�|	D]v}|�tjd�|d�ddd	d
����|dd�D]2}|�d�|�tjd�|�dd	d	d
�����q@|�d��q
q|�r�|d
�r�|�d�d�|�S)z�Serialize release notes from parsed fragments and notes.

    This function essentially takes the output of ``parsenotesfromrevisions()``
    and ``parserelnotesfile()`` and produces output combining the 2.
    r�r6r�rW�N)�widthrs* s  )r�Z
initindentZ
hangindentr+N����
)r'rhr/r�rYr�wraprZ�
splitlinesr0r�)
rr�r\ZsectionnameZsectiontitler(r)r�r]Z	nontitledrrr�serializenotes�s\




�


��	
��	
r��releasenotes�r�revr6s&revisions to process for release notessREV�c�checkFs+checks for validity of admonitions (if any)�l�lists/list the available admonitions with their titles"hg releasenotes [-r REV] [-c] FILE)Zhelpcategoryc
Ksjt�|�}t||�}t�|dddg�|�d�r:t||�S|�d�}t�||pPdg�}|�d�rrt	|||�
�|�St||�
�|�}|dur�|�d�|�
t||��Sz<t|d��}t||���}	Wd�n1s�0YWn<t�y}
z"|
jtjk�r�t�}	WYd}
~
n
d}
~
00|	�||�t|d�� }|�
t||	��Wd�n1�s\0YdS)	a�	parse release notes from commit messages into an output file

    Given an output file and set of revisions, this command will parse commit
    messages for release notes then add them to the output file.

    Release notes are defined in commit messages as ReStructuredText
    directives. These have the form::

       .. directive:: title

          content

    Each ``directive`` maps to an output section in a generated release notes
    file, which itself is ReStructuredText. For example, the ``.. feature::``
    directive would map to a ``New Features`` section.

    Release note directives can be either short-form or long-form. In short-
    form, ``title`` is omitted and the release note is rendered as a bullet
    list. In long form, a sub-section with the title ``title`` is added to the
    section.

    The ``FILE`` argument controls the output file to write gathered release
    notes to. The format of the file is::

       Section 1
       =========

       ...

       Section 2
       =========

       ...

    Only sections with defined release notes are emitted.

    If a section only has short-form notes, it will consist of bullet list::

       Section
       =======

       * Release note 1
       * Release note 2

    If a section has long-form notes, sub-sections will be emitted::

       Section
       =======

       Note 1 Title
       ------------

       Description of the first long-form note.

       Note 2 Title
       ------------

       Description of the second long-form note.

    If the ``FILE`` argument points to an existing file, that file will be
    parsed for release notes having the format that would be generated by this
    command. The notes from the processed commit messages will be *merged*
    into this parsed set.

    During release notes merging:

    * Duplicate items are automatically ignored
    * Items that are different are automatically ignored if the similarity is
      greater than a threshold.

    This means that the release notes file can be updated independently from
    this command and changes should not be lost when running this command on
    that file. A particular use case for this is to tweak the wording of a
    release note after it has been added to the release notes file.

    The -c/--check option checks the commit message for invalid admonitions.

    The -l/--list option, presents the user with a list of existing available
    admonitions along with their title. This also includes the custom
    admonitions (if any).
    r�r�r�snot public()Nr��rbswb)rZbyteskwargsrJrZcheck_incompatible_argumentsr.r�r	Zrevranger�rSr�Zpagerr=r�rr�ru�IOError�errno�ENOENTrrF)rArPZfile_Zoptsrr�r�Zincoming�fhr��errr�releasenotes/s.o






0r�sdebugparsereleasenotesT)Znorepoc	Cs|dkrtj��}n2t|d��}|��}Wd�n1s<0Yt||�}t||�}|D]�}|�td�|�|�|�D]<\}}	|�td�|�|	D]}
|�td�d�	|
��q�q~|�
|�D]4}	|�td��|	D]}
|�td�d�	|
��q�q�q^dS)	z6parse release notes and print resulting data structurer�r�Nssection: %s
s  subsection: %s
s    paragraph: %s
rWs  bullet point:
)r�stdinrurrJr�r=rr/rZr0)rA�pathrPr�r�rr�r r(r)r]rrr�debugparsereleasenotes�s &

r�)N)N):�__doc__Z
__future__rrxr�r^Zmercurial.i18nrZmercurial.pycompatrZmercurial.noderZ	mercurialrrrr	r
rrr
Zmercurial.utilsrrZcmdtableZcommand�warnings�catch_warnings�filterwarnings�UserWarningZfuzzywuzzy.fuzzr9rl�ImportErrorZ
testedwithrK�compiler}r`r��objectrrJr;r<r>r?r@rjrLr�r�r�r�r�ZCATEGORY_CHANGE_NAVIGATIONr�r�rrrr�<module>s�(


�(





�
]


$COI�����u


Youez - 2016 - github.com/yon3zu
LinuXploit