https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/revset.cpython-310.pyc
o

�]Lb]�@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�i�d�e<��d�e=��d�e>��d�e?��d�eA��d�e:��d�e:��d�eB��d�eC��d�eF��d�eG��d�eD��d�eH��d�eL��d�eM��d�eN��d�eO�ePe^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:|s	t�td���t|d||g|dd��Rd|i�S)Nsmissing argumentrr�order)r�
ParseErrorr�methods��repo�subset�xr"�r)�2/usr/lib/python3/dist-packages/mercurial/revset.py�getsetns(r+c	CsN||��}dD]}||vr$z|||��WStjy#YqwqdS)N)�sourcestransplant_sources
rebase_source)�extra�revr�RepoLookupError)r&�rr-�labelr)r)r*�
_getrevsourcets��r2cCstt�tj|��S�N)�sortedr�rapply�maybebytestr)�xsr)r)r*�_sortedb�r8cCsN|s	t�td���t�t�||��}||vs|tvr$t|t�r$t	|g�St	�S)Ns$empty string is not a valid revision)
rr#rr�intrev�	revsymbol�_virtualrevs�
isinstance�fullreposet�basesetr%r)r)r*�	stringset�s
r@cCs|tkr||@S||@S)z1argument is already a smartset, use that directly)�followorderr%r)r)r*�rawsmartset�srBcCsFt|t|�|�}t|t|�|�}|r|st�St|||��|��|�Sr3)r+r>r?�
_makerangeset�first�last)r&r'r(�yr"�m�nr)r)r*�rangeset�s
rIcCs"|dusJ�t||d|j��|�S�Nr)rC�	changelog�tiprevr%r)r)r*�rangeall�srMcCs.t|t|�|�}|s
t�St||d|��|�SrJ)r+r>r?rCrE)r&r'rFr"rHr)r)r*�rangepre�srNcCs4t|t|�|�}|s
t�St|||��|j��|�Sr3)r+r>r?rCrDrKrL)r&r'r(r"rGr)r)r*�	rangepost�s�rOcCs�||kr
t|g�}n<|tkrt||t|��t|g�}n*|tkr1t|g�t||j��|d�}n||kr>t|||d�}nt|||d�}|tkrN||@S||@S�Nr)r?r	�spanset�lenrKrL�defineorder)r&r'rGrHr"r0r)r)r*rC�s"rCcCs2t|�}tj|t|||�t|||�dd�}||@S)NT)�includepath)r>r
�reachablerootsr+)r&r'r(rFr"r0r7r)r)r*�dagrange�s
�rVcCs*|tkrt}nt}t|t||||�||�Sr3��anyorderrAr+�r&r'r(rFr"�yorderr)r)r*�andset�sr[cCs*|tkrt}nt}t|t||||�||�Sr3rWrYr)r)r*�andsmallyset�sr\cCst||||�t|||t�Sr3�r+rX�r&r'r(rFr"r)r)r*�
differenceset�sr_cCsf|sJ�t|�dkrt|||d|�St|�d}t|||d|�|�}t||||d�|�}||S)Nrr�)rRr+�
_orsetlist)r&r'r7r"�p�a�br)r)r*ra�sracCs>t|�}|s	t�S|tkr|t|t|�|t�@St||||�Sr3)�getlistr?rArar>rX)r&r'r(r"r7r)r)r*�orset�srfcCs|t|||t�Sr3r]r%r)r)r*�notset�r9rgcCsBt|�}|tvrt||||||�Sdd�t��D�}t�||��)NcS�g|]
}t|�dkr|�qS�r�rR��.0r0r)r)r*�
<listcomp>�zrelationset.<locals>.<listcomp>)�	getsymbol�	relations�keysr�UnknownIdentifier)r&r'r(rFr"�rel�relnamesr)r)r*�relationset�s
rucCsdd}d}||krdkrnnd}|dkr!t|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)rcrd�	ancdepths�
descdepthsr)r)r*�_splitrangesr{cCsd}t||||||�S)N)�rangeallN)�generationssubrel)r&r'r(rsr"�zr)r)r*�generationsrel*srcCs�t|td�td�tjdtjd
d�\}}t||�\\}}	\}
}|dur-|
dur-t�St|t|�|�}|s:t�S|durZ|
durZt�||d||	�}
|
t�	||d|
|�7}
||
@S|durkt�||d||	�}
||
@S|
durxt�	||d|
|�}
||
@S)Ns0relation subscript must be an integer or a ranges*relation subscript bounds must be integersr)�deffirst�deflastF)
�getintrangerr
�maxlogdepthr{r?r+r>�revancestors�revdescendants)r&r'r(rsr~r"rcrd�ancstart�ancstop�	descstart�descstop�revs�sr)r)r*r}/s.


���r}cCsDt|�}|tvrt|||||||�Sdd�t��D�}t�||��)NcSrhrirjrkr)r)r*rmUrnz#relsubscriptset.<locals>.<listcomp>)ro�subscriptrelationsrqrrr)r&r'r(rFr~r"rsrtr)r)r*�relsubscriptsetMs
r�cC�t�td���)Ns%can't use a subscript in this context�rr#rr^r)r)r*�subscriptsetY�r�cOstjtd�td�d��)Ns can't use a list in this contextssee 'hg help "revsets.x or y"')�hintr�)r&r'r7�optsr)r)r*�listset]s�r�cCr�)Ns*can't use a key-value pair in this contextr�)r&r'�k�vr"r)r)r*�keyvaluepairdr�r�csht|�}|tvrt|}t|dd�r|||||�S||||�Sdd���fdd�t��D�}t�||��)N�
_takeorderFcSst|dd�duS)N�__doc__r)�fnr)r)r*�<lambda>p�zfunc.<locals>.<lambda>csg|]
\}}�|�r|�qSr)r))rlr�r���keepr)r*rmrrnzfunc.<locals>.<listcomp>)ro�symbolsr�itemsrrr)r&r'rcrdr"�f�func�symsr)r�r*r�hsr�s_destupdatecCs2t|dd�}|ttj|fit�|���dg�@S)N�limitscleanr)�getargsdictr?r�
destupdater�	strkwargs)r&r'r(�argsr)r)r*�_destupdate�s�r�s
_destmergecCs4d}|durt|t|�|�}|ttj||d�g�@S)N)�	sourceset)r+r>r?r�	destmerge)r&r'r(r�r)r)r*�
_destmerge�sr�s
adds(pattern)T�)�safe�weightcC�t|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��	r�sancestor(*changeset)g�?cCs|tt|t|�|td��}z|t|�}Wnty t�YSw|D]	}|�||�}q#t�	|�}||vr;t|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")
�iterrfr>rX�next�
StopIterationr?�ancestorrr:)r&r'r(�reviter�ancr0r)r)r*r��s
�

r�FcC�4t|t|�|�}|s
t�St�|||||�}||@Sr3)r+r>r?r
r�)r&r'r(�followfirst�
startdepth�	stopdepth�headsr�r)r)r*�
_ancestors��
r�sancestors(set[, depth]))r�cC�t|dd�}d|vrt�td���d}}d|vr+t|dd�}|dkr)t�d	��|}d
|vrGt|d
td��}|dkrCt�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�rHr)r)r*�	ancestors�s&	�
�r�s_firstancestorscC�t|||dd�S�NT�r�)r��r&r'r(r)r)r*�_firstancestors��r�c	Cs~t�}t|t|�|�D]/}t|�D]#}||��}t|�dkr!nt|�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�childrenrRrr/rr.�add)	r&r'r(rHr"�csr0�i�cr)r)r*�
_childrenspec�s�
�r�c	
Cs�t|td��}|dkrt|||||�St�}|j}t|t|�|�D])}t|�D]}z	|�|�d}Wq(t	j
yE||����}Yq(w|�
|�q"||@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�rKr+r>r��
parentrevsr�WdirUnsupported�p1r.r�)	r&r'r(rHr"�ps�clr0r�r)r)r*�ancestorspecs�r�sauthor(string)�
c�<t|td��}t|dd�\}}�|j��fdd�d|fd�S)zAlias for ``user(string)``.sauthor requires a stringF��
casesensitivec���|���Sr3��user�r(��matcherr&r)r*r�r�zauthor.<locals>.<lambda>s	<user %r>��condrepr�r�r�_substringmatcher�filter)r&r'r(rH�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�sbisectedcC�t|||�Sr3)r�r�r)r)r*�bisected6�r�sbookmark([name])cst|ddtd��}|rot|dtd��}t�|�\}}}t�}|dkrI||kr-�j�|�}�j�|d�}	|	s?t	�
td�|��|��|	���n2t�}
t
��j�D]
\}}	||�r_|
�|	�qR|
D]}	|��|	���qbn�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.rk�r&r)r*�	<setcomp>\�zbookmark.<locals>.<setcomp>)�getargsrr�r�
stringmatcherr��
_bookmarks�
expandnamer�rr/r�r.r�	iteritems�valuesr)r&r'r(r��bmr�r�r��bms�bmrev�	matchrevs�namer)rr*�bookmark;s8�
�
��
rsbranch(string or set)cs���j���fdd��zt|d��Wn
tjyYn?wt���\}}�|dkrN����|�r?|j	��fdd�d�fd�S��
d	�rMt�td
�|��n|j	��fdd�d�fd�St
�t��|�}t��|D]	}���|��qi|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`.
    cs0z�|�dWStjy�|��YSwrJ)rr��branch�r0)�getbir&r)r*�	getbranchls
�zbranch.<locals>.getbranch�rc���|��Sr3r)r�rr�r)r*r�~�zbranch.<locals>.<lambda>�<branch %r>r�sliteral:sbranch '%s' does not existcrr3r)rrr)r*r��rcs�|�p	�|��vSr3r)r)rdr�rr)r*r���c�dt��S)Nr�r8r))rdr)r*r��r)�revbranchcache�
branchinfor�rr#rr�	branchmap�	hasbranchr��
startswithr/rr+r>r�r��__contains__)r&r'r(r�r�r�r0r))rdr�rrr�r&r*ras>
	��

���
�rsphasedivergent()cC�&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�rr�obsmod�getrevs)r&r'r(�phasedivergentr)r)r*r(�sr(sbundle()cCs0z	|jj}W||@Styt�td���w)zIChangesets in the bundle.

    Bundle must be specified by the -R option.s$no bundle provided - specify with -R)rK�
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
�rtj�j����g|d��d<�d�d}�dus%J����s7t����dkr7���d}|durD||��vrCdSnt�fdd�|��D��sSdSt��	|�
���|�����}|durn||vrldSdSt�fdd�|D��r{dSdS)	Nr��ctxrFc3��|]}�|�VqdSr3r)�rlr��rGr)r*�	<genexpr>���z/checkstatus.<locals>.matches.<locals>.<genexpr>Tc3r/r3r)r0r1r)r*r2�r3)�matchmodr�root�getcwd�anypatsrR�files�anyrr�r��node)r(r��fnamer8��field�hasset�mcacher�r&r1r*�matches�s,���zcheckstatus.<locals>.matchess<status.%s %r>r�)r4�patkindr�r�sysbytes)r&r'r�r=r@r)r<r*r��s�r�c	Cst|st�St�}|jj}|��}|D]#}||krq||�\}}||vr(|�|�|tkr5||vr5|�|�qt|�Sr3)r?r�rKr�rwr�r)	r&r'�	parentsetr��pr�minrevr0r��p2r)r)r*�	_children�s

�rGs
children(set)cCs$t|t|�|�}t|||�}||@S)z&Child changesets of changesets in set.)r+r>rG)r&r'r(r�r�r)r)r*r��sr�sclosed()cs(t|ddtd��|j�fdd�dd�S)zChangeset is closed.rsclosed takes no argumentsc��|��Sr3)�closesbranchrrr)r*r��rzclosed.<locals>.<lambda>s<branch closed>r�)rrr�r�r)rr*�closed�s�rJs_commonancestorheads(set)cCs0t|t|�|td�}|jjt|��}|t|�@S)Nr�)r+r>rXrK�_commonancestorsheads�listr?)r&r'r(�	startrevs�ancsr)r)r*�_commonancestorheads�srOscommonancestors(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>rXr?r
r�)r&r'r(rMr0r)r)r*�commonancestorssrPsconflictlocal()cC�Zt|ddtd��ddlm}|j�|�}|��r*|j�|j�r*||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)rr�rS�read�activerK�hasnode�localr.r?�r&r'r(�
mergestatemodrSr)r)r*�
conflictlocal�r[sconflictother()cCrQ)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 argumentsrrR)rrrTrSrUrVrKrW�otherr.r?rYr)r)r*�
conflictother r\r^scontains(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 patterncstt���st��j�����}|�|vrdSdS�|}tj�j����g|d�}|��D]	}||�r7dSq.dS)NTr-F)r4rAr�	canonpathr5r6r�manifest)r(�patsr�rGr��r�r&r)r*r@<s
��zcontains.<locals>.matchess
<contains %r>r�)r�rr��r&r'r(r@r)rcr*�contains0s

resconverted([id])csTd�t|ddtd��}|rt|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>._matchvaluec��|�Sr3r)r�rgr)r*r�a�zconverted.<locals>.<lambda>s<converted %r>r�)rrr�r��r&r'r(�lr))rgr&r.r*�	convertedLs	�rmsdate(interval)cs4t|td��}t�|��|j��fdd�d|fd�S)z5Changesets within the interval, see :hg:`help dates`.sdate requires a stringcs��|��d�SrJ��dater���dmr&r)r*r�lrzdate.<locals>.<lambda>s	<date %r>r�)r�rr�	matchdater�)r&r'r(�dsr)rpr*roes

�rosdesc(string)cr�)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�cr�r3��descriptionrr�r)r*r�}r�zdesc.<locals>.<lambda>s	<desc %r>r�r�)r&r'r(rsr�r�r)r�r*�descps
�rvcCr�r3)r+r>r?r
r�)r&r'r(r�r�r��rootsr�r)r)r*�_descendants�r�rxsdescendants(set[, depth])cCr�)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�rxr�r)r)r*�descendants�s*	�
��rys_firstdescendantscCr�r�)rxr�r)r)r*�_firstdescendants�r�rzsdestination([set])cs�|dur
t|t|�|�}nt|�}t��|D]2}t||�}d}|durH|dur*t�}|�|�||vs7|�vr=��|�n|}t||�}|dus#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().
    Ncr)Ns<destination %r>rr)��destsr)r*r��rzdestination.<locals>.<lambda>r�)	r+r>r�r2rL�append�updater�r")r&r'r(�sourcesr0�src�lineager)r{r*�destination�s,



��
�r�sdiffcontains(pattern)�ncs�t|dd�}d|vrt�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)�searchfilesr?r��grepmod�difflinestates)r.�foundr�r.�pstates�states)r��searcherr)r*�testdiffs
��zdiffcontains.<locals>.testdiffs<diffcontains %r>r�)r�rr#rr�r�substringregexp�re�Mr4�alwaysr��grepsearcher�uir�)r&r'r(r�r��regexpr�r))r�r�r�r*�diffcontains�s�
r�scontentdivergent()cCr#)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*r�sr�sexpectsize(set[, size]))r��	takeorderc	Cst|dd�}d}t|�d}d}d|vsd|vrt�td���t|dtd	�td
�||�\}}|dks7|dkr>t�td���t|t|�|d|d�}||krft|�|ksZt|�|krftd
�||t|�f}n||krzt|�|krztd�|t|�f}|r�t�|��|t	kr�||@S||@S)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 sizerrrssizer�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 %d)
r�rRrr#rr�r+r>r/rA)	r&r'r(r"r��minsize�maxsize�errr.r)r)r*�
expectsizes@	� ��
r�sextdata(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�rr�
extdatasourcer?)r&r'r(r�rf�datar)r)r*�extdataFs�r�s	extinct()cCr#)zBObsolete changesets with obsolete descendants only. (EXPERIMENTAL)rsextinct takes no argumentssextinctr%)r&r'r(�extinctsr)r)r*�extinctT�r�sextra(label, [value])cs�t|dd�}d|vrt�td���t|dtd���d�d|vr1t|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*rgvszextra.<locals>._matchvaluecrhr3r)rrir)r*r�{rjzextra.<locals>.<lambda>s<extra[%r] %r>r�)r�rr#rr�rrr�)r&r'r(r�r�r))rgr1r�r&r�r*r-]s ���r-sfilelog(pattern)cs�t|td��}t�}|j}t�|�s t�|j|�	�|�}|g}ntj
|j|�	�|g|dd���fdd�|dD�}|D]}|�|�}i}	d}
t|�D]o}|�
|�}||	vr^|�|	|�qK|�|�}
|
|vrm|�|
�qK|
dur�t|
|
�d}d}
|�|�D]:}||�|�vr�||�|�vr�z||�|�}||	vr�||kr�|�|�|}
Wn||	|<Wqtjy�YqwqqKq<||@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)r0r1r)r*r2���zfilelog.<locals>.<genexpr>rr)r�rr�rKr4rArr`r5r6r�filerLr:r��linkrevrxr��revision�	readfiles�filenoder�ManifestLookupError)r&r'r(r�r�r�r�r8�fl�known�scanpos�frr��lr�startr0rHr)r1r*�filelogsP




����r�sfirst(set, [n]))r�r�r�cC�t||||�S)zAn alias for limit().)�limitr%r)r)r*rD�srDcst||d�}d}d|vrt|t|�|d�}d|vrjt|dtd�|�}|dur,dg}g}|D]/}||�}	|dur@|d�tj|j|��|g|	dd�}
|�	�fdd	���
��|
�D��q0t�
||�}||@S|durwt|d��g�}t�|||�}||@S)
Ns
file startrev�startrev�files%s expected a pattern�.spath)r.�defaultc3��|]	}�|��VqdSr3)�introfilectxr0r-r)r*r2�r�z_follow.<locals>.<genexpr>)r�r+r>r�rr4rr5r6�extendra�walkr
�filerevancestorsr?r.r�)r&r'r(rr�r�r��fctxsr0�mctxrGr�r)r-r*�_follow�s.�$�r�sfollow([file[, startrev]])cCst|||d�S)��
    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])cCs<t|dd�}t|d�dkrt�td���d}d|vr6t|t|�|d�}t|�dkr2t�td���|��}t|d	td
��}td�}t	�
||||�}tjt
|ddtd
�td���\}	}
||�|�}d}d|vrtt|dtd��}|r�tdd�t�||	|
�D�dd�}
||
@Stdd�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 ranger�r�s(followlines expects exactly one revisionr�sfollowlines 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 booleancs��|]	\}}|��VqdSr3r�rlr��
_lineranger)r)r*r2&�
��
�zfollowlines.<locals>.<genexpr>T)�iterasccsr�r3rr�r)r)r*r20r�)r�rRrr#rr+r>rEr�r�parsefollowlinespatternr�processlineranger��filectx�
getboolean�generatorsetr
�blockdescendants�blockancestors)r&r'r(r�r.r�r��msgr;�fromline�toline�fctx�descend�rsr)r)r*�followlines�s^�
��	��������	r�snodefromfile(path)c
Cs�t|td��}t�}z/t�|d��}|D]}|��}t||�}|dur(|�|�qWd�n1s3wYWntyX}	ztd�}
|
|t	�
|	j�f;}
t�
|
��d}	~	ww|t|�@S)r�s nodefromfile require a file path�rbNscannot open nodes file "%s": %s)r�rr�r�open�strip�_noder��IOErrorr
�
strtolocal�strerrorrr+r?)r&r'r(�path�
listed_revr��linerH�rn�excrGr)r)r*�nodefromfile;s(

����
��r�sall()cCst|ddtd��|t|�@S)z&All changesets, the same as ``0:tip``.rsall takes no arguments)rrrQr�r)r)r*�getallRsr�sgrep(regex)c
snzt�t|td����Wntjy%}zt�td�t�|���d}~ww��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]
}��|�rdSqdS�NTF)r8r�ru�search)r(r��e��grr&r)r*r@hs
�zgrep.<locals>.matchess	<grep %r>r�)
r��compiler�rrr#r�forcebytestrr�r�)r&r'r(r�r@r)r�r*rZs���rs_matchfilesc		sPt|ddd�}ggg���d\��|D]_}t|d�}|dd�|dd�}}|dkr3��|�q|dkr=��|�q|d	krG��|�q|d
kr^�durTt�d��|dkr[t�q|�q|d
krn�durkt�d��|�qt�d|���syd�tdd����D���dg��jj����������f	dd�}|j	|d�����fd�S)Nr���s*_matchfiles requires at least one argumentrvs%_matchfiles requires string argumentsr`�p:si:sx:sr:s)_matchfiles expected at most one revisionrsd:s-_matchfiles expected at most one default modesinvalid _matchfiles prefix: %ssglobcss�|]
}t�|�dkVqdS)r�N)r4rA�rlrbr)r)r*r2�s�z_matchfiles.<locals>.<genexpr>c	s�|tkr�|��}n�|�}�dr�r4�dur4�dur|n�}tj�j�������|�d��d<�d}|D]	}||�rCdSq:dS)Nr)�include�excluder.r�TF)r	r8r4rr5r6)r(r8r0rGr��	r�r��getfilesr>�incr?rbr&r.r)r*r@�s(
�	�z_matchfiles.<locals>.matchessC<matchfiles patterns=%r, include=%r exclude=%r, default=%r, rev=%r>r�)
rr�r}rr#r	r9rKr�r�)	r&r'r(rl�argr��prefixr�r@r)r�r*�_matchfilesrsV
����r�s
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�stringr�)r�rr�r�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)rl�h�r�r)r*r2�s�zhead.<locals>.<genexpr>)rrr�rKr�	iterheadsr~r?)r&r'r(�hs�lsr)r�r*�head�srs
heads(set)cCs�|tkrt}t|t|�||d�}d}t|vr*dd�|d��D�}t|�}|�t�|j�	|�}|dur>|�
|�|�t�t|�}||@S)z'Members of set with no children in set.r�NcS�g|]}|���qSr)rr�r)r)r*rm�rzheads.<locals>.<listcomp>)
rSrAr+r>r	�parentsr��discardrK�headrevs�difference_updater�r?)r&r'r(r"�inputset�wdirparentsr�r)r)r*r��s


r�shidden()cCr#)zHidden changesets.rshidden takes no argumentssvisible)rrr�
filterrevs)r&r'r(�
hiddenrevsr)r)r*�hidden�r�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�)rl�t)�kwr)r*r2s
��
�z+keyword.<locals>.matches.<locals>.<genexpr>)r9r8r�ru)r0r��r
r&r)r*r@s�zkeyword.<locals>.matchess<keyword %r>r�)r
r�r�rr�rdr)rr*�keywords	rslimit(set[, n[, offset]])c	Cs�t|dd�}d|vrt�td���t|�d�td�dd�}|d	kr(t�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)r�r�negative number to selectsoffsetsnegative offset)
r�rr#rr�r�r+r>�slicerA)	r&r'r(r"r��lim�ofs�osr�r)r)r*r�s �r�slast(set, [n])cCs�t|ddtd��}d}t|�dkrt|dtd��}|dkr%t�td���t|t|�|d�}|��|�	d|�}|t
krE|dkrE||@S|��||@S)z'Last n members of set, defaulting to 1.rr`s"last requires one or two argumentsslast expects a numberrr)rrrRr�rr#r+r>�reverserrA)r&r'r(r"rlrrr�r)r)r*rE2srEsmax(set)cC�^t|t|�|�}z|��}||vrt|gd||fd�WSWn	ty&Ynwtd||fd�S)z.Changeset with highest revision number in set.s<max %r, %r>��datarepr)r+r>rxr?�
ValueError�r&r'r(rrGr)r)r*�maxrevF���rsmerge()cs4t|ddtd���j���fdd�}|j|dd�S)zChangeset is a merge changeset.rsmerge takes no argumentscs:z
��|�dtkWStjyt�|���YSwrP)r�rrr��boolrFr�r�r&r)r*�ismerge\s
�zmerge.<locals>.ismerges<merge>r�)rrrKr�)r&r'r(r r)rr*�mergeUsr!s
branchpoint()cs�t|ddtd��|j}|st�St|��dgt|���|j�dd�D]}|�|�D]}|�kr=�|�d7<q-q&|j��fdd�dd�S)	z$Changesets with more than one child.rsbranchpoint takes no argumentsr)r�cs�|�dkSrPr)r��baserev�parentscountr)r*r�vr�zbranchpoint.<locals>.<lambda>s
<branchpoint>r�)	rrrKr?rwrRr�r�r�)r&r'r(r�r0rbr)r"r*�branchpointes���r%smin(set)cCr)z-Changeset with lowest revision number in set.s<min %r, %r>r)r+r>rwr?rrr)r)r*rEzrrEsmodifies(pattern)cCr�)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�r�r'snamed(namespace)c	s�t|ddtd��}t|dtd��}t�|�\}}}t�}|dkr8|�jvr/t�td�|��|�	�j|�nt
��j�D]
\}	}||	�rK|�	|�q>t�}
|D]}|���D]}	|	|j
vro|
��fdd�|��|	�D��qXqQ|
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 stringrsnamespace '%s' does not existc3r�r3r�rlrHrr)r*r2�r�znamed.<locals>.<genexpr>)rrr�rrr��namesrr/r�rr	�	listnames�
deprecatedr~�nodesr)r&r'r(r��nsr�r�r��
namespacesrr)r)rr*�named�s4�

�
�
 ��
r/c	Cs�d}t|�d|jjkr2z|j�t|��}W|Stjy$t}Y|St	t
fy1d}Y|Swzt�||�}|durF|j�|�}W|SW|St	yRY|Stjy^t}Y|Sw)zprocess a node inputNr`)
rR�
nodeconstants�nodelenrKr.rrr�r	�LookupError�	TypeErrorr�resolvehexnodeidprefix)r&rHr��pmr)r)r*r��s4��
�����r�s
id(string)cCsNt|ddtd��}t|dtd��}t||�}|durt�St|g�}||@S)zBRevision non-ambiguously specified by the given hex string prefix.rsid requires one argumentrsid requires a stringN)rrr�r�r?)r&r'r(rlrHr��resultr)r)r*�node_�s

r7snone()cCst|ddtd��t�S)zNo changesets.rsnone takes no arguments)rrr?r�r)r)r*�none�sr8s
obsolete()cCr#)z6Mutable changeset with a newer version. (EXPERIMENTAL)rsobsolete takes no argumentssobsoleter%)r&r'r(�	obsoletesr)r)r*r�r�rsonly(set, [set])cs�|j}t|ddtd��}t|t|�|d��t|�dkr7�s!t�Stt�	|�d�����fdd�|�
�D�}n
t|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>).
    rr`sonly takes one or two argumentsrFcs g|]}|�vr|�vr|�qSr)r)�rlr.�ryr�r)r*rms
�zonly.<locals>.<listcomp>)�commonr�)rKrrr+r>rRr?r�r
r�r�findmissingrevs)r&r'r(r�r�r��resultsr)r;r*�only�s�r?s
origin([set])csR|dur
t�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.
    Ncs4t�|�}|durdS	t�|�}|dur|S|}qr3)r2)r.r��prevrr)r*�	_firstsrcs

�zorigin.<locals>._firstsrcc�h|]}�|��qSr)r)rk)rAr)r*r*rzorigin.<locals>.<setcomp>)r+r>)r&r'r(r|�or))rAr&r*�origins	
rDsoutgoing([path])c	s4ddlm}m}t|ddtd��}|rt|dtd��pd}|r$|g}ng}t�}t���j	|�D]X}	|	j
p8|	j}|	jgf}
|�
��|
g�\}}|rS�fdd�|D�}|��i|�}
z#�j	���|j�|
|d	�}Wd
�n1sswYW|
��n|
��w|�|j�q1�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 pathrcsg|]}��|��qSr)��lookupr:rr)r*rmP�zoutgoing.<locals>.<listcomp>)�	onlyheadsNcsh|]}��|��qSr)rrkr�r)r*r[rIzoutgoing.<locals>.<setcomp>)rTrErFrrr�r�r �get_push_pathsr��pushloc�locr�
addbranchrevs�peer�silent�findcommonoutgoing�closer~�missingrK)r&r'r(rErFrl�destr|rSr��branchesr��checkoutr]�outgoingrCr)rr*rW1s6	�
���rWs	p1([set])c	Cs�|dur||����}|dkr|t|g�@St�St�}|j}t|t|�|�D]#}z|�|�|�d�Wq(t	j
yK|�||�����Yq(w|th8}||@S)z<First parent of changesets in set, or the working directory.Nr)r�r.r?r�rKr+r>r�r�rr�r)r&r'r(rbr�r�r0r)r)r*r�_s�
r�s	p2([set])c	Cs�|dur-||��}z|d��}|dkr|t|g�@WSt�WSty,t�YSwt�}|j}t|t|�|�D]+}z|�|�	|�d�Wq;t
jyf||��}t|�dkrd|�|d�Yq;w|t
h8}||@S)z=Second parent of changesets in set, or the working directory.Nrrr`)rr.r?�
IndexErrorr�rKr+r>r�r�rr�rRr)r&r'r(r�rbr�r0rr)r)r*rFus.
���
rFcCr�r3)r�r%r)r)r*�
parentpost�srYsparents([set])c	Cs�|durdd�||��D�}n6t�}|j}|j}|j}t|t|�|�D]!}z|||��Wq$tjyE|dd�||��D��Yq$w|t	h8}||@S)zU
    The set of all parents for all changesets in set, or the working directory.
    NcSsh|]}|���qSr)rr�r)r)r*r�rzparents.<locals>.<setcomp>css�|]}|��VqdSr3rr�r)r)r*r2�r3zparents.<locals>.<genexpr>)
rr�rKr~r�r+r>rr�r)r&r'r(r�r��upr�r0r)r)r*r�s�
rcGs|j�|||�S)z,helper to select all rev in <targets> phases)�_phasecache�	getrevset)r&r'�targetsr)r)r*�_phase��r^s_phase(idx)cCs(t|ddd�}t|dd�}t|||�S)Nrs_phase requires one argumentrs_phase expects a number)rr�r^)r&r'r(rl�targetr)r)r*�phase�srasdraft()cC�$t|ddtd��tj}t|||�S)zChangeset in draft phase.rsdraft takes no arguments)rrr�draftr^�r&r'r(r`r)r)r*rc��rcssecret()cCrb)zChangeset in secret phase.rssecret takes no arguments)rrr�secretr^rdr)r)r*rf�rerfs
stack([revs])cCsV|dur
t�|�}||@St�g�}t|t|�|�D]}t�||�}||}q||@S)zdExperimental revset for the stack of changesets or working directory
    parent. (EXPERIMENTAL)
    N)�stackmod�getstackrr?r+r>)r&r'r(�stacksr��currentstackr)r)r*r�s

�
rc		Cs.zt|d�}|dvr
t�Wnttfyt�td���wt�}|j}t|t	|�|�D]e}|dkr9|�
|�q-|dkr_z|�
|�|�d�Wq-tjy^|�
||�
����Yq-wz|�|�}|dtkrr|�
|d�Wq-tjy�||��}t|�dkr�|�
|d���Yq-w||@S)z�``set^0``
    The set.
    ``set^1`` (or ``set^``), ``set^2``
    First or second parent, respectively, of all changesets in set.
    r)rrr`s^ expects a number 0, 1, or 2rr`)�intrr3rr#rr�rKr+r>r�r�r�r�r.rrrR)	r&r'r(rHr"r�r�r0rr)r)r*�
parentspec�s>���
���rlspresent(set)cCs,zt||||�WStjyt�YSw)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.
    )r+rr/r?r%r)r)r*�present�s
	
�rm�
_notpubliccCs t|ddd�t||tjtj�S)Nrs_notpublic takes no arguments)rr^rrcrfr�r)r)r*�
_notpublic
sros"_phaseandancestors(phasename, set)c
s�t|ddd�}t|d�}t�t��|d�}tj�tj}��|d�}||vr.t�d|��||��j	j
����fdd�}tj�||d	�}	|d
krU|	�
���fdd��}	||	@S)
Nr`s)_phaseandancestors requires two argumentsrr)rn�draftssecrets%r is not a valid phasenamecs��|��kSr3r)r)�getphase�minimalphaser&r)r*�cutfunc&r�z#_phaseandancestors.<locals>.cutfunc)rsrpcs��|��kSr3r)r)rcrqr&r)r*r�,�z$_phaseandancestors.<locals>.<lambda>)rror+r>rrcrfrr#r[rar
r�r�)
r&r'r(r��	phasenamer�rf�phasenamemaprsr�r))rcrqrrr&r*�_phaseandancestorss$�rwspublic()cCs t|ddtd��t||tj�S)zChangeset in public phase.rspublic takes no arguments)rrr^r�publicr�r)r)r*rx0srxsremote([id [,path]])cCs�ddlm}t|ddtd��}d}t|�dkr t|dtd��}|dkr*|d��}d}t|�dkr;t|dtd	��}|s?d
}t�d||j	|�\}}|�
|i|�}|�|�}	|	|vri||	��}
|
|vrit
|
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)rFrr`s(remote takes zero, one, or two argumentsr�sremote requires a string idrs!remote requires a repository pathsdefaultsremote)rTrFrrrRr�rr �get_unique_pull_pathr�rOrHr.r?)r&r'r(rFrl�qrTrUr]rHr0r)r)r*�remote8s,
�

r{sremoves(pattern)cCr�)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^r�r}srev(number)cCs*zt|||�WStjyt�YSw)z+Revision with the given numeric identifier.)�_revrr/r?r�r)r)r*r.ks

�r.s_rev(number)c	Cs�t|ddtd��}z
tt|dtd���}Wnttfy&t�td���w|tvrDz|j	�
|�WntyCt�td�|��w|t
|g�@S)Nrsrev requires one argumentrsrev requires a numbersrev expects a numbersunknown revision '%d')rrrkr�r3rrr#r<rKr:rXr/r?rkr)r)r*r~ts��r~srevset(set)cCr�)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�srsmatching(revision [, field])cs�t|ddtd��}t�t��|d��dg}t|�dkr't|dtd����}g}|D]#}|dkr8|gd�7}q+|dkrC|d	dg7}q+|d
krId}|�|�q+t|�}d|vr`d
|vr`|�	d�gd���fdd�}t
|�}|j|d�g��fdd��fdd��fdd��fdd��fdd��fdd��fdd��fdd��fdd��fdd�d�
}|D]}	|�|	d�}
|
dur�t
�td�|	����|
�q��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.
    rr`smatching 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��|�WStyt��YSwr3)�indexrrR)r�)�
fieldorderr)r*�fieldkeyfunc�s
�zmatching.<locals>.fieldkeyfunc)�keycrHr3r�rrr)r*r��rzmatching.<locals>.<lambda>crHr3�rrrr)r*r��rcrHr3rnrrr)r*r��rcrHr3rtrrr)r*r��rcrHr3)r8rrr)r*r��rcrHr3)rrrr)r*r��rcrHr3)rarrr)r*r��rcs
�|jSr3)�substaterrr)r*r��s
cs�|����dSrJ)ru�
splitlinesrrr)r*r��rcs"t�|jt��jddi�d��S)NsgitT)r�)rLr�r�diffalloptsr�rrr)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)r0rr)r*rm	rz.matching.<locals>.<lambda>.<locals>.<listcomp>r)r)�
getfieldfuncsrr*r�	scsJ�D] }�|�}d}t��D]\}}||||�krd}q|r"dSqdSr�)�	enumerate)r(r.r`rrHr�)r��getinfor�r)r*r@	s��zmatching.<locals>.matchess<matching%r %r>r�)rrr+r>rRr��splitr}r�rrL�sortr�rr#r�)r&r'r(rl�	fieldlist�fieldsr=r��_funcs�info�getfieldr@r))r�r�r�r&r�r*�matching�sd��	











���r�sreverse(set)cCs"t||||�}|tkr|��|S)zReverse order of set.)r+rSr)r&r'r(r"rlr)r)r*r	srs
roots(set)cs8t|t|�|��|jj���fdd�}|�j|dd�@S)z2Changesets in set with no parent changeset in set.cs(�|�D]
}d|kr|�vrdSqdS)NrFTr))r0rb�rr�r)r*r�#	s
�zroots.<locals>.filters<roots>r�)r+r>rKr�r�)r&r'r(r�r)r�r*rw	srwcC�|��Sr3r��r�r)r)r*r�.	rjr�cCr�r3rtr�r)r)r*r�/	rjcCr�r3r�r�r)r)r*r�0	rjcCr�r3r�r�r)r)r*r�1	rjcCs|��dSrJrnr�r)r)r*r�2	r)�revr�sdescr�r�r�snodecCst|dd�}d|vrt�td���d}d|vr t|dtd��}g}|��D],}|}|�d�}|r7|d	d
�}|tvrK|dkrKt�td�t�	|���|�
||f�q&t|�d	kritd
d�|D��rit�td���i}d|vr�t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 %rcs��|]	\}}|dkVqdS�r�Nr)�rlr�rr)r)r*r2N	r�z_getsortargs.<locals>.<genexpr>s7topo sort order cannot be combined with other sort keys�topo.firstbranchcsr�r�r)r�r)r)r*r2V	r�s>topo.firstbranch can only be used when using the topo sort key)
r�rr#rr�r�r!�
_sortkeyfuncsr�bytestrr}rRr9)r(r�rq�keyflagsr��fkrr�r)r)r*�_getsortargs7	s>
����r�ssort(set[, [-]key... [, ...]])cst|�\}}}t�|||�}|r|tkr|St|�dkr0|dddkr0|j|ddd�|S|dddkr_d}d|vrFt�||d�}tt�|�jj	|�dd	�}|ddr]|�
�|S�fd
d�|D�}	t|�D]
\}
}|	jt|
|d�qltd
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�)rr�r)r�T)�istopocsg|]}�|�qSr)r)rkrr)r*rm�	rzsort.<locals>.<listcomp>)r�rcSrr)r)rlr�r)r)r*rm�	r)
r�r+rSrRr�r?r
�toposortrKr�r�reversedr�)r&r'r(r"r�r�r�r��firstbranch�ctxsr�rr)rr*r�d	s,�r�ssubrepo([pattern])cspt|ddtd��}d�t|�dkrt|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�rbrGr)r�r)r*�
submatches�	s���zsubrepo.<locals>.submatchescs��|}�j|����|���d�}�dur|jp|jp|jS|jr+t�|j����S|jrWt	|��j���}|�
|j����|�D]}|��j�|�|j�|�krVdSqC|jret�|��j����SdS)N)rTF)r�r�r:r�r&r|r9r�rqr�r~r�)r(r�r��subsr��rGr�r&r�r)r*r@�	s �zsubrepo.<locals>.matchess<subrepo %r>r�)rrrRr�r4�exactr�)r&r'r(r�r@r)r�r*�subrepo�	sr�csX|��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.
    crBr)r)r()�torevr)r*r�	rz!_mapbynodefunc.<locals>.<setcomp>c3r/r3r)rk)�tonoder)r*r2�	r3z!_mapbynodefunc.<locals>.<genexpr>N)	�
unfilteredrKr��get_revr:rrr?�filteredrevs)r&r�r�r�r6r))r�r�r*�_mapbynodefunc�	s
$
r�ssuccessors(set)cs0t�t��|�}�fdd�}t�||�}||@S)zNAll successors for set, including the given set themselves.
    (EXPERIMENTAL)cst��j|�Sr3)r�
allsuccessors�obsstore)r,rr)r*r��	rtzsuccessors.<locals>.<lambda>)r+r>r�)r&r'r(r�r��dr)rr*�
successors�	sr�csNtj�|d�\}�}|dkr"|st�����fdd�}n�fdd�}|�|fS)Nr�rcs�t�|�vSr3r�r��r�r)r*r��	rtz#_substringmatcher.<locals>.<lambda>cs�|vSr3r)r�r�r)r*r��	rj)rrr
r�)r�r�r�r�r)r�r*r��	s�

r�stag([name])cs�t|ddtd��}|j�|rSt|dtd��}t�|�\}}�|dkrC|jj�|d�}|dur8t	�
td�|��||��h}||@S��fdd	�|��D�}||@S�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 stringrNstag '%s' does not existcs"h|]
\}}�|�r��|��qSr)r�rlrrH�r�r�r)r*r
�"ztag.<locals>.<setcomp>cs"h|]
\}}|dkr��|��qS)stiprr�r�r)r*r
r�)
rrrKr�rr�
_tagscache�tagsr�rr/r.�tagslist)r&r'r(r�r�r��tnr�r)r�r*�tag�	s(�
���r�staggedcCr�r3)r�r�r)r)r*�tagged
r�r�sorphan()cCr#)z?Non-obsolete changesets with obsolete ancestors. (EXPERIMENTAL)rsorphan takes no arguments�orphanr%)r&r'r(�orphanr)r)r*r�
r�r�s
unstable()cCsVt|ddd�t�}|�t�|d��|�t�|d��|�t�|d��|t|�@S)z-Changesets with instabilities. (EXPERIMENTAL)rsunstable takes no argumentsr�r$r�)rr�r~r&r'r?)r&r'r(�	_unstabler)r)r*�unstable
sr�suser(string)cCr�)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�"
sr�swdir()cCs4t|ddtd��t|vst|t�rttg�St�S)z!Working directory. (EXPERIMENTAL)rswdir takes no arguments)rrr	r=r>r?r�r)r)r*�wdir,
s
r�c
	Cs�t|d�}|s
t�S|j}g}t�}|�d�D]I}zt|�}d||ks(||vr*t�|g}	Wnty>t|||t�}	Ynw|	D]}||vrHqA||vsU|t	vrZt
|t�rZ|�|�|�
|�qAqt|�S)N�internal error�s%d)r�r?rKr�r�rkrr@rSr<r=r>r}r�)
r&r'r(r�r�r��seenrr0r�r)r)r*�_orderedlist6
s4

��
�
r�s_listcC�(|tkr|t|t|�|�@St|||�Sr3)rAr�r>r%r)r)r*�_listW
�r�csBt|d���s
t�Sdd���d�D�}|�t�fdd�|D��S)Nr�cSsg|]}t|��qSr))rkrkr)r)r*rmd
rz#_orderedintlist.<locals>.<listcomp>r�c�g|]}|�vr|�qSr)r)rkr�r)r*rmf
r)r�r?r��r&r'r(r�r)r�r*�_orderedintlist`
s
r�s_intlistcCr�r3)rAr�r>r%r)r)r*�_intlistj
r�r�csLt|d���s
t�S|j��fdd���d�D�}|�t�fdd�|D��S)Nr�csg|]	}��t|���qSr))r.rrkr�r)r*rmx
sz#_orderedhexlist.<locals>.<listcomp>r�cr�r)r)rkr�r)r*rmz
r)r�r?rKr�r�r))r�r�r*�_orderedhexlists
s
r�s_hexlistcCr�r3)rAr�r>r%r)r)r*�_hexlist~
r�r�sranger|srangepres	rangepostsdagranger�ssymbolsands	andsmally�orsnots
differencesrelationsrelsubscripts	subscript�listskeyvalue)sfuncsancestorsparents
parentpostssmartset)�gsgenerationscs�fdd�}|S)Ncs.zt��|�WStjyt�d|��w)Ns!ambiguous revision identifier: %s)r�isrevsymbolr�AmbiguousPrefixLookupError�
InputError)�symbolrr)r*r��
s��zlookupfn.<locals>.fnr))r&r�r)rr*�lookupfn�
sr�cCst||g|d�S)z+Create a matcher for a single revision specrG)�matchany)r��specrHr)r)r*r�
r_rcs�|s	d
dd�}|St|�st�td���t|�dkr#t�|d��}nddt�fd	d
�|D��f}g}d}|rC|�|�	d��|j
}|rL|�|���|rVtj|||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)rlr�rGr)r*r2�
r�zmatchany.<locals>.<genexpr>srevsetalias)�warnr3)�allrr#rrRrr��tupler��configitemsr�r��
expandaliases�
foldconcat�analyze�optimize�makematcher)r��specsrH�
localaliasr��tree�aliasesr�r)rGr*r��
s.

�


r�csd�fdd�	}|S)z)Create a matcher from an evaluatable treeNcs8|dur
|durt}nt}|durt|�}t||�|�Sr3)rSrAr>r+)r&r'r"�r�r)r*r��
szmakematcher.<locals>.mfuncrvr))r�r�r)r�r*r��
s
r�cCs2t�|j�D]\}}|t|<|jrt�|�qdS)z2Load revset predicates from specified registrarobjN)rr	�_tabler��_safe�safesymbolsr�)r��extname�registrarobjrr�r)r)r*�
loadpredicate�
s
��r�)FNN)F)Tr3rv)��
__future__rr��i18nrrrr:rrr	rTr
rrr
rrr�rrr4rr&rrrrrrrrrrgr�utilsrrr ror�r�r�rer�rr�r?r�rQr>r<rXrSrAr+r2r8r@rBrIrMrNrOrCrVr[r\r_rarfrgrur{rr}r�r�r�r�r�r�r�r�r�	predicater�r�r�r�r�r�r�r�r�r�r�r�rrr(r,r�rGr�rJrOrPr[r^rermrorvrxryrzr�r�r�r�r�r�r-r�rDr�r�r�r�r�r�r�r�rr�r
rr�rErr!r%rEr'r/r�r7r8r?rDrWr�rFrYrr^rarcrfrlrmrorwrxr{r}r.r~r�rrwr:�binnoder�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$rpr�r�r�r�r�r
�
i18nfunctionsr)r)r)r*�<module>s�X(				




�












%

3


%



















�



!


/

)

+





!
?



	
�
E






Z


















%
 -"%





�-
�.,	
		!
��������	�
���
�����
���)	

https://t.me/RX1948 - 2025