o ]LbU@stddlmZddlmZmZmZmZmZmZm Z m Z ddl m Z ddZ ddZe jd d d d d dZddZdS))absolute_import)bundle2error extensionshg narrowspecwireprototypeswireprotov1peerwireprotov1server) narrowbundle2cCs ttj_dS)N)peernarrowwidenr wirepeer narrow_widenrr=/usr/lib/python3/dist-packages/hgext/narrow/narrowwirepeer.pyuisetups rcsfdd}tj|dS)Ncsfdd}t|d|dS)NcsD|dkrj\}}d||d<d||d<||g|Ri|S)Nsunbundle, includepats excludepats) narrowpatsjoin)origcmdargskwargsincludeexcludereporrwrappeds  z1reposetup..wirereposetup..wrappeds_calltwowaystream)r wrapfunction)uipeerr rrr wirereposetups  z reposetup..wirereposetup)rwirepeersetupfuncsappend)rr$rrr reposetups  r' narrow_widensToldincludes oldexcludes newincludes newexcludes commonheads cgversion known ellipsesspull) permissionc  Csd} z{dd} | |}| |}| |}| |}tt|tt|tt|tt|t|} t|}| dkrDd} nt| } |}t|j} tj |j ||d}tj |j ||d}| sqt | |||| ||| n t | ||||| |Wn:tjy}z-t|j} d|jfg}g}|jdur|d|jf| td ||d } WYd}~nd}~ww| }tj|| d S) awireprotocol 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 FcSs|r|dSgS)Nr)split)datarrr splitpathsQsz narrow_widen..splitpaths0)rrsmessageNshints error:abortT)genprefer_uncompressed)rvalidatepatternssetr decodelistboolrbundle20r"matchroot widen_bundler &generate_ellipses_bundle2_for_wideningrAbortmessagehintr&addpart bundlepart getchunks streamres)rproto oldincludes oldexcludes newincludes newexcludes commonheads cgversionknownellipsespreferuncompressedr,commonbundlernewmatcholdmatchexcmanargsadvargschunksrrrr,sv"        rcKsjdD] }t||||<qdD] }d||||<qdt|d|d<|jdi|}t|j|S)N)rErG)rArCrBrDrs%irHr()r()r encodelistrr3_callcompressabler getunbundlerr")remoterchfrrrr sr N) __future__r mercurialrrrrrrr r r rr'wireprotocommandrr rrrrs (   ^