
    	^c                         d dl mZmZmZmZmZmZmZmZm	Z	 ddl
mZ d Zd Z e	j        ddd	          d
             Zd ZdS )    )	bundle2errorexchange
extensionshg
narrowspecwireprototypeswireprotov1peerwireprotov1server   )narrowbundle2c                  2    t           t          j        _        d S )N)peernarrowwidenr
   wirepeernarrow_widen     =/usr/lib/python3/dist-packages/hgext/narrow/narrowwirepeer.pyuisetupr      s    ,;O)))r   c                 P      fd}t           j                            |           d S )Nc                 >    fd}t          j        |d|           d S )Nc                     |dk    r:j         \  }}d                    |          |d<   d                    |          |d<    | |g|R i |S )Ns   unbundle   ,includepatsexcludepats)
narrowpatsjoin)origcmdargskwargsincludeexcluderepos         r   wrappedz1reposetup.<locals>.wirereposetup.<locals>.wrapped   sh    k!! $(? (,		'(:(:}%(,		'(:(:}%4-d---f---r   s   _calltwowaystream)r   wrapfunction)uipeerr%   r$   s      r   wirereposetupz reposetup.<locals>.wirereposetup   s:    	. 	. 	. 	. 	. 	&:GDDDDDr   )r   wirepeersetupfuncsappend)r$   r)   s   ` r   	reposetupr,      s@    
E 
E 
E 
E 
E   /////r      narrow_widensT   oldincludes oldexcludes newincludes newexcludes commonheads cgversion known ellipsess   pull)
permissionc
           
         d}
	 d } ||          } ||          } ||          } ||          }| j                             t          j                  rt          j        | d|i           t          j        t          |                     t          j        t          |                     t          j        t          |                     t          j        t          |                     t          j	        |          }t          j	        |          }|	dk    rd}	nt          |	          }	|}t          j        | j                   }t          j        | j        ||          }t          j        | j        ||          }|	st          j        || ||||||	           nt!          j        || |||||           n# t$          j        $ r}}t          j        | j                   }d|j        fg}g }|j        |                    d|j        f           |                    t          j        d	||                     d
}
Y d}~nd}~ww xY w|                                }t          j        ||
          S )a  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                 4    | r|                      d          ng S )Nr   )split)datas    r   
splitpathsz narrow_widen.<locals>.splitpathsQ   s    '+34::d###3r   r      0)r"   r#   s   messageNs   hints   error:abortT)genprefer_uncompressed)r'   has_sectionr   _NARROWACL_SECTIONapplynarrowaclr   validatepatternssetr	   
decodelistboolr   bundle20matchrootwiden_bundler   &generate_ellipses_bundle2_for_wideningr   Abortmessagehintr+   addpart
bundlepart	getchunks	streamres)r$   protooldincludesoldexcludesnewincludesnewexcludescommonheads	cgversionknownellipsespreferuncompressedr3   commonbundlernewmatcholdmatchexcmanargsadvargschunkss                       r   r   r   ,   s   D @"	4 	4 	4 !j-- j-- j-- j-- 7x:;; 	H#D=+*FGGG 	#C$4$4555#C$4$4555#C$4$4555#C$4$4555*;77)%00tHHH~~H	"47++#I{K
 
 
 #I{K
 
 
  	 	 	 	 	 @   ; " " ""47++,-8NNGSX.///*>7GLLMMM!"   F#(:   s   F9F> >I
A3II
c                    dD ]}t          j        ||                   ||<    dD ] }d                    ||                   ||<   !dt          |d                   z  |d<    | j        di |}t          j        | j        |          S )N)rO   rQ   )rK   rM   rL   rN   r   s   %irR   r-   )r-   )r	   
encodelistr   r=   _callcompressabler   getunbundlerr'   )remoter!   chfs       r   r   r      s    & ; ;#.vbz::r

J + +YYvbz**r

fZ&8!9!99F:  ;;F;;A	1---r   N)	mercurialr   r   r   r   r   r   r	   r
   r    r   r   r,   wireprotocommandr   r   r   r   r   <module>rf      s  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      < < <0 0 0  $#   ` ` `F	. 	. 	. 	. 	.r   