
    6h                        S SK J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  SSKJr  S rS r\R(                  " S	S
SS9S 5       rS rg)    )annotations)_)
stringutil)	bundle2errorexchange
extensionshg
narrowspecwireprototypeswireprotov1peerwireprotov1server   )narrowbundle2c                 6    [         [        R                  l        g )N)peernarrowwidenr   wirepeernarrow_widen     =/usr/lib/python3/dist-packages/hgext/narrow/narrowwirepeer.pyuisetupr      s    ,;O)r   c                P   ^  U 4S jn[         R                  R                  U5        g )Nc                B   > U4S jn[         R                  " USU5        g )Nc                   > US:X  a6  TR                   u  pESR                  U5      US'   SR                  U5      US'   U " U/UQ70 UD6$ )Ns   unbundle   ,includepatsexcludepats)
narrowpatsjoin)origcmdargskwargsincludeexcluderepos         r   wrapped1reposetup.<locals>.wirereposetup.<locals>.wrapped#   sT    k! $(?? (,		'(:}%(,		'(:}%-d-f--r   _calltwowaystream)r	   wrapfunction)uipeerr(   r'   s      r   wirereposetup reposetup.<locals>.wirereposetup"   s    	. 	&97Cr   )r
   wirepeersetupfuncsappend)r'   r.   s   ` r   	reposetupr2   !   s    
D   /r      narrow_widensT   oldincludes oldexcludes newincludes newexcludes commonheads cgversion known ellipsess   pull)
permissionc
           
     z   Sn
 S n[        U" U5      5      n[        U" U5      5      n[        U" U5      5      n[        U" U5      5      nU R                  R                  [        R                  5      (       a  [        R
                  " XUS.5      nUS   nUS   U-
  nU(       a  U R                  nUR                  UR                  R                  S5      =(       d    UR                  5       5      n[        R                  " [        S5      U[        R                  " [        U5      5      4-  5      eUS   n[         R"                  " U5        [         R"                  " U5        [         R"                  " U5        [         R"                  " U5        [$        R&                  " U5      n[$        R&                  " U5      nU	S:X  a  Sn	O[)        U	5      n	Un[*        R,                  " U R                  5      n[         R.                  " U R0                  XES	9n[         R.                  " U R0                  X#S	9nU	(       d  [*        R2                  " UU UUUUUU	5        O[4        R6                  " UU UUUUU5         URC                  5       n[$        RD                  " UU
S9$ ! [        R                   a  n[*        R,                  " U R                  5      nS
UR8                  4/n/ nUR:                  b  UR=                  SUR:                  45        UR?                  [*        R@                  " SUU5      5        Sn
 SnANSnAff = f)aW  wireprotocol command to send data when a narrow clone is widen. We will
be sending a changegroup here.

The current set of arguments which are required:
oldincludes: the old includes of the narrow copy
oldexcludes: the old excludes of the narrow copy
newincludes: the new includes of the narrow copy
newexcludes: the new excludes of the narrow copy
commonheads: list of heads which are common between the server and client
cgversion(maybe): the changegroup version to produce
known: list of nodes which are known on the client (used in ellipses cases)
ellipses: whether to send ellipses data or not
Fc                6    U (       a  U R                  S5      $ / $ )Nr   )split)datas    r   
splitpaths narrow_widen.<locals>.splitpathsV   s    '+4::d#33r   )r   r   r   r   s   REMOTE_USERs3   The following excludes cannot be removed for %s: %s   0)r%   r&   s   messageNs   hints   error:abortT)genprefer_uncompressed)#setr,   has_sectionr   _NARROWACL_SECTIONapplynarrowacl	shortuserenvirongetusernamer   Abortr   r   pprintlistr   validatepatternsr   
decodelistboolr   bundle20matchrootwiden_bundler   &generate_ellipses_bundle2_for_wideningmessagehintr1   addpart
bundlepart	getchunks	streamres)r'   protooldincludesoldexcludesnewincludesnewexcludescommonheads	cgversionknownellipsespreferuncompressedr9   r$   requiredexcludesr,   rE   commonbundlernewmatcholdmatchexcmanargsadvargschunkss                           r   r   r   1   s   D R"	4 *[12*[12*[12*[12 77x::;;,,+NF !/K%m4{B
 WW<<JJNN>2Cbkkm kkLM!2!248H3I!JKL  !/K 	##K0##K0##K0##K0**;7))%0tHH~H	""477+##II{
 ##II{
   	 @@$  F##(:  ;; """477+,-88NNGSXX./**>7GLM!"s   IJ J L:,BL55L:c                   S H  n[         R                  " X   5      X'   M     S H  nSR                  X   5      X'   M     S[        US   5      -  US'   U R                  " S0 UD6n[
        R                  " U R                  U5      $ )N)r\   r^   )rX   rZ   rY   r[   r   s   %ir_   )r3   )r   
encodelistr    rK   _callcompressabler   getunbundlerr,   )remoter$   chfs       r   r   r      s    &#..vz:
 ' KYYvz*
 K fZ&8!99F:  ;F;A		1--r   N)
__future__r   mercurial.i18nr   mercurial.utilsr   	mercurialr   r   r   r	   r
   r   r   r   r    r   r   r2   wireprotocommandr   r   r   r   r   <module>rw      sb    #  &
 
 
 <0  ## rrj	.r   