
    q&fA                     	   d dl mZ d dlmZmZ d dlmZmZmZm	Z	m Z m
Z
mZmZmZmZmZmZ d dlmZmZ ej(                  Zej,                  Zej.                  Zej0                  Zej2                  Zej4                  ZddZd ZdZed	z   ed
dddZed   ed<   i Z ej@                  e      Z  e ddh      d        Z! e dddh      d        Z" e ddh      d        Z# e ddh      d        Z$ e dddh      d        Z% e ddh      d        Z& e dddh      d         Z' e d!ddh      d"        Z( e d#dh      d$        Z) e d%dh      d&        Z* e d'd(dh      d)        Z+ e d*d(h      d+        Z, e d,dh      d-        Z- e d.dh      d/        Z.dd0Z/dd1Z0 e d2h d3      d4        Z1 e d5d6h      d7        Z2 e d8dd6h      d9        Z3 e d:dd6h      d;        Z4 e d<dd6h      d=        Z5 e d>dh      d?        Z6 e d@h dA      dB        Z7dC Z8dD Z9dE Z: e dFdG      dH        Z; e dIdG      dJ        Z< e dKh dA      dL        Z=dM Z> e dNh dA      dO        Z? e dPh dA      dQ        Z@dR ZAddheA_B         e dSddh      dT        ZC e dUh dV      dW        ZDdX ZE e dYddh      dZ        ZF e d[ddh      d\        ZG e d]dh      d^        ZH e d_dh      d`        ZI e dad(dh      db        ZJ e dcddh      de        ZK e dfdh      dg        ZL e dhddh      di        ZM e djdh      dk        ZN e dlddh      dm        ZO e dnh do      dp        ZP e dqddh      dr        ZQ e dsddh      dt        ZR e dudh      dv        ZS e dwdh      dx        ZT e dydh      dz        ZU e d{dh      d|        ZV e d}dh      d~        ZW e ddh      d        ZX e dddh      d        ZY e ddh      d        ZZ e ddh      d        Z[ e ddh      d        Z\ e ddh      d        Z] e dddh      d        Z^ e dd(h      d        Z_ e ddh      d        Z` e ddh      d        Za e dd(h      d        Zb e dddh      d        Zcd Zdej                         Zfy)   )_)hexwdirrev)diffutilencodingerrorhbisecti18nobsutilpatchpycompat	registrarscmutiltemplateutilutil)
stringutilurlutilNc                 0   | j                  |d      | j                  |d      | j                  |d      }d}|!|d|z   z  }t        j                  |      d   }nt        j                  }||vrdddd	gfi||<   ||   }j                         }|g}|r%|j                         }||v r|   j                         D 	cg c]1  }	j                  |	      rj                  |	      d
k7  r
 ||	      r|	3 }
}	|
r1j                         d   dt        |
      D 	cg c]  }	|	 c}	f||<   	 j                         D cg c]  }||j                             }}t        |      dkD  r9|d   d   |d   d   k(  rt        |      \  }}}n!fd}t        ||      \  }}}n	|d   \  }}}||dz   |f||<   |r%||   S c c}	w c c}	w c c}w # t        $ r; |j                  |       |j!                  d j                         D               Y w xY w)z8return date, distance and name for the latest tag of rev   repo   ctx   caches
   latesttags   -       s   nulls   localr   c                 @   | d   d   }j                         Mj                         D cg c]  }|j                          }}j                  d||      }t        |      dz   }n,j                  dj                         |      }t        |      }| | d   gS c c}w )Nr   r      only(%ld, %s)r   s   only(%d, %s))revparentsrevslen)xtagcprevschangeschangessincetagctxrepos         6/usr/lib/python3/dist-packages/mercurial/templatekw.pykeyzgetlatesttags.<locals>.keyU   s    d1g779,69kkm$DQUUW$DE$D&*ii0@%&MG.1'lQ.>O&*iiC&PG.1'lO "1 0!A$77 %Es   B)r+   c              3   <   K   | ]  }|j                           y wN)r   ).0ps     r*   	<genexpr>z getlatesttags.<locals>.<genexpr>i   s     7A7s   )resourcer   stringmatcherr   alwaysr   poptagstagtypedatesortedr   r!   maxKeyErrorappendextend)contextmappingpatterncache	cachenamematch
latesttagsr   todotr5   r/   ptagspdatepdistptagr+   r(   r)   s                    @@r*   getlatesttagsrJ   *   sA   GW-D


7F
+CWh/EITG^#	((1!4 Ay 12iy!J
'')C5D
hhj*3i XXZ
QDLLOx$?E!H 
 

 !hhjmQF4L0Iq0IIJsO	25++-@QZ(@E@5zA~8A;%(1+- *-U&E5$8 *-U)<&E5$%*1X"ud  D0
3Y Z c?Q
 1J A2  	KKKK777		s2   6G	G0G GAG G A HHc                     t         j                  }  | d      }t        t        |j	                         D cg c]  }|j                  dd      d    c}t        j                  |      j	                  d                  S c c}w )z"Return a dict of log column labelss  bookmark:    %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
   :r   r   T)r   identitydictzip
splitlinessplitr
   r   )r   columnsss      r*   getlogcolumnsrT   o   ss    A	G& *1*<*<*>?QQWWT1a ?FF7O&&t,	
 ?s   A?s   {rev}:{node|formatnode}    s   {name} ({source})s   {key}={value}s   {key}={value|stringescape})   parent   manifest	   file_copy   envvar   extrarX   s   filecopys   authorr   )requiresc                     t        | |      S )zAlias for ``{user}``)showuserr=   r>   s     r*   
showauthorr_      s     GW%%    s   bisectr   c                     | j                  |d      }| j                  |d      }t        j                  ||j                               S )z'String. The changeset bisection status.r   r   )r1   r	   labelnode)r=   r>   r)   r(   s       r*   
showbisectrd      s?     GW-D


7F
+C==sxxz**r`      branchc                 F    | j                  |d      }|j                         S )zMString. The name of the branch on which the changeset was
    committed.
    r   )r1   branchr=   r>   r(   s      r*   
showbranchri      s"    
 

7F
+C::<r`      branchesc                     | j                  |d      }|j                         }|dk7  rt        | |d|gd      S t        | |dg d      S )zList of strings. The name of the branch on which the
    changeset was committed. Will be empty if the branch name was
    default. (DEPRECATED)
    r   s   defaultre   rj   plural)r1   rg   
compatlist)r=   r>   r(   rg   s       r*   showbranchesro      sX     

7F
+CZZ\FWi&+
 	
 gw	2kJJr`   s	   bookmarksc                     | j                  |d      }| j                  |d      }|j                         }|j                  fd}t        | |d|      }t	        |||t
        j                        S )z{List of strings. Any bookmarks associated with the
    changeset. Also sets 'active', the name of the active bookmark.
    r   r   c                     | dS )N)   bookmarks   actives   current )vactives    r*   <lambda>zshowbookmarks.<locals>.<lambda>   s    aFO r`   rr   )r1   	bookmarks_activebookmark_showcompatlist_hybridr   rM   )r=   r>   r)   r(   rw   makemapfru   s          @r*   showbookmarksr}      sk    
 GW-D


7F
+CI!!FOG+yAA1i(*;*;<<r`      childrenc                     | j                  |d      }|j                         D cg c]  }d|j                         |fz   }}t        | |d|d      S c c}w )z/List of strings. The children of the changeset.r   s   %d:%sr~   s   child)element)r1   childrenr   rn   )r=   r>   r(   cctx	childrevss        r*   showchildrenr      s]     

7F
+C;><<>J4TXXZ..JIJ+y(  Ks   As   currentbookmarkc                     t        | |      S )zUString. The active bookmark, if it is associated with the changeset.
    (DEPRECATED))showactivebookmarkr^   s     r*   showcurrentbookmarkr      s     gw//r`   s   activebookmarkc                     | j                  |d      }| j                  |d      }|j                  }|r||j                         v r|S y)zDString. The active bookmark, if it is associated with the changeset.r   r   r`   )r1   rx   rw   )r=   r>   r)   r(   ru   s        r*   r   r      sK     GW-D


7F
+C!!F&CMMO+r`   s   datec                 p    | j                  |d      }t        j                  |j                         d      S )z<Date information. The date when the changeset was committed.r   s   %d.0%d)showfmt)r1   r   r7   rh   s      r*   showdater      s1     

7F
+C SXXZ;;r`   s   descc                    | j                  |d      }|j                         }t        |t        j                        r6t        j
                  t        j                  |      j                               S t        |t        j                        r#t        j                  |j                               S |j                         S )z.String. The text of the changeset description.r   )	r1   description
isinstancer   localstrtolocal	fromlocalstripsafelocalstr)r=   r>   r(   rS   s       r*   showdescriptionr      s     

7F
+CA!X&&' 2 21 5 ; ; =>>	Ax,,	-$$QWWY//wwyr`   s   diffstat   uic                 n   | j                  |d      }| j                  |d      }t        j                  |ddi      }|j                  t        j                  |      |      }t        j                  t        j                  |            }t        j                  |      \  }}}	}
}dt        |      |	|
fz  S )ziString. Statistics of changes with the following format:
    "modified files: +added/-removed lines"
    r   r   s   noprefixF)optss   %d: +%d/-%d)r1   r   diffalloptsdiffdiff_parentr   diffstatdatar   	iterlinesdiffstatsumr!   )r=   r>   uir(   diffoptsr   statsmaxnamemaxtotaladdsremovesbinarys               r*   showdiffstatr   	  s    
 
		'5	)B


7F
+C##Be(<=H88H((-H8=Dt~~d34E/4/@/@/G,GXtWfSZw777r`      envvarsc                     | j                  |d      }|j                         t        j                  fdt	              D              t        | |dd      S )z5A dictionary of environment variables. (EXPERIMENTAL)r   c              3   ,   K   | ]  }||   f  y wr-   rs   )r.   kenvs     r*   r0   zshowenvvars.<locals>.<genexpr>  s     9CF9   rY   r   rl   )r1   exportableenvironr   sortdictr8   
compatdict)r=   r>   r   r   s      @r*   showenvvarsr     sP     
		'5	)B



 C
--9VC[9
9Cgw	3zJJr`      extrasc                    | j                  |d      }|j                         t        j                  fdt	              D              fd}D cg c]
  } ||       }}t        | |d|d      }t        ||fd      S c c}w )zRList of dicts with key, value entries of the 'extras'
    field of this changeset.r   c              3   ,   K   | ]  }||   f  y wr-   rs   )r.   r   extrass     r*   r0   zshowextras.<locals>.<genexpr>&  s     BaAvay>Br   c                     | |    dS )N)s   keys   valuers   r   r   s    r*   rv   zshowextras.<locals>.<lambda>'  s    fQi8 r`   rZ   r   rl   c                 >    d| t        j                  |          fz  S Ns   %s=%s)r   	escapestrr   s    r*   rv   zshowextras.<locals>.<lambda>.  s     (a!5!5fQi!@AA r`   )r1   extrar   r   r8   ry   rz   )r=   r>   r(   r{   r   r$   r|   r   s          @r*   
showextrasr      s     

7F
+CYY[F]]B6&>BBF8G#$$A$(AiHA	A	  	%s   Bs
   _fast_rankc                 V    | j                  |d      }|j                         }|yd|z  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.
    r   Ns   %d)r1   	fast_rank)r=   r>   r(   ranks       r*   r   r   2  s3     

7F
+C==?D|4<r`   c                     | j                  |d      }| j                  |d      }d|vs|d   |k  r-|j                         j                  ||||      }||d<   ||d<   |d   S )Nr      revcaches
   filestatus   filestatusall)listignored	listcleanlistunknown)r1   p1status)r=   r>   listallr(   revcachestats         r*   _getfilestatusr   A  s    


7F
+C5HH$1A(BW(LvvxWW  
 #'%,!"M""r`   c                     | j                  |d      }d|vs|d   |k  rVt        | ||      }i x|d<   }t        t        j                  d      |      D ]  \  }|j                  fd|D               ! |d   S )Nr   s   filestatusmapr   r   s   MAR!?ICc              3   &   K   | ]  }|f 
 y wr-   rs   )r.   r|   chars     r*   r0   z$_getfilestatusmap.<locals>.<genexpr>S  s     4At94s   )r1   r   rO   r   iterbytestrupdate)r=   r>   r   r   r   statmapfilesr   s          @r*   _getfilestatusmapr   M  s    5Hx'84D+E+Ogw@/11!"Wx33J?F 	5KD%NN4e44	5$%%r`   s   file_copies>   r   r   r   r   c                 6   | j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      j                  d      }|)d|vrt        j                  |      |d<   |d   } ||      }t	        j
                  | |d|      S )zLList of strings. Files copied in this changeset with
    their sources.
    r   r   r   r      copiess	   getcopiesrX   )r1   getr   getcopiesfnr   compatfilecopiesdict)r=   r>   r)   r(   r@   copies	getcopiess          r*   showfilecopiesr   W  s     GW-D


7F
+CWh/Eg{377	BF~u$")"5"5d";E,,'	3,,, r`   s   file_copies_switchr   c                 |    | j                  |d      j                  d      xs g }t        j                  | |d|      S )z^List of strings. Like "file_copies" but displayed
    only if the --copied switch is set.
    r   r   rX   )r1   r   r   r   )r=   r>   r   s      r*   showfilecopiesswitchr   o  sB    
 g{377	BHbF,,, r`   s	   file_addsc                 r    | j                  |d      }t        j                  | |d|j                               S )z/List of strings. Files added by this changeset.r   s   file_add)r1   r   compatfileslist
filesaddedrh   s      r*   showfileaddsr   z  s9     

7F
+C''+s~~'7 r`   s	   file_delsc                 r    | j                  |d      }t        j                  | |d|j                               S )z1List of strings. Files removed by this changeset.r   s   file_del)r1   r   r   filesremovedrh   s      r*   showfiledelsr     s;     

7F
+C''+s'7'7'9 r`   s	   file_modsc                 r    | j                  |d      }t        j                  | |d|j                               S )z2List of strings. Files modified by this changeset.r   s   file_mod)r1   r   r   filesmodifiedrh   s      r*   showfilemodsr     s;     

7F
+C''+s'8'8': r`   s   filesc                 r    | j                  |d      }t        j                  | |d|j                               S )zRList of strings. All files modified, added, or removed by this
    changeset.
    r   s   file)r1   r   r   r   rh   s      r*   	showfilesr     s3    
 

7F
+C'''399;OOr`   s	   graphnode>   r   r   r   c                     | j                  |d      }| j                  |d      }| j                  |d      }t        |||      S )zUString. The character representing the changeset node in an ASCII
    revision graph.r   r   r   )r1   getgraphnode)r=   r>   r)   r(   r@   s        r*   showgraphnoder     sI     GW-D


7F
+CWh/Ec5))r`   c                 6    t        | ||      xs t        |      S r-   )getgraphnodecurrentgetgraphnodesymbol)r)   r(   r@   s      r*   r   r     s    tS%0K4Fs4KKr`   c                 z   | j                   j                         }|d   | j                  k(  r|d d }|j                         |v ry|j	                  d      }|Qddlm} |j                  j                  |       }|j                         r|j                  |j                  f}nd}||d<   |j                         |v ryy)Nr      @s   merge_nodes)
mergestaters      %r`   )dirstater   nullidrc   r    r   readunresolvedcountlocalother)r)   r(   r@   wpnodesmerge_nodesmergestatemodr   s          r*   r   r     s    mm##%GqzT[[ "1+
xxzWii/5&1166t<J))+)//1A1AB $/E.!88:$r`   c                 j    | j                         ry| j                         ry| j                         ryy)N   x   *   _   o)obsolete
isunstableclosesbranchr(   s    r*   r   r     s-    
||~						r`   s
   graphwidthrs   c                      y)z?Integer. The width of the graph drawn by 'log --graph' or zero.r   rs   r^   s     r*   showgraphwidthr    s     r`   s   indexc                 >    t        j                  t        d            )z7Integer. The current iteration of the loop. (0 indexed)s   can't use index in this context)r   Abortr   r^   s     r*   	showindexr    s     ++a:;
<<r`   	   latesttagc                     t        | |d      S )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)showlatesttagsr^   s     r*   showlatesttagr    s     '7D11r`   c                     t        | ||      fd}d   }t        | |d|d      }t        |||t        j                        S )z4helper method for the latesttag keyword and functionc                      t         d   | | dS )Nr   )s   changess   distancer     tag)_showchangessincetag)rt   rC   s    r*   rv   z showlatesttags.<locals>.<lambda>  s    (]	 r`   r   r  rL   )	separator)rJ   ry   rz   r   rM   )r=   r>   r?   r{   r5   r|   rC   s         @r*   r  r    sL    w9J
G a=D,MA1dGX%6%677r`   s   latesttagdistancec                      t        | |      d   S )z(Integer. Longest path to the latest tag.r   )rJ   r^   s     r*   showlatesttagdistancer    s     '*1--r`   s   changessincelatesttagc                 f    t        | |      d   d   }| j                  |d|i      }t        | |      S )z-Integer. All ancestors not in the latest tag.r   r   r  )rJ   
overlaymapr  )r=   r>   r#   s      r*   showchangessincelatesttagr    s=     
)!
,Q
/C  63-8G11r`   c                 V   | j                  |d      }| j                  |d      }d}|j                         g}| j                  |d      }|j                         -d}|j                         D cg c]  }|j                          }}t	        |j                  d||            |z   S c c}w )Nr   r   r   r  r   r   )r1   r   symbolr   r!   r    )r=   r>   r)   r(   offsetr    r#   r/   s           r*   r  r    s    GW-D


7F
+CFGGI;D
..&
)C wwy!$/A//tyy)456?? 0s   .B&rW   c                    | j                  |d      }| j                  |d      }|j                         }|3|j                  j                  }t        |j                  j
                  n&|j                  j                  |      t        |      | j                  |d      }| j                  d|      }t        j                  |d |fd      S )Nr   r      rev   noderW   c                     dS )Nr  rs   )r"   mhexmrevs    r*   rv   zshowmanifest.<locals>.<lambda>(  s    td; r`   )r1   manifestnodenodeconstantswdiridr   wdirhexmanifestlogr   r   r  processr   
hybriditem)r=   r>   r)   r(   mnoder|   r"  r#  s         @@r*   showmanifestr,    s    GW-D


7F
+CE}""))!!))##E*5z  4$*GHGW-A""	4; r`   s   obsfate>   r   r   r   c                 ,   t        | |      }| j                  |d      }| j                  |d      }g }|j                  | |      D ]@  }t        j                  |||d   |d   t
        j                        }|j                  |       B t        | |d|      S )Nr   r   
   successors   markerss   fate)	showsuccsandmarkersr1   tovaluer   obsfateprinterr   formatchangeidr;   rn   )r=   r>   succsandmarkersr   r)   valuesr"   rt   s           r*   showobsfater6  ,  s     *'7;O			'5	)BGW-DF$$Wg6 ""a&*w7M7M
 	a	 gw88r`   c                     | j                  |d      }| j                  |d      }|j                  j                  |      }|y|j                  ||j                               }t	        | ||j
                  ||      S )z<helper method to generate a template keyword for a namespacer   r   Nrl   )r1   namesr   rc   rn   templatename)r=   r>   	namespacer)   r(   nsr8  s          r*   	shownamesr<  A  st    GW-D


7F
+C			"B	z 	HHT388:&E"//5 r`   s
   namespacesc                   	
 | j                  |d      
| j                  |d      }t        j                         	d }
j                  j	                         D ]X  \  }}|j                  
|j                               }t        | |d|      }t        || ||      t        j                        	|<   Z t        | |dt        	            }	
fd}t        |	|t        j                        S )zBDict of lists. Names attached to this changeset per
    namespace.r   r   c                       fdS )Nc                 $    d| j                   | iS )N   name)r9  )rt   r;  s    r*   rv   z5shownamespaces.<locals>.makensmapfn.<locals>.<lambda>[  s    '1booq9 r`   rs   )r;  s   `r*   makensmapfnz#shownamespaces.<locals>.makensmapfnY  s	    99r`   r@  	   namespacec                 t    | |    j                   |    j                  j                   |    j                  dS )N)rB  s   namess   builtins	   colorname)r8  builtin	colorname)r;  
namespacesr)   s    r*   r{   zshownamespaces.<locals>.makemapd  s9     n

2..**R.22	
 	
r`   )r1   r   r   r8  itemsrc   ry   rz   r   rM   list)r=   r>   r(   rA  r   r;  r8  r|   r{   rF  r)   s            @@r*   shownamespacesrI  P  s     GW-D


7F
+CJ: !!# N2sxxz*GWgu=5+b/8;L;LM
1N
 	,Z8HIA
 1j'8+<+<==r`   s   negrevc                     | j                  |d      }|j                         }||dk  ry| j                  |d      }|t        |      z
  S )zmInteger. The repository-local changeset negative revision number,
    which counts in the opposite direction.r   Nr   r   )r1   r   r!   )r=   r>   r(   r   r)   s        r*   
shownegrevrK  o  sO     

7F
+C
'')C
{cAgGW-DT?r`   r   c                 F    | j                  |d      }|j                         S )zUString. The changeset identification hash, as a 40 hexadecimal
    digit string.
    r   )r1   r   rh   s      r*   shownoderM  {  s"    
 

7F
+C779r`      obsoletec                 J    | j                  |d      }|j                         ryy)z9String. Whether the changeset is obsolete. (EXPERIMENTAL)r   rN  r`   )r1   r  rh   s      r*   showobsoleterP    s%     

7F
+C
||~r`   s   onelinesummaryc                 z    ddl m} | j                  |d      }| j                  |d      }|j                  ||      S )zString. A one-line summary for the ctx (not including trailing newline).
    The default template be overridden in command-templates.oneline-summary.r   )cmdutilr   r   )r   rR  r1   format_changeset_summary)r=   r>   rR  r   r(   s        r*   showonelinesummaryrT    s>     			'5	)B


7F
+C++B44r`      path   fctxc                 F    | j                  |d      }|j                         S )zDString. Repository-absolute path of the current file. (EXPERIMENTAL)rV  )r1   pathr=   r>   fctxs      r*   showpathr[    "     GW-D99;r`   s   peerurlsc                     | j                  |d      }|j                  j                  t        j                  |j                        }t        j                  d |D              fd}fd}t        d||      S )zcA dictionary of repository locations defined in the [paths] section
    of your configuration file.r   c              3   >   K   | ]  \  }}||j                   f  y wr-   )rawloc)r.   r   r/   s      r*   r0   zshowpeerurls.<locals>.<genexpr>  s     =41a!QXX=s   c                    |    }d| i}t        |      dk(  r^|d   j                  |d<   |d   j                  j                         }t	        j
                  t        |            }|j                  |       t	        j
                         }|D ]^  }t	        j
                  t        |j                  j                                     }|j                  |d<   |j                  |       |g|d<   ` |S )Nr@  r   r   s   urls   urls)r!   r_  
suboptionsrG  r   r   r8   r   )r   psdsub_opts	path_dictr/   pathss         r*   r{   zshowpeerurls.<locals>.makemap  s    1XaLr7a<1AfI!u''--/H}}VH%56HHHXMMO	 	%A}}VALL,>,>,@%ABH !IfX&#AgJ		%
 r`   c                     d| |    fz  S r   rs   )r   urlss    r*   
format_onez showpeerurls.<locals>.format_one  s    1d1g,&&r`   N)r1   r   rf  r   
list_pathsr   r   rz   )r=   r>   r)   	all_pathsr{   ri  rf  rh  s         @@r*   showpeerurlsrl    si     GW-DGGMME""477+I===9==D ' 4w
33r`   s   predecessorsc                    | j                  |d      | j                  |d      }t        t        j                  |j	                                     }t        j                  t        |      }t        d|fdfd      S )zDReturns the list of the closest visible predecessors. (EXPERIMENTAL)r   r   Nc                     d|    iS Nr   rs   r"   r)   s    r*   rv   z"showpredecessors.<locals>.<lambda>      647# r`   c                 4    t        j                  |          S r-   r   r3  rp  s    r*   rv   z"showpredecessors.<locals>.<lambda>      '((a1 r`   )	r1   r8   r   closestpredecessorsrc   r   maplistr   rz   )r=   r>   r(   predecessorsr)   s       @r*   showpredecessorsrx    sq     GW-D


7F
+C'55dCHHJGHL##C6L#1	 r`   s   reporootc                 >    | j                  |d      }|j                  S )z5String. The root directory of the current repository.r   )r1   root)r=   r>   r)   s      r*   showreporootr{    s      GW-D99r`   s   sizec                 F    | j                  |d      }|j                         S )z:Integer. Size of the current file in bytes. (EXPERIMENTAL)rV  )r1   sizerY  s      r*   showsizer~    r\  r`   s   status>   r   rV  r   c                     t        j                  | |d      }t        j                  | ||      }|syt        | |      }||vrt        | |d      }|j	                  |      S )z7String. Status code of the current file. (EXPERIMENTAL)rU  NTr   )r   	runsymbol	stringifyr   r   )r=   r>   rX  r   s       r*   
showstatusr    sc     !!'7G<D!!'7D9D1G7#GWdC;;tr`   s   successorssetsc           
         	
  j                  d      
 j                  d      }g }|j                         rzt        j                  
|j	                         d      }|D cg c]  }|D cg c]  }t        |       c} }}}|D ]'  }t        d|
fd
fd      }|j                  |       )  fd		fd	}t         ||      |d
 t        j                        S c c}w c c}}w )zReturns a string of sets of successors for a changectx. Format used
    is: [ctx1, ctx2], [ctx3] if ctx has been split into ctx1 and ctx2
    while also diverged into ctx3. (EXPERIMENTAL)r   r   T)closestNc                     d|    iS ro  rs   rp  s    r*   rv   z$showsuccessorssets.<locals>.<lambda>      647+ r`   c                 4    t        j                  |          S r-   rs  rp  s    r*   rv   z$showsuccessorssets.<locals>.<lambda>  s    '00a9 r`   c                 2    t        j                  |       S r-   )r   r  )rc  r=   r>   s    r*   renderz"showsuccessorssets.<locals>.render  s    %%gw::r`   c              3   F   K   dj                  fd| D               y w)Ns   ; c              3   .   K   | ]  } |        y wr-   rs   )r.   rc  r  s     r*   r0   z2showsuccessorssets.<locals>.gen.<locals>.<genexpr>  s     1q1s   )join)datar  s    r*   genzshowsuccessorssets.<locals>.gen  s     jj1D111s   !c                 
    d| iS )Ns   successorsetrs   )r"   s    r*   rv   z$showsuccessorssets.<locals>.<lambda>  s    OQ#7 r`   )
r1   r  r   successorssetsrc   r   rz   r;   r   rM   )r=   r>   r(   r  ssetsssnhr  r  r)   s   ``       @@r*   showsuccessorssetsr    s    
 GW-D


7F
+CD
||~&&tSXXZF056""%Q#a&%66 	B+9	A KKN	;2 D	479J9J % &6s   &	C(/C#C(#C(s   succsandmarkersc                 0   | j                  |d      | j                  |d      }t        j                  |      }|g }g }|D ]  }|d   }|D cg c]  }t        |       }}t	        d|fdfd      }g }|d   D ]f  }	t        |	d         }
t        d	 |	d
   D              }d}|	d   t        d |	d   D              }|
|f|	dd z   |fz   |	dd z   }|j                  |       h |j                  ||d        t        j                  |      S c c}w )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)
    r   r   Nr.  c                     d|    iS ro  rs   rp  s    r*   rv   z%showsuccsandmarkers.<locals>.<lambda>(  s    vtAw' r`   c                 4    t        j                  |          S r-   rs  rp  s    r*   rv   z%showsuccsandmarkers.<locals>.<lambda>)  s    g,,T!W5 r`   r/  r   c              3   2   K   | ]  }t        |        y wr-   r   r.   r  s     r*   r0   z&showsuccsandmarkers.<locals>.<genexpr>0  s     1qCF1   r      c              3   2   K   | ]  }t        |        y wr-   r  r  s     r*   r0   z&showsuccsandmarkers.<locals>.<genexpr>3  s     "8a3q6"8r  r      )r.  r/  )	r1   r   successorsandmarkersr   rz   tupler;   r   mappinglist)r=   r>   r(   r5  r  i
successorsr  finalmarkersmhexprechexsucs
hexparents	newmarkerr)   s                 @r*   r0  r0    sR    GW-D


7F
+C))$4F~ D K}%
&01c!f1
1'5	

 : 	+A!A$iG1AaD11GJt""81Q4"88
 '*QqV3zmCaeKI	*	+ 	JLIJ/K2 ##D))+ 2s   Ds   p1c                 |    | j                  |d      }t        j                  d|j                         it              S )zChangeset. The changeset's first parent. ``{p1.rev}`` for the revision
    number, and ``{p1.node}`` for the identification hash.r   tmpl)r1   r   mappingdictr   _changeidtmplrh   s      r*   showp1r  <  4     

7F
+C##VSVVX$6]KKr`   s   p2c                 |    | j                  |d      }t        j                  d|j                         it              S )zChangeset. The changeset's second parent. ``{p2.rev}`` for the revision
    number, and ``{p2.node}`` for the identification hash.r   r  )r1   r   r  p2r  rh   s      r*   showp2r  D  r  r`   s   p1revc                 b    | j                  |d      }|j                         j                         S )zInteger. The repository-local revision number of the changeset's
    first parent, or -1 if the changeset has no parents. (DEPRECATED)r   )r1   r   r   rh   s      r*   	showp1revr  L  (     

7F
+C668<<>r`   s   p2revc                 b    | j                  |d      }|j                         j                         S )zInteger. The repository-local revision number of the changeset's
    second parent, or -1 if the changeset has no second parent. (DEPRECATED)r   )r1   r  r   rh   s      r*   	showp2revr  T  r  r`   s   p1nodec                 b    | j                  |d      }|j                         j                         S )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   )r1   r   r   rh   s      r*   
showp1noder  \  (    
 

7F
+C668<<>r`   s   p2nodec                 b    | j                  |d      }|j                         j                         S )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   )r1   r  r   rh   s      r*   
showp2noder  e  r  r`   s   parentsc                    | j                  |d      | j                  |d      }t        j                  |      }|D cg c]  }|j                          }}|D cg c]7  }d|j                         fd|j	                         fd|j                         fg9 }}t        | |d|      }t        ||fdfdt        	      S c c}w c c}w )
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.r   r   r  r      phaserV   c                     d|    iS ro  rs   rp  s    r*   rv   zshowparents.<locals>.<lambda>  rq  r`   c                 4    t        j                  |          S r-   rs  rp  s    r*   rv   zshowparents.<locals>.<lambda>  rt  r`   )keytype)	r1   r   meaningfulparentsr   r   phasestrry   rz   int)	r=   r>   r(   pctxsr/   r%   r   r|   r)   s	           @r*   showparentsr  n  s    
 GW-D


7F
+C%%dC0E#$QUUW$E$  !%%'	Waeeg.1::<0HIG  	)W=A	#1  %s    C<Cr  c                 F    | j                  |d      }|j                         S )z!String. The changeset phase name.r   )r1   r  rh   s      r*   	showphaser    s"     

7F
+C<<>r`   s   phaseidxc                 F    | j                  |d      }|j                         S )z.Integer. The changeset phase index. (ADVANCED)r   )r1   phaserh   s      r*   showphaseidxr    s"     

7F
+C99;r`   r  c                 P    | j                  |d      }t        j                  |      S )z8Integer. The repository-local changeset revision number.r   )r1   r   intrevrh   s      r*   showrevr    s%     

7F
+C>>#r`   s   subreposc                 V   | j                  |d      }|j                  }|st        | |dg       S |j                         j                  xs i }g }|D ]#  }||vs||   ||   k7  s|j	                  |       % |D ]  }||vs|j	                  |        t        | |dt        |            S )z:List of strings. Updated subrepositories in the changeset.r   s   subrepo)r1   substatern   r   r;   r8   )r=   r>   r(   r  	psubstatesubrepossubs          r*   showsubreposr    s     

7F
+C||H'7J;;!!'RIH !i8C=IcN#BOOC !  !hOOC ! gw
F84DEEr`      tagsc                     t        | |d      S )z8List of strings. Any tags associated with the changeset.r  )r<  r^   s     r*   showtagsr    s     Wgw//r`   s	   termwidthc                 F    | j                  |d      }|j                         S )z+Integer. The width of the current terminal.r   )r1   	termwidthr=   r>   r   s      r*   showtermwidthr    s"     
		'5	)B<<>r`   s   userc                 F    | j                  |d      }|j                         S )z/String. The unmodified author of the changeset.r   )r1   userrh   s      r*   r]   r]     s"     

7F
+C88:r`      instabilitiesc                 b    | j                  |d      }t        | |d|j                         d      S )zYList of strings. Evolution instabilities affecting the changeset.
    (EXPERIMENTAL)
    r   s   instabilityr  rl   )r1   rn   instabilitiesrh   s      r*   showinstabilitiesr    s;    
 

7F
+C r`   s	   verbosityc                 v    | j                  |d      }|j                  ry|j                  ry|j                  ryy)zOString. The current output verbosity in 'debug', 'quiet', 'verbose',
    or ''.r   s   debugs   quiets   verboser`   )r1   	debugflagquietverboser  s      r*   showverbosityr    s7     
		'5	)B	||		r`   s   whyunstablec           	      f  	
 | j                  |d      
| j                  |d      }d 	t        j                  
|      }|D ]O  }|j                  d      s|d   }t	        d|D cg c]  }|j                          c}
fd	
fd      }||d<   Q d}t        j                  ||d	
      S c c}w )zRList of dicts explaining all instabilities of a changeset.
    (EXPERIMENTAL)
    r   r   c                 R    dt        j                  |       | j                         fz  S )Ns   %s (%s))r   r3  r  r  s    r*   
formatnodez#showwhyunstable.<locals>.formatnode  s#    W33C8#,,.IIIr`   s   divergentnodesNc                     d|    iS ro  rs   rp  s    r*   rv   z!showwhyunstable.<locals>.<lambda>  r  r`   c                      |          S r-   rs   )r"   r  r)   s    r*   rv   z!showwhyunstable.<locals>.<lambda>  s    *T!W- r`   sM   {instability}:{if(divergentnodes, " ")}{divergentnodes} {reason} {node|short}   
)r  sep)r1   r   whyunstabler   rz   r   r   r  )r=   r>   r(   entriesentrydnodesdnodednhybridr  r  r)   s            @@r*   showwhyunstabler    s    
 GW-D


7F
+CJ !!$,G 	099&',-F*011+-	H (0E#$	0	! 	 ##G$EBB 2s   &B.c                 Z    |j                   j                         D ]  \  }}|t        |<    y)z1Load template keyword from specified registrarobjN)_tablerG  keywords)r   extnameregistrarobjnamefuncs        r*   loadkeywordr     s-    "))//1 
dr`   r-   )F)gr
   r   rc   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   utilsr   r   hybridrz   
hybriddict
hybridlistr   rn   ry   rJ   rT   r  defaulttemplr  templatekeywordr_   rd   ri   ro   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  	_requiresr,  r6  r<  rI  rK  rM  rP  rT  r[  rl  rx  r{  r~  r  r  r0  r  r  r  r  r  r  r  r  r  r  r  r  r  r]   r  r  r  r  r5  i18nfunctionsrs   r`   r*   <module>r     s   
   
 

$$
$$
$$
$$
..BJ@ + t#&+ )6[  +)++H5 fX.& /&
 gv%67+ 8+ fX. / x0K 1K &(9:
= ;
= x0 1 #w.?@0 A0 "gv->? @ F8,< -< F8,
 -
 v7
8 8
8 ug.K /K fX. /" &2 3	#& E* &+? @ (=> ? (=> ? (=> ? VH-P .P (CD* E*L. , - B'= (= (CD2 E28& %0KL. M.
 )4OP2 Q2@  #*6!2   '89 :$ &>?9 @9( '6):;> <>< gv%67 8 F8, - x0 1 "eV_=	5 >	5 G9- . y14 24> GV+<= > y1 2 G9- . %CD	 E	 "gv->? @B #w.?@)* A)*X &*L +L &*L +L VH- . VH- . fX. / fX. / w&78 9, VH- . x0 1 6(+ , x0F 1F( GV#450 60
 0 1 F8, - !VH5 6 0 1 7F*;<C =C< !r`   