a +bEn @sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZmZmZddlmZmZddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z4m5Z5m6Z7m8Z8m9Z9m:Z:m;Z;mZ>mZm?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZNmOZOmPZPmQZQmRZSmTZTmUZVmWZWmXZXddlYmZZZdd l[m\Z\m]Z]m^Z^m_Z_m`Z`maZadd lbmcZdmeZemfZfmgZge4jhZhiZieijeLjkjle?keiZkekd ged d dddZmekdgddZnekdgdddZoekddddedfdddedfdd ded!fd"d#ded$fged%dd'd(Zpdd)d*Zqdd+d,Zrdd-d.Zsd/d0Ztdd1d2Zuekd3d4d5ded6fd"d7ged8fd"d9ded:fgedd d;ddged?d d;d@dAZwekdBdCgdDdEdFZxekdGgd"dHdIZyekdJd"dKdedLfgdMdNdOZzdPdQZ{dRdSZ|ekdTgddUdVZ}ekdWdXdYdedZfd[d\ded]fd"d^ded_fd`dadedbfgedcd dddddeZ~ekdfe#jedgddhdiZekdjdkdldedmfgednd d doddpdqZekdre#je#jedsd dddtduZekdvd"dwdedxfd"dyd edzfd"d{ded|fd"d}d&ed~fd"d5d&edfgedddZekdd"ddedfd"ddedfd"dgdfdddge#je#jeddddZdZekdddd"edfgd ddddZekde#jgd dddZekdddd"ededDfd"dd&edfd`ddedfddgededfgedddZekdd"dd"ededfd"dd"ededfd"dd&edfge#jddZekdge#jddZekdgedd d;dddZekdddgededfddgededfdXddedÃedăfgedŃd d;dddDŽZekdgdɃdd˄Zekde#je#jedsddd΄Zekde#jedsd ddddфZekdgddԄZekdge#jd"d d;ddׄZekdgedكd d;ddۄZekdged݃dd߄Zekddddedfdddedfd`ddedfdddedfgedddZekdd"dd&edfd4dgededfgd"dddZekdge#jd"ddZekdgedddZekdd"dd&edfd"dd&edfd"dd&edfd"dd&edfgddZekd d"d ded fd"d d&ed fddgedfd"dd&edfd"dd&edfd"dgedfge#je#jeddddZekdddd"ededDfgedddZekdddd"ededDfgedddZekdd d!ded"fdd#ded$fd4d%ded&fdd'ded(fged)d*d+Zekd,e#jd-d d.d/d0Zekd1ged?d d;d2d3Zekd4ddd"ed5edDfd"d6ded7fge#je#jed8d d.d9d:Zekd;ged<d d;d=d>Zekd?ged@ddAdBZekdCddd"edDedDfd"dEdedFfgeddGdHZekdId"dJd&edKfgd"dLdMZekdNddd"ededDfgedOdPdQZekdRgd"dSdTZekdUe#jdVdWd&edXfgedsd dddYdZZekd[e#jd d\ded]ed^fged_d ddd`daZekdbd"dcdeddfd"ded edffd`dgdedhfddgededfd"did&edjfd"dkd&edlfgdmdndoZekdpd"dqd&edrfd"dsd"edtfd"dud"edvfgd"dwdxZekdygedzdd{d|Zekd}e#jedgdd~dZekdgdd ddddZekddge#jedddZekdddd"ededDfgeddddZekdd dddZekdd"dd&edfgedddZekdgddZekdddgededDfddgededfgedd dddZekdddd"ededfgedd d;dddZekdddd"ededfgedd d;dddZekdgddZekdddcgededfd"dd&edfd"dd edfd"ddedfd"ddedfd"ddedfgdddZekde#jedd d.ddZekdgedDdÐdĄZekdgdƢe#jedǃd d;dȐdɄZdʐd˄Zekdd"dd&ed΃fd"dd"edЃfd"dd&ed҃fd"dd&edԃfge#jedd dddՐdքZdS()absolute_importN)_)binhexnullrevshort)getattropen)5bundle2 bundlerepo changegroupcmdutilcolorcontextcopies dagparser dirstateutilsencodingerrorexchange extensions filemerge filesetlang formatterhghttppeer localrepolock logcmdutil mergestatemetadataobsoleteobsutilpathutilphasespolicypvecpycompat registrarrepairrepoview requirementsrevlogrevset revsetlangscmutil setdiscovery simplemergesshpeersslutil streamclonestriptags templater treediscoveryupgradeurlutilvfswireprotoframingwireprotoserver) repository)cborutil compressiondateutilprocutil stringutilurlutil)deltasnodemaprewritesidedatas debugancestors[INDEX] REV1 REV2T) optionalrepoc Gst|dkr8|\}}}ttjtdd|}|j}nBt|dkrl|sVtt d|\}}|j }|j}ntt d| ||||}| d| |t|fdS) zGBDK|qyDK~v2MM*sz!debugbuilddag..rvsbuildings revisions)Zunittotalsbuilddagdefaultsnode %s smfcsg|]}|qSrb)data)rwxfnrbrcryscSsg|] }|qSrbr6rwlrbrbrcrys s r%isofsr%i snf%isnfcs |vrt||||SdSN)rZ memfilectx)r[cxpath) filecontentrbrcfctxfn:s  zdebugbuilddag..fctxfncsg|] }|qSrbrbrwp)nodeidsrbrcryFrvr%irrbranch)dateuserZextralstag %s %s %s as branch %s s localtags)#statusrfinreadrVrQrrUrZparsedagr(xrangeappendZ makeprogresswlockr transactionupdatenotebytestrrWr2Z Merge3TextZrender_minimizedr}splitri startswithrZmemctxZ commitctxrnoder=rX)"rZr[textZmergeable_fileZoverwritten_fileZnew_fileZ from_existingclrztyper}Z linesperrevZinitialmergedlinesr7ZprogressZatZatbranchidZpsfilesp2p1pabaselocalotherZm3mlZ mergedtextrZparsrnodeidnamerb)rrrrc debugbuilddagsB   .                          rc sd||rndfdd}|d|dtjiD]}|d}||qVnZttjrt t d D].}|\} } } } } }}} d t | fqdS) N s3%sformat: id, p1, p2, cset, delta base, len(delta) c sld|fD]L}|\}}}}}}}} dt|t|t|t|t|t|fqdS)Ns %s%s s%s%s %s %s %s %s %d )rX deltaiterrrQ) Znamed deltadatarrrcs deltabasedeltaflagsrJrp indent_stringrZrbrc showchunksis z%_debugchangegroup..showchunks changelogmanifestsfilenamesuse debugbundle2 for this file%s%s ) writenoi18nZchangelogheaderZmanifestheaderiterZ filelogheader isinstancer unbundle20rrUrrrXr)rZrpallindentoptsrZ chunkdatarorrrrrrrrrJrbrrc_debugchangegroupas*   rc Kst|}|}d|}zt|\}}WnHtjyt}z.d} | ||jt|f;} | | WYd}~nvd}~00d} | ||t|f;} | | | d|} t |D].} t d| } | | |t| | q| dS)/display version and markers contained in 'data'rs%%sunsupported version: %s (%d bytes) Ns%sversion: %d (%d bytes) debugobsolete)r( byteskwargsrr"Z _readmarkersrZUnknownVersionversionrQrXrsortedr#Zmarker startitemplainr showmarkerend) rZpartrrr}rrmarkersexcmsgfmZ rawmarkermrbrbrc_debugobsmarkerss&       rcCsVd|}t|}tjD]8}||D]*}|||dt|tj|fq$qdS)rrrN)r%Z binarydecodeZ allphasesrXrZ phasenames)rZr}rrZ headsbyphaseZphaseheadrbrbrc_debugphaseheadss     rcsBtttjtjfr4ddfddtDSt t S)Ns{%s}, c3s|]}d||fVqdS)s%s: %sNrb)rwkthingrbrc rvz_quasirepr..) rdictr<Zsortdict collections OrderedDictrirr(rreprrrbrrc _quasireprs rc Kst|tjsttd|dt|j| dg}| D]}|rV|j |vrVqBd}|||j t|j|j f|j dkr|j dd}t ||d}|jst||f|d d ||j d kr|jst||fd d i||j d krB|jsBt||d dqBdS)zlists the contents of a bundle2snot a bundle2 filesStream params: %s Z part_types%s -- %s (mandatory: %r) s changegroupsversions01sUN)rrs obsmarkersrs phase-heads)rN)rr rrrUrrXrparamsgetZ iterpartsrZ mandatoryr Z getunbundlerquietrrr) rZrprrZ parttypesrrrZcgrbrbrc _debugbundle2s(      rs debugbundlerallsshow all detailss part-typesshow only the named part typesspecs"print the bundlespec of the bundle)norepocKst||}|rVrvz$_debugdisplaycolor..rrlabel) copy_stylesclearrZ_activeeffectskeysZ_terminfoparams configitemsrrXrritems)rZZeffectrrrZ colornamerrbrbrcr Is     r c stdjsdStddjD}tjD]p\}}jd||d|rddtd|t|d fd d|Dd q:dS) Nsavailable style: css|]}t|VqdSrrQrwsrbrbrcr_rvz%_debugdisplaystyle..%srs: rrrc3s|]}||VqdSrrrwerZrbrcrfrvr) rXrrmaxrrrQrir)rZwidthrZeffectsrbr rcr [s "r sdebugcreatestreamclonebundlecCsTt|r|tdt|\}}t||||tdd t |dS)zcreate a stream clone bundle file Stream bundles are special bundles that are essentially archives of revlog files. They are commonly used for cloning very quickly. s=(warning: stream clone bundle will contain secret revisions) sbundle requirements: %s rN) r%Z hassecretrrr5Zgeneratebundlev1r Z writechunksrXrir)rZr[ror,rprbrbrcdebugcreatestreamclonebundlejs r#sdebugdagtstagssuse tags as labelsbbranchessannotate with branch namessdotssuse dots for runsssspacessseparate elements by spacessPTION]... [FILE [REV]...]c s|d}|d}|rPttjtdd|ddDfdd}nv|r|j|d |d ri|D] \}}   | g |qfd d}nt td tj||d d ||ddD]} || |dqdS)aformat the changelog or an index DAG as a concise textual description If you pass a revlog index, the revlog's DAG is emitted. If you list revision numbers, they get labeled in the output as rN. Otherwise, the changelog DAG of the current repo is emitted. spacesdotsFrMcSsh|] }t|qSrb)intrwr`rbrbrc rvzdebugdag..c3sJD]@}d|tdd|DffV|vrd|d|ffVqdS)Nrucss|]}|dkr|VqdSr{Nrbrrbrbrcrrv+debugdag..events..rr)list parentrevs)r`)revsrlogrbrceventss"zdebugdag..eventsr7branchesc3sd}D]}r>|dd}||kr>d|fV|}d|tdd|DffVr|}|r|D]}d||ffVqvqdS) Nr|rrrucss|]}|dkr|VqdSr-rbrrbrbrcrrvr.r)rrr/r0r)br`ZnewbZlsr)r4rlabelsr7rbrcr3s " sneed repo for changelog dagTF)Z addspacesZ wraplabelsZwrapannotationsZ wrapnonlinearZusedotsZ maxlinewidthrN)rr-rRr=rrSrVr7r setdefaultrYrrrUrrZ dagtextlinesrX) rZr[file_r1rr(r)r3rnlinerb)r4rr7r1r2r7rcdebugdags6     r= debugdatas-c|-m|FILE REVcKst|}|ds(|ds(|drL|dur@tdtdd|}}n|durdtdtdt|d||}z|| | |Wn$t yt td|Yn0dS)z)dump the contents of a data file revisionrrdirNr>invalid argumentsinvalid revision identifier %s) r(rrr CommandErrorrr openstoragerXZrawdatarTKeyErrorrU)rZr[r:rYrr`rbrbrc debugdatas   rEs debugdateesextendedstry extended date formatss[-e] DATE [RANGE])rrKcKsl|drt|tj}n t|}|d||dt||rht|}|d||ddS)zparse and display a dateZextendedsinternal: %d %d s standard: %s s match: %s rN)rC parsedateZextendeddateformatsrZdatestrZ matchdate)rZrrangerdrrbrbrc debugdates   rJdebugdeltachains -c|-m|FILEc  sLt|}t|d||jj}j}jtdd}fdd}| d|}| d|rr| d| di} D]} || \} } } }}|d }| |t | d }||}|| }|| |}||}z |d }Wnt yd }Yn0| d krt|t| }n|}|d kr.revinfoss rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratios) readsize largestblk rddensity srchunksrrrr{slrev chainid chainlen prevrev deltatype compsize uncompsize chainsize chainratio lindist extradist extraratios7%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f) rYchainidchainlenprevrevrPrMrNrO chainratioZlindist extradist extraratios*readsize largestblock readdensity srchunkss %10d %10d %9.5f %8d)readsize largestblock readdensitysrchunksN)r(rr openrevlogr]startlengthZ _generaldeltar rrr9rQ IndexErrorfloatrrX deltautilZ slicechunkr) rZr[r:rr`raZwithsparsereadrSr chainbasesrYcompZuncomprPrQrO chainbaserUZ basestartZrevstartZ lineardistrYrWrXrZr[r\r^Z revschunkZblkendZblksizer]rbrRrcdebugdeltachains)              rhsdebugdirstate|debugstatesnodatess+do not display the saved mtime (DEPRECATED)sdatessdisplay the saved mtimesdatesortssort by saved mtimesdockets*display the docket (metadata file) insteads9display dirstate-v2 tree nodes that would not exist in v1s [OPTION]...c Ks|dr|jjs ttd|jjj}tj j |j \}}}}}} } | td|j| td|j| td|| td|| td|| td|| td || td t| d S|d  } |d d urd} |d} | rdd} nd } t|jjj|dd}|j| d|D]}|\}}}}}|dkrld}n(| rxd}ntdt|}t|}|d@rd}nd|d@tj@}| d|||||fqJ|jD]$}| td|j||fqd S)z)show the contents of the current dirstatedockets"dirstate v1 does not have a docketssize of dirstate data: %d sdata file uuid: %s sstart offset of root nodes: %d snumber of root nodes: %d snodes with entries: %d snodes with copies: %d snumber of unused bytes: %d signore pattern hash: %s NZdatesnodatesTdatesortcSs|\}}}}}||fSrrb)entryfilename_state_mode_sizemtimerbrbrckeyfuncszdebugstate..keyfuncr)rrr{sunset sset z%Y-%m-%d %H:%M:%S i slnks%3ois%c %s %10d %s%s scopy: %s -> %s )rrZ_use_dirstate_v2rrUr_maprirZv2Z TREE_METADATAunpackZ tree_metadatarX data_sizeZuuidbinasciiZhexlifyr/Z debug_itersortrfstrftime localtimer strtolocalr<umaskrZcopied)rZr[rriZ start_offsetZ root_nodesZnodes_with_entryZnodes_with_copyZ unused_bytesZ_unusedZignore_patternrjrkrrentriesrlrmstatemodesizerqZtimestrrjrbrbrc debugstates^         rdebugdiscoveryoldsuse old-style discoverynonheadss/use old-style discovery with non-heads includedrevs&restrict discovery to this set of revs)rvseeds12323s)specify the random seed use for discovery)rvs local-as-revsrvs+treat local has having these revisions only)rvsremote-as-revsrvs4use local as remote, with only these these revisionss[--rev REV] [OTHER]r|c$ slt}d}d}ttd|sttd|\}}t |} t dt |nNdgf}t |d|gtfdd } | tjd < }|jd |_|rt |d|gtfd d } | tjd <d idr*|ffdd } n|ffdd } tj||dd\} } d}d}|jrtjfdd}ntj}|Jtd}| || \}}Wdn1s0YWdn1s0Yt|}t|}t}||@}||@}||@|@}d}d|}d|}d|}d|}d|}t |t |t |ksJd||}d|} d|}!||@}"||@}#|j!d<t |d<t |d <t |d!<t |d"<t |d#<t |d$<t |t |d%<t |d&<t |t |d'<t |d(<t |d)<t |d*<t |d+<t |d,<t |d-<t | d.<t |!d/<t |"d0<t |#d1<|"|j#fit$|%d2|%d3|%d4|%d5|%d6|%d7|%d8|%d9|%d:|%d;|%d<|%d=|%d>|%d?|%d@|%dA|%dB|%dC|%dD|%dE|%dF|%dG|%dH|%dI|%dJj&r`|%dKdL't(dMdN|D|)dS)Oaruns the changeset discovery protocol in isolation The local peer can be "replaced" by a subset of the local repository by using the `--local-as-revs` flag. Int he same way, usual `remote` peer can be "replaced" by a subset of the local repository using the `--local-as-revs` flag. This is useful to efficiently debug pathological discovery situation. The following developer oriented config are relevant for people playing with this command: * devel.discovery.exchange-heads=True If False, the discovery will not start with remote head fetching and local head querying. * devel.discovery.grow-sample=True If False, the sample size used in set discovery will not be increased through the process * devel.discovery.grow-sample.dynamic=True When discovery.grow-sample.dynamic is True, the default, the sample size is adapted to the shape of the undecided set (it is set to the max of: , len(roots(undecided)), len(heads(undecided) * devel.discovery.grow-sample.rate=1.05 the rate at which the sample grow * devel.discovery.randomize=True If andom sampling during discovery are deterministic. It is meant for integration tests. * devel.discovery.sample-size=200 Control the initial size of the discovery sample * devel.discovery.sample-size.initial=100 Control the initial size of the discovery for initial change s local_as_revssremote_as_revsrrscomparing with %s Ns not (::(%s))csSrrbr~)remote_filtered_revsrbrc remote_func]sz#debugdiscovery..remote_funcsdebug-discovery-remote-filtercsSrrbr)local_filtered_revsrbrc local_funcksz"debugdiscovery..local_funcsdebug-discovery-local-filterrcst|dst|}tj|dd\}}}t|}ds dd t dd|Dj j d |}fd d |D}||fS) Nr&T)forcerNrsunpruned common: %s rcss|]}t|VqdSrrrwr;rbrbrcrrvz/debugdiscovery..doit..s heads(::%ln)csh|] }|qSrbrbr+Zclnoderbrcr,rvz/debugdiscovery..doit..)r< safehasattrrZlocallegacypeerrr9ZfindcommonincomingsetrrrirrVrr1) pushedrevs remoteheadsremotecommonZ_inhds)r}rr[rZrrcdoitts     zdebugdiscovery..doitcsHd}|r&t|}fdd|D}tj||d\}}}||fS)Ncsg|]}|qSrbrr+r[rbrcryrvz0debugdiscovery..doit..)Z ancestorsofrN)rrevranger1Zfindcommonheads)rrrnodesr1ranyr)r}r[rZrbrcrs  )r1rc3sdVd<dS)Noutput)Z pushbufferZ popbufferrb)r}rZrbrcmay_capture_outputsz*debugdiscovery..may_capture_outputzdebug-discoverysall()s::%lns roots(::%ld)s not ::%lds heads(%ld)s roots(%ld)snot (::%ln or %ln::)selapsedsnb-common-headssnb-common-heads-localsnb-common-heads-remotesnb-common-heads-bothsnb-common-rootss nb-head-localsnb-head-local-missingsnb-head-remotesnb-head-remote-unknownsnb-revssnb-revs-commonsnb-revs-missingsnb-missing-headssnb-missing-rootss nb-ini_undsnb-ini_und-headssnb-ini_und-rootssnb-ini_und-commonsnb-ini_und-missings#elapsed time: %(elapsed)f seconds s-round-trips: %(total-roundtrips)9d sheads summary: s, total common heads: %(nb-common-heads)9d s2 also local heads: %(nb-common-heads-local)9d s3 also remote heads: %(nb-common-heads-remote)9d s1 both: %(nb-common-heads-both)9d s* local heads: %(nb-head-local)9d s2 common: %(nb-common-heads-local)9d s2 missing: %(nb-head-local-missing)9d s+ remote heads: %(nb-head-remote)9d s3 common: %(nb-common-heads-remote)9d s3 unknown: %(nb-head-remote-unknown)9d s$local changesets: %(nb-revs)9d s+ common: %(nb-revs-common)9d s, heads: %(nb-common-heads)9d s, roots: %(nb-common-roots)9d s, missing: %(nb-revs-missing)9d s- heads: %(nb-missing-heads)9d s- roots: %(nb-missing-roots)9d s' first undecided set: %(nb-ini_und)9d s- heads: %(nb-ini_und-heads)9d s- roots: %(nb-ini_und-roots)9d s. common: %(nb-ini_und-common)9d s/ missing: %(nb-ini_und-missing)9d scommon heads: %s rcss|]}t|VqdSrrrrbrbrcrrvz!debugdiscovery..)*r(r unfilteredrandomZseedr*rFget_unique_pull_pathrrrrZ hidepasswordrr frozensetr+Z filtertableZ_repoZfilteredr addbranchrevsrZ strict_format contextlibcontextmanagerr<nullcontextmanagerZtimedcmrheadsr1rQelapsedrr} strkwargsrverboserirr)$rZr[Z remoteurlrunfiZ local_revsZ remote_revsr4rrrrZ remoterevsZ _checkoutZ localrevsrrtrrZ heads_commonZ heads_remoteZ heads_localZheads_common_localZheads_common_remoteZheads_common_bothrZ roots_commonmissingZ heads_missingZ roots_missingZinitial_undecidedZheads_initial_undecidedZroots_initial_undecidedZcommon_initial_undecidedZmissing_initial_undecidedrb)r}rrrr[rZrcdebugdiscoverysI            N                              ris debugdownloadrspathcKsjt|||}|}|r"t|dt}z4|t}|rH|||t}q.W|rf|n|rd|0dS)z4download a resource using Mercurial logic and configreN)urlmodr _chunksizerrXr)rZr[r;outputrfhdestr}rbrbrc debugdownloads     rdebugextensionsc Kst|}t|}t}|d|}t|tddD]v\}}t |}d} t |drlt |j } nt tddr~tj} |rg} nt |dd } t |d d} ||js|jr|d d |nR|d d ||s|| vr|dn,| s|tdn| d} |d| ||jo(| dtd| p8d |jr^|tdddg||j|d||jox| dtd|j| dd||jo| dtd| pd q:|dS)z(show information about active extensionsrrrN__file__oxidizedFZ testedwithrvZbuglinknamerrrs (untested!) r{s (%s!) ssources location: %s s bundled: %s noyes)Zbundleds testedwiths tested with: %s sverrsbuglinks bug reporting: %s )r(rrr<rrroperator itemgetterZismoduleinternalrfsencoderr sys sysexecutablerrrrrXrr condwriter} formatlistr) rZr[rZextshgverrZextnameZextmodZ isinternalZ extsourceZ exttestedwithZ extbuglinkZlasttestedversionrbrbrcdebugextensionss^               rs debugfilesetrs#apply the filespec on this revisions all-filess3test files from all revisions and working directorys show-matchers(print internal representation of matcherps show-stages$print parsed tree at the given stagesNAMEs+[-r REV] [--all-files] [OPTION]... FILESPECcKsDddlm}|jt|}t||dd}dtjfdt j fdt j fg}dd |D}t }|j rx|d sx|d|d d gkr||n6|d D]} | |vrttd | q||d t |} |D]L\} } | | } | |vr|d s| dkr|d | |t | dqt } |drb|D](} || }| || |jq8|dsz|dur|d}| |jjt|t|jddd| |jn| || |j|||}|ds|ddur|j r| dt!"|dt#| D]"} || s.q|d| qdS)z'parse and apply a fileset specificationr)filesetrNparsedanalyzed optimizedcSsh|] \}}|qSrbrbrwr;rjrbrbrcr,rvzdebugfileset.. show_stagerinvalid stage name: %s* %s: rs all_filesT)Zsubreposunknownignoreds show_matcher * matcher: r)$rZsymbolsr(rrrridentityranalyzeoptimizerraddrrrUrparserX prettyformatrsubstaterYrwalkr0Zmatchallr/Z matchfilesetrSrrE prettyreprr)rZr[exprrrrstages stagenames showalwaysr;treerjrr`rZwctxrrbrbrc debugfilesetUsf"            rsdebug-repair-issue6528s to-reports1build a report of affected revisions to this files from-reports+repair revisions listed in this report filesparanoids3check that both detection methods do the same thingcKsrt|dddg|d}|d}|d}|d}tj|jvrXd}tt|tj ||||||ddS)afind affected revisions and repair them. See issue6528 for more details. The `--to-report` and `--from-report` flags allow you to cache and reuse the computation of affected revisions for a given repository across clones. The report format is line-based (with empty lines ignored): ``` ,... ``` There can be multiple broken revisions per filelog, they are separated by a comma with no spaces. The only space is between the revision(s) and the filename. Note that this does *not* mean that this repairs future affected revisions, that needs a separate fix at the exchange level that was introduced in Mercurial 5.9.1. There is a `--paranoid` flag to test that the fast implementation is correct by checking it against the slow implementation. Since this matter is quite urgent and testing every edge-case is probably quite costly, we use this method to test on large repositories as a fuzzing method of sorts. to_report from_reportdry_runparanoids9can only repair revlogv1 repositories, v2 is not affected)rrrrN) rZcheck_incompatible_argumentsrr,ZREVLOGV1_REQUIREMENTrrUrrIZrepair_issue6528)rZr[rrrrrrrbrbrcdebug_repair_issue6528s$2      r debugformatc  st|}tddtjDttdfdd}|d|}|rVdd}ntj}| d| d td| d |j r| d | d tjD]}| | |}| |}||krd } d} n||jkrd} d} nd} d} |jd||j|j| d|jdd||| d|j|kr6d} nd} |j|j dd||| d|j|j dd||jdd| d q|dS)zdisplay format information about the current repository Use --verbose to get extra information about current config value and Mercurial default.css|]}t|jVqdSr)rQr)rwfvrbrbrcrrvzdebugformat..sformat-variantcsddt|S)Ns%s:rrrZmaxvariantlengthrbrcmakeformatname sz#debugformat..makeformatnamercSs t|dr|S|rdSdSdS)Ns startswithrr)r<rvaluerbrbrc formatvalues  z debugformat..formatvaluers repos config defaultrs!formatvariant.name.mismatchconfigs!formatvariant.repo.mismatchconfigs"formatvariant.name.mismatchdefaults"formatvariant.repo.mismatchdefaultsformatvariant.name.uptodatesformatvariant.repo.uptodaterrsrepos %3ssformatvariant.config.specialsformatvariant.config.defaultsconfigs %6sr|s %7ssformatvariant.defaultN)r(rr!r:ZallformatvariantrQrZisplainrrrrZfromrepoZ fromconfigdefaultrXrrr) rZr[rrrrrZ repovalueZ configvalueZ namelabelZ repolabelZ configlabelrbrrc debugformats^              rs debugfsinfos[PATH].cCs|d||dt|p d|dt|r:dp.rcSsg|] }t|qSrbrrrbrbrcry~rvrNZ bundlecapsdebugrrsHG10UNsHG10BZsHG10GZsHG20)snonersgzipsbundle2s)unknown bundle type specified with --type)r)r(rrrcapablerrUZ getbundlerlowerr Z bundletypesrZ writebundle) rZrepopathrrrrr[r\ZbundleZ bundletypeZbtypesrbrbrcdebuggetbundle`s*     rs debugignores[FILE]cOs0|jj}|s$|dt|ntj|d|d}tj|dd}|D]}t |}d} d} |dkr||r|} |j |} n,t |D] } || r| } |j | } qq| r| |kr|td||n|td||| f| \} } }|td | | |fqL|td ||qLdS) adisplay the combined ignore pattern and information about ignored files With no argument display the combined ignore pattern. Given space separated file names, shows if the given file is ignored and if so, show the ignore rule (file and line number) that matched it. rN)patsT)Zlegacyrelativevaluers%s is ignored s1%s is ignored because of containing directory %s s#(ignore rule in %s, line %d: '%s') s%s is not ignored )r_ignorerXr(Zbytereprr0matchZ getuipathfnrr<normpathZ_ignorefileandliner$Zfinddirsr)rZr[rrignorerZuipathfnrjZnfrZ ignoredatarZ ignorefilelinenor<rbrbrc debugignoresF      r debugindexc Kst|}t|d||}|jr&t}nt}d}|D]}t|||}qNq2| d|}| dd |d |f|D]} || } | | } | |dd| |dd || |d d || |dd || d |d d|| d| dq||dS)z'dump index data for a storage primitiver  rev linkrev %s %s p2 nodeidrrs%6d slinkrevs%7d nodes%s rrrrrN)r(rrrC debugflagrrrQrrrljustrrrXlinkrevr) rZr[r:rstoreshortfnidlenrxrrYrrrbrbrc debugindexs4     r debugindexdotcKst|}t|d||}|d|D]^}||}||}|d||d|f|d|j kr(|d||d|fq(|ddS)z(dump an index DAG as a graphviz dot filers digraph G { s %d -> %d rrs} N) r(rrrCrrrrXrYnullid)rZr[r:rr`rxrpprbrbrc debugindexdots    rsdebugindexstatscCsb|j|jd|jj}t|ds2ttdt | D]\}}| d||fqBdS)z)show stats related to the changelog indexrsstatss+debugindexstats only works with native codes%s: %d N) rVZshortestrr]r<rrrUrrZstatsrrX)rZr[r]rrrbrbrcdebugindexstatss  r debuginstallc" Kst|}d}|d|}||ddtjd}ztttjWn6t y}zt |}|d7}WYd}~n d}~00| |dd|d}t td rtjttj}nttd d rtj}|d td tjptd|dtdtt|dtddtjdd|dtd|p|j%d?d@|Dd8dd9dd#}t j=rJdA}|'tdB||j>t?t j=dCt@A}|dDdE|pdF| | dFtdG|rBt@BdH\}}|rd}zt@j@C|Wn4t6y}zt |}d}WYd}~n d}~00| |dId3|nd}| |dJtdK|| | dLtdMdN|sP|d7}| | dFtdO|D}t E|}tFG|d}|dPtdQ|tFH|}| | o|dRkdStdT| o|dRko|| | o|dRkdUtdV| o||s|dRkr|d7}d}d}z |I}Wn6tJjKy\}z|jL}|d7}WYd}~n d}~00| |dWtdX|| |dYtdZ|tMMD].\}} t| d[d}!|!dur||!||7}q| | dFtd\|s|j>|d]| |d^td_||N|S)`z;test Mercurial installation Returns 0 on success. rrsencodingschecking encoding (%s)... Nrs encodingerrors. %s (check that your locale is properly set) rrFs pythonexes checking Python executable (%s) sunknownspythonimplementations$checking Python implementation (%s) s pythonverschecking Python version (%s) s%d.%d.%drLs pythonlibschecking Python lib (%s)... )rustextssnispythonsecuritys&checking Python security support (%s) sprotocolr,)rfmtsepstls1.2sT TLS 1.2 not supported by Python install; network connections lack modern security sV SNI not supported by Python install; may have connectivity issues with some servers schecking Rust extensions (%s) missings installedshgvers checking Mercurial version (%s) +s hgverextras%checking Mercurial custom build (%s) shgmodulepolicyschecking module policy (%s) s hgmoduless#checking installed modules (%s)... )srust+cs rust+c-allow)csallow)base85bdiffmpatchosutil)rWrsextensionserrors %s s compenginess-checking registered compression engines (%s) css|]}|VqdSrrrrbrbrcrrvzdebuginstall..s compenginerscompenginesavails,checking available compression engines (%s) css|]}|r|VqdSr)Z availablerrrbrbrcrrvscompenginesservers>checking available compression engines for wire protocol (%s) cSsg|]}|r|qSrb)Zwireprotosupportrrrbrbrcryrvz debuginstall..s availables"checking "re2" regexp engine (%s) )re2s templatedirsschecking templates (%s)... rvs no template directories found smap-cmdline.defaultsdefaulttemplateerrorsdefaulttemplateschecking default template (%s) sdefaulttemplatenotfounds template '%s' not found r|s5 (templates seem to have been installed incorrectly) seditorschecking commit editor... (%s) svis vinotfoundsf No commit editor set and can't find %s in PATH (specify a commit editor in your configuration file) seditornotfoundsV Can't find editor '%s' in PATH (specify a commit editor in your configuration file) susernameschecking username (%s) s usernameerrorsJchecking username... %s (specify a username in your configuration file) debuginstallsno problems detected )problemssproblemss1%d problems detected, please check your install! )Or(rrrrXrcodecsrTsysstr LookupErrorrE forcebytestrrr<rosrdirnamerrr rrrZsysbytesplatformZpython_implementation version_inforr__doc__ ImportErrorrr4ZsupportedprotocolsZhassnirrrrrrrimodules__name__r&cextrrr r!rrWr Exception compenginesZ_enginesrrBZsupportedwireenginesZ SERVERROLEZ_re2r}boolr8Z templatedirZtry_open_templateZ frommapfileZ geteditorZ expandpathrDZ shellsplitZfindexeusernamerrUmessagerr)"rZrr$rrinstZ pythonlibrZsecurityrZ hgmodulesZrustandcr1Znopurerrr r!rWrr3Zwirecompenginesr"rrfpZeditorZ editorbinZcmdpathr5rrmodZhandlerrbrbrcr# s                                        r#s debugknowns REPO ID...cOsbt|}t|||}|ds,td|dd|D}|dd dd|DdS) ztest whether node ids are known to a repo Every ID must be a full-length hex node id string. Returns a list of 0s and 1s indicating unknown/known. sknowns*known() not supported by target repositorycSsg|] }t|qSrbrrrbrbrcryArvzdebugknown..rrvcSsg|]}|rdpdqS)10rbrwrjrbrbrcryBrvN) r(rrrrrrUZknownrXri)rZrZidsrr[rrbrbrc debugknown6s    r=sdebuglabelcompletesLABEL...cGst||g|RdS)zEbackwards compatibility with old bash completion scripts (DEPRECATED)N)debugnamecomplete)rZr[r\rbrbrcdebuglabelcompleteEsr?s debuglocksLsforce-free-locksfree the store lock (DANGEROUS)Wsforce-free-wlocks'free the working state lock (DANGEROUS)sset-locks set the store lock until stoppedSs set-wlocks(set the working state lock until stoppedc sN|dr|jd|dr,|jd|ds@|drDdSg}z|drz||dWn"tjytt dYn0|d rz|| dWn"tjytt d Yn0t |r t d Wt |dSWt |n t |0td}fd d }|||jd|j 7}|||jd|j7}|S)ashow or modify state of locks By default, this command will show which locks are held. This includes the user and process holding the lock, the amount of time the lock has been held, and the machine name where the process is running if it's not local. Locks protect the integrity of Mercurial's data, so should be treated with care. System crashes or other interruptions may cause locks to not be properly released, though Mercurial will usually detect and remove such stale locks automatically. However, detecting stale locks may not always be possible (for instance, on a shared filesystem). Removing locks may also be blocked by filesystem permissions. Setting a lock will prevent other commands from changing the data. The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs. The set locks are removed when the command exits. Returns 0 if no locks are held. Zforce_free_lockslockZforce_free_wlockswlockrZ set_wlockFswlock is already heldZset_lockslock is already helds&ready to release the lock (y)? $$ &Yesc sz |d}Wntjy$d}Yn0|r4|nz||}|tj}t|j}| |}d|vr| d\}} |t krd|pd| f}nd|pd| |f} d|d||fWdSty} z| jtjkrWYd} ~ n d} ~ 00 d|dd S) NF:suser %s, process %ssNonesuser %s, process %s, host %ss%-6s %s (%ds) rs %-6s free r)rLockHeldreleaselstatstatST_MTIMEr<r5st_uidZreadlockrsocketZ gethostnamerrerrnoENOENT) r=rmethodrstZagerZlockerhostpidrZnowrZrbrcreports6        zdebuglocks..report)rZsvfsZ tryunlinkr=rrrrDrUrrrQZ promptchoicerErf)rZr[rlocksZheldrRrbrQrc debuglocksKs<-      "rTsdebugmanifestfulltextcachesclearsclear the cachesadds)add the given manifest nodes to the cachesNODErbc sfdd}|drR$|}|jddWddS1sH0Y|rj}|d}|D]X}z|||} Wn8tjy} ztjt | dd WYd} ~ n d} ~ 00| qvWddS1s0Y|}t |s| t d n| t d t |fd } |D]D} || } t | }| |d 7} | t dt| t|fq2|jdj}| t dt| t|fdS)z@show, clear or amend the contents of the manifest fulltext cachecs>jd}z|jWSty8td}t|Yn0dS)NrvsOCurrent revlog implementation doesn't appear to have a manifest fulltext cache ) manifestlog getstorageZ_fulltextcacheAttributeErrorrrrU)r`rrrbrcgetcaches  z,debugmanifestfulltextcache..getcacherT)Zclear_persisted_dataNrvsCheck your manifest node idhints cache empty sFcache contains %d manifest entries, in order of most to least recent: rsid: %s, size %s smanifestfulltextcaches%total cache data size %s, on-disk %s )rrrrUrVrTrr'rUbytesrrQrXrpeekrr<Z bytecount_openerrGst_size)rZr[rrrXcacherr r;rr totalsizerr}rZondiskrbrrcdebugmanifestfulltextcachesV       "   rbdebugmergestatecOs|jr\t|}|}|}|s*|s*n2|s:|dn"|||rR|dn |dt|}|dsvd|d<tj |}| d|}| | d}| rd|jd fd |jd ffD]T\} } } | |j| d |jt| d |jrt|j| kr|j|j| dq|| d} | r~|D]B} | | j| d|j| }| j|d d|d tjtjfvr| j|d d| j|dd| j|dd| j|dd| j|dd| j|dd| j|ddn6|d tjtjfvr*| j|d d| j|dd | d!}t|| D]*\}}| |j|d"|j|d#qF|q8| | d!}tt|D]Z\} }| |vrqt|D]6\}}| |j| d$|j|d"|j|d#qq||d%S)&zpprint merge state Use --verbose to print out information about whether v1 or v2 merge state was chosen.sno version 2 merge state s!v1 and v2 states match: using v2 s$v1 and v2 states mismatch: using v1 templates{if(commits, "", "no merge state found ")}{commits % "{name}{if(label, " ({label})")}: {node} "}{files % "file: {path} (state \"{state}\") {if(local_path, " local path: {local_path} (hash {local_key}, flags \"{local_flags}\") ancestor path: {ancestor_path} (node {ancestor_node}) other path: {other_path} (node {other_node}) ")}{if(rename_side, " rename side: {rename_side} renamed path: {renamed_path} ")}{extras % " extra: {key} = {value} "}"}{extras % "extra: {file} ({key} = {value}) "}rcscommitsslocalrrLrrrrsfiles)r)r})Z local_keyrO)Z local_pathrL)Z ancestor_pathr)Z ancestor_noder5) other_pathr )Z other_node)Z local_flags)Z renamed_path)Z rename_sidesextrasrr)fileN)r mergestatemodr Z_readrecordsv1Z_readrecordsv2rZ _v1v2matchr(rrrrnestedZactiverrr}rZ_labelsrQrrnZMERGE_RECORD_UNRESOLVEDZMERGE_RECORD_RESOLVEDZMERGE_RECORD_UNRESOLVED_PATHZMERGE_RECORD_RESOLVED_PATHrextrasrrZ allextras)rZr[r\rmsZ v1recordsZ v2recordsrZ fm_commitsrrZ label_indexZfm_filesrjr}Z fm_extrasrrrIrbrbrcdebugmergestate s                         rlsdebugnamecompletesNAME...cst}t|jD] \}}|dkr|||q|dd|Dt}|s`dg}|D]|fdd|Dqd|d t ||ddS)z:complete "names" - tags, open branch names, bookmark namesr&css|]\}}}}|s|VqdSrrb)rwtagrZtipclosedrbrbrcr~ s z$debugnamecomplete..rvc3s|]}|r|VqdSr)rrrarbrcr rvrN) rr(rnamesrZ listnamesZ branchmapZ iterbranchesrXrir)rZr[r\rprnsZ completionsrbrorcr>t s  r>s debugnodemapsdump-news1write a (new) persistent binary nodemap on stdouts dump-disksdump on-disk data on stdoutschecks-check that the data on disk data are correct.smetadatas-display the on disk meta data for the nodemapc Ksz|drJ|}|j}t|jdr0|j}n t|j}||n,|dr|}|j}t |}|dur|\}}||ddn|dr|}|j}t |}|dur|\}}t ||j|Sn|drv|}|j}t |}|durv|\}}|d|j |d|j |d t |j|d |j|d |j|jd |j}|d |dS)z!write and inspect on disk nodemapZdump_newnodemap_data_allZ dump_diskNcheckr!suid: %s s tip-rev: %d s tip-node: %s sdata-length: %d sdata-unused: %d Y@sdata-unused: %2.3f%% )rrVr<rr]rrrHZpersistent_datarXZpersisted_dataZ check_datauidZtip_revrZtip_nodeZ data_lengthZ data_unused) rZr[rrrr}Znm_datariZ unused_percrbrbrc debugnodemap sD       rvrflagss markers flagsrecord-parentss+record parent information for the precursorsdisplay markers relevant to REV exclusives0restrict display to markers only relevant to REVindexsdisplay index of the markerdeletes#delete markers specified by indicess[OBSOLETED [REPLACEMENT ...]]c sTt|}fdd|drg}|dD]D}z|t|Wq.typtjtd|tddYq.0q. rt td 0t j|}|td|Wd n1s0Yd S|d urL|d rtd i}t|d p ||d <tfd d|D}  } z d} zz|d} | r^t| } nd } |} d }|dr| vrt d| }tdd|D}jj| | | |d|| ||d| Wn>ty}z$t tdt|WYd }~n d }~00W| n | 0W| n | 0n|d rt|d }fdd|D}t t!j"||dd}|j#dddn t!"}|}dd}|d r|drt!"}t$|fd d}|%d|}t&|D]D\}}||sq|'|dr0|nd }t(j)|||d!q|*d S)"zccreate arbitrary obsolete marker With no arguments, displays the list of obsolescence markers.csFz$t|}t|jjkr t|WSty@tdYn0dS)Ns>changeset references must be full hexadecimal node identifiers)rrQZ nodeconstantsZnodelen TypeErrorr InputError)rr;rrbrc parsenodeid s z"debugobsolete..parsenodeidrzsinvalid index value: %rsuse integers for indicesrYs6cannot delete obsmarkers in the middle of transaction.s deleted %i obsolescence markers Nrs+cannot select revision when creating markersuserc3s|]}|VqdSrrb)rwZsucc)r}rbrcr rvz debugobsolete..rsdatesrecord_parentss2cannot used --record-parents on unknown changesetscss|]}|VqdSrrrrbrbrcr) rvrw)rrr!rZsbad obsmarker input: %scsg|]}|qSrbrr+rrbrcry@ rvz!debugobsolete..rx)rZ exclusivecSs|jSr)_datarrbrbrcrF rvzdebugobsolete..rcSsdS)NTrbrrbrbrcrK rvrycs|vSrrbr) markersetrbrcrO rv)r])+r(rrrr* ValueErrorrr|rZcurrenttransactionrUrr*ZdeleteobsmarkersZobsstorerXrZ fromlocalr5tuplerrCrGrrZcreaterrEr(rErrr/r#Z getmarkersrwrr enumeraterrrr)rZr[Z precursorZ successorsrindicesrr;r!ZsuccsrtrrZprecrrr1rrZ markerstoiterZ isrelevantrrxrZindrb)rr}r[rc debugobsolete s      0             rs debugp1copiessrevision to debugs[-r REV]cKsLt|}tj||ddd}|D]\}}|d||fq,dS)z$dump copy information compared to p1rNr %s -> %s )r(rr0rrZp1copiesrrXrZr[rrdstsrcrbrbrc debugp1copiesb s rs debugp2copiescKsLt|}tj||ddd}|D]\}}|d||fq,dS)z$dump copy information compared to p2rNrr)r(rr0rrZp2copiesrrXrrbrbrcrp s sdebugpathcompletefsfullscomplete an entire pathsnormalsshow only normal filesrsshow only added filesrsshow only removed filess FILESPEC...c sfdd}d}dr"|d7}dr2|d7}drB|d 7}|sTd g}tt}}|D]*}|||ptd \} } || || qf|||d fd dt|D|d dS)a)complete part or all of a tracked path This command supports shells that offer path name completion. It currently completes only files already known to the dirstate. Completion extends only to the next path segment unless --full is specified, in which case entire paths are used.cs8j}tjtjt|}jtj }|jkrH| |sHggfStj |r\|d7}|t |d}tj dk}|r| tj d}t |}d}tt}} | j|j} } t|D]p\} } | |r| j|vr|r| dtj } |r| | q| tj |}|dkr&| | d|q| | q|| fS)N/Zfullr)rr)rrrirrSrootr(osseprisdirrQreplacerrrr}find)r acceptablerrZrootdirZfixpathsZspeclenZ fullpathsrdirsZadddirZaddfilerjrNr)rr[rbrccomplete s6     z#debugpathcomplete..completervZnormalsnmrrrrrsnmarrc3s|]}|VqdSr)pathtor)cwdr[rbrcr rvz$debugpathcomplete..N)rSrrrXrir) rZr[ZspecsrrrrrrrjrIrb)rrr[rcdebugpathcomplete~ s&   $rsdebugpathcopiess#hg debugpathcopies REV1 REV2 [FILE])Z inferrepoc Os\t||}t||}t|||}tt|||D]\} } |d| | fq<|sa: %s sb: %s sdepth(a): %d depth(b): %d s.delta: %d hdist: %d distance: %d relation: %s ) r0rr'ZctxpvecrXrZ_depthabsZ_hammingZ_vecZdistance) rZr[rar6cacbrZpbrelrbrbrc debugpvecg s0    rs&debugrebuilddirstate|debugrebuildstatesrevision to rebuild tosminimalsEonly rebuild files that are inconsistent with the working copy parentc  st||}|||jd}|drlt|}t}||}||} fdd| D} || B}| ||Wdn1s0YdS)arebuild the dirstate as it would look like for the given revision If no revision is specified the first current parent will be used. The dirstate will be set to the files of the given revision. The actual working directory content or existing dirstate information such as adds or removes is not considered. ``minimal`` will only rebuild the dirstate status for files that claim to be tracked but are not in the parent manifest, or that exist in the parent manifest but are not in the dirstate. It will not change adds, removes, or modified files that are in the working copy parent. One use of this command is to make the next :hg:`status` invocation check the actual file content. NZminimalcsh|]}|js|qSrb)Z get_entryrr<rrbrcr, rvz'debugrebuilddirstate..) r0rrrrrrrZrebuildr) rZr[rYrrZ changedfilesZ manifestfilesZ dirstatefilesZ manifestonlyZdsonlyZ dsnotaddedrbrrcdebugrebuilddirstate s!   rsdebugrebuildfncaches only-datas*only look for wrong .d files (much faster)cKs"t|}t|||ddS)zrebuild the fncache files only_dataN)r(rr*Zrebuildfncacherr rbrbrcdebugrebuildfncache s rs debugrenames[-r REV] [FILE]...c Ost|}t||d}t|||}||D]d}||}|| }| |} |r| t d| |dt |dfq4| t d| q4dS)zdump rename informationrs%s renamed from %s:%s rrs%s not renamed N)r(rr0rrrrZfilelogZrenamedZfilenoderrXrr) rZr[rrrrrrorrbrbrc debugrename s  &rsdebugrequires|debugrequirementscCs"t|jD]}|d|q dS)z#print the current repo requirementsrN)rr,rX)rZr[r`rbrbrcdebugrequirements sr debugrevlogddumpsdump index datacE sL t|}t|d||}|dr8t|}|dd}t}t|D]}| |} | dkrf|} | |} | |} | |\} } | |}||}|t| |8}||z|||}Wntyd}Yn0|d|| | |||||| || || || |||t|| fqLdS|j}|j}g}d}|tj@rb|d|tj@r|d }|d |sd g}d}d}d}d}d}d}td d }d}d}d}d}d}d} g}!g}"g}#gd}$gd}%gd}&tdd }'gd}(i})i}*dd}+t|}t|D]}| |\} } | |},|dkrZ|+| ||$| tkrl|d7}||}-|,tkr|!d|"|||#|-|-dkr|d7}|d7}n0|d7}|dd7<|+|-|%|+|-|'dn&|!|!|,d|"|,}.||}/|"|.|#|/|.|-|-dkrP|d7}|d7}n||r|+|-|&|d7}||}0||0d7<|+|-|'|0n|+|-|(|,|dkr|d7}|,| kr|d7}n|,| kr| d7} n:|,| kr|d7}n&|,| kr|d7}n|,tkr|d7}t|dr:| ||d}1n|j! ||d}1|1rdt"|1dd}2nd}2|2|)vrd|)|2<d|*|2<|)|2d7<|*|2|-7<q"|$|%|&|(fD]}-|-ddurd|-d<q||||}3||| }4|$d}5|$d|<|%d}6|dkr d|%d<n|%d|<|&d}7i}8|dkrV|&d|<|'D].}0|'|0d|8|0<|'|0d||0<qZ|(d}9|3dkr|(d|3<|6|7|9}:t#|!|};t$|!}|:r|5|:}>ddfdd}?dBfdd }@dd}A|%d||%d d!&||d"|@|:}B|?|:}C|%d#|C||%d$|B|A|||%d%|B|A||||%d#|C||%d&|B|A|||%d'|B|A||||%d(|B|A||||%d)|B|A|||t'|D]&}0|d*|0|B|A||0|q|%d+|B|A|3||%d,|C|:|%d)|B|A|6|7|:t'|D]&}0|d*|0|B|A|8|0|:q|%d+|B|A|9|:d-d.}D|d"|%d/|C|t'|)D],}2||D|2||B|A|)|2|q|%d0|C|:t'|)D],}2||D|2||B|A|*|2|:qB|d"|?t$|;|<|=|>}B|%d1|B|;|%d2|B|<|%d3|B|=|%d4|B|>|dkr|d"|%d5t(|$|%d6t(|%|%d7t(|&t'|'D]0}0|0dk r8 q&|%d8|0ft(|'|0 q&|%d9t(|(|3dk rH|d"|@|3}B|@|3d:}C|%d;|B|A||3|dk r|%d<|C|A|||%d=|C|A| ||%d>|C|A|4|| rH|%d?|B|A||3|%d@|B|A||3|%dA|B|A||3dS)Cz'show data and statistics about a revlogrrse# rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen rr{s:%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d %11d %5d %8d FsinlineTs generaldeltas(none)cSsdS)Nrrbrbrbrbrcr6 rvzdebugrevlog..NrrcSsgdS)NrrbrbrbrbrcrM rvcSsH|ddus||dkr ||d<||dkr4||d<|d|7<dS)NrrrOrb)rrrbrbrcaddsizeR s  zdebugrevlog..addsizers_getsegmentforrevsemptyNrOs%%%dd s%%%dd %s(%%5.2f%%%%) cstt|SrrQstr)r!) basedfmtstrrbrcdfmtstr szdebugrevlog..dfmtstrcstt|d|fS)Nrr)r!Zpadding) basepcfmtstrrbrcpcfmtstr szdebugrevlog..pcfmtstrcSs$|r|dt||fS|dfSdS)Ndrt)rc)rrzrbrbrcpcfmt szdebugrevlog..pcfmts format : %d s flags : %s rrsrevisions : s merges : s normal : s empty : s text : s delta : s snapshot : s lvl-%-3d : s deltas : srevision size : cSs@|dkrd|S|ttjvr0dt||fSdt|SdS)Nrs %s : s 0x%s (%s) : s 0x%s : )r(rstring ascii_lettersr) chunktyperbrbrc fmtchunktype s z!debugrevlog..fmtchunktypeschunks : schunks size : savg chain length : smax chain length : smax chain reach : scompression ratio : s4uncompressed data size (min/max/avg) : %d / %d / %d s4full revision size (min/max/avg) : %d / %d / %d s4inter-snapshot size (min/max/avg) : %d / %d / %d s5 level-%-3d (min/max/avg) : %d / %d / %d s4delta size (min/max/avg) : %d / %d / %d rsdeltas against prev : s where prev = p1 : s where prev = p2 : s other : sdeltas against p1 : sdeltas against p2 : sdeltas against other : )r))r(rrr_rrQrXrrZ deltaparentrgrVr0rawsizerrZeroDivisionErrorr`Z_format_versionZ _format_flagsr-ZFLAG_INLINE_DATArZFLAG_GENERALDELTAr defaultdictrraZ issnapshotZ snapshotdepthr<rZ_getsegmentforrevs_revlogr\sumr!rrirr)ErZr[r:rr`ZnumrevstsrrYZdbaseZcbaseZclenrrZrsrBformatrrZgdeltaZ nummergesZnumemptyZ numemptytextZ numemptydeltaZnumfullZnumsemiZ numsnapdepthZnumprevZnump1Znump2ZnumotherZ nump1prevZ nump2prevZ chainlengthsreZ chainspansZdatasizeZfullsizeZsemisizeZ snapsizedepthZ deltasizeZchunktypecountsZchunktypesizesrrrZbaseaddrZrevaddrdepthZsegmentrZ numdeltasZnumoprevZ totalrawsizeZ fulltotalZ semitotalZ snaptotalZ deltatotalraZ avgchainlenZ maxchainlenZ maxchainspanZ compratiorrrrZfmt2rrb)rrrc debugrevlog s<                                                                 rdebugrevlogindexformats revlog formatsFORMATs[-f FORMAT] -c|-m|FILEc Ksnt|}t|d||}|dd}|dvr@ttd||jrLt }nt }d}|D]}t || |}qtqX|dkr|j r|dd|d |fq|d d|d |fn8|d kr|j r|d d|n|d d||D]h}| |} |dkrz|| } Wn tyF|j|jg} Yn0|j r|d||||||||| || d|| d fn2|d||||| || d|| d fq|d kr||} |j r.|d|||||||||||| d| d || f q|d|||||||| d| d || fqdS)z#dump the contents of a revlog indexrrr)rrsunknown format %drs* rev offset length linkrev %s %s p2 rrrrs? rev flag offset length size link p1 p2 %s s- rev flag size link p1 p2 %s s% 6d % 9d % 7d % 7d %s %s %s s% 6d % 7d %s %s %s s+% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s s!% 6d %04x % 8d % 6d % 6d % 6d %s N)r(rrr_rrrUrr rrrQrrrr rjustrr2rrXr`rar r0rr) rZr[r:rr`rrrrxrrZprrbrbrcdebugrevlogindexF s            rs debugrevspecoptimizes/print parsed tree after optimizing (DEPRECATED)s show-revss(print list of result revisions (default)sshow-sets+print internal representation of result sets no-optimizeds"evaluate tree without optimizationsverify-optimizedsverify optimized resultsREVSPECc st|}ddddfdfddfdtjfdtjfd tjfg}|d r^|d d }|d r||d r|tt ddd|D}t }t }j r|ds| d| ddg|dr| d |dr|drtt d|ddgkr| |n:|dD]"}||vrtt d|q| |di} d } tj|t|d} |D]p\}} | | | |<} ||vs||vrb| | krb|ds|dkrd|t| d| } qb|d r.sexpandedcst|jSr)r/ expandaliasesrraliasesrZrbrcr rvs concatenatedrrs no_optimizedNr{sverify_optimizeds1cannot use --verify-optimized with --no-optimizedcSsh|] \}}|qSrbrbrrbrbrcr, rvzdebugrevspec..rrs'cannot use --optimize with --show-stagerrrTrrsshow_sets* analyzed set: s* optimized set: rs --- analyzed s diff.file_ars+++ optimized s diff.file_b)deleters-%d s diff.deleted)insertrs+%d s diff.insertedZequals %d rs* set: s show_revss%d )r(rrr/Z foldconcatrrrrUrrrrrrr.ZlookupfnrXrZ makematcherrrErr/difflibZSequenceMatcherZ get_opcodes)rZr[rrrrrZ showchangedr;Z treebystageZ printedtreerrjZarevsZbrevsZsmrmZaloZahiZbloZbhirfuncr1rbrrc debugrevspec s-                       r debugservesshstdios*run an SSH server bound to process handleslogiofds$file descriptor to log server I/O to logiofilesfile to log server I/O toc Kst|}|ds ttdd}|drB|drBttd|drztt|ddd}Wqty}z0|j t j krtt|dd d}WYd}~qd}~00n|drt |dd d}t j |||d }|dS) zrun a server with advanced settings This command is similar to :hg:`serve`. It exists partially as a workaround to the fact that ``hg serve --stdio`` must have specific arguments for security reasons. rs&only --sshstdio is currently supportedNrrs)cannot use both --logiofd and --logiofileabrwbsab)logfh)r(rrrUrr)fdopenr*rrKZESPIPEr r?Z sshserverZ serve_forever)rZr[rrrrrbrbrc debugserve>s"  .rsdebugsetparentss REV1 [REV2]cCsZt||}t||d}||||Wdn1sL0YdS)amanually set the parents of the current working directory (DANGEROUS) This command is not what you are looking for and should not be used. Using this command will most certainly results in slight corruption of the file level histories withing your repository. DO NOT USE THIS COMMAND. The command update the p1 and p2 field in the dirstate, and not touching anything else. This useful for writing repository conversion tools, but should be used with extreme care. For example, neither the working directory nor the dirstate is updated, so file status may be incorrect after running this command. Only used if you are one of the few people that deeply unstand both conversion tools and file level histories. If you are reading this help, you are not one of this people (most of them sailed west from Mithlond anyway. So one last time DO NOT USE THIS COMMAND. Returns 0 on success. snullN)r0rrrZ setparents)rZr[r^r_Znode1Znode2rbrbrcdebugsetparentsps rs debugsidedatac Ks(t|}|ds(|ds(|drL|dur@tdtdd|}}n|durdtdtdt|d||}t|d|}z| | |}Wn$t yt td|Yn0|r$t |}||d t||D]8\}}|d |t|f|jr|d t|qdS) zcdump the side data for a cl/manifest/file revision Use --verbose to dump the sidedata content.rrr?Nr>r@rrAs%d sidedata entries s entry-%04o size %d r)r(rrrrBrrrCr rJrTrDrUr/rrwrrQrrEr) rZr[r:rYrr`rJrrrbrbrc debugsidedatas*      rdebugssls[SOURCE]c Ksvtjsttd|s.|s*ttdd}td|||\}}t|}ddd}|j|vrz|j t |j pv||jf}Wqt yttdYq0nttd d d l m}tjttjtjd d } z| || d} |td|j |j| dd} | sN|td|| s>|tdn|tdn|tdW| n | 0d S)atest a secure connection to a server This builds the certificate chain for the server on Windows, installing the missing intermediates and trusted root via Windows Update if necessary. It does nothing on other platforms. If SOURCE is omitted, the 'default' path will be used. If a URL is given, that server is used. See :hg:`help urls` for more information. If the update succeeds, retry the original operation. Otherwise, the cause of the SSL error is likely another issue. s6certificate chain building is only possible on Windowss>there is no Mercurial repository here, and no server specifiedr|ri)shttpsssshsmalformed port number in URLs,only https and ssh connections are supportedr)win32N)Z ssl_versionZ cert_reqsZca_certsTs&checking the certificate chain for %s F)Zbuilds-certificate chain is incomplete, updating... sfailed. sdone. s$full certificate chain is available )r(Z iswindowsrrUrrFrr;schemerOr*portrrrsslZ wrap_socketrJZ PROTOCOL_TLSZ CERT_NONEZconnectZ getpeercertrZcheckcertificatechainr) rZr[sourcerr4r;Z defaultportZaddrrrZcertrrbrbrcdebugsslsT        rdebugbackupbundle)rvrecoverrvs7brings the specified changeset back into the repositorys%hg debugbackupbundle [--recover HASH]c stttjjtjdd}|jddddt dd<d d <t fd d } d }|rt|r|td|d Sn.|rtd}|j|ddn|tdd S|D]}tj|t} tjd||  dd\} } zt| Wn`tjyv} zDtd| }tdt| j} |j|| dWYd } ~ qWYd } ~ n d } ~ 00t|  d\} }| rfdd| D} |^z&t !|| dd \}}Wn&tjyYWd qYn0Wd n1s0Yz|s6W|q|r."#d}t|r|td|t$|| }t%&||| }t'|t(j)rt(j*||dd| dn|+dd| Wd Wd W|qWd n1s0YWd n1s"0Ynt,t-.d t-/tj0| }|d!|1d"|j2r|d#d1d$| fnd%d&<t 3|d'}||||4W|q|0qd S)(alists the changesets available in backup bundles Without any arguments, this command prints a list of the changesets in each backup bundle. --recover takes a changeset hash and unbundles the first bundle that contains that hash, which puts that changeset back in your repository. --verbose will print the entire commit message and the bundle path for that backup. s strip-backups/*.hgcSs tj|Sr)r)rgetmtimerrbrbrcrrvz#debugbackupbundle..T)rreverservsbundleNsforcecsdr|d}|D]`}dur2|kr2q|fdd|j|D}drdt|dkrdq|d7}|||qdS)Ns newest_firstrcsg|]}|jkrdqS)T)rrrrbrcrysz6debugbackupbundle..display..s no_mergesrOr)rrrVrrQshow)rchlist displayercountr;r)limitrr[rbrcdisplays   z"debugbackupbundle..displayrs%s already exists in the repo sgRecover changesets using: hg debugbackupbundle --recover Available backup changesets:sstatus.removedrsno backup changesets found rr)Zdefault_branchess" warning: unable to open bundle %ss (missing parent rev %s) rYrcsg|]}|qSrbr)rwrY)rrbrcryKrvz%debugbackupbundle..sunbundlesUnbundling %s sbundle:)rr;z%a %H:%M, %Y-%m-%ds %s 2r s8{label('status.modified', node|short)} {desc|firstline} rdF)5r/filterr)risfileglobr=rirwr(rrZgetlimitrr0Z isrevsymbolrrrrelpathrrSrFrrrrr'rrrrr Zgetremotechangesrrrlrrmrr rZ applybundlernrzrfrxryrr rZchangesetdisplayerr)rZr[rrZbackupsrZ recovernoderbackuprr4exrZr1ZcheckoutrZ cleanupfnrrjrpZ backupdaterrb)rrrr[rcdebugbackupbundles       " 6& H  r sdebugsubsrevision to checks[-r REV] [REV]cCs\t||d}t|jD]:\}}|d||d|d|d|dqdS)Nspath %s s source %s rs revision %s r)r0rrrrr)rZr[rYrrrrbrbrcdebugsubs rs debugshellcCs"ddl}||d}|j|ddS)zrun an interactive Python interpreter The local namespace is provided with a reference to the ui and the repo instance (if available). rN)rZr[)r)codeZinteract)rZr[rZimported_objectsrbrbrc debugshells rsdebugsuccessorssetssclosests#return closest successors sets onlys[REV]c Osi}t}t}t||D]}||}|d||tj|||d|dD]X} | r|d||| d| ddD]} |d||| q|d qPqdS) a}show set of successors for revision A successors set of changeset A is a consistent group of revisions that succeed A. It contains non-obsolete changesets only unless closests successors set is set. In most cases a changeset A has a single successors set containing a single successor (changeset A replaced by A'). A changeset that is made obsolete with no successors are called "pruned". Such changesets have no successors sets at all. A changeset that has been "split" will have a successors set containing more than one successor. A changeset that has been rewritten in multiple different ways is called "divergent". Such changesets have multiple successor sets (each of which may also be split, i.e. have multiple successors). Results are displayed as follows:: Here rev2 has two possible (i.e. divergent) successors sets. The first holds one element, whereas the second holds three (i.e. the changeset has been split). rclosest)rr`s rrNrr)r\rrrrXr#Zsuccessorssetsr) rZr[r1rr`Zctx2strZnode2strrYrZsuccssetrrbrbrcdebugsuccessorssetss &   rsdebugtagscachecCst|}|d}|D]h}||}|j|dd}|rZt|}||sl|d7}n|durhd}nd}|d|t||fqdS) z/display the contents of .hg/cache/hgtagsfnodes1s.hgtagsF)Zcomputemissings (unknown node)Nrsinvalids %d %s %s ) tagsmodZhgtagsfnodescacherrgrZgetfnoderZhasnoderX)rZr[r`Zflogr`rZtagsnodeZtagsnodedisplayrbrbrcdebugtagscaches    rs debugtemplatesapply template on changesetsDsdefinesdefine template keywords KEY=VALUEs&[-r REV]... [-D KEY=VALUE]... TEMPLATEc Ksd}|dr2|dur"ttdt||d}i}|dD]`}z6dd|ddD\}}|rj|d krnt|||<Wq>tyttd |Yq>0q>|jr| d } t |} | t | d t | | } | | kr|d t | d |durpt||} tj||| d} |jr^| \}}|ddt||ddt||| |nt|||}|jr|j\}}|ddt||ddt||D]"}|j||fit|q|dS)zparse and apply a template If -r/--rev is given, the template is processed as a log template and applied to the given changesets. Otherwise, it is processed as a generic template. Use --verbose to print the parsed tree. NrYrPZdefinecss|]}|VqdSrrrrbrbrcrrvz debugtemplate..rrrs malformed keyword definition: %ss templatealiasrs * expanded: )Z resourcess* keywords: %s rs* functions: %s )rZ RepoErrorrrrrrrUrrr8rrrrrrZtemplateresourcesZ maketemplaterZsymbolsuseddefaultrrirrXZ renderdefaultrrr(rr)rZr[Ztmplrr1ZpropsrIrrrrZnewtreeZtresrkwdsZfuncsrr`rbrbrc debugtemplatesR            rsdebuguigetpasssprompts prompt textsTEXTs [-p TEXT]cCs(||}|durd}|d|dS)zshow prompt to type passwordNs response: %s )ZgetpassrrZpromptr`rbrbrcdebuguigetpass+s rs debuguipromptcCs||}|d|dS)zshow plain promptrN)rrrrbrbrc debuguiprompt;s rsdebugupdatecachesc Osb|F||jtjdWdn1s60YWdn1sT0YdS)z'warm all known caches in the repository)ZcachesN)rrZ updatecachesr@Z CACHES_ALL)rZr[rrrbrbrcdebugupdatecachesIsrsdebugupgradereposextra optimization to performsrunsperforms an upgradesbackups&keep the old repository content aroundrs select the changelog for upgradersselect the manifest for upgradesfilelogssselect all filelogs for upgradecKs tj||f|t||d|S)a0upgrade a repository to use different features If no arguments are specified, the repository is evaluated for upgrade and a list of problems and potential optimizations is printed. With ``--run``, a repository upgrade is performed. Behavior of the upgrade can be influenced via additional arguments. More details will be provided by the command output when run without ``--run``. During the upgrade, the repository will be locked and no writes will be allowed. At the end of the upgrade, the repository may not be readable while new repository data is swapped in. This window will be as long as it takes to rename some directories inside the ``.hg`` directory. On most machines, this should complete almost instantaneously and the chances of a consumer being unable to access the repository should be low. By default, all revlogs will be upgraded. You can restrict this using flags such as `--manifest`: * `--manifest`: only optimize the manifest * `--no-manifest`: optimize all revlog but the manifest * `--changelog`: optimize the changelog only * `--no-changelog --no-manifest`: optimize filelogs only * `--filelogs`: optimize the filelogs only * `--no-changelog --no-manifest --no-filelogs`: skip all revlog optimizations )runrr )r:Z upgraderepor)rZr[rrr rrbrbrcdebugupgraderepoPs. rs debugwalks[OPTION]... [FILE]...c st|}td||}|jr6|dt|dtd |}|sPdSdd}| ddrvtj dkrvd d}d t d d |Dt fd d |Df}|D]<}||| |||rdpdf} |d| qdS)z&show how files match on given patternsNrrcSs|Srrbrrbrbrcrrvzdebugwalk..rsslashrcSs t|Sr)r<rrrbrbrcrrvsf %%-%ds %%-%ds %%scSsg|] }t|qSrbrrwrrbrbrcryrvzdebugwalk..csg|]}t|qSrb)rQrr rrbrcryrvsexactrvr)r(rr0rrrrErr/rZ configboolrr!rexactrXrstrip) rZr[rrrrrjrrr<rbrrc debugwalks*  r#sdebugwhyunstablec Csjt|t||D]P}d}|drBddd|dDd}|d|d||d|d fqd S) z$explain instabilities of a changesetrvsdivergentnodesrcss"|]}d||fVqdS)s%s (%s)N)rZphasestr)rwrrbrbrcrsz#debugwhyunstable..s %s: %s%s %s s instabilitysreasonr N)r#Z whyunstabler0rrrirX)rZr[rYrlZdnodesrbrbrcdebugwhyunstables  r$s debugwireargs))rvthreervr%)rvfourrvr&)rvfivervr'sREPO [OPTIONS]... [ONE [TWO]]c Ost|}t|||}ztjD]}||d=q i}t|D]\}}|r>|||<q>t|}|j|i|} |j|i|} | d| | | kr| d| W| n | 0dS)Nrr) r(rrrr remoteoptsrr debugwireargsrXrr) rZrZvalsrr[optr\rrZres1Zres2rbrbrcr)s     r)ccsd}g}d}|D]}|}|s"q|dr.q|dsT|rF||fV|}g}d}q|sfttdt|t|}||kr|r|d|7<q|||}q|r||fVdS)Nr#rsindented line outside of blockr{)r"rrrUrrQlstripr)rZ activeactionZ blocklinesZ lastindentr<rrbrbrc_parsewirelangblockss2     r-sdebugwireprotolocalsshs!start an SSH server for this repopeers(construct a specific version of the peer noreadstderrs%do not read from stderr of the remotesnologhandshakes,do not log I/O related to the peer handshakec* sn t|}|dr$|s$ttd|drN|ddvrNtjtdtdd|rh|drhttd|r~|td tt|j }d }d }d }d }d } |drt d |j d d g} t jtt j| t jt jt jdd}|j}|j}|j}|js |ddkrHtj||jddd}tj||jddd}tj||jddd}d} |d } |ddkr|tdtj|| ||||d | d} nH|ddkr|tdd } n&|tdtj|| ||||| d} n|rt|}|jdkrttd|\} }dd i}|jr8||d!dd"d#d$|j rLd|d%d&<|ddkrbd"|d'<t!j"||fi|} |ddkr|tdd } n2|drttd(|dnt#j||| d)} nttd*d }|D]P\}}|d+vrH|s ttd,d-$d.d/|D}t%&|}|||d0k r2|'q|d1krr|sfttd2|'q|(d3r2| sttd4|)d5d6d6}i} |D]l}|*)d5d6}t+|d6kr|d}d-}n|\}}|(d7rt%,|d8d }n t%&|}|| |<q|d ur4|-|| fq|.td9|d:| vrt/| d:d;d}| d:=| j0||fit1| \}}|.td<t%2||.td=t%2|Wd n1s0YnX| 3 }|4|| 5}Wd n1s0Y|.td>t%j6|dd?d@q|dAkr\|d urTttdBg}q|dCkr|.tdDt+|| d usJt7| 8|D]&\}}|.tdE|t%2|fqd }q|(dFr| sttdG|)d5d?} t+| dHkrttdI| d6d \}!i}"d }#g}$|D]}|*}t9:dJ|}%|%rzt;|%?|t+dMd }&|$-|&nttdN|q0||!} |$r*d-$dOd/|$D}#t!j@At;| |#|"}'fdPdQ|'_Bz| /|'}|=}#WnJtjCjDy}z,tE|dRdSdQWYd }~qWYd }~n d }~00|jFGdT}(|(dUk r2|tdVt%j6tHI|#dd?d@q|dWkr| d usJ| Jq|dXkrP|r(|s6ttdY|J|=|=n|dZkrx|snttd[|Kn|d\kr|sttd]|Kn|(d^rtL|)d5d6d6})|sttd_|=|)nR|(d` r tL|)d5d6d6})| sttda|=|)nttdb|q|d u rNttdc| r\| J| rj|Md S)dasend wire protocol commands to a server This command can be used to issue wire protocol commands to remote peers and to debug the raw data being exchanged. ``--localssh`` will start an SSH server against the current repository and connect to that. By default, the connection will perform a handshake and establish an appropriate peer instance. ``--peer`` can be used to bypass the handshake protocol and construct a peer instance using the specified class type. Valid values are ``raw``, ``ssh1``. ``raw`` instances only allow sending raw data payloads and don't support higher-level command actions. ``--noreadstderr`` can be used to disable automatic reading from stderr of the peer (for SSH connections only). Disabling automatic reading of stderr is useful for making output more deterministic. Commands are issued via a mini language which is specified via stdin. The language consists of individual actions to perform. An action is defined by a block. A block is defined as a line with no leading space followed by 0 or more lines with leading space. Blocks are effectively a high-level command with additional metadata. Lines beginning with ``#`` are ignored. The following sections denote available actions. raw --- Send raw data to the server. The block payload contains the raw data to send as one atomic send operation. The data may not actually be delivered in a single system call: it depends on the abilities of the transport being used. Each line in the block is de-indented and concatenated. Then, that value is evaluated as a Python b'' literal. This allows the use of backslash escaping, etc. raw+ ---- Behaves like ``raw`` except flushes output afterwards. command ----------- Send a request to run a named command, whose name follows the ``command`` string. Arguments to the command are defined as lines in this block. The format of each line is `` ``. e.g.:: command listkeys namespace bookmarks If the value begins with ``eval:``, it will be interpreted as a Python literal expression. Otherwise values are interpreted as Python b'' literals. This allows sending complex types and encoding special byte sequences via backslash escaping. The following arguments have special meaning: ``PUSHFILE`` When defined, the *push* mechanism of the peer will be used instead of the static request-response mechanism and the content of the file specified in the value of this argument will be sent as the command payload. This can be used to submit a local bundle file to the remote. batchbegin ---------- Instruct the peer to begin a batched send. All ``command`` blocks are queued for execution until the next ``batchsubmit`` block. batchsubmit ----------- Submit previously queued ``command`` blocks as a batch request. This action MUST be paired with a ``batchbegin`` action. httprequest --------------------------- (HTTP peer only) Send an HTTP request to the peer. The HTTP request line follows the ``httprequest`` action. e.g. ``GET /foo``. Arguments of the form ``: `` are interpreted as HTTP request headers to add to the request. e.g. ``Accept: foo``. The following arguments are special: ``BODYFILE`` The content of the file defined as the value to this argument will be transferred verbatim as the HTTP request body. ``frame `` Send a unified protocol frame as part of the request body. All frames will be collected and sent as the body to the HTTP request. close ----- Close the connection to the server. flush ----- Flush data written to the server. readavailable ------------- Close the write end of the connection and read all available data from the server. If the connection to the server encompasses multiple pipes, we poll both pipes and read available data. readline -------- Read a line of output from the server. If there are multiple output pipes, reads only the main pipe. ereadline --------- Like ``readline``, but read from the stderr pipe, if available. read -------- ``read()`` N bytes from the server's main output pipe. eread --------- ``read()`` N bytes from the server's stderr pipe, if available. Specifying Unified Frame-Based Protocol Frames ---------------------------------------------- It is possible to emit a *Unified Frame-Based Protocol* by using special syntax. A frame is composed as a type, flags, and payload. These can be parsed from a string of the form: ``request-id`` and ``stream-id`` are integers defining the request and stream identifiers. ``type`` can be an integer value for the frame type or the string name of the type. The strings are defined in ``wireprotoframing.py``. e.g. ``command-name``. ``stream-flags`` and ``flags`` are a ``|`` delimited list of flag components. Each component (and there can be just one) can be an integer or a flag name for stream flags or frame flags, respectively. Values are resolved to integers and then bitwise OR'd together. ``payload`` represents the raw frame payload. If it begins with ``cbor:``, the following string is evaluated as Python code and the resulting object is fed into a CBOR encoder. Otherwise it is interpreted as a Python byte string literal. r.s --localssh requires a repositoryr/)rawssh1sinvalid value for --peers!valid values are "raw" and "ssh1"rYs/cannot specify --localssh with an explicit paths (waiting for commands on stdin) Ns-Rrs --sshstdior)stdinstdoutstderrbufsizer1iT)logdatartrFsssh://localserverr0r2s.creating ssh peer for wire protocol version 1 )autoreadstderrsusing raw connection to peer s)creating ssh peer from handshake results shttps*only http:// paths are currently supportedZ useragentsMercurial debugwireprotor'F)r8 logdataapis)Z loggingfhZ loggingname loggingoptsr;r:Z sendaccepts'--peer %s not supported with HTTP peers)openers$unsupported connection configuration)r1raw+s!cannot call raw/raw+ on this peerrvcss|]}|VqdSr)r,rrbrbrcrarvz!debugwireproto..r=sflushscannot call flush on this peerscommands6cannot send commands unless peer instance is availablerrseval:r5ssending %s command sPUSHFILErbs result: %s sremote output: %s rrO)Zbprefixrs batchbeginsnested batchbegin not alloweds batchsubmits#sending batch with %d sub-commands sresponse #%d: %s s httprequest s+cannot use httprequest without an HTTP peerrLsDinvalid httprequest: expected format is "httprequest s^([a-zA-Z0-9_-]+): (.*)$s BODYFILE srbsframe s#unknown argument to httprequest: %scss|]}t|VqdSr)r\r<rbrbrcrrvcs tSr)r(r&rbrMrbrcrrvz debugwireproto..rcSsdSrrbrbrbrbrcrrvz Content-Typezapplication/mercurial-cbors cbor> %s scloses readavailables(readavailable not available on this peersreadlines#readline not available on this peers ereadlines$ereadline not available on this peersread sread not available on this peerseread s eread not available on this peersunknown action: %ssunclosed "batchbegin" request)Nr(rrrUr interactiverXr/r-rrDZhgcmdr subprocessPopenZrapplyZ tonativestrPIPEr3r4r5rr<Zmakeloggingfileobjectr3Z sshv1peerZmakepeerrFr;rauthinforr rr<rrirEZ unescapestrflushrrr,rQZevalpythonliteralrrr Z _callpushrrrrrrrZ _submitbatchrerZstrurlgrouprr>ZmakeframefromhumanstringZurlreqrequestZ get_methodZurlerrZurlerrorr headersrrAZ decodeallrreadliner*kill)*rZr[rrZblocksprocr3r4r5r<r\r;r9rurDZ openerargsZbatchedcommandsrlinesr}commandr<fieldsrrrresrrrxchunkrHZhttppathrIbodyZframesrframeZreqZctrrbr?rcdebugwireprotosL                               & 0       *     $                 rU)NFFFF)Nr)r)r)N)NN)N)N)N)N)r|)N)r)NN)N)N)rb)N)N)N)N)N)N)N)N)rv)rv)FNT)N)Z __future__rrvr%rrrrKr rr)r+rrFrJrrGrrArrfZi18nrrrrrrr(r r rr r r rrrrrrrrrrrrrrrrrZlockmodrr rhr!r"r#r$r%r&r'r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7rr8r9r:r;rr<r=rRr>r?Z interfacesr@ZutilsrArBrCrDrErFZ revlogutilsrGrdrHrIrJrEtablerrOZ_tablerdrkrqrrrrrrrrrrr r r r#r=ZdebugrevlogoptsrErJZ formatteroptsrhrr(rrrrrZ dryrunoptsrrrrrrrrr#r=r?rTrbZ templateoptsrlr>rvZ commitopts2rrrZwalkoptsrrZ mergetooloptsrrrrrrrrrrrrrrZlogoptsr rrrrrrrrrr#r$r)r-rUrbrbrbrcs  7        # )      '      <  1 ? c > A 0 G   1 $  -   ] = l '   <  K$ !  `l!d $H   3  8 "  *