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 :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/revset.cpython-39.opt-1.pyc
a

�+�b]�@s�ddlmZddlZddlmZddlmZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z!m"Z"ddl#m$Z$m%Z%m&Z&ej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ej,Z,ej-Z-ej.Z.ej/Z/ej0Z0ej1Z1ej2Z2e	e
fZ3d	Z4d
Z5dZ6e5fdd
�Z7dd�Z8dd�Z9dd�Z:dd�Z;dd�Z<dd�Z=dd�Z>dd�Z?dd�Z@d d!�ZAd"d#�ZBd$d%�ZCd&d'�ZDd(d)�ZEd*d+�ZFd,d-�ZGd.d/�ZHd0d1�ZId2d3�ZJd4d5�ZKd6d7�ZLd8d9�ZMd:d;�ZNd<d=�ZOd>d?�ZPejQZQeR�ZSe�T�ZUeUd@�dAdB��ZVeUdC�dDdE��ZWeUdFdGdHdI�dJdK��ZXeUdLdGdMdI�dNdO��ZY�d�dQdR�ZZeUdSdGdT�dUdV��Z[eUdWdGdT�dXdY��Z\dZd[�Z]d\d]�Z^eUd^dGd_dI�d`da��Z_eUdbdGdT�dcdd��Z`eUdedGdT�dfdg��ZaeUdhdGdT�didj��ZbeUdkdGd_dI�dldm��ZceUdndGdT�dodp��ZdeUdqdGdT�drds��Zedtdu�Zfdvdw�ZgeUdxdGdT�dydz��ZheUd{dGd_dI�d|d}��ZieUd~dGdT�dd���ZjeUd�dGdT�d�d���ZkeUd�dGdT�d�d���ZleUd�dGdT�d�d���ZmeUd�d�d��d�d���ZneUd�dGdT�d�d���ZoeUd�dGd_dI�d�d���ZpeUd�dGd_dI�d�d���Zq�d�d�d��ZreUd�dGdT�d�d���ZseUd�dGdT�d�d���ZteUd�dGd_dI�d�d���ZueUd�d�d��d�d���ZveUd�dGdT�d�d���ZweUd�dGdGd��d�d���ZxeUd�dPd�dI�d�d���ZyeUd�dGdT�d�d���ZzeUd�dGdT�d�d���Z{eUd�dGdT�d�d���Z|eUd�dGdGdd��d�d���Z}�d�d�d��Z~eUd�dGdT�d�d„�ZeUd�dGdT�d�dń�Z�eUd�dGdT�d�dȄ�Z�eUdɃd�d˄�Z�eUd�dGdT�d�d΄�Z�eUd�d_d��d�dф�ZeUd�dGdT�d�dԄ�Z�eUd�dGd_dI�d�dׄ�Z�eUd�dGdT�d�dڄ�Z�eUd�dGdGd��d�d݄�Z�eUd�dGdT�d�d��Z�eUd�dGd_dI�d�d��Z�eUd�dGdGdd��d�d��Z�eUd�dGdGd��d�d��Z�eUd�dGdT�d�d��Z�eUd�dGdT�d�d��Z�eUd�dGdT�d�d��Z�eUd�dGdT�d�d���Z�eUd�dGdHdI�d�d���Z�eUd��d�d���Z�d�d��Z�eUd�dGdT�d��d��Z�eU�ddGdT��d�d��Z�eU�ddGdT��d�d��ZeU�ddGdT��d�d	��Z�eU�d
dGdT��d�d��Z�eU�d
dPd_dI��d�d��Z�eU�ddGdT��d�d��Z�eU�ddGdT��d�d��Z��d�d�Z�eU�ddGdT��d�d��Z��d�d�Z�eU�ddGdT��d�d��Z�eU�d dGdT��d!�d"��Z�eU�d#dGdT��d$�d%��Z�eU�d&dGdT��d'�d(��Z �d)�d*�Z�eU�d+dGdGd���d,�d-��Z�eU�d.dGdT��d/�d0��Z�eU�d1dGdT��d2�d3��Z�eU�d4dGdT��d5�d6��Z�eU�d7dPdT��d8�d9��Z�eU�d:dGdHdI��d;�d<��Z�eU�d=dGdT��d>�d?��Z�eU�d@dGdT��dA�dB��Z�eU�dCdGdGd���dD�dE��ZTeU�dFdGdT��dG�dH��Z�eU�dIdGdGdd���dJ�dK��Z�eU�dLdGdT��dM�dN��Z�ej��dO�dP��dQ�dP��dR�dP��dS�dP��dT�dP�ej��dU�Z��dV�dW�Z�eU�dXdGdGd_d���dY�dZ��Z�eU�d[��d\�d]��Z��d^�d_�Z�eU�d`dGdT��da�db��Z��d��dc�dd�Z�eU�dedGdT��df�dg��Z�eU�dhdGdT��di�dj��Z�eU�dkdGdT��dl�dm��Z�eU�dndGdT��do�dp��Z�eU�dqdGd_dI��dr�ds��Z�eU�dtdGddI��du�dv��Z��dw�dx�Z�eU�dydGdGd���dz�d{��Z��d|�d}�Z�eU�d~dGdGdd���d�d���Z��d��d��Z�eU�d�dGdGd���d��d���Z�e<e=e>e?eAe:e:eBeCeFeGeDeHeLeMeNeOePe^e�e�e;�d��Z�eJeJ�d��Z�eKeK�d��ZÐd��d��ZĐd��d��d��Z�d��d��d��ZŐd��d��ZƐd��d��Z�e�ddeU�eQ�ȡZ�dS(��)�absolute_importN�)�_��getattr)�bin�nullrev�wdirrev)�dagop�destutil�diffutil�encoding�error�grep�hbisect�match�obsolete�obsutil�pathutil�phases�pycompat�	registrar�repoview�
revsetlang�scmutil�smartset�stack�util)�dateutil�
stringutil�urlutilsanysdefine�followcCs:|st�td���t|d||g|dd��Rd|i�S)Nsmissing argumentrr�order)r�
ParseErrorr�methods��repo�subset�xr"�r)�6/usr/lib64/python3.9/site-packages/mercurial/revset.py�getsetnsr+c	CsN||��}dD]8}||vrz|||��WStjyFYq0qdS)N)�sourcestransplant_sources
rebase_source)�extra�revr�RepoLookupError)r&�rr-�labelr)r)r*�
_getrevsourcetsr2cCstt�tj|��S�N)�sortedrZrapplyZmaybebytestr)�xsr)r)r*�_sortedbsr6cCsN|st�td���t�t�||��}||vs>|tvrHt|t�rHt	|g�St	�S)Ns$empty string is not a valid revision)
rr#rr�intrevZ	revsymbol�_virtualrevs�
isinstance�fullreposet�basesetr%r)r)r*�	stringset�s
r<cCs|tkr||@S||@SdS)z1argument is already a smartset, use that directlyN)�followorderr%r)r)r*�rawsmartset�sr>cCsFt|t|�|�}t|t|�|�}|r(|s.t�St|||��|��|�Sr3)r+r:r;�
_makerangeset�first�last)r&r'r(�yr"�m�nr)r)r*�rangeset�s
rEcCst||d|j��|�S�Nr)r?�	changelog�tiprevr%r)r)r*�rangeall�srIcCs.t|t|�|�}|st�St||d|��|�SrF)r+r:r;r?rA)r&r'rBr"rDr)r)r*�rangepre�srJcCs4t|t|�|�}|st�St|||��|j��|�Sr3)r+r:r;r?r@rGrH)r&r'r(r"rCr)r)r*�	rangepost�s�rKcCs�||krt|g�}nx|tkr8t||t|��t|g�}nT|tkrbt|g�t||j��|d�}n*||kr|t|||d�}nt|||d�}|tkr�||@S||@SdS�Nr)r;r	�spanset�lenrGrH�defineorder)r&r'rCrDr"r0r)r)r*r?�s"r?cCs2t|�}tj|t|||�t|||�dd�}||@S)NT)Zincludepath)r:r
Zreachablerootsr+)r&r'r(rBr"r0r5r)r)r*�dagrange�s
�rPcCs*|tkrt}nt}t|t||||�||�Sr3��anyorderr=r+�r&r'r(rBr"Zyorderr)r)r*�andset�srTcCs*|tkrt}nt}t|t||||�||�Sr3rQrSr)r)r*�andsmallyset�srUcCst||||�t|||t�Sr3�r+rR�r&r'r(rBr"r)r)r*�
differenceset�srXcCs^t|�dkrt|||d|�St|�d}t|||d|�|�}t||||d�|�}||S)Nrr�)rNr+�
_orsetlist)r&r'r5r"�p�a�br)r)r*rZ�srZcCsBt|�}|st�S|tkr0|t|t|�|t�@St||||�SdSr3)�getlistr;r=rZr:rR)r&r'r(r"r5r)r)r*�orset�sr_cCs|t|||t�Sr3rVr%r)r)r*�notset�sr`cCsFt|�}|tvr$t||||||�Sdd�t��D�}t�||��dS)NcSsg|]}t|�dkr|�qS�r�rN��.0r0r)r)r*�
<listcomp>�zrelationset.<locals>.<listcomp>)�	getsymbol�	relations�keysr�UnknownIdentifier)r&r'r(rBr"�rel�relnamesr)r)r*�relationset�s
rmcCsdd}d}||krdkr$nnd}|dkrBt|d�|df}|dkr\t|d�|df}||fS)a�Split range with bounds a and b into two ranges at 0 and return two
    tuples of numbers for use as startdepth and stopdepth arguments of
    revancestors and revdescendants.

    >>> _splitrange(-10, -5)     # [-10:-5]
    ((5, 11), (None, None))
    >>> _splitrange(5, 10)       # [5:10]
    ((None, None), (5, 11))
    >>> _splitrange(-10, 10)     # [-10:10]
    ((0, 11), (0, 11))
    >>> _splitrange(-10, 0)      # [-10:0]
    ((0, 11), (None, None))
    >>> _splitrange(0, 10)       # [0:10]
    ((None, None), (0, 11))
    >>> _splitrange(0, 0)        # [0:0]
    ((0, 1), (None, None))
    >>> _splitrange(1, -1)       # [1:-1]
    ((None, None), (None, None))
    �NNr)rrr)�min�max)r\r]Z	ancdepthsZ
descdepthsr)r)r*�_splitrangesrqcCsd}t||||||�S)N)�rangeallN)�generationssubrel)r&r'r(rkr"�zr)r)r*�generationsrel*srucCs�t|td�td�tjdtjd
d�\}}t||�\\}}	\}
}|durZ|
durZt�St|t|�|�}|stt�S|dur�|
dur�t�||d||	�}
|
t�	||d|
|�7}
n6|dur�t�||d||	�}
n|
dur�t�	||d|
|�}
||
@S)Ns0relation subscript must be an integer or a ranges*relation subscript bounds must be integersr)ZdeffirstZdeflastF)
�getintrangerr
Zmaxlogdepthrqr;r+r:�revancestors�revdescendants)r&r'r(rkrtr"r\r]ZancstartZancstopZ	descstartZdescstop�revs�sr)r)r*rs/s*

�
rscCsHt|�}|tvr&t|||||||�Sdd�t��D�}t�||��dS)NcSsg|]}t|�dkr|�qSrarbrcr)r)r*reUrfz#relsubscriptset.<locals>.<listcomp>)rg�subscriptrelationsrirrj)r&r'r(rBrtr"rkrlr)r)r*�relsubscriptsetMs
r|cCst�td���dS)Ns%can't use a subscript in this context�rr#rrWr)r)r*�subscriptsetYsr~cOstjtd�td�d��dS)Ns can't use a list in this contextssee 'hg help "revsets.x or y"')�hintr})r&r'r5�optsr)r)r*�listset]s�r�cCst�td���dS)Ns*can't use a key-value pair in this contextr})r&r'�k�vr"r)r)r*�keyvaluepairdsr�cslt|�}|tvr>t|}t|dd�r2|||||�S||||�Sdd���fdd�t��D�}t�||��dS)NZ
_takeorderFcSst|dd�duS)N�__doc__r)�fnr)r)r*�<lambda>prfzfunc.<locals>.<lambda>csg|]\}}�|�r|�qSr)r))rdrzr��Zkeepr)r*rerrfzfunc.<locals>.<listcomp>)rg�symbolsr�itemsrrj)r&r'r\r]r"�f�funcZsymsr)r�r*r�hsr�s_destupdatecCs2t|dd�}|ttj|fit�|���dg�@S)N�limitscleanr)�getargsdictr;rZ
destupdaterZ	strkwargs)r&r'r(�argsr)r)r*�_destupdate�s�r�s
_destmergecCs4d}|durt|t|�|�}|ttj||d�g�@S)N)�	sourceset)r+r:r;rZ	destmerge)r&r'r(r�r)r)r*�
_destmerge�sr�s
adds(pattern)T�)�safe�weightcCst|td��}t|||d�S)z�Changesets that add a file matching pattern.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file or a
    directory.
    sadds requires a pattern�added��	getstringr�checkstatus�r&r'r(�patr)r)r*�adds�s	r�sancestor(*changeset)g�?cCs|tt|t|�|td��}z|t|�}Wnty@t�YS0|D]}|�||�}qFt�	|�}||vrvt|g�St�S)z�A greatest common ancestor of the changesets.

    Accepts 0 or more changesets.
    Will return empty list when passed no args.
    Greatest common ancestor of a single changeset is that changeset.
    �r")
�iterr_r:rR�next�
StopIterationr;�ancestorrr7)r&r'r(ZreviterZancr0r)r)r*r��s

r�FcCs4t|t|�|�}|st�St�|||||�}||@Sr3)r+r:r;r
rw)r&r'r(�followfirst�
startdepth�	stopdepth�headsrzr)r)r*�
_ancestors�s
r�sancestors(set[, depth]))r�cCs�t|dd�}d|vr"t�td���d}}d|vrVt|dd�}|dkrRt�d	��|}d
|vr�t|d
td��}|dkr�t�td���|d
}t|||d||d�S)z�Changesets that are ancestors of changesets in set, including the
    given changesets themselves.

    If depth is specified, the result only includes changesets up to
    the specified generation.
    s	ancestors�set depth startdepth�sets#ancestors takes at least 1 argumentN�
startdepths'ancestors expects an integer startdepthr�negative startdepth�depths"ancestors expects an integer depth�negative depthr�r�r�)r�rr#r�
getintegerr��r&r'r(r�r�r�rDr)r)r*�	ancestors�s&	�
�r�s_firstancestorscCst|||dd�S�NT�r�)r��r&r'r(r)r)r*�_firstancestors�sr�c	Cs~t�}t|t|�|�D]^}t|�D]F}||��}t|�dkrBqt|�dkr\t�td���|d�	�}q"|�
|�q||@S)zAChangesets that are the Nth child of a changeset
    in set.
    rrs'revision in set has more than one child)�setr+r:�range�childrenrNrr/rr.�add)	r&r'r(rDr"�csr0�i�cr)r)r*�
_childrenspec�s�r�c	
Cs�t|td��}|dkr(t|||||�St�}|j}t|t|�|�D]T}t|�D]<}z|�|�d}WqPt	j
y�||����}YqP0qP|�
|�qD||@S)zg``set~n``
    Changesets that are the Nth ancestor (first parents only) of a changeset
    in set.
    s~ expects a numberr)r�rr�r�rGr+r:r��
parentrevsr�WdirUnsupported�p1r.r�)	r&r'r(rDr"�ps�clr0r�r)r)r*�ancestorspecsr�sauthor(string)�
cs<t|td��}t|dd�\}}�|j��fdd�d|fd�S)zAlias for ``user(string)``.sauthor requires a stringF��
casesensitivecs��|���Sr3��user�r(��matcherr&r)r*r�rfzauthor.<locals>.<lambda>s	<user %r>�Zcondrepr�r�r�_substringmatcher�filter)r&r'r(rD�kind�patternr)r�r*�authors
�r�sbisect(string)cCs*t|td����}tt�||��}||@S)a	Changesets marked in the specified bisect status:

    - ``good``, ``bad``, ``skip``: csets explicitly marked as good/bad/skip
    - ``goods``, ``bads``      : csets topologically good/bad
    - ``range``              : csets taking part in the bisection
    - ``pruned``             : csets that are goods, bads or skipped
    - ``untested``           : csets whose fate is yet unknown
    - ``ignored``            : csets ignored due to DAG topology
    - ``current``            : the cset currently being bisected
    sbisect requires a string)r�r�lowerr�r�get)r&r'r(�status�stater)r)r*�bisect"s
r�sbisectedcCst|||�Sr3)r�r�r)r)r*�bisected6sr�sbookmark([name])cst|ddtd��}|r�t|dtd��}t�|�\}}}t�}|dkr�||krZ�j�|�}�j�|d�}	|	s~t	�
td�|��|��|	���q�t�}
t
��j�D]\}}	||�r�|
�|	�q�|
D]}	|��|	���q�n�fdd	��j��D�}|th8}||@S)
z{The named bookmark or all bookmarks.

    Pattern matching is supported for `name`. See :hg:`help revisions.patterns`.
    rrs"bookmark takes one or no argumentss)the argument to bookmark must be a string�literalNsbookmark '%s' does not existcsh|]}�|���qSr)�r.rc�r&r)r*�	<setcomp>\rfzbookmark.<locals>.<setcomp>)�getargsrr�r�
stringmatcherr�Z
_bookmarksZ
expandnamer�rr/r�r.r�	iteritems�valuesr)r&r'r(r�Zbmr�r�r�ZbmsZbmrevZ	matchrevs�namer)r�r*�bookmark;s4�
�
r�sbranch(string or set)cs���j���fdd��zt|d��Wntjy:Yn~0t���\}}�|dkr�����|�r~|j	��fdd�d�fd�S��
d	�r�t�td
�|��n|j	��fdd�d�fd�St
�t��|�}t��|D]}���|��q�|j�|j	���fdd��fd
d�d�S)z�
    All changesets belonging to the given branch or the branches of the given
    changesets.

    Pattern matching is supported for `string`. See
    :hg:`help revisions.patterns`.
    cs4z�|�dWStjy.�|��YS0dSrF)rr��branch�r0)�getbir&r)r*�	getbranchlszbranch.<locals>.getbranchrfr�cs��|��Sr3r)r��r�r�r)r*r�~rfzbranch.<locals>.<lambda>�<branch %r>r�sliteral:sbranch '%s' does not existcs��|��Sr3r)r�r�r)r*r��rfcs�|�p�|��vSr3r)r�)r]r�r�r)r*r��rfcsdt��S)Nr��r6r))r]r)r*r��rf)ZrevbranchcacheZ
branchinfor�rr#rr��	branchmapZ	hasbranchr��
startswithr/rr+r:r�r��__contains__)r&r'r(r�r�rzr0r))r]r�r�r�r�r&r*r�as:	
�

��
�r�sphasedivergent()cCs&t|ddtd��t�|d�}||@S)z�Mutable changesets marked as successors of public changesets.

    Only non-public and non-obsolete changesets can be `phasedivergent`.
    (EXPERIMENTAL)
    rs!phasedivergent takes no arguments�phasedivergent�r�r�obsmod�getrevs)r&r'r(�phasedivergentr)r)r*r��sr�sbundle()cCs6z|jj}Wn ty,t�td���Yn0||@S)zIChangesets in the bundle.

    Bundle must be specified by the -R option.s$no bundle provided - specify with -R)rG�
bundlerevs�AttributeErrorr�Abortr)r&r'r(r�r)r)r*�bundle�s
r�csBt���dk�dg������fdd�}|j|dt����fd�S)zuHelper for status-related revsets (adds, removes, modifies).
    The field parameter says which kind is desired.
    r�Ncs��|}�dr�r2tj�j����g|d��d<�d�d}���sbt����dkrb���d}|dur|||��vr�dSnt�fdd�|��D��s�dSt��	|�
���|�����}|dur�||vr�dSnt�fdd�|D��r�dSdS)	Nr��ctxrFc3s|]}�|�VqdSr3r)�rdr��rCr)r*�	<genexpr>�rfz/checkstatus.<locals>.matches.<locals>.<genexpr>Tc3s|]}�|�VqdSr3r)r�r�r)r*r��rf)�matchmodr�root�getcwdZanypatsrN�files�anyrr�r��node)r(r��fnamer���field�hasset�mcacher�r&r�r*�matches�s$zcheckstatus.<locals>.matchess<status.%s %r>r�)r��patkindr�rZsysbytes)r&r'r�rrr)rr*r��s�r�c	Cst|s
t�St�}|jj}|��}|D]F}||kr2q$||�\}}||vrP|�|�|tkr$||vr$|�|�q$t|�Sr3)r;r�rGr�ror�r)	r&r'Z	parentsetr�Zpr�minrevr0r��p2r)r)r*�	_children�s
r	s
children(set)cCs$t|t|�|�}t|||�}||@S)z&Child changesets of changesets in set.)r+r:r	)r&r'r(rzr�r)r)r*r��sr�sclosed()cs(t|ddtd��|j�fdd�dd�S)zChangeset is closed.rsclosed takes no argumentscs�|��Sr3)Zclosesbranchr�r�r)r*r��rfzclosed.<locals>.<lambda>s<branch closed>r�)r�rr�r�r)r�r*�closed�s�r
s_commonancestorheads(set)cCs0t|t|�|td�}|jjt|��}|t|�@S)Nr�)r+r:rRrGZ_commonancestorsheads�listr;)r&r'r(�	startrevsZancsr)r)r*�_commonancestorheads�sr
scommonancestors(set)cCsBt|t|�|td�}|st�S|D]}|t�|t|g��M}q"|S)z8Changesets that are ancestors of every changeset in set.r�)r+r:rRr;r
rw)r&r'r(rr0r)r)r*�commonancestorssrsconflictlocal()cCsZt|ddtd��ddlm}|j�|�}|��rT|j�|j�rT||j�	|j�h@St
�S)z�The local side of the merge, if currently in an unresolved merge.

    "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.
    rs conflictlocal takes no argumentsr��
mergestate)r�r�r�read�activerG�hasnode�localr.r;�r&r'r(Z
mergestatemodrr)r)r*�
conflictlocalsrsconflictother()cCsZt|ddtd��ddlm}|j�|�}|��rT|j�|j�rT||j�	|j�h@St
�S)z�The other side of the merge, if currently in an unresolved merge.

    "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.
    rs conflictother takes no argumentsrr)r�rrrrrrGr�otherr.r;rr)r)r*�
conflictother srscontains(pattern)�d)r�cs.t|td�����fdd�}|j|d�fd�S)a<The revision's manifest contains a file matching pattern (but might not
    modify it). See :hg:`help patterns` for information about file patterns.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file exactly
    for efficiency.
    scontains requires a patterncsrt���s0t��j�����}|�|vrndSn>�|}tj�j����g|d�}|��D]}||�rZdSqZdS)NTr�F)r�rr�	canonpathr�r�r�manifest)r(�patsr�rCr��r�r&r)r*r<s
zcontains.<locals>.matchess
<contains %r>r�)r�rr��r&r'r(rr)rr*�contains0s

r sconverted([id])csTd�t|ddtd��}|r,t|dtd�����fdd��|j�fdd	�d
�fd�S)z�Changesets converted from the given identifier in the old repository if
    present, or all converted changesets if no identifier is specified.
    Nrrs#converted takes one or no argumentssconverted requires a revisioncs.�|���dd�}|duo,�dup,|���S)Nsconvert_revision)r-r�r�)r0�source)r&r.r)r*�_matchvalue\szconverted.<locals>._matchvaluecs�|�Sr3r)r��r"r)r*r�arfzconverted.<locals>.<lambda>s<converted %r>r�)r�rr�r��r&r'r(�lr))r"r&r.r*�	convertedLs	�r&sdate(interval)cs4t|td��}t�|��|j��fdd�d|fd�S)z5Changesets within the interval, see :hg:`help dates`.sdate requires a stringcs��|��d�SrF��dater��Zdmr&r)r*r�lrfzdate.<locals>.<lambda>s	<date %r>r�)r�rrZ	matchdater�)r&r'r(�dsr)r)r*r(es

�r(sdesc(string)cs<t|td��}t|dd�\}}�|j��fdd�d|fd�S)z�Search commit message for string. The match is case-insensitive.

    Pattern matching is supported for `string`. See
    :hg:`help revisions.patterns`.
    sdesc requires a stringFr�cs��|���Sr3��descriptionr�r�r)r*r�}rfzdesc.<locals>.<lambda>s	<desc %r>r�r�)r&r'r(r*r�r�r)r�r*�descps
�r-cCs4t|t|�|�}|st�St�|||||�}||@Sr3)r+r:r;r
rx)r&r'r(r�r�r��rootsrzr)r)r*�_descendants�s
r/sdescendants(set[, depth])cCs�t|dd�}d|vr"t�td���d}}d|vrVt|dd�}|dkrRt�d	��|}d
|vr�t|d
td��}|dkr�t�td���|d
}t|||d||d�S)z�Changesets which are descendants of changesets in set, including the
    given changesets themselves.

    If depth is specified, the result only includes changesets up to
    the specified generation.
    sdescendantsr�r�s%descendants takes at least 1 argumentNr�s)descendants expects an integer startdepthrr�r�s$descendants expects an integer depthr�rr�)r�rr#rr�r/r�r)r)r*�descendants�s*	�
��r0s_firstdescendantscCst|||dd�Sr�)r/r�r)r)r*�_firstdescendants�sr1sdestination([set])cs�|durt|t|�|�}nt|�}t��|D]^}t||�}d}|dur,|durTt�}|�|�||vsn|�vrz��|�q,|}t||�}q>q,|j�j�fdd�d�S)z�Changesets that were created by a graft, transplant or rebase operation,
    with the given revisions specified as the source.  Omitting the optional set
    is the same as passing all().
    Ncsdt��S)Ns<destination %r>r�r)��destsr)r*r��rfzdestination.<locals>.<lambda>r�)	r+r:r�r2r�append�updater�r�)r&r'r(Zsourcesr0�srcZlineager)r2r*�destination�s(



�r7sdiffcontains(pattern)�ncs�t|dd�}d|vr"t�td���t|dtd��}t�|tj�}t	�
���fdd��tj|j
||dd����fd	d
�}|j|d|fd�S)
z�Search revision differences for when the pattern was added or removed.

    The pattern may be a substring literal or a regular expression. See
    :hg:`help revisions.patterns`.
    sdiffcontainsspatterns&diffcontains takes at least 1 arguments&diffcontains requires a string patterncs�Sr3r)r�)�fmatchr)r*�makefilematcher�sz%diffcontains.<locals>.makefilematcherT)�diffcs>d}��t|g���D]"\}}}}tt�||�d�rd}q|S)NFT)Zsearchfilesr;r��grepmodZdifflinestates)r.�foundr�r�ZpstatesZstates)r:�searcherr)r*�testdiffs
�zdiffcontains.<locals>.testdiffs<diffcontains %r>r�)r�rr#rr�rZsubstringregexp�re�Mr��alwaysr<Zgrepsearcher�uir�)r&r'r(r�r�Zregexpr?r))r9r:r>r*�diffcontains�s�
rDscontentdivergent()cCs&t|ddtd��t�|d�}||@S)zh
    Final successors of changesets with an alternative set of final
    successors. (EXPERIMENTAL)
    rs#contentdivergent takes no arguments�contentdivergentr�)r&r'r(�contentdivergentr)r)r*rFsrFsexpectsize(set[, size]))r��	takeorderc	Cs"t|dd�}d}t|�d}d}d|vs0d|vr>t�td���t|dtd	�td
�||�\}}|dksn|dkr|t�td���t|t|�|d|d�}||kr�t|�|ks�t|�|kr�td
�||t|�f}n(||kr�t|�|kr�td�|t|�f}|�rt�|��|t	k�r||@S||@SdS)aReturn the given revset if size matches the revset size.
    Abort if the revset doesn't expect given size.
    size can either be an integer range or an integer.

    For example, ``expectsize(0:1, 3:5)`` will abort as revset size is 2 and
    2 is not between 3 and 5 inclusive.s
expectsizesset sizerrrfssizer�sinvalid set of argumentss6expectsize requires a size range or a positive integers"size range bounds must be integerss
negative sizer�s8revset size mismatch. expected between %d and %d, got %ds)revset size mismatch. expected %d, got %dN)
r�rNrr#rrvr+r:r/r=)	r&r'r(r"r�Zminsize�maxsize�errr.r)r)r*�
expectsizes@	� ��

rJsextdata(source)cCs8t|dd�}t|�d�td��}t�||�}|t|�@S)z:Changesets in the specified extdata source. (EXPERIMENTAL)sextdatar,s(extdata takes at least 1 string argument)r�r�r�rrZ
extdatasourcer;)r&r'r(r�r!�datar)r)r*�extdataFs�rLs	extinct()cCs&t|ddtd��t�|d�}||@S)zBObsolete changesets with obsolete descendants only. (EXPERIMENTAL)rsextinct takes no argumentssextinctr�)r&r'r(Zextinctsr)r)r*�extinctTsrMsextra(label, [value])cs�t|dd�}d|vr"t�td���t|dtd���d�d|vrbt|dtd���t���\}������fd	d
��|j�fdd�d
��fd�S)z�Changesets with the given label in the extra metadata, with the given
    optional value.

    Pattern matching is supported for `value`. See
    :hg:`help revisions.patterns`.
    sextraslabel valueslabelsextra takes at least 1 arguments(first argument to extra must be a stringNsvalues)second argument to extra must be a stringcs(�|��}�|vo&�dup&�|��Sr3)r-)r0r-)r1r�r&�valuer)r*r"vszextra.<locals>._matchvaluecs�|�Sr3r)r�r#r)r*r�{rfzextra.<locals>.<lambda>s<extra[%r] %r>r�)r�rr#rr�rr�r�)r&r'r(r�r�r))r"r1r�r&rNr*r-]s ���r-sfilelog(pattern)cs�t|td��}t�}|j}t�|�s@t�|j|�	�|�}|g}n4tj
|j|�	�|g|dd���fdd�|dD�}|D�]}|�|�}i}	d}
t|�D]�}|�
|�}||	vr�|�|	|�q�|�|�}
|
|vr�|�|
�q�|
dur�t|
|
�d}d}
|�|�D]�}||�|�v�r||�|�v�rzD||�|�}||	v�rf||k�r^|�|�|}
Wq�n||	|<Wntj�y�Y�qYn0�qq�qx||@S)a�Changesets connected to the specified filelog.

    For performance reasons, visits only revisions mentioned in the file-level
    filelog, rather than filtering through all changesets (much faster, but
    doesn't include deletes or duplicate changes). For a slower, more accurate
    result, use ``file()``.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file exactly
    for efficiency.
    sfilelog requires a patternNr�c3s|]}�|�r|VqdSr3r)r�r�r)r*r��rfzfilelog.<locals>.<genexpr>rr)r�rr�rGr�rrrr�r�r�filerr�r�Zlinkrevrpry�revision�	readfilesZfilenoderZManifestLookupError)r&r'r(r�rzr�r�r�ZflZknownZscanpos�frr�Zlr�startr0rDr)r�r*�filelogsH




 


rTsfirst(set, [n]))r�rGr�cCst||||�S)zAn alias for limit().)�limitr%r)r)r*r@�sr@cs�t||d�}d}d|vr,t|t|�|d�}d|vr�t|dtd�|�}|durXdg}g}|D]^}||�}	|dur�|d�tj|j|��|g|	dd�}
|�	�fdd	���
��|
�D��q`t�
||�}n(|dur�t|d��g�}t�|||�}||@S)
Ns
file startrev�startrev�files%s expected a pattern�.spath)r��defaultc3s|]}�|��VqdSr3)Zintrofilectxr�r�r)r*r��rfz_follow.<locals>.<genexpr>)r�r+r:r�rr�rr�r��extendr�walkr
Zfilerevancestorsr;r.rw)r&r'r(r�r�r�ryZfctxsr0ZmctxrCrzr)r�r*�_follow�s,�$r\sfollow([file[, startrev]])cCst|||d�S)z�
    An alias for ``::.`` (ancestors of the working directory's first parent).
    If file pattern is specified, the histories of files matching given
    pattern in the revision given by startrev are followed, including copies.
    r!�r\r�r)r)r*�follow�sr^�_followfirstcCst|||ddd�S)Nr_Tr�r]r�r)r)r*�_followfirst�sr`s?followlines(file, fromline:toline[, startrev=., descend=False])cCs8t|dd�}t|d�dkr*t�td���d}d|vrlt|t|�|d�}t|�dkrdt�td���|��}t|d	td
��}td�}t	�
||||�}tjt
|ddtd
�td���\}	}
||�|�}d}d|vr�t|dtd��}|�rtdd�t�||	|
�D�dd�}
n tdd�t�||	|
�D�dd�}
||
@S)a�Changesets modifying `file` in line range ('fromline', 'toline').

    Line range corresponds to 'file' content at 'startrev' and should hence be
    consistent with file size. If startrev is not specified, working directory's
    parent is used.

    By default, ancestors of 'startrev' are returned. If 'descend' is True,
    descendants of 'startrev' are returned though renames are (currently) not
    followed in this direction.
    sfollowlinessfile *lines startrev descendslinesrs!followlines requires a line rangerXrVs(followlines expects exactly one revisionrWsfollowlines requires a patterns$followlines expects exactly one filers,followlines expects a line number or a ranges"line range bounds must be integersFsdescends"descend argument must be a booleancss|]\}}|��VqdSr3r��rdr�Z
_lineranger)r)r*r�&s�zfollowlines.<locals>.<genexpr>T)Ziterasccss|]\}}|��VqdSr3r�rar)r)r*r�0s�)r�rNrr#rr+r:rAr�rZparsefollowlinespatternrZprocesslinerangervZfilectx�
getboolean�generatorsetr
ZblockdescendantsZblockancestors)r&r'r(r�r.ryr��msgrZfromlineZtolineZfctxZdescendZrsr)r)r*�followlines�s\�
��	����
���	resnodefromfile(path)c
Cs�t|td��}t�}z^t�|d��>}|D](}|��}t||�}|dur(|�|�q(Wd�n1sf0YWnJty�}	z2td�}
|
|t	�
|	j�f;}
t�
|
��WYd}	~	n
d}	~	00|t|�@S)z�Read a list of nodes from the file at `path`.

    This applies `id(LINE)` to each line of the file.

    This is useful when the amount of nodes you need to specify gets too large
    for the command line.
    s nodefromfile require a file path�rbNscannot open nodes file "%s": %s)r�rr�r�open�strip�_noder��IOErrorr
Z
strtolocal�strerrorrr�r;)r&r'r(�pathZ
listed_revr��linerD�rn�excrCr)r)r*�nodefromfile;s	
. rpsall()cCst|ddtd��|t|�@S)z&All changesets, the same as ``0:tip``.rsall takes no arguments)r�rrMr�r)r)r*�getallTsrqsgrep(regex)c
szzt�t|td����Wn>tjyV}z$t�td�t�|���WYd}~n
d}~00��fdd�}|j|d�j	fd�S)z�Like ``keyword(string)`` but accepts a regex. Use ``grep(r'...')``
    to ensure special escape characters are handled correctly. Unlike
    ``keyword(string)``, the match is case-sensitive.
    sgrep requires a stringsinvalid match pattern: %sNcs:�|}|��|��|��gD]}��|�r dSq dS�NTF)r�r�r,�search)r(r��e�Zgrr&r)r*rjs

zgrep.<locals>.matchess	<grep %r>r�)
r@�compiler�rrr#rZforcebytestrr�r�)r&r'r(rtrr)rur*r\s�rs_matchfilesc		sRt|ddd�}ggg���d\��|D]�}t|d�}|dd�|dd�}}|dkrf��|�q*|dkrz��|�q*|d	kr���|�q*|d
kr��dur�t�d��|dkr�t�q�|�q*|d
kr܈dur�t�d��|�q*t�d|��q*�s�d�tdd����D���dg��jj����������f	dd�}|j	|d�����fd�S)Nr���s*_matchfiles requires at least one argumentrns%_matchfiles requires string argumentsrY�p:si:sx:sr:s)_matchfiles expected at most one revisionrfsd:s-_matchfiles expected at most one default modesinvalid _matchfiles prefix: %ssglobcss|]}t�|�dkVqdS)r�N)r�r�rdr[r)r)r*r��rfz_matchfiles.<locals>.<genexpr>c	s�|tkr�|��}n�|�}�dr2�rh�durh�dur>|n�}tj�j�������|�d��d<�d}|D]}||�rtdSqtdS)Nr)�include�excluder�rYTF)r	r�r�rr�r�)r(r�r0rCr��	rYroZgetfilesrZincrrr&r.r)r*r�s&�
	z_matchfiles.<locals>.matchessC<matchfiles patterns=%r, include=%r exclude=%r, default=%r, rev=%r>r�)
r�r�r4rr#r	r�rGrQr�)	r&r'r(r%�argrz�prefixrNrr)r|r*�_matchfilestsV
����rs
file(pattern)cCs"t|td��}t||dd|f�S)z�Changesets affecting files matched by pattern.

    For a faster but less accurate result, consider using ``filelog()``
    instead.

    This predicate uses ``glob:`` as the default kind of pattern.
    sfile requires a pattern�stringrx)r�rrr�r)r)r*�hasfile�s
r�shead()csTt|ddtd��t�}|j�|����D]}|��fdd�|D��q*|t|�@S)z!Changeset is a named branch head.rshead takes no argumentsc3s|]}��|�VqdSr3r�)rd�h�r�r)r*r��rfzhead.<locals>.<genexpr>)r�rr�rGr�Z	iterheadsr5r;)r&r'r(Zhs�lsr)r�r*�head�sr�s
heads(set)cCs�|tkrt}t|t|�||d�}d}t|vrTdd�|d��D�}t|�}|�t�|j�	|�}|dur||�
|�|�t�t|�}||@S)z'Members of set with no children in set.r�NcSsg|]}|���qSr)r�ryr)r)r*re�rfzheads.<locals>.<listcomp>)
rOr=r+r:r	�parentsr��discardrG�headrevs�difference_updater�r;)r&r'r(r"ZinputsetZwdirparentsr�r)r)r*r��s


r�shidden()cCs&t|ddtd��t�|d�}||@S)zHidden changesets.rshidden takes no argumentssvisible)r�rrZ
filterrevs)r&r'r(Z
hiddenrevsr)r)r*�hidden�sr�skeyword(string)cs4t�t|td������fdd�}|j|d�fd�S)z�Search commit message, user name, and names of changed files for
    string. The match is case-insensitive.

    For a regular expression or case sensitive search of these fields, use
    ``grep(regex)``.
    skeyword requires a stringcs2�|}t�fdd�|��|��|��gD��S)Nc3s|]}�t�|�vVqdSr3�r
r�)rd�t)�kwr)r*r�s�z+keyword.<locals>.matches.<locals>.<genexpr>)r�r�r�r,)r0r��r�r&r)r*rs�zkeyword.<locals>.matchess<keyword %r>r�)r
r�r�rr�rr)r�r*�keywords	r�slimit(set[, n[, offset]])c	Cs�t|dd�}d|vr"t�td���t|�d�td�dd�}|d	krPt�td
���t|�d�td�d	d�}|d	kr~t�td���t|t|�|d�}|�|||�}|t	kr�|dkr�||@S||@S)
z>First n members of set, defaulting to 1, starting from offset.r�sset n offsetr�s%limit requires one to three arguments�nslimit expects a numberr)rYr�negative number to selectsoffsetsnegative offset)
r�rr#rr�r�r+r:�slicer=)	r&r'r(r"r��limZofs�osr�r)r)r*rUs �rUslast(set, [n])cCs�t|ddtd��}d}t|�dkr4t|dtd��}|dkrJt�td���t|t|�|d�}|��|�	d|�}|t
kr�|dkr�||@S|��||@S)z'Last n members of set, defaulting to 1.rrYs"last requires one or two argumentsslast expects a numberrr�)r�rrNr�rr#r+r:�reverser�r=)r&r'r(r"r%r�r�r�r)r)r*rA4srAsmax(set)cCs^t|t|�|�}z*|��}||vr8t|gd||fd�WSWntyLYn0td||fd�S)z.Changeset with highest revision number in set.s<max %r, %r>�Zdatarepr)r+r:rpr;�
ValueError�r&r'r(r�rCr)r)r*�maxrevHsr�smerge()cs4t|ddtd���j���fdd�}|j|dd�S)zChangeset is a merge changeset.rsmerge takes no argumentscs>z��|�dtkWStjy8t�|���YS0dSrL)r�rrr��boolrr��r�r&r)r*�ismerge^szmerge.<locals>.ismerges<merge>r�)r�rrGr�)r&r'r(r�r)r�r*�mergeWsr�s
branchpoint()cs�t|ddtd��|j}|s"t�St|��dgt|���|j�dd�D]0}|�|�D] }|�krZ�|�d7<qZqL|j��fdd�dd�S)	z$Changesets with more than one child.rsbranchpoint takes no argumentsr)rScs�|�dkSrLr)r��ZbaserevZparentscountr)r*r�xrfzbranchpoint.<locals>.<lambda>s
<branchpoint>r�)	r�rrGr;rorNryr�r�)r&r'r(r�r0r[r)r�r*�branchpointgs�r�smin(set)cCs^t|t|�|�}z*|��}||vr8t|gd||fd�WSWntyLYn0td||fd�S)z-Changeset with lowest revision number in set.s<min %r, %r>r�)r+r:ror;r�r�r)r)r*r|srsmodifies(pattern)cCst|td��}t|||d�S)z�Changesets modifying files matched by pattern.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file or a
    directory.
    smodifies requires a pattern�modifiedr�r�r)r)r*�modifies�s	r�snamed(namespace)c	s�t|ddtd��}t|dtd��}t�|�\}}}t�}|dkrp|�jvr^t�td�|��|�	�j|�n(t
��j�D]\}	}||	�r||�	|�q|t�}
|D]>}|���D].}	|	|j
vr�|
��fdd�|��|	�D��q�q�|
th8}
||
@S)	z�The changesets in a given namespace.

    Pattern matching is supported for `namespace`. See
    :hg:`help revisions.patterns`.
    rs#named requires a namespace argumentrs&the argument to named must be a stringr�snamespace '%s' does not existc3s|]}�|��VqdSr3r��rdrDr�r)r*r��rfznamed.<locals>.<genexpr>)r�rr�rr�r��namesrr/r�rr�Z	listnamesZ
deprecatedr5�nodesr)r&r'r(r��nsr�r�r�Z
namespacesr�r�r)r�r*�named�s.�

�
$
r�c	Cs�d}t|�d|jjkr`z|j�t|��}Wq�tjyDt}Yq�t	t
fy\d}Yq�0nNz$t�||�}|dur�|j�|�}Wn(t	y�Yntjy�t}Yn0|S)zprocess a node inputNrY)
rNZ
nodeconstantsZnodelenrGr.rrr�r	�LookupError�	TypeErrorrZresolvehexnodeidprefix)r&rDrnZpmr)r)r*ri�s"
ris
id(string)cCsNt|ddtd��}t|dtd��}t||�}|dur<t�St|g�}||@S)zBRevision non-ambiguously specified by the given hex string prefix.rsid requires one argumentrsid requires a stringN)r�rr�rir;)r&r'r(r%rDrn�resultr)r)r*�node_�s

r�snone()cCst|ddtd��t�S)zNo changesets.rsnone takes no arguments)r�rr;r�r)r)r*�none�sr�s
obsolete()cCs&t|ddtd��t�|d�}||@S)z6Mutable changeset with a newer version. (EXPERIMENTAL)rsobsolete takes no argumentssobsoleter�)r&r'r(Z	obsoletesr)r)r*r�srsonly(set, [set])cs�|j}t|ddtd��}t|t|�|d��t|�dkrn�sBt�Stt�	|�d�����fdd�|�
�D�}nt|t|�|d�}t|j|�d��}||@S)	aChangesets that are ancestors of the first set that are not ancestors
    of any other head in the repo. If a second set is specified, the result
    is ancestors of the first set that are not ancestors of the second set
    (i.e. ::<set1> - ::<set2>).
    rrYsonly takes one or two argumentsrFcs g|]}|�vr|�vr|�qSr)r)�rdr.�r0rzr)r*res�zonly.<locals>.<listcomp>)�commonr�)rGr�rr+r:rNr;r�r
rxr�Zfindmissingrevs)r&r'r(r�r�r{�resultsr)r�r*�only�s�r�s
origin([set])csR|durt�t��|�}nt��}�fdd���fdd�|D�}|dh8}||@S)an
    Changesets that were specified as a source for the grafts, transplants or
    rebases that created the given revisions.  Omitting the optional set is the
    same as passing all().  If a changeset created by these operations is itself
    specified as a source for one of these operations, only the source changeset
    for the first operation is selected.
    Ncs6t�|�}|durdSt�|�}|dur,|S|}qdSr3)r2)r.r6�prevr�r)r*�	_firstsrc s

zorigin.<locals>._firstsrccsh|]}�|��qSr)r)rc)r�r)r*r�,rfzorigin.<locals>.<setcomp>)r+r:)r&r'r(r3�or))r�r&r*�origins	
r�soutgoing([path])c	s4ddlm}m}t|ddtd��}|r8t|dtd��p:d}|rH|g}ng}t�}t���j	|�D]�}	|	j
pp|	j}|	jgf}
|�
��|
g�\}}|r��fdd�|D�}|��i|�}
zF�j	��� |j�|
|d	�}Wd
�n1s�0YW|
��n
|
��0|�|j�qb�j��fdd�|D�}||@S)
z�Changesets not found in the specified destination repository, or the
    default push location.

    If the location resolve to multiple repositories, the union of all
    outgoing changeset will be used.
    r)�	discovery�hgrs"outgoing takes one or no argumentss#outgoing requires a repository pathrfcsg|]}��|��qSr)��lookupr�r�r)r*reRrfzoutgoing.<locals>.<listcomp>)Z	onlyheadsNcsh|]}��|��qSr)r�rcr�r)r*r�]rfzoutgoing.<locals>.<setcomp>)rr�r�r�rr�r�r Zget_push_pathsrCZpushloc�locr�Z
addbranchrevs�peerZsilentZfindcommonoutgoing�closer5�missingrG)r&r'r(r�r�r%�destr3r�rl�branchesryZcheckoutr�outgoingr�r)r�r*r�3s2	�
�&r�s	p1([set])c	Cs�|dur4||����}|dkr.|t|g�@St�St�}|j}t|t|�|�D]H}z|�|�|�d�WqPt	j
y�|�||�����YqP0qP|th8}||@S)z<First parent of changesets in set, or the working directory.Nr)r�r.r;r�rGr+r:r�r�rr�r)r&r'r(r[r�r�r0r)r)r*r�as
r�s	p2([set])c	Cs�|durZ||��}z,|d��}|dkr:|t|g�@WSt�WStyXt�YS0t�}|j}t|t|�|�D]X}z|�|�	|�d�Wqvt
jy�||��}t|�dkr�|�|d�Yqv0qv|t
h8}||@S)z=Second parent of changesets in set, or the working directory.NrrrY)r�r.r;�
IndexErrorr�rGr+r:r�r�rr�rNr)r&r'r(r�r[r�r0r�r)r)r*rws(
rcCst|||�Sr3)r�r%r)r)r*�
parentpost�sr�sparents([set])c	Cs�|dur dd�||��D�}nnt�}|j}|j}|j}t|t|�|�D]D}z|||��WqHtjy�|dd�||��D��YqH0qH|t	h8}||@S)zU
    The set of all parents for all changesets in set, or the working directory.
    NcSsh|]}|���qSr)r�ryr)r)r*r��rfzparents.<locals>.<setcomp>css|]}|��VqdSr3r�ryr)r)r*r��rfzparents.<locals>.<genexpr>)
r�r�rGr5r�r+r:rr�r)r&r'r(r�r�Zupr�r0r)r)r*r��s"
r�cGs|j�|||�S)z,helper to select all rev in <targets> phases)�_phasecacheZ	getrevset)r&r'�targetsr)r)r*�_phase�sr�s_phase(idx)cCs(t|ddd�}t|dd�}t|||�S)Nrs_phase requires one argumentrs_phase expects a number)r�r�r�)r&r'r(r%�targetr)r)r*�phase�sr�sdraft()cCs$t|ddtd��tj}t|||�S)zChangeset in draft phase.rsdraft takes no arguments)r�rr�draftr��r&r'r(r�r)r)r*r��sr�ssecret()cCs$t|ddtd��tj}t|||�S)zChangeset in secret phase.rssecret takes no arguments)r�rr�secretr�r�r)r)r*r��sr�s
stack([revs])cCsP|durt�|�}n4t�g�}t|t|�|�D]}t�||�}||}q.||@S)zdExperimental revset for the stack of changesets or working directory
    parent. (EXPERIMENTAL)
    N)�stackmodZgetstackrr;r+r:)r&r'r(ZstacksrPZcurrentstackr)r)r*r�s

rc		Cs:zt|d�}|dvrt�Wn$ttfy@t�td���Yn0t�}|j}t|t	|�|�D]�}|dkrv|�
|�q^|dkr�z|�
|�|�d�Wn*tjy�|�
||�
����Yn0q^z(|�|�}|dtkr�|�
|d�Wq^tj�y.||��}t|�dk�r*|�
|d���Yq^0q^||@S)z�``set^0``
    The set.
    ``set^1`` (or ``set^``), ``set^2``
    First or second parent, respectively, of all changesets in set.
    r)rrrYs^ expects a number 0, 1, or 2rrY)�intr�r�rr#rr�rGr+r:r�r�r�r�r.rr�rN)	r&r'r(rDr"r�r�r0r�r)r)r*�
parentspec�s2
r�spresent(set)cCs0zt||||�WStjy*t�YS0dS)aAn empty set, if any revision in set isn't found; otherwise,
    all revisions in set.

    If any of specified revisions is not present in the local repository,
    the query is normally aborted. But this predicate allows the query
    to continue even in such cases.
    N)r+rr/r;r%r)r)r*�present�s	r��
_notpubliccCs t|ddd�t||tjtj�S)Nrs_notpublic takes no arguments)r�r�rr�r�r�r)r)r*�
_notpublicsr�s"_phaseandancestors(phasename, set)c
s�t|ddd�}t|d�}t�t��|d�}tj�tj}��|d�}||vr\t�d|��||��j	j
����fdd�}tj�||d	�}	|d
kr�|	�
���fdd��}	||	@S)
NrYs)_phaseandancestors requires two argumentsrr)r��draftssecrets%r is not a valid phasenamecs��|��kSr3r)r�)�getphase�minimalphaser&r)r*�cutfunc(sz#_phaseandancestors.<locals>.cutfunc)r�r�cs��|��kSr3r)r�)r�r�r&r)r*r�.rfz$_phaseandancestors.<locals>.<lambda>)r�rgr+r:rr�r�rr#r�r�r
rwr�)
r&r'r(r�Z	phasenamerzr�Zphasenamemapr�ryr))r�r�r�r&r*�_phaseandancestorss$�r�spublic()cCs t|ddtd��t||tj�S)zChangeset in public phase.rspublic takes no arguments)r�rr�r�publicr�r)r)r*r�2sr�sremote([id [,path]])cCs�ddlm}t|ddtd��}d}t|�dkr@t|dtd��}|dkrT|d��}d}t|�dkrvt|dtd	��}|s~d
}t�d||j	|�\}}|�
|i|�}|�|�}	|	|vr�||	��}
|
|vr�t
|
g�St
�S)z�Local revision that corresponds to the given identifier in a
    remote repository, if present. Here, the '.' identifier is a
    synonym for the current local branch.
    r)r�rrYs(remote takes zero, one, or two argumentsrXsremote requires a string idrfs!remote requires a repository pathsdefaultsremote)rr�r�rrNr�r�r Zget_unique_pull_pathrCr�r�r.r;)r&r'r(r�r%�qr�r�rrDr0r)r)r*�remote:s,
�

r�sremoves(pattern)cCst|td��}t|||d�S)z�Changesets which remove files matching pattern.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file or a
    directory.
    sremoves requires a pattern�removedr�r�r)r)r*�removes`s	r�srev(number)cCs.zt|||�WStjy(t�YS0dS)z+Revision with the given numeric identifier.N)�_revrr/r;r�r)r)r*r.msr.s_rev(number)c	Cs�t|ddtd��}ztt|dtd���}Wn$ttfyPt�td���Yn0|tvr�z|j	�
|�Wn$ty�t�td�|��Yn0|t
|g�@S)Nrsrev requires one argumentrsrev requires a numbersrev expects a numbersunknown revision '%d')r�rr�r�r�r�rr#r8rGr�r�r/r;r$r)r)r*r�vsr�srevset(set)cCst||||�S)aStrictly interpret the content as a revset.

    The content of this special predicate will be strictly interpreted as a
    revset. For example, ``revset(id(0))`` will be interpreted as "id(0)"
    without possible ambiguity with a "id(0)" bookmark or tag.
    )r+r%r)r)r*�revsetpredicate�sr�smatching(revision [, field])cs�t|ddtd��}t�t��|d��dg}t|�dkrNt|dtd����}g}|D]F}|dkrp|gd�7}qV|dkr�|d	dg7}qV|d
kr�d}|�|�qVt|�}d|vr�d
|vr�|�	d�gd���fdd�}t
|�}|j|d�g��fdd��fdd��fdd��fdd��fdd��fdd��fdd��fdd��fdd��fdd�d�
}|D]8}	|�|	d�}
|
du�r�t
�td�|	����|
��qZ�fd d�����fd!d"�}|j|d#|�fd$�S)%a�Changesets in which a given set of fields match the set of fields in the
    selected revision or set.

    To match more than one field pass the list of fields to match separated
    by spaces (e.g. ``author description``).

    Valid fields are most regular revision fields and some special fields.

    Regular revision fields are ``description``, ``author``, ``branch``,
    ``date``, ``files``, ``phase``, ``parents``, ``substate``, ``user``
    and ``diff``.
    Note that ``author`` and ``user`` are synonyms. ``diff`` refers to the
    contents of the revision. Two revisions matching their ``diff`` will
    also match their ``files``.

    Special fields are ``summary`` and ``metadata``:
    ``summary`` matches the first line of the description.
    ``metadata`` is equivalent to matching ``description user date``
    (i.e. it matches the main metadata fields).

    ``metadata`` is the default field which is used when no fields are
    specified. You can match more than one field at a time.
    rrYsmatching takes 1 or 2 argumentsrsmetadatas1matching requires a string as its second argument)�user�description�date�diff�files�authorr��summaryr�)
�phase�parentsr�r��branchr�r�r��substater�cs,z��|�WSty&t��YS0dSr3)�indexr�rN)r�)�
fieldorderr)r*�fieldkeyfunc�szmatching.<locals>.fieldkeyfunc)�keycs�|��Sr3r�r�r�r)r*r��rfzmatching.<locals>.<lambda>cs�|��Sr3�r�r�r�r)r*r��rfcs�|��Sr3r'r�r�r)r*r��rfcs�|��Sr3r+r�r�r)r*r��rfcs�|��Sr3)r�r�r�r)r*r��rfcs�|��Sr3)r�r�r�r)r*r��rfcs�|��Sr3)r�r�r�r)r*r��rfcs
�|jSr3)�substater�r�r)r*r��rfcs�|����dSrF)r,�
splitlinesr�r�r)r*r��rfcs"t�|jt��jddi�d��S)NsgitT)r�)rr;rZdiffalloptsrCr�r�r)r*r��s�)
r�r�r�r�r�r�r�r�r�r�Ns,unexpected field name passed to matching: %scs�fdd��D�S)Ncsg|]}|���qSr)r)r�r�r)r*re	rfz.matching.<locals>.<lambda>.<locals>.<listcomp>r)r�)�
getfieldfuncsr�r*r�	rfcsJ�D]@}�|�}d}t��D]\}}||||�krd}q|rdSqdSrr)�	enumerate)r(r.r�rrDr�)r��getinforyr)r*r	szmatching.<locals>.matchess<matching%r %r>r�)r�rr+r:rNr��splitr4r�r�r�sortr�rr#r�)r&r'r(r%Z	fieldlist�fieldsrr�Z_funcs�infoZgetfieldrr))r�r�r�r&ryr*�matching�s`�	











�
��r�sreverse(set)cCs"t||||�}|tkr|��|S)zReverse order of set.)r+rOr�)r&r'r(r"r%r)r)r*r�	sr�s
roots(set)cs8t|t|�|��|jj���fdd�}|�j|dd�@S)z2Changesets in set with no parent changeset in set.cs(�|�D]}d|kr|�vrdSqdS)NrFTr))r0r[�r�rzr)r*r�%	szroots.<locals>.filters<roots>r�)r+r:rGr�r�)r&r'r(r�r)r�r*r.	sr.cCs|��Sr3r��r�r)r)r*r�0	rfr�cCs|��Sr3r+r�r)r)r*r�1	rfcCs|��Sr3r�r�r)r)r*r�2	rfcCs|��Sr3r�r�r)r)r*r�3	rfcCs|��dSrFr'r�r)r)r*r�4	rf)�revr�sdescr�r�r�snodecCst|dd�}d|vr"t�td���d}d|vr@t|dtd��}g}|��D]X}|}|�d�}|rn|d	d
�}|tvr�|dkr�t�td�t�	|���|�
||f�qLt|�d	kr�td
d�|D��r�t�td���i}d|v�rtdd�|D���r|d|d<nt�td���|d||fS)z5Parse sort options into (set, [(key, reverse)], opts)ssortsset keys topo.firstbranchr�s"sort requires one or two argumentsr�skeysssort spec must be a string�-rN�toposunknown sort key %rcss|]\}}|dkVqdS�r�Nr)�rdr�r�r)r)r*r�P	rfz_getsortargs.<locals>.<genexpr>s7topo sort order cannot be combined with other sort keys�topo.firstbranchcss|]\}}|dkVqdSr�r)r�r)r)r*r�X	rfs>topo.firstbranch can only be used when using the topo sort key)
r�rr#rr�r�r��
_sortkeyfuncsrZbytestrr4rNr�)r(r�ri�keyflagsr�Zfkr�r�r)r)r*�_getsortargs9	s>
��
��rssort(set[, [-]key... [, ...]])cst|�\}}}t�|||�}|r(|tkr,|St|�dkr`|dddkr`|j|ddd�|S|dddkr�d}d|vr�t�||d�}tt�|�jj	|�dd	�}|ddr�|�
�|S�fd
d�|D�}	t|�D]\}
}|	jt|
|d�q�td
d�|	D��S)a�Sort set by keys. The default sort order is ascending, specify a key
    as ``-key`` to sort in descending order.

    The keys can be:

    - ``rev`` for the revision number,
    - ``branch`` for the branch name,
    - ``desc`` for the commit message (description),
    - ``user`` for user name (``author`` can be used as an alias),
    - ``date`` for the commit date
    - ``topo`` for a reverse topographical sort
    - ``node`` the nodeid of the revision

    The ``topo`` sort order cannot be combined with other sort keys. This sort
    takes one optional argument, ``topo.firstbranch``, which takes a revset that
    specifies what topographical branches to prioritize in the sort.

    rrr�)r�r�r)r�T)Zistopocsg|]}�|�qSr)r)rcr�r)r*re�	rfzsort.<locals>.<listcomp>)r�r�cSsg|]}|���qSr)r�)rdr�r)r)r*re�	rf)
rr+rOrNr�r;r
ZtoposortrGr�r��reversedr�)r&r'r(r"rzr�r�ryZfirstbranchZctxsr�r�r)r�r*r�f	s,�r�ssubrepo([pattern])cspt|ddtd��}d�t|�dkr4t|dtd���t�dg���fdd������fd	d
�}|j|d�fd�S)
z�Changesets that add, modify or remove the given subrepo.  If no subrepo
    pattern is named, any subrepo changes are returned.
    rrs"subrepo takes at most one argumentNssubrepo requires a patterns.hgsubstatec3s,t���\}}}|D]}||�r|VqdSr3)rr�)r�r�r[rCr�)r�r)r*�
submatches�	szsubrepo.<locals>.submatchescs��|}�j|����|���d�}�dur>|jp<|jp<|jS|jrVt�|j����S|jr�t	|��j���}|�
|j����|�D]&}|��j�|�|j�|�kr�dSq�|jr�t�|��j����SdS)N)rTF)r�r�r�r�r�r�r�r�rir�r5r�)r(r�rzZsubsrl�rCr�r&rr)r*r�	szsubrepo.<locals>.matchess<subrepo %r>r�)r�rrNr�r��exactr�)r&r'r(r�rr)rr*�subrepo�	srcsX|��j}|jj�|j��fdd�|�fdd�|D��D�}|�d�t�||jj�S)z�(repo, smartset, [node] -> [node]) -> smartset

    Helper method to map a smartset to another smartset given a function only
    talking about nodes. Handles converting between rev numbers and nodes, and
    filtering.
    csh|]}�|��qSr)r)r�)�torevr)r*r��	rfz!_mapbynodefunc.<locals>.<setcomp>c3s|]}�|�VqdSr3r)rc)�tonoder)r*r��	rfz!_mapbynodefunc.<locals>.<genexpr>N)	Z
unfilteredrGr�Zget_revr�r�rr;Zfilteredrevs)r&rzr�r�r�r))rrr*�_mapbynodefunc�	s
$
rssuccessors(set)cs0t�t��|�}�fdd�}t�||�}||@S)zNAll successors for set, including the given set themselves.
    (EXPERIMENTAL)cst��j|�Sr3)rZ
allsuccessorsZobsstore)r�r�r)r*r��	rfzsuccessors.<locals>.<lambda>)r+r:r)r&r'r(rzr��dr)r�r*�
successors�	sr
csNtj�|d�\}�}|dkrD|s8t�����fdd�}n�fdd�}|�|fS)Nr�r�cs�t�|�vSr3r��rz�r�r)r*r��	rfz#_substringmatcher.<locals>.<lambda>cs�|vSr3r)rrr)r*r��	rf)rr�r
r�)r�r�r�r�r)rr*r��	s�
r�stag([name])cs�t|ddtd��}|j�|r�t|dtd��}t�|�\}}�|dkr�|jj�|d�}|durpt	�
td�|��||��h}q���fdd	�|��D�}n�fd
d	�|��D�}||@S)z�The specified tag by name, or all tagged revisions if no name is given.

    Pattern matching is supported for `name`. See
    :hg:`help revisions.patterns`.
    rrstag takes one or no argumentss$the argument to tag must be a stringr�Nstag '%s' does not existcs"h|]\}}�|�r��|��qSr)r��rdr�rD�r�r�r)r*r�
rfztag.<locals>.<setcomp>cs"h|]\}}|dkr��|��qS)stipr�r
r�r)r*r�
rf)
r�rrGr�rr�Z
_tagscache�tagsr�rr/r.Ztagslist)r&r'r(r�r�r��tnrzr)rr*�tag�	s$�
�rstaggedcCst|||�Sr3)rr�r)r)r*�tagged

srsorphan()cCs&t|ddtd��t�|d�}||@S)z?Non-obsolete changesets with obsolete ancestors. (EXPERIMENTAL)rsorphan takes no arguments�orphanr�)r&r'r(�orphanr)r)r*r
srs
unstable()cCsVt|ddd�t�}|�t�|d��|�t�|d��|�t�|d��|t|�@S)z-Changesets with instabilities. (EXPERIMENTAL)rsunstable takes no argumentsrr�rE)r�r�r5r�r�r;)r&r'r(Z	_unstabler)r)r*�unstable
srsuser(string)cCst|||�S)z�User name contains string. The match is case-insensitive.

    Pattern matching is supported for `string`. See
    :hg:`help revisions.patterns`.
    )r�r�r)r)r*r�$
sr�swdir()cCs4t|ddtd��t|vs$t|t�r.ttg�St�S)z!Working directory. (EXPERIMENTAL)rswdir takes no arguments)r�rr	r9r:r;r�r)r)r*�wdir.
s
rc
	Cs�t|d�}|st�S|j}g}t�}|�d�D]�}z*t|�}d||ksP||vrTt�|g}	Wn ty|t|||t�}	Yn0|	D]<}||vr�q�||vs�|t	vr�t
|t�r�|�|�|�
|�q�q.t|�S)N�internal error�s%d)r�r;rGr�r�r�r�r<rOr8r9r:r4r�)
r&r'r(rzr�r��seenr�r0ryr)r)r*�_orderedlist8
s4

���
rs_listcCs,|tkr|t|t|�|�@St|||�SdSr3)r=rr:r%r)r)r*�_listY
srcsBt|d���st�Sdd���d�D�}|�t�fdd�|D��S)NrcSsg|]}t|��qSr))r�rcr)r)r*ref
rfz#_orderedintlist.<locals>.<listcomp>rcsg|]}|�vr|�qSr)r)rcrr)r*reh
rf)r�r;r��r&r'r(r�r)rr*�_orderedintlistb
s
rs_intlistcCs,|tkr|t|t|�|�@St|||�SdSr3)r=rr:r%r)r)r*�_intlistl
srcsLt|d���st�S|j��fdd���d�D�}|�t�fdd�|D��S)Nrcsg|]}��t|���qSr))r.rrcr�r)r*rez
rfz#_orderedhexlist.<locals>.<listcomp>rcsg|]}|�vr|�qSr)r)rcrr)r*re|
rf)r�r;rGr�rr))r�rzr*�_orderedhexlistu
s
rs_hexlistcCs,|tkr|t|t|�|�@St|||�SdSr3)r=rr:r%r)r)r*�_hexlist�
sr )srangerrsrangepres	rangepostsdagranger�ssymbolsands	andsmally�orsnots
differencesrelationsrelsubscripts	subscript�listskeyvaluesfuncsancestorsparents
parentpostssmartset)�gsgenerationscs�fdd�}|S)Ncs6zt��|�WStjy0t�d|��Yn0dS)Ns!ambiguous revision identifier: %s)rZisrevsymbolrZAmbiguousPrefixLookupErrorZ
InputError)�symbolr�r)r*r��
s�zlookupfn.<locals>.fnr))r&r�r)r�r*�lookupfn�
sr%cCst||g|d�S)z+Create a matcher for a single revision specr�)�matchany)rC�specr�r)r)r*r�
srcs�|sd
dd�}|St|�s(t�td���t|�dkrFt�|d��}nddt�fd	d
�|D��f}g}d}|r�|�|�	d��|j
}|r�|�|���|r�tj|||d�}t�
|�}t�|�}t�|�}t|�S)aeCreate a matcher that will include any revisions matching one of the
    given specs

    If lookup function is not None, the parser will first attempt to handle
    old-style ranges, which may contain operator characters.

    If localalias is not None, it is a dict {name: definitionstring}. It takes
    precedence over [revsetalias] config section.
    NcSst�Sr3)r;)r&r'r)r)r*�mfunc�
szmatchany.<locals>.mfuncsempty queryrrr!)r"c3s|]}t�|��VqdSr3)r�parse)rdrzr�r)r*r��
rfzmatchany.<locals>.<genexpr>srevsetalias)�warn)N)�allrr#rrNrr)�tuplerZZconfigitemsr*r�Z
expandaliasesZ
foldconcatZanalyze�optimize�makematcher)rCZspecsr�Z
localaliasr(�tree�aliasesr*r)r�r*r&�
s.

�


r&csd�fdd�	}|S)z)Create a matcher from an evaluatable treeNcs8|dur|durt}nt}|dur*t|�}t||�|�Sr3)rOr=r:r+)r&r'r"�r/r)r*r(�
szmakematcher.<locals>.mfunc)NNr))r/r(r)r1r*r.�
s
r.cCs2t�|j�D] \}}|t|<|jrt�|�qdS)z2Load revset predicates from specified registrarobjN)rr�Z_tabler�Z_safe�safesymbolsr�)rCZextnameZregistrarobjr�r�r)r)r*�
loadpredicate�
sr3)FNN)FNN)F)T)N)NN)�Z
__future__rr@Zi18nrrrr�rrr	rr
rrr
rrr<rrr�rr�rrrrrrrrrr�rZutilsrrr rgr�r�rbr^rvr�r�r;rcrMr:r8rRrOr=r+r2r6r<r>rErIrJrKr?rPrTrUrXrZr_r`rmrqrursr|r~r�r�r�r�r�r2r��	predicater�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r�r
r
rrrr r&r(r-r/r0r1r7rDrFrJrLrMr-rTr@r\r^r`rerprqrr�r�r�r�r�rUrAr�r�r�rr�r�rir�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r.r�r�r�r.r7Zbinnoder�rr�rrr
r�rrrrr�rrrrrrr r$rhr{r%r&r.r3r�Z
i18nfunctionsr)r)r)r*�<module>s\X(				




�













%
3



%



















�



!


/

)


+




!

?


	

�
E






Z


















%
 -"%





�-
�.,	
		!
	���)	

Youez - 2016 - github.com/yon3zu
LinuXploit