
Qc           @   s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d e f d     YZ d d d  Z	 d d  Z
 d   Z d   Z d d	  Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d    Z$ d!   Z% d"   Z& d#   Z' d$   Z( d%   Z) i e d& 6e d' 6e d( 6e d) 6e d* 6e d+ 6e d, 6e d- 6e d. 6e d/ 6e d0 6e d1 6e d2 6e d3 6e d4 6e d5 6e d6 6e d7 6e  d8 6e! d9 6e" d: 6e$ d; 6e# d< 6e% d= 6e& d> 6e' d? 6e( d@ 6e) dA 6Z* dB   Z+ i e+ dC 6Z, e, j- e*  e, j.   Z/ d S(D   i(   t   hexNt   _hybridc           B   s&   e  Z d d   Z d   Z d   Z RS(   c         C   s4   | |  _  | |  _ | r$ | |  _ n d   |  _ d  S(   Nc         S   s   |  j    d S(   Ni    (   t   values(   t   x(    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   <lambda>   s    (   t   genR   t   joinfmt(   t   selfR   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   __init__   s
    		c         C   s   |  j  S(   N(   R   (   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   __iter__   s    c         c   s   x |  j  D] } | Vq
 Wd  S(   N(   R   (   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   __call__   s    N(   t   __name__t
   __module__t   NoneR   R	   R
   (    (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyR      s   	c         K   sK   | s |  } n  t  |  | | |  } t | g  | D] } i | | 6^ q1  S(   N(   t	   _showlistR   (   t   nameR   t   pluralt   elementt   argst   fR   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showlist   s    	c         +   s  | d  | r | } n
   d } | sT d | } |  k rP  | |  Vn  d S   k r t  | d t  r d j |  Vn x | D] } t | |  Vq Wd Sd | } |  k r  | |  Vn  | j          f d  } d	   }	 |	  k r| j   }
 n d }
 x | D] } | |  Vq$W|
 d k	 rY| |
 d
 |	 Vn  d | } |  k r | |  Vn  d S(   s  expand set of values.
    name is name of key in template map.
    values is list of strings or dicts.
    plural is plural of name, if not simply name + 's'.

    expansion works like this, given name 'foo'.

    if values is empty, expand 'no_foos'.

    if 'foo' not in template map, return values as a string,
    joined by space.

    expand 'start_foos'.

    for each value, expand 'foo'. if 'last_foo' in template
    map, expand it instead of 'foo' for last key.

    expand 'end_foos'.
    t   templt   st   no_Ni    t    t   start_c            s{   y  j  |   WnZ t t f k
 rm y% x |  D] \ } } |  | <q1 WWqn t k
 ri |     <qn Xn X |   S(   N(   t   updatet   AttributeErrort
   ValueError(   t   vt   tagt   at   b(   R   R   t   vargs(    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   oneL   s    t   last_R   t   end_(   t
   isinstancet   strt   joint   dictt   copyt   popR   (   R   R   R   R   t   namest   nonameR   t	   startnameR"   t   lastnamet   lastt   endname(    (   R   R   R!   s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyR   $   s>    
	





c         C   sC   d | k r; |  j  | j   j   | j    d  | d <n  | d S(   Nt   filesi   (   t   statust   p1t   node(   t   repot   ctxt   revcache(    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   getfilesc   s    /c   
         so  d | k r  i d
 d 6| d <n  | d   | j    } | g } x%| rf| j   } |   k rf qB n  |  | } g  | j   D]! } |  j |  d k r} | ^ q} } | r | j   d d d j t |   f   | <qB n  y/ t   f d   | j   D  \ } } }	 Wn> t	 k
 rK| j
 |  | j d   | j   D  qB n X| | d	 |	 f   | <qB W  | S(   s8   return date, distance and name for the latest tag of revt
   latesttagsi    t   nullit   globalt   :c         3   s   |  ] }   | j    Vq d  S(   N(   t   rev(   t   .0t   p(   R9   (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pys	   <genexpr>   s    c         s   s   |  ] } | j    Vq d  S(   N(   R=   (   R>   R?   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pys	   <genexpr>   s    i   (   i    i    R:   (   R=   R*   t   tagst   tagtypet   dateR'   t   sortedt   maxt   parentst   KeyErrort   appendt   extend(
   R5   R6   t   cacheR=   t   todot   tR@   t   pdatet   pdistt   ptag(    (   R9   s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   getlatesttagsh   s.    
		
4,,c            s:   i     d  k r! t     n      f d   } | S(   Nc            s   |   k r~ i   |  < j  |   } xV | D]K } | j |  } | j | j |   } |  |  | <|   k r, Pq, q, Wn  |  |  k r  |  | Sy  | |  j   SWn t j k
 r d SXd S(   s   looks up all renames for a file (up to endrev) the first
        time the file is given. It indexes on the changerev and only
        parses the manifest if linkrev != changerev.
        Returns rename info for fn at changerev rev.N(   t   filet   linkrevt   renamedR4   t   errort   LookupErrorR   (   t   fnR=   t   flt   it   lrRR   (   t   endrevt   rcacheR5   (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   getrenamed   s    
(   R   t   len(   R5   RY   R[   (    (   RY   RZ   R5   s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   getrenamedfn   s
    c         K   s
   | j    S(   s8   :author: String. The unmodified author of the changeset.(   t   user(   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   showauthor   s    c         K   s   t  j |  | j    S(   s0   :bisect: String. The changeset bisection status.(   t   hbisectt   labelR4   (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   showbisect   s    c          K   s   |  d j    S(   sV   :branch: String. The name of the branch on which the changeset was
    committed.
    R6   (   t   branch(   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   showbranch   s    c          K   s9   |  d j    } | d k r5 t d | g d d |  Sd S(   s   :branches: List of strings. The name of the branch on which the
    changeset was committed. Will be empty if the branch name was
    default.
    R6   t   defaultRc   R   t   branchesN(   Rc   R   (   R   Rc   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showbranches   s    c          K   s    |  d j    } t d | |   S(   sR   :bookmarks: List of strings. Any bookmarks associated with the
    changeset.
    R6   t   bookmark(   t	   bookmarksR   (   R   Ri   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showbookmarks   s    c          K   sI   |  d } g  | j    D] } d | | f ^ q } t d | d d |  S(   s:   :children: List of strings. The children of the changeset.R6   s   %d:%st   childrenR   t   child(   Rk   R   (   R   R6   t   cctxt	   childrevs(    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showchildren   s    
)c         K   s
   | j    S(   sC   :date: Date information. The date when the changeset was committed.(   RB   (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showdate   s    c         K   s   | j    j   S(   s5   :desc: String. The text of the changeset description.(   t   descriptiont   strip(   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showdescription   s    c   
      K   sS   t  j t j | j     } t  j |  \ } } } } }	 d t |  | | f S(   st   :diffstat: String. Statistics of changes with the following format:
    "modified files: +added/-removed lines"
    s   %s: +%s/-%s(   t   patcht   diffstatdatat   utilt	   iterlinest   difft   diffstatsumR\   (
   R5   R6   R   R   t   statst   maxnamet   maxtotalt   addst   removest   binary(    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showdiffstat   s    c          k   sq   |  d } x` t  |  d j   j    D]B \ } } |  j   }  |  j t d | d |   | d |   Vq' Wd  S(   NR   R6   t   keyt   valuet   extra(   RC   R   t   itemsR)   R   R(   (   R   R   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   showextras   s
    
)c          K   sF   |  d |  d |  d } } } t  d t | | |  d d d |  S(   s;   :file_adds: List of strings. Files added by this changeset.R5   R6   R7   t   file_addi   R   RP   (   R   R8   (   R   R5   R6   R7   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showfileadds   s     c    
      K   s  |  d |  d } } |  d j  d  } | d k r d | k rW t |  d  | d <n  g  } | d } xL | j   D]; } | | | j    } | rt | j | | d f  qt qt Wn  g  | D]" } i | d d 6| d	 d
 6^ q } t d | d d |  }	 t |	 | d    S(   sZ   :file_copies: List of strings. Files copied in this changeset with
    their sources.
    RI   R6   R7   t   copiesR[   R5   i    R   i   t   sourcet	   file_copyR   t   file_copiesc         S   s   d |  d |  d f S(   Ns   %s (%s)R   R   (    (   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyR      s    N(   t   getR   R]   R1   R=   RG   R   R   (
   R   RI   R6   R   R[   RU   t   renameR   t   cR   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showfilecopies   s    
!/c          K   ss   |  d j  d  p g  } g  | D]" } i | d d 6| d d 6^ q  } t d | d d	 |  } t | | d
    S(   ss   :file_copies_switch: List of strings. Like "file_copies" but displayed
    only if the --copied switch is set.
    R7   R   i    R   i   R   R   R   R   c         S   s   d |  d |  d f S(   Ns   %s (%s)R   R   (    (   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyR     s    (   R   R   R   (   R   R   R   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showfilecopiesswitch  s    /c          K   sF   |  d |  d |  d } } } t  d t | | |  d d d |  S(   s=   :file_dels: List of strings. Files removed by this changeset.R5   R6   R7   t   file_deli   R   RP   (   R   R8   (   R   R5   R6   R7   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showfiledels
  s     c          K   sF   |  d |  d |  d } } } t  d t | | |  d d d |  S(   s>   :file_mods: List of strings. Files modified by this changeset.R5   R6   R7   t   file_modi    R   RP   (   R   R8   (   R   R5   R6   R7   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showfilemods  s     c          K   s   t  d |  d j   |   S(   sZ   :files: List of strings. All files modified, added, or removed by this
    changeset.
    RP   R6   (   R   R1   (   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt	   showfiles  s    c         K   s   t  |  | |  d S(   sW   :latesttag: String. Most recent global tag in the ancestors of this
    changeset.
    i   (   RO   (   R5   R6   R   RI   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showlatesttag  s    c         K   s   t  |  | |  d S(   s<   :latesttagdistance: Integer. Longest path to the latest tag.i   (   RO   (   R5   R6   R   RI   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showlatesttagdistance"  s    c          K   s{   |  d |  d |  d } } } |  j    }  |  j t d | j j | j   d  d t | j   d    | d |   S(   NR5   R6   R   R=   i    R4   t   manifest(   R)   R   R(   R   R=   t	   changesetR    (   R   R5   R6   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showmanifest&  s
     (c         K   s
   | j    S(   s\   :node: String. The changeset identification hash, as a 40 hexadecimal
    digit string.
    (   R    (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   shownode-  s    c         K   s   | j    j   S(   s   :p1rev: Integer. The repository-local revision number of the changeset's
    first parent, or -1 if the changeset has no parents.(   R3   R=   (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt	   showp1rev3  s    c         K   s   | j    j   S(   s   :p2rev: Integer. The repository-local revision number of the changeset's
    second parent, or -1 if the changeset has no second parent.(   t   p2R=   (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt	   showp2rev8  s    c         K   s   | j    j   S(   s   :p1node: String. 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.(   R3   R    (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   showp1node=  s    c         K   s   | j    j   S(   s   :p2node: String. 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.(   R   R    (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt
   showp2nodeC  s    c         K   s
   | j    S(   s)   :phase: String. The changeset phase name.(   t   phasestr(   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt	   showphaseI  s    c         K   s
   | j    S(   s.   :phaseidx: Integer. The changeset phase index.(   t   phase(   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showphaseidxM  s    c         K   s
   | j    S(   s>   :rev: Integer. The repository-local changeset revision number.(   R=   (   R5   R6   R   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showrevQ  s    c          K   s   t  d |  d j   |   S(   s?   :tags: List of strings. Any tags associated with the changeset.R   R6   (   R   R@   (   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   showtagsU  s    t   authort   bisectRc   Rf   Ri   Rk   RB   t   desct   diffstatt   extrast	   file_addsR   t   file_copies_switcht	   file_delst	   file_modsR1   t	   latesttagt   latesttagdistanceR   R4   t   p1revt   p1nodet   p2revt   p2nodeR   t   phaseidxR=   R@   c          K   s   d S(   s   :parents: List 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.N(    (   R   (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   _showparents  s    RE   (0   R4   R    Rt   Rv   RS   R`   t   objectR   R   R   R   R8   RO   R]   R_   Rb   Rd   Rg   Rj   Ro   Rp   Rs   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   keywordsR   t   dockeywordsR   R   t   i18nfunctions(    (    (    s8   /sys/lib/python2.7/site-packages/mercurial/templatekw.pyt   <module>   s   $?		! 																														
	
