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

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


��c@s�dZddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZdejfd��YZdeejfd��YZd	eejfd
��YZdeejfd��YZd
ejfd��YZdejfd��YZd�Zdded�ZdS(s�Repository class for viewing uncompressed bundles.

This provides a read-only repository interface to bundles as if they
were part of the actual repository.
i�(tnullid(t_NtbundlerevlogcBsYeZd�Zd�Zd�Zd�Zdddd�Zd�Zd�Z	d�Z
RS(	cCstj|�}tjj|||�||_t|�}|d|_d}t�|_	x�t
r|j|�}|s{Pn|d}|d}	|d}
|d}|d}|d}
t|
�}|j�|}||�}||j
kr|}|j	j|j
|�q\nxD|	|
fD]6}||j
krtj||jtd���qqW||j
kr�t||jtd	���n|j|�}tj|d
�|d|||j|	�|j|
�|f}|jjd|�||j
|<|j	j|�|}|d7}q\WdS(Nitnodetp1tp2tcst	deltabasetdeltasunknown parentsunknown delta baseii�(tscmutiltreadonlyvfstrevlogt__init__tbundletlent
repotiprevtNonetsett
bundlerevstTruet
deltachunkttelltnodemaptaddterrortLookupErrort	indexfileRtrevtoffset_typetindextinsert(tselftopenerRR
t
linkmappertntchaint	chunkdataRRRRRRtsizetstarttlinktptbaserevte((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRsN	
	





!
cCsT||jkr"tjj||�S|jj|j|��|jj|j|��S(N(RRt_chunkR
tseekR&treadtlength(RR((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR+LscCs�||jkrK||jkrK|j|d}||kr|j|�Sn4||jkr||jkrtjj|||�Stj|j|j|��|j|j|���S(s1return or calculate a delta between two revisionsi(	RRR+RtrevdifftmdiffttextdifftrevisionR(Rtrev1trev2trevb((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR/UscCsCt|t�r'|}|j|�}n|}|j|�}|tkrLdSd}g}|}x^||jkr�|jr�|jd|kr�|jd}Pn|j|�|j	|d}qaW|dkr�
j
j||�}nx4|r|j|j
��}tj||g�}q�|j|||�|||f|_|S(sTreturn an uncompressed revision of a given node or revision
        number.
        tiiiN(t
isinstancetintRRRRRt_cachetappendRRR2R+tpopR0tpatchest
_checkhash(Rt	nodeorrevRRttextR#titerrevR((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR2bs0

	cCs
t�dS(N(tNotImplementedError(RR?ttransactionR'RRtd((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytaddrevision�scCs
t�dS(N(RA(RtrevsR!RB((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytaddgroup�scCs
t�dS(N(RA(RRtminlink((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytstrip�scCs
t�dS(N(RA(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyt	checksize�sN(t__name__t
__module__RR+R/R2RRDRFRHRI(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRs	7			
	#		tbundlechangelogcBseZd�ZRS(cCs<tjj||�d�}tj|||j||�dS(NcSs|S(N((tx((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyt<lambda>�s(t	changelogRRR(RR R
R!((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR�s	(RJRKR(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRL�stbundlemanifestcBseZd�ZRS(cCs3tjj||�tj|||j||�dS(N(tmanifestRRR(RR R
R!((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR�s(RJRKR(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRP�st
bundlefilelogcBseZd�Zd�ZRS(cCs?tjj|||�tj|||j||�||_dS(N(tfilelogRRRt_repo(RR tpathR
R!trepo((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR�scCs|jj|�dS(N(RTtfile(Rtf((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyt_file�s(RJRKRRY(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRR�s	t
bundlepeercBseZd�ZRS(cCstS(N(tFalse(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytcanpush�s(RJRKR\(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRZ�stbundlerepositorycBs�eZd�Zejd��Zejd��Zejd��Zejd��Zd�Z	d�Z
d�Zd�Zd	�Z
d
�ZRS(c	Cs�d|_ytjj|||�WnRtjk
rwtj�|_tj	||jd�tjj|||j�nX|j
jddt�|r�dt
j|�d||_n
d||_d|_t
j|d�}tj||�|_|jj�r�tjddd	d
d|j�\}}||_tj|d�}zG|jd
�x3tr�|jjd�}|sxPn|j|�qVWWd|j�Xt
j|jd�}tj||�|_ni|_dS(Nitphasestpublishsbundle:t+trbtprefixs
hg-bundle-tsuffixs.hg10untdirtwbtHG10UNiii(Rt_tempparentt	localrepotlocalrepositoryRRt	RepoErrorttempfiletmkdtemptinstancetuit	setconfigR[tutilt
expandpatht_urlt	posixfiletchangegroupt
readbundleR
t
compressedtmkstempRUtostfdopentwriteRR-tclosetbundlefilespos(	RRnRUt
bundlenameRXtfdtempttemptfptemptchunk((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR�s<	!
		
	cCs8|jj�t|j|j�}|jj�|_|S(N(R
tchangelogheaderRLtsopenerRtmanstart(Rtc((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRO�s
cCsT|jj|j�|jj�t|j|j|jj�}|jj�|_	|S(N(
R
R,R�tmanifestheaderRPR�RORRt	filestart(Rtm((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRQ�s

cCs|j|jS(N(ROR�(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR��scCs|j|jS(N(RQR�(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR��scCs|jS(N(Rr(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyturl�scCs�|js�|jj|j�xotr�|jj�}|s>Pn|d}|jj�|j|<x&tr�|jjd�}|saPqaqaWqWn||jkr�|jj|j|�t	|j
||j|jj|�St
j
|j
|�SdS(Ntfilename(R|R
R,R�Rt
filelogheaderRRRRRR�RORRS(RRXR$tfnameR�((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRW�s"		
	cCsR|jj�|jdk	r/tj|j�n|jrNtj|jt	�ndS(s'Close assigned bundle file immediately.N(
R
R{RkRRxtunlinkRgtshutiltrmtreeR(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR{s

	cCstS(N(R[(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytcancopy
scCs
t|�S(N(RZ(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytpeerscCs
tj�S(N(Rxtgetcwd(R((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR�s(RJRKRRhtunfilteredpropertycacheRORQR�R�R�RWR{R�R�R�(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyR]�s	(						c	CsU|rtjtd���n|jddd�}|sftjtj��}|dkrfd}qfn|r�tj�}||kr�d}q�tj	j
|d�}|j|�r�|t|�}q�ntj
|�}|j�}|jdkr8|jdd�}t|�dkr)||d}}qE|\}}n
||}}t|||�S(Ns#cannot create new bundle repositoryR
tmainreporootR6R`ii(RptAbortRtconfigtcmdutiltfindrepoRxR�RRUtjoint
startswithRR�t	localpathtschemetsplitR](	RnRUtcreatet
parentpathtcwdtutstrepopathR}((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyRms.	
cs�tj|�d|d|�}|\}}}	|sqy|rLtj|�nWntk
r`nX|g�jfSd
�d
��j�}
|s�|
r}�jd�r��j	dd|d|	�}nL|d
kr�jd�r�j
|d�}d
}	n�j||	d�}|
rdpd}t
j|||�}
�|rId
�n|
s}t
|j|j|
�}
�|j�}q}n|
r�|
j�}
n|
jj||	�}���fd	�}|
||fS(sGobtains a bundle of changes incoming from other

    "onlyheads" restricts the returned changes to those reachable from the
      specified heads.
    "bundlename", if given, stores the bundle to this file path permanently;
      otherwise it's stored to a temp file and gets deleted again when you call
      the returned "cleanupfn".
    "force" indicates whether to proceed on unrelated repos.

    Returns a tuple (local, csets, cleanupfn):

    "local" is a local repo from which to obtain the actual incoming
      changesets; it is a bundlerepo for the obtained bundle when the
      original "other" is remote.
    "csets" lists the incoming changeset node ids.
    "cleanupfn" must be called without arguments when you're done processing
      the changes; it closes both the original "other" and the one returned
      here.
    theadstforcet	getbundletincomingtcommontchangegroupsubsettHG10BZRfcs7�r�j�n�r)tj��n�j�dS(N(R{RxR�((R
t
bundlerepotother(s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytcleanupws

N(t	discoverytfindcommonincomingRxR�tOSErrorR{RtlocaltcapableR�RtR�twritebundleR]tbaseuitrootR�t
unfilteredROtfindmissing(RnRVR�t	onlyheadsR}R�ttmpR�R�trheadsRhtcgt
bundletypeR�tcsetsR�((R
R�R�s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pytgetremotechanges6sB	

		
( t__doc__RRti18nRRxRkR�RtRpR0R�R�R	RhRORQRSRRRRLRPRRt	localpeerRZRiR]RmRR[R�(((s8/sys/lib/python2.7/site-packages/mercurial/bundlerepo.pyt<module>s$HHz
n	

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.