HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyo
�
1�3\c@`s�dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZmZmZmZmZmZmZmZmZddlmZejZejZe	j Z!e	j"Z#dZ$dZ%d	Z&d
Z'dZ(dZ)dZ*ej+d
�Z,d�Z-d�Z.d�Z/d�Z0iZ1d�d�Z2de3fd��YZ4de3fd��YZ5de6fd��YZ7d�Z8dd�Z:de3fd��YZ;dddd�Z<d�Z=d �Z>d!�Z?d"�Z@d#�ZAd$�ZBid�d6d�d&6d�d'6d�d*6d�d+6ZCd+d*d'gZDd-e3fd.��YZEd/e3fd0��YZFdd1�ZGd2eFfd3��YZHieHd46ZIiZJd5�ZKeKd6�d7��ZLd8e3fd9��YZMd:ZNd;eFfd<��YZOd=e3fd>��YZPd?�ZQd@eFfdA��YZRdBeRfdC��YZSid�d&6d�dD6d�dI6d�dJ6d�dH6eTeUejVjW���dK6d�dN6d�dO6d�dP6d�dR6d�dT6ZXeYddU�ZZdV�Z[dW�Z\ddddX�Z]dY�Z^dZ�Z_d[�Z`d\�Zad]�Zbd^�Zcd_�Zddddd`�Zeda�Zfe2dbd��dg��ZgeTdhdidKggejVjW�D]Zhdjeh^q��Zie2dNei�dk��Zje2dld��do��Zke2dp�dq��Zle2dr�ds��Zme2dt�du��Zne2dv�dw��Zoe2dx�dy��Zpe2dz�d{��Zqd|ejrfd}��YZse2d~d��d���Zte2d�d��d���Zue2d�d��d���Zve2d�d��d���Zwe2dJd��d���Zxe2dHd��d���Zye2dD�d���Zze2d��d���Z{e2d�d��d���Z|e2d��d���Z}e2d�d��d���Z~e2dO�d���Ze	j�d��Z�e2d��d���Z�e2d��d���Z�e2d�d��d���Z�d��Z�dS(�s�Handling of the new bundle2 format

The goal of bundle2 is to act as an atomically packet to transmit a set of
payloads in an application agnostic way. It consist in a sequence of "parts"
that will be handed to and processed by the application layer.


General format architecture
===========================

The format is architectured as follow

 - magic string
 - stream level parameters
 - payload parts (any number)
 - end of stream marker.

the Binary format
============================

All numbers are unsigned and big-endian.

stream level parameters
------------------------

Binary format is as follow

:params size: int32

  The total number of Bytes used by the parameters

:params value: arbitrary number of Bytes

  A blob of `params size` containing the serialized version of all stream level
  parameters.

  The blob contains a space separated list of parameters. Parameters with value
  are stored in the form `<name>=<value>`. Both name and value are urlquoted.

  Empty name are obviously forbidden.

  Name MUST start with a letter. If this first letter is lower case, the
  parameter is advisory and can be safely ignored. However when the first
  letter is capital, the parameter is mandatory and the bundling process MUST
  stop if he is not able to proceed it.

  Stream parameters use a simple textual format for two main reasons:

  - Stream level parameters should remain simple and we want to discourage any
    crazy usage.
  - Textual data allow easy human inspection of a bundle2 header in case of
    troubles.

  Any Applicative level options MUST go into a bundle2 part instead.

Payload part
------------------------

Binary format is as follow

:header size: int32

  The total number of Bytes used by the part header. When the header is empty
  (size = 0) this is interpreted as the end of stream marker.

:header:

    The header defines how to interpret the part. It contains two piece of
    data: the part type, and the part parameters.

    The part type is used to route an application level handler, that can
    interpret payload.

    Part parameters are passed to the application level handler.  They are
    meant to convey information that will help the application level object to
    interpret the part payload.

    The binary format of the header is has follow

    :typesize: (one byte)

    :parttype: alphanumerical part name (restricted to [a-zA-Z0-9_:-]*)

    :partid: A 32bits integer (unique in the bundle) that can be used to refer
             to this part.

    :parameters:

        Part's parameter may have arbitrary content, the binary structure is::

            <mandatory-count><advisory-count><param-sizes><param-data>

        :mandatory-count: 1 byte, number of mandatory parameters

        :advisory-count:  1 byte, number of advisory parameters

        :param-sizes:

            N couple of bytes, where N is the total number of parameters. Each
            couple contains (<size-of-key>, <size-of-value) for one parameter.

        :param-data:

            A blob of bytes from which each parameter key and value can be
            retrieved using the list of size couples stored in the previous
            field.

            Mandatory parameters comes first, then the advisory ones.

            Each parameter's key MUST be unique within the part.

:payload:

    payload is a series of `<chunksize><chunkdata>`.

    `chunksize` is an int32, `chunkdata` are plain bytes (as much as
    `chunksize` says)` The payload part is concluded by a zero size chunk.

    The current implementation always produces either zero or one chunk.
    This is an implementation limitation that will ultimately be lifted.

    `chunksize` can be negative to trigger special case processing. No such
    processing is in place yet.

Bundle processing
============================

Each part is processed in order using a "part handler". Handler are registered
for a certain part type.

The matching of a part to its handler is case insensitive. The case of the
part type is used to know if a part is mandatory or advisory. If the Part type
contains any uppercase char it is considered mandatory. When no handler is
known for a Mandatory part, the process is aborted and an exception is raised.
If the part is advisory and no handler is known, the part is ignored. When the
process is aborted, the full bundle is still read from the stream to keep the
channel usable. But none of the part read from an abort are processed. In the
future, dropping the stream may become an option for channel we do not care to
preserve.
i(tabsolute_importtdivisionNi(t_(
t	bookmarkstchangegrouptencodingterrortnodetobsoletetphasestpushkeytpycompattstreamclonettagsturltutil(t
stringutils>is>Bs>Is>BBi�s[^a-zA-Z0-9_:-]cC`s*|jdd�r&|jd|�ndS(s(debug regarding output stream (bundling)tdevels
bundle2.debugsbundle2-output: %s
N(t
configbooltdebug(tuitmessage((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytoutdebug�scC`s*|jdd�r&|jd|�ndS(s"debug on input stream (unbundling)Rs
bundle2.debugsbundle2-input: %s
N(RR(RR((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytindebug�scC`s"tj|�rt|��ndS(s9raise ValueError if a parttype contains invalid characterN(t_parttypeforbiddentsearcht
ValueError(tparttype((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytvalidateparttype�scC`sdd|S(s�return a struct format to read part parameter sizes

    The number parameters is variable so we need to build that format
    dynamically.
    t>tBB((tnbparams((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_makefpartparamsizes�sc`s t����fd�}|S(s�decorator that register a function as a bundle2 part handler

    eg::

        @parthandler('myparttype', ('mandatory', 'param', 'handled'))
        def myparttypehandler(...):
            '''process a part of type "my part".'''
            ...
    c`s)�j�}|t|<t��|_|S(N(tlowertparthandlermappingt	frozensettparams(tfunct	lparttype(R$R(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
_decorator�s
(R(RR$R'((R$Rs7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytparthandler�s

tunbundlerecordscB`sVeZdZd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
e
ZRS(	s�keep record of what happens during and unbundle

    New records are added using `records.add('cat', obj)`. Where 'cat' is a
    category of record and obj is an arbitrary object.

    `records['cat']` will return all entries of this category 'cat'.

    Iterating on the object itself will yield `('category', obj)` tuples
    for all entries.

    All iterations happens in chronological order.
    cC`si|_g|_i|_dS(N(t_categoriest
_sequencest_replies(tself((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__init__�s		cC`s^|jj|g�j|�|jj||f�|dk	rZ|j|�j||�ndS(s�add a new record of a given category.

        The entry can then be retrieved in the list returned by
        self['category'].N(R*t
setdefaulttappendR+tNonet
getrepliestadd(R-tcategorytentryt	inreplyto((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR3scC`s|jj|t��S(s3get the records that are replies to a specific part(R,R/R)(R-tpartid((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR2scC`st|jj|d��S(N((ttupleR*tget(R-tcat((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__getitem__scC`s
t|j�S(N(titerR+(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__iter__scC`s
t|j�S(N(tlenR+(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__len__scC`s
t|j�S(N(tboolR+(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__nonzero__sN(t__name__t
__module__t__doc__R.R1R3R2R;R=R?RAt__bool__(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR)�s	
					tbundleoperationcB`s/eZdZedd�Zd�Zd�ZRS(sPan object that represents a single bundling process

    Its purpose is to carry unbundle-related objects and states.

    A new object should be created at the beginning of each bundle processing.
    The object is to be returned by the processing function.

    The object has very little content now it will ultimately contain:
    * an access to the repo the bundle is applied to,
    * a ui object,
    * a way to retrieve a transaction to add changes to the repo,
    * a way to record the result of processing each part,
    * a way to construct a bundle response when applicable.
    tcC`s[||_|j|_t�|_d|_||_i|_||_i|_	||_
dS(N(trepoRR)trecordsR1treplyt
captureoutputthookargst_gettransactiontmodestsource(R-RHttransactiongetterRKRO((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR..s						cC`sD|j�}|jr7|jj|j�|j|_nd|_|S(N(RMRLtupdateR1(R-ttransaction((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytgettransaction:s		cC`s5|jdkr!tjd��n|jj|�dS(Ns@attempted to add hookargs to operation after transaction started(RLR1RtProgrammingErrorRQ(R-RL((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytaddhookargsIs(RBRCRDtTrueR.RSRU(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRFs	tTransactionUnavailablecB`seZRS((RBRC(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRWOscC`s
t��dS(s�default method to get a transaction while processing a bundle

    Raise an exception to highlight the fact that no transaction was expected
    to be createdN(RW(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_notransactionRsc`s�t|t�r�d�jd<|dk	rGd�jkrG|�jd<n|dk	rrd�jkrr|�jd<nt||�fd�d|�St|�fd�d|�}t||�|||�|SdS(Nt1tbundle2RORc`s�S(N(((ttr(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt<lambda>aRGc`s�S(N(((R[(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR\dRG(t
isinstancet
unbundle20RLR1t
processbundleRFt_processchangegroup(RHt	unbundlerR[RORtkwargstop((R[s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytapplybundleYs
tpartiteratorcB`s#eZd�Zd�Zd�ZRS(cC`s:||_||_||_d|_d|_d|_dS(Ni(RHRcRaR1titeratortcounttcurrent(R-RHRcRa((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.is					c`s"�fd�}|��_�jS(Nc3`sZt�jj��}x>|D]6\}}|�_|�_|V|j�d�_qWdS(N(t	enumerateRat	iterpartsRgRhtconsumeR1(titrRgtp(R-(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR%rs		
(Rf(R-R%((R-s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt	__enter__qscC`s|js
dSt|t�r�t}y;|jr>|jj�nx|jD]}|j�qHWWntk
rvt}nXt|_g}d}|j	j
dk	r�|j	j
j�}|j	j
j}n||_
||_|r�|�q�n|jjjd|j�dS(Ns%bundle2-input-bundle: %i parts total
(RfR]t	ExceptiontFalseRhRkRVtduringunbundle2R1RcRJt
salvageoutputtcapabilitiest
_replycapst_bundle2salvagedoutputRHRRRg(R-ttypetexcttbt	seekerrortparttsalvagedt	replycaps((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__exit__}s.		

			(RBRCR.RnR}(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRehs		RGcC`s�|dkr9|dkr!t}nt||d|�}n|j|jjr�dg}|jr{|jdt|j��n|jdks�|jtkr�|jd�n
|jd�|jd�|jj	dj
|��nt|||�|S(	s,This function process a bundle, apply effect to/from a repo

    It iterates over each part then searches for and uses the proper handling
    code to process the part. Parts are processed in order.

    Unknown Mandatory part will abort the process.

    It is temporarily possible to provide a prebuilt bundleoperation to the
    function. This is used to ensure output is properly propagated in case of
    an error during the unbundling. This output capturing part will likely be
    reworked and this ability will probably go away in the process.
    ROsbundle2-input-bundle:s
 %i paramss no-transactions with-transactions
RGN(R1RXRFR$Rt	debugflagR0R>RMRtjointprocessparts(RHRaRPRcROtmsg((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR_�s 
			

cC`s=t|||��%}x|D]}t||�qWWdQXdS(N(Ret_processpart(RHRcRatpartsRz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s
cK`s<|j|j||||�}|jjdi|d6�|S(NRtreturn(tapplyRHRIR3(RctcgR[RORRbtret((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR`�sc	C`s�d}z�y�tj|j�}|dkrHd}tjd|j��nt|jd|j�|j|j	}|r�t
|�}|j�ddj|�}tjd|jd|��nd}Wn:tjk
r�}|j
r��nt|jd	|�dSXWd|jjr�d
|jg}|j
s9|jd�nt|j�}t|j	�|}|sg|r�|jd�|r�|jd
|�n|r�|jd|�n|jd�n|jd|�|jjdj|��nX|S(Ntunknownsunsupported-typeRsfound a handler for part %ssunsupported-params (%s)s, R$t	supporteds%ignoring unsupported advisory part %ssbundle2-input-part: "%s"s (advisory)s	 (params:s
 %i mandatorys %i advisoryt)s %s
RG(R"R9RvR1RtBundleUnknownFeatureErrorRRt
mandatorykeysR$tlisttsortRt	mandatoryR~R0R>R(	RcRztstatusthandlert
unknownparamsRwR�tnbmptnbap((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_gethandler�sJ

			
c	C`s�t||�}|dkrdSd}|jr_|jdk	r_|jjdtdt�d}nz|||�Wd|dk	r�|jj�}n|r�|jjdd|dt	�}|j
dtj|j
�dt	�nXdS(	s�process a single part from a bundle

    The part is guaranteed to have been fully consumed when the function exits
    (even if an exception is raised).NRtsubprocRGtoutputtdataR�sin-reply-to(R�R1RKRJRt
pushbufferRVt	popbuffertnewpartRptaddparamRtbytestrtid(RcRzR�R�toutpart((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�s 		cC`s�i}x�|j�D]�}|s%qnd|krA|d}}n'|jdd�\}}|jd�}tj|�}g|D]}tj|�^q~}|||<qW|S(s�decode a bundle2 caps bytes blob into a dictionary

    The blob is a list of capabilities (one per line)
    Capabilities may have values using a line of the form::

        capability=value1,value2,value3

    The values are always a list.t=it,((t
splitlinestsplitturlreqtunquote(tblobtcapstlinetkeytvalstv((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
decodecaps s	"cC`s�g}x~t|�D]p}||}tj|�}g|D]}tj|�^q9}|rvd|dj|�f}n|j|�qWdj|�S(s2encode a bundle2 caps dictionary into a bytes blobs%s=%sR�s
(tsortedR�tquoteRR0(R�tchunkstcaR�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
encodecaps7s
"tUNtHG20tHG10UNtHG10tBZtHG10BZtHG10GZtGZtbundle20cB`s}eZdZdZdd�Zd
d�Zed��Zd
d�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�ZRS(s�represent an outgoing bundle2 container

    Use the `addparam` method to add stream level parameter. and `newpart` to
    populate it. Then call `getchunks` to retrieve all the binary chunks of
    data that compose the bundle2 container.R�cC`sU||_g|_g|_t|�|_tjjd�|_d|_
t|_dS(NR�(
Rt_paramst_partstdictRsRtcompenginest
forbundletypet_compengineR1t	_compoptsRVtprefercompressed(R-RRs((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.Ys				cC`sB|dkrdS|jd|�tjj|�|_||_dS(s$setup core part compression to <alg>R�NtCompression(NR�(R1R�RR�R�R�R�(R-talgtcompopts((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytsetcompressiones
cC`s
t|j�S(s*total number of parts added to the bundler(R>R�(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytnbpartsnscC`sg|stjd��n|dd!tjtj�krMtjd|��n|jj||f�dS(sadd a stream level parametersempty parameter nameiisnon letter first character: %sN(RRTRR�tstringt
ascii_lettersR�R0(R-tnametvalue((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�ts	
cC`s&t|j�|_|jj|�dS(s_add a new part to the bundle2 container

        Parts contains the actual applicative payload.N(R>R�R�R0(R-Rz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytaddpart}scO`s#t|||�}|j|�|S(sqcreate a new part and add it to the containers

        As the part is directly added to the containers. For now, this means
        that any failure to properly initialize the part after calling
        ``newpart`` should result in a failure of the whole bundling process.

        You can still fall back to manually create and add if you need better
        control.(t
bundlepartR�(R-ttypeidtargsRbRz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s	
cc`s|jjrxd|jg}|jrB|jdt|j��n|jdt|j��|jjdj|��nt	|jd|j�|jV|j
�}t	|jd|�ttt|��V|r�|Vnx+|j
j|j�|j�D]}|Vq�WdS(Nsbundle2-output-bundle: "%s",s (%i params)s %i parts total
RGsstart emission of %s streamsbundle parameter: %s(RR~t_magicstringR�R0R>R�RRRt_paramchunkt_packt_fstreamparamsizeR�tcompressstreamt
_getcorechunkR�(R-R�tparamtchunk((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt	getchunks�s 	cC`swg}xa|jD]V\}}tj|�}|dk	rYtj|�}d||f}n|j|�qWdj|�S(s1return a encoded version of all stream parameterss%s=%st N(R�R�R�R1R0R(R-tblockstparR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��scc`s�t|jd�xM|jD]B}t|jd|j�x"|jd|j�D]}|VqMWqWt|jd�ttd�VdS(sUyield chunk for the core part of the bundle

        (all but headers and parameters)sstart of partssbundle part: "%s"Rs
end of bundleiN(RRR�RvR�R�t_fpartheadersize(R-RzR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s
cC`sFg}x9|jD].}|jjd�r|j|j��qqW|S(s�return a list with a copy of all output parts in the bundle

        This is meant to be used during error handling to make sure we preserve
        server outputR�(R�Rvt
startswithR0tcopy(R-R{Rz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRr�s
(N(RBRCRDR�R.R1R�tpropertyR�R�R�R�R�R�R�Rr(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�Ps							
t
unpackermixincB`s)eZdZd�Zd�Zd�ZRS(s6A mixin to extract bytes and struct data from a streamcC`s
||_dS(N(t_fp(R-tfp((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.�scC`s%|jtj|��}t||�S(sunpack this struct format from the stream

        This method is meant for internal usage by the bundle2 protocol only.
        They directly manipulate the low level stream including bundle2 level
        instruction.

        Do not use it to implement higher-level logic or methods.(t
_readexacttstructtcalcsizet_unpack(R-tformatR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��scC`stj|j|�S(sread exactly <size> bytes from the stream

        This method is meant for internal usage by the bundle2 protocol only.
        They directly manipulate the low level stream including bundle2 level
        instruction.

        Do not use it to implement higher-level logic or methods.(RtreadexactlyR�(R-tsize((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s(RBRCRDR.R�R�(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s		cC`s�|d	kr!tj|d�}n|dd!|dd!}}|dkrw|jd||f�tjtd���ntj|�}|d	kr�tjtd�|��n|||�}t	|d|�|S(
s7return a valid unbundler object for a given magicstringiiitHGs6error: invalid magic: %r (version %r), should be 'HG'
snot a Mercurial bundlesunknown bundle version %ssstart processing of %s streamN(
R1RR�RRtAbortRt	formatmapR9R(RR�tmagicstringtmagictversiontunbundlerclassRa((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytgetunbundler�sR^cB`sqeZdZdZd�Zejd��Zd�Zd�Z	d�Z
ed�Zd�Z
d	�Zd
�ZRS(s|interpret a bundle2 stream

    This class is fed with a binary stream and yields parts through its
    `iterparts` methods.R�cC`sA||_tjjd�|_d|_tt|�j	|�dS(s<If header is specified, we do not read it out of the stream.R�N(
RRR�R�R�R1t_compressedtsuperR^R.(R-RR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.�s		cC`svt|jd�i}|jt�d}|dkrKtjd|��n|rr|j|�}|j|�}n|S(s%dictionary of stream level parameterss!reading bundle2 stream parametersisnegative bundle param size: %i(RRR�R�RtBundleValueErrorR�t_processallparams(R-R$t
paramssize((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR$s	
cC`s�tj�}x�|jd�D]{}|jdd�}g|D]}tj|�^q;}t|�dkrx|jd�n|j|�|d||d<qW|S(RGR�R�iiiN(	RtsortdictR�R�R�R>R0R1t
_processparam(R-tparamsblockR$Rmti((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�s"
cC`s�|std��n|dd!tjtj�krGtd|��nyt|j�}WnPtk
r�|dd!j�r�t	|j
d|�q�tjd|f��nX||||�dS(s�process a parameter, applying its effect if needed

        Parameter starting with a lower case letter are advisory and will be
        ignored when unknown.  Those starting with an upper case letter are
        mandatory and will this function will raise a KeyError when unknown.

        Note: no option are currently supported. Any input will be either
              ignored or failing.
        sempty parameter nameiisnon letter first character: %ssignoring unknown parameter %sR$N(
RRR�R�R�tb2streamparamsmapR!tKeyErrortislowerRRRR�(R-R�R�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�s

cc`s%|jV|jt�d}|dkr=tjd|��ntt|�V|ru|j|�}|j|�|Vn|jj	|j
�|_
d}x�|dkr |jt�d}tt|�V|r�d}n
|d7}q�|tkr�q�n|dkrtjd��n|j|�Vq�WdS(sWutility to transfer a bundle2 as binary

        This is made necessary by the fact the 'getbundle' command over 'ssh'
        have no way to know then the reply end, relying on the bundle to be
        interpreted to know its end. This is terrible and we are sorry, but we
        needed to move forward to get general delta enabled.
        isnegative bundle param size: %iiisnegative chunk size: %iN(
R�R�R�RR�R�R�R�R�tdecompressorreaderR�R�t
flaginterrupt(R-R�R$t
emptycountR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_forwardchunks7s2	

	
cc`s�|rtnt}|j|jj|j�|_t|jd�|j�}xC|dk	r�||j||j�}|V|j
�|j�}qPWt|jd�dS(s'yield all parts contained in the streams!start extraction of bundle2 partssend of bundle2 streamN(tseekableunbundleparttunbundlepartR$R�R�R�RRt_readpartheaderR1Rk(R-tseekabletclstheaderblockRz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRj_s
cC`s`|jt�d}|dkr5tjd|��nt|jd|�|r\|j|�SdS(sQreads a part header size and return the bytes blob

        returns None if emptyisnegative part header size: %ispart header size: %iN(R�R�RR�RRR�R1(R-t
headersize((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRrs	

cC`s|j|jS(N(R$R�(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
compressedscC`s&tj|jd�r"|jj�SdS(sclose underlying filetcloseN(RtsafehasattrR�R
(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR
�s(RBRCRDR�R.Rt
propertycacheR$R�R�RRpRjRR	R
(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR^�s		
		(	
	t20c`s�fd�}|S(s/register a handler for a stream level parameterc`s|t�<|S(N(R�(R%(R�(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt	decorator�s
((R�R((R�s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytb2streamparamhandler�stcompressioncC`sd|tjjkr3tjd|fd|f��ntjj|�|_|dk	r`t|_	ndS(s<read compression parameter and install payload decompressionR$tvaluesN(
RR�tsupportedbundletypesRR�R�R�R1RVR�(RaR�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytprocesscompression�sR�cB`s�eZdZdd
ded�Zd�Zd�Zed��Zej	d��Zed��Z
ed��Zded	�Zd
�Z
d�ZRS(sA bundle2 part contains application level payload

    The part `type` is used to route the part to the application level
    handler.

    The part payload is contained in ``part.data``. It could be raw bytes or a
    generator of byte chunks.

    You can add parameters to the part using the ``addparam`` method.
    Parameters can be either mandatory (default) or advisory. Remote side
    should be able to safely ignore the advisory ones.

    Both data and parameters cannot be modified after the generation has begun.
    RGcC`s�t|�d|_||_||_t|�|_t|�|_t�|_	xS|j|jD]A\}}||j	kr�t
jd|��n|j	j|�q`Wd|_
||_dS(Nsduplicated params: %s(RR1R�Rvt_dataR�t_mandatoryparamst_advisoryparamstsett_seenparamsRRTR3t
_generatedR�(R-RtmandatoryparamstadvisoryparamsR�R�tpnamet__((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.�s
				cC`sBd|jj|jjf}d|t|�|j|j|jfS(Ns%s.%ss2<%s object at %x; id: %s; type: %s; mandatory: %s>(t	__class__RCRBR�RvR�(R-R((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__repr__�scC`s(|j|j|j|j|j|j�S(s�return a copy of the part

        The new part have the very same content but no partid assigned yet.
        Parts with generated data cannot be copied.(RRvRRRR�(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��scC`s|jS(N(R(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��scC`s.|jdk	r!tjd��n||_dS(Nspart is being generated(RR1RtReadOnlyPartErrorR(R-R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��scC`s
t|j�S(N(R8R(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�scC`s
t|j�S(N(R8R(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�scC`s�|jdk	r!tjd��n||jkrCtd|��n|jj|�|j}|rn|j}n|j	||f�dS(s�add a parameter to the part

        If 'mandatory' is set to True, the remote handler must claim support
        for this parameter or the unbundling will be aborted.

        The 'name' and 'value' cannot exceed 255 bytes each.
        spart is being generatedsduplicated params: %sN(
RR1RR RRR3RRR0(R-R�R�R�R$((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s	cc`s�|jdk	r!tjd��nt|_|jrjd|jg}|js\|jd�nt	|j
�}t	|j�}|s�|r�|jd�|r�|jd|�n|r�|jd|�n|jd�n|js�|jd�nTt
j|jd	�st
j|jd
�r*|jd�n|jdt	|j��|jd
�|jdj|��n|jr�|jj�}n|jj�}t|dtj|j�|f�ttt	|��|tt|j�g}|j
}|j}|jttt	|�t	|���g}	x:|D]2\}
}|	jt	|
��|	jt	|��q%Wx:|D]2\}
}|	jt	|
��|	jt	|��qbWttt	|	�d�|	�}|j|�x.|D]&\}
}|j|
�|j|�q�Wx.|D]&\}
}|j|
�|j|�q�Wydj|�}
Wn!tk
r\td|��nXt|dt	|
��ttt	|
��V|
VyKxD|j�D]6}t|dt	|��ttt	|��V|Vq�WWn�t k
r�|jd��n�t!k
r�}t"j#|�}|jd|�t$j%�d}d|}t&dd|fgdt�}d|_ttd�Vx|j'd|�D]}|Vq�Wt|d�ttd�Vtj(||�nXt|d�ttd�Vt)|_dS(Nspart can only be consumed oncesbundle2-output-part: "%s"s (advisory)s	 (params:s
 %i mandatorys %i advisoryR�s empty payloadtnextt__next__s streamed payloads %i bytes payloads
RGs
part %s: "%s"is8Found a non-bytes trying to build bundle part header: %rsheader chunk size: %ispayload chunk size: %isbundle2-generatorexit
s5bundle2-input-stream-interrupt: encoding exception %ssunexpected error: %sserror:abortRR�ii����Rsclosing payload chunk(*RR1RRTRpR~RvR�R0R>RRR�RRRRtupperR!RRR�R�R�t_fparttypesizet_fpartidt_fpartparamcountR t	TypeErrorR�t_payloadchunkst
_fpayloadsizet
GeneratorExitt
BaseExceptionRtforcebytestrtsystexc_infoR�R�traisewithtbRV(R-RR�R�R�RtheadertmanpartadvpartparsizesR�R�t
paramsizestheaderchunkR�RwtbexcRxt	interpart((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s�			
	
	#		%






	
			

cc`s�tj|jd�s*tj|jd�rotj|j�}|jt�}x;|rk|V|jt�}qNWnt|j�r�|jVndS(smyield chunks of a the part payload

        Exists to handle the different methods to provide data to a part.R!R"N(RRR�tchunkbuffertreadtpreferedchunksizeR>(R-tbuffR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR(`s	(((RBRCRDRVR.RR�R�R�tsetterRRR�R�R((((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s		
	gi����tinterrupthandlercB`s)eZdZd�Zd�Zd�ZRS(s�read one part and process it with restricted capability

    This allows to transmit exception raised on the producer size during part
    iteration while the consumer is reading a part.

    Part processed in this manner only have access to a ui object,cC`s#tt|�j|�||_dS(N(R�R=R.R(R-RR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.{scC`s`|jt�d}|dkr5tjd|��nt|jd|�|r\|j|�SdS(sQreads a part header size and return the bytes blob

        returns None if emptyisnegative part header size: %ispart header size: %i
N(R�R�RR�RRR�R1(R-R((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRs	

cC`s�|jjd�t|jd�|j�}|dkrLt|jd�dSt|j||j�}t|j�}t}z8yt	||�Wn t
tfk
r�t}�nXWd|s�|j
�nX|jjd�dS(Ns<bundle2-input-stream-interrupt: opening out of band context
s0bundle2 stream interruption, looking for a part.s"no part found during interruption.s<bundle2-input-stream-interrupt: closing out of band context
(RRRRR1RR�tinterruptoperationRpR�t
SystemExittKeyboardInterruptRVRk(R-RRzRct	hardabort((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt__call__�s$(RBRCRDR.RRB(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR=ss		
R>cB`s/eZdZd�Zed��Zd�ZRS(spA limited operation to be use by part handler during interruption

    It only have access to an ui object.
    cC`s||_d|_t|_dS(N(RR1RJRpRK(R-R((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.�s		cC`stjd��dS(Ns'no repo access from stream interruption(RRT(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRH�scC`std��dS(Ns'no repo access from stream interruption(RW(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRS�s(RBRCRDR.R�RHRS(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR>�s	cc`s�|jdd�}|j}tjt�}|j}|j}tj}|j	}||||��d}	t
|d|	�x|	r}|	dkr�||	�}
t|
�|	kr�tj
td�t|
�|	f��n|
Vn2|	tkr�t||��ntjd|	��||�}
t|
�|krStj
td�t|
�|	f��n||
�d}	|r{|d|	�q{q{WdS(	s�Reads bundle2 part payload data into chunks.

    Part payload data consists of framed chunks. This function takes
    a file handle and emits those chunks.
    Rs
bundle2.debugispayload chunk size: %is6stream ended unexpectedly  (got %d bytes, expected %d)snegative payload chunk size: %ss&bundle2-input: payload chunk size: %i
N(RRR�tStructR)R�tunpackRR�R9RR>RR�RR�R=R�(RtfhtdologRtheaderstructRRDR�R9t	chunksizets((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytdecodepayloadchunks�s6						
RcB`sYeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	d�ZRS(
s a bundle part read from a bundlecC`s�tt|�j|�tj|d�o7tj|d�|_||_||_d|_t	|_
t	|_d|_
d|_d|_d|_d|_d|_|j�d|_d|_dS(Ntseekttelli((R�RR.RRt	_seekableRt_headerdatat
_headeroffsetRpt_initializedtconsumedR1R�RvRRR$R�t_readheadert
_mandatoryt_pos(R-RR0R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.�s"											
	cC`s.|j}|j|||!}|||_|S(s+return the next <size> byte from the header(RORN(R-R�toffsetR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_fromheader�s	
cC`s%|jtj|��}t||�S(saread given format from header

        This automatically compute the size of the format to read.(RVR�R�R�(R-R�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
_unpackheaderscC`sct|�|_t|�|_tj|j�|_|jj|j�td�|D��|_dS(s7internal function to setup all logic related parameterscs`s|]}|dVqdS(iN((t.0Rm((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pys	<genexpr>sN(	R8RRRR�R$RQR#R�(R-RR((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_initparamss
cC`s�|jt�d}|j|�|_t|jd|j�|jt�d|_t|jdtj	|j��|j|jj
�k|_|jj
�|_|jt�\}}t|jd||�t
||�}|j|�}tt|ddd�|ddd���}|| }||}g}x9|D]1\}	}
|j|j|	�|j|
�f�q;Wg}x9|D]1\}	}
|j|j|	�|j|
�f�q}W|j||�tj|j��|_t|_dS(s$read the header and setup the objectispart type: "%s"s
part id: "%s"spart parameters: %iNii(RWR$RVRvRRR%R�RR�R!R�R&R R�tzipR0RYRR8R(t_payloadstreamRVRP(R-ttypesizetmancounttadvcounttfparamsizesR4tmansizestadvsizest	manparamsR�R�t	advparams((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRRs. /

))cC`st|j|j�S(s+Generator of decoded chunks in the payload.(RJRR�(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR(9scC`sQ|jr
dS|jd�}x.|rL|jt|�7_|jd�}qWdS(s�Read the part payload until completion.

        By consuming the part data, the underlying stream read offset will
        be advanced to the next part (or end of stream).
        Ni�(RQR9RTR>(R-R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRk=s		cC`s�|js|j�n|dkr4|jj�}n|jj|�}|jt|�7_|dksyt|�|kr�|jr�|jr�|jj	d|j�nt
|_n|S(sread payload datas*bundle2-input-part: total payload size %i
N(RPRRR1R[R9RTR>RQRRRV(R-R�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR9Ks	
N(RBRCRDR.RVRWRYRRR(RkR1R9(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�s				
	#		RcB`sYeZdZd�Zdd�Zd�Zd�Zejd�Z	dd�Z
d�ZRS(	s�A bundle2 part in a bundle that is seekable.

    Regular ``unbundlepart`` instances can only be read once. This class
    extends ``unbundlepart`` to enable bi-directional seeking within the
    part.

    Bundle2 part data consists of framed chunks. Offsets when seeking
    refer to the decoded data, not the offsets in the underlying bundle2
    stream.

    To facilitate quickly seeking within the decoded data, instances of this
    class maintain a mapping between offsets in the underlying stream and
    the decoded payload. This mapping will consume memory in proportion
    to the number of chunks within the payload (which almost certainly
    increases in proportion with the size of the part).
    cC`s)g|_tt|�j|||�dS(N(t_chunkindexR�RR.(R-RR0R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR.ls	icc`s�t|j�dkr4|jjd|j�f�n|j|j|d�|j|d}xpt|j|j�D]Y}|d7}|t|�7}|t|j�kr�|jj||j�f�n|VqsWdS(s/seek to specified chunk and start yielding dataiiN(R>RdR0t_tellfpt_seekfpRJRR�(R-tchunknumtposR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR(rs
cC`syxft|j�D]U\}\}}||kr8|dfS||kr|d||j|ddfSqWtd��dS(s>for a given payload position, return a chunk number and offsetiis
Unknown chunkN(RiRdR(R-RhR�tppostfpos((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
_findchunk�s"
%cC`s|jS(N(RT(R-((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRL�scC`s�|tjkr|}n�|tjkr7|j|}nq|tjkr�|js}|jd�}x|ry|jd�}qaWn|jdd|}ntd|f��||jddkr�|jr�|jd�}x|r�|jd�}q�Wnd|ko|jddkns-td��n|j|kr�|j	|�\}}t
j|j|��|_
|j|�}t|�|kr�tjtd���n||_ndS(Ni�i����isUnknown whence value: %ri�sOffset out of rangesSeek failed
(tostSEEK_SETtSEEK_CURRTtSEEK_ENDRQR9RdRRkRR8R(R[R>RR�R(R-RUtwhencetnewposR�tinternaloffsettadjust((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRK�s0			!	'cC`s2|jr|jj||�Sttd���dS(smove the underlying file pointer

        This method is meant for internal usage by the bundle2 protocol only.
        They directly manipulate the low level stream including bundle2 level
        instruction.

        Do not use it to implement higher-level logic or methods.sFile pointer is not seekableN(RMR�RKtNotImplementedErrorR(R-RURp((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRf�s	cC`sX|jrTy|jj�SWqTtk
rP}|jtjkrJt|_qQ�qTXndS(s,return the file offset, or None if file is not seekable

        This method is meant for internal usage by the bundle2 protocol only.
        They directly manipulate the low level stream including bundle2 level
        instruction.

        Do not use it to implement higher-level logic or methods.N(RMR�RLtIOErrorterrnotESPIPERpR1(R-te((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyRe�s	
(RBRCRDR.R(RkRLRlRmRKRfRe(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR[s				 
Rtaborttunsupportedcontentt	pushracedR
Rtlistkeystdigeststhttpthttpssremote-changegroupthgtagsfnodessrev-branch-cachetheadsR	tv2tstreamcC`sQ|dkrtjd��ntj�}tttj|���|d<tj	|tj
�r�td�tjD��}||d<n|r�d|d<n|jj
dd�}|d	kr�d|d<nd|jjd
d�kr�|jd�n|dkrM|jjdddt�}|jjdd�}|s:|rM|jd�qMn|S(s_return the bundle2 capabilities for a given repo

    Exists to allow extensions (like evolution) to mutate the capabilities.

    The returned value is used for servers advertising their capabilities as
    well as clients advertising their capabilities to servers as part of
    bundle2 requests. The ``role`` argument specifies which is which.
    tclienttservers&role argument must be client or serverRcs`s|]}d|VqdS(sV%iN((RXR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pys	<genexpr>�st
obsmarkerstpushbacksconcurrent-push-modes
check-relatedtrelatedt
checkheadsR	Rslegacy.exchangetuncompressedt	untrustedsbundle2.streamR�(R�R�((R�(RRTRsR�R8R�RtsupportedincomingversionsRt	isenabledtexchangeopttformatsRtconfigt
configlisttpopRRV(RHt
allowpushbacktroleR�tsupportedformattcpmodetstreamsupportedtfeaturesupported((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytgetrepocaps�s,	


	cC`sH|jd�}|r&|dkr&iStj|jd��}t|�S(s0return the bundle capabilities of a peer as dictRZRG(tcapableR�R�R�(tremotetrawtcapsblob((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytbundle2capss
cC`sB|jdd�}g|D]%}|jd�rt|d�^qS(sNextract the list of supported obsmarkers versions from a bundle2caps dict
    R�tVi((R9R�tint(R�tobscapstc((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytobsmarkersversionsc
C`s�|jd�rLtj||d|�}
t||
||d|d|d|	�S|jd�sqtjd|��ni}d|kr�d|d
<nt||�}|j||	�t||||||�|j	�}
tj
||
|d|�S(NR�t01tvfsRR�R�sunknown bundle type: %stobsolescencetV1R�(R�(R�RtmakechangegrouptwritebundleRRTR�R�t_addpartsfromoptsR�twritechunks(RRHROtfilenamet
bundletypetoutgoingtoptsR�RR�R�R�tbundlet	chunkiter((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytwritenewbundles

cC`s�|jdt�r�|jd�}|dkr?tj|�}ntj||||�}|jdd|j��}|jd|j	�d|j
kr�|jdd|j
ddt�n|jd	�r�|jd
|j
�r�|jddtjdt�q�n|jdt�r't||d
t�n|jdt�rLt|||�n|jdt�rqt|||�n|jdt�r�|jj|j�}	t||	�n|jd	t�r�tj||j�}
tj|
�}|jdd|�ndS(NRs
cg.versionR�R�tclcountt	nbchangess%dR�R	s%ln and secret()ttargetphasetstreamv2R�ttagsfnodescachetrevbranchcacheR�sphase-heads(R9RVR1RtsafeversionR�R�R�R�R�textrasRptrevstmissingheadsR	tsecrettaddpartbundlestream2taddparttagsfnodescachetaddpartrevbranchcachetobsstoretrelevantmarkerstmissingtbuildobsmarkersparttsubsetphaseheadstbinaryencode(RRHtbundlerROR�R�t	cgversionR�RzR�theadsbyphaset	phasedata((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�)s4

#cC`s�tj|j��}g}xH|jD]=}|j|dt�}|dk	r%|j||g�q%q%W|r�|jdddj	|��ndS(NtcomputemissingR�R�RG(
R
thgtagsfnodescachet
unfilteredR�tgetfnodeRpR1textendR�R(RHR�R�tcacheR�Rtfnode((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�Ssc	`s�|j�}|j�j}tjd���xD|jD]9}|j|j|��\}}�||j|�q7W�fd�}|j	dd|�dt
�dS(NcS`st�t�fS(N(R(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR\pRGc3`s�x�t�j��D]�\}\}}tj|�}tjt|�t|�t|��V|Vxt|�D]}|VqlWxt|�D]}|Vq�WqWdS(N(R�titemsRt	fromlocalt	rbcstructtpackR>(tbranchtnodestclosedt
utf8branchtn(tbranchesdata(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytgenerateus%&	scache:rev-branch-cacheR�R�(R�R�t	changelogtcollectionstdefaultdictR�t
branchinfotrevR3R�Rp(	RHR�R�R�tclRR�R
R�((R�s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR�ks
cC`stjdjt|���S(NR�(R�R�RR�(trequirements((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_formatrequirementsspec�scC`s)t|�}dtjd�|f}|S(Ns%s%ss
requirements=(R�R�R�(R�R$((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt_formatrequirementsparams�sc
K`s�|jdt�sdStj|�sItjtd�dtd���nt|_|jd�}|jd�}|jj	dd�}|s�|r�|r�tjtd	���nt}|j
r
t|j�}|s�tjtd
���q
|j
j
|kr
t}q
ntj||||�\}}	}
t|j�}|jdd|
�}|jd
d|	dt�|jdd|dt�|jd|dt�dS(NR�s<stream data requested but server does not allow this featurethintsrwell-behaved clients should not be requesting stream data from servers not advertising it; the client may be buggytincludepatstexcludepatstexperimentalsserver.stream-narrow-cloness,server does not support narrow stream clonessPserver has obsolescence markers, but client cannot receive them via stream clonetstream2R�t	bytecounts%dR�t	filecountR�(R9RpRtallowservergenerationRR�RR�RRR�R�Rst_versionRVt
generatev2R�R�R�R�(
R�RHRbR�R�tnarrowstreamtincludeobsmarkerstremoteversionsR�R�titR�Rz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s6			cC`sn|s
dSt|j�}tj|�}|dkrCtd��ntj|td|�}|jdd|�S(s�add an obsmarker part to the bundler with <markers>

    No part is created if markers is empty.
    Raises ValueError if the bundler doesn't support any known obsmarker format.
    s0bundler does not support common obsmarker formatR�R�R�N(	R1R�RsRt
commonversionRt
encodemarkersRVR�(R�tmarkersR�R�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��sc`sI|dkr�t|�}|j|��|jdd�j��}|jd�j�d�jkr�|jdd�jddt�n|j�}	n��jd	kr�tj	t
d
���nt|\�}
|
tj
jkr�tj	t
d�|
��ntj
j|
������fd�}	|	�}	tj||	|d
|�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.
    R�RR�R�R�R�s%dR�R�s.old bundle types only supports v1 changegroupss#unknown stream compression type: %sc3`s1�Vx%�j�j���D]}|VqWdS(N(R�R�(R�(R�t
compengineR�R0(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��sR�(R�R�R�R�R�R�R�RpRR�RtbundletypesRR�RR�RR�(RR�R�R�R�RR�R�RzR�tcomp((R�R�R�R0s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR��s&


	cC`s�g|jdD]}|jdd�^q}d}d}x^|D]V}|dkr[d}Pn|dkrx||d7}q?|dkr?||d7}q?q?W|dkr�d|}n|dkr�d|}n|S(s:logic to combine 0 or more addchangegroup results into oneRR�iii����(RIR9(RctrtresultstchangedheadstresultR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytcombinechangegroupresults�s")


RR�R�ttreemanifestR�c	C`s�ddlm}|j�}|jjdd�}tj||d�}d}d|jkrvt|jjd��}nd|jkrd|j	j
krt|j	j�dkr�t
jtd���n|j	j
jd�|j|j	j|j	j
|j	j�|j	j_|j	j�ni}|jjd	�}|dk	rQt|�|d	<nt|||d
d
d||�}	|jdk	r�|jjdd
t�}
|
jdtj|j�d
t�|
jdd|	d
t�ndS(s�apply a changegroup part on the repo

    This is a very early implementation that will massive rework before being
    inflicted to any end-user.
    i(t	localrepoR�R�R�R�is[bundle contains tree manifests, but local repo is non-empty and does not use tree manifestsR�RZt
expectedtotalsreply:changegroupR�sin-reply-toR�s%iN(RGRRSR$R9RR�R1R�RHR�R>R�RR�RR3tresolvestorevfsoptionsRtfeaturestsvfstoptionst_writerequirementsR`RJR�RpR�RR�R�(RctinpartRR[tunpackerversionR�tnbchangesetstextrakwargsR�R�Rz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlechangegroups8	*RR�s	digest:%scC`s�y|jd}Wn*tk
r=tjtd�d��nXtj|�}|jtdkrtjtd�|j��nyt	|jd�}WnSt
k
r�tjtd�d��n*tk
r�tjtd�d��nXi}xu|jjdd�j�D]X}d	|}y|j|}Wn*tk
r[tjtd�|��nX|||<qWtj
tj|j|�||�}	|j�}
d
dlm}|j|jj|	|�}t|tj�s�tjtd�tj|���nt|||
d
d
�}
|jdk	rt|jjd�}|jdtj|j �dt!�|jdd|
dt!�ny|	j"�WnDtjk
r�}tjtd�tj|�t#|�f��nXdS(s�apply a bundle10 on the repo, given an url and validation information

    All the information about the remote bundle to import are given as
    parameters. The parameters include:
      - url: the url to the bundle10.
      - size: the bundle10 file size. It is used to validate what was
        retrieved by the client matches the server knowledge about the bundle.
      - digests: a space separated list of the digest types provided as
        parameters.
      - digest:<digest-type>: the hexadecimal representation of the digest with
        that name. Like the size, it is used to validate what was retrieved by
        the client matches what the server knows about the bundle.

    When multiple digest types are given, all of them are checked.
    Rs&remote-changegroup: missing "%s" paramsremote-changegroups+remote-changegroup does not support %s urlsR�s0remote-changegroup: invalid value for param "%s"R}RGs	digest:%si(texchanges%s: not a bundle version 1.0RZsreply:changegroupsin-reply-toR�R�s%isbundle at %s is corrupted:
%sN($R$R�RR�RRRtschemeRsR�RR9R�t
digestcheckertopenRRSRGRt
readbundleRHR]Rtcg1unpackerthidepasswordR`RJR1R�R�RR�R�Rptvalidatetbytes(RcRtraw_urlt
parsed_urlR�R}ttypR�R�t	real_partR[RR�R�RzRx((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleremotechangegroup1sV



"

$#sreply:changegroupR�sin-reply-tocC`sGt|jd�}t|jd�}|jjdi|d6|�dS(NR�sin-reply-toR(R�R$RIR3(RcRR�treplyto((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlereplychangegrouptsscheck:bookmarksc
C`s�tj|�}d}d}d}x�|D]�\}}|jjj|�}||kr(|dkr}||tj|�f}	nM|dkr�||tj|�f}	n%||tj|�tj|�f}	tj	|	��q(q(WdS(s�check location of bookmarks

    This part is to be used to detect push race regarding bookmark, it
    contains binary encoded (bookmark, node) tuple. If the local state does
    not marks the one in the part, a PushRaced exception is raised
    s]remote repository changed while pushing - please try again (bookmark "%s" move from %s to %s)sbremote repository changed while pushing - please try again (bookmark "%s" is missing, expected %s)sfremote repository changed while pushing - please try again (bookmark "%s" set on %s, expected missing)N(
RtbinarydecodeRHt
_bookmarksR9R1tnodemodtshortRt	PushRaced(
RcRtbookdatatmsgstandardt
msgmissingtmsgexisttbookRtcurrentnodetfinalmsg((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlecheckbookmarkszsscheck:headscC`s�|jd�}g}x2t|�dkrI|j|�|jd�}qW|jjdd�rl|j�nt|�t|jj��kr�t	j
d��ndS(s�check that head of the repo did not change

    This is used to detect a push race when using unbundle.
    This replaces the "heads" argument of unbundle.iR�tbundle2lazylockings:remote repository changed while pushing - please try againN(R9R>R0RRRSR�RHR�RR (RcRthR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlecheckheads�s

!scheck:updated-headscC`s�|jd�}g}x2t|�dkrI|j|�|jd�}qW|jjdd�rl|j�nt�}x*|jj�j	�D]}|j
|�q�Wx,|D]$}||kr�tjd��q�q�WdS(sNcheck for race on the heads touched by a push

    This is similar to 'check:heads' but focus on the heads actually updated
    during the push. If other activities happen on unrelated heads, it is
    ignored.

    This allow server with high traffic to avoid push contention as long as
    unrelated parts of the graph are involved.iR�R)s:remote repository changed while pushing - please try againN(
R9R>R0RRRSRRHt	branchmapt
itervaluesRQRR (RcRR*R�tcurrentheadstls((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlecheckupdatedheads�s


	
scheck:phasescC`s�tj|�}|jj�}|j}|j}d}x�t|�D]�\}}xq|D]i}	|j||j|	��}
|
|krV|t	j
|	�tj|
tj|f}tj
|��qVqVWqCWdS(sjcheck that phase boundaries of the repository did not change

    This is used to detect a push race.
    sQremote repository changed while pushing - please try again (%s is %s expected %s)N(R	RRHR�R�t_phasecacheRitphaseR�RRt
phasenamesRR (RcRtphasetonodestunfiR�t
phasecacheR�t
expectedphaseR�R�tactualphaseR'((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlecheckphases�s		

R�cC`s;x4|j�j�D] }|jjtd�|�qWdS(s3forward output captured on the server to the clientsremote: %s
N(R9R�RR�R(RcRR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleoutput�sR|cC`s=t|j��}|jdkr9t|j|�|_ndS(sqNotify that a reply bundle should be created

    The payload contains the capabilities information for the replyN(R�R9RJR1R�R(RcRR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlereplycaps�st
AbortFromPartcB`seZdZRS(s=Sub-class of Abort that denotes an error from a bundle2 part.(RBRCRD(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyR<�sserror:abortRR�cC`s)t|jdd|jjd���dS(s*Used to transmit abort error over the wireRR�N(R<R$R9(RcR((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleerrorabort�ss
error:pushkeyt	namespaceR�tnewtoldR�cC`shi}x9dD]1}|jj|�}|dk	r
|||<q
q
Wtj|jdtj|���dS(	s=Used to transmit failure of a mandatory pushkey over the wireR>R�R?R@R�sin-reply-toN(R>R�R?R@R�(R$R9R1Rt
PushkeyFailedRt	strkwargs(RcRRbR�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleerrorpushkey�s
serror:unsupportedcontentRR$cC`s�i}|jjd�}|dk	r1||d<n|jjd�}|dk	re|jd�|d<ntjtj|���dS(s4Used to transmit unknown content error over the wireRR$sN(R$R9R1R�RR�RRB(RcRRbRR$((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleerrorunsupportedcontent�s
serror:pushracedcC`s#tjtd�|jd��dS(s.Used to transmit push race error over the wirespush failed:RN(Rt
ResponseErrorRR$(RcR((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleerrorpushracedscC`s?|jd}tj|j��}|jjd||f�dS(s6retrieve pushkey namespace content stored in a bundle2R>R|N(R$R
t
decodekeysR9RIR3(RcRR>R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlelistkeyss
cC`s�tj}||jd�}||jd�}||jd�}||jd�}|jjdd�rw|j�n|jj||||�}i|d6|d6|d6|d6}|jjd|�|j	dk	r'|j	jd�}	|	jd	t
j|j�d
t�|	jdd|d
t�n|jr�|r�i}
x1dD])}||jkrD|j||
|<qDqDWtjdd|jt
j|
���ndS(sprocess a pushkey requestR>R�R@R?R�R)R
s
reply:pushkeysin-reply-toR�R�s%iR�R7s%dN(R>R�R?R@R�(R
tdecodeR$RRRSRHRIR3RJR1R�R�RR�R�RpR�RRARB(RcRtdecR>R�R@R?R�trecordtrpartRb((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt
handlepushkeys2	



c`s�tj|�}�jjjdd�}�jjdd�}|dkr��j�}�jj}|r7g�x�|D]�\}}|j	j
�}	d|	d<d|	d<||	d<tj|j|d	��|	d
<tj|dk	r�|nd	�|	d<�j|	�qsWx3�D](}	�jjdd
ttj|	��qWn|j�j�j�|�|r���fd�}
�jj|
�q�n`|dkr�xQ|D]3\}}i|d6|d6}�jjd|�q�Wntjd|��dS(sdtransmit bookmark information

    The part contains binary encoded bookmark information.

    The exact behavior of this part can be controlled by the 'bookmarks' mode
    on the bundle operation.

    When mode is 'apply' (the default) the bookmark information is applied as
    is to the unbundling repository. Make sure a 'check:bookmarks' part is
    issued earlier to check for push races in such update. This behavior is
    suitable for pushing.

    When mode is 'records', the information is recorded into the 'bookmarks'
    records of the bundle operation. This behavior is suitable for pulling.
    R�sbookmarks-pushkey-compatRR�RYt
pushkeycompatR>R�RGR@R?t
prepushkeytthrowc`s1x*�D]"}�jjdtj|��qWdS(NR
(RHthookRRB(RL(tallhooksRc(s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytrunhookbs
RItbookmarkRsunkown bookmark mode: %sN(RRRHRRRNR9RSRRLR�RthexR1R0RQRVRRBtapplychangest
_afterlockRIR3RRT(RcRtchangesRNt
bookmarksmodeR[t	bookstoreR%RRLRSRK((RRRcs7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlebookmark7s8


%
sphase-headscC`s2tj|�}tj|jj�|j|�dS(s%apply phases from bundle part to repoN(R	RtupdatephasesRHR�RS(RcRR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlephasesnss
reply:pushkeycC`sGt|jd�}t|jd�}|jjdi|d6|�dS(s(retrieve the result of a pushkey requestR�sin-reply-toR
N(R�R$RIR3(RcRR�R7((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlepushkeyreplytsR�cC`sC|j�}|j�}|jjdd�rJ|jjdt|��n|jrz|jjj	rz|jjj
d�dS|jjj||�}|jj�|r�|jjj
td�|�n|jjdi|d6�|jdk	r?|jjd	�}|jd
tj|j�dt�|jdd|dt�ndS(
s&add a stream of obsmarkers to the repoR�sobsmarkers-exchange-debugs&obsmarker-exchange: %i bytes received
s3ignoring obsolescence markers, feature not enabled
Ns%i new obsolescence markers
R�R?sreply:obsmarkerssin-reply-toR�s%i(RSR9RR�twriteR>R�RHR�treadonlyRtmergemarkerstinvalidatevolatilesetsR�RRIR3RJR1R�R�RR�R�Rp(RcRR[t
markerdataR?RL((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleobsmarker{s$
 sreply:obsmarkerscC`sGt|jd�}t|jd�}|jjdi|d6|�dS(s(retrieve the result of a pushkey requestR?sin-reply-toR�N(R�R$RIR3(RcRR�R7((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandleobsmarkerreply�scC`s�|jjdd�r"|j�ntj|jj��}d}xztr�|jd�}|jd�}t	|�dks�t	|�dkr�|jj
d�Pn|j||�|d7}qCW|j�|jj
d|�dS(	s|Applies .hgtags fnodes cache entries to the local repo.

    Payload is pairs of 20 byte changeset nodes and filenodes.
    R�R)iis1ignoring incomplete received .hgtags fnodes data
is'applied %i hgtags fnodes cache entries
N(
RRRSR
R�RHR�RVR9R>RtsetfnodeR_(RcRR�RgRR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlehgtagsfnodes�s
	$
s>IIIscache:rev-branch-cachecC`sQd}|jtj�}|jj�}|jj�j}x|rBtj|�}||d|d7}|j|d�}tj	|�}xOt
j|d�D]:}	|jd�}
|j|
�}|j
|||
t�q�WxOt
j|d�D]:}	|jd�}
|j|
�}|j
|||
t�q�W|jtj�}q<W|j�dS(sreceive a rev-branch-cache payload and update the local cache

    The payload is a series of data related to each branch

    1) branch name length
    2) number of open heads
    3) number of closed heads
    4) open heads nodes
    5) closed heads nodes
    iiiiN(R9R�R�RHR�R�R�RDRttolocalRtxrangeR�tsetdataRpRVR_(RcRttotalt	rawheaderR�R�R0R�R�txRR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt	handlerbc�s&	tpushvarscC`si|jjdd�rei}x7|jD],\}}|j�}d|}|||<q%W|j|�ndS(s5unbundle a bundle2 containing shellvars on the servertpushspushvars.servertUSERVAR_N(RRRR#RU(RcRzRLR�R�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytbundle2getvars�s
R�R�R�R�cC`s�tj|jd�jd�}t|jd�}t|jd�}|j}t|�rxtd�}tj	|��n|j
jd�tj
|||||�dS(NR�R�R�R�s1cannot apply stream clone to non empty repositorysapplying stream bundle
(R�R�R$R�R�RHR>RRR�RRRt
applybundlev2(RcRzR�R�R�RHR�((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pythandlestreamv2bundle�s	c	C`s�t|j�}t�}|j}	x0|jd|�D]}
|j|	j|
��q4W|r�tj||d|d|d|�}|j	tt
jg�t|�t
ddt
�}|jdd|�}
|
jd	|�d
|jkr�|
jd
d�q�n|S(sgenerates bundle2 for widening a narrow clone

    repo is the localrepository instance
    oldmatcher matches what the client already has
    newmatcher matches what the client needs (including what it already has)
    common is set of common heads between server and client
    known is a set of revs known on the client side (used in ellipses)
    cgversion is the changegroup version to send
    ellipses is boolean value telling whether to send ellipses data or not

    returns bundle2 of the data required for extending
    s::%lnt
oldmatchertmatchert	fullnodestnarrow_widenR�RR�R�R�RY(R�RRR�R�R3RRt
getbundlerR�RtnullidR�RpR�R�R�(RHRut
newmatchertcommontknownR�tellipsesR�tcommonnodesR�R�tpackertcgdataRz((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pytwiden_bundle�s"			((RGR�((R�R�(R�R�(R�R�(((RyRzR{R
(((R~R(((R�(R�(R�R�R�R�(R�sin-reply-to(RR�(R>R�R?R@R�sin-reply-to(RR$(R(R>(R>R�R@R?(R�sin-reply-to(R?sin-reply-to(R�R�R�(�RDt
__future__RRR�RvRltreR�R�R-ti18nRRGRRRRRRRR	R
RRR
RRtutilsRturlerrR�R�R�RDR�R�R�R$R%R)R&R:tcompileRRRRR R"R(tobjectR)RFtRuntimeErrorRWRXR1RdReR_R�R`R�R�R�R�R�tbundlepriorityR�R�R�R^R�R�RRR�R�R=R>RJRRR8R�tDIGESTStkeysRsRpR�R�R�R�R�R�R�R�R�R�R�R�R�Rtkt_remotechangegroupparamsRRR(R+R0R9R:R;R�R<R=RCRDRFRHRMR[R]R^RdReRgRCR�RnRrRtR�(((s7/usr/lib64/python2.7/site-packages/mercurial/bundle2.pyt<module>�s�X								/1	D$			(			
y�
	
�0	1ux

'			*					,	'	+*C	
7