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

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


�ڧOc@sdddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dZd�Zd�Z
d�Zd�Zd	efd
��YZidefd6defd6d
d�fd6dd�fd6ZdddgZd�Zd�Zdefd��YZdefd��YZd�Zdefd��YZdS(i�(t_(tnullrevNt20s20s20s20scCsM|j|�}t|�|krItjtd�t|�|f��n|S(s=read n bytes from stream.read and abort if less was availables5stream ended unexpectedly (got %d bytes, expected %d)(treadtlentutiltAbortR(tstreamtnts((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytreadexactlys
cCsht|d�}tjd|�d}|dkrW|rStjtd�|��ndSt||d�S(s-return the next chunk from stream as a stringis>lisinvalid chunk length %dt(R
tstructtunpackRRR(Rtdtl((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytgetchunkscCstjd|d�S(s*return a changegroup chunk header (string)s>li(Rtpack(tlength((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytchunkheader"scCstjdd�S(sBreturn a changegroup chunk header (string) for a zero-length chunks>li(RR(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt
closechunk&st
nocompresscBseZd�Zd�ZRS(cCs|S(N((tselftx((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytcompress+scCsdS(NR((R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytflush-s(t__name__t
__module__RR(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR*s	RtHG10UNtHG10cCs
tj�S(N(tbz2t
BZ2Compressor(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt<lambda>5stHG10BZtHG10GZcCs
tj�S(N(tzlibtcompressobj(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR 6scCs�d
}d
}z{|r't|d�}n0tjdddd�\}}tj|d�}|}t|\}}|j|�|�}t}	d}
x�|	s�|
dkrht	}	|
d7}
x�t	rKt
|�}|s�Pnt}	|j|jtt
|����d}xC|t
|�krG|d}
|j|j|||
!��|
}qWq�W|j|jt���q�W|j|j��d
}|SWd
|d
k	r�|j�n|d
k	r�tj|�nXd
S(s�Write a bundle file and return its filename.

    Existing files will not be overwritten.
    If no filename is specified, a temporary file is created.
    bz2 compression can be turned off.
    The bundle file will be deleted in case of errors.
    twbtprefixs
hg-bundle-tsuffixs.hgiiiiNi(tNonetopenttempfiletmkstemptostfdopentbundletypestwritetFalsetTrueRRRRRRtclosetunlink(tcgtfilenamet
bundletypetfhtcleanuptfdtheadert
compressortztemptytcounttchunktpostnext((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytwritebundle<sF	
	
	"

cCsf|dkr|S|dkr(d�}n+|dkr@d�}ntjd|��tj||��S(NtUNtGZcss8tj�}x%tj|�D]}|j|�VqWdS(N(R#t
decompressobjRt
filechunkitert
decompress(tftzdR?((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt	generatorwstBZcssHtj�}|jd�x(tj|d�D]}|j|�Vq,WdS(NRKi(RtBZ2DecompressorRGRRF(RHRIR?((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRJ|s
sunknown bundle compression '%s'(RRtchunkbuffer(R7talgRJ((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytdecompressorsst
unbundle10cBs�eZeZeje�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�ZRS(cCs(t||�|_||_d|_dS(N(ROt_streamt_typeR(tcallback(RR7RN((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt__init__�s	cCs
|jdkS(NRC(RR(R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt
compressed�scCs|jj|�S(N(RQR(RR((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR�scCs|jj|�S(N(RQtseek(RR@((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRV�scCs
|jj�S(N(RQttell(R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRW�scCs
|jj�S(N(RQR2(R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR2�scCsxt|jd�}tjd|�d}|dkrZ|rVtjtd�|��ndS|jrp|j�n|dS(Nis>lisinvalid chunk length %d(R
RQRR
RRRRS(RRR((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytchunklength�s	
cCsiS(s*v10 does not have a changelog header chunk((R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytchangelogheader�scCsiS(s)v10 does not have a manifest header chunk((R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytmanifestheader�scCs5|j�}|siSt|j|�}td|�S(sBreturn the header of the filelogs chunk, v10 only has the filenameR5(RXR
RQtdict(RRtfname((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt
filelogheader�s
cCs@|\}}}}|dkr'|}n|}|||||fS(N(R((Rtheadertupletprevnodetnodetp1tp2tcst	deltabase((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt_deltaheader�s
	c
Cs�|j�}|siSt|j|j�}tj|j|�}t|j||j�}|j||�\}}}}	}
td|d|d|d|
d|	d|�S(NR`RaRbRcRdtdelta(	RXR
RQtdeltaheadersizeRR
tdeltaheaderReR[(RR_Rt
headerdataR:RfR`RaRbRdRc((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt
deltachunk�s!(RRt_BUNDLE10_DELTA_HEADERRhRtcalcsizeRgRTRURRVRWR2RXRYRZR]ReRj(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRP�s											theaderlessfixupcBseZd�Zd�ZRS(cCs||_||_dS(N(t_ht_fh(RR7th((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRT�s	cCsp|jr`|j| |j|}|_t|�|kr\|t|j|t|��7}n|St|j|�S(N(RnRR
Ro(RRR((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR�s	#(RRRTR(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRm�s	cCs�t|d�}|sUd}|jd�rU|jd�rUt||�}d}qUn|dd!|dd!|dd!}}}|dkr�tjtd	�|��n|d
kr�tjtd�||f��nt||�S(NiRtHGtRiiis%s: not a Mercurial bundlet10s%s: unknown bundle version %s(R
t
startswithRmRRRRP(R7R\R:tmagictversionRN((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt
readbundle�s)"tbundle10cBs;eZeZd�Zd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(t_lookup(Rtlookup((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRT�scCst�S(N(R(R((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR2�scCstt|��|S(N(RR(RR\((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt
fileheader�sccs�|j|�}|j|�\}}|}d}|tkrc|j|�}	tjt|	��}n|j||�}	|j||�}
|j	|�\}}|j|�}
|j
||||
|
�}||7}t|�t|	�}t|�V|V|	VdS(NR(R`t
parentrevsRtrevisiontmdiffttrivialdiffheaderRtrevdiffRytparentstbuilddeltaheaderR(RtrevlogtrevtprevR`RaRbtbaseR&Rftlinknodetp1ntp2ntbasenodetmetaR((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pytrevchunk�s"
cCstj|j||||�S(N(RRRh(RR`R�R�R�R�((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyR��s(	RRRkRhRTR2R{R�R�(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyRx�s				(ti18nRR`RR~RRR,RR#R*RkR
RRRtobjectRR.tbundlepriorityRBRORPRmRwRx(((s9/sys/lib/python2.7/site-packages/mercurial/changegroup.pyt<module>s*<			
		

	7	@	

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.