
    g1c             	          d dl Z d dlZd dlZd dlZddlmZ ddlmZ ddlm	Z	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mZmZmZmZmZm Z m!Z"m#Z# ddl$m%Z%m&Z&m'Z' ej(        Z(ej)        Z)ej*        Z*ej+        Z+ej,        Z,ej-        Z-ej.        Z.ej/        Z/e j0        Z0e j1        Z1e j2        Z2e j3        Z3e
efZ4dZ5d	Z6d
Z7e6fdZ8d Z9d Z:d Z;d Z<d Z=d Z>d Z?d Z@d ZAd ZBd ZCd ZDd ZEd ZFd ZGd ZHd ZId ZJd ZKd ZLd  ZMd! ZNd" ZOd# ZPd$ ZQejR        ZR eS            ZT ejU                    ZV eVd%          d&             ZW eVd'          d(             ZX eVd)d*d+,          d-             ZY eVd.d*d/,          d0             ZZ	 dd2Z[ eVd3d*4          d5             Z\ eVd6d*4          d7             Z]d8 Z^d9 Z_ eVd:d*d;,          d<             Z` eVd=d*4          d>             Za eVd?d*4          d@             Zb eVdAd*4          dB             Zc eVdCd*d;,          dD             Zd eVdEd*4          dF             Ze eVdGd*4          dH             ZfdI ZgdJ Zh eVdKd*4          dL             Zi eVdMd*d;,          dN             Zj eVdOd*4          dP             Zk eVdQd*4          dR             Zl eVdSd*4          dT             Zm eVdUd*4          dV             Zn eVdWdXY          dZ             Zo eVd[d*4          d\             Zp eVd]d*d;,          d^             Zq eVd_d*d;,          d`             Zr	 ddaZs eVdbd*4          dc             Zt eVddd*4          de             Zu eVdfd*d;,          dg             Zv eVdhdiY          dj             Zw eVdkd*4          dl             Zx eVdmd*d*n          do             Zy eVdpd1dX,          dq             Zz eVdrd*4          ds             Z{ eVdtd*4          du             Z| eVdvd*4          dw             Z} eVdxd*d*d y          dz             Z~dd{Z eVd|d*4          d}             Z eVd~d*4          d             Z eVdd*4          d             Z eVd          d             Z eVdd*4          d             Z eVdd;Y          d             Z eVdd*4          d             Z eVdd*d;,          d             Z eVdd*4          d             Z eVdd*d*n          d             Z eVdd*4          d             Z eVdd*d;,          d             Z eVdd*d*d y          d             Z eVdd*d*n          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*d+,          d             Z eVd          d             Zd Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd1d;,          d             Z eVdd*4          d             Z eVdd*4          d             Zd Z eVdd*4          d             Zd Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z!d Z eVdd*d*n          dÄ             Z eVdd*4          dń             Z eVdd*4          dǄ             Z eVdd*4          dɄ             Z eVdd14          d˄             Z eVdd*d+,          d̈́             Z eVdd*4          dτ             Z eVdd*4          dф             Z eVdd*d*n          dӄ             ZU eVdd*4          dՄ             Z eVdd*d*d y          dׄ             Z eVdd*4          dل             ZdZe dz
  ZefdۄZej        d܄ d݄ dބ d߄ d ej        edZd Z eVdd*d*d;y          d             Z eVd          d             Zd Z eVdd*4          d             ZddZ eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*4          d             Z eVdd*d;,          d             Z eVdd*d ,          d             Zd Z eVdd*d*n          d             Zd Z eVdd*d*d y          d             Zd Z eVdd*d*n          d             Zi d e=de>de?de@deBde;de;deCdeDd	eGd
eHdeEdeIdeMdeNdeOdePeQe_eee<dZeKeKdZeLeLdZǐd ZȐddZddZɐd Zʐd Z eddeV           eR                                ZdS (      N   )_getattr)binnullrevwdirrev)dagopdestutildiffutilencodingerrorgrephbisectmatchobsoleteobsutilpathutilphasespycompat	registrarrepoview
revsetlangscmutilsmartsetstackutil)dateutil
stringutilurlutils   anys   define   followc                     |s!t          j        t          d                    t          |d                  | |g|dd          R d|iS )Ns   missing argumentr   r   order)r   
ParseErrorr   methodsreposubsetxr#   s       2/usr/lib/python3/dist-packages/mercurial/revset.pygetsetr+   p   sT     7q!4556661Q4=v;!"";;;U;;;    c                     | |                                          }dD ]>}||v r8	 | ||                                                  c S # t          j        $ r Y :w xY w?d S )N)   sources   transplant_sources   rebase_source)extrarevr   RepoLookupError)r'   rr/   labels       r*   _getrevsourcer4   v   s    GMMOOED  E>>E%L)--/////(    
 4s   AAAc                 Z    t          t          j        t          j        |                     S N)sortedr   rapplymaybebytestr)xss    r*   _sortedbr;      s    (/("7<<===r,   c                    |s!t          j        t          d                    t          j        t          j        | |                    }||v s|t          v r%t          |t                    rt          |g          S t                      S )Ns$   empty string is not a valid revision)
r   r$   r   r   intrev	revsymbol_virtualrevs
isinstancefullreposetbasesetr&   s       r*   	stringsetrC      s{     Kq!HIIJJJw(q1122AF{{a<''Jv{,K,K's||99r,   c                 ,    |t           k    r||z  S ||z  S )z1argument is already a smartset, use that directly)followorderr&   s       r*   rawsmartsetrF      s!    z6zr,   c                    t          | t          |           |          }t          | t          |           |          }|r|st                      S t          | ||                                |                                |          S r6   )r+   rA   rB   _makerangesetfirstlast)r'   r(   r)   yr#   mns          r*   rangesetrN      ss    t[&&**At[&&**A A yyvqwwyy!&&((EBBBr,   c                 ^    |J t          | |d| j                                        |          S Nr   )rH   	changelogtiprevr&   s       r*   rangeallrS      s/    999vq$.*?*?*A*A5IIIr,   c                     t          | t          |           |          }|st                      S t          | |d|                                |          S rP   )r+   rA   rB   rH   rJ   )r'   r(   rK   r#   rM   s        r*   rangeprerU      sK    t[&&**A yyvq!&&((E:::r,   c                     t          | t          |           |          }|st                      S t          | ||                                | j                                        |          S r6   )r+   rA   rB   rH   rI   rQ   rR   )r'   r(   r)   r#   rL   s        r*   	rangepostrW      s`    t[&&**A yyfaggii!6!6!8!8%  r,   c                    ||k    rt          |g          }n|t          k    r0t          | |t          |                     t          |g          z   }nw|t          k    r=t          |g          t          | | j                                        |dz
            z   }n/||k     rt          | ||dz             }nt          | ||dz
            }|t          k    r||z  S ||z  S Nr   )rB   r	   spansetlenrQ   rR   defineorder)r'   r(   rL   rM   r#   r2   s         r*   rH   rH      s    AvvQCLL	
gD!SYY'''1#,,6	
gQCLL74)>)>)@)@!a%HHH	
QD!QU##D!QU##6z zr,   c           	          t          |           }t          j        | t          | ||          t          | ||          d          }||z  S )NT)includepath)rA   r
   reachablerootsr+   )r'   r(   r)   rK   r#   r2   r:   s          r*   dagranger`      sS    DA		fT1a  &q!"4"4$
 
 
B B;r,   c           	      z    |t           k    rt           }nt          }t          | t          | |||          ||          S r6   anyorderrE   r+   r'   r(   r)   rK   r#   yorders         r*   andsetrf      s;    $tVQ666BBBr,   c           	      z    |t           k    rt           }nt          }t          | t          | |||          ||          S r6   rb   rd   s         r*   andsmallysetrh      s;    $tVQ77EBBBr,   c                 V    t          | |||          t          | ||t                    z
  S r6   r+   rc   r'   r(   r)   rK   r#   s        r*   differencesetrl      s)    $5))F4H,M,MMMr,   c                     |sJ t          |          dk    rt          | ||d         |          S t          |          dz  }t          | ||d |         |          }t          | |||d          |          }||z   S )Nr   r      )r[   r+   
_orsetlist)r'   r(   r:   r#   pabs          r*   ro   ro      s    III
2ww!||dFBqE5111B1A4BQB//A4ABB//Aq5Lr,   c                     t          |          }|st                      S |t          k    r'|t          | t	          |           |t
                    z  S t          | |||          S r6   )getlistrB   rE   ro   rA   rc   )r'   r(   r)   r#   r:   s        r*   orsetru      s_    	B yy
4T):):BIIII$E222r,   c                 6    |t          | ||t                    z
  S r6   rj   r&   s       r*   notsetrw      s    F4H5555r,   c                     t          |          }|t          v rt          |         | ||||          S d t                                          D             }t          j        ||          )Nc                 8    g | ]}t          |          d k    |S r   r[   .0r2   s     r*   
<listcomp>zrelationset.<locals>.<listcomp>	  s#    :::as1vvzzzzzr,   )	getsymbol	relationskeysr   UnknownIdentifier)r'   r(   r)   rK   r#   relrelnamess          r*   relationsetr     sd     A,,C
i~dFAsE:::::9>>++:::H

!#x
0
00r,   c                     d}d}| |cxk    rdk    rn nd}| dk     rt          |d           |  dz   f}|dk    rt          | d          |dz   f}||fS )a  Split range with bounds a and b into two ranges at 0 and return two
    tuples of numbers for use as startdepth and stopdepth arguments of
    revancestors and revdescendants.

    >>> _splitrange(-10, -5)     # [-10:-5]
    ((5, 11), (None, None))
    >>> _splitrange(5, 10)       # [5:10]
    ((None, None), (5, 11))
    >>> _splitrange(-10, 10)     # [-10:10]
    ((0, 11), (0, 11))
    >>> _splitrange(-10, 0)      # [-10:0]
    ((0, 11), (None, None))
    >>> _splitrange(0, 10)       # [0:10]
    ((None, None), (0, 11))
    >>> _splitrange(0, 0)        # [0:0]
    ((0, 1), (None, None))
    >>> _splitrange(1, -1)       # [1:-1]
    ((None, None), (None, None))
    NNr   )r   r   r   )minmax)rq   rr   	ancdepths
descdepthss       r*   _splitranger     sy    ( IJA{{{{{{{{{	1uu!QiiZ!a(	1uu!QiiQ'
j  r,   c                 .    d}t          | |||||          S )N)   rangeallN)generationssubrel)r'   r(   r)   r   r#   zs         r*   generationsrelr   ,  s    AT61c1e<<<r,   c                 2   t          |t          d          t          d          t          j        dz
   t          j        dz
  
           \  }}t	          ||          \  \  }}	\  }
}||
t                      S t          | t          |           |          }|st                      S |6|
4t          j        | |d||	          }|t          j	        | |d|
|          z  }n5|t          j        | |d||	          }n|
t          j	        | |d|
|          }||z  S )Ns0   relation subscript must be an integer or a ranges*   relation subscript bounds must be integersr   )deffirstdeflastF)
getintranger   r
   maxlogdepthr   rB   r+   rA   revancestorsrevdescendants)r'   r(   r)   r   r   r#   rq   rr   ancstartancstop	descstartdescstoprevsss                 r*   r   r   1  s=    		
=>>	
788$q()#a'(  DAq 2=Q1B1B.Xw.)XI-yy$D))1--D yy	 5tT5(GDD	U!$eYIII		tT5(GDD		 tUIxHHA:r,   c                     t          |          }|t          v rt          |         | |||||          S d t                                          D             }t          j        ||          )Nc                 8    g | ]}t          |          d k    |S rz   r{   r|   s     r*   r~   z#relsubscriptset.<locals>.<listcomp>W  s#    CCCaA




r,   )r   subscriptrelationsr   r   r   )r'   r(   r)   rK   r   r#   r   r   s           r*   relsubscriptsetr   O  sk     A,,C
   !#&tVQQFFFCC-2244CCCH

!#x
0
00r,   c                 D    t          j        t          d                    )Ns%   can't use a subscript in this contextr   r$   r   rk   s        r*   subscriptsetr   [  s    

1EFF
G
GGr,   c                 b    t          j        t          d          t          d                    )Ns    can't use a list in this contexts   see 'hg help "revsets.x or y"')hintr   )r'   r(   r:   optss       r*   listsetr   _  s4    

	
-..233   r,   c                 D    t          j        t          d                    )Ns*   can't use a key-value pair in this contextr   )r'   r(   kvr#   s        r*   keyvaluepairr   f  s    

1JKK
L
LLr,   c                     t          |          }|t          v r9t          |         }t          |dd          r || |||          S  || ||          S d fdt                                          D             }t	          j        ||          )N
_takeorderFc                 (    t          | dd           d uS )N__doc__r   )fns    r*   <lambda>zfunc.<locals>.<lambda>r  s    gb)T22$> r,   c                 0    g | ]\  }} |          |S  r   )r}   r   r   keeps      r*   r~   zfunc.<locals>.<listcomp>t  s*    999'1bR9A999r,   )r   symbolsr   itemsr   r   )	r'   r(   rq   rr   r#   ffuncsymsr   s	           @r*   r   r   j  s    !AG||qz4u-- 	04fa///tD&!$$$>>D9999W]]__999D

!!T
*
**r,   s   _destupdatec           
          t          |dd          }|t          t          j        | fi t	          j        |          d         g          z  S )N   limits   cleanr   )getargsdictrB   r   
destupdater   	strkwargs)r'   r(   r)   argss       r*   _destupdater     sW     q(H--DG		T	>	>X%7%=%=	>	>q	AB   r,   s
   _destmergec                     d }|t          | t          |           |          }|t          t          j        | |          g          z  S )N)	sourceset)r+   rA   rB   r   	destmerge)r'   r(   r)   r   s       r*   
_destmerger     sM     I}4T!2!2A66	GX/	JJJKLLLLr,   s   adds(pattern)T   )safeweightc                 `    t          |t          d                    }t          | ||d          S )zChangesets that add a file matching pattern.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file or a
    directory.
    s   adds requires a patternadded	getstringr   checkstatusr'   r(   r)   pats       r*   addsr     s0     Aq344
5
5CtVS'222r,   s   ancestor(*changeset)g      ?c                 |   t          t          | t          |           |t                              }	 | t	          |                   }n# t
          $ r t                      cY S w xY w|D ]}|                    | |                   }t          j	        |          }||v rt          |g          S t                      S )zA greatest common ancestor of the changesets.

    Accepts 0 or more changesets.
    Will return empty list when passed no args.
    Greatest common ancestor of a single changeset is that changeset.
    r#   )
iterru   rA   rc   nextStopIterationrB   ancestorr   r=   )r'   r(   r)   reviterancr2   s         r*   r   r     s     5{400!8DDDEEG4==!   yy $ $ll47##sAF{{s||99s   A
 
A%$A%Fc                     t          | t          |           |          }|st                      S t          j        | ||||          }||z  S r6   )r+   rA   rB   r
   r   )r'   r(   r)   followfirst
startdepth	stopdepthheadsr   s           r*   
_ancestorsr     sQ     4T**A..E yy4ZKKAA:r,   s   ancestors(set[, depth]))r   c                    t          |dd          }d|vr!t          j        t          d                    dx}}d|v r2t	          |d         d          }|dk     rt          j        d	          |}d
|v rOt	          |d
         t          d                    }|dk     r!t          j        t          d                    |dz   }t          | ||d         ||          S )zChangesets that are ancestors of changesets in set, including the
    given changesets themselves.

    If depth is specified, the result only includes changesets up to
    the specified generation.
    s	   ancestors   set depth startdepth   sets#   ancestors takes at least 1 argumentN
   startdepths'   ancestors expects an integer startdepthr      negative startdepth   depths"   ancestors expects an integer depth   negative depthr   r   r   )r   r   r$   r   
getintegerr   r'   r(   r)   r   r   r   rM   s          r*   	ancestorsr     s    q,(?@@DTq!GHHIII!!J!K
 
 q55"#9:::
4tH~q)N'O'OPPq55"1%6#7#7888E	fd6lzY   r,   s   _firstancestorsc                 (    t          | ||d          S NTr   )r   r'   r(   r)   s      r*   _firstancestorsr     s     dFA48888r,   c                    t                      }t          | t          |           |          D ]}t          |          D ]}| |                                         }t          |          dk    r ndt          |          dk    r!t          j        t          d                    |d         	                                }|
                    |           ||z  S )zAChangesets that are the Nth child of a changeset
    in set.
    r   r   s'   revision in set has more than one child)setr+   rA   rangechildrenr[   r   r1   r   r0   add)	r'   r(   r)   rM   r#   csr2   ics	            r*   _childrenspecr     s     
BD+d++Q//  q 
	 
	AQ  ""A1vv{{1vvzz+@AA   !

AAFF1IIIB;r,   c                    t          |t          d                    }|dk     rt          | ||| |          S t                      }| j        }t          | t          |           |          D ]}t          |          D ]_}	 |                    |          d         }# t          j
        $ r/ | |                                                                         }Y \w xY w|                    |           ||z  S )zg``set~n``
    Changesets that are the Nth ancestor (first parents only) of a changeset
    in set.
    s   ~ expects a numberr   )r   r   r   r   rQ   r+   rA   r   
parentrevsr   WdirUnsupportedp1r0   r   )	r'   r(   r)   rM   r#   psclr2   r   s	            r*   ancestorspecr     s    
 	1a-..//A1uuT61qb%888	B	BD+d++Q//  q 	' 	'A'MM!$$Q'( ' ' 'GJJLL$$&&'
q				B;s   ?B;CCs   author(string)
   c                      t          |t          d                    }t          |d          \  }}|                     fdd|f          S )zAlias for ``user(string)``.s   author requires a stringFcasesensitivec                 J     |                                                     S r6   user)r)   matcherr'   s    r*   r   zauthor.<locals>.<lambda>   s    ''$q',,..)) r,   s	   <user %r>condreprr   r   _substringmatcherfilter)r'   r(   r)   rM   kindpatternr  s   `     @r*   authorr    sh     	!Q23344A.qFFFD'7==)))))\14E    r,   s   bisect(string)c                     t          |t          d                                                    }t          t	          j        | |                    }||z  S )a	  Changesets marked in the specified bisect status:

    - ``good``, ``bad``, ``skip``: csets explicitly marked as good/bad/skip
    - ``goods``, ``bads``      : csets topologically good/bad
    - ``range``              : csets taking part in the bisection
    - ``pruned``             : csets that are goods, bads or skipped
    - ``untested``           : csets whose fate is yet unknown
    - ``ignored``            : csets ignored due to DAG topology
    - ``current``            : the cset currently being bisected
    s   bisect requires a string)r   r   lowerr   r   get)r'   r(   r)   statusstates        r*   bisectr  $  sK     q!78899??AAFD&))**EE>r,   s   bisectedc                 $    t          | ||          S r6   )r  r   s      r*   bisectedr  8  s    $"""r,   s   bookmark([name])c                 n    t          |ddt          d                    }|r^t          |d         t          d                    }t          j        |          \  }}}t                      }|dk    r||k    r j                            |          } j                            |d          }	|	s$t          j
        t          d          |z            |                     |	                                                    nt                      }
 j                                        D ]%\  }}	 ||          r|
                    |	           &|
D ]/}	|                     |	                                                    0n% fd j                                        D             }|t          hz  }||z  S )	z{The named bookmark or all bookmarks.

    Pattern matching is supported for `name`. See :hg:`help revisions.patterns`.
    r   r   s"   bookmark takes one or no argumentss)   the argument to bookmark must be a string   literalNs   bookmark '%s' does not existc                 D    h | ]}|                                          S r   r0   r}   r2   r'   s     r*   	<setcomp>zbookmark.<locals>.<setcomp>^  s%    ???tAw{{}}???r,   )getargsr   r   r   stringmatcherr   
_bookmarks
expandnamer  r   r1   r   r0   r   valuesr   )r'   r(   r)   r   bmr  r  r  bmsbmrev	matchrevsnames   `           r*   bookmarkr(  =  s    1aACDDEED @G:;;
 

 ",!9"!=!=gwee:W}}/44W==O''66E +566@   GGDKOO%%&&&&I#4466 ) )e74== )MM%(((" + +U))****+ @???do&<&<&>&>???G9CC<r,   s   branch(string or set)c                    	
                                   j        		 fd
	 t          |d          t          j                  \  }}|dk    r~                                                     |          r|                    
fddf          S                     d          r$t          j
        t          d          |z            n2|                    
fd	df          S # t          j        $ r Y nw xY wt           t                     |          }t                      |D ] }                     
|                     !|j        |                    
fd
fd          S )z
    All changesets belonging to the given branch or the branches of the given
    changesets.

    Pattern matching is supported for `string`. See
    :hg:`help revisions.patterns`.
    c                     	  |           d         S # t           j        $ r |                                          cY S w xY wrP   )r   r   branch)r2   getbir'   s    r*   	getbranchzbranch.<locals>.getbranchn  sR    	$588A;$ 	$ 	$ 	$7>>#####	$s    )A A r,   r  c                 ,      |                     S r6   r   r2   r-  r  s    r*   r   zbranch.<locals>.<lambda>  s    ggiill33 r,      <branch %r>r  s   literal:s   branch '%s' does not existc                 ,      |                     S r6   r   r/  s    r*   r   zbranch.<locals>.<lambda>  s    ''))A,,// r,   c                 4     |           p |           v S r6   r   )r2   rr   r   r-  s    r*   r   zbranch.<locals>.<lambda>  s!    !!A$$+))A,,!+ r,   c                  (    dt                     z  S )Nr0  r;   )rr   s   r*   r   zbranch.<locals>.<lambda>  s    (1++5 r,   )revbranchcache
branchinfor   r   r  	branchmap	hasbranchr  
startswithr   r1   r   r$   r+   rA   r   r   __contains__)r'   r(   r)   r  r  r   r2   rr   r   r,  r-  r  s   `      @@@@@r*   r+  r+  c  s    !!,E$ $ $ $ $ $a
 ",!9!!<!<gw: ~~))'22 }}33333,a0 %    ||K(( +344w>  
 ==/////>1:M !   %    , 	t[&&**AA  	iill	A==++++++5555    s   C0 0DDs   phasedivergent()c                 t    t          |ddt          d                     t          j        | d          }||z  S )zMutable changesets marked as successors of public changesets.

    Only non-public and non-obsolete changesets can be `phasedivergent`.
    (EXPERIMENTAL)
    r   s!   phasedivergent takes no arguments   phasedivergentr  r   obsmodgetrevs)r'   r(   r)   phasedivergents       r*   r@  r@    s>     Aq!Q;<<===^D*;<<NN""r,   s   bundle()c                     	 | j         j        }n/# t          $ r" t          j        t          d                    w xY w||z  S )zIChangesets in the bundle.

    Bundle must be specified by the -R option.s$   no bundle provided - specify with -R)rQ   
bundlerevsAttributeErrorr   Abortr   )r'   r(   r)   rB  s       r*   bundlerE    sW    F^.

 F F Fk!CDDEEEFJs    ,;c                      t          j                  dk    dg fd}|                    |dt          j                  f          S )zuHelper for status-related revsets (adds, removes, modifies).
    The field parameter says which kind is desired.
    r   Nc                    	|          }d         rr3t          j        	j        	                                g|          d<   d         d }J                                 s?t                                                    dk    r                                d         }|||                                vrdS n/t          fd|                                D                       sdS t          		                    |
                                                                |                                                    }|||v rdS d S t          fd|D                       rdS d S )Nr   ctxr   Fc              3   .   K   | ]} |          V  d S r6   r   r}   r   rL   s     r*   	<genexpr>z/checkstatus.<locals>.matches.<locals>.<genexpr>  s+      //qqtt//////r,   Tc              3   .   K   | ]} |          V  d S r6   r   rK  s     r*   rL  z/checkstatus.<locals>.matches.<locals>.<genexpr>  s+      ''A11Q44''''''r,   )matchmodr   rootgetcwdanypatsr[   filesanyr   r  r   node)
r)   r   fnamerR  rL   fieldhassetmcacher   r'   s
       @r*   matcheszcheckstatus.<locals>.matches  sw   Gay 	OF 	O ty$++--#ANNNF1I1I}}}yy{{ 	!s17799~~22GGIIaLEAGGII%%u & ////QWWYY///// uADDFFKKMM16688<<eDD~~t ~ ''''''''' t r,   s   <status.%s %r>r  )rN  patkindr  r   sysbytes)r'   r(   r   rV  rY  rW  rX  s   ` `` @@r*   r   r     s     c""f,FVF        0 ==,h.?.F.FL    r,   c                 J   |st                      S t                      }| j        j        }|                                }|D ]T}||k    r	 ||          \  }}||v r|                    |           |t          k    r||v r|                    |           Ut          |          S r6   )rB   r   rQ   r   r   r   r   )	r'   r(   	parentsetr   prminrevr2   r   p2s	            r*   	_childrenra    s     yy	B		"B]]__F  ;;AB??FF1III==R9__FF1III2;;r,   s   children(set)c                 j    t          | t          |           |          }t          | ||          }||z  S )z&Child changesets of changesets in set.)r+   rA   ra  )r'   r(   r)   r   r   s        r*   r   r     s8     	t[&&**A	4	#	#BB;r,   s   closed()c                 v     t          |ddt          d                     |                     fdd          S )zChangeset is closed.r   s   closed takes no argumentsc                 8    |                                           S r6   )closesbranchr2   r'   s    r*   r   zclosed.<locals>.<lambda>  s    $q'&&(( r,   s   <branch closed>r  )r  r   r  r   s   `  r*   closedrg    sL     Aq!Q344555==((((3E    r,   s   _commonancestorheads(set)c                     t          | t          |           |t                    } | j        j        t          |           }|t          |          z  S )Nr   )r+   rA   rc   rQ   _commonancestorsheadslistrB   )r'   r(   r)   	startrevsancss        r*   _commonancestorheadsrm    sJ     t[..BBBI/4>/iADGDMM!!r,   s   commonancestors(set)c                     t          | t          |           |t                    }|st                      S |D ](}|t	          j        | t          |g                    z  })|S )z8Changesets that are ancestors of every changeset in set.r   )r+   rA   rc   rB   r
   r   )r'   r(   r)   rk  r2   s        r*   commonancestorsro    si     t[..BBBI yy 9 9%$T7A3<<888Mr,   s   conflictlocal()c                 H   t          |ddt          d                     ddlm} |j                            |           }|                                rB| j                            |j                  r#|| j        	                    |j                  hz  S t                      S )zThe local side of the merge, if currently in an unresolved merge.

    "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.
    r   s    conflictlocal takes no argumentsr   
mergestate)r  r    rr  readactiverQ   hasnodelocalr0   rB   r'   r(   r)   mergestatemodrr  s        r*   conflictlocalrz         Aq!Q:;;<<<------)..t44J ?t~55j6FGG ?++J,<==>>>99r,   s   conflictother()c                 H   t          |ddt          d                     ddlm} |j                            |           }|                                rB| j                            |j                  r#|| j        	                    |j                  hz  S t                      S )zThe other side of the merge, if currently in an unresolved merge.

    "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'.
    r   s    conflictother takes no argumentsr   rq  )r  r   rs  rr  rt  ru  rQ   rv  otherr0   rB   rx  s        r*   conflictotherr~  "  r{  r,   s   contains(pattern)d   )r   c                 ~     t          |t          d                     fd}|                    |df          S )a<  The revision's manifest contains a file matching pattern (but might not
    modify it). See :hg:`help patterns` for information about file patterns.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file exactly
    for efficiency.
    s   contains requires a patternc                 ^   t          j                  s:t          j        j                                                  }||          v rdS n]|          }t          j        j                                        g|          }|                                D ]} ||          r dS dS )NTrH  F)rN  rZ  r   	canonpathrO  rP  r   manifest)r)   patsr   rL   r   r   r'   s        r*   rY  zcontains.<locals>.matches>  s    $$ 		 %diDDDtAwt  QAty$++--#AFFFAZZ\\    1Q44  44 ur,   s   <contains %r>r  )r   r   r  )r'   r(   r)   rY  r   s   `   @r*   containsr  2  sZ     Aq788
9
9C      ==,<c+B=CCCr,   s   converted([id])c                      dt          |ddt          d                    }|r#t          |d         t          d                     fd|                    fddf	          S )
zChangesets converted from the given identifier in the old repository if
    present, or all converted changesets if no identifier is specified.
    Nr   r   s#   converted takes one or no argumentss   converted requires a revisionc                     |                                                               dd           }|d uod u p|                              S )Ns   convert_revision)r/   r  r9  )r2   sourcer'   r0   s     r*   _matchvaluezconverted.<locals>._matchvalue^  sL    a$$%8$??T!Msd{'Lf6G6G6L6LMr,   c                      |           S r6   r   r2   r  s    r*   r   zconverted.<locals>.<lambda>c      ++a.. r,   s   <converted %r>r  )r  r   r   r  )r'   r(   r)   lr  r0   s   `   @@r*   	convertedr  N  s     C1aABBCCA C!a @AABBN N N N N N ==    ,=s+C    r,   s   date(interval)c                      t          |t          d                    }t          j        |          |                     fdd|f          S )z5Changesets within the interval, see :hg:`help dates`.s   date requires a stringc                 V     |                                           d                   S rP   date)r)   dmr'   s    r*   r   zdate.<locals>.<lambda>n  s"    ""T!W\\^^A&'' r,   s	   <date %r>r  )r   r   r   	matchdater  )r'   r(   r)   dsr  s   `   @r*   r  r  g  s_     
1a122	3	3B		B		B=='''''<2D    r,   s   desc(string)c                      t          |t          d                    }t          |d          \  }}|                     fdd|f          S )zSearch commit message for string. The match is case-insensitive.

    Pattern matching is supported for `string`. See
    :hg:`help revisions.patterns`.
    s   desc requires a stringFr  c                 J     |                                                     S r6   description)r2   r  r'   s    r*   r   zdesc.<locals>.<lambda>  s!    ''$q'--//00 r,   s	   <desc %r>r  r
  )r'   r(   r)   r  r  r  r  s   `     @r*   descr  r  sh     
1a122	3	3B.rGGGD'7==00000L";M    r,   c                     t          | t          |           |          }|st                      S t          j        | ||||          }||z  S r6   )r+   rA   rB   r
   r   )r'   r(   r)   r   r   r   rootsr   s           r*   _descendantsr    sQ     4T**A..E yyT5+z9MMAA:r,   s   descendants(set[, depth])c                    t          |dd          }d|vr!t          j        t          d                    dx}}d|v r2t	          |d         d          }|dk     rt          j        d	          |}d
|v rOt	          |d
         t          d                    }|dk     r!t          j        t          d                    |dz   }t          | ||d         ||          S )zChangesets which are descendants of changesets in set, including the
    given changesets themselves.

    If depth is specified, the result only includes changesets up to
    the specified generation.
    s   descendantsr   r   s%   descendants takes at least 1 argumentNr   s)   descendants expects an integer startdepthr   r   r   s$   descendants expects an integer depthr   r   r   )r   r   r$   r   r   r  r   s          r*   descendantsr    s    q.*ABBDTq!IJJKKK!!J!M
 
 q55"#9:::
4NAEFF
 
 q55"1%6#7#7888E	fd6lzY   r,   s   _firstdescendantsc                 (    t          | ||d          S r   )r  r   s      r*   _firstdescendantsr    s     faT::::r,   s   destination([set])c                    |t          | t          |           |          }nt          |           }t                      |D ]m}t          | |          }d}|W|t	                      }|                    |           ||v s|v r                    |           n|}t          | |          }|Wn|                    j        fd          S )zChangesets that were created by a graft, transplant or rebase operation,
    with the given revisions specified as the source.  Omitting the optional set
    is the same as passing all().
    Nc                  (    dt                     z  S )Ns   <destination %r>r4  )destss   r*   r   zdestination.<locals>.<lambda>  s    ,x> r,   r  )	r+   rA   r   r4   rj  appendupdater  r:  )r'   r(   r)   sourcesr2   srclineager  s          @r*   destinationr    s     	}{400!44d##EEE  ) )D!$$o&&NN1 g~~W%%%Aa((C# o& ==>>>>    r,   s   diffcontains(pattern)n   c                   	 t          |dd          }d|vr!t          j        t          d                    t	          |d         t          d                    }t          j        |t          j                  }t          j
                    fdt          j        | j        | |d          		fd}|                    |d	|f
          S )zSearch revision differences for when the pattern was added or removed.

    The pattern may be a substring literal or a regular expression. See
    :hg:`help revisions.patterns`.
    s   diffcontainss   patterns&   diffcontains takes at least 1 arguments&   diffcontains requires a string patternc                     S r6   r   )rI  fmatchs    r*   makefilematcherz%diffcontains.<locals>.makefilematcher  s    r,   T)diffc                     d}                     t          | g                    D ],\  }}}}t          t          j        ||          d           rd}-|S )NFT)searchfilesrB   r   grepmoddifflinestates)r0   foundr   rI  pstatesstatesr  searchers         r*   testdiffzdiffcontains.<locals>.testdiff  si    (0(<(<SENNO)
 )
 	 	$BWf G*7F;;TBB r,   s   <diffcontains %r>r  )r   r   r$   r   r   r   substringregexpreMrN  alwaysr  grepsearcheruir  )
r'   r(   r)   r   r  regexpr  r  r  r  s
          @@@r*   diffcontainsr    s     q/:66Dq!JKKLLLZ!EFF G '66F _F     #DGT6EEEH      ==-A7,K=LLLr,   s   contentdivergent()c                 t    t          |ddt          d                     t          j        | d          }||z  S )zh
    Final successors of changesets with an alternative set of final
    successors. (EXPERIMENTAL)
    r   s#   contentdivergent takes no arguments   contentdivergentr=  )r'   r(   r)   contentdivergents       r*   r  r    s@     Aq!Q=>>???~d,?@@$$$r,   s   expectsize(set[, size]))r   	takeorderc                    t          |dd          }d}t          |           dz   }d}d|vsd|vr!t          j        t	          d                    t          |d         t	          d	          t	          d
          ||          \  }}|dk     s|dk     r!t          j        t	          d                    t          | t          |           |d         |          }||k    rIt          |          |k     st          |          |k    r#t	          d          ||t          |          fz  }n:||k    r4t          |          |k    r!t	          d          |t          |          fz  }|rt          j        |          |t          k    r||z  S ||z  S )a  Return the given revset if size matches the revset size.
    Abort if the revset doesn't expect given size.
    size can either be an integer range or an integer.

    For example, ``expectsize(0:1, 3:5)`` will abort as revset size is 2 and
    2 is not between 3 and 5 inclusive.s
   expectsizes   set sizer   r   r,   s   sizer   s   invalid set of argumentss6   expectsize requires a size range or a positive integers"   size range bounds must be integerss   negative sizer   s8   revset size mismatch. expected between %d and %d, got %ds)   revset size mismatch. expected %d, got %d)
r   r[   r   r$   r   r   r+   rA   r1   rE   )	r'   r(   r)   r#   r   minsizemaxsizeerrr0   s	            r*   
expectsizer    s    q-55DG$ii!mG
CdfD00q!<==>>>"W	
CDD	
/00 GW {{gkkq!122333
{4(($v,e
D
D
DC's3xx'11SXX5G5GKLLHHP
 

 
G		CG 3 3<==HHA
 
  )#C(((|V|r,   s   extdata(source)c                     t          |dd          }t          |                    d          t          d                    }t	          j        | |          }|t          |          z  S )z:Changesets in the specified extdata source. (EXPERIMENTAL)s   extdatar.   s(   extdata takes at least 1 string argument)r   r   r  r   r   extdatasourcerB   )r'   r(   r)   r   r  datas         r*   extdatar  H  sd     q*i00D	
566 F
  v..DGDMM!!r,   s	   extinct()c                 t    t          |ddt          d                     t          j        | d          }||z  S )zBObsolete changesets with obsolete descendants only. (EXPERIMENTAL)r   s   extinct takes no argumentss   extinctr=  )r'   r(   r)   extinctss       r*   extinctr  V  s=     Aq!Q455666~dJ//HHr,   s   extra(label, [value])c                     t          |dd          }d|vr!t          j        t          d                    t	          |d         t          d                    dd|v r;t	          |d         t          d                    t          j                  \  } fd	|                    fd
df          S )zChangesets with the given label in the extra metadata, with the given
    optional value.

    Pattern matching is supported for `value`. See
    :hg:`help revisions.patterns`.
    s   extras   label values   labels   extra takes at least 1 arguments(   first argument to extra must be a stringNs   values)   second argument to extra must be a stringc                 j    |                                           }|v od u p |                   S r6   )r/   )r2   r/   r3   r  r'   values     r*   r  zextra.<locals>._matchvaluex  s:    Q~J5D=#IGGE%L4I4IJr,   c                      |           S r6   r   r  s    r*   r   zextra.<locals>.<lambda>}  r  r,   s   <extra[%r] %r>r  )r   r   r$   r   r   r   r  r  )	r'   r(   r)   r   r  r  r3   r  r  s	   `    @@@@r*   r/   r/   _  s    q(N33Dtq!CDDEEEXEFF E E4NAJKK
 
  *7>>eWK K K K K K K K ==    ,=ue+L    r,   s   filelog(pattern)c                 .   t          |t          d                    }t                      }| j        }t	          j        |          s1t          j        | j        | 	                                |          }|g}nJt	          j
        | j        | 	                                |g| d                   fd| d         D             }|D ]K}|                     |          }i }	d}
t          |          D ]}|                    |          }||	v r|                    |	|                    8|                    |          }||v r|                    |           g|
t!          ||
          dz   }d}
|                    |          D ]}||                    |          v rq||                    |          v rZ	 | |                             |          }||	vr$||k    r|                    |           |}
 n||	|<   u# t*          j        $ r Y w xY w M||z  S )a  Changesets connected to the specified filelog.

    For performance reasons, visits only revisions mentioned in the file-level
    filelog, rather than filtering through all changesets (much faster, but
    doesn't include deletes or duplicate changes). For a slower, more accurate
    result, use ``file()``.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file exactly
    for efficiency.
    s   filelog requires a patternNrH  c              3   2   K   | ]} |          |V  d S r6   r   rK  s     r*   rL  zfilelog.<locals>.<genexpr>  s0      //q!!A$$///////r,   r   r   )r   r   r   rQ   rN  rZ  r   r  rO  rP  r   filerj  rT  r   linkrevr   r   revision	readfilesfilenoder   ManifestLookupError)r'   r(   r)   r   r   r   r   rR  flknownscanposfrr   lrstartr2   rM   rL   s                    @r*   filelogr    s-    Aq677
8
8CA	BC   0ty$++--==N49dkkmmcUT
KKK////DJ/// !% !%YYq\\r(( 	% 	%BBU{{eBi   BBRxxb				$ B((1, % %ABKKNN**qBLLOO/C/C% $Q 0 0 3 3A ~~#$77$%EE!HHH./G$)E/0E!H$8 % % %$H%7	%> A:s   4<G82G88H
		H
	s   first(set, [n]))r   r  r   c                 &    t          | |||          S )zAn alias for limit().)limitr&   s       r*   rI   rI     s     vq%(((r,   c                    t          ||d          }d }d|v r$t          | t          |           |d                   }d|v rt          |d         t	          d          |z            }|d g}g }|D ]}| |         x}	|| d         t          j        | j        |                                 |g|	d          }
|	                    fd
                                                    |
          D                        t          j        ||          }n@|(t          | d                                         g          }t          j        | ||          }||z  S )	Ns   file startrev   startrev   files   %s expected a pattern   .s   path)rI  defaultc              3   L   K   | ]}|                                          V  d S r6   )introfilectx)r}   r   rI  s     r*   rL  z_follow.<locals>.<genexpr>  s3      OO1Q,,..OOOOOOr,   )r   r+   rA   r   r   rN  r   rO  rP  extendr  walkr
   filerevancestorsrB   r0   r   )r'   r(   r)   r'  r   r   r   fctxsr2   mctxrL   r   rI  s               @r*   _followr    so   q$ 011DDddK--tK/@AA$d7mQ'?%@%@4%GHH<6D 	P 	PAa C$y4j	4;;==1#4  A LLOOOO8K8KA8N8NOOOOOOO"5+66<DJNN,,-..DtT;77A:r,   s   follow([file[, startrev]])c                 &    t          | ||d          S )z
    An alias for ``::.`` (ancestors of the working directory's first parent).
    If file pattern is specified, the histories of files matching given
    pattern in the revision given by startrev are followed, including copies.
    r!   r  r   s      r*   followr    s     4I...r,      _followfirstc                 *    t          | ||dd          S )Nr  Tr   r  r   s      r*   _followfirstr    s    
 4OFFFFr,   s?   followlines(file, fromline:toline[, startrev=., descend=False])c           	         t          |dd          }t          |d                   dk    r!t          j        t	          d                    d}d|v rlt          | t          |           |d                   }t          |          dk    r!t          j        t	          d                    |                                }t          |d	         t	          d
                    }t	          d          }t          j
        | |||          }t          j        t          |d         d         t	          d          t	          d                     \  }	}
| |                             |          }d}d|v r#t          |d         t	          d                    }|r0t!          d t#          j        ||	|
          D             d          }n/t!          d t#          j        ||	|
          D             d          }||z  S )a  Changesets modifying `file` in line range ('fromline', 'toline').

    Line range corresponds to 'file' content at 'startrev' and should hence be
    consistent with file size. If startrev is not specified, working directory's
    parent is used.

    By default, ancestors of 'startrev' are returned. If 'descend' is True,
    descendants of 'startrev' are returned though renames are (currently) not
    followed in this direction.
    s   followliness   file *lines startrev descends   linesr   s!   followlines requires a line ranger  r  s(   followlines expects exactly one revisionr  s   followlines requires a patterns$   followlines expects exactly one filer   s,   followlines expects a line number or a ranges"   line range bounds must be integersFs   descends"   descend argument must be a booleanc              3   D   K   | ]\  }}|                                 V  d S r6   r  r}   r   
_lineranges      r*   rL  zfollowlines.<locals>.<genexpr>(  B        !Az      r,   T)iterascc              3   D   K   | ]\  }}|                                 V  d S r6   r  r  s      r*   rL  zfollowlines.<locals>.<genexpr>2  r  r,   )r   r[   r   r$   r   r+   rA   rJ   r   r   parsefollowlinespatternr   processlineranger   filectx
getbooleangeneratorsetr
   blockdescendantsblockancestors)r'   r(   r)   r   r0   r   r   msgrU  fromlinetolinefctxdescendrss                 r*   followlinesr    s/    q.*IJJD
4>aq!EFFGGG
CddK--tK/@AAt99>>"=>>   iikk
DM1%F#G#G
H
HC
3
4
4C+D#sC@@E,	N1=>>344	

 

Hf 9U##DGT344
 

  
 %*%;(F& &   
 
 
  %*%9(F& &   
 
 
 B;r,   s   nodefromfile(path)c                    t          |t          d                    }t                      }	 t          j        |d          5 }|D ]=}|                                }t          | |          }||                    |           >	 ddd           n# 1 swxY w Y   nS# t          $ rF}	t          d          }
|
|t          j
        |	j                  fz  }
t          j        |
          d}	~	ww xY w|t          |          z  S )zRead a list of nodes from the file at `path`.

    This applies `id(LINE)` to each line of the file.

    This is useful when the amount of nodes you need to specify gets too large
    for the command line.
    s    nodefromfile require a file pathrbNs   cannot open nodes file "%s": %s)r   r   r   r   openstrip_noder   IOErrorr   
strtolocalstrerrorr   rD  rB   )r'   r(   r)   path
listed_revr   linerM   rnexcrL   s              r*   nodefromfiler  =  sC    Q=>>??DJ
]4&& 	'! ' 'JJLL4^^>NN2&&&	'	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'    011	dH'5566k!nn GJ''''s=   B ABB BB BB 
C,&AC''C,s   all()c                 d    t          |ddt          d                     |t          |           z  S )z&All changesets, the same as ``0:tip``.r   s   all takes no arguments)r  r   rZ   r   s      r*   getallr  V  s2     Aq!Q011222GDMM!!r,   s   grep(regex)c                 J    	 t          j        t          |t          d                              nM# t           j        $ r;}t	          j        t          d          t          j        |          z            d}~ww xY w fd}|                    |dj	        f          S )zLike ``keyword(string)`` but accepts a regex. Use ``grep(r'...')``
    to ensure special escape characters are handled correctly. Unlike
    ``keyword(string)``, the match is case-sensitive.
    s   grep requires a strings   invalid match pattern: %sNc                     |          }|                                 |                                |                                gz   D ]}                    |          r dS dS NTF)rR  r  r  search)r)   r   egrr'   s      r*   rY  zgrep.<locals>.matchesl  s`    Gaffhh88 	 	Ayy|| ttur,   s	   <grep %r>r  )
r  compiler   r   r   r$   r   forcebytestrr  r  )r'   r(   r)   r#  rY  r$  s   `    @r*   r   r   ^  s    
Z	!Q'@%A%ABBCC8 
 
 
*++j.Ea.H.HH
 
 	


      ==L"*+E=FFFs   /4 A>6A99A>s   _matchfilesc           	         	
 t          |ddd          }g g g c
d\  	|D ]}t          |d          }|d d         |dd          }}|dk    r                    |           B|dk    r                    |           ^|d	k    r
                    |           z|d
k    r't          j        d          |dk    rt
          ||dk    r	t          j        d          |	t          j        d|z            	sd	t          d z   
z   D                       d g j        j        	
 f	d}|	                    |d
	f          S )Nr   s*   _matchfiles requires at least one argumentr   s%   _matchfiles requires string argumentsrn      p:s   i:s   x:s   r:s)   _matchfiles expected at most one revisionr,   s   d:s-   _matchfiles expected at most one default modes   invalid _matchfiles prefix: %ss   globc              3   F   K   | ]}t          j        |          d k    V  dS )r   N)rN  rZ  r}   rp   s     r*   rL  z_matchfiles.<locals>.<genexpr>  s2      II1!!$$.IIIIIIr,   c           	      :  	 | t           k    r|                                          }n |           }
d         rrCA| n}t          j        j                                        	|                   
d<   
d         }|D ]} ||          r dS dS )Nr   )includeexcluderI  r  TF)r	   rR  rN  r   rO  rP  )r)   rR  r2   rL   r   r  r  getfilesrW  incrX  r  r'   r0   s        r*   rY  z_matchfiles.<locals>.matches  s    <<GMMOOEEHQKKEay 
	V 
	[cA 	G  F1I 1I 	 	Aqtt ttur,   sC   <matchfiles patterns=%r, include=%r exclude=%r, default=%r, rev=%r>r  )
r  r   r  r   r$   r	   rS  rQ   r  r  )r'   r(   r)   r  argr   prefixr  rY  r  r  r/  rW  r0  rX  r  r0   s   `        @@@@@@@@r*   _matchfilesr3  v  s    	1bGHHARND#sLC O OcCDD"1"quU??KKu__JJuu__JJuu__&@   ||u__"&D   GG"#Dv#MNNN IIs
S8HIIIIIFVF ~'H            0 ==/
    r,   s   file(pattern)c                 h    t          |t          d                    }t          | |dd|z   f          S )zChangesets affecting files matched by pattern.

    For a faster but less accurate result, consider using ``filelog()``
    instead.

    This predicate uses ``glob:`` as the default kind of pattern.
    s   file requires a pattern   stringr)  )r   r   r3  r   s       r*   hasfiler6    s7     Aq344
5
5CtVi%=>>>r,   s   head()c                 $   t          |ddt          d                     t                      }| j        |                                                                 D ]#}|                    fd|D                        $|t          |          z  S )z!Changeset is a named branch head.r   s   head takes no argumentsc              3   B   K   | ]}                     |          V  d S r6   r  )r}   hr   s     r*   rL  zhead.<locals>.<genexpr>  s-      (("&&))((((((r,   )r  r   r   rQ   r7  	iterheadsr  rB   )r'   r(   r)   hslsr   s        @r*   headr=    s     Aq!Q122333	B	Bnn((** ) )
		((((R(((((((GBKKr,   s
   heads(set)c                    |t           k    rt          }t          | t          |           ||          }d}t          |v rMd | d                                         D             }t          |          }|                    t                     | j        	                    |          }|/|
                    |           |                    t                     t          |          }||z  S )z'Members of set with no children in set.r   Nc                 6    g | ]}|                                 S r   r  r+  s     r*   r~   zheads.<locals>.<listcomp>  s     ===1quuww===r,   )r\   rE   r+   rA   r	   parentsr   discardrQ   headrevsdifference_updater   rB   )r'   r(   r)   r#   inputsetwdirparentsr   s          r*   r   r     s     dK--q>>>HK(==T
(:(:(<(<===x==!!!N##H--E,,,		'ENNEE>r,   s   hidden()c                 t    t          |ddt          d                     t          j        | d          }||z  S )zHidden changesets.r   s   hidden takes no argumentss   visible)r  r   r   
filterrevs)r'   r(   r)   
hiddenrevss       r*   hiddenrI     s>     Aq!Q344555$T:66JJr,   s   keyword(string)c                      t          j        t          |t          d                               fd}|                    |df          S )zSearch commit message, user name, and names of changed files for
    string. The match is case-insensitive.

    For a regular expression or case sensitive search of these fields, use
    ``grep(regex)``.
    s   keyword requires a stringc                     |          }t          fd|                                |                                |                                gz   D                       S )Nc              3   D   K   | ]}t          j        |          v V  d S r6   r   r  )r}   tkws     r*   rL  z+keyword.<locals>.matches.<locals>.<genexpr>  sF       
 
 (.###
 
 
 
 
 
r,   )rS  rR  r  r  )r2   r   rO  r'   s     r*   rY  zkeyword.<locals>.matches  sf    G 
 
 
 
WWYY!&&((AMMOO!<<
 
 
 
 
 	
r,   s   <keyword %r>r  )r   r  r   r   r  )r'   r(   r)   rY  rO  s   `   @r*   keywordrP  	  sc     
	!Q'C%D%DEE	F	FB
 
 
 
 
 
 ==OR+@=AAAr,   s   limit(set[, n[, offset]])c                    t          |dd          }d|vr!t          j        t          d                    t	          |                    d          t          d          d          }|d	k     r!t          j        t          d
                    t	          |                    d          t          d          d	          }|d	k     r!t          j        t          d                    t          | t          |           |d                   }|                    |||z             }|t          k    r|dk    r||z  S ||z  S )z>First n members of set, defaulting to 1, starting from offset.r   s   set n offsetr   s%   limit requires one to three arguments   ns   limit expects a numberr   )r  r      negative number to selects   offsets   negative offset)
r   r   r$   r   r   r  r+   rA   slicerE   )	r'   r(   r)   r#   r   limofsosr<  s	            r*   r  r    s4    q(O44DTq!IJJKKK
TXXd^^Q'@%A%A1
M
M
MC
Qwwq!=>>???
Q8991  C Qwwq!344555	k$''f	6	6B	#sSy	!	!Ba{;r,   s   last(set, [n])c                    t          |ddt          d                    }d}t          |          dk    r#t          |d         t          d                    }|dk     r!t	          j        t          d                    t          | t          |           |d                   }|                                 |	                    d|          }|t          k    r|dk    r||z  S |                                 ||z  S )z'Last n members of set, defaulting to 1.r   rn   s"   last requires one or two argumentss   last expects a numberr   rS  )r  r   r[   r   r   r$   r+   rA   reverserT  rE   )r'   r(   r)   r#   r  rU  rW  r<  s           r*   rJ   rJ   6  s     	1a@AABBA
C
1vv{{1q!9::;;
Qwwq!=>>???	k$''1	.	.BJJLLL	!S		Ba{JJLLL;r,   s   max(set)c                     t          | t          |           |          }	 |                                }||v rt          |gd||f          S n# t          $ r Y nw xY wt          d||f          S )z.Changeset with highest revision number in set.s   <max %r, %r>datarepr)r+   rA   r   rB   
ValueErrorr'   r(   r)   rW  rL   s        r*   maxrevr_  J       
k$''	+	+BFFHH;;A3/62)FGGGG     	 _fb9::::   ,A 
AAs   merge()c                      t          |ddt          d                      j         fd}|                    |d          S )zChangeset is a merge changeset.r   s   merge takes no argumentsc                     	                      |           d         t          k    S # t          j        $ r* t	          |                                                    cY S w xY wrY   )r   r   r   r   boolr`  )r2   r   r'   s    r*   ismergezmerge.<locals>.ismerge`  sb    	&==##A&'11$ 	& 	& 	&Q

%%%%%	&s   #' 6A A s   <merge>r  )r  r   rQ   r  )r'   r(   r)   re  r   s   `   @r*   mergerf  Y  s`     Aq!Q233444	B& & & & & & ==:=666r,   s   branchpoint()c                    t          |ddt          d                     | j        }|st                      S t	          |          dgt          |           z
  z  |                    dz             D ]3}|                    |          D ]}|k    r|z
  xx         dz  cc<   4|                    fdd          S )z$Changesets with more than one child.r   s   branchpoint takes no argumentsr   )r  c                 "    | z
           dk    S rY   r   )r2   baserevparentscounts    r*   r   zbranchpoint.<locals>.<lambda>z  s    ,q7{+a/ r,   s   <branchpoint>r  )	r  r   rQ   rB   r   r[   r   r   r  )r'   r(   r)   r   r2   rp   ri  rj  s         @@r*   branchpointrk  i  s     Aq!Q899:::	B yy &kkG3#d))g-.LWW7Q;W'' / /q!! 	/ 	/AG||Q[)))Q.)))	/ ==/////:J    r,   s   min(set)c                     t          | t          |           |          }	 |                                }||v rt          |gd||f          S n# t          $ r Y nw xY wt          d||f          S )z-Changeset with lowest revision number in set.s   <min %r, %r>r[  )r+   rA   r   rB   r]  r^  s        r*   r_  r_  ~  r`  ra  s   modifies(pattern)c                 `    t          |t          d                    }t          | ||d          S )zChangesets modifying files matched by pattern.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file or a
    directory.
    s   modifies requires a patternmodifiedr   r   s       r*   modifiesro    s0     Aq788
9
9CtVS*555r,   s   named(namespace)c           	          t          |ddt          d                    }t          |d         t          d                    }t          j        |          \  }}}t                      }|dk    rN| j        vr$t          j        t          d          |z            |	                     j        |                    n? j        
                                D ]%\  }	} ||	          r|	                    |           &t                      }
|D ]X}|                               D ]@}	|	|j        vr5|
                     fd|                     |	          D                        AY|
t          hz  }
||
z  S )zThe changesets in a given namespace.

    Pattern matching is supported for `namespace`. See
    :hg:`help revisions.patterns`.
    r   s#   named requires a namespace argumentr   s&   the argument to named must be a stringr  s   namespace '%s' does not existc              3   L   K   | ]}|                                          V  d S r6   r  )r}   rM   r'   s     r*   rL  znamed.<locals>.<genexpr>  s/      IIqT!W[[]]IIIIIIr,   )r  r   r   r   r  r   namesr   r1   r   r   	listnames
deprecatedr  nodesr   )r'   r(   r)   r   nsr  r  r  
namespacesr'  rr  s   `          r*   namedrx    s    1aADEEFFD	Q	
344
 
B
 (5b99D'7Jz$*$$'233b8   	tz'*++++
((** 	# 	#HD"wt}} #r"""EEE J JLL&& 	J 	JD2=((IIIIBHHT44H4HIIIIII	J 
gYEE>r,   c                    d}t          |          d| j        j        z  k    r^	 | j                            t          |                    }n# t          j        $ r
 t          }Y nwt          j
        t          f$ r d}Y n^w xY w	 t          j        | |          }|| j                            |          }n'# t          $ r Y nt          j        $ r
 t          }Y nw xY w|S )zprocess a node inputNrn   )r[   nodeconstantsnodelenrQ   r0   r   r   r   r	   binasciiErrorLookupErrorr   resolvehexnodeidprefix)r'   rM   r  pms       r*   r  r    s   	B
1vvT'////	##CFF++BB$ 	 	 	BBB, 	 	 	BBB		/a88B~^''++ 	 	 	D$ 	 	 	BBB	Is/   'A A>$A>=A>1B4 4
C CCs
   id(string)c                     t          |ddt          d                    }t          |d         t          d                    }t          | |          }|t	                      S t	          |g          }||z  S )zBRevision non-ambiguously specified by the given hex string prefix.r   s   id requires one argumentr   s   id requires a string)r  r   r   r  rB   )r'   r(   r)   r  rM   r  results          r*   node_r    so     	1a67788A!A$12233A	tQB	zyybT]]FF?r,   s   none()c                 \    t          |ddt          d                     t                      S )zNo changesets.r   s   none takes no arguments)r  r   rB   r   s      r*   noner    s+     Aq!Q12233399r,   s
   obsolete()c                 t    t          |ddt          d                     t          j        | d          }||z  S )z6Mutable changeset with a newer version. (EXPERIMENTAL)r   s   obsolete takes no argumentss   obsoleter=  )r'   r(   r)   	obsoletess       r*   r   r     s=     Aq!Q566777t[11IIr,   s   only(set, [set])c                    | j         }t          |ddt          d                    }t          | t	          |           |d                   t          |          dk    rUst                      S t          t          j	        | d                    fd|
                                D             }n$t          | t	          |           |d                   }t          |                    |                    }||z  S )a  Changesets that are ancestors of the first set that are not ancestors
    of any other head in the repo. If a second set is specified, the result
    is ancestors of the first set that are not ancestors of the second set
    (i.e. ::<set1> - ::<set2>).
    r   rn   s   only takes one or two argumentsr   Fc                 $    g | ]}|v|v
|S r   r   )r}   r0   r  r-  s     r*   r~   zonly.<locals>.<listcomp>  s4     
 
 
+%%cWnn .<nnr,   )commonr   )rQ   r  r   r+   rA   r[   rB   r   r
   r   rB  findmissingrevs)	r'   r(   r)   r   r   r.  resultsr  r-  s	          @@r*   onlyr    s    
B1aA@AABBDT;t,,d1g66G
4yyA~~ 	99%.tWeDDEE
 
 
 
 
{{}}
 
 
 {400$q'::"$$G7$CCDDG Gr,   s   origin([set])c                      |t           t                     |          }nt                     } fdfd|D             }|dhz  }||z  S )an  
    Changesets that were specified as a source for the grafts, transplants or
    rebases that created the given revisions.  Omitting the optional set is the
    same as passing all().  If a changeset created by these operations is itself
    specified as a source for one of these operations, only the source changeset
    for the first operation is selected.
    Nc                 \    t          |           }|d S 	 t          |          }||S |}r6   )r4   )r0   r  prevr'   s      r*   	_firstsrczorigin.<locals>._firstsrc"  sD    D#&&;4	 s++D|
C	r,   c                 &    h | ]} |          S r   r   )r}   r2   r  s     r*   r  zorigin.<locals>.<setcomp>.  s!    %%%!1%%%r,   )r+   rA   )r'   r(   r)   r  or  s   `    @r*   originr    s~     	}t[..22D!!
 
 
 
 
 	&%%%u%%%A$KA A:r,   s   outgoing([path])c                     ddl m}m} t          |ddt	          d                    }|r#t          |d         t	          d                    pd}|r|g}ng }t                      }t          j          j	        |          D ]}	|	j
        p|	j        }|	j        g f}
|                      |
g           \  }}|r fd|D             }|                     i |          }	  j	                                        5  |                     ||          }d	d	d	           n# 1 swxY w Y   |                                 n# |                                 w xY w|                    |j                    j        fd
|D             }||z  S )zChangesets not found in the specified destination repository, or the
    default push location.

    If the location resolve to multiple repositories, the union of all
    outgoing changeset will be used.
    r   )	discoveryhgr   s"   outgoing takes one or no argumentss#   outgoing requires a repository pathr,   c                 :    g | ]}                     |          S r   lookup)r}   r0   r'   s     r*   r~   zoutgoing.<locals>.<listcomp>T  s%    555DKK$$555r,   )	onlyheadsNc                 :    h | ]}                     |          S r   r  r}   r2   r   s     r*   r  zoutgoing.<locals>.<setcomp>_  s#    $$$q$$$r,   )rs  r  r  r  r   r   r   r    get_push_pathsr  pushloclocr+  addbranchrevspeersilentfindcommonoutgoingcloser  missingrQ   )r'   r(   r)   r  r  r  destr  r  r  branchesr   checkoutr}  outgoingr  r   s   `               @r*   r  r  5  s           	1a@AABBA 	
Hi!a FGGHHOC 	  eeG&tTWe<< ) )|'tx;?))$hCCh 	65555555Db$''	!!  $77%4 8                
 KKMMMMEKKMMMMx'((((	B$$$$G$$$AA:s0   D<7DD<D 	 D<#D 	$D<<Es	   p1([set])c                 >   |S| |                                                                          }|dk    r|t          |g          z  S t                      S t                      }| j        }t          | t          |           |          D ]}	 |                    |                    |          d                    2# t          j
        $ rB |                    | |                                                                                     Y w xY w|t          hz  }||z  S )z<First parent of changesets in set, or the working directory.Nr   )r   r0   rB   r   rQ   r+   rA   r   r   r   r   r   )r'   r(   r)   rp   r   r   r2   s          r*   r   r   c  s    	yGJJLL66GQCLL((yy	B	BD+d++Q// ' '	'FF2==##A&''''$ 	' 	' 	'FF47::<<##%%&&&&&	'7)OB B;s   .B;;ADDs	   p2([set])c                    |z| |                                          }	 |d                                         }|dk    r|t          |g          z  S t                      S # t          $ r t                      cY S w xY wt	                      }| j        }t          | t          |           |          D ]}	 |                    |	                    |          d                    2# t          j        $ rK | |                                          }t          |          dk    r|                    |d                    Y w xY w|t          hz  }||z  S )z=Second parent of changesets in set, or the working directory.Nr   r   rn   )r@  r0   rB   
IndexErrorr   rQ   r+   rA   r   r   r   r   r[   r   )r'   r(   r)   r   rp   r   r2   r@  s           r*   r`  r`  y  sV    	y!W__	1		AAvv,,99 	 	 	99	 
B	BD+d++Q// # #	#FF2==##A&''''$ 	# 	# 	#1goo''G7||q  wqz"""	# 7)OB B;s*   2A A A:9A:3.C""AD<;D<c                 $    t          | ||          S r6   )r   r&   s       r*   
parentpostr    s    dFAr,   s   parents([set])c                    |%d | |                                          D             }nt                      }| j        }|j        }|j        }t          | t          |           |          D ]Y}	  | ||                     # t          j        $ r0  |d | |                                          D                        Y Vw xY w|t          hz  }||z  S )zU
    The set of all parents for all changesets in set, or the working directory.
    Nc                 6    h | ]}|                                 S r   r  r+  s     r*   r  zparents.<locals>.<setcomp>  s     111!aeegg111r,   c              3   >   K   | ]}|                                 V  d S r6   r  r+  s     r*   rL  zparents.<locals>.<genexpr>  s*      66q15577666666r,   )
r@  r   rQ   r  r   r+   rA   r   r   r   )r'   r(   r)   r   r   upr   r2   s           r*   r@  r@    s    
 	y11tAw00111UU^Y]
k$//33 	7 	7A7::a==!!!!( 7 7 766DGOO$5$56666666677)OBB;s   ,B<C ?C c                 :    | j                             | ||          S )z,helper to select all rev in <targets> phases)_phasecache	getrevset)r'   r(   targetss      r*   _phaser    s    %%dGV<<<r,   s   _phase(idx)c                 t    t          |ddd          }t          |d         d          }t          | ||          S )Nr   s   _phase requires one argumentr   s   _phase expects a number)r  r   r  )r'   r(   r)   r  targets        r*   phaser    s<    1a899A!899F$'''r,   s   draft()c                 z    t          |ddt          d                     t          j        }t	          | ||          S )zChangeset in draft phase.r   s   draft takes no arguments)r  r   r   draftr  r'   r(   r)   r  s       r*   r  r    s:     Aq!Q233444\F$'''r,   s   secret()c                 z    t          |ddt          d                     t          j        }t	          | ||          S )zChangeset in secret phase.r   s   secret takes no arguments)r  r   r   secretr  r  s       r*   r  r    s:     Aq!Q344555]F$'''r,   s   stack([revs])c                     |t          j        |           }nOt          j        g           }t	          | t          |           |          D ]}t          j        | |          }||z   }||z  S )zdExperimental revset for the stack of changesets or working directory
    parent. (EXPERIMENTAL)
    )stackmodgetstackr   rB   r+   rA   )r'   r(   r)   stacksr  currentstacks         r*   r   r     sv    
 	y"4((!"%%t[%6%6:: 	+ 	+H#,T8<<Ll*FFF?r,   c                    	 t          |d                   }|dvrt          n6# t          t          f$ r" t          j        t          d                    w xY wt                      }| j        }t          | t          |           |          D ]Z}|dk    r|
                    |           |dk    r	 |
                    |                    |          d                    U# t          j        $ rB |
                    | |                                                                                    Y w xY w	 |                    |          }|d         t          k    r|
                    |d                    # t          j        $ r^ | |                                         }t#          |          dk    r-|
                    |d                                                    Y Xw xY w||z  S )z``set^0``
    The set.
    ``set^1`` (or ``set^``), ``set^2``
    First or second parent, respectively, of all changesets in set.
    r   )r   r   rn   s   ^ expects a number 0, 1, or 2r   rn   )intr]  	TypeErrorr   r$   r   r   rQ   r+   rA   r   r   r   r   r0   r   r@  r[   )	r'   r(   r)   rM   r#   r   r   r2   r@  s	            r*   
parentspecr    s   D!III z" D D Dq!ABBCCCD	B	BD+d++Q// - -66FF1IIII!VV+r}}Q''*++++( + + +tAwzz||''))*****+---**1:((FF71:&&&( - - -q'//++w<<1$$FF71:>>++,,,- B;s0    # 3A2.C!!AD21D26AE88A)G%$G%s   present(set)c                 n    	 t          | |||          S # t          j        $ r t                      cY S w xY w)a  An empty set, if any revision in set isn't found; otherwise,
    all revisions in set.

    If any of specified revisions is not present in the local repository,
    the query is normally aborted. But this predicate allows the query
    to continue even in such cases.
    )r+   r   r1   rB   r&   s       r*   presentr    sI    dFAu---    yys    44
   _notpublicc                 r    t          |ddd           t          | |t          j        t          j                  S )Nr   s   _notpublic takes no arguments)r  r  r   r  r  r   s      r*   
_notpublicr    s/    Aq!5666$fm<<<r,   s"   _phaseandancestors(phasename, set)c                    
 t          |ddd          }t          |d                   }t           t                     |d                   }t          j        
t          j        }

|d}||vrt          j        d|z            ||          j	        j
         fd}t          j         ||          }	|d	k    r|	                    
 fd
          }	||	z  S )Nrn   s)   _phaseandancestors requires two argumentsr   r   )r     drafts   secrets   %r is not a valid phasenamec                 $     |           k     S r6   r   )r0   getphaseminimalphaser'   s    r*   cutfuncz#_phaseandancestors.<locals>.cutfunc*  s    xc""\11r,   )r  r  c                 $     |           k    S r6   r   )r2   r  r  r'   s    r*   r   z$_phaseandancestors.<locals>.<lambda>0  s    XXdA%6%6%%? r,   )r  r   r+   rA   r   r  r  r   r$   r  r  r
   r   r  )r'   r(   r)   r   	phasenamer   r  phasenamemapr  r   r  r  r  s   `         @@@r*   _phaseandancestorsr    s    1aHIID$q'""It[&&Q00ALE]F L
 $$=	IJJJ	*L%H2 2 2 2 2 2 2 dAw777DH{{??????@@D=r,   s   public()c                 v    t          |ddt          d                     t          | |t          j                  S )zChangeset in public phase.r   s   public takes no arguments)r  r   r  r   publicr   s      r*   r  r  4  s5     Aq!Q344555$...r,   s   remote([id [,path]])c                    ddl m} t          |ddt          d                    }d}t	          |          dk    r#t          |d         t          d                    }|dk    r| d                                         }d}t	          |          dk    r#t          |d         t          d	                    }|sd
}t          j        d| | j	        |          \  }}|
                    | i |          }|                    |          }	|	| v r.| |	                                         }
|
|v rt          |
g          S t                      S )zLocal revision that corresponds to the given identifier in a
    remote repository, if present. Here, the '.' identifier is a
    synonym for the current local branch.
    r   )r  r   rn   s(   remote takes zero, one, or two argumentsr  s   remote requires a string idr,   s!   remote requires a repository paths   defaults   remote)rs  r  r  r   r[   r   r+  r    get_unique_pull_pathr  r  r  r0   rB   )r'   r(   r)   r  r  qr  r  r}  rM   r2   s              r*   remoter  <  sA     	1aFGGHHAA
1vvzzadA<==>>DyyJD
1vvzz1q!EFFGG 14$ ND( GGD"d##EQADyyGKKMM;;A3<<99r,   s   removes(pattern)c                 `    t          |t          d                    }t          | ||d          S )zChangesets which remove files matching pattern.

    The pattern without explicit kind like ``glob:`` is expected to be
    relative to the current directory and match against a file or a
    directory.
    s   removes requires a patternremovedr   r   s       r*   removesr  b  s0     Aq677
8
8CtVS)444r,   s   rev(number)c                 l    	 t          | ||          S # t          j        $ r t                      cY S w xY w)z+Revision with the given numeric identifier.)_revr   r1   rB   r   s      r*   r0   r0   o  sG    D&!$$$    yys    33s   _rev(number)c                    t          |ddt          d                    }	 t          t          |d         t          d                              }n6# t          t
          f$ r" t          j        t          d                    w xY w|t          vrN	 | j	        
                    |           n2# t          $ r% t          j        t          d          |z            w xY w|t          |g          z  S )Nr   s   rev requires one argumentr   s   rev requires a numbers   rev expects a numbers   unknown revision '%d')r  r   r  r   r  r]  r   r$   r?   rQ   rT  r  r1   rB   )r'   r(   r)   r  s       r*   r  r  x  s    	1a78899A;	!A$": ; ;<<==z" ; ; ;q!899:::; 		IN"""" 	I 	I 	I'*B(C(Ca(GHHH	IGQCLL  s   0A 3BB- -/Cs   revset(set)c                 &    t          | |||          S )a  Strictly interpret the content as a revset.

    The content of this special predicate will be strictly interpreted as a
    revset. For example, ``revset(id(0))`` will be interpreted as "id(0)"
    without possible ambiguity with a "id(0)" bookmark or tag.
    )r+   r&   s       r*   revsetpredicater    s     $5)))r,   s   matching(revision [, field])c                     t          |ddt          d                    }t           t                     |d                   dg}t	          |          dk    r5t          |d         t          d                                                    }g }|D ];}|dk    r|g dz  }|dk    r|d	dgz  }|d
k    rd}|                    |           <t          |          }d|v rd|v r|	                    d           g dfd}t          |          }|                    |           g  fd fd fd fd fd fd fd fd fd fdd
}|D ]S}	|                    |	d          }
|
$t          j        t          d          |	z                                |
           Tfdfd}|                    |d |f!          S )"a  Changesets in which a given set of fields match the set of fields in the
    selected revision or set.

    To match more than one field pass the list of fields to match separated
    by spaces (e.g. ``author description``).

    Valid fields are most regular revision fields and some special fields.

    Regular revision fields are ``description``, ``author``, ``branch``,
    ``date``, ``files``, ``phase``, ``parents``, ``substate``, ``user``
    and ``diff``.
    Note that ``author`` and ``user`` are synonyms. ``diff`` refers to the
    contents of the revision. Two revisions matching their ``diff`` will
    also match their ``files``.

    Special fields are ``summary`` and ``metadata``:
    ``summary`` matches the first line of the description.
    ``metadata`` is equivalent to matching ``description user date``
    (i.e. it matches the main metadata fields).

    ``metadata`` is the default field which is used when no fields are
    specified. You can match more than one field at a time.
    r   rn   s   matching takes 1 or 2 argumentsr   s   metadatas1   matching requires a string as its second argument)   user   description   date   diff   files   authorr     summaryr  )
   phase   parentsr  r     branchr  r  r     substater  c                 n    	                      |           S # t          $ r t                    cY S w xY wr6   )indexr]  r[   )r   
fieldorders    r*   fieldkeyfunczmatching.<locals>.fieldkeyfunc  sI    	###A&&& 	# 	# 	#z??"""	#s    44)keyc                 8    |                                           S r6   r  rf  s    r*   r   zmatching.<locals>.<lambda>      47<<>> r,   c                 8    |                                           S r6   r+  rf  s    r*   r   zmatching.<locals>.<lambda>  s    T!W^^-- r,   c                 8    |                                           S r6   r  rf  s    r*   r   zmatching.<locals>.<lambda>  r  r,   c                 8    |                                           S r6   r  rf  s    r*   r   zmatching.<locals>.<lambda>  s    $q'"5"5"7"7 r,   c                 8    |                                           S r6   )rR  rf  s    r*   r   zmatching.<locals>.<lambda>      DGMMOO r,   c                 8    |                                           S r6   )r@  rf  s    r*   r   zmatching.<locals>.<lambda>  s    d1goo// r,   c                 8    |                                           S r6   )r  rf  s    r*   r   zmatching.<locals>.<lambda>  r  r,   c                     |          j         S r6   )substaterf  s    r*   r   zmatching.<locals>.<lambda>  s    tAw/ r,   c                 h    |                                                                           d         S rP   )r  
splitlinesrf  s    r*   r   zmatching.<locals>.<lambda>  s(    d1g1133>>@@C r,   c           	          t          |                              t          j        j        ddi                              S )Ns   gitT)r   )rj  r  r   diffalloptsr  rf  s    r*   r   zmatching.<locals>.<lambda>  s9    4GLLh247VTNKKLLL
 
 r,   )
r  r  r  r  r  r  r  r  r  r  Ns,   unexpected field name passed to matching: %sc                 "      fdD             S )Nc                 &    g | ]} |          S r   r   )r}   r   r2   s     r*   r~   z.matching.<locals>.<lambda>.<locals>.<listcomp>	  s!    555!1555r,   r   )r2   getfieldfuncss   `r*   r   zmatching.<locals>.<lambda>	  s    5555}555 r,   c                     D ]@} |          }d}t                    D ]\  }}||          ||           k    rd}|r dS AdS r!  )	enumerate)	r)   r0   r  r   rM   r   r
  getinfor   s	         r*   rY  zmatching.<locals>.matches
	  su     	 	CWS\\FE!-00 " "1!9!$$!E ttur,   s   <matching%r %r>r  )r  r   r+   rA   r[   r   splitr  r   rA  rj  sortr  r   r$   r  )r'   r(   r)   r  	fieldlistfieldsrV  r  _funcsinfogetfieldrY  r  r
  r  r   s   `           @@@@r*   matchingr    s   4 	1a=>>??A$D))1Q400DI
1vvzzaDBCC
 
 %''	 	 F ! !K8888FFg x))FF	!!MM%    [[FV& 8 8z"""
  J# # # # # &\\F
KKLK!!! M))))----))))7777++++////++++////CCCC
 
 
 
 F  ' '::dD))"ABB  
 	X&&&& 6555G	 	 	 	 	 	 	 ==,>+M=NNNr,   s   reverse(set)c                 h    t          | |||          }|t          k    r|                                 |S )zReverse order of set.)r+   r\   rY  )r'   r(   r)   r#   r  s        r*   rY  rY  	  s4     	tVQ&&A			Hr,   s
   roots(set)c                      t           t                     |           j        j         fd}|                    |d          z  S )z2Changesets in set with no parent changeset in set.c                     	  |           D ]}d|k    r|v r dS nL# t           j        $ r: d                                          D ]}|                                v r Y dS Y nw xY wdS )Nr   FT)r   r   r@  r0   )r2   rp   r@  r'   r   s     r*   r  zroots.<locals>.filter'	  s    	!WQZZ ! !66a1ff 55! $ 	! 	! 	!$Z'')) ! !5577a<< 555  ! !	! ts     AA($A('A(s   <roots>r  )r+   rA   rQ   r   r  )r'   r(   r)   r  r@  r   s   `   @@r*   r  r  !	  sj     	t[&&**An'G	 	 	 	 	 	 	 AHHVjH9999r,   ic                 B    |                     t          t                    S r6   )randintMININTMAXINT)r   gens     r*   pick_randomr  9	  s    ;;vv&&&r,   c                 *    |                                  S r6   r  r   s    r*   r   r   @	  s     r,   c                 *    |                                  S r6   r  r   s    r*   r   r   A	  s    q}} r,   c                 *    |                                  S r6   r  r   s    r*   r   r   B	  s    qvvxx r,   c                 *    |                                  S r6   r  r   s    r*   r   r   C	  s     r,   c                 6    |                                  d         S rP   r  r   s    r*   r   r   D	  s    qvvxx{ r,   )   revr  s   descr  r  r  s   node   randomc                 
   t          | dd          }d|vr!t          j        t          d                    d}d|v r#t	          |d         t          d                    }g }|                                D ]}|}|                    d          }|r
|d	d
         }|t          vr<|dk    r6t          j        t          d          t          j	        |          z            |
                    ||f           t          |          d	k    r:t          d |D                       r!t          j        t          d                    i }d|v rFt          d |D                       r|d         |d<   n!t          j        t          d                    d|v ret          d |D                       r+|d         }t	          |t          d                    }	|	|d<   n!t          j        t          d                    |d         ||fS )z5Parse sort options into (set, [(key, reverse)], opts)s   sorts%   set keys topo.firstbranch random.seedr   s"   sort requires one or two argumentsr%  s   keyss   sort spec must be a string   -r   N   topos   unknown sort key %rc              3   (   K   | ]\  }}|d k    V  dS r)  Nr   r}   r   rY  s      r*   rL  z_getsortargs.<locals>.<genexpr>e	  s*       I I*!Wg I I I I I Ir,   s7   topo sort order cannot be combined with other sort keys   topo.firstbranchc              3   (   K   | ]\  }}|d k    V  dS r+  r   r,  s      r*   rL  z_getsortargs.<locals>.<genexpr>m	  s*      77
7qG|777777r,   s>   topo.firstbranch can only be used when using the topo sort key   random.seedc              3   (   K   | ]\  }}|d k    V  dS )r&  Nr   r,  s      r*   rL  z_getsortargs.<locals>.<genexpr>y	  s*      99*!WqI~999999r,   s   random.seed must be a strings;   random.seed can only be used when using the random sort key)r   r   r$   r   r   r  r9  _sortkeyfuncsr   bytestrr  r[   rS  )
r)   r   r   keyflagsr   fkrY  r   r   seeds
             r*   _getsortargsr6  J	  sd   	0 D
 Tq!FGGHHHD$g*G(H(HIIHZZ\\ 	& 	&,,t$$ 	!""AM!!a7ll"())H,<R,@,@@   	G%%%%
8}}qS I I I I IIIHII
 
 	
 Dd""77h77777 		(,-@(AD$%% "4    9999999 	^$AQ"A B BCCD#'D   "6    <4''r,   s   sort(set[, [-]key... [, ...]])c                 b    t          |          \  }}}t           |||          }|r|t          k    r|S t          |          dk    r6|d         d         dk    r$|                    |d         d                    |S |d         d         dk    rd} j        j        }	t          |v r fd}	d|v rt           ||d                   }t          t          j
        ||	|          d	
          }|d         d         r|                                 |S  fd|D             }
t          |          D ]e\  }}t          |         }|dk    r6d|v r2|d         }t          j        |          }t!          j        ||          }|
                    ||           ft          d |
D                       S )aZ  Sort set by keys. The default sort order is ascending, specify a key
    as ``-key`` to sort in descending order.

    The keys can be:

    - ``rev`` for the revision number,
    - ``branch`` for the branch name,
    - ``desc`` for the commit message (description),
    - ``user`` for user name (``author`` can be used as an alias),
    - ``date`` for the commit date
    - ``topo`` for a reverse topographical sort
    - ``node`` the nodeid of the revision
    - ``random`` randomly shuffle revisions

    The ``topo`` sort order cannot be combined with other sort keys. This sort
    takes one optional argument, ``topo.firstbranch``, which takes a revset that
    specifies what topographical branches to prioritize in the sort.

    The ``random`` sort takes one optional ``random.seed`` argument to control
    the pseudo-randomness of the result.
    r   r   r%  )rY  r)  r   c                     	  |           S # t           j        $ r' d d                                          D             cY S w xY w)Nc                 6    g | ]}|                                 S r   r  r+  s     r*   r~   z-sort.<locals>.parentsfunc.<locals>.<listcomp>	  s     BBBAEEGGBBBr,   )r   r   r@  )r2   r   r'   s    r*   parentsfunczsort.<locals>.parentsfunc	  sc    C%:a==(, C C CBBT$Z-?-?-A-ABBBBBBCs   
 3AAr-  T)istopoc                      g | ]
}|         S r   r   r  s     r*   r~   zsort.<locals>.<listcomp>	  s    """DG"""r,   r&  r/  )r  )r  rY  c                 6    g | ]}|                                 S r   r  )r}   r   s     r*   r~   zsort.<locals>.<listcomp>	  s     ***AEEGG***r,   )r6  r+   r\   r[   r  rQ   r   r	   rB   r
   toposortrY  reversedr1  randomRandom	functoolspartial)r'   r(   r)   r#   r   r3  r   r   firstbranchr:  ctxsr   rY  r   r5  r2   r   s   `               @r*   r  r  	  s   2 %QAx$5))D u++
8}}hqk!n66		(1+a.	)))	!Q7	"	"^.
 d??C C C C C C $&& vt4G/HIIKN4k::
 
 
 A;q> 	LLNNN #"""T"""Dx(( - -
7Q	>>n44'Dd##A$Tq111D		dG	,,,,**T***+++r,   s   subrepo([pattern])c                 .    t          |ddt          d                    }dt          |          dk    r#t          |d         t          d                    t	          j        dg          fd fd}|                    |d	f
          S )zChangesets that add, modify or remove the given subrepo.  If no subrepo
    pattern is named, any subrepo changes are returned.
    r   r   s"   subrepo takes at most one argumentNs   subrepo requires a patterns   .hgsubstatec              3   d   K   t          j                  \  }}}| D ]} ||          r|V  d S r6   )r   r  )rr  r   rp   rL   r'  r   s        r*   
submatcheszsubrepo.<locals>.submatches	  sP      *3//1a 	 	Dqww 


	 	r,   c                 f   |          }                     |                                                                |                                          }|j        p|j        p|j        S |j        r/t           |j                                                            S |j        rt          |                                j                                                  }|
                    |j                                                    |          D ]M}|                                j                            |          |j                            |          k    r dS N|j        rAt           |                                j                                                            S dS )N)r   TF)r  r   rT  r   rn  r  rS  r  r   r   r  r  )	r)   r   r   subsr  rL   r   r'   rH  s	        r*   rY  zsubrepo.<locals>.matches	  se   GKKqvvxxqK99;75aj5AI57 	6zz!*//"3"344555: 	 qttvv++--..DKK
))***"
4((    4466?&&t,,
t0D0DDD44 E 9 	;zz!$$&&/"6"6"8"899:::ur,   s   <subrepo %r>r  )r  r   r[   r   rN  exactr  )r'   r(   r)   r   rY  rL   r   rH  s   `    @@@r*   subreporL  	  s     1aACDDEED
C
4yyA~~Q#@!A!ABB'((A           . ==OS+A=BBBr,   c                    |                                  j        }|j        j        |j        fd |fd|D                       D             }|                    d           t          j        || j        j        z
            S )z(repo, smartset, [node] -> [node]) -> smartset

    Helper method to map a smartset to another smartset given a function only
    talking about nodes. Handles converting between rev numbers and nodes, and
    filtering.
    c                 &    h | ]} |          S r   r   )r}   rM   torevs     r*   r  z!_mapbynodefunc.<locals>.<setcomp>
  s!    8881eeAhh888r,   c              3   .   K   | ]} |          V  d S r6   r   )r}   r2   tonodes     r*   rL  z!_mapbynodefunc.<locals>.<genexpr>
  s+      !7!7&&))!7!7!7!7!7!7r,   N)	
unfilteredrQ   r  get_revrT  rA  r   rB   filteredrevs)r'   r   r   r   r  rQ  rO  s        @@r*   _mapbynodefuncrU  	  s     
			$BHEWF8888!7!7!7!7Q!7!7!7 7 7888F
NN4FT^%@@AAAr,   s   successors(set)c                 v     t           t                     |          } fd}t           ||          }||z  S )zNAll successors for set, including the given set themselves.
    (EXPERIMENTAL)c                 8    t          j        j        |           S r6   )r   allsuccessorsobsstore)ru  r'   s    r*   r   zsuccessors.<locals>.<lambda>
  s    g+DM5AA r,   )r+   rA   rU  )r'   r(   r)   r   r   ds   `     r*   
successorsr[  
  sG     	t[&&**AAAAAAtQ""AA:r,   c                      t          j         |          \  } }|dk    r!|st          j                     fd}n fd}| |fS )Nr  r  c                 0    t          j        |           v S r6   rM  r   r  s    r*   r   z#_substringmatcher.<locals>.<lambda>
  s    8>!+<+< < r,   c                     | v S r6   r   r^  s    r*   r   z#_substringmatcher.<locals>.<lambda>
  s    1 r,   )r   r  r   r  )r  r  r  r  s   `   r*   r  r  
  su    '5}  D'7 z 	-nW--G<<<<GG,,,,G'!!r,   s   tag([name])c                 *  	 t          |ddt          d                    }| j        |rt          |d         t          d                    }t	          j        |          \  }}	|dk    rb| j        j                            |d          }|$t          j
        t          d          |z            | |                                         h}nB	fd|                                 D             }n fd	|                                 D             }||z  S )
zThe specified tag by name, or all tagged revisions if no name is given.

    Pattern matching is supported for `name`. See
    :hg:`help revisions.patterns`.
    r   r   s   tag takes one or no argumentss$   the argument to tag must be a stringr  Ns   tag '%s' does not existc                 V    h | ]%\  }} |                               |          &S r   r  )r}   rN  rM   r   r  s      r*   r  ztag.<locals>.<setcomp>9
  s4    EEEtq!''!**EEEEr,   c                 L    h | ] \  }}|d k                         |          !S )s   tipr  )r}   rN  rM   r   s      r*   r  ztag.<locals>.<setcomp>;
  s,    BBB41aa6kkRVVAYYkkkr,   )r  r   rQ   r   r   r  
_tagscachetagsr  r   r1   r0   tagslist)
r'   r(   r)   r   r  r  tnr   r   r  s
           @@r*   tagrg  
  s&    1aA>??@@D	B CG566
 

 ",!9'!B!Bgw:%))'488Bz+011G;   b AAEEEEEt}}EEEAABBBB4==??BBBA:r,   s   taggedc                 $    t          | ||          S r6   )rg  r   s      r*   taggedri  ?
  s    tVQr,   s   orphan()c                 t    t          |ddt          d                     t          j        | d          }||z  S )z?Non-obsolete changesets with obsolete ancestors. (EXPERIMENTAL)r   s   orphan takes no arguments   orphanr=  )r'   r(   r)   orphans       r*   rl  rl  D
  s<     Aq!Q344555^D),,FF?r,   s
   unstable()c                 V   t          |ddd           t                      }|                    t          j        | d                     |                    t          j        | d                     |                    t          j        | d                     |t          |          z  S )z-Changesets with instabilities. (EXPERIMENTAL)r   s   unstable takes no argumentsrk  r<  r  )r  r   r  r>  r?  rB   )r'   r(   r)   	_unstables       r*   unstablero  M
  s     Aq!3444IV^D)44555V^D*;<<===V^D*=>>???GI&&&&r,   s   user(string)c                 $    t          | ||          S )zUser name contains string. The match is case-insensitive.

    Pattern matching is supported for `string`. See
    :hg:`help revisions.patterns`.
    )r  r   s      r*   r  r  Y
  s     $"""r,   s   wdir()c                     t          |ddt          d                     t          |v st          |t                    rt          t          g          S t                      S )z!Working directory. (EXPERIMENTAL)r   s   wdir takes no arguments)r  r   r	   r@   rA   rB   r   s      r*   wdirrr  c
  sU     Aq!Q122333&Jv{;;y!!!99r,   c                    t          |d          }|st                      S | j        }g }t                      }|                    d          D ]}	 t          |          }d|z  |k    s||vrt          |g}	n'# t          $ r t          | ||t                    }	Y nw xY w|	D ]S}||v r||v s|t          v r*t          |t                    r|                    |           |                    |           Tt          |          S )N   internal error    s   %d)r   rB   rQ   r   r  r  r]  rC   r\   r?   r@   rA   r  r   )
r'   r(   r)   r   r   r<  seenrN  r2   r   s
             r*   _orderedlistrw  m
  s4   !&''A yy 
B	B55DWWU^^  	;AA	a1B;;  3DD 	; 	; 	;T61k::DDD	;  		 		ADyyV$$v{33 % 		!HHQKKKK		 2;;s   &A77!BBs   _listc                 |    |t           k    r!|t          | t          |           |          z  S t          | ||          S r6   )rE   rw  rA   r&   s       r*   _listry  
  s>    T;t+<+<a@@@@D&!,,,r,   c                     t          |d          st                      S d                     d          D             }|t          fd|D                       S )Nrt  c                 ,    g | ]}t          |          S r   )r  r|   s     r*   r~   z#_orderedintlist.<locals>.<listcomp>
  s    	)	)	)Q#a&&	)	)	)r,   ru  c                     g | ]}|v |	S r   r   r}   r2   r   s     r*   r~   z#_orderedintlist.<locals>.<listcomp>
      ,,,!Q!VVAVVVr,   )r   rB   r  )r'   r(   r)   r<  r   s       @r*   _orderedintlistr  
  sj    !&''A yy	)	)!''%..	)	)	)BA,,,,r,,,---r,   s   _intlistc                 |    |t           k    r!|t          | t          |           |          z  S t          | ||          S r6   )rE   r  rA   r&   s       r*   _intlistr  
  >    k$.?.?CCCCtVQ///r,   c                     t          |d          st                      S | j        fd                    d          D             }|t          fd|D                       S )Nrt  c                 T    g | ]$}                     t          |                    %S r   )r0   r   r  s     r*   r~   z#_orderedhexlist.<locals>.<listcomp>
  s)    	1	1	1Q"&&Q..	1	1	1r,   ru  c                     g | ]}|v |	S r   r   r}  s     r*   r~   z#_orderedhexlist.<locals>.<listcomp>
  r~  r,   )r   rB   rQ   r  )r'   r(   r)   r<  r   r   s       @@r*   _orderedhexlistr  
  sx    !&''A yy	B	1	1	1	1!''%..	1	1	1BA,,,,r,,,---r,   s   _hexlistc                 |    |t           k    r!|t          | t          |           |          z  S t          | ||          S r6   )rE   r  rA   r&   s       r*   _hexlistr  
  r  r,   s   ranger   s   rangepres	   rangeposts   dagranger5  s   symbols   ands	   andsmally   ors   nots
   differences   relations   relsubscripts	   subscript   lists   keyvalue)s   funcs   ancestors   parents
   parentposts   smartset)   gs   generationsc                       fd}|S )Nc                     	 t          j        |           S # t          j        $ r t          j        d| z            w xY w)Ns!   ambiguous revision identifier: %s)r   isrevsymbolr   AmbiguousPrefixLookupError
InputError)symbolr'   s    r*   r   zlookupfn.<locals>.fn
  sV    	&tV444/ 	 	 	"4v=  	s    '?r   )r'   r   s   ` r*   lookupfnr  
  s#         Ir,   c                 (    t          | |g|          S )z+Create a matcher for a single revision specr  )matchany)r  specr  s      r*   r   r   
  s    Bv....r,   c                    |sdd}|S t          |          s!t          j        t          d                    t	          |          dk    rt          j        |d                   }n ddt          fd|D                       z   f}g }d}| r/|                    | 	                    d	                     | j
        }|r'|                    |                                           |rt          j        |||
          }t          j        |          }t          j        |          }t          j        |          }t!          |          S )ae  Create a matcher that will include any revisions matching one of the
    given specs

    If lookup function is not None, the parser will first attempt to handle
    old-style ranges, which may contain operator characters.

    If localalias is not None, it is a dict {name: definitionstring}. It takes
    precedence over [revsetalias] config section.
    Nc                     t                      S r6   )rB   )r'   r(   s     r*   mfunczmatchany.<locals>.mfunc
  s    99r,   s   empty queryr   r   r  )r  c              3   B   K   | ]}t          j        |          V  d S r6   )r   parse)r}   r   r  s     r*   rL  zmatchany.<locals>.<genexpr>
  s0      JJqz/6::JJJJJJr,   s   revsetalias)warnr6   )allr   r$   r   r[   r   r  tupler  configitemsr  r   expandaliases
foldconcatanalyzeoptimizemakematcher)r  specsr  
localaliasr  treealiasesr  s     `     r*   r  r  
  sd     	 	 	 	 u:: 2q00111
5zzQa&11 JJJJEJJJJJJ

 GD	 r~~n55666w +z''))*** B'gDAAA &&Dd##Dt$$Dtr,   c                      d fd	}|S )z)Create a matcher from an evaluatable treeNc                 p    ||t           }nt          }|t          |           }t          | ||          S r6   )r\   rE   rA   r+   )r'   r(   r#   r  s      r*   r  zmakematcher.<locals>.mfunc  s?    =~##> &&FdFD%000r,   r   r   )r  r  s   ` r*   r  r    s(    1 1 1 1 1 1 Lr,   c                     |j                                         D ]0\  }}|t          |<   |j        rt                              |           1dS )z2Load revset predicates from specified registrarobjN)_tabler   r   _safesafesymbolsr   )r  extnameregistrarobjr'  r   s        r*   loadpredicater  ,  sT    ")//11 " "
d: 	"OOD!!!" "r,   )FNN)F)Tr6   r   )r|  rB  r@  r  i18nr   r   r   rT  r   r   r	   rs  r
   r   r   r   r   r   r  r   r   rN  r   r>  r   r   r   r   r   r   r   r   r   r  r   utilsr   r   r    r   r   r   r  rt   r   r  r   rB   r  rZ   rA   r?   rc   r\   rE   r+   r4   r;   rC   rF   rN   rS   rU   rW   rH   r`   rf   rh   rl   ro   ru   rw   r   r   r   r   r   r   r   r   r   r   r   r  r  	predicater   r   r   r   r   r   r   r   r   r  r  r  r(  r+  r@  rE  r   ra  r   rg  rm  ro  rz  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r/   r  rI   r  r  r  r  r  r  r3  r6  r=  r   rI  rP  r  rJ   r_  rf  rk  r_  ro  rx  r  r  r  r  r  r  r   r`  r  r@  r  r  r  r  r  r  r  r  r  r  r  r0   r  r  rY  r  r  r  r  r=   binnoder1  r6  r  rL  rU  r[  r  rg  ri  rl  ro  r  rr  rw  ry  r  r  r  r  r%   r   r   r  r  r  r  r"  i18nfunctionsr   r,   r*   <module>r     s         				                     
                                           ,           	 	"
"


$

$

$

" !P 
 #. < < < <  > > >    C C CJ J J
; ; ;    &  C C CC C CN N N  3 3 36 6 6	1 	1 	1! ! !>= = =
  <	1 	1 	1H H H  M M M+ + +, 

 cee%I%''	 >   =M M M $r222	3 	3 32	3 "c:::  ;:, DH    %D111  21> D)))9 9 *)9  (  * 4333  43 4(((  )(& ;T"""# # #"# T***" " +*"J #$r:::0 0 ;:0f T***	# 	# +*	# ;T"""	 	 #"	" " "J  " $'''  (' ;T"---  .- 'd333	" 	" 43	" "...  /. D)))  *) D)))  *) ,,,D D -,D6 D)))  *)0 4333  43 ?b111  21" DH    'd333  43B d+++; ; ,+;  tB777, , 87,^ #C000&M &M 10&MR  t,,,% % -,% %DDAAA( ( BA(V E#666
" 
" 76
" <d###  $# #$///  0/B T***< < +*<~ DDCCC) ) DC)
   6 (t444/ / 54/ ?&&&G G '&G F	  B B	 BJ  !!( ( "!(0 8$" "  " >"%%%G G &%G. >%%%W W &%Wt $r222
? 
? 32
? 94       !   =tt444  54( ;T"""  #" D444B B 54B( 'dd1MMM  NM. 44888  98& ;T"""; ; #"; :D!!!7 7 "!7 $'''  ('( ;T"""; ; #"; d2666	6 	6 76	6 " "  "J  , =t$$$  %$ 94     !  =t$$$  %$ T***  +*: $'''  ('@ U2666* * 76*Z <d###  $#* <d###  $#6   4(((  )((= = =
 >%%%( ( &%( :D!!!( ( "!( ;T"""( ( #"( $'''  ('  D ?666  76 =t$$$= = %$= 0t<<<  =<< ;T"""/ / #"/ "///" " 0/"J T"555	5 	5 65	5 >%%%  &% ?&&&! ! '&!$ >555* * 65* *666~O ~O 76~OB ?a@@@  A@ =t$$$: : %$:& 

1  ' ' ' ' N##&&!!""_	 	<( <( <(~ %DD  =, =, =,@  !!)C )C "!)CXB B B D)))  *)
" 
" 
" 
" >%%%  &%> 94       !   ;T"""  #" =t$$$' ' %$' ?b111# # 21# 94***  +*  B 8$$///- - 0/-. . . ;TT!<<<0 0 =<0. . . ;TT2220 0 320h  )	
  y y F , 
5 F =  _ ,  W!" #$ -  4 " 	 %  	 	 	/ / / /
& & & &R   " " " dD) $ $ $   r,   