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

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


��c@s{ddlmZmZmZmZddlZddlZddlZd�Zd�Z	d�Z
defd��YZdS(i�(tbinthextnullidtnullrevNcCs)d}|jr%d||jf}n|S(s7name of a branchcache file for a given repo or repoviewscache/branchheadss%s-%s(t
filtername(trepotfilename((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyt	_filenames	c
Csy8|jt|��}|j�jd�}|j�Wnttfk
rRdSXy4|jd�jdd�}|d \}}t	|�t
|�}}d}t|�dkr�t	|d�}ntd|d|d|�}|j
|�s�d��nx�|D]}}|sqn|jdd	�\}	}
tj|
j��}
|	|krctd
|	��n|j|
g�jt	|	��qWWn�tk
r��notk
r}|jjrd}|jdk	r�d|j7}n|d
7}|jj||�nd}nX|S(Ns
it ittipnodettiprevtfilteredhashstip differsisnode %s does not existsinvalid branchheads caches (%s)s: %s
(topenerRtreadtsplittclosetIOErrortOSErrortNonetpopRtinttlentbranchcachetvalidfort
ValueErrortencodingttolocaltstript
setdefaulttappendtKeyboardInterruptt	Exceptiontuit	debugflagRtwarn(
RtftlinestcachekeytlasttlrevRtpartialtltnodetlabeltinsttmsg((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR
sH	
'


csT|j}|j}|jj|��g}�dksF�j|�r�t|���dkr�tjj|�}|dkr�t	��q�|j
|�}|j�j��|jj
|j
}|j�fd�|D��q�n|j|jd�jd��|r%�j||��j|�n�j|�s@t|���|j|j<dS(Nc3s$|]}|�jkr|VqdS(N(R
(t.0tr(R((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pys	<genexpr>Mststarti(t	changelogRt
_branchcachestgetRRR
trepoviewtsubsettableRtfilteredt	branchmaptcopytfilteredrevstextendtrevsR
tupdatetwritetAssertionError(RtclRR;t
subsetnametsubsett	extrarevs((R(s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pytupdatecache=s(		# RcBsPeZdZdeedd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	s1A dict like object that hold branches heads cachecCs5tt|�j|�||_||_||_dS(N(tsuperRt__init__R	R
R(tselftentriesR	R
R((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyREXs		cs�|j}|jsdSd}t�fd�|jD��}|r~tj�}x|D]}|jd|�qTW|j�}n|S(sBbuild hash of revision filtered in the current cache

        Tracking tipnode and tiprev is not enough to ensure validity of the
        cache as they do not help to distinct cache that ignored various
        revision bellow tiprev.

        To detect such difference, we build a cache of all ignored revisions.
        c3s$|]}|�jkr|VqdS(N(R
(R.R/(RF(s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pys	<genexpr>lss%s;N(R1R9Rtsortedtutiltsha1R<tdigest(RFRR?tkeyR;tstrev((RFs7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyt
_hashfiltered_s			
cCsQy8|j|jj|j�ko6|j|j|�kSWntk
rLtSXdS(s�Is the cache content valid regarding a repo

        - False when cached tipnode is unknown or if we detect a strip.
        - True when cache is up to date or a subset of current repo.N(R	R1R*R
RROt
IndexErrortFalse(RFR((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyRts

cCst||j|j|j�S(s-return an deep copy of the branchcache object(RR	R
R(RF((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR8scCs
y�jt|�ddt�}t|j�t|j�g}|jdk	rg|j	t|j��n|j
dj|�d�xWt|j
��D]C\}}x4|D],}|j
dt|�tj|�f�q�Wq�W|j�Wntttjfk
rnXdS(Ntwt
atomictempRs
s%s %s
(RRtTrueRR	tstrR
RRRR=tjoinRHt	iteritemsRt	fromlocalRRRRItAbort(RFRR#R%R+tnodesR*((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR=�s
.cs#|j�i}�j}x6|D].}|j||�g�j�j|��qWx�|j�D]�\}}|j|g�}g|D]$}	�j|	�r��j|	�^q�}
g|D]$}	�j|	�r��j|	�^q�}|
o�|�t	|
�k}t
t|
�j|��}
|r,t
|�}
nt
|
�}
xu|
r�|
j�}||
kr_q;nt�j|g|
d��}|r;g|
D]}||kr�|^q�}
q;q;Wg|
D]}�j|�^q�||<t	|
�}||jkr^�j|�|_||_q^q^Wg}x]|j�D]O}g||D]}�j|�r7|^q7}|s&|j|�||=q&q&W|j|�s�|j|kr
t|_t|_x`|j�D]O}t	�fd�|D��}||jkr��j|�|_||_q�q�Wn|j|�|_dS(s�Given a branchhead cache, self, that may have extra nodes or be
        missing heads, and a generator of nodes that are at least a superset of
        heads missing, this function updates self to be correct.
        ic3s|]}�j|�VqdS(N(RN(R.R*(R?(s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pys	<genexpr>�sN(R1tbranchRRR*RWthasnodeRNtmintmaxRHtsettuniontlistRt	ancestorsR
R	tkeysR:RRRtvaluesROR(RFRtrevgentnewbranchest	getbranchR/R[tnewnodestbheadsR*t	bheadrevstnewheadrevstctxisnewtiterrevstlatestRbtbRNR
tdroppednodestheadRZtheads((R?s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyR<�sZ		
,
$
$	,&
		(N(t__name__t
__module__t__doc__RRRRERORR8R=R<(((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyRUs					(
R*RRRRRRIR4RR
RCtdictR(((s7/sys/lib/python2.7/site-packages/mercurial/branchmap.pyt<module>s"		*	

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.