
    6hqs                       S SK Jr  S SKrS SKrSSKJr  SSKJr  SSKJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJr  SSKJrJr  \R<                  r\R>                  r\" S5      r \" S	5      r!S
\ \!4-  r"S r#SOS jr$SOS jr%S r&S r'\RP                  " 5       r)SPS jr*\*" SSSS9S 5       r+\*" SSSS9S 5       r,\*" SSS9S 5       r-\*" SSSS9S 5       r.\*" SS SS9S! 5       r/\*" S"S#SS9S$ 5       r0\*" S%S&SS9S' 5       r1/ S(Qr2S) r3\*" S*SS9S+ 5       r4\*" S,S-SS9S. 5       r\*" S/S0SS9S1 5       r5\*" S2S3SS9S4 5       r6S5 r7\*" S6S&SS9S7 5       r8\*" S8SS9S9 5       r9\*" S:SS9S; 5       r:\*" S<S=SS9S> 5       r;\*" S?S@SS9SA 5       r<\*" SBSCSS9SD 5       r=\*" SESFSS9SG 5       r>\*" SHSISS9SJ 5       r\*" SKSS9SL 5       r?\*" SMS8SS9SN 5       r@g)Q    )annotationsN   )_)hex)bundle2bundlecacheschangegroup	discoveryencodingerrorexchangehookpushkeypycompatrepoviewrequirementsstreamcloneutilwireprototypes)procutil
stringutils/   incompatible Mercurial client; bundle2 requireds9   see https://www.mercurial-scm.org/wiki/IncompatibleClients   %s
(%s)
c                    U R                  5        H/  nUR                  S5      (       d  M  USS R                  S5      s  $    SS/$ )a  Returns a list of compression methods supported by the client.

Returns a list of the compression methods supported by the client
according to the protocol capabilities. If no such capability has
been announced, fallback to the default of zlib and uncompressed.
s   comp=   N   ,s   zlibs   none)getprotocaps
startswithsplit)protocaps     =/usr/lib/python3/dist-packages/mercurial/wireprotov1server.pyclientcompressionsupportr!   1   sH     !!#>>(##qr7==&& $ W    c                    U R                   R                  SS5      nU(       a  Ub  US-   [        R                  ;   a  US-  nU R	                  U5      $ )zObtain the repo used for processing wire protocol commands.

The intent of this function is to serve as a monkeypatch point for
extensions that need commands to operate on different repo views under
specialized circumstances.
   servers   views   .hidden)uiconfigr   filtertablefiltered)repor   commandaccesshidden
viewconfigs        r    getdispatchrepor-   A   sO     	73J
 	"#x';';;j 
==$$r"   c                `    [        XX#S9n [        U   u  pEUR                  U5      nU" X/UQ76 $ )N)r+   )r-   commandsgetargs)r)   r   r*   r+   funcspecargss          r    dispatchr4   V   s8    4KD'"JD==D#d##r"   c                    0 nU H  nXB;   d  M
  X$   X4'   X$	 M     U(       a3  [         R                  R                  SU SR                  U5      4-  5        U$ )Ns,   warning: %s ignored unexpected arguments %s
r   )r   stderrwritejoin)cmdkeysothersoptsks        r    optionsr>   _   s[    D;iDG	  <DIIf%&'	
 Kr"   c                *   U R                   n[        R                  U R                  ;   nU(       a  UR	                  SSU-  5      nUb  U$ UR	                  SSU-  5      nUb  U$ U(       a  UR	                  SS5      nUb  U$ UR	                  SS5      $ )zWhether a bundle1 operation is allowed from the server.

Priority is:

1. server.bundle1gd.<action> (if generaldelta active)
2. server.bundle1.<action>
3. server.bundle1gd (if generaldelta active)
4. server.bundle1
r$   s   bundle1gd.%ss
   bundle1.%ss	   bundle1gds   bundle1)r%   requirementsmodGENERALDELTA_REQUIREMENTr   
configbool)r)   actionr%   gdvs        r    bundle1allowedrF   m   s     
B		1	1T5F5F	FB	MM)_v%=>=H
i!78A}	MM)\2=H==J//r"      pushc                F  ^ ^^^ [         R                  R                  5        VVs1 s H  u  p4US   S:X  d  M  UiM     snnmTS;  a  [        R                  " ST-  5      eTc  Sm[        T[        5      (       d  [        R                  " S5      eUU UU4S jnU$ s  snnf )a{  Decorator to declare a wire protocol command.

``name`` is the name of the wire protocol command being provided.

``args`` defines the named arguments accepted by the command. It is
a space-delimited list of argument names. ``*`` denotes a special value
that says to accept all named arguments.

``permission`` defines the permission type needed to run this command.
Can be ``push`` or ``pull``. These roughly map to read-write and read-only,
respectively. Default is to assume command requires ``push`` permissions
because otherwise commands not declaring their permissions could modify
a repository that is supposed to be read-only.
s   versionr   rG      pullsC   invalid wire protocol permission; got %s; expected "push" or "pull"r"   s:   arguments for version 1 commands must be declared as bytesc                   > T[         ;   a  [        R                  " ST-  5      e[        R                  " U TTTS9[         T'   U $ )Ns+   %s command already registered for version 1)r3   
transports
permission)r/   r   ProgrammingErrorr   commandentry)r1   r3   namerM   rL   s    r    register"wireprotocommand.<locals>.register   sL    8((>E  (44t
z
 r"   )r   
TRANSPORTSitemsr   rN   
isinstancebytes)rP   r3   rM   r=   rE   rQ   rL   s   ```   @r    wireprotocommandrW      s      %//5577da1Z=A;M7J ++$$13=>
 	

 |dE""$$I
 	
	 	 O;s
   BBs   batchs   cmds *rJ   )rM   c           	        [         R                  n/ nUR                  S5       GH  nUR                  SS5      u  px0 n	UR                  S5       H/  n
U
(       d  M  U
R                  S5      u  pU" U5      X" U5      '   M1     [        U   u  p[        U   R                  nUS;   d   eUR                  U5        U(       aw  UR                  5       n0 nU HA  nUS:X  a0  0 nU	R                  5        H  nUU;  d  M  U	U   UU'   M     UUS'   M9  U	U   UU'   MC     U" X/U Vs/ s H  nUU   PM
     snQ76 nOU" X5      n[        U[         R                  5      (       a  Us  $ [        U[         R                  [        45      (       d   e[        U[         R                  5      (       a  UR                  nUR                  [         R                  " U5      5        GM     [         R                  " SR                  U5      5      $ s  snf )N   ;    r   r      =rI      *)r   unescapebatchargr   r/   rM   	checkpermr:   rU   ooberrorbytesresponserV   dataappendescapebatchargr8   )r)   r   cmdsr;   unescapeargrespairopr3   valsanrE   r1   r2   permr:   ra   r=   starkeyresults                         r    batchrp      s    11K
C

4 ::dA&D!Aqwwt}'21~[^$ " b\
 |&&))))::<DD9D#yy{d?(,S	DI  + "&DJ"1gDG  $@$(?$Qa$(?@F$&Ffn5566M &>#?#?"GHHHHfn::;;[[F

>0089K !N ''		#77 )@s   !Hs   betweens   pairsc                F   UR                  S5       Vs/ s H  n[        R                  " US5      PM     nn/ nU R                  U5       H+  nUR	                  [        R
                  " U5      S-   5        M-     [        R                  " SR                  U5      5      $ s  snf )NrZ      -   
r"   )r   r   
decodelistbetweenrb   
encodelistr`   r8   )r)   r   pairsprbs         r    ru   ru      s    9>T9JK9JA^&&q$/9JEK
A\\% 	**1-56 ! ''44 Ls   !B	   branchmapc                J   U R                  5       n/ nUR                  5        HY  u  pE[        R                  [        R
                  " U5      5      n[        R                  " U5      nUR                  SXg4-  5        M[     [        R                  " SR                  U5      5      $ )Ns   %s %srs   )	branchmaprT   urlreqquoter   	fromlocalr   rv   rb   r`   r8   )r)   r   r}   headsbranchnodes
branchnamebranchnodess           r    r}   r}      s     IE"*\\("4"4V"<=
$//6X 99: +
 ''

5(9::r"   s   branches   nodesc                    [         R                  " U5      n/ nU R                  U5       H+  nUR                  [         R                  " U5      S-   5        M-     [         R
                  " SR                  U5      5      $ )Nrs   r"   )r   rt   branchesrb   rv   r`   r8   )r)   r   r   ry   rz   s        r    r   r     sa    %%e,E
A]]5!	**1-56 " ''44r"   s   get_cached_bundle_inlines   pathc                   [         R                  " U R                  S5      (       a"  [         R                   " U R                  U SSUS9  U R                  R                  SS5      nU R                  R                  U5      nU R                  R                  X25      nU R                  R                  U5      (       d  [        R                  " SU-  5      e[        R                  R                  U5      n[        R                  R                  U5      R                  U5      (       d  [        R                  " SU-  5      eS nU" U R                  U5      n[        R                  " USS	9$ )
z4
Server command to send a clonebundle to the client
s   pretransmit-inline-clone-bundleT)throwclonebundlepathr$   s   peer-bundle-cache-roots   clonebundle %s does not exists'   clonebundle %s is using an illegal pathc              3    #    U " USS9 n[         R                  " UR                  5       5      S   n[        R                  " U5      v   [        R
                  " U5       S h  vN   S S S 5        g  N! , (       d  f       g = f7f)NF)	auditpath   )osfstatfilenor   uvarintencodefilechunkiter)vfsbundle_pathflengths       r    	generator+get_cached_bundle_inline.<locals>.generator%  sd     .!XXahhj)!,F$$V,,))!,,, /. - /.s/   BAA3#A1$A3(	B1A33
B=Bgenprefer_uncompressed)r   hashookr%   r&   r   r8   existsr   Abortr   pathrealpathr   r   	streamres)	r)   r   r   bundle_rootbundle_root_dirr   clonebundles_dirr   streams	            r    get_cached_bundle_inliner     s   
 ||DGG?@@		GG. 	
 ''..,EFKhhmmK0OhhmmK6O88???++kk:TABBww''877O,778HIIkkDtKLL- txx1F##DIIr"   s   clonebundlesr"   c                :   [         R                  " U 5      n/ nUR                  5        H:  nUR                  [         R                  5      (       a  M)  UR                  U5        M<     UR                  S5        [        R                  " SR                  U5      5      $ )zA legacy version of clonebundles_manifest

This version filtered out new url scheme (like peer-bundle-cache://) to
avoid confusion in older clients.
r"   rs   )	r   get_manifest
splitlinesr   CLONEBUNDLESCHEMErb   r   r`   r8   )r)   r   manifest_contentsmodified_manifestlines        r    clonebundlesr   0  s     %11$7!,,.??<99::  & / S!''

3D(EFFr"   s   clonebundles_manifestr\   c                Z    [         R                  " U 5      n[        R                  " U5      $ )a  Server command for returning info for available bundles to seed clones.

Clients will parse this response and determine what bundle to fetch.

Extensions may wrap this command to filter or dynamically emit data
depending on the request. e.g. you could advertise URLs for the closest
data center given the client's IP address.

The only filter on the server side is filtering out inline clonebundles
in case a client does not support them.
Otherwise, older clients would retrieve and error out on those.
)r   r   r   r`   )r)   r   r3   r   s       r    clonebundles_2r   B  s'     %11$7''(9::r"   )   lookupr{      pushkey   known	   getbundles   unbundlehashc                R   [        [        5      n[        R                  SU5      (       a  UR	                  S5        [
        R                  " U 5      (       a  U R                  R                  SS5      (       a  UR	                  S5        [
        R                  " U 5      nU[        R                  1-
  (       d  UR	                  S5        O,UR	                  SSR                  [        U5      5      -  5        U R                  R                  SS	5      (       aP  [        R                  " [        R                   " U SS
95      nUR	                  S["        R%                  U5      -   5        UR	                  SSR                  [        R&                  5      -  5        U R                  R                  SS5      (       a_  UR	                  [(        R*                  5        U R                  R                  SS5      (       a  UR	                  [(        R,                  5        UR/                  X5      $ )a  return a list of capabilities for a repo

This function exists to allow extensions to easily wrap capabilities
computation

- returns a lists: easy to alter
- change done here will be propagated to both `capabilities` and `hello`
  command without any other action needed.
   changegroupsubsetr$   s   preferuncompresseds   stream-preferreds   streams   streamreqs=%sr   s   experimentals   bundle2-advertise)roles   bundle2=s   unbundle=%ss   narrows   narrowservebrokenellipses)listwireprotocapsr/   commandavailablerb   r   allowservergenerationr%   rB   streamed_requirementsr@   REVLOGV1_REQUIREMENTr8   sortedr   
encodecapsgetrepocapsr~   r   bundlepriorityr   	NARROWCAPELLIPSESCAPaddcapabilities)r)   r   capsrequiredformatscapsblobs        r    _capabilitiesr   ^  s    D   !5u==()((..77i)>??KK+,%;;DA/"F"F!GGKK	" KK(499VO5L+MMNww/+?@@%%g&9&9$Y&OPK&,,x"889KK7+A+A!BBCww/955N,,-77o/KLLKK223  ,,r"   s   capabilitiesc                t    [        X5      n[        R                  " SR                  [	        U5      5      5      $ )NrZ   )r   r   r`   r8   r   r)   r   r   s      r    capabilitiesr     s*    %D''		&,(?@@r"   s   changegroups   rootsc                   ^ [         R                  " U5      n[        R                  " XU R	                  5       S9n[
        R                  " XSS5      m[        U4S jS5      n[         R                  " US9$ )Nmissingrootsancestorsof   01   servec                 &   > T R                  S5      $ Ni   readcgs   r    <lambda>changegroup.<locals>.<lambda>      rwwu~r"   r"   r   )	r   rt   r
   outgoingr   changegroupmodmakechangegroupiterr   )r)   r   rootsr   r   r   r   s         @r    r	   r	     sb    %%e,E!!djjlH 
	'	'x	HB
%s
+C##,,r"   r   s   bases headsc                   ^ [         R                  " U5      n[         R                  " U5      n[        R                  " XUS9n[        R
                  " XSS5      m[        U4S jS5      n[         R                  " US9$ )Nr   r   r   c                 &   > T R                  S5      $ r   r   r   s   r    r   #changegroupsubset.<locals>.<lambda>  r   r"   r"   r   )r   rt   r
   r   r   r   r   r   )r)   r   basesr   r   r   r   s         @r    changegroupsubsetr     sg    %%e,E%%e,E!!$NH		'	'x	HB
%s
+C##,,r"      debugwireargss	   one two *c           	         [        SSS/U5      n[        R                  " U R                  " X#40 [        R
                  " U5      D65      $ )Nr   s   threes   four)r>   r   r`   debugwireargsr   	strkwargs)r)   r   onetwor;   r<   s         r    r   r     sI     #h%8&AD''3@x'9'9$'?@ r"   c                  ^^^ S nU R                   R                  S5      nU(       d  g[        R                  " X5      n[        R                  " XSS9nU(       d  gU R                  5       R                  mTR                  U V	s/ s H  n	TR                  U	5      PM     sn	SS9mTR                  U V	s/ s H  n	TR                  U	5      PM     sn	SS9m[        U5      n
U GH#  nUR                  S5      n[        R                  R                  R                  U5      nU(       a  X;  a  X;  a  MQ  SU;   a_   U" US   5      nUR                  U5      (       a  M{  [!        UU4S	 jU 5       5      (       a  M  [#        UUU4S
 jU 5       5      (       a  M  SU;   a)   U" US   5      n[!        UU4S jU 5       5      (       d  M  US   nU R$                  R'                  SU-  5         U R                   R)                  U5      s  $    gs  sn	f s  sn	f ! [         a     GMA  f = f! [         a     GMS  f = f! [*         a#    U R$                  R'                  SU-  5         GM  f = f)ay  Return a file object for the first matching pullbundle.

Pullbundles are specified in .hg/pullbundles.manifest similar to
clonebundles.
For each entry, the bundle specification is checked for compatibility:
- Client features vs the BUNDLESPEC.
- Revisions shared with the clients vs base revisions of the bundle.
  A bundle can be applied only if all its base revisions are known by
  the client.
- At least one leaf of the bundle's DAG is missing on the client.
- Every leaf of the bundle's DAG is part of node set the client wants.
  E.g. do not send a bundle of all changes if the client wants only
  one specific branch of many.
c                x    U R                  S5       Vs1 s H  n[        R                  " U5      iM     sn$ s  snf )NrY   )r   binascii	unhexlify)shs     r    decodehexstring(find_pullbundle.<locals>.decodehexstring  s-    /0wwt}=}!""1%}===s    7s   pullbundles.manifestNT)pullbundles)	inclusives   COMPRESSION   headsc              3  L   >#    U  H  nTR                  U5      T;   v   M     g 7fNrev.0r   cl
common_ancs     r    	<genexpr>"find_pullbundle.<locals>.<genexpr>  s     E266#;*,   !$c              3     >#    U  H4  nTR                  U5      T;  =(       a    TR                  U5      T;  v   M6     g 7fr   r   )r   r   r   r   	heads_ancs     r    r   r    s:      'C s9,NJ1NN's   <?s   basesc              3  L   >#    U  H  nTR                  U5      T;   v   M     g 7fr   r   r   s     r    r   r    s     ILSrvvc{j0Lr  s   URLs   sending pullbundle "%s"
s   pullbundle "%s" not accessible
)r   tryreadr   parseclonebundlesmanifestfilterclonebundleentries
unfiltered	changelog	ancestorsr   r!   getr   compengines_bundlenames	TypeErrorissubsetallanyr%   debugopenOSError)r)   r   r<   clheadsr   commonr   manifestrf   r   compformatsentrycompaltcompbundle_headsbundle_basesr   r   r   r  s                    @@@r    find_pullbundler    s-    > xx 78H

0
0
@C

/
/t
LC			$	$BU;UcbffSkU;tLIf=fsrvvc{f=NJ*51Kyy(""//33D9D+0J u.uX? $$V,,EEEE '   u.uX? ILIIIV}2T9:	88==&&C J Q <=      	GGMM=DE	sB   H6H<H!H)-H;
H&%H&)
H87H8;(I('I(r   c                   [        S[        R                  R                  5       U5      nUR	                  5        H  u  pE[        R                  U   nUS:X  a  [        R
                  " U5      X4'   M8  US:X  a  [        UR                  S5      5      X4'   M\  US:X  a  [        UR                  S5      5      X4'   M  US:X  a  US:X  a  SX4'   M  [        U5      X4'   M  US	:w  d  M  [        S
U-  5      e   [        U S5      (       dq  [        R                  " UR                  S5      5      (       dG  UR                  S:X  a  [        R                   " ["        5      $ [$        R&                  " [(        [*        S9e [        U R,                  R/                  5       5      n[        UR                  S[        5       5      5      n[        UR                  S[        5       5      5      n	U	R1                  U R2                  5        U R4                  R7                  SS5      (       aQ  SUR9                  5       ;   a=  [;        XX7X5      n
U
(       a)  [        R<                  " [>        R@                  " U
5      SS9$ U R4                  R7                  SS5      (       aL  UR                  SS5      nU(       a3  U	(       d,  Xx:X  a'  [$        R&                  " [C        S5      [C        S5      S9e[        RD                  " U S40 [F        RH                  " U5      D6u  pUR                  SS5      n[        R<                  " X(       + S9$ ! [$        R&                   Ga  n[        R                  " UR                  S5      5      (       d9  UR                  S:X  a(  [        R                   " URJ                  S-   5      s S nA$ e [L        RN                  " U R4                  5      nSURJ                  4/n/ nURP                  b  URS                  SURP                  45        URU                  [L        RV                  " SUU5      5        URY                  5       nSn S nAGN+S nAff = f) Nr   r   s   csvr   s   scsvs   boolean   0Fs   plains    unknown getbundle option type %srJ   s
   bundlecaps   http-v1hintr   s   commonr$   s
   pullbundles   partial-pullTr   s   disablefullbundles   cgs%   server has pull-based clones disableds/   remove --pull if specified or upgrade Mercurialr   s   prefercompressedrs      message   hint   error:abort)-r>   r   GETBUNDLE_ARGUMENTSr:   rT   rt   r   r   setboolKeyErrorrF   r   bundle2requestedr  rP   r_   bundle2requiredr   r   bundle2requiredmainbundle2requiredhintr
  r   discardnullidr%   rB   r   r  r   r   r   r   getbundlechunksr   r   messager   bundle20r$  rb   addpart
bundlepart	getchunks)r)   r   r;   r<   r=   rE   keytyper  r   r  bundler	   infochunksprefercompressedexcbundlermanargsadvargss                      r    	getbundlerA    sh   n88==?D 

 44Q7h$//2DG1774=)DG!''$-(DG
" Dyq' >HII! $ $((((-)@AAzzZ'%..??++18KLL+!dnn**,-DHHXsu-.TXXi/0t{{#GGy-885#5#5#77 %T$OF%//**62  77i)=>>((5$/K6g.>kk>?MN 
  //(
&006
  88$7>" ##(< ! ;; !((-)@AAzzZ'%..s{{U/BCC""477+,-88NNGSXX./**>7GLM""$ !s.   6C5L2 ,B-L2 2Q	AQ#Q	)BQQ	r   c                |    U R                  5       n[        R                  " [        R                  " U5      S-   5      $ )Nrs   )r   r   r`   rv   )r)   r   r   s      r    r   r   B  s.    

A''(A(A!(Du(LMMr"   s   helloc                ^    [        X5      R                  n[        R                  " SU-  5      $ )aN  Called as part of SSH handshake to obtain server info.

Returns a list of lines describing interesting things about the
server, in an RFC822-like format.

Currently, the only one defined is ``capabilities``, which consists of a
line of space separated tokens describing server abilities:

    capabilities: <token0> <token1> <token2>
s   capabilities: %s
)r   ra   r   r`   r   s      r    hellorD  H  s+     $))D''(=(DEEr"   s   listkeys	   namespacec                    [        U R                  [        R                  " U5      5      R	                  5       5      n[
        R                  " [        R                  " U5      5      $ r   )	r   listkeysr   tolocalrT   r   r`   
pushkeymod
encodekeys)r)   r   	namespaceds       r    rG  rG  X  sE    t}}X--i89??ABA''
(=(=a(@AAr"   r      keyc                     [         R                  " U5      nU R                  U5      n[        U5      nSn[        R                  " SXe4-  5      $ ! [         a"  n[
        R                  " U5      nSn S nANAS nAff = f)Nr   r   s   %d %s
)	r   rH  lookupr   	Exceptionr   forcebytestrr   r`   )r)   r   rn   r=   rk   ry   successinsts           r    rO  rO  ^  ss    S!KKNF ''
g\(ABB  ##D)s   4A 
A<A77A<r   s   nodes *c                    SR                  S U R                  [        R                  " U5      5       5       5      n[        R                  " U5      $ )Nr"   c              3  H   #    U  H  o=(       a    S =(       d    Sv   M     g7f)   1r!  N )r   rz   s     r    r   known.<locals>.<genexpr>m  s      $Pq
dd$Ps    ")r8   knownr   rt   r`   )r)   r   r   r;   rE   s        r    rY  rY  k  sD     $(JJ~/H/H/O$P 	A ''**r"   s	   protocapss   capsc                    UR                   [        R                  :X  a  [        UR	                  S5      5      Ul        [        R                  " S5      $ )NrZ   s   OK)rP   r   SSHV1r)  r   
_protocapsr`   r   s      r    	protocapsr]  s  s;    zz^)))tzz$/0''..r"   r   s   namespace key old newc                r   [        U5      S:X  aC  [        R                  " U5      U:w  a)   UR                  S5        [        R
                  " U5      nO[        R
                  " U5      nUR                  5        nU R                  [        R
                  " U5      [        R
                  " U5      [        R
                  " U5      U5      =(       d    SnS S S 5        W(       a  UR                  5       OSn[        R                  " S[        W5      U4-  5      $ ! [         a     Nf = f! , (       d  f       N[= f)N   zutf-8Fr"   s   %d
%s)lenr   	escapestrdecoder   rH  UnicodeDecodeErrormayberedirectstdior   getvaluer   r`   int)r)   r   rK  rn   oldnewoutputry   s           r    r   r   z  s     3x2~*..s3s:	JJw""3'C s#		!	!	#vLL  +  %  %	   	
 
$ #)V__cF''	SVV4D(DEE# " 		
 
$	#s   'D 9AD(
D%$D%(
D6s
   stream_outc                V    [         R                  " [        R                  " U 5      5      $ )zIf the server supports streaming clone, it advertises the "stream"
capability with a value representing the version and flags of the repo
it is serving. Client checks to see if it understands the format.
)r   streamreslegacyr   generatev1wireproto)r)   r   s     r    r   r     s      ))+*I*I$*OPPr"   s   unbundlec           
       ^^^ [         R                  " U5      nUR                  5        n [        R                  " XS5        S n UR                  5       mU R                  R                  SS5      (       a  U4S jn[        R                  " T5      mOSu  mmUU4S jn[        R                  " SS	9u  nmU R                  R                  S
T-  5        [        R                  " U[        R                  " S5      5      mT H  nTR!                  U5        M     TR#                  S5        [        R$                  " U R                  TS 5      n['        U[(        R*                  5      (       ah  [-        U S5      (       dW  UR.                  S:X  a*  [         R0                  " [2        5      U" 5         sS S S 5        $ [4        R6                  " [8        [:        S9e[        R<                  " XUSUR?                  5       5      n	[A        U	S5      (       a2  [         RB                  " U	RE                  5       S9U" 5         sS S S 5        $ [         RF                  " X(       a  URI                  5       OS5      U" 5         sS S S 5        $ ! U" 5         f = f! [4        RJ                  [4        R6                  [4        RL                  4 Ga8  n
[O        U
SS5      (       Gd   e ! [4        R6                   a  n
[P        RR                  R!                  U
RU                  5       5        [P        RR                  RW                  5         [         RF                  " SU(       a  URI                  5       OS5      s S n
A
s S n
A
sS S S 5        $ S n
A
f[4        RL                   aS    [         RX                  " [        RZ                  " U
5      U(       a  URI                  5       OS5      s s S n
A
sS S S 5        $ f = f[\        R^                  " U R                  5      n[O        U
SS5       H  nURa                  U5        M       e ! [4        Rb                   Ga'  n
[O        U
SS 5      nUb  SURe                  SS5      ;  a  e URg                  S5      nURi                  SU
Rj                  5        U
Rl                  b  URi                  SU
Rl                  SS9  U
Rn                  b  URi                  SU
Rn                  SS9  U
Rp                  b  URi                  S U
Rp                  SS9  U
Rr                  b  URi                  S!U
Rr                  SS9  U
Rt                  b  URi                  S"U
Rt                  SS9   S n
A
GObS n
A
ff = f! [4        RJ                   a  n
URg                  S#5      nU
Rv                  b  URi                  S$U
Rv                  5        U
Rx                  (       a+  URi                  S%S&R{                  U
Rx                  5      5         S n
A
OS n
A
f[4        R6                   al  n
S'U
R|                  4/n/ nU
R~                  b  UR                  S(U
R~                  45        URa                  [\        R                  " S)UU5      5         S n
A
OMS n
A
f[4        RL                   a3  n
URg                  S*S'[        R                  " U
5      4/5         S n
A
OS n
A
ff = f[         RB                  " URE                  5       S9s S n
A
sS S S 5        $ S n
A
ff = f! , (       d  f       g = f)+Ns   preparing changesc                     g r   rW  rW  r"   r    r   unbundle.<locals>.<lambda>  s    dr"   r$   s   streamunbundlec                    > T H  n M     g r   rW  )rx   payloads    r    cleanupunbundle.<locals>.cleanup  s     ")A  ")r"   )NNc                 p   > T (       a  T R                  5         T(       a  [        R                  " T5        g g r   )closer   unlink)fptempnames   r    rr  rs    s#    HHJ#IIh/ $r"   s   hg-unbundle-)prefixs"   redirecting incoming bundle to %s
s   wb+r   rG   r"  r#  r   r5  r   r"   duringunbundle2F_bundle2salvagedoutputrW  
_replycapsr   s   errors   error:pushkeys   in-reply-torE  )	mandatoryrM  s   news   olds   rets   error:unsupportedcontents   parttypes   params    r%  r&  r'  s   error:pushraced)Dr   rt   rd  r   check_heads
getpayloadr%   rB   r   chunkbufferr   mkstempr  r   fdopensysstrr7   seek
readbundlerU   r   cg1unpackerrF   rP   r_   r-  r   r   r.  r/  unbundleclienthasattrrk  r7  pushresre  BundleValueError	PushRacedgetattrr   r6   formatflushpusherrbytestrr   r4  r5  PushkeyFailedr  newpartaddparampartidrK  rn   rh  rg  retparttypeparamsr8   r3  r$  rb   r6  r   rQ  )r)   r   r   their_headsri  rr  fdrx   r   ry   r=  r>  out
remotecapsparterrpartr?  r@  rw  rq  rx  s                     @@@r    r  r    s    ++E2K		!	!	#vB	K  4HI"G8**,77%%i1BCC! ))'2B $.LB0 $,#3#3?#KLBGGMM>I 2xv'>?B$ %GGAJ))$''2t<33 (w77zzZ/
  .66G" 	y 
$	#X  +++2E  %%{Helln 1i(( *99akkmL 	y 
$	#n &--Fv(
 	y 
$	#x 	&&U__E E	K3 1599{{ 	
 OO))#**,7OO))+)116??,C  U 
$	#Z  )11 ((--3) ] 
$	#Z &&tww/Gs$<bA$ B,H** H!(lD!AJ".&jnnXr.JJ "??+;<DMM.#**=}}0(#--5 &  ww*fcggGww*fcggGww*fcggGww*fcggG-H. )) H!//*EF<<+$$[#,,?::$$Y

3::0FG;; &4588'NNGSXX#67&&~wH  ?? & *"9"9#">?@ 
 "11g6G6G6IJJG 
$	#|E	K} 
$	#s&  [7JE I<'J8A6I<.J?,I<+J<	JJ4[4<[/KO%A8M1O[/"[4#[71AO
[/[4[7OA[/%P&&U";DUU%[/U""U%%Z<9A6W4/[/4Z<A"Y2-[/2Z<	)Z72[/7Z<<$[/ [4![7/[44[77
\)F)NrG   )A
__future__r   r   r   i18nr   noder    r   r   r	   r   r
   r   r   r   r   r   rI  r   r   r   r@   r   r   r   utilsr   r   urlerrr~   r.  r/  r-  r!   r-   r4   r>   rF   commanddictr/   rW   rp   ru   r}   r   r   r   r   r   r   r   r   r   r  rA  r   rD  rG  rO  rY  r]  r   r  rW  r"   r    <module>r     s6   #  	      $
 
	JK @   #68K"LL
 %*$0< %%',` (I':*8 ;*8Z *h7;5 <5 ,73; 4; +xG<5 =5 -w7K J L JF /37;G <G" *DWE; F;"&-V /g6A 7A
 .(w?- @- &7K- L- "LWE FCL ,9K :K\ (w/N 0N
 (w/F 0F +|@B AB
 )V8	C 9	C (J7;+ <+ ,G</ =/ *67KF LF8 -G4Q 5Q +xG<FK =FKr"   