a +b?@s6dZddlmZddlmZddlmZddlmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZdZiZeeZeZGdddejZeZed d d d d edfgedejdd)ddZedddddZedddddZedddZ edddd d!Z!d"d#Z"d*d%d&Z#d'd(Z$e$dS)+ajunified command to show various repository information (EXPERIMENTAL) This extension provides the :hg:`show` command, which provides a central command for displaying commonly-accessed repository data and views of that data. The following config options can influence operation. ``commands`` ------------ ``show.aliasprefix`` List of strings that will register aliases for views. e.g. ``s`` will effectively set config options ``alias.s = show `` for all views. i.e. `hg swork` would execute `hg show work`. Aliases that would conflict with existing registrations will not be performed. )absolute_import)_)nullrev) cmdutilcommandsdestutilerror formattergraphmod logcmdutilphasespycompat registrarrevset revsetlangscmutilsships-with-hg-corec@seZdZdZdZdddZdS) showcmdfuncz;Register a function to be invoked for an `hg show `.s%s -- %sNcCs||_||_dS)aCalled with decorator arguments to register a show view. ``name`` is the sub-command name. ``func`` is the function being decorated. ``fmtopic`` is the topic in the style that will be rendered for this view. ``csettopic`` is the topic in the style to be used for a changeset printer. If ``fmtopic`` is specified, the view function will receive a formatter instance. If ``csettopic`` is specified, the view function will receive a changeset printer. N)_fmtopic _csettopic)selfnamefuncfmtopic csettopicr0/usr/lib64/python3.9/site-packages/hgext/show.py _extrasetupBszshowcmdfunc._extrasetup)NN)__name__ __module__ __qualname____doc__Z _docformatrrrrrr<srshowTtemplatesdisplay with templatesTEMPLATEsVIEW)Z helpcategoryNcCsx|r&|s&td}tjtd|dtj}|s|d|td|dt| D]\}}|dt |j q^|dtjtdtd d||vrtjtd |td d|pd}||}|d|j r,d |j } || d |i} |||| WdS1s 0YnH|jrjd |j} t|| |} tj||| dd} |||| S|||SdS)ashow various repository information A requested view of repository data is displayed. If no view is requested, the list of available views is shown and the command aborts. .. note:: There are no backwards compatibility guarantees for the output of this command. Output may change in any future Mercurial release. Consumers wanting stable command output should specify a template via ``-T/--template``. List of available views: s2invoke with -T/--template to control output formats%must specify a template in plain mode)hintr!savailable views:  s%s sno view requesteds#use "hg show VIEW" to choose a viewsunknown view: %ss$run "hg show" to see available viewssshow%sr#NT)Zbuffered)ZplainrrAbortshowview_tableZpagerwritesorteditemsr Zsysbytesr rr rZlookuptemplater Zchangesettemplater)uirepoviewtemplater%Zviewsrrfnrfmrefspec displayerrrrshowZsF       .  r6s bookmarks)rc sj}t|s,t|tjs(|tddSfdd|D}j}t dd|D}t |}t | D]\\}} | |j| d|dd ||d || || |j||k||d qpdS) z(bookmarks and their associated changesets(no bookmarks set) Ncsg|]}|qSr)rev).0noder.rr r$z!showbookmarks..css|]}t|VqdSN)len)r8brrr r$z showbookmarks..ctxsbookmarks%snode)activeZlongestbookmarklennodelen)Z _bookmarksr= isinstancer Z jsonformatterr*rvaluesZ_activebookmarkmaxlongestshortestr+r,Z startitemcontextZhexfuncdata) r-r.r2ZmarksrevsrCZ longestnamerDZbmr9rr:r showbookmarkss"   rLsstack)rc s |d}|tkr"ttd|tjkrB|tddSt ||}d}|durn|}|h}nt | d|}||}| tkr| }d}|j} | |gD]D} || }|tjkrq||t|dkrd}qqtt|dd }|r,t | d ||} nt } t || B|hB} t|| } ztd tjd}Wn tjtjfyd}Yn0t||}tj|d | |d fdd}| ri| D]*}| j|g|d}tt||<q||d}t| fdddd}t |D]\}} || }|r8|dn |d|!d|j"|| d|#||d|r|dn |d|d|jtd| dd|r|d |jd!||||fd"d|d#q|d$|jtd%d&d|r2|d'|jtd(d&d|d)|D]n} || }| |krTd*nd+}| rj|dn |d||d|j"|| d|#||dq6|r| r|d,n |d-|jtd.dd&d|!d|j"|| d|#||ddS)/zcurrent line of work.s;stack view only available when there is a working directorysA(empty stack; working directory parent is a published changeset) Ns%d::.FT)reverses heads(%d::) - %ld - not public()srebases{shortest(node, %d)})Z resourcescs||dS)N)sctxrB)Z renderdefaulthexr@) shortesttmplrrshortest!szshowstack..shortest)Zstoprevcs|Sr<r)x) revdistancerr4r$zshowstack..)keyrOs: s so )rDr&s:/s /s (s%d commits aheadsstack.commitdistance)Zlabels; shg rebase --source %s --dest %ssstack.rebasehints) s: : s (stack head) s stack.labels \ / s(multiple children) s | @os:/ s / s (stack base))$r7rrr'rZphaser Zpublicr*rZ stackbasesetrKZp1 changelogZ descendantsaddr=Zchildrenlistr+rHrZfindcmdrtableZAmbiguousCommandZUnknownCommandr ZtemplateresourcesZ maketemplater ancestors enumerateZ writenoi18nr6flush)r-r.r5ZwdirctxZbaserevZbasectxZ stackrevsrAZbranchpointattipclr7ZnewheadsZallrevsrDZ haverebaseZtresrRheadr_Z sourcectxZ sortedheadsisymbolr)rUrQr showstacks                              rfs!_underway([commitage[, headage]])c Cst|dd}d|vrd|d<d|vr.d|d<d}g}|dr`|d7}|t|dtd|j|g|R}t|}||d|7}d }g}|dr|d7}|t|dtd ||j|g|R7}|d }|t kr|t|h7}||@S) Nsunderwayscommitage headages commitagesheadagesnot public() and not obsolete()s and date(%s)scommitage requires a strings parents(%ld)shead() and not closed()sheadage requires a stringrM) rZ getargsdictappendrZ getstringrrKZbasesetr7r) r.ZsubsetrTargsZrsZrsargsZmutableZrelevantZwdirrevrrrunderwayrevsets>     risworkcCsN|d}t||}t||}|dddtj||||tjd|iddS)zchangesets that aren't finishedssort(_underway(), topo)s experimentals graphshortenTsnodelen)ZpropsN)rKrHr Z dagwalker setconfigr Z displaygraphZ asciiedges)r-r.r5rKrDZrevdagrrrshowworks   rkcCst|ddD]b}tjD]V}d||f}tj|tjdd\}}||vrFq|d|drVq|jd|d|dd qq dS) Nscommandssshow.aliasprefixs%s%sT)strictsaliassshow %sr!)source) Z configlistr(r)rZ findpossiblerr^Zconfigrj)r-prefixr/rchoiceZ allcommandsrrrextsetups   rpcs(|sSjtfdd|DS)aReturn the length of the longest shortest node to identify revisions. The result of this function can be used with the ``shortest()`` template function to ensure that a value is unique and unambiguous for a given set of nodes. The number of revisions in the repo is taken into account to prevent a numeric node prefix from conflicting with an integer revision number. If we fail to do this, a value of e.g. ``10023`` could mean either revision 10023 or node ``10023abc...``. c3s&|]}tt|VqdSr<)r=rZshortesthexnodeidprefixr9)r8rrbminlenr.rrr?sz"longestshortest..)r[rG)r.rKrtrrsrrHs rHc Csttttj}g}ttjD]*}|dt | |tj|j fq&t dt ddj t d|ft dd_ dS)Nz %s %ss %s %s r!rs )rGmapr=r(r)keysr+rgr ZsysstrljustZ_origdoccmdtabler rstripjoin)ZlongestentriesrWrrr_updatedocstrings r|)NN)rq)%r Z __future__rZmercurial.i18nrZmercurial.noderZ mercurialrrrrr r r r r rrrrZ testedwithrxZcommandZrevsetpredicateZ_funcregistrarbaserr(ZCATEGORY_CHANGE_NAVIGATIONr6rLrfrirkrprHr|rrrrs>   <  C    ? 8