
    6h?              
         S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJr  Sr0 r\R.                  " \5      r\R0                  " 5       r " S S\R2                  5      r\" 5       r\" S	S
SSS\" S5      4/\" S5      \R8                  S9S S j5       r\" SSS9S 5       r\" SSS9S 5       r\" S5      S 5       r \" SSS9S 5       r!S r"S!S jr#S r$\$" 5         g)"aj  unified 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<view> = show <view>`` for all
   views. i.e. `hg swork` would execute `hg show work`.

   Aliases that would conflict with existing registrations will not be
   performed.
    )annotations)_)nullrev)cmdutilcommandsdestutilerror	formattergraphmod
logcmdutilphasespycompat	registrarrevset
revsetlangscmutils   ships-with-hg-corec                  &    \ rS rSrSrSrSS jrSrg)showcmdfunc<   z;Register a function to be invoked for an `hg show <thing>`.s   %s -- %sNc                    X2l         XBl        g)a  Called 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)selfnamefuncfmtopic	csettopics        ,/usr/lib/python3/dist-packages/hgext/show.py_extrasetupshowcmdfunc._extrasetupB   s    "  #     NN)__name__
__module____qualname____firstlineno____doc__
_docformatr   __static_attributes__r"   r!   r   r   r   <   s    E J$r!   r      show   T   templater!   s   display with templates   TEMPLATEs   VIEW)helpcategoryNc                T   U R                  5       (       a0  U(       d)  [        S5      n[        R                  " [        S5      US9e[        R
                  nU(       d  U R                  S5        U R                  [        S5      5        U R                  S5        [        UR                  5       5       H7  u  pgU R                  S[        R                  " UR                  5      -  5        M9     U R                  S5        [        R                  " [        S5      [        S	5      S9eX%;  a*  [        R                  " [        S
5      U-  [        S5      S9eU=(       d    SnXR   nU R                  S5        UR                  (       a6  SUR                  -  n	U R                  U	SU05       n
U" XU
5      sSSS5        $ UR                  (       aE  SUR                  -  n[        R                   " XU5      n["        R$                  " XUSS9nU" XU5      $ U" X5      $ ! , (       d  f       g= f)a  show 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:
s2   invoke with -T/--template to control output formats%   must specify a template in plain mode)hintr+   s   available views:
   
s   %s
s   no view requesteds#   use "hg show VIEW" to choose a views   unknown view: %ss$   run "hg show" to see available viewss   show%sr-   NT)buffered)plainr   r	   Abortshowview_tablepagerwritesorteditemsr   sysbytesr(   r   r
   r   lookuptemplater   changesettemplater)uirepoviewtemplater0   viewsr   r   fnr   fmrefspec	displayers                 r   showrH   Z   s   > 
xxzz(FGkk67d
 	
 OOE
 	()*
 /JDHHWx00>>? 0 	kk"#9:
 	
 kk!"T):;
 	

 "7H	BHHW	{{bkk)\\'K#:;rb# <;	"--''':11"D4P	"I&&"| <;s   (	H
H's	   bookmarks)r   c                   UR                   n[        U5      (       d:  [        U[        R                  5      (       d  U R                  [        S5      5        gUR                  5        Vs/ s H  oAU   R                  5       PM     nnUR                  n[        S U 5       5      n[        X5      n[        UR                  5       5       H|  u  pUR                  5         UR                  X   S9  UR                  SSU	5        UR                  SUR!                  U5      UR!                  U5      5        UR#                  X:H  XxS9  M~     gs  snf )	z(bookmarks and their associated changesets   (no bookmarks set)
Nc              3  8   #    U  H  n[        U5      v   M     g 7fN)len).0bs     r   	<genexpr> showbookmarks.<locals>.<genexpr>   s     ,ec!ffes   )ctxs   bookmarks   %s   node)activelongestbookmarklennodelen)
_bookmarksrL   
isinstancer
   jsonformatterr8   r   valuesrev_activebookmarkmaxlongestshortestr9   r:   	startitemcontexthexfuncdata)
r>   r?   rD   marksnoderevsrS   longestnamerU   bms
             r   showbookmarksrg      s    OOEu:: "i5566HHQ./0).8JNND8!!F,e,,Kd)G5;;=)



tz
"
eR(
"**T*BJJt,<=
<K 	 	
 * 9s   )E
s   stack)r   c                n  ^^ US   nUR                  5       [        :X  a  [        R                  " [	        S5      5      eUR                  5       [        R                  :X  a  U R                  [	        S5      5        g[        R                  " X5      nSnUc"  UR                  5       nUR                  5       1nO[        UR                  SU5      5      nX   nUR                  5       R                  5       [        :w  a  UR                  5       nSnUR                  n	U	R                  UR                  5       /5       Hk  n
X   nUR                  5       [        R                  :X  a    ODUR!                  UR                  5       5        [#        UR%                  5       5      S:  d  Mi  Sn  O   ['        [)        USS	95      nU(       a+  [        UR                  S
UR                  5       U5      5      nO
[        5       n[        U5      U-  U1-  n[+        X5      n [,        R.                  " S[0        R2                  5        Sn[8        R:                  " X5      n[8        R<                  " U SU-  US9mU4S jnU(       Ga  0 mU H9  nU	R?                  U/UR                  5       S9n[#        ['        U5      5      TU'   M;     XS      n[)        UU4S jSS9n[A        U5       GH  u  nn
X   nU(       a  U R                  S5        OU R                  S5        U RC                  S5        URE                  X}S9  URG                  U5        U R                  S5        U(       a  U R                  S5        OU R                  S5        U R                  S5        U R                  [	        S5      TU
   -  SS9  U(       a2  U R                  S5        U R                  SU" U5      U" U5      4-  S S9  U R                  S!5        GM     U R                  S"5        U R                  [	        S#5      S$S9  U(       a;  U R                  S%5        U R                  [	        S&5      S$S9  U R                  S'5        U H  n
X   nXR                  5       :X  a  S(OS)nU(       a  U R                  S5        OU R                  S5        U R                  US5        URE                  X}S9  URG                  U5        U R                  S5        M     U(       a  U(       a  U R                  S*5        OU R                  S+5        U R                  [	        S,5      SS$S9  U RC                  S5        URE                  X]S9  URG                  U5        U R                  S5        gg! [        R4                  [        R6                  4 a    Sn GNtf = f)-zcurrent 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::.F   T)reverses    heads(%d::) - %ld - not public()s   rebases   {shortest(node, %d)})	resourcesc                F   > TR                  X R                  5       S.5      $ )N)s   ctxrR   )renderdefaulthex)rQ   shortesttmpls    r   shortestshowstack.<locals>.shortest!  s    ))3*KLLr!   )stoprevc                   > TU    $ rK   r"   )xrevdistances    r   <lambda>showstack.<locals>.<lambda>4  s	    KNr!   )keyrk   s   : s     s   o  )rU   r1   s   :/s    /s       (s   %d commits aheads   stack.commitdistance)labels   ; s   hg rebase --source %s --dest %ss   stack.rebasehints   )
s   :
:    s   (stack head)
s   stack.labels    \ /  s   (multiple children)
s     |
   @   os   :/   s    /   s   (stack base))$rZ   r   r	   r4   r   phaser   publicr8   r   	stackbasesetrd   p1	changelogdescendantsaddrL   childrenlistr9   r]   r   findcmdr   tableAmbiguousCommandUnknownCommandr
   templateresourcesmaketemplater	ancestors	enumeratewritenoi18nrH   flush)r>   r?   rG   wdirctxbaserevbasectx	stackrevsrQ   branchpointattipclrZ   newheadsallrevsrU   
haverebasetresrq   headr   	sourcectxsortedheadsisymbolrw   rp   s                          @@r   	showstackr      s    4jG{{}kk%
 	
 }}&--'
 	
 	
   *GG++-[[]O			(G45	
-C
vvx||~ &&( 	B~~w{{}o.i 99;&--'cggi  s||~"#! /$ VIt45I II3W[[]I
 5)nx'7)3Gd,G	8>>2
 &&r0D**
#g-LM  D dVW[[]CI #DO 4K	  2'	2D
  ,FAs)CNN6"NN3N0OOC HHUOHHXHH%&S)99-  
 :#I.>? .   HHVG -J 	
$%^<

+,NC
i-4HHUOHHUO
s,
    HHXHHX
?#U.A
vw0 
 A ""E$8$89 
s   'V
 
&V43V4s!   _underway([commitage[, headage]])c                   [         R                  " USS5      nSU;  a  S US'   SU;  a  S US'   Sn/ nUS   (       a7  US-  nUR                  [        R                  " US   [        S5      5      5        U R                  " U/UQ76 n[         R                  " U5      nXpR                  SU5      -  nS	n/ nUS   (       a7  US-  nUR                  [        R                  " US   [        S
5      5      5        XpR                  " U/UQ76 -  nU S   R                  5       nU[        :w  a  U[         R                  " U15      -  nX-  $ )Ns   underways   commitage headages	   commitages   headages   not public() and not obsolete()s    and date(%s)s   commitage requires a strings   parents(%ld)s   head() and not closed()s   headage requires a stringri   )
r   getargsdictappendr   	getstringr   rd   basesetrZ   r   )	r?   subsetrv   argsrsrsargsmutablerelevantwdirrevs	            r   underwayrevsetr     sU   a.BCD4!\Z 
,BFL
  \"A&D$E	
 ii$V$G~~g&H 		/733H 
$BFJ
  Z !$@"A	
 		"&v&&H 4jnnG'FNNG9--r!   s   workc           	         UR                  S5      n[        X5      n[        R                  " X5      nU R	                  SSS5        [
        R                  " U UUU[        R                  SU0S9  g)zchangesets that aren't finisheds   sort(_underway(), topo)s   experimentals   graphshortenTs   nodelen)propsN)rd   r]   r   	dagwalker	setconfigr   displaygraph
asciiedges)r>   r?   rG   rd   rU   revdags         r   showworkr     sh     99/0Dd)G+FLL/48
7#r!   c           	     (   U R                  SS5       H|  n[        R                   He  nSX4-  n[        R                  " U[
        R                  SS9u  pEX4;   a  M6  U R                  SUS 5      (       a  MP  U R                  SUSU-  SS	9  Mg     M~     g )
Ns   commandss   show.aliasprefixs   %s%sT)stricts   aliass   show %sr+   )source)	
configlistr5   r6   r   findpossibler   r   configr   )r>   prefixr@   r   choiceallcommandss         r   extsetupr     s    ---@AOODf^+D")"6"6hnnT#F
 ~ yy4..LL4d):7LK $ Br!   c                `   ^ ^^ U(       d  T$ T R                   m[        UUU 4S jU 5       5      $ )a  Return 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...``.
c           	   3     >#    U  H5  n[        [        R                  " TTR                  U5      T5      5      v   M7     g 7frK   )rL   r   shortesthexnodeidprefixrc   )rM   rr   minlenr?   s     r   rO   "longestshortest.<locals>.<genexpr>  s7      A 	G++D"''!*fEFFs   =A )r   r\   )r?   rd   r   r   s   ` `@r   r]   r]     s0     	B   r!   c                 d   [        [        [        [        R                  R                  5       5      5      n / n[        [        R                  R                  5       5       HY  nUR                  [        R                  " UR                  U 5      5      < S[        R                  U   R                  < 35        M[     [        R                  " S5      [        R                  " [        S   S   R                  5      [        R                  " S5      R                  U5      4-  [        S   S   l        g )Nz   s   %s

%s
    r+   r   s   

)r\   maprL   r5   r6   keysr9   r   r   sysstrljust_origdoccleandoccmdtabler(   join)longestentriesrz   s      r   _updatedocstringr      s    #c8??//123GGhoo**,- 		' 23$--	
 . $,??3D#E(7+A.667 %%g.I $HWa r!   r#   )   )%r(   
__future__r   mercurial.i18nr   mercurial.noder   	mercurialr   r   r   r	   r
   r   r   r   r   r   r   r   r   
testedwithr   commandrevsetpredicate_funcregistrarbaser   r5   CATEGORY_CHANGE_NAVIGATIONrH   rg   r   r   r   r   r]   r   r"   r!   r   <module>r      s@  ( #  "   ( #



H
%++-$).. $6 = 	 
{C!91[>J gJ33@@F 
,-
 .
4 
(h'{ ({| 565 75p 
'W% &&L*4$  r!   