o ]Lb?@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 csettopicr,/usr/lib/python3/dist-packages/hgext/show.py _extrasetupBs zshowcmdfunc._extrasetupNN)__name__ __module__ __qualname____doc__ _docformatrrrrrr<srshowTtemplatesdisplay with templatesTEMPLATEsVIEW) helpcategoryNcCsp|r|std}tjtd|dtj}|sO|d|td|dt| D]\}}|dt |j q/|dtjtdtd d||vr`tjtd |td d|pcd}||}|d|j rd |j } || d |i} |||| WdS1swYdS|jrd |j} t|| |} tj||| dd} |||| S|||S)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)buffered)plainrrAbortshowview_tablepagerwritesorteditemsr sysbytesr!rr rlookuptemplater changesettemplater)uirepoviewtemplater(viewsrrfnrfmrefspec displayerrrrshowZsH        $   r@s bookmarks)rc sj}t|st|tjs|tddSfdd|D}j}t dd|D}t |}t | D].\}} | |j| d|dd ||d || || |j||k||d q8dS) z(bookmarks and their associated changesets(no bookmarks set) Ncsg|]}|qSr)rev).0noder7rr sz!showbookmarks..css|]}t|VqdSN)len)rBbrrr sz showbookmarks..ctxsbookmarks%snode)activelongestbookmarklennodelen) _bookmarksrG isinstancer jsonformatterr0rvalues_activebookmarkmaxlongestshortestr1r2 startitemcontexthexfuncdata) r6r7r<marksrevsrM longestnamerObmrCrrDr showbookmarkss$   r_sstack)rc s |d}|tkrttd|tjkr!|tddSt ||}d}|dur7|}|h}nt | d|}||}| tkrO| }d}|j} | |gD]"} || }|tjkrkn||t|dkr~d}nq\tt|dd }|rt | d ||} nt } t || B|hB} t|| } z td tjd}Wntjtjfyd}Ynwt||}tj|d | |d fdd}| ri| D]}| j|g|d}tt||<q||d}t| fdddd}t |D]i\}} || }|r|dn|d|!d|j"|| d|#||d|r=|dn|d|d|jtd| dd|rk|d |jd!||||fd"d|d#q|d$|jtd%d&d|r|d'|jtd(d&d|d)|D]7} || }| |krd*nd+}| r|dn|d||d|j"|| d|#||dq|r| r|d,n|d-|jtd.dd&d|!d|j"|| d|#||ddSdS)/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)}) resourcescs||dS)N)sctxrL) renderdefaulthexrJ) shortesttmplrrshortest!szshowstack..shortest)stoprevcs|SrFr)x) revdistancerr4szshowstack..)keyrbs: s so )rOr)s:/s /s (s%d commits aheadsstack.commitdistance)labels; shg rebase --source %s --dest %ssstack.rebasehints) s: : s (stack head) s stack.labels \ / s(multiple children) s | @os:/ s / s (stack base))$rArrr,rphaser publicr0r stackbasesetr\p1 changelog descendantsaddrGchildrenlistr1rVrfindcmdrtableAmbiguousCommandUnknownCommandr templateresources maketemplater ancestors enumerate writenoi18nr@flush)r6r7r?wdirctxbaserevbasectx stackrevsrKbranchpointattipclrAnewheadsallrevsrO haverebasetresrgheadr sourcectx sortedheadsisymbolr)rkrfr showstacks                             rs!_underway([commitage[, headage]])c Cst|dd}d|vrd|d<d|vrd|d<d}g}|dr0|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 stringr`) r getargsdictappendr getstringrr\basesetrAr) r7subsetrjargsrsrsargsmutablerelevantwdirrevrrrunderwayrevsets>     rsworkcCsN|d}t||}t||}|dddtj||||tjd|iddS)zchangesets that aren't finishedssort(_underway(), topo)s experimentals graphshortenTsnodelen)propsN)r\rVr dagwalker setconfigr displaygraph asciiedges)r6r7r?r\rOrevdagrrrshowworks    rcCst|ddD]1}tjD]+}d||f}tj|tjdd\}}||vr#q |d|dr+q |jd|d|dd q qdS) Nscommandssshow.aliasprefixs%s%sT)strictsaliassshow %sr#)source) configlistr-r.r findpossiblerr|configr)r6prefixr8rchoice allcommandsrrrextsetups   rcs(|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|VqdSrF)rGrshortesthexnodeidprefixrC)rBrrminlenr7rrrIs  z"longestshortest..)rvrU)r7r\rrrrrVs  rVc Csttttj}g}ttjD]}|dt | |tj|j fqt dt ddj t d|ft dd_ dS)Nz %s %ss %s %s r#rs )rUmaprGr-r.keysr1rr sysstrljust_origdoccmdtabler!rstripjoin)longestentriesrmrrr_updatedocstrings rr)r)%r! __future__rmercurial.i18nrmercurial.noder mercurialrrrrr r r r r rrrr testedwithrcommandrevsetpredicate_funcregistrarbaserr-CATEGORY_CHANGE_NAVIGATIONr@r_rrrrrVrrrrrs@   <  C   ?  8