\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlmZddlmZmZddlm Z m Z m Z m Z mZmZmZmZmZmZmZddlmZmZejZejZedZed Zd eefZd Zd Zd Z dZ!dZ"ej#Z$dddZ&e&dddddZ'e&dddddZ(e&ddddZ)e&dddddZ*e&dd ddd!Z+d"dd#d$d%d&gZ,d'Z-e&d(ddd)Z.e&d*d+ddd,Z e&d-d.ddd/Z/e&d0d1ddd2Z0d3Z1e&d%d4ddd5Z2e&d6ddd7Z3e&d8ddd9Z4e&d:d;ddd<Z5e&d"d=ddd>Z6e&d$d?ddd@Z7e&dAdBdddCZ8e&d#dDdddEZe&dFdddGZ9e&dHd6dddIZ:dS(Ji(tabsolute_importNi(t_(thextnullid( tbundle2t changegroupt discoverytencodingterrortexchangetpushkeytpycompatt streamclonetutiltwireprototypes(tprocutilt stringutils/incompatible Mercurial client; bundle2 requireds9see https://www.mercurial-scm.org/wiki/IncompatibleClients%s (%s) cC@sAx4|jD]&}|jdr |djdSq WddgS(sReturns 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. scomp=it,tzlibtnone(t getprotocapst startswithtsplit(tprototcap((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytclientcompressionsupport-scC@s |jdS(sObtain 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. tserved(tfiltered(trepoRtcommand((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytgetdispatchrepo;scC@sAt|||}t|\}}|j|}||||S(N(Rtcommandstgetargs(RRRtfunctspectargs((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytdispatchDscC@ski}x2|D]*}||kr ||||<||=q q W|rgtjjd|dj|fn|S(Ns,warning: %s ignored unexpected arguments %s R(Rtstderrtwritetjoin(tcmdtkeystotherstoptstk((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytoptionsLs   cC@s|j}d|jk}|rG|jdd|}|dk rG|Sn|jdd|}|dk rm|S|r|jdd}|dk r|Sn|jddS(sWhether a bundle1 operation is allowed from the server. Priority is: 1. server.bundle1gd. (if generaldelta active) 2. server.bundle1. 3. server.bundle1gd (if generaldelta active) 4. server.bundle1 t generaldeltatservers bundle1gd.%ss bundle1.%st bundle1gdtbundle1N(tuit requirementst configbooltNone(RtactionR2tgdtv((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytbundle1allowedWs    tpushc@sdtjjDdkr8jtjnd krZtjdnd krodntt stjdnfd}|S( sDecorator 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. cS@s,h|]"\}}|ddkr|qS(tversioni((t.0R,R8((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys s tbatchR:tpullsCinvalid wire protocol permission; got %s; expected "push" or "pull"ts:arguments for version 1 commands must be declared as bytesc@sKtkr"tjdntj|dddt<|S(Ns+%s command already registered for version 1R#t transportst permission(RRtProgrammingErrorRt commandentry(R!(R#tnameRAR@(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytregisters    (R:R>N( Rt TRANSPORTStitemstaddtSSHV2RRBR5t isinstancetbytes(RDR#RARE((R#RDRAR@sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytwireprotocommandvs      R=scmds *RAR>cC@s#tj}|jd}g}x|jdD]}|jdd\}}i} xK|jdD]:} | rb| jd\} } || | || t*(R:R>(RtunescapebatchargRRRRAtAssertionErrort checkpermR)RJtooberrort bytesresponseRKtdatatappendtescapebatchargR'(RRtcmdsR*t unescapeargtrestpairtopR#tvalstatnR8R!R"tpermR)RVR,tstartkeytresult((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR=sD        , tbetweentpairscC@s~g|jdD]}tj|d^q}g}x1|j|D] }|jtj|dqDWtjdj|S(NRNt-s R?(RRt decodelistReRWt encodelistRUR'(RRRftptrtb((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRes .t branchmapcC@s|j}g}xX|jD]J\}}tjtj|}tj|}|jd||fqWtj dj |S(Ns%s %ss ( Rmt iteritemsturlreqtquoteRt fromlocalRRiRWRUR'(RRRmtheadstbranchtnodest branchnamet branchnodes((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRms tbranchesRtcC@s_tj|}g}x1|j|D] }|jtj|dq%Wtjdj|S(Ns R?(RRhRwRWRiRUR'(RRRtRkRl((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRws t clonebundlesR?cC@stj|jjdS(sZServer 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. sclonebundles.manifest(RRUtvfsttryread(RR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRxs tlookupR tknownt getbundlet unbundlehashcC@stt}tjd|r.|jdntj|r|jjddrb|jdn|j |j @}|dhs|jdq|jddj t |n|jjd d rt jt j|d d}|jd tj|n|jd dj t j|jjd dro|jtj|jjd dro|jtjqon|j||S(s)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. tchangegroupsubsetR/tpreferuncompressedsstream-preferredtrevlogv1tstreams streamreqs=%sRt experimentalsbundle2-advertisetrolesbundle2=s unbundle=%stnarrowtnarrowservebrokenellipses(tlistt wireprotocapsRtcommandavailableRWR tallowservergenerationR2R4R3tsupportedformatsR'tsortedRt encodecapst getrepocapsRoRptbundlepriorityRt NARROWCAPt ELLIPSESCAPtaddcapabilities(RRtcapstrequiredformatstcapsblob((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyt _capabilitiess&  #t capabilitiescC@s+t||}tjdjt|S(NRN(RRRUR'R(RRR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR*sRtrootsc@sptj|}tj|d|d|j}tj||ddtfdd}tjd|S(Nt missingrootst missingheadst01tservec@s jdS(Ni(tread((tcg(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyt5sR?tgen( RRhRtoutgoingRrtchangegroupmodtmakechangegrouptitert streamres(RRRRtRR((RsA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR/s Rs bases headsc@sytj|}tj|}tj|d|d|}tj||ddtfdd}tjd|S(NRRRRc@s jdS(Ni(R((R(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR@sR?R(RRhRRRRRR(RRtbasesRrRR((RsA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR8s t debugwireargss one two *cC@s=tdddg|}tj|j||tj|S(NRtthreetfour(R-RRURR t strkwargs(RRtonettwoR*R+((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRCs c@sd}|jjd}|s%d Stj||}tj||}|sSd S|jjg|D]} j| ^qidt jg|D]} j| ^qdt t |} x|D]} | j d} t j jj | } | r| | kr| | krqnd| kry|| d}Wntk rUqnX|j|rkqntfd|Drqntfd|Drqqnd| kry|| d}Wntk rqnXtfd |Dsqqn| d }|jjd |y|jj|SWqtk rv|jjd |qqXqWd S(sReturn 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. cS@s/tg|jdD]}|jd^qS(NRMR(tsetRtdecode(tsth((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytdecodehexstringZsspullbundles.manifestt inclusivet COMPRESSIONRrc3@s$|]}j|kVqdS(N(trev(R<R(tclt common_anc(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys wsc3@s9|]/}j|ko0j|kVqdS(N(R(R<R(RRt heads_anc(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys ysRc3@s$|]}j|kVqdS(N(R(R<R(RR(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys stURLssending pullbundle "%s" spullbundle "%s" not accessible N(RyRzR5R tparseclonebundlesmanifesttfilterclonebundleentriest changelogt ancestorsRtTrueRtgetR t compenginest _bundlenamest TypeErrortissubsettalltanyR2tdebugtopentIOError(RRR+tclheadsRrtcommonRtmanifestR[Rt compformatstentrytcomptaltcompt bundle_headst bundle_basestpath((RRRsA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytfind_pullbundleKsX  11            RPcC@stdtjj|}x|jD]\}}tj|}|dkrctj|||t bundlecapsshttp-v1thintRrRR/t pullbundles partial-pullRtprefer_uncompressedtdisablefullbundleRs%server has pull-based clones disableds/remove --pull if specified or upgrade MercurialRtprefercompresseds tmessages error:abort(0R-RtGETBUNDLE_ARGUMENTSR)RnRhRRRtFalsetbooltKeyErrorR9R tbundle2requestedRRDRTtbundle2requiredRtAborttbundle2requiredmaintbundle2requiredhintRRRrtdiscardRR2R4RRRR t filechunkiterRtgetbundlechunksR RtbytestrRtbundle20RR5RWtaddpartt bundlepartt getchunks(RRR*R+R,R8tkeytypeRRRrRtbundleRtinfotchunkstexctbundlertmanargstadvargs((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR}sx                   RrcC@s&|j}tjtj|dS(Ns (RrRRURi(RRR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRrs thellocC@s#t||j}tjd|S(sfCalled 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: scapabilities: %s (RRVRRU(RRR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRs tlistkeyst namespacecC@s:t|jtj|j}tjtj|S(N( RRRttolocalRGRRUt pushkeymodt encodekeys(RRRtd((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRs$RccC@svy4tj|}|j|}t|}d}Wn(tk r^}tj|}d}nXtjd||fS(Niis%d %s ( RRR{Rt ExceptionRt forcebytestrRRU(RRRcR,R`Rktsuccesstinst((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR{s   snodes *cC@s8djd|jtj|D}tj|S(NR?cs@s!|]}|rdpdVqdS(t1RN((R<Rl((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys s(R'R|RRhRU(RRRtR*R8((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR|s t protocapsRcC@s:|jtjkr-t|jd|_ntjdS(NRNtOK(RDRtSSHV1RRt _protocapsRU(RRR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRssnamespace key old newc C@st|dkr^tj||kr^y |jdtj|}Wqmtk rZqmXntj|}|j@}|jtj|tj|tj||pt }WdQX|r|j nd}t j dt ||fS(Nisutf-8R?s%d %s(tlenRt escapestrRRRtUnicodeDecodeErrortmayberedirectstdioR RtgetvalueRRUtint(RRRRctoldtnewtoutputRk((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR s'  !t stream_outcC@stjtj|S(sIf 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. (RtstreamreslegacyR tgeneratev1wireproto(RR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRstunbundlec @stj|}|j}ytj||dd}z|j|jjddrfd}tj nd)\fd}t j dd\}|jj d tj|t jd d }xD]}j|qWjd tj|jd} t| tjrt|d  r|jd krntjtStjtdtntj|| |d|j }tj!|drtj"d|j#Stj$||r|j%ndSWd|XWntj&tjtj'fk r} t(| dt)syWqtjk rt*j+jd| | j,dk rt*j+jd| j,nt*j+j-tj$d |r|j%ndStj'k rtj.t j/| |r|j%ndSXnt0j1|j} x't(| dd*D]} | j2| qWyYyWnKtj3k r} t(| dd} | dk rd| j4dd+krn| j5d}|j6d| j7| j8dk r|j6d| j8dt)n| j9dk r|j6d| j9dt)n| j:dk r3|j6d| j:dt)n| j;dk r^|j6d | j;dt)n| j<dk r|j6d!| j<dt)qnXWn tj&k r} | j5d"}| j=dk r|j6d#| j=n| j>r|j6d$d%j?| j>qntjk ry} d&t@jA| fg}g}| j,dk rZ|jBd| j,fn| j2t0jCd'||n8tj'k r} | j5d(d&t@jA| fgnXtj"d| j#SXWdQXdS(,Nspreparing changescS@sdS(N(R5(((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR/sR/tstreamunbundlec@sxD]}qWdS(N((Rj(tpayload(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytcleanup3s c@s-rjnr)tjndS(N(tclosetostunlink((tfpttempname(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR<s tprefixs hg-unbundle-s"redirecting incoming bundle to %s swb+iR:shttp-v1RRRRR?tduringunbundle2s abort: %s s(%s) t_bundle2salvagedoutputt _replycapsR Rs error:pushkeys in-reply-toRt mandatoryRcRRtretserror:unsupportedcontenttparttypetparamssRs error:abortserror:pushraced(NN(((DRRhR R t check_headst getpayloadR2R4R t chunkbufferR5R tmkstempRRtfdopentsysstrR&tseekt readbundleRJRt cg1unpackerR9RDRTRRRRRRtclientt safehasattrRRtpushresR tBundleValueErrort PushRacedtgetattrRRR%RtflushtpusherrRRRRt PushkeyFailedRtnewparttaddparamtpartidRRcRRR"R#R$R'RRRWR(RRRrt their_headsRRtfdRkRjRRRtoutt remotecapstpartterrpartRR((RRRsA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR(s           !    $ " (;t __future__RRti18nRtnodeRRR?RRRRRRR R RR R R RtutilsRRturlerrRoRRRRRR$R-R9t commanddictRR5RLR=ReRmRwRxRRRRRRR}RrRRR{R|RRR(((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytsT L        /.     *   BL