Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/changegroup.pyc

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


�
�c@sddklZddkZddkZddkZddkZddkZddkZd�Zd�Z	d�Z
d�Zdefd��YZ
hd	e
fd	<d
e
fd
<dd�fd
<dd�fd<Zdd
d
gZd�Zd�Zd�ZdS(i�(t_NcCs�|id�}|pdSntid|�d}|djodSn|i|d�}t|�|djo-titd�t|�|df��n|S(sget a chunk from a changegroupits>lis7premature EOF reading chunk (got %d bytes, expected %d)(treadtstructtunpacktlentutiltAbortR(tsourcetdtl((s(/sys/lib/python/mercurial/changegroup.pytgetchunks
ccs'x t|�}|pPn|VqdS(s$iterate through the chunks in sourceN(R(Rtc((s(/sys/lib/python/mercurial/changegroup.pyt	chunkiters
cCstid|d�S(s build a changegroup chunk headers>li(Rtpack(tlength((s(/sys/lib/python/mercurial/changegroup.pytchunkheader#scCstidd�S(Ns>li(RR(((s(/sys/lib/python/mercurial/changegroup.pyt
closechunk'st
nocompresscBseZd�Zd�ZRS(cCs|S(N((tselftx((s(/sys/lib/python/mercurial/changegroup.pytcompress+scCsdS(NR((R((s(/sys/lib/python/mercurial/changegroup.pytflush-s(t__name__t
__module__RR(((s(/sys/lib/python/mercurial/changegroup.pyR*s	RtHG10UNtHG10cCs
ti�S((tbz2t
BZ2Compressor(((s(/sys/lib/python/mercurial/changegroup.pyt<lambda>3stHG10BZtHG10GZcCs
ti�S((tzlibtcompressobj(((s(/sys/lib/python/mercurial/changegroup.pyR4sc	Cs�d
}d
}zv|ot|d�}n1tidddd�\}}ti|d�}|}t|\}}|i|�|�}t}	d}
x�|	p
|
djo�t	}	|
d7}
x�t
|�D]|}t}	|i|itt
|����d}xE|t
|�jo1|d}
|i|i|||
!��|
}q�q�W|i|it���q�W|i|i��d
}|SWd
|d
j	o|i�n|d
j	oti|�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(tNonetopenttempfiletmkstemptostfdopentbundletypestwritetFalsetTrueR
RRRRRtclosetunlink(tcgtfilenamet
bundletypetfhtcleanuptfdtheadert
compressortztemptytcounttchunktpostnext((s(/sys/lib/python/mercurial/changegroup.pytwritebundle:sB	
	

"


cs�djo|SnX�id�p�fd�}n5�djo
d�}n�djo
d�}nti||��S(NRtHGc3s�Vx|D]}|VqWdS(N((tfR<(R7(s(/sys/lib/python/mercurial/changegroup.pyt	generatorssRcss/ti�}x|D]}|i|�VqWdS(N(R t
decompressobjt
decompress(RAtzdR<((s(/sys/lib/python/mercurial/changegroup.pyRBxsRcssHti�}|id�x(ti|d�D]}|i|�Vq,WdS(NtBZi(RtBZ2DecompressorRDRt
filechunkiter(RARER<((s(/sys/lib/python/mercurial/changegroup.pyRB}s

(t
startswithRtchunkbuffer(R7R4RB((R7s(/sys/lib/python/mercurial/changegroup.pytunbundlens




cCs�|id�}|id�ptitd�|��n|id�ptitd�|��n+|tjotitd�|��nt||�S(NiR@s%s: not a Mercurial bundle fileRs%s: unknown bundle versions#%s: unknown bundle compression type(RRIRRRR+RK(R4tfnameR7((s(/sys/lib/python/mercurial/changegroup.pyt
readbundle�s
(ti18nRRRR)RR R'RR
RRtobjectRR+tbundlepriorityR?RKRM(((s(/sys/lib/python/mercurial/changegroup.pys<module>s <					4	

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.