HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python2.7/dist-packages/mercurial/bundle2.pyc

Xc@@sdZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZmZmZmZejZejZejZejZdZdZdZd	ZdZd
ZdZej dZ!d
Z"dZ#dZ$dZ%iZ&dxdZ'de(fdYZ)de(fdYZ*de+fdYZ,dZ-ddddZ/dddZ0dZ1dZ2dZ3idyd6dzd6d{d 6d|d#6d}d$6Z4d$d#d gZ5d&e(fd'YZ6d(e(fd)YZ7dd*Z8d+e7fd,YZ9ie9d-6Z:iZ;d.Z<e<d/d0Z=d1e(fd2YZ>d3Z?d4e7fd5YZ@d6e(fd7YZAd8e7fd9YZBid~d6dd>6dd?6dd=6eCeDejEjFd@6ddC6ddD6ZGeHdEZIdFZJdGZKdddHZLe'dIddMZMeCdNdOd@ggejEjFD]ZNdPeN^q{ZOe'dCeOdQZPe'dRddUZQe'dVdWZRe'dXdYZSe'dZd[ZTd\ejUfd]YZVe'd^ddaZWe'dbddhZXe'diddlZYe'dmddnZZe'd?ddoZ[e'd=ddpZ\e'dqddrZ]e'dsdtZ^e'duddvZ_e'dDdwZ`dS(sHandling 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_importNi(t_(tchangegroupterrortobsoletetpushkeytpycompatttagsturltutils>is>Bs>Is>BBis[^a-zA-Z0-9_:-]cC@s-|jddtr)|jd|ndS(s(debug regarding output stream (bundling)tdevels
bundle2.debugsbundle2-output: %s
N(t
configbooltFalsetdebug(tuitmessage((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytoutdebugscC@s-|jddtr)|jd|ndS(s"debug on input stream (unbundling)R
s
bundle2.debugsbundle2-input: %s
N(RRR
(RR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytindebugscC@s"tj|rt|ndS(s9raise ValueError if a parttype contains invalid characterN(t_parttypeforbiddentsearcht
ValueError(tparttype((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytvalidateparttypescC@sdd|S(sreturn a struct format to read part parameter sizes

    The number parameters is variable so we need to build that format
    dynamically.
    t>tBB((tnbparams((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt_makefpartparamsizessc@s tfd}|S(sdecorator 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}|tkst|t|<t|_|S(N(tlowertparthandlermappingtAssertionErrort	frozensettparams(tfunct	lparttype(RR(s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
_decorators

(R(RRR"((RRs5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytparthandlers

tunbundlerecordscB@sPeZdZdZddZdZdZdZdZ	dZ
RS(	skeep 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((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt__init__s		cC@s^|jj|gj||jj||f|dk	rZ|j|j||ndS(sadd 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((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR.scC@s|jj|tS(s3get the records that are replies to a specific part(R'R*R$(R(tpartid((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR-scC@st|jj|dS(N((ttupleR%tget(R(tcat((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt__getitem__scC@s
t|jS(N(titerR&(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt__iter__	scC@s
t|jS(N(tlenR&(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt__len__scC@s
t|jS(N(tboolR&(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt__nonzero__sN(t__name__t
__module__t__doc__R)R,R.R-R6R8R:R<(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR$s	
				tbundleoperationcB@seZdZedZRS(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.
    cC@s@||_|j|_t|_||_d|_||_dS(N(trepoRR$trecordstgettransactionR,treplyt
captureoutput(R(RAttransactiongetterRE((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)"s			(R=R>R?tTrueR)(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR@stTransactionUnavailablecB@seZRS((R=R>(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRH*scC@s
tdS(sdefault method to get a transaction while processing a bundle

    Raise an exception to highlight the fact that no transaction was expected
    to be createdN(RH(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt_notransaction-sc@sdjd<|dk	r8djkr8|jd<n|dk	rcdjkrc|jd<nt||fdd|S(Nt1tbundle2tsourceRc@sS(N(((ttr(s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt<lambda>;stop(thookargsR,t
processbundle(RAt	unbundlerRMRLRRO((RMs5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytapplybundle4s
cC@s|d	kr3|d	kr!t}nt||}n|j|jjrdg}|jrh|jdn|jd	kr|jdn
|jd|jd|jjdj	|nt
|j}d	}d}zy(x!|D]\}}t||qWWnt
k
r}x$|D]\}}|jddqWt|_g}	d	}
|jd	k	r|jj}	|jj}
n|
|_|	|_nXWd	|jjd
|X|S(sThis 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.

    This is very early version of this function that will be strongly reworked
    before final usage.

    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.
    sbundle2-input-bundle:s
 %i paramss no-transactions with-transactions
tiiNs%bundle2-input-bundle: %i parts total
(R,RIR@RRt	debugflagR+RCR
tjoint	enumeratet	iterpartst_processpartt	ExceptiontseekRGtduringunbundle2RDt
salvageoutputtcapabilitiest
_replycapst_bundle2salvagedoutput(RARRRFROtmsgRXtparttnbparttexctsalvagedt	replycaps((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRQ=sF			

			c	C@sd}t}zyzytj|j}|d	krTd}tjd|jnt|jd|j|j	|j
}|rt|}|jd|}tjd|jd|nd}Wn:tjk
r}|j
rnt|jd|d	SXWd	|jjrd
|jg}|j
s<|jdnt|j	}t|j
|}	|sj|	r|jd|r|jd
|n|	r|jd|n|jdn|jd||jjdj|nXd	}
|jr)|jd	k	r)|jjdtdtd}
nz|||Wd	|
d	k	r[|jj}
n|
r|jjdd|
dt}|jdt|jdtnXWn ttfk
rt}nXWd	|s|jddnXd	S(sprocess 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).tunknownsunsupported-typeRsfound a handler for part %rsunsupported-params (%s)Rt	supporteds%ignoring unsupported advisory part %sNsbundle2-input-part: "%s"s (advisory)s	 (params:s
 %i mandatorys %i advisoryt)s %s
RTRtsubproctoutputtdatat	mandatorysin-reply-toii(RRR4ttypeR,RtBundleUnknownFeatureErrorRRt
mandatorykeysRtlisttsortRmRUR+R9R
RVRERDt
pushbufferRGt	popbuffertnewparttaddparamtstrtidt
SystemExittKeyboardInterruptR[(RORbtstatust	hardabortthandlert
unknownparamsRdRatnbmptnbapRktoutpart((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRY|sp


			
		'cC@si}x|jD]}|s%qnd|krA|d}}n'|jdd\}}|jd}tj|}g|D]}tj|^q~}|||<qW|S(sdecode 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((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
decodecapss	"cC@sg}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=%sRs
(tsortedRtquoteRVR+(RtchunkstcaRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
encodecapss
"RTtHG20tHG10UNtHG10tBZtHG10BZtHG10GZtGZtbundle20cB@szeZdZdZddZdZedZd
dZ	dZ
dZdZd	Z
d
ZdZRS(srepresent 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.RcC@sA||_g|_g|_t||_tjd|_dS(N(	Rt_paramst_partstdictR^R	tcompressorsR,t_compressor(R(RR^((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)s
			cC@sW|dkrdStd|jDs0t|jd|tj||_dS(s$setup core part compression to <alg>Ncs@s'|]\}}|jdkVqdS(tCompressionN(R(t.0tnR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pys	<genexpr>sR(R,tanyRRRvR	RR(R(talg((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytsetcompressions
 cC@s
t|jS(s*total number of parts added to the bundler(R9R(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytnbpartsscC@sU|stdn|dtjkr;td|n|jj||fdS(sadd a stream level parametersempty parameter nameisnon letter first character: %rN(RtstringtlettersRR+(R(tnametvalue((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRvs
cC@s;|jdkstt|j|_|jj|dS(s_add a new part to the bundle2 container

        Parts contains the actual applicative payload.N(RxR,RR9RR+(R(Rb((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytaddpartscO@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(ttypeidtargstkwargsRb((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRu"s	
cc@s"|jjrxd|jg}|jrB|jdt|jn|jdt|j|jjdj|nt	|jd|j|jV|j
}t	|jd|ttt|V|r|Vnx4|j
D]&}|jj|}|r|VqqW|jjVdS(Nsbundle2-output-bundle: "%s",s (%i params)s %i parts total
RTsstart emission of %s streamsbundle parameter: %s(RRUt_magicstringRR+R9RR
RVRt_paramchunkt_packt_fstreamparamsizet
_getcorechunkRtcompresstflush(R(RatparamtchunkRl((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt	getchunks0s$	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(RRRR,R+RV(R(tblockstparR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyREscc@st|jdxM|jD]B}t|jd|jx"|jd|jD]}|VqMWqWt|jdttdVdS(sUyield chunk for the core part of the bundle

        (all but headers and parameters)sstart of partssbundle part: "%s"Rs
end of bundleiN(RRRRnRRt_fpartheadersize(R(RbR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRPs
cC@sFg}x9|jD].}|jjdr|j|jqqW|S(sreturn 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 outputRk(RRnt
startswithR+tcopy(R(ReRb((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR]]s
(N(R=R>R?RR)RtpropertyRR,RvRRuRRRR](((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs						
t
unpackermixincB@sGeZdZdZdZdZddZdZdZRS(s6A mixin to extract bytes and struct data from a streamcC@s4||_tj|do*tj|d|_dS(NR[ttell(t_fpR	tsafehasattrt	_seekable(R(tfp((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)ls	cC@s%|jtj|}t||S(s)unpack this struct format from the stream(t
_readexacttstructtcalcsizet_unpack(R(tformatRl((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRqscC@stj|j|S(s)read exactly <size> bytes from the stream(RtreadexactlyR(R(tsize((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRvsicC@s2|jr|jj||SttddS(s move the underlying file pointersFile pointer is not seekableN(RRR[tNotImplementedErrorR(R(toffsettwhence((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR[zs	cC@sX|jrTy|jjSWqTtk
rP}|jtjkrJt|_qQqTXndS(s7return the file offset, or None if file is not seekableN(RRRtIOErrorterrnotESPIPERR,(R(te((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs	
cC@s&tj|jdr"|jjSdS(sclose underlying filetcloseN(R	RRR(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs(	R=R>R?R)RRR[RR(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRis				cC@s|dkr!tj|d}n|dd!|dd!}}|dkr`tjtdntj|}|dkrtjtd|n|||}t|d||S(	s7return a valid unbundler object for a given magicstringiiitHGsnot a Mercurial bundlesunknown bundle version %ssstart processing of %s streamN(	R,RRRtAbortRt	formatmapR4R(RRtmagicstringtmagictversiontunbundlerclassRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytgetunbundlerst
unbundle20cB@seeZdZdZdZejdZdZdZ	dZ
dZdZd	Z
RS(
s|interpret a bundle2 stream

    This class is fed with a binary stream and yields parts through its
    `iterparts` methods.RcC@s<||_tjd|_d|_tt|j|dS(s<If header is specified, we do not read it out of the stream.N(	RR	t
decompressorsR,t
_decompressort_compressedtsuperRR)(R(RR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)s		cC@svt|jdi}|jtd}|dkrKtjd|n|rr|j|}|j|}n|S(s%dictionary of stream level parameterss!reading bundle2 stream parametersisnegative bundle param size: %i(RRRRRtBundleValueErrorRt_processallparams(R(Rt
paramssize((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs	
cC@stj}x|jdD]{}|jdd}g|D]}tj|^q;}t|dkrx|jdn|j||d||d<qW|S(RTRRiiiN(	R	tsortdictRRRR9R+R,t
_processparam(R(tparamsblockRtpti((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs"
cC@s|stdn|dtjkr;td|nyt|j}WnMtk
r|djrt|jd|qt	j
d|fnX||||dS(sprocess 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 nameisnon letter first character: %rsignoring unknown parameter %rRN(RRRtb2streamparamsmapRtKeyErrortislowerRRRRo(R(RRR}((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs

cc@sh|jVdt|ks t|jtd}|dkrUtjd|ntt|V|r|j|}|j	||V|j
tjdkstn|j
|j|_d}x|dkrcttkst|jtd}tt|V|rd}n
|d7}q|tkr4qn|dkrRtjdn|j|VqWdS(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.
        Risnegative bundle param size: %iiisnegative chunk size: %iN(RtvarsRRRRRRRRRR	RR,RRt
_fpayloadsizet
flaginterrupt(R(RRt
emptycountR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt_forwardchunkss6	

	
cc@s|j|j|j|_t|jd|j}xI|dk	rt|j||j}|V|jdd|j}q;Wt|jddS(s'yield all parts contained in the streams!start extraction of bundle2 partsiisend of bundle2 streamN(	RRRRRt_readpartheaderR,tunbundlepartR[(R(theaderblockRb((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRX
scC@s`|jtd}|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(RRRRRRRR,(R(t
headersize((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs	

cC@s|j|jS(N(RR(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
compressed&s(R=R>R?RR)R	t
propertycacheRRRRRXRR(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs		
		(		
t20c@sfd}|S(s/register a handler for a stream level parameterc@s tkst|t<|S(N(RRR(R (R(s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt	decorator0s
((RR((Rs5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytb2streamparamhandler.stcompressioncC@s\|tjkr0tjd|fd|fntj||_|dk	rXt|_ndS(s<read compression parameter and install payload decompressionRtvaluesN(R	RRRoRR,RGR(RRRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytprocesscompression6sRcB@seZdZdddedZdZedZejdZedZ	edZ
dedZd	Zd
Z
RS(
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.
    RTcC@st|d|_||_||_t||_t||_t|_	xP|j|jD]>\}}||j	krt
d|n|j	j|q`Wd|_||_
dS(Nsduplicated params: %s(RR,RxRnt_dataRqt_mandatoryparamst_advisoryparamstsett_seenparamstRuntimeErrorR.t
_generatedRm(R(RtmandatoryparamstadvisoryparamsRlRmtpnamet__((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)Ps
				cC@sDtj|jdst|j|j|j|j|j|j	S(sreturn 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.tnext(
R	RRlRt	__class__RnRRRRm(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRescC@s|jS(N(R(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRloscC@s.|jdk	r!tjdn||_dS(Nspart is being generated(RR,RtReadOnlyPartErrorR(R(Rl((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRlsscC@s
t|jS(N(R3R(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRyscC@s
t|jS(N(R3R(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR~scC@s|jdk	r!tjdn||jkrCtd|n|jj||j}|rn|j}n|j	||fdS(Nspart is being generatedsduplicated params: %s(
RR,RR
RRR.RRR+(R(RRRmR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRvs	cb@s|jdk	redne|_|jrRd|jg}|jsY|jdne|j	}e|j
}|s|r|jd|r|jd|n|r|jd|n|jdn|js|jdn?ej
|jd	r|jd
n|jde|j|jd|jd
j|n|jrm|jj}n|jj}e|d|j|feee||ee|jg}|j	}|j
}|jeee|e|g}	x:|D]2\}
}|	je|
|	je|qWx:|D]2\}
}|	je|
|	je|qAWeee|	d|	}|j|x.|D]&\}
}|j|
|j|qWx.|D]&\}
}|j|
|j|qWd
j|}
e|de|
eee|
V|
VyKxD|jD]6}e|de|eee|V|VqTWWnek
r|jdnek
r}|jd|ej}d|}e dd|fgde}d|_eedVx|j!d|D]}|Vq0We|deedVe"j#r|d|dj$|dqddUnXe|deedVe%|_dS(Nspart can only be consumed oncesbundle2-output-part: "%s"s (advisory)s	 (params:s
 %i mandatorys %i advisoryRis empty payloadRs streamed payloads %i bytes payloads
RTs
part %s: "%s"isheader chunk size: %ispayload chunk size: %isbundle2-generatorexit
s5bundle2-input-stream-interrupt: encoding exception %ssunexpected error: %sserror:abortRRmiiRsclosing payload chunkis+raise exc_info[0], exc_info[1], exc_info[2](&RR,RRRURnRmR+R9RRRlR	RR
RVtupperRRRxRt_fparttypesizet_fpartidt_fpartparamcountRRt_payloadchunksRt
GeneratorExitt
BaseExceptiontsystexc_infoRRRtispy3twith_tracebackRG(R(RRaRRRtheadertmanpartadvpartparsizesRRt
paramsizestheaderchunkRRdRt	interpart((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs			
	
			%





	
			
	$
cc@sxtj|jdrZtj|j}|jt}x;|rV|V|jt}q9Wnt|jrt|jVndS(smyield chunks of a the part payload

        Exists to handle the different methods to provide data to a part.RN(R	RRltchunkbuffertreadtpreferedchunksizeR9(R(tbuffR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs	(((R=R>R?RGR)RRRltsetterRRRvRR(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR@s	
	ditinterrupthandlercB@s)eZdZdZdZdZRS(sread 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(RR%R)R(R(RR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)
scC@s`|jtd}|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(RRRRRRRR,(R(R((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRs	

cC@s|jjdt|jd|j}|dkrLt|jddSt|j||j}t|j}t|||jjddS(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
(	RR
RRR,RRtinterruptoperationRY(R(RRbRO((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt__call__s
(R=R>R?R)RR'(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR%s		
R&cB@s/eZdZdZedZdZRS(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(RR,RDRRE(R(R((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)3s		cC@stddS(Ns'no repo access from stream interruption(R(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRA8scC@stddS(Ns'no repo access from stream interruption(RH(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRC<s(R=R>R?R)RRARC(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR&-s	RcB@sqeZdZdZdZdZdZddZdZdZ	dd	Zd
ZddZ
RS(
s a bundle part read from a bundlecC@stt|j|||_||_d|_t|_t|_d|_
d|_d|_d|_
d|_d|_d|_|jd|_g|_d|_dS(Ni((RRR)Rt_headerdatat
_headeroffsetRt_initializedtconsumedR,RxRnRRRRpt_payloadstreamt_readheadert
_mandatoryt_chunkindext_pos(R(RRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR)Bs"												
		cC@s.|j}|j|||!}|||_|S(s+return the next <size> byte from the header(R)R((R(RRRl((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt_fromheaderWs	
cC@s%|jtj|}t||S(saread given format from header

        This automatically compute the size of the format to read.(R1RRR(R(RRl((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
_unpackheader^scC@sct||_t||_tj|j|_|jj|jtd|D|_dS(s7internal function to setup all logic related parameterscs@s|]}|dVqdS(iN((RR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pys	<genexpr>msN(	R3RRR	RRtupdateRRp(R(RR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt_initparamses
icc@st|jdkrU|dks-td|jjdtt|jfnF|t|jksztd|tt|j|j|d|j|d}|jt	d}t
|jd|x|r|tkrt
|j|jn|dkr)d|}tj|ne|j|}|d7}||7}|t|jkr|jj|tt|jfn|V|jt	d}t
|jd|qWdS(s/seek to specified chunk and start yielding dataisMust start with chunk 0sUnknown chunk %dispayload chunk size: %isnegative payload chunk size: %iN(R9R/RR+RRRR[RRRRRR%RRRR(R(tchunknumtpostpayloadsizeRatresult((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRos0(
!	


cC@syxft|jD]U\}\}}||kr8|dfS||kr|d||j|ddfSqWtddS(s>for a given payload position, return a chunk number and offsetiis
Unknown chunkN(RWR/R(R(R6Rtppostfpos((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
_findchunks"
%cC@s|jtd}|j||_t|jd|j|jtd|_t|jd|j|j|jjk|_	|jj|_|jt
\}}t|jd||t||}|j|}t|ddd|ddd}|| }||}g}x9|D]1\}	}
|j
|j|	|j|
fq,Wg}x9|D]1\}	}
|j
|j|	|j|
fqnW|j||tj|j|_t|_dS(s$read the header and setup the objectispart type: "%s"s
part id: "%s"spart parameters: %iNii(R2RR1RnRRRRxRRmRRtzipR+R4R	R RR,RGR*(R(ttypesizetmancounttadvcounttfparamsizesRtmansizestadvsizest	manparamsRRt	advparams((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR-s.)

))cC@s|js|jn|dkr4|jj}n|jj|}|jt|7_|dksyt||kr|jr|jr|jj	d|jnt
|_n|S(sread payload datas*bundle2-input-part: total payload size %i
N(R*R-R,R,R!R0R9R+RR
RG(R(RRl((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR!s	
cC@s|jS(N(R0(R(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRscC@sj|dkr|}ni|dkr1|j|}nM|dkrk|jsS|jn|jdd|}ntd|f||jddkr|jr|jnd|ko|jddknstdn|j|krf|j|\}}tj|j||_	|j|}t
||krZtjt
dn||_ndS(NiiiisUnknown whence value: %rsOffset out of rangesSeek failed
(R0R+R!R/RR;R	R RR,R9RRR(R(RRtnewposRtinternaloffsettadjust((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR[s(		
!
'N(R=R>R?R)R1R2R4RR;R-R,R!RR[(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyR?s				
 			#	taborttunsupportedcontentt	pushracedRRtlistkeystdigeststhttpthttpssremote-changegroupthgtagsfnodescC@s}tj}tttj||d<tj|tjrftdtj	D}||d<n|ryd|d<n|S(sreturn the bundle2 capabilities for a given repo

    Exists to allow extensions (like evolution) to mutate the capabilities.
    Rcs@s|]}d|VqdS(sV%iN((RR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pys	<genexpr>st
obsmarkerstpushback((
R^RR3RRtsupportedincomingversionsRt	isenabledtexchangeopttformats(RAt
allowpushbackRtsupportedformat((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytgetrepocapss

cC@sH|jd}|r&|dkr&iStj|jd}t|S(s0return the bundle capabilities of a peer as dictRKRT(tcapableRRR(tremotetrawtcapsblob((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytbundle2capss
cC@sB|jdd}g|D]%}|jdrt|d^qS(sNextract the list of supported obsmarkers versions from a bundle2caps dict
    RPtVi((R4Rtint(Rtobscapstc((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytobsmarkersversion
sc
@s^|dkrt|}|j||jdd|j}|jd|jd|jkr|jdt|jddtn|j}n|d
kst
|jdkrtjt
d	nt|\}	|	tjkrtjt
d
|	ntj|	|jfd}|}tj|||d|S(sWrite 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.
    RRRlRtclcountt	nbchangesRmt01s.old bundle types only supports v1 changegroupss#unknown stream compression type: %sc3@sBVx+D]#}j|}|r|VqqWjVdS(N(RR(RRl(Rtsubchunkitertz(s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt	chunkiter.s
tvfsN(RRRuRRvRtextrasRwRR,RRRRtbundletypesR	RRtwritechunks(
Rtcgtfilenamet
bundletypeRiRtbundleRbRhtcomp((RRfRgs5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pytwritebundles*	


	RRRdttreemanifestcC@s|j|jjdd}tj||d}d}d|jkrdt|jjd}nd|jkrd|jjkrt	|jj
dkrtjt
dn|jjjd|jj|jjn|j|jddd|}|jjd	i|d
6|jdk	r|jjddt}|jd
t|jdt|jd
d|dtn|jstdS(sapply a changegroup part on the repo

    This is a very early implementation that will massive rework before being
    inflicted to any end-user.
    RReRdRsis[bundle contains tree manifests, but local repo is non-empty and does not use tree manifestsRKt
expectedtotalRtreturnsreply:changegroupRmsin-reply-tos%iN(RCRR4RRR,R_RAtrequirementsR9t	changelogRRRR.t_applyopenerreqst_writerequirementstapplyRBRDRuRRvRwRxR!R(ROtinparttunpackerversionRmtnbchangesetstretRb((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlechangegroup;s*
	
RRs	digest:%scC@sy|jd}Wn*tk
r=tjtddnXtj|}|jtdkrtjtd|jnyt	|jd}WnSt
k
rtjtddn*tk
rtjtddnXi}xu|jjddjD]X}d	|}y|j|}Wn*tk
r[tjtd|nX|||<qWtj
tj|j|||}	|jd
dlm}
|
j|jj|	|}t|tjstjtdtj|n|j|jd
d
}|jjdi|d6|jdk	r|jjd}
|
jdt |j!dt"|
jdd|dt"ny|	j#WnDtjk
r}tjtdtj|t |fnX|j$st%dS(sapply 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 urlsRs0remote-changegroup: invalid value for param "%s"RLRTs	digest:%si(texchanges%s: not a bundle version 1.0RKRRusreply:changegroupsin-reply-toRms%isbundle at %s is corrupted:
%sN(&RRRRRR	RtschemeR^R_RR4Rt
digestcheckertopenRRCRTRt
readbundleRAt
isinstanceRtcg1unpackerthidepasswordRzRBR.RDR,RuRvRwRxRtvalidateR!R(ROR{traw_urlt
parsed_urlRRLttypRRt	real_partRRmR~RbR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleremotechangegroupesV



"

$
#sreply:changegroupRusin-reply-tocC@sGt|jd}t|jd}|jjdi|d6|dS(NRusin-reply-toR(R_RRBR.(ROR{R~treplyto((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlereplychangegroupsscheck:headscC@s|jd}g}x2t|dkrI|j||jd}qW|sWt|jjddry|jnt|t|jj	krt
jdndS(scheck 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.itexperimentaltbundle2lazylockings3repository changed while pushing - please try againN(R!R9R+RRRRCRRAtheadsRt	PushRaced(ROR{thR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlecheckheadss


!RkcC@s;x4|jjD] }|jjtd|qWdS(s3forward output captured on the server to the clientsremote: %s
N(R!RRR{R(ROR{R((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleoutputsRfcC@s=t|j}|jdkr9t|j||_ndS(sqNotify that a reply bundle should be created

    The payload contains the capabilities information for the replyN(RR!RDR,RR(ROR{R((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlereplycapsst
AbortFromPartcB@seZdZRS(s=Sub-class of Abort that denotes an error from a bundle2 part.(R=R>R?(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyRsserror:abortRthintcC@s)t|jdd|jjddS(s*Used to transmit abort error over the wireRRN(RRR4(ROR{((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleerrorabortss
error:pushkeyt	namespaceRtnewtoldR~cC@s_i}x9dD]1}|jj|}|dk	r
|||<q
q
Wtj|jd|dS(	s=Used to transmit failure of a mandatory pushkey over the wireRRRRR~sin-reply-toN(RRRRR~(RR4R,Rt
PushkeyFailed(ROR{RRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleerrorpushkeys
serror:unsupportedcontentRRcC@sxi}|jjd}|dk	r1||d<n|jjd}|dk	re|jd|d<ntj|dS(s4Used to transmit unknown content error over the wireRRsN(RR4R,RRRo(ROR{RRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleerrorunsupportedcontents
serror:pushracedcC@s#tjtd|jddS(s.Used to transmit push race error over the wirespush failed:RN(Rt
ResponseErrorRR(ROR{((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleerrorpushracedscC@s?|jd}tj|j}|jjd||fdS(s6retrieve pushkey namespace content stored in a bundle2RRKN(RRt
decodekeysR!RBR.(ROR{Rtr((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlelistkeyss
cC@stj}||jd}||jd}||jd}||jd}|jjddrw|jn|jj||||}i|d6|d6|d6|d6}|jjd||j	dk	r$|j	jd}	|	jd	t
|jd
t|	jdd|d
tn|jr|ri}
x1dD])}||jkrA|j||
|<qAqAWtjdt
|j|
ndS(sprocess a pushkey requestRRRRRRRs
reply:pushkeysin-reply-toRmRus%iR~R2N(RRRRR~(RtdecodeRRRRCRARBR.RDR,RuRvRwRxRRmRR(ROR{tdecRRRRR~trecordtrpartR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt
handlepushkeys.	



s
reply:pushkeycC@sGt|jd}t|jd}|jjdi|d6|dS(s(retrieve the result of a pushkey requestRusin-reply-toRN(R_RRBR.(ROR{R~R2((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlepushkeyreplysRPcC@s6|j}|j}|jjddtrM|jjdt|n|jr}|jj	j
r}|jjjddS|jj	j||}|r|jjj
td|n|jjdi|d6|jdk	r2|jjd	}|jd
t|jdt|jdd|dtndS(
s&add a stream of obsmarkers to the repoRsobsmarkers-exchange-debugs&obsmarker-exchange: %i bytes received
s2ignoring obsolescence markers, feature not enabledNs%i new obsolescence markers
RPRsreply:obsmarkerssin-reply-toRms%i(RCR!RtconfigRtwriteR9RmRAtobsstoretreadonlyR
tmergemarkersR{RRBR.RDR,RuRvRwRx(ROR{RMt
markerdataRR((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleobsmarker&s  sreply:obsmarkerscC@sGt|jd}t|jd}|jjdi|d6|dS(s(retrieve the result of a pushkey requestRsin-reply-toRPN(R_RRBR.(ROR{R~R2((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandleobsmarkerreply=scC@s|jjddr"|jntj|jj}d}xztr|jd}|jd}t	|dkst	|dkr|jj
dPn|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.
    RRiis1ignoring incomplete received .hgtags fnodes data
is'applied %i hgtags fnodes cache entries
N(
RRRCRthgtagsfnodescacheRAt
unfilteredRGR!R9R
tsetfnodeR(ROR{tcachetcounttnodetfnode((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pythandlehgtagsfnodesDs
	$
((RTN((RN(RR(RR((RHRIRJR(((RMRN((RRdRs(Rusin-reply-to(RR(RRRRR~sin-reply-to(RR(R(R(RRRR(Rusin-reply-to(Rsin-reply-to(aR?t
__future__RRtreRRRti18nRRTRRRRRRRR	turlerrRtpackRtunpackRRRRRRRR"tcompileRRRRRRR#tobjectR$R@RRHRIR,RSRQRYRRRktbundlepriorityRRRRRRRRRRR%R&RR3RtDIGESTStkeysR^RRXR]RbRrRtkt_remotechangegroupparamsRRRRRRRRRRRRRRRRR(((s5/usr/lib/python2.7/dist-packages/mercurial/bundle2.pyt<module>s:								-		?	H		
u)
	
(

		+(*H