o ]Lb}@sdddlmZddlmZddlmZmZddlmZm Z m Z m Z mZm Z m Z mZmZmZmZmZddlmZmZejZejZejZejZejZejZddd Zd d Zd Zed eddddZ e de d<iZ!e"e!Z"e"ddhdddZ#e"dddhdddZ$e"ddhdddZ%e"d dhdd!d"Z&e"d#ddhdd$d%Z'e"d&dhdd'd(Z(e"d)ddhdd*d+Z)e"d,ddhdd-d.Z*e"d/dhdd0d1Z+e"d2dhdd3d4Z,e"d5d6dhdd7d8Z-e"d9d6hdd:d;Z.e"dZ/e"d?dhdd@dAZ0ddCdDZ1ddEdFZ2e"dGhdHddIdJZ3e"dKdLhddMdNZ4e"dOddLhddPdQZ5e"dRddLhddSdTZ6e"dUddLhddVdWZ7e"dXdhddYdZZ8e"d[hd\dd]d^Z9d_d`Z:dadbZ;dcddZe"dlhd\ddmdnZ?dodpZ@e"dqhd\ddrdsZAe"dthd\ddudvZBdwdxZCddheC_De"dyddhddzd{ZEe"d|hd}dd~dZFddZGe"dddhdddZHe"dddhdddZIe"ddhdddZJe"ddhdddZKe"dd6dhdddZLe"ddhdddZMe"ddhdddZNe"dddhdddZOe"ddhdddZPe"ddhdddZQe"dhddddZRe"dddhdddZSe"dddhdddZTe"ddhdddZUe"ddhdddZVe"ddhdddZWe"ddhdddZXe"ddhdddZYe"ddhdddZZe"dddhdddZ[e"ddhddd„Z\e"ddhdddńZ]e"ddhdddȄZ^e"ddhddd˄Z_e"dddhddd΄Z`e"dd6hdddфZae"ddhdddԄZbe"ddhdddׄZce"dd6hdddڄZde"dddhddd݄Zedd߄Zfe!gZhdS))absolute_import)_)hexwdirrev) diffutilencodingerrorhbisecti18nobsutilpatchpycompat registrarscmutil templateutilutil) stringutilurlutilNc s||d||d||d}d}|dur&|d|7}t|dntj||vr7dd d d gfi||<||}|g}|r|}|vrMqB|fd d D}|rrd d d d t |Df|<qBz?fdd  D}t |dkr|d d|ddkrt |\} } } nfdd} t || d\} } } n|d \} } } Wnt y|||dd DYqBw| | d| f|<|sD|S)z8return date, distance and name for the latest tag of revrepoctxcaches latesttagsN-rsnullcs0g|]}|r|dkr|r|qS)slocal)tagtype.0t)matchrepo6/usr/lib/python3/dist-packages/mercurial/templatekw.py Esz!getlatesttags..cSsg|]}|qSr!r!rr!r!r"r#Kscsg|]}|qSr!revrp latesttagsr!r"r#Nsrcsn|dd}dur#ddD}d||}t|d}n d|}t|}| |dgS)NrrcSg|]}|qSr!r$)rcr!r!r"r#Zz.getlatesttags..key.. only(%ld, %s)rs only(%d, %s))r%parentsrevslen)xtagprevschangeschangessincetag)ctxr r!r"keyVs  zgetlatesttags..key)r7css|]}|VqdSNr$r&r!r!r" jz getlatesttags..)resourcer stringmatcherralwaysr%poptagsdatesortedr.r0maxKeyErrorappendextend) contextmappingpatterncache cachenamer%todor?ptagspdatepdistptagr7r!)r6r)rr r" getlatesttags+sR     $   -rPcCs6tj}|d}ttdd|Dt|dS)z"Return a dict of log column labelssbookmark: %s branch: %s changeset: %s copies: %s date: %s extra: %s=%s files+: %s files-: %s files: %s instability: %s manifest: %s obsolete: %s parent: %s phase: %s summary: %s tag: %s user: %s cSsg|] }|dddqS):rr)split)rsr!r!r"r#z!getlogcolumns..T)ridentitydictzip splitlinesr r)rcolumnsr!r!r" getlogcolumnspsrZs{rev}:{node|formatnode} s{name} ({source})s {key}={value}s{key}={value|stringescape})parentmanifest file_copyenvvarextrar^sfilecopysauthorr)requirescC t||S)zAlias for ``{user}``)showuserrFrGr!r!r" showauthors resbisectrcCs(||d}||d}t||S)z'String. The changeset bisection status.rr)r;r labelnode)rFrGr r6r!r!r" showbisects  rhbranchcC||d}|S)zMString. The name of the branch on which the changeset was committed. r)r;branchrFrGr6r!r!r" showbranch rmbranchescCsB||d}|}|dkrt||d|gddSt||dgddS)zList of strings. The name of the branch on which the changeset was committed. Will be empty if the branch name was default. (DEPRECATED) rsdefaultriroplural)r;rk compatlist)rFrGr6rkr!r!r" showbranchess  rss bookmarkscsP||d}||d}|}|jfdd}t||d|}t|||tjS)z{List of strings. Any bookmarks associated with the changeset. Also sets 'active', the name of the active bookmark. rrcs |dS)N)bookmarksactivescurrentr!vactiver!r" zshowbookmarks..rt)r; bookmarks_activebookmark_showcompatlist_hybridrrU)rFrGr r6r{makemapfr!rwr" showbookmarkss   rchildrencCs0||d}dd|D}t||d|ddS)z/List of strings. The children of the changeset.rcSsg|] }d||fqS)s%d:%sr$)rcctxr!r!r"r#rTz showchildren..rschild)element)r;childrenrr)rFrGr6 childrevsr!r!r" showchildrens  rscurrentbookmarkcCrb)zUString. The active bookmark, if it is associated with the changeset. (DEPRECATED))showactivebookmarkrdr!r!r"showcurrentbookmarks rsactivebookmarkcCs6||d}||d}|j}|r||vr|SdS)zDString. The active bookmark, if it is associated with the changeset.rr)r;r|r{)rFrGr r6rxr!r!r"rs  rsdatecCs||d}tj|ddS)z.r_rrp)r;exportableenvironrsortdictrA compatdictrFrGrr!rr" showenvvarss rextrascsv||d}|tfddtDfddfddD}t||d|d d }t|fd dS) zRList of dicts with key, value entries of the 'extras' field of this changeset.rc3rr8r!rextrasr!r"r9'rzshowextras..cs||dS)N)skeysvaluer!rrr!r"ry(zshowextras..csg|]}|qSr!r!r)rr!r"r#)r,zshowextras..r`rrpcsd|t|fSNs%s=%s)r escapestrrrr!r"ry/s)r;extrarrrAr}r~)rFrGr6r+rr!)rrr" showextras!s   rs _fast_rankcCs(||d}|}|durdSd|S)zthe rank of a changeset if cached The rank of a revision is the size of the sub-graph it defines as a head. Equivalently, the rank of a revision `r` is the size of the set `ancestors(r)`, `r` included. rNs%d)r; fast_rank)rFrGr6rankr!r!r"r3s rFcCsZ||d}||d}d|vs|d|kr)|j||||d}||d<||d<|dS)Nrrevcaches filestatus filestatusall) listignored listclean listunknown)r;p1status)rFrGlistallr6revcachestatr!r!r"_getfilestatusBs  rcst||d}d|vs|d|kr6t|||d}i|d<}ttd|D]\}|fdd|Dq%|dS)Nrs filestatusmaprrsMAR!?ICc3s|]}|fVqdSr8r!)rrcharr!r"r9Tr:z$_getfilestatusmap..)r;rrWr iterbytestrupdate)rFrGrrrstatmapfilesr!rr"_getfilestatusmapNs  rs file_copies>rrrrcCst||d}||d}||d}||dd}|dur2d|vr*t||d<|d}||}t||d|S) zLList of strings. Files copied in this changeset with their sources. rrrrcopiesNs getcopiesr^)r;getr getcopiesfnrcompatfilecopiesdict)rFrGr r6rIcopies getcopiesr!r!r"showfilecopiesXs   rsfile_copies_switchrcCs&||ddp g}t||d|S)z^List of strings. Like "file_copies" but displayed only if the --copied switch is set. rrr^)r;rrr)rFrGrr!r!r"showfilecopiesswitchpsrs file_addscC ||d}t||d|S)z/List of strings. Files added by this changeset.rsfile_add)r;rcompatfileslist filesaddedrlr!r!r" showfileadds{  rs file_delscCr)z1List of strings. Files removed by this changeset.rsfile_del)r;rr filesremovedrlr!r!r" showfiledelsrrs file_modscCr)z2List of strings. Files modified by this changeset.rsfile_mod)r;rr filesmodifiedrlr!r!r" showfilemodsrrsfilescCr)zRList of strings. All files modified, added, or removed by this changeset. rsfile)r;rrrrlr!r!r" showfiless rs graphnode>rrrcCs0||d}||d}||d}t|||S)zUString. The character representing the changeset node in an ASCII revision graph.rrr)r; getgraphnode)rFrGr r6rIr!r!r" showgraphnodes    rcCst|||p t|Sr8)getgraphnodecurrentgetgraphnodesymbol)r r6rIr!r!r"rsrcCs|j}|d|jkr|dd}||vrdS|d}|dur@ddlm}|j|}|r:|j |j f}nd}||d<||vrHdSdS)Nr@s merge_nodes) mergestater!%r) dirstater.nullidrgrrreadunresolvedcountlocalother)r r6rIwpnodes merge_nodes mergestatemodrr!r!r"rs       rcCs(|rdS|r dS|rdSdS)Nx*_o)obsolete isunstable closesbranchr6r!r!r"rsrs graphwidthr!cCsdS)z?Integer. The width of the graph drawn by 'log --graph' or zero.rr!rdr!r!r"showgraphwidthsrsindexcCsttd)z7Integer. The current iteration of the loop. (0 indexed)scan't use index in this context)r Abortrrdr!r!r" showindexsr latesttagcC t||dS)zList of strings. The global tags on the most recent globally tagged ancestor of this changeset. If no such tags exist, the list consists of the single string "null". N)showlatesttagsrdr!r!r" showlatesttags rcsBt|||fdd}d}t||d|dd}t|||tjS)z4helper method for the latesttag keyword and functioncstd||dS)Nr)schangessdistancertag)_showchangessincetagrur(r!r"rys z showlatesttags..rrrQ) separator)rPr}r~rrU)rFrGrHrr?rr!r(r"rs  rslatesttagdistancecCst||dS)z(Integer. Longest path to the latest tag.r)rPrdr!r!r"showlatesttagdistancesrschangessincelatesttagcCs,t||dd}||d|i}t||S)z-Integer. All ancestors not in the latest tag.rrr)rP overlaymapr)rFrGr2r!r!r"showchangessincelatesttags rcCsj||d}||d}d}|g}||d}|dur*d}dd|D}t|d|||S) NrrrrrcSr*r!r$r&r!r!r"r#r,z(_showchangessincetag..r-)r;r%symbolr.r0r/)rFrGr r6offsetr/r2r!r!r"rs     rr]cs||d}||d}|}|dur|jj}t|jjn |j|t|| |d}| d|}t |d|fddS)Nrrrevnoder]cs dS)Nr r!r1mhexmrevr!r"ry)s zshowmanifest..) r; manifestnode nodeconstantswdiridrwdirhex manifestlogr%rrprocessr hybriditem)rFrGr r6mnoderr!r r" showmanifests     rsobsfate>rrrcCslt||}||d}||d}g}|||D]}t|||d|dtj}||qt||d|S)Nrr successorsmarkerssfate) showsuccsandmarkersr;tovaluer obsfateprinterrformatchangeidrDrr)rFrGsuccsandmarkersrr valuesr1rvr!r!r" showobsfate-s    r!cCsT||d}||d}|j|}|durdS|||}t|||j||dS)z.makensmapfn..r!r(r!r(r" makensmapfnZs z#shownamespaces..makensmapfnr' namespacecs"||j|jj|jdS)N)r*snamessbuiltins colorname)r"builtin colornamer( namespacesr r!r"res   zshownamespaces..makemap) r;rrr iteritemsr"rgr}r~rUlist) rFrGr6r)rr%r"rrr!r-r"shownamespacesQs  r1snegrevcCs@||d}|}|dus|dkrdS||d}|t|S)zmInteger. The repository-local changeset negative revision number, which counts in the opposite direction.rNrr)r;r%r0)rFrGr6r%r r!r!r" shownegrevps   r2r cCrj)zUString. The changeset identification hash, as a 40 hexadecimal digit string. r)r;rrlr!r!r"shownode|rnr3obsoletecCs||d}|r dSdS)z9String. Whether the changeset is obsolete. (EXPERIMENTAL)rr4r)r;rrlr!r!r" showobsoletes r5sonelinesummarycCs0ddlm}||d}||d}|||S)zString. A one-line summary for the ctx (not including trailing newline). The default template be overridden in command-templates.oneline-summary.r)cmdutilrr)rr6r;format_changeset_summary)rFrGr6rr6r!r!r"showonelinesummarys    r8pathfctxcCrj)zDString. Repository-absolute path of the current file. (EXPERIMENTAL)r:)r;pathrFrGfctxr!r!r"showpath r>speerurlscsZ||d}|jjt|j}tdd|Dfdd}fdd}td||S) zcA dictionary of repository locations defined in the [paths] section of your configuration file.rcss|] \}}||jfVqdSr8)rawloc)rrr'r!r!r"r9szshowpeerurls..cs|}d|i}t|dkr)|dj|d<t|dj}tt|}||t}|D]}ttt|j}|j|d<|||g|d<q/|S)Nr'rrsurlsurls) r0r@rr/ suboptionsrrrAr)rpsdsub_opts path_dictr')pathsr!r"rs     zshowpeerurls..makemapcsd||fSrr!r)urlsr!r" format_onesz showpeerurls..format_oneN)r;rrFr list_pathsrrr~)rFrGr all_pathsrrHr!)rFrGr" showpeerurlss    rKs predecessorscsV||d||d}tt|}tt|}td|fddfddS)zDReturns the list of the closest visible predecessors. (EXPERIMENTAL)rrNc d|iSNrr!r r r!r"ryrzz"showpredecessors..ct|Sr8rrr rNr!r"ryr) r;rAr closestpredecessorsrgrmaplistrr~)rFrGr6 predecessorsr!rNr"showpredecessorss     rTsreporootcCs||d}|jS)z5String. The root directory of the current repository.r)r;root)rFrGr r!r!r" showreporoots rVssizecCrj)z:Integer. Size of the current file in bytes. (EXPERIMENTAL)r:)r;sizer<r!r!r"showsizer?rXsstatus>rr:rcCsNt||d}t|||}|sdSt||}||vr"t||dd}||S)z7String. Status code of the current file. (EXPERIMENTAL)r9NTr)r runsymbol stringifyrr)rFrGr;rr!r!r" showstatuss  r[ssuccessorssetscsdd}g}|r..r!)rssr!r!r"r#sz&showsuccessorssets..NcrLrMr!r rNr!r"ryrzz$showsuccessorssets..crOr8rPr rNr!r"ryrcst|Sr8)rrZ)rCrdr!r"rendersz"showsuccessorssets..renderc3s dfdd|DVdS)Ns; c3s|]}|VqdSr8r!)rrCrbr!r"r9 r:z2showsuccessorssets..gen..)join)datarcr!r"genszshowsuccessorssets..gencSsd|iS)Ns successorsetr!r r!r!r"ry s) r;rr successorssetsrgr~rDrrU)rFrGr6ressetsrahrfr!)rFrGrbr r"showsuccessorssetss&      rjssuccsandmarkersc s||d||d}t|}|durg}g}|D]i}|d}dd|D}td|fddfd d}g}|d D]>}t|d } td d |dD} d} |ddurdtdd |dD} | | f|dd| f|dd} || q>|||dqt|S)zReturns a list of dict for each final successor of ctx. The dict contains successors node id in "successors" keys and the list of obs-markers from ctx to the set of successors in "markers". (EXPERIMENTAL) rrNrcSr]r!r^r_r!r!r"r#%r,z'showsuccsandmarkers..crLrMr!r rNr!r"ry)rzz%showsuccsandmarkers..crOr8rPr rNr!r"ry*rrrcs|]}t|VqdSr8r^r_r!r!r"r91r:z&showsuccsandmarkers..rcsrkr8r^r_r!r!r"r94r:r)rr) r;r successorsandmarkersr~rtuplerDr mappinglist) rFrGr6r rei successors finalmarkersmhexprechexsucs hexparents newmarkerr!rNr"rs4        &  rsp1cC"||d}tjd|itdS)zChangeset. The changeset's first parent. ``{p1.rev}`` for the revision number, and ``{p1.node}`` for the identification hash.rtmpl)r;r mappingdictr _changeidtmplrlr!r!r"showp1= r~sp2cCry)zChangeset. The changeset's second parent. ``{p2.rev}`` for the revision number, and ``{p2.node}`` for the identification hash.rrz)r;rr|p2r}rlr!r!r"showp2Errsp1revcC||d}|S)zInteger. The repository-local revision number of the changeset's first parent, or -1 if the changeset has no parents. (DEPRECATED)r)r;rr%rlr!r!r" showp1revM  rsp2revcCr)zInteger. The repository-local revision number of the changeset's second parent, or -1 if the changeset has no second parent. (DEPRECATED)r)r;rr%rlr!r!r" showp2revUrrsp1nodecCr)zString. The identification hash of the changeset's first parent, as a 40 digit hexadecimal string. If the changeset has no parents, all digits are 0. (DEPRECATED)r)r;rrrlr!r!r" showp1node]  rsp2nodecCr)zString. The identification hash of the changeset's second parent, as a 40 digit hexadecimal string. If the changeset has no second parent, all digits are 0. (DEPRECATED)r)r;rrrlr!r!r" showp2nodefrrsparentscsp||d||d}t|}dd|D}dd|D}t||d|}t||fddfd dtd S) zList of strings. The parents of the changeset in "rev:node" format. If the changeset has only one "natural" parent (the predecessor revision) nothing is shown.rrcSr*r!r$r&r!r!r"r#wr,zshowparents..cSs.g|]}d|fd|fd|fgqS)r r phase)r%rphasestrr&r!r!r"r#xs r\crLrMr!r rNr!r"ryrzzshowparents..crOr8rPr rNr!r"ryr)keytype)r;rmeaningfulparentsr}r~int)rFrGr6pctxsr3r.rr!rNr" showparentsos     rrcCrj)z!String. The changeset phase name.r)r;rrlr!r!r" showphaser?rsphaseidxcCrj)z.Integer. The changeset phase index. (ADVANCED)r)r;phaserlr!r!r" showphaseidxr?rr cCs||d}t|S)z8Integer. The repository-local changeset revision number.r)r;rintrevrlr!r!r"showrevs  rssubreposcCs||d}|j}|st||dgS|jpi}g}|D]}||vs+||||kr0||q|D] }||vr>||q3t||dt|S)z:List of strings. Updated subrepositories in the changeset.rssubrepo)r;substaterrrrDrA)rFrGr6r psubstatesubrepossubr!r!r" showsubreposs   rtagscCr)z8List of strings. Any tags associated with the changeset.r)r&rdr!r!r"showtagss rs termwidthcCrj)z+Integer. The width of the current terminal.r)r; termwidthrr!r!r" showtermwidthr?rsusercCrj)z/String. The unmodified author of the changeset.r)r;userrlr!r!r"rcr?rc instabilitiescCs"||d}t||d|ddS)zYList of strings. Evolution instabilities affecting the changeset. (EXPERIMENTAL) rs instabilityrrp)r;rr instabilitiesrlr!r!r"showinstabilitiess rs verbositycCs.||d}|jr dS|jrdS|jrdSdS)zOString. The current output verbosity in 'debug', 'quiet', 'verbose', or ''.rsdebugsquietsverboser)r; debugflagquietverboserr!r!r" showverbositys rs whyunstablecs||d||d}ddt|}|D]$}|dr<|d}tddd|Dfd d fd d }||d<qd }tj||d dS)zRList of dicts explaining all instabilities of a changeset. (EXPERIMENTAL) rrcSsdt||fS)Ns%s (%s))rrrrr!r!r" formatnodesz#showwhyunstable..formatnodesdivergentnodesNcSr*r!r^)rdnoder!r!r"r#r,z#showwhyunstable..crLrMr!r rNr!r"ryrzz!showwhyunstable..cs |Sr8r!r rr r!r"ryrzsM{instability}:{if(divergentnodes, " ")}{divergentnodes} {reason} {node|short} )r{sep)r;r whyunstablerr~rrp)rFrGr6entriesentrydnodesdnhybridr{r!rr"showwhyunstables$       rcCs"t|jD]\}}|t|<qdS)z1Load template keyword from specified registrarobjN)rr/_tablekeywords)rextname registrarobjnamefuncr!r!r" loadkeywords rr8)F)i __future__rr rrgrrrrrr r r r rrrrrutilsrrhybridr~ hybriddict hybridlistrrrr}rPrZr} defaulttemplrtemplatekeywordrerhrmrsrrrrrrrrrrrrrrrrrrrrrrrrrrrrr _requiresrr!r&r1r2r3r5r8r>rKrTrVrXr[rjrr~rrrrrrrrrrrrrcrrrrr  i18nfunctionsr!r!r!r"s0  8 E                                                             !  ,