^c|ddlZddlZddlmZddlmZmZddlmZ m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!m"Z"ddl#m$Z$ej%Z%ej&Z&dZ'dod Z(d Z)d Z*d Z+d Z,dZ-GddZ.ededfededfededfdZ/ dpdZ0gZ1iZ2dZ3dZ4dZ5e3ddZ6e3d d!Z7e3d"d#Z8e3d$d%Z9d&Z:d'Z;gZd)Z?d*Z@e>d+d,ZAe>d-d.ZBe>dd/ZCe>d d0ZDd1ZEd2ZFe>d3d4ZGe>d$d5ZHd6ZId7ZJd8ZKd9ZLe>d:d;d<ZMd=ZNd>ZOd?ZPejQfd@ZRdAZSdBZTGdCdDZUGdEdFejVZWdGZXdHZYdIZZ dqdJZ[gZ\iZ]dKZ^dLZ_e^dMdNZ`e^dOdPZadQZbdRZcdSZddTZedUZfdVZgdWZhdXZidodYZjdZZkgZliZmdod[Znd\Zo drd]Zpend^d_ZqendO dsd`Zrend$ dtdaZsendb dtdcZtend3 duddZuende dudfZvendg drdhZwendi drdjZxdkZydlZzdmZ{dnZ|dS)vN)_)hexnullrev) bookmarksbundle2 bundlecaches changegroup discoveryerrorlock logexchange narrowspecobsoleteobsutilphasespushkeypycompat requirementsscmutil streamcloneurlutilwireprototypes)hashutil stringutilurlutil) repositorys narrowaclctj|d}d}|sFd}|ds.|drtj||}d}d}n|r||}|dd|dd}}|dkr$t jtd |z|d kr,|tj|d}tj||S|d rtj ||||z S|d krtj |St jtd||fz)NstreamsHGsHG10sUNrs%s: not a Mercurial bundles102) magicstringsS1s%s: unknown bundle version %s) r readexactly startswithheaderlessfixupjoinr Abortr cg1unpackerr getunbundlerrstreamcloneapplier)uifhfnamevfsheaderalgmagicversions 4/usr/lib/python3/dist-packages/mercurial/exchange.py readbundler74sr  $R + +F C    '' F,=,=e,D,D ,R88BFC  AaC[&1+7E ~~k!9::UBCCC% ;)"a00C&r3///   D ! ! #BHHHH E  -b111k . / /5'2B B   cg}t|D]9\}}t|}|d||fz:d|S)Ns%s=%s;)sorteditemsurlreqquoteappendr))paramspartskeyvalues r6_format_paramsrDSsk EV\\^^,,.. U U## Xe ,---- 99U  r8cd}i}t||d}t|tjrE|j}|dkrd}||}|s$t jtd|zd|zSt|tj r|d|j vr=||j d}|s$t jtd|znd}d}| D]}|j d krS|j d } | d vrd }!| d vrd }| |d<-t jtd|ztd|j dkrQ|Ot|j d} | j} tj| }d|zcS|j dkrd|d<|jsd|d<|s!t jtdd||fz} |r| dz } | t%|z } | St|t&jr3t'j|d} tj| } d| zSt jtd|z) zInfer the bundlespec from a bundle file handle. The input file handle is seeked and the original seek position is not restored. c tj|dS#t$rYdSwxYwNr)r compengines forbundletype bundletypeKeyError)r3s r6speccompressionz&getbundlespec..speccompressionbsQ #11#66AACCAF F   44 s69 AANs _truncatedBZsBZs!unknown compression algorithm: %ss%s-v1s Compressionsnone changegroupversion)01s02sv2)s03s cg.versions7changegroup version %s does not have a known bundlespecs#try upgrading your Mercurial clienthintstream2s requirementssnone-v2;stream=v2;%s obsmarkerssyess obsolescencesnosobsolescence-mandatorys0could not identify changegroup version in bundles%s-%sr:r#snone-packed1;%ssunknown bundle type: %s)r7 isinstancer r+_typer r*rr unbundle20r@ iterpartstyper=unquotesplit_formatrequirementsparams mandatoryrDrr-readbundle1header)r.r/rLr@br3compr5part cgversionrsplittedspec formatteds r6 getbundlespecre[s F2r4  A![,-->=g / ! !Cs## M+a DEEKLL L$ Aw) * *6= QX % %"?18N#;< >DyN** K 3 ..#GG(**#G,5F=))+2" " EFF j((W_%~~dk/.JKK -<-// :8DD.7777m++*0'~>8=F45 +EFF 4/)  + DLD N6** *D A{5 6 6="4R88; 5lCC !I--k!677!;<<z$_computeoutgoing..s&222wwqzz2!222r8) changelogrknullidheadsr outgoing)reporocommonclrks @r6_computeoutgoingrtsi B *2222V222+    dFE 2 22r8cN|j}|j}|dd}|js|dvrdSt |jd}|ddsdS|j)|dd}n3|d |j}||dz}|r|d kr4| td t|zdS|d krU| td t|zr!tjtddS|dkrFtdt|z}td}tj||dSdS)N experimentals auto-publish)warnconfirmabortphases publishingFsserveds not public()s::%ln - public()rws$%i changesets about to be published rxs2push and publish %i changesets (yn)?$$ &Yes $$ &Nos user quitrys push would publish %i changesetss:use --publish or adjust 'experimental.auto-publish' configrP)rqr.configpublishlistkeysremotegetrevsfilteredwarnrlen promptchoicer CanceledErrorr*)pushoprqr.behavior remotephases publishedmsgrQs r6 _checkpublishrs ;D Byy/::H ~)HHHFM955L   M5 1 1 {MM),,11/BB II16;??  T]]9--- . w   GG:;;c)nnL      # #GHHi..! ;)!L//:::  ; ;  ! !7883y>>ICD+c--- -#.." !r8c|jj}|dd}d|vod|v}|p|jd S)zsreturn true if a pull/push must use bundle1 This function is used to allow testing of the older bundle versiondevellegacy.exchangebundle2sbundle1)rqr. configlistrcapable)opr.exchange forcebundle1s r6 _forcebundle1rsU B}}X'9::HX-H*2HL  .fs+DDD4D V0C0C$0C0C0Cr8s%ln and parents(roots(%ln))c3>K|]}|VdSrrrics r6 z.pushoperation.fallbackheads..ns*//1affhh//////r8) rrp commonheadsrq unfilteredrrrmindexrrmissingextend)runficheadsrevsetrrrs @@r6 fallbackheadszpushoperation.fallbackheadsOs 9 =, ,y##%%%i!'+DDDDD49DDD * M % M !    //////// r8c,|jr|jS|jS)z3set of all common heads after changeset bundle push)rrrrs r6rzpushoperation.commonheadsqs  = &# #% %r8FNFrhFN) __name__ __module__ __qualname____doc__rr propertycacherrpropertyrrhr8r6rrs IIIIV ))) B&&X&&&r8rsupdating bookmark %s supdating bookmark %s failed sexporting bookmark %s sexporting bookmark %s failed sdeleting remote bookmark %s s#deleting remote bookmark %s failed )updateexportdeleteFrhc T|i}t|||||||fitj|}|jrt |jj|jjz } | rFtdd t| z} tj | |js!tj td|jds!tj tdtt!j|jD]n} |jD]\} } | | rn7tj tdtj| zodx}} |jdd }t1|s/|r-t3j|s|j}|j}t;|jd |j|_nM#tj $r;}d tCj"|z} |j#| Yd}~nd}~wwxYw|ptIj%5|ptIj%5|jptIj%5|j&|tO|tQ||j)stU|t1|stW|tY|t[|t]|t_|dddn #1swxYwYdddn #1swxYwYdddn #1swxYwY|jdd rtaj1|||S) aWPush outgoing changesets (limited by revs) from a local repository to remote. Return an integer: - None means nothing to push - 0 means HTTP error - 1 means we pushed and remote head count is unchanged *or* we have outgoing changesets but refused to push - other values as described by addchangegroup() N:required features are not supported in the destination: %s, s!destination does not support pushunbundlesLcannot push: destination does not support the unbundle wire protocol commandsJcannot push: required sidedata category not supported by this client: '%s'rvbundle2.pushbacks push-responses"cannot lock source repository: %s remotenames)2rr strkwargsrlocalrrqr supportedrr)r;r r*canpushrrread_remote_wanted_sidedata_sidedata_computersr<rbytestrr. configboolrbookmodbookmarksinstorewlockr transactionmanagerrrLockUnavailabler forcebytestrdebugrnullcontextmanager checkpushr_pushdiscoveryr_checksubrepostate _pushbundle2_pushchangeset_pushsyncphase _pushobsolete _pushbookmarkrpullremotenames)rqrrrrrr}opargsrrrcategorykind computersrr maypushbackerrs r6pushrs$~        V $ $  F} #  ( ) )FM,?,?,A,A,K K   #F7OO,, .C +c"" " = " "Ck!@AABBB =  - - k 2     7>v}MMNN   $7==??  OD)}}X&&  +-"8,, - EDi**?+>    5z7N 8 8      +$)++ & &  .T,.. & &!>T%<%>%> & & %%f---f%%%v&&&|/&v...$V,,) (((v&&&v&&&f%%%f%%% & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & w/>::2#D&111 MstB$I77K1J<<KO-/O B)N?3 O?O OO O O-O O-O O--O14O1cfd}|S)a|decorator for function performing discovery before push The function is added to the step -> function mapping and appended to the list of steps. Beware that decorated function will be added in order (this may matter). You can only use this decorator for a new step, if you want to wrap a step from an extension, change the pushdiscovery dictionary directly.cftvsJ|t<t|Sr)pushdiscoverymappingpushdiscoveryorderr?funcstepnames r6deczpushdiscovery..dec933333)-X&!!(+++ r8rhrrs` r6 pushdiscoveryr# Jr8cJtD]}t|}||dSzRun all discovery stepsN)rr)rrsteps r6rr4&#H- V r8c|j}t|dr"t|dsdS|jjD]x}||}d|vrXd|vrBt|jD]-}| |}| d.ydS)zDEnsure all outgoing referenced subrepo revisions are present locallys.hgsubs .hgsubstateNT)onpush) rqrfilerprmanifestfilesr;substatesubverify)rrqrjctxsubpathr s r6rrs ;D tyy## $ $C .0I0I,J,J _ $((1g   & &>SYY[[+H+H!#,// ( (ggg&& $ '''' ((r8s changesetcDtj}|jr$||j|j|j|j}n||j|j|j}|\}}}tj}||j|j|j||j}||_||_||_ dS)z-discover the changeset that need to be pushed)rr)r) onlyheads commonincrN) r findcommonincomingrrqrrfindcommonoutgoingrprr)rfcirrrincrfcorps r6_pushdiscoverychangesetr1s  &C {HC K M,    C V]&,GGG (FC  &Cs  +l HFO$FFOOOr8sphasecR|j}|j}t|jd}|jddr4|r2|jjs&|ddrg|_ g|_ dStj |j|j ||_|jj}d}|jjsd}d |z}t#||||j }|jjs1|jr*t#|d |j|}nh|js|}n^t#|d |j|} d | D} t#||| |j}||_ ||_ dS) zpdiscover the phase that needs to be pushed (computed for both success and failure case for changesets push)rzui_usedassubrepor{FNr8s and public()sheads((%%ln::%%ln) %s)s%ln and (not public() or %ln::)sroots(%ln + %ln::)c6g|]}|Srhr)rifs r6rlz'_pushdiscoveryphase..s ---16688---r8)rprqrr~rr.rrrrrrremotephasessummaryrr draftroots publishinglistrr}r) rrprrdroots extracondrfallbackfuturefdrootss r6_pushdiscoveryphaser%Ls H ; ! ! # #DFM955L  U$566 '   ]E 2 2 !#(*% 4 V)<F +FI   )%$ & 2FDHHVVV-ABBCCH   )EfnE HH2F4F       E  HH+X-=v F F  .-W---dhhvw0BCCDD"F$,F!!!r8s obsmarkerc@tj|jtjsdS|jjsdSdt |jdvrdS|j}d|d|jD}|jj ||_ dS)Nobsoletes namespacesc3>K|]}|VdSrrrs r6rz+_pushdiscoveryobsmarkers..s* F F!QVVXX F F F F F Fr8::%ln) r isenabledrq exchangeoptobsstorer~rrrrelevantmarkersr)rrqnodess r6_pushdiscoveryobsmarkersr/s  fk8+? @ @ ; (6=-@@@@ ;D G Ftxx&2DEE F F FE!;/??FFFr8 bookmarksc|j}|j|j}|dd}|jr@t jjj |j}j |d}tj t|d}fd|jD}tjj|}t#|||||S)Nschecking for updated bookmarks rhT) inclusiver0cDh|]}j|Srh _bookmarks expandnameribookmarkrqs r6 z*_pushdiscoverybookmarks..s619""8,,r8)r.rqrrrrrmaplistrmr ancestorsrunhexlifybookmarksr~rcomparebookmarksr5_processcompared) rr.rr;revnumsremotebookmarkexplicitr_rqs @r6_pushdiscoverybookmarksrBs B ; ! ! # #D ]FHH 0111I {F"4>#5v{CCN,,W,EE /0N0NOON=C=MH  #D$/> J JD FIx N NNr8cJ|\}}}}} } } } |j} |D]Z\}}}||vr|||r| ||vr|j|||f[|D]\}}}||vrx||t j|r2|jtd|zd|_ e|j|d|ft|t| zt| zD]<\}}}||vr2|||j|||f=|D]<\}}}||vr2|||j||df=| D]\}}}||vr|| |rFt|}|jtd|dzd|_ |j dS)zntake decision on bookmarks to push to the remote repo Exists to help extensions alter this behavior. s#cannot push divergent bookmark %s! r#r8s>bookmark %s does not exist on the local or remote repository! rN)rqremoverrr?r isdivergentr.rrrrr;sort)rpushedrA remotebmsr_addsrcadddstadvsrcadvdstdivergedifferinvalidsamerqr^sciddcids r6r>r>sw FJBFFFFGVWd ;D88 4 == OOA    8d))V33   & &4 7 7 7;; 4 == OOA   "1%% ; q!HIIAMNNN"##**AsD>:::fW 5V D88 4 == OOA      & &4 7 7 777 4 == OOA      & &4~ 6 6 6 4 == OOA    (##  +  qk      r8ch|j}|j}|js"t j|j||jdS|js|j rtd}td}td}td||d}|j D]~}||}| rtj||z|r5tj||d|zt#j|dS) NFs%push includes obsolete changeset: %s!s,push includes phase-divergent changeset: %s!s.push includes content-divergent changeset: %s!s#push includes orphan changeset: %s!)sorphansphase-divergentscontent-divergentrT)rprqrrrnochangesfoundr.excludedrr,rrrr r* isunstable instabilitiesr checkheads) rrprmsomspdmscdmstrr s r6_pushcheckoutgoingr]sGH ; ! ! # #D  twh.?@@@u <% = I<==CDEEDFGGDCDD$(&*C!, I I4j<<>>I+cCi000^^%%I +c#*;*;*=*=a*@&AC&GHHHI V$$$ 4r8cfd}|S)awdecorator for function generating bundle2 part The function is added to the step -> function mapping and appended to the list of steps. Beware that decorated functions will be added in order (this may matter). You can only use this decorator for new steps, if you want to wrap a step from an extension, attack the b2partsgenmapping dictionary directly.ctvsJ|t<tnt|Sr)b2partsgenmappingb2partsgenorderr?insertridxrs r6rzb2partsgenerator..dec!sW00000&*(# ;  " "8 , , , ,  " "3 1 1 1 r8rhrrdrs`` r6b2partsgeneratorrf) Jr8c,|js|jjrd|jddv}|jdu}|r|r+|dt|jdSt}|j D]G\}}|\}}} } |9t|} |t| | zz}|| t|z z}H|r9tt|} |d| dSdSdSdS)zdGenerate race condition checking parts Exists as an independent function to aid extensions srelateds checkheadsrhNs check:headsdatascheck:updated-heads) rrpr capabilitiesrrnewpartiterrrr<r;) rbundlerallowunrelated emptyremoteaffectedbranchrornewheads unsyncedheadsdiscardedheadsrrjs r6_pushb2ctxcheckheadsrv-s_ <CFO7C#w';'?'? 2( (  *d2  C C OONf6H1I1IO J J J J JuuH!'!5!;!;!=!= 7 7 GLD X}n* --FN 3 3f <z&_pushb2checkphases..ks222A!R222r8s check:phasesri)ryrrr{rrrr allphasespublicr publicheadsdraftranyvaluesrFr|rl)rrnr} hasphaseheadschecksphasers r6_pushb2checkphasesrbs6 F  v|   / /F 9b 9 99M &=&22!1222v}$$V%8%DEEEv|##F$7$BCCC v}}   = % %u ""$$$$+F33I OOO)O < < < < <'&&&  = =r8cLdjvrdSjdtsdSjt |t jj}d}| d}|r@fd|D}|s!tj tdt|}t jj}tjjj|d||}|d| |rd |t)jjrd d t,jjjvrd d fd}|S)zwhandle changegroup push through bundle2 addchangegroup result is stored in the ``pushop.cgresult`` attribute. changesetsNrOrMcJg|]}|tjjv| Srh)r supportedoutgoingversionsrq)rivrs r6rlz_pushb2ctx..s;   K9&+FFFF FFFr8no common changegroup versionpush bundlecapsremote_sidedatarirN treemanifest1 exp-sidedatac|jj}t|ddksJ|ddd_dS)z0extract addchangegroup returns from server replyrMrrreturnN)records getrepliesidrr)r cgrepliescgpartrs r6 handlereplyz_pushb2ctx..handlereplysRJ))&)44 9^,--2222#N3A6yAr8)raddr]rqprepushoutgoinghooksrvrr{rrr r*rmaxrr makestreamrprladdparamristreemanifestrREPO_FEATURE_SIDE_DATAfeatures) rrnr}r5 cgversionsrcgstreamrrs ` @r6 _pushb2ctxrus ((( ''' f % % K$$V,,,)))   / /FGN++J"        C+a @AABB Bj//9&-HHO% ' H__^(_ ; ;F- G,,,fk**/...(FK,@@@...BBBBBB r8cd|jvrdStj|j}|jj}d|ddv}d|v}d|ddv}|r|st||S|rt||SdS)z!handle phase push through bundle2rzNrrpushkeyrrh) rrr{rrqr.rr_pushb2phaseheads_pushb2phasespushkey)rrnr}r. legacyphase haspushkeyrs r6 _pushb2phasesrsF$$$   / /F Br}}X7IJJJKv%J 9b 9 99M5[5 111 5#FG44455r8c"|jd|jrmdtjD}|dd|jDtj|}|d|dSdS)z6push phase information through a bundle2 - binary partrzci|]}|gSrhrhrs r6rz%_pushb2phaseheads..s333Q1b333r8rc3>K|]}|VdSrrrihs r6rz$_pushb2phaseheads..s*BBq!&&((BBBBBBr8 phase-headsriN)rrrrrrr|rl)rrnupdates phasedatas r6rrs ### 833&"2333 BBF,ABBBBBB'00 Y77777 88r8cTjdgfd}tj}jD]}|d}|d|d|d|||d|dtj z|d|dtj z |j |f|j |j <fd }|S) z7push phase information through a bundle2 - pushkey partrzct|j}D]/\}}||kr$tjt d|z0dS)Nsupdating %s to public failed)intpartidr r*r)rexctargetidrr part2nodes r6 handlefailurez+_pushb2phasespushkey..handlefailures_sz??% M MLFD!!k!$C"D"Dt"KLLL" M Mr8r namespacekeyold%dnewcFD]\}}|j|}|d}t|dksJd}|std|z}n-t |ddstd|z}|j|dS)Nrrs'server ignored update of %s to public! rrupdating %s to public failed! )rrrrrr.r)rrrpartrepresultsrrrs r6rz)_pushb2phasespushkey..handlereplys% $ $LFDj++F33Gj)Gw<<1$$$$C CCDDtKI.// C:;;dB s### $ $r8)rrrencoderrlrrrrrr?rr)rrnrenc newremoteheadr`rrs` @r6rrsL ###IMMMMM .C.11 z** lCC NN333 fcc-"3"3"5"566777 fcc%&,"677888 fcc%&-"788999$'=1222#0   $ $ $ $ $ $ r8rScd|jvrdStj|j}t j|dS|jd|jr0tj |j}tj ||dSdS)NrS) rrobsmarkersversionrkr commonversionrrr sortedmarkersbuildobsmarkerspart)rrnremoteversionsmarkerss r6_pushb2obsmarkersrs(((.w/CDDNn--5 ''' 6'(<==#GW5555566r8cd|jvrdStj|j}|jjdd}d|v}|sd|vrt||Sd|vrt||SdS)z$handle bookmark push through bundle2r0Nrrr) rrr{rrqr.r_pushb2bookmarkspart_pushb2bookmarkspushkey)rrnr}legacy legacybookss r6_pushb2bookmarksrsv'''   / /F [^ & &x1C D DF&(K 8<611#FG444 v  &vw777  r8c|sdS|sdSdS)z"small utility for bookmark pushingrrrrh)rrs r6 _bmactionr s! y y 9r8c|rQ|j|tjkr&t jt d|zdSdS)z6abort if a given bookmark points to a secret changesets:cannot push bookmark %s as it points to a secret changesetN)rqrrsecretr r*r)rrr^s r6_abortonsecretctxrs^   D!''))V]::k K L Lq P     ::r8c|jdjsdSgg}jD]S\}}}t|||||f|t ||fTt jj|}| d|fd}|S)Nr0ricxj}D].\}}|t|d|z/dSrG)r.status bookmsgmap)rr.raction allactionsrs r6rz)_pushb2bookmarkspart..handlereply)sK Y& 4 4LD& IIj(+d2 3 3 3 3 4 4r8) rrrrr?rrr|rqrl) rrnrjrrrrrrs ` @r6rrs &&&  J D -77c3&#t,,, T3K   43!4!456666$V[$77I OOLyO111444444 r8c r jdg tj} fd}jD]\}}}t |||d}|d|d|d|||d|t||d|t|d}|sd }n|sd } |j ||f|j |j < fd } | S) Nr0ct|j}D]F\}}}||kr:tjt|d|zGJ)Nr)rrr r*rrstrip)rrrrrr part2books r6rz._pushb2bookmarkspushkey..handlefailure7sjsz??$- I I FD&!!k*V"4Q"7">">"@"@4"GHHH"  r8rrrrrrrrc j}D]\}}}|j|}|d}t|dksJ|s+ jt d|zjt |dd}|r*|t|d|z|t|d|z j d _ dS)Nrrs"server ignored bookmark %s update rr) r.rrrrrrrrr) rr.rrrrrretrrs r6rz,_pushb2bookmarkspushkey..handlereplyNs Y$- , , FD&j++F33Gj)Gw<<1$$$$ , q!GHH4OPPPP'!*Y/00,IIj03d:;;;;GGJv.q1D89992*+ , ,r8) rrrrrrrlrrr?rr) rrnrrrrrr`rrrs ` @r6rr2sp &&&I .C!- 1 1c3&#t,,,z** lCC $5$5666 fcc$ii((( fcc#c((mm,,, fcc#c((mm,,, FF F$'40111#0  ,,,,,," r8pushvars)rdc.|j}|ri}|D]=}d|vrd}tj||z|dd\}}|||<>|d}|D]\} } || | ddSdS)zsend shellvars via bundle2=sIunable to parse variable '%s', should follow 'KEY=VALUE' or 'KEY=' formatrrFr\N)rr r*rZrlr<r) rrnr shellvarsrawrkrr`rBrCs r6_getbundlesendvarsrbsH7   C34k#),,,99T1%%DAqIaLL{++#//++ 7 7JC MM#uM 6 6 6 677 7 7r8cTtj|jtj|j}|jo|jdd}tjtj|j |d}| d|g}tD]?}t|}|||}t|r||@|jdkrdSt!j|} |j5} | d |d g|jd } dddn #1swxYwYn;#t.j$r)} t/jt5d | zd} ~ wwxYw d} |r |jj} tj|j | | } n#t.j$r)} t/jt5d | zd} ~ wtj$r} |jt5d | z| j2|jt5d d| jzzt/jt5dd} ~ wwxYwnQ#t.j$r?} tA| j!}||j"vr|j"||| Yd} ~ nd} ~ wwxYw|D] }|| dS)zpush data to the remote using bundle2 The only currently supported type of data is changegroup but this will evolve in the future.rvrclient) allowpushbackroles replycapsrirNrforce)sbundlerurlmissing support for %ss remote: %s s(%s)spush failed on remote)#rbundle20r.r{rrr encodecaps getrepocapsrqrlrar`callabler?nbpartsr chunkbuffer getchunkscommandexecutor callcommandrresultr BundleValueError RemoteErrorr transaction processbundle AbortFromPartrQ PushkeyFailedrrr)rrnpushbackcapsblob replyhandlers partgennamepartgenrstreamereplyrtrgetterrrrephands r6rrxs vy'*=fm*L*LMMGFI$8$8,%%H !FKxiPPPH OOLxO000M&&& #K0gfg&& C== &   % % %!  g//11 2 2F- H..00 A #)#+* & 1 1 3 3&((               % H H H#A&?$@$@3$FGG G H AH 8!+7&v{E8DDBB% H H H#A&?$@$@3$FGG G$ A A A IOOAo..4 5 5 5x# / 2 2g6H IJJJ#A&>$?$?@@ @  A   ---SZ  ( ( ,,,,,,,, - ! sF 0AF5 F FF F F K G$GGK +G54K5K$H((K:BJ>>KKL5LLc>d|jvrdS|jdt|sdS|jdsJ|j||j}d}|j8|j s1|jj j s tj |j|ddd|}ntj |j|dd|}|jrd g}n|j}|j|||j|_dS) z7Make the actual push of changeset bundle to remote reporNrrOrT)fastpathrrr)rrr]rrrqrrprrUrm filteredrevsr makechangegrouprrunbundlerr)rrprcgrs r6rrsC((( ''' f % % =  - ---- K$$V,,,HJ {#[2?  ( K   !     ( K5'j   |)j ( m,,Rfkoo>O>OPPFOOOr8c  |j}t|jd}|jddr#|r!|j|ddrddi}|st||dStj |j ||}|\ }|ddrt||n+t| t||tj |jrd|j vrdS|j }n|j}|j d fd|D}|D]}|j5}|d d|d tj zd tjzd }dddn #1swxYwY|s*|jt-d |zdS) z2synchronise phase information locally and remotelyrzrrNr{FsTruec@g|]}|v|Srhr)rirpheadss r6rlz"_pushsyncphase..s+BBB!166886+A+AA+A+A+Ar8rrrrrrr)rr~rr.rrr_localphasemoveranalyzeremotephasesrqrrrrrr r rrrrr) rrranar outdatedrrrr(s @r6rrsf  FFM955L U$5660 0 O #   ]E 2 2 $&w/ *'''''(flKK   M5 1 1 : FF + + + + FF + + + FFFL 9 9 9 ? 5F,,,,HH4HY'''CBBBxBBB%  M..00 AMM&/ - 1 1 3 3 % 4 % 5 &((                 899MI  sAF..F2 5F2 c jr5tjjj|dSfd|D}tj}|r,jtd|zdSdS)z0move to in the local source repocZg|]'}j|k%|(Srh)rqr)rirjrrs r6rlz#_localphasemove../s5JJJQ56;q>3G3G3I3I+I+Iq+I+I+Ir8s8cannot lock source repo, skipping local %s phase update N) rradvanceboundaryrqr phasenamesr.rr)rr.r actualmovesphasestrs` ` r6r*r*%s  K)5577     KJJJJ%JJJ $U+   I  /        r8c  d|jvrdS|j}|j}|jd|jr|jdg}tj|j}tj |}t|dD]5}||}| | d|d|6d|Dr-td }|j|dSdSdS) z5utility function to push obsolete markers to a remoterSNs'try to push obsolete markers to remote Treverser'r8cg|]}||Srhrh)rir.s r6rlz!_pushobsolete..Ks & & &!A &A & & &r8s&failed to push some obsolete markers! )rrqrrrr.rrrr_pushkeyescaper;r?rrr) rrqrrsltsr remotedatarBrjrs r6rr;s"((( ;D ]F '''   CDDD'(<==,W55 *d333 F FCc?D LL S#tDD E E E E & &u & & & >??C GLL         r8c `|jdks d|jvrdS|jd|j}|j}|jD]\}}}d}|sd}n|sd}|5}|dd|t|t|d }dddn #1swxYwY|r*| t|d|z| t|d |z|j d |_ dS) z"Update bookmark position on remoterr0Nrrrrr)r)rrrr.rrr r rrrrrr) rr.rr^rrrrr.s r6rrPs !|v/??? &&& B ]F*$$ 3 FF F  # # % %  ".HHHH fhh                  $ IIj(+a/ 0 0 0 0 GGJv&q)A- . . .*"#1$$s+AB??C C ceZdZdZ d dZejdZejdZejdZ d Z dS) pulloperationzA object that represent a single pull operation It purpose is to carry pull related state and very common operation. A new should be created at the beginning of each pull and discarded afterward. NFrhc 4|_||_| |_||_fd|D|_||_||_d|_d|_d|_ d|_ ||_ d|_ t|_d|_||_| |_| |_dS)NcDg|]}j|Srhr4r7s r6rlz*pulloperation.__init__..s6" " " 5=DO & &x 0 0" " " r8F)rqr remote_pathroexplicitbookmarksrstreamclonerequestedrrrrheadsfetchremotebookmarksrrrclonebundleattempted includepats excludepatsdepth) rrqrrorrrFrCrHrIrJpaths ` r6rzpulloperation.__init__|s    " " " " AJ" " "  $8!   . $)!&& r8c|jMt|j}t|j}|jD]}||vr|||S|jS)z0heads of the set of changeset target by the pull)rorrrrrDr?)rrrrjs r6 pulledsubsetzpulloperation.pulledsubsetse : DK  At{##C[ " "A::JJqMMMJ: r8c"t| Sr)rrs r6 canusebundle2zpulloperation.canusebundle2s &&&&r8c4tj|jSr)rr{rrs r6remotebundle2capszpulloperation.remotebundle2capss"4;///r8c4|jSr)rrrs r6gettransactionzpulloperation.gettransactions~))+++r8) NFrhNNNNNN) rrrrrrrrMrOrQrSrhr8r6r>r>ss! 5555n " ''' 000,,,,,r8r>c*eZdZdZdZdZdZdZdS)rzAn object to manage the life cycle of a transaction It creates the transaction on demand and calls the appropriate hooks when closing the transaction.c>||_||_||_d|_dSr)rqsourcer_tr)rrqrVrs r6rztransactionmanager.__init__s"  r8c|jsjd|jtj|jfz}|j||_|j|jjd<|j|jjd<|jS)z.headsofdiff.. ***s ***r8rh1h2resrs r6 headsofdiffz%_fullpullbundle2..headsofdiffs-hh+R44**c****r8cJd||}d|DS)zReturns heads((h1 + h2) - null)sheads((%ln + %ln - null))c6h|]}|Srhrrgs r6r9z9_fullpullbundle2..headsofunion.. rhr8rirjs r6 headsofunionz&_fullpullbundle2..headsofunion s-hh3R<<**c****r8Tc3BK|]}|VdSr)rk)rirjunficls r6rz#_fullpullbundle2..s/88Qv~~a  888888r8) rrmror _pullbundle2rNARROW_REQUIREMENTallrDrrr) rqpulloprnrq old_headsclstart new_headsrrss @@r6_fullpullbundle2r{s ??  D ^F+++++ +++++ ;LLNN f++V  *d.? ? ? E c&kk ! ! E 8888&-888 8 8  EK  :: $ Y >> FM**V]: !;r8c|j}tj||ddt j|fd}|d|dS)zadds a finalize callback to transaction which can be used to show stats to user and confirm the pull before committing transactionpullT)txnname as_validatorc}td}|j|rtjddS)Ns+accept incoming changes (yn)?$$ &Yes $$ &Nos user aborted)rr.rr r*)trrqcmreporefs r6promptz$add_confirm_callback..prompt+sNwyy = > > 7   # # /+o.. . / /r8s900-pull-promptN)rrrregistersummarycallbackweakrefrefr addvalidator)rqrwrrrs @r6add_confirm_callbackr!s   % % ' 'B # b'k$//++,,G///// OO&/////r8c |i}|s| r!|p t}| p t} n |j\}} tj|tj| t ||f||||||| | dt j|} | j} | rit| j | j j z }|rFtdd t|z}tj||jD]n}|jD]\}}||rn7tjtdt j|zot/|d|| _t5j}t9j|s|}|5|5| j5| s4|j !ddr)|j "stG|| tI| tKj&| tO| | j(rtS|| tU| tW| tY| t[| dddn #1swxYwYdddn #1swxYwYdddn #1swxYwY|j !dd rt]j/||| S) aFetch repository data from a remote. This is the main function used to retrieve data from a remote repository. ``repo`` is the local repository to clone into. ``remote`` is a peer instance. ``heads`` is an iterable of revisions we want to pull. ``None`` (the default) means to pull everything from the remote. ``bookmarks`` is an iterable of bookmarks requesting to be pulled. By default, all remote bookmarks are pulled. ``opargs`` are additional keyword arguments to pass to ``pulloperation`` initialization. ``streamclonerequested`` is a boolean indicating whether a "streaming clone" is requested. A "streaming clone" is essentially a raw file copy of revlogs from the server. This only works when the local repository is empty. The default value of ``None`` means to respect the server configuration for preferring stream clones. ``includepats`` and ``excludepats`` define explicit file patterns to include and exclude in storage, respectively. If not defined, narrow patterns from the repo instance are used, if available. ``depth`` is an integer indicating the DAG depth of history we're interested in. If defined, for each revision specified in ``heads``, we will fetch up to this many of its ancestors and data associated with them. ``confirm`` is a boolean indicating whether the pull should be confirmed before committing the transaction. This overrides HGPLAIN. Returns the ``pulloperation`` created for this pull. N)rKrorrrCrHrIrJrrsDsidedata category requested by local side without localsupport: '%s'r}rxrvr)0r narrowpatsrvalidatepatternsr>rrrrrrqrrr)r;r r*_wanted_sidedatarr<rProgrammingErrorrrrrrrrrrr r.rplainr_maybeapplyclonebundlermaybeperformlegacystreamclone_pulldiscoveryrOr{_pullchangeset _pullphase_pullbookmarks _pullobsoleterr)rqrrKrorrrrCrHrIrJconfirmrw peerlocalrrrrrrs r6pullr4s4T~3k3!*SUU !*SUU #'? [ ,,, ,,,   1    V $ $  F ##%%I#i,-- 0EE  #F7OO,, .C +c"" ") $7==??  OD)}}X&&   (%"8,, -  *$FFF  # % %E  #D ) )   V-  / G  w 3 3 /<@GMMOO / !v . . . v&&&1&999v   + T6 * * *v6vf!& w/>::2#D&111 Ms[$L9K0C K K0K K0 K !K0$ L0K4 4L7K4 8LL L cfd}|S)a|decorator for function performing discovery before pull The function is added to the step -> function mapping and appended to the list of steps. Beware that decorated function will be added in order (this may matter). You can only use this decorator for a new step, if you want to wrap a step from an extension, change the pulldiscovery dictionary directly.cftvsJ|t<t|Sr)pulldiscoverymappingpulldiscoveryorderr?rs r6rzpulldiscovery..decrr8rhrs` r6 pulldiscoveryrrr8cJtD]}t|}||dSr)rr)rwrrs r6rrrr8s b1:bookmarksc|jdS|jr d|jvrdSt|jd}t j||_dS)zfetch bookmark data in bundle1 case If not using bundle2, we have to fetch bookmarks before changeset discovery to reduce the chance and impact of race conditions.Nrbr0)rFrOrQr~rrr<)rwbookss r6_pullbookmarkbundle1rs[ )  v/G G G  V]L 1 1E$7>>Fr8rMctj|j|j|j|j}|\}}}|jjjj }|rk|rit|}|D]&}||r||vr| |'t| t|rg}||_ ||_||_dS)z~discovery phase for the pull Current handle changeset discovery only, will change handle all discovery at some point.)rorN)r rrqrrorrrmrhas_noderr?issubsetrrrErD)rwtmprrrErDrscommonrjs r6_pulldiscoverychangegrouprs  & V]&,fl   C FE6{%%''17@H f++ % %Ax{{ %G##MM!$$$ v;;  F , , EFMFLFMMMr8c dt|jdi}|jj}tj|dd}|j|d<|jp|j|d<|j tj }|r|j r |j |d <|r|j r |j |d <|r?d |d <d|d <|jd|jdn|jd|j|d <d|ddv}d|jddv}|s!|rd|d<|jdd|jvrd|jvrdg|d<d }d|ddv}d|jv} |j|jdd|jvr|j |s | rd|d<d}d|jvrLd|jvrC|jd|dgd|j dr4|j-t/|j|jjgkr |j|d<|r-|jjt7dn|js4|jjt7dd|_nV|jOt/|j|jjgkr,|jjt7dt;j|jt:jrLtAj!|j} t;j"| d|d<|jdtG||tAj$|j} | r| |d<|j%5} tM|} d| d<| 'd | (} tAj)|j|j*d!}d"|j+d<tAj,|j||#n#t@j-$r\}|jj.t7d$|zt]j/t7d%|j0&d}~wt\j1$r)}t]j/t7d'|zd}~wwxYw dddn #1swxYwY|jrtAj2||_|j3dD]\}}|dkrti|||r+i}|j3dD]}|d(||d)<||_n2|j3dD]$\}}|dkrtkj6||_%|jto|dSdS)*zNpull data using bundle2 For now, the only supported data are changegroup.s bundlecapsrrT)rrcommonrs includepatss excludepatsFcgr!rMrzrrrhrbr0Nsrequest-bookmarks clonebundless cbattemptedsstreaming all changes no changes found requesting all changes rSsremote_sidedatar}rY getbundle)rVsrecordsrsremote: abort: %s spull failed on remoterPrsnodesbookmark)8 caps20to10rqr.rcanperformstreamclonerrrorDrrr NARROWCAPrHrIrrrErrQrrF setdefaultr?rrnrGrrrrr*r+rrr_pullbundle2extrapreparerr dictr rbundleoperationrSmodesrrr rrQrcombinechangegroupresultsr_pullapplyphasesrr<r)rwkwargsr. streaming servernarrowrhasbinaryphasebookmarksrequestedlegacybookmark hasbinarybookrrrargsbundlerrrcrCrrecords r6rtrtsZ )DDD EF B1&$GGGJI F9|4v}F8=(()ABBL4*4!'!3~4*4!'!3~2u  y^,,,Y'''' ^,,, u 2==;M#N#NN !V%=%A%A)R%P%PP ,~ , $F9     + + + &2 2 2 000'0k{#!R]]8=O%P%PPN F$<$?$?chOOO O% H H H#A&?$@$@3$FGG G H >HHHHHHHHHHHHHHH"|@!;B??J{3,, 5  ! ! VU + + +Kj. 9 9F)/E&% & &!& " ; 7 K K IuL(()0)CE)J)J&)v*)sD6=T-4AQ<;T-<T AS""T4$TTT--T14T1cdS)z>hook function so that extensions can extend the getbundle callNrh)rwrs r6rrsr8c<d|jvrdS|jd|js5|jjt dd|_dS|}|j Pt|j |jj gkr-|jjt dn-|j &|j dr |j|_ |j dr0|j d|j |j p|j }n |j b|j 5}|d|jdd }dddn #1swxYwYn|j ds!t)jt d |j 5}|d|j|j dd }dddn #1swxYwYt-j|j||d|j }t-j||_dS) z0pull changeset from unbundle into the local reporMNrrrschangegroupsubsetrr}rrro)snodesrYsWpartial pull cannot be done because other repository doesn't support changegroupsubset.)sbasesrrY)rrrErqr.rrrrSrorrrrnrrrD getbundler r rr r*r applybundlerr)rwrr%rbundleops r6rrs ))) ((( < a 566777    B |V] 3 3 8J7K K K a ;<<====  &-"7"78L"M"M }  }\**  ] $ $ FM1N%     ] * * , , $l& fhh                ] " "#7 8 8k &     ] * * , , $$l$l&fhh                " RWfm&7&7&9&9H7AAFOOOs$$1F!!F%(F%7II Icfd|jvrdSt|jd}t||dS)Nrz)rr~rr)rwrs r6rrs<F$$$FM955LV\*****r8c d|jvrdS|jdt|dd}|r-|s+t j|j|j|\}}|j}n |j}g}|j j j  j j j tj tj fd|D}|r0|}t j|j| | fd|D}|r2|}t j|j||dSdS)z/apply phase movement from observed remote staterzNr{FcFg|]}|k|Srhrh)ripnrrrrs r6rlz$_pullapplyphases..s7 C C CRUU4R%9%9F%B%Bb%B%B%Br8cFg|]}|k|Srhrh)rirrrrrs r6rlz$_pullapplyphases..s7 B B BRUU4R%9%9E%A%Ab%A%A%Ar8)rrrxrrr+rqrMr _phasecacherrmrget_revrrrSr1) rwrrr(_drdheadsrrrrrrs @@@@@r6rrsF$$$ ###l&&}e<<==J J 0 K,l  $$ ; ! ! # #D   "E .  &C ]F LED C C C C C C6 C C CF @  " " $ $v{B???C B B B B B B6 B B BF ?  " " $ $v{Bv>>>>>??r8c d|jvrdS|jd|j}|j}d}|j |jj}t j|j|||j |j |j |dS)z?process the remote bookmark information to update the local oner0N)rAmode) rrrqrFrAbookmarks_moderupdatefromremoter.rrrSrB)rwrqrFrs r6rrsv''' &&& ;D,ON %+:    ) r8cld|jvrdS|jdd}tj|jtjr|jjdt|j d}d|vr| }g}t|dD]M}| dr6tj||}tj|\}}||z }N|r |jj|||j|S) aVutility function to pull obsolete markers from a remote The `gettransaction` is function that return the pull transaction, creating one if necessary. We return the transaction to inform the calling code that a new transaction have been created (when applicable). Exists mostly to allow overriding for experimentation purposerSNs!fetching remote obsolete markers r'sdump0Tr6sdump)rrrr*rqr+r.rr~rrSr;r'r b85decode _readmarkersr,invalidatevolatilesets)rwr remoteobsrrBrjr5newmarkss r6rrs7((( ''' B&+x';<< 1 BCCCV]K88 y &&((BGi666 ( (>>'**(>)C.99D(0(=d(C(C%GXx'G 6 $((W555 K . . 0 0 0 Ir8c|j}||jdp|}|t |dz|t d}|t |dz|t d}|s+tjtdt |fzd|D}d|D}t|d g}t|d g}tj ||||\}}}|r8tjtd |tj|fzi} | |d | d <d | d<|| d <|r|| d <| S)zApply narrow fetch access control. This massages the named arguments for getbundle wire protocol commands so requested data is filtered through access control rules. s REMOTE_USERs .includessdefault.includess .excludessdefault.excludess%%s configuration for user %s is emptyc(g|]}|dkrdnd|zS*spath:.spath:rhrs r6rlz"applynarrowacl..J556Q$YY HqLr8c(g|]}|dkrdnd|zSrrhrs r6rlz"applynarrowacl..Mrr8rHrIs4The following includes are not accessible for %s: %sTnarrow narrow_acl)r. shortuserenvironrusernamer_NARROWACL_SECTIONr r*rrrrestrictpatternsrpprintupdate) rqrr.r user_includes user_excludes req_includes req_excludesinvalid_includesnew_argss r6applynarrowaclr1s B||BJNN>::KbkkmmLLHMM< (*=>>M MM< (*=>>M  k 6 7 7!8, -   :GM:GMvzz-4455Lvzz-4455L3=3NlM=440L, 0 k E F F*+;<<= >   H OOFHX!H\*H]/". Or8c  jj}jfd|Dthz}fd|D}|r d|D} t jt } t jt  fd} fd fdt||} t| } t }fd| D}t ||z}| D]V} |d  |D}|:| |}|D]/}t|d z| ||d z| |<0d }|d up | ||k}|r|j}|r| |d j}t!|||}|snt%|d kr[| |d j}t!|||}n"t'||}|r[| |D]}| |||D]}|||||stg}||vr9| |D]}| |||D]}| ||;|D]}| |xx| |zcc<X|D]}| |D]}| ||||fS)aCompute the shape of a narrowed DAG. Args: repo: The repository we're transferring. common: The roots of the DAG range we're transferring. May be just [nullid], which means all ancestors of heads. heads: The heads of the DAG range we're transferring. match: The narrowmatcher that allows us to identify relevant changes. depth: If not None, only consider nodes to be full nodes if they are at most depth changesets away from one of heads. Returns: A tuple of (visitnodes, relevant_nodes, ellipsisroots) where: visitnodes: The list of nodes (either full or ellipsis) which need to be sent to the client. relevant_nodes: The set of changelog nodes which change a file inside the narrowspec. The client needs these as non-ellipsis nodes. ellipsisroots: A dict of {rev: parents} that is used in narrowchangegroup to produce ellipsis nodes with the correct parents. c&h|] }|Srhrhrirjclrevs r6r9z#_computeellipsis..s!+++q%%((+++r8c&h|] }|Srhrhrs r6r9z#_computeellipsis..s!)))aq)))r8ci|]}|dS)rrhrs r6rz$_computeellipsis..s,,,QAq,,,r8c||t|dkr8|\}}||||}t|dk6dSdS)z=Add a root to an ellipsis head, splitting heads with 3 roots.r#N)rr)head curchangechildroots ellipsisroots splithead splitrootss r6addrootz!_computeellipsis..addrootsd *** -%&&**$9T??LE5 JtUE * * *D-%&&******r8c||||||||dSr)difference_updaterrdiscard)rrrrs r6rz$_computeellipsis..splitrootssmd--e444d&&&e##E***e$$U+++++r8cRt|\}}}||f||f||ffD]Z\}} d||||}|D]9}||kr |||ffccS|vst|dkr |||ffccS:[tjt d||||fz)Ns%sort(merge() & %d::%d & %d::%d, -rev)r#s;Failed to split up ellipsis node! head: %d, roots: %d %d %d)r;rrr r*r) rr1r2r3nr1nr2midjrrqs r6rz#_computeellipsis..splitheadsM$/00 BbB8b"X6 ) )HC))8#tS$C ) )88c ?*****M))Sq1A-B-BQ-F-FsCj=(((((.G ) k #  RR  !   r8rc:g|]}|Srhr)rimrss r6rlz$_computeellipsis..s#..."''!**...r8c(g|]}|tk |Srh)r)riprevs r6rlz$_computeellipsis..s E E EtTW__d___r8NrFr)rm manifestlogrr collections defaultdictrrfindmissingrevsreversedchangelogrevision parentrevsminrrreadrxdiffrrwalkrr)!rqrrroknownmatchrJmfl commonrevs headsrevsrevdepth ellipsisheadsrrvisitrelevant_nodes visitnodesrequiredrpscurdepthrneededshallow_enoughcurmfp1mfp2mfrrrsrrrrs!` @@@@@r6_computeellipsisr0isJ. B  C FE++++F+++wi7J))))5)))I -,,),,,+C00M+C00M       ,,,,,       &2%%Zy%IIJJG W  EUUN....g...J9~~%H-;-;$$S)) E Er}}S11 E E E  }H L L!(Q, Q 0J0JKK $@(3-5*@  0',,..E 02//166?@EEGGejju5566;#b''A++ r33BqE::CDIIKKD!%**T5"9"9::FUZZ..//  ;%c* # #c""""   Q   rwws|| , , , , Yh)#.''DGD#&&&&..A!!$((----.;;A!!$$$ c(::$$$$;!!$  D GD!      ~} 44r8cdh}tjtj||}|dt|z|S)zFreturn a set with appropriate options to use bundle20 during getbundlesHG20rbundle2=)rrrrr=r>)rqrcapsrs r6rrsQ 9D!'"5d"F"F"FGGHHH[6<<11 1222 Kr8cfd}|S)adecorator for function generating bundle2 part for getbundle The function is added to the step -> function mapping and appended to the list of steps. Beware that decorated functions will be added in order (this may matter). You can only use this decorator for new steps, if you want to wrap a step from an extension, attack the getbundle2partsmapping dictionary directly.ctvsJ|t<tnt|Sr)getbundle2partsmappinggetbundle2partsorderr?rbrcs r6rz%getbundle2partsgenerator..dec sW55555+/x( ; ' ' 1 1 1 1 ' 'X 6 6 6 r8rhres`` r6getbundle2partsgeneratorr8rgr8c<|td|DSdS)Nc3@K|]}|dVdS)sHG2N)r')ricaps r6rz#bundle2requested.. s.@@c3>>&))@@@@@@r8F)rr!s r6bundle2requestedr< s*@@Z@@@@@@ 5r8c tj|}i}t|}|s|r2|ddst t d|rQt t ddt|zt|||} d|d<|tj || d||| fSd |d<i} |D]m} | d rVt| td d } | t#j| nt#j|j| } ||d <||d<t*D]0}t,|}|| ||f|| |dtj|1| j|d<|| fS)aReturn chunks constituting a bundle's raw data. Could be a bundle HG10 or a bundle HG20 depending on bundlecaps passed. Returns a 2-tuple of a dict with metadata about the generated bundle and an iterator over raw chunks (of varying sizes). rTs-request for bundle10 must include changegroups#unsupported getbundle arguments: %srrs bundleversionrOrr#r2Nrr)rr}rsprefercompressed)r byteskwargsr<r ValueErrorrr)r;keysrtr rr'r=rYrrr decodecapsrr.r7r6rprefercompressedr )rqrVrorrrrrinfo usebundle2rpr}bcapsblobrnnamers r6getbundlechunksrH s4" !& ) )F D!*--J   fjj55 BCC   899**VFKKMM22334 $D%88!"    "% /      D  F44   K ( ( 4>>%K(8(8(:(:";<.~ s9   K9$???? ???r8rrFrHrI)includeexclude)rmatcherrrirNs nbchangesrrrrrsexp-wanted-sidedatarsNarrow:responsespecs%s%s )rr r*rrrtrr;filterrxrrrootr rrlrrrrrrrrformat_remote_wanted_sidedatar)rj)rnrqrVrr}rorrrrr5rrprNrOrPrr`sidedatanarrowspecparts ` r6_getbundlechangegrouppartrWk s ::dD ! !GN++J"        C+a @AABB Bj//eV44H   zz(E""fjj&C&CDDEEfjj&C&CDDEE"49gwOOO% 'H ??>? 9 9D+ j'***MM,H,<(=(= =MOOOd##- ot,,,(DM99 ot,,,8>> ,h777  8U##  JJ|U + +       !)?@@' JJw   JJw  +         r8c |ddsdS|rd|vr!tjtdt j|}t j||}|r|d|dSdS)z+add a bookmark part to the requested bundlerFNr0s#no common bookmarks exchange methodri)rr r*rrlistbinbookmarksr|rl)rnrqrVrr}rrrjs r6_getbundlebookmarkpartrZ s ::k5 ) ) E\//k!BCCDDD  $T * *E  e , ,D 1 40000011r8rbc |dd}|D]m}|d}|d|||} t j| |_ndS)z@add parts containing listkeys namespaces to the requested bundler~rhrbrN)rrlrr~r<r encodekeysrj) rnrqrVrr}rr~rcr`r@s r6_getbundlelistkeyspartsr] s zz*b))H-- {++ lI...}}Y''--//&t,, --r8c (|ddr{||}d|d|D}|j|}t j|}tj||dSdS)z8add an obsolescence markers part to the requested bundle obsmarkersFNc6g|]}|Srhrrs r6rlz+_getbundleobsmarkerpart.. s >>>q!&&((>>>r8r)) rrorr,r-rrrr) rnrqrVrr}rorsubsetrs r6_getbundleobsmarkerpartrb s zz,&&6 =JJLLE>>DHHXu$=$=>>>-//77'00#GW55555 66r8rzc Z|ddr|rd|dvr!tjtd||}t jt|r|tj <n?|j j }|j j}|j j} |D]0} ||| | | 1t#} | rt'| tjksJtjt} | rxtj t} d}||| | }|D]0}tj ||1fdtjD}tj|}|d | dSdS) z,add phase heads part to the requested bundlerFrrzs no common phases exchange methodNs"heads(only(%ln, %ln) and public())c<i|]}|t|Srh)r;)rir headsbyphases r6rz(_getbundlephasespart.. s5   38E6,u-..   r8rri)rr r*rrorrrrrrrrrmrrrrr@rrrrr|rl)rnrqrVrr}rorrrrr seenphases draftheadsrr extraheadsr. phasemappingrres @r6_getbundlephasespartrj s% zz(E"")8 FI)>)>>>+a CDDEE E =JJLLE".s33 ??   =*/L ' '$*E>&D.$C 9 9UU4Q00155a8888l//1122J 7:&,6666&))&,>>J =*..v}ceeDD >!YYvz;GG #==A /33DDGG<<<<    >@@Jz!! %   9j1 1 1o = G   "!   1 1r8c  dgd d}jdd}dsdrd} t|d t |t jsd tj g} 5 |5}t j ||} t j | dddn #1swxYwYdddn #1swxYwYnd fd } jdd s | t j| |d } t j|| } | j|r#!jddfd}n1#| j|r#!jddfd}wxYw d dn>#t&$r1} d| _|r" x | _ fd}d} ~ wwxYwt/j d d d|"|jnR#t/j d d d|#|jwwxYwS)aApply a bundle to a repo. this function makes sure the repo is locked during the application and have mechanism to check that no push race occurred between the creation of the bundle and its application. If the push was raced as PushRaced exception is raised.rNNNNrvsbundle2-output-captures remote:http:s remote:https:Tsuploading changesrQc8dstjsd<d<d<djd<djd<ddjd<dS)Nr#rrrYrrr)rrrr rr[) lockandtrrqrVrsr6rSz unbundle..gettransaction s$Q<A&7==8+/::<.recordout s!IIifINNNNNr8r#c`tjd|d}|dSr)r bundlepartr?)rr`rAs r6rzunbundle..recordout s;&1%Fe    T*****r8r)r.rr'r{rTrrVr)rrZr rrrrrr pushbufferr^ BaseExceptionduringunbundle2 salvageoutput_bundle2salvagedoutputlockmodr` popbuffer)rqr%rorVrrrr~rrrSrrrAr.s` `` @@@r6r$r$g s4 A#""IIG&&2M ~~o&&#..9I*J*J B+ D%!5666"g0119 jj&'*>s*C*C!DEEG : :d..w77 :2(r2vsCC5b99 : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :A1  ( ( ( ( ( ( ( (w))#%:%#N$$$,""/"  O .tRB???BA$O**t*DDDOOOOO A$O**t*DDDOOOOOOOOOQ<+aL&&(((   &*# +Q]9:9J9JJEC6+++++    ! ilIaLAAA  Idg'')) * * *  ! ilIaLAAA  Idg'')) * * * * ! HsA(J?D%-D D%D D%D D% J%D))J,D)-J5AH;F?-H?.G--%HJ I,I  IJAK-c|j}|j}|jddsdSt |rdS|jrdS|dsdS|5}|di }dddn #1swxYwYd|_ tj ||}|s)|j tddStj|||j}|sP|jtd|jtddStj|j|}|d d }|jtd |zt)|j||r)|jtd dS|jdd r)|jtddSt+jtdtd)z0Apply a clone bundle from a remote, if possible.rrNTsDno clone bundles available on remote; falling back to regular clone )rCsOno compatible clone bundles available on server; falling back to regular clone s5(you may want to report this to the server operator) rsURLsapplying clone bundle from %s sfinished applying clone bundle sclonebundlefallbacksfalling back to normal clone serror applying bundles}if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false"rP)rqrr.rrrorr r rrGr parseclonebundlesmanifestnoterfilterclonebundleentriesrCrsortclonebundleentriesrtrypullbundlefromurlr r*)rwrqrrrmentriesrs r6rr s ;D ]F 7  e_ 5 5 4yy | >>/ * *    ! !:QmmOR007799::::::::::::::: #'F4T3??G   3     3 gF,GG   3      G H H    1$'7CCG !*V CGNN17883>???DGT3//  q<==>>>>>   E#9 : :    Q899:::::k & ' '4    s1)B&&B*-B*c 0|5|d5} tj||}t ||d}t |t jr||ntj |||d| dddddddS#tj $rA}| tdtj|zYd}~n[d}~wtj$rF}| tdtj|jzYd}~nd}~wwxYw dddddddS#1swxYwYddddS#1swxYwYdS) z%Attempt to apply a bundle from a URL.s bundleurlr!rNTsHTTP error fetching bundle: %s serror fetching bundle: %s F)r rurlmodopenr7rTrr-applyrrurlerr httperrorrrrrurlerrorreason)r.rqrrr/r%rs r6rr s d&&|44 R%%BBI..B"k<== H#D"b/3GGG    GG566)!,,-            GG011)!(334          +spF E3A.B4 F 4E7C?:E3?Er]rar`rfrvryrrrrrrrrrrrrrrrrrr*rrr> transactionalrr~r{rrrrrrrrrtrrrrrrrr0rr7r6r8r<rHrKrWrZr]rbrjrorsr{r$rrrhr8r6rs , #"""""  !    >N=N=N=b333(#.#.#.L = = = A&A&A&A&A&A&A&A&N  #$$  *++  $%%  +,,  *++  122   &    mmmmb &(((&|4x;-;-;-||GGG"|OOO(333l###N ,CCC6$%% 8 8&% 8/""==#"=$,33 3l(555"888"""J-   6 6!  6, 8 8  8   .---`+1%%%77&%7*888v-Q-Q-Q`???D*0,* $ $ $F\,\,\,\,\,\,\,\,~+@NNN ';';';T000,      ||||@ & ? ?  ?~@JJJZIII8B8B8Bv+++!?!?!?H*:555pB5B5B5B5J ,   H%H%H%H%V*%%AA&%A.))    H H H *)H V,''37 1 1 1(' 1+&&37 - - -'& --((?C 6 6 6)( 6)$$?C-8-8-8%$-8`/**    <<<+*<6344    ";";";54";J   &V V V rO O O dr8