Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/ancestor.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s]ddlZddlZddlmZd�Zd�Zd�Zdefd��YZdS(i�N(tnullrevcs�t|t�st|�}nt|kr1t�St|�dkrG|S�fd�}�fd�}||�}t|�dkr�|S||�S(s�
    Returns the common ancestors of a and b that are furthest from a
    root (as measured by longest path).

    pfunc must return a list of parent vertices for a given vertex.
    ics%dt|�>d}dgt|�d}x(t|�D]\}}d|>||<q8Wd|d>}t�}t|�}}t|�d}	x�|	dkr |r |	}
|	d8}	||
s�q�n||
}||kr=|d8}||kr=|j|
�||O}|
|kr:|d8}|dkr7t|
g�Sq:q=n||kr�x��|
�D]d}||}
|tkrxqVn|
dkr�|||<|d7}qV|
|krV||c|O<qVqVWq�xY�|
�D]K}|tkr��n||}
|
r|
|kr|d8}n|||<q�Wq�W|S(Nii(tlentmaxt	enumeratetsettaddR(tnodestallseentseentitntpoisontgcatinterestingtlefttnvtvtsvtptsp(tpfunc(s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyt
candidatessR	











cs�i}t|�d}dg|}dg|}g}x[tt|��D]G\}}d||<d|>}|||<d||<|j||f�qIW|d}	x�|	dkrct|�dkrc|	}
|	d8}	||
}|dkr��n||
}x>�|
�D]0}
|
tkrqn||
}||
}}||kr�|d||
<||kr2||cd7<|}||
<|r�||cd8<||dkr�||=q�q�q2q||dkr||B}||kr�qn|||
<|j|d�||cd7<||cd8<||dkr2||=q2qqW||cd8<||dkr�||=q�q�Wt|�dkrzgSd�x|D]}�|O�q�Wt�fd�|D��S(Niic3s%|]\}}�|@r|VqdS(N((t.0R	R
(tk(s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pys	<genexpr>}s(RRtsortedtappendRRt
setdefaultR(RR
tcounttdepthRtmappingR	R
tbRRtdvRRtdptnspR(R(Rs6/sys/lib/python2.7/site-packages/mercurial/ancestor.pytdeepestGsh






!






(t
isinstanceRRR(Rt	orignodesRR"R((Rs6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyt	ancestorss.8c
s<||kr|St||g�\}}i�||g}i�x�r9|d}g||�D]}|tkr`|^q`}|�|<|s�d�|<|j�qCxF|D]>}||ks�||kr�|S|�kr�|j|�q�q�W|d|krCtg|D]}�|^q�d�|<|j�qCqCW��fd���fd�}||�}||�}	|j�}
|	j�}y�x�tr!|
d|dkr�&|
dD]}||dkr�|Sq�W|	j�}|j�}
q�|
d|dkr|	j�}q�|j�}
q�WWntk
r7dSXdS(s:
    Returns the common ancestor of a and b that is furthest from a
    root (as measured by longest path) or None if no ancestor is
    found. If there are multiple common ancestors at the same
    distance, the first one found is returned.

    pfunc must return a list of parent vertices for a given vertex
    i�iic3s��||fg}t�}xu|r�tj|�\}}||kr|j|�||fVx/�|D] }tj|�||f�qiWqqWdS(N(RtheapqtheappopRtheappush(tvertexthRtdR
R(Rtparentcache(s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyR%�s		
c3s�dt�}}x`�|�D]R\}}||krb|rI||fVn|t|f�}}q|j|�qW||fVdS(N(tNoneRR(R)tsgtstgR(R%(s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pytgenerations�sN(	RRtpopRtmintnexttTruet
StopIterationR-(
taRRtvisitR)RtplR1txtytgxtgyR((R%RR,s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pytgenericancestor�sP
	
+



+	
cCs�t|�}t|�}|s"gS|s8|jt�ntt|�t|��}|j|�}|j|�|j|�g}xIt|td�D]5}|s�Pn||kr|j|�x;||�D]-}	|j|	�|j|	�|j|	�q�Wq�n||kr*|j	|�|}
|}n||kr�|}
|}nq�|
j|�xr||�D]d}	|	tkrwqb|	|ks�|	|kr�|j|	�|j|	�|j|	�qb|
j|	�qbWq�W|j
�|S(s\Return all the ancestors of revs that are not ancestors of bases.

    This may include elements from revs.

    Equivalent to the revset (::revs - ::bases). Revs are returned in
    revision number order, which is a topological order.

    revs and bases should both be iterables. pfunc must return a list of
    parent revs for a given revs.
    i�(RRRRtintersectiontdifference_updatetxrangetremovetdiscardRtreverse(trevstbasesRt	revsvisitt
basesvisittstartt	bothvisittmissingtcurrRt	thisvisitt
othervisit((s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pytmissingancestors�sP





		



t
lazyancestorscBs)eZded�Zd�Zd�ZRS(icCs||j|_||_||_||_g|D]
}|^q.|_tj|j�|rlt|�|_	nt�|_	dS(s�Create a new object generating ancestors for the given revs. Does
        not generate revs lower than stoprev.

        This is computed lazily starting from revs. The object supports
        iteration and membership.

        cl should be a changelog and revs should be an iterable. inclusive is
        a boolean that indicates whether revs should be included. Revs lower
        than stoprev will not be generated.

        Result does not include the null revision.N(
t
parentrevst_parentrevst	_initrevst_stoprevt
_inclusivet_containsvisitR&theapifyRt
_containsseen(tselftclREtstoprevt	inclusivetrev((s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyt__init__*s			ccs�t�}|j}|jrAx|D]}|Vq"W|j|�n|j}|j}tj|�}xa|r�xT||j��D]@}||kr~||kr~|j	|�|j
|�|Vq~q~WqeWdS(seGenerate the ancestors of _initrevs in reverse topological order.

        If inclusive is False, yield a sequence of revision numbers starting
        with the parents of each revision in revs, i.e., each revision is *not*
        considered an ancestor of itself.  Results are in breadth-first order:
        parents of each rev in revs, then parents of those, etc.

        If inclusive is True, yield all the revs first (ignoring stoprev),
        then yield all the ancestors of revs as when inclusive is False.
        If an element in revs is an ancestor of a different rev it is not
        yielded again.N(RRSRUtupdateRRRTtutiltdequetpopleftRR(RYRRER]RQR[R8tparent((s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyt__iter__Hs			
				

c
Cs�|j}||krtS|j}|j}|j}tj}tj}t}x�|r�|d|kr�|r�xi|||��D]T}	|	|ks�|	|kr�q�n|||	�|j	|	�|	|kr�t}q�q�WqOW|S(s5Test whether target is an ancestor of self._initrevs.i(
RXR5RRRVRTR&R'R(tFalseR(
RYttargetRRQR8R[R'R(t
targetseenRc((s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyt__contains__fs$						!
(t__name__t
__module__ReR^RdRh(((s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyRP)s	(	R&R`tnodeRR%R>ROtobjectRP(((s6/sys/lib/python2.7/site-packages/mercurial/ancestor.pyt<module>s
	z	S	Q

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.