
    6ho=                      S r SSKJr  SSKrSSKrSSKrSSKrSSKJr  SSK	J
r
JrJrJr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r%  SSK&J'r'J(r(J)r)  \RT                  r*SS	S\" S
5      4/r+0 r,\RZ                  " \,5      r-Sr.0 r/\R`                  " \/5      r0\0" SSSS9  \0" SSSS9  \0" SSSS9  \0" SSSS9   \Rb                  " S5        \!RB                  r!GSS jr5\#Rl                  r7 " S S5      r8/ SQr9SSSS.r:S r;S  r< " S! S"5      r=S# r> " S$ S%\R~                  5      r@ " S& S'5      rAS( rB\-" S)S*S+S\" S,5      4S-S./ \" S/5      \" S05      4/\" S15      \-R                  S29S3 5       rD\-" S4S5S6S\" S75      4/\+-   \" S85      \-R                  S29GSS9 j5       rE\-" S:S5S;S\" S<5      4/\+-   \" S=5      \-R                  S29GSS> j5       rF\-" S?S@SAS\" SB5      4SCSDS\" SE5      \" SF5      4SGSHS\" SI5      4S-S./ \" SJ5      \" S05      4SKSS\" SL5      4SMSNS\" SO5      4/\" SP5      \-R                  S29SQ 5       rHSR rI\-" SSSTSUS\" SV5      4/\" SW5      \-R                  SXSY9SZ 5       rK\-" S[SS\S\" S]5      4S^S_S\" S`5      4SSaS\" Sb5      4ScSdS\" Se5      \" Sf5      4/\R                  -   \" Sg5      \-R                  SXSh9GSSi j5       rM\-" Sj\R                  Sk   S   \" Sl5      \-R                  SXSm9Sn 5       rP\-" SoSpSqS\" Sr5      4/\+-   \" Ss5      \-R                  S29St 5       rQ\-" Su\+\" Sv5      \-R                  S29Sw 5       rR\-" Sx\+\" Sy5      \-R                  S29Sz 5       rS\-" S{\+\" S|5      \-R                  S29S} 5       rTS~ rU\-" SS@SS\" S5      4SGSHS\" S5      4SKSS\" SL5      4S^SS\" S5      4SSS\" S5      \" S5      4SSS\" S5      4SSS\" S5      \" S5      4/\R                  -   \R                  -   \" S5      \-R                  SXSXS9S 5       rX\-" SS@SS\" S5      4SKSS\" SL5      4SSS\" S5      4S^SS\" S5      4SSS\" S5      \" S5      4SSS\" S5      4SSS\" S5      \" S5      4/\R                  -   \R                  -   \" S5      \-R                  SXSXS9S 5       rY\-" S\R                  \R                  -   \R                  -   \" S5      \-R                  SXSXS9S 5       r]\-" SS@SS\" S5      4S*S+S\" S5      4/\R                  -   \" S5      \-R                  S29S 5       r_\-" SSSS\" S5      4SGSHS\" S5      4SSS\" S5      4/\" S5      \-R                  S29S 5       r`\-" SSSS\" S5      4SCSS\" S5      4/\" S5      \-R                  S29S 5       ra\-" S/ \" S5      \-R                  S29GSS j5       rbS rcS rd\-" SSSS\" S5      4SGSHS\" S5      4S@SS\" S5      4SSS\" S5      4SSS\" S5      4SpSS\" S5      4SCSDS\" S5      \" SF5      4SSS\" S5      4SSS\" S5      4/	\" S5      \-R                  SXSY9GSS j5       re\-" SSSS\" S5      4SCSDS\" S5      \" SF5      4SSS\" S5      4SGSHS\" S5      4SSS\" S5      4/\" S5      \-R                  SXSY9GSS j5       rf\-" S/ \" S5      \-R                  S29GSS j5       rg\-" SSSS\" S5      4SSS\" S5      4/\" S5      \-R                  S29S 5       rh\-" SSTSS\" S5      4SCSDS\" S5      \" SF5      4S@SS\" S5      4SGSHS\" S5      4/\R                  -   \" S5      \-R                  S29S 5       ri\-" SSCSS\" S5      4SSS\" S5      4SSS\" S5      4SSS\" S5      4/\" S5      \-R                  S29S 5       rj\-" SSSS\" S5      4/\" S5      \-R                  S29S 5       rk\-" SSSS\" S5      4SSS\" S5      4STSS\" S5      4SSS\" S5      4SSS\" S5      4SSS\" S5      4/\" S5      \-R                  S29GSS j5       rlS rmS rnS roS rpGS  rqGS rr\R                  " 5       rs\s" GS5      GS 5       rt\t/ruGS rvGSGSGSGSGS	GS
GS	GS.rwg! \2 a'     " S S5      r3\Rh                  " \3" 5       SS5         GNf = f(  a  manage a stack of patches

This extension lets you work with a stack of patches in a Mercurial
repository. It manages two stacks of patches - all known patches, and
applied patches (subset of known patches).

Known patches are represented as patch files in the .hg/patches
directory. Applied patches are both patch files and changesets.

Common tasks (use :hg:`help COMMAND` for more details)::

  create new patch                          qnew
  import existing patch                     qimport

  print patch series                        qseries
  print applied patches                     qapplied

  add known patch to applied stack          qpush
  remove patch from applied stack           qpop
  refresh contents of top applied patch     qrefresh

By default, mq will automatically use git patches when required to
avoid losing file mode changes, copy records, binary files or empty
files creations or deletions. This behavior can be configured with::

  [mq]
  git = auto/keep/yes/no

If set to 'keep', mq will obey the [diff] section configuration while
preserving existing git patches upon qrefresh. If set to 'yes' or
'no', mq will override the [diff] section and always generate git or
regular patches, possibly losing data in the second case.

It may be desirable for mq changesets to be kept in the secret phase (see
:hg:`help phases`), which can be enabled with the following setting::

  [mq]
  secret = True

You will by default be managing a patch queue named "patches". You can
create other, independent patch queues with the :hg:`qqueue` command.

If the working directory contains uncommitted files, qpush, qpop and
qgoto abort immediately. If -f/--force is used, the changes are
discarded. Setting::

  [mq]
  keepchanges = True

make them behave as if --keep-changes were passed, and non-conflicting
local changes will be tolerated and preserved. If incompatible options
such as -f/--force or --exact are passed, this setting is ignored.

This extension used to provide a strip command. This command now lives
in the strip extension.
    )annotationsN_)binhexnullrevshort)cmdutilcommandsencodingerror
extensionshg	localrepolock
logcmdutilpatchphasespycompat	registrar
revsetlangscmutilsmartsetstripsubrepoutilutilvfs)dateutil
stringutilurlutil   s   summarys    print first line of patch headers   ships-with-hg-core   mq   git   auto)default   keepchangesF   plain   secrets   stripc                       \ rS rSrS rS rSrg)dummyui   c                    g N )selfmsgs     */usr/lib/python3/dist-packages/hgext/mq.pydebugdummyui.debug           c                    g r.   r/   )r0   eventmsgfmtmsgargsoptss        r2   logdummyui.log   r5   r6   r/   N)__name__
__module____qualname____firstlineno__r3   r<   __static_attributes__r/   r6   r2   r+   r+      s    		r6   r+   r6   c                P   / nU S   nU(       a  X   nOUR                  5       n[        UR                  5       Hi  nUR                  U5      R	                  S5        XTR                  ;  d&  UR                  U5      R                  5       (       d  MX  UR                  U5        Mk     U$ )znreturn list of subrepos at a different revision than substate.
Abort if any subrepos have uncommitted changes.NT)p1sortedsubstatesubbailifchangeddirtyappend)repobaserevinclsubswctxbctxss         r2   checksubstaterQ      s     H:D}wwyDMM"!!$'MM!TXXa[%6%6%8%8OOA # Or6   c                  h    \ rS rSrS rS r\R                  " \5      r\R                  " \5      r	Sr
g)statusentry   c                     XsU l         U l        g r.   )nodename)r0   rV   rW   s      r2   __init__statusentry.__init__   s    #	49r6   c                L    [        U R                  5      S-   U R                  -   $ )N   :)r   rV   rW   r0   s    r2   	__bytes__statusentry.__bytes__   s    499~$tyy00r6   )rW   rV   N)r>   r?   r@   rA   rX   r]   r   	strmethod__str____repr__rB   r/   r6   r2   rS   rS      s.    *1   +G!!),Hr6   rS   )   # User    # Date s   #      	   # Branch 
   # Node ID 
   # Parent        )s   from   dates   subjectc                   U R                  S5      S-   n[        R                  U5      n[        U 5      n[        U[        U 5      5       H|  nX   nUR	                  S5      (       d  [        XV5      n  OV[        [        5       H?  u  pUR	                  U	5      (       d  M  X:X  a  X-   X'   U s  s  $ X:  a  [        XV5      n  Mz     M~     U R                  XQU-   5        U $ )a;  Assuming lines contains a HG patch header, add a header line with value.
>>> try: inserthgheader([], b'# Date ', b'z')
... except ValueError as inst: print("oops")
oops
>>> inserthgheader([b'# HG changeset patch'], b'# Date ', b'z')
['# HG changeset patch', '# Date z']
>>> inserthgheader([b'# HG changeset patch', b''], b'# Date ', b'z')
['# HG changeset patch', '# Date z', '']
>>> inserthgheader([b'# HG changeset patch', b'# User y'], b'# Date ', b'z')
['# HG changeset patch', '# User y', '# Date z']
>>> inserthgheader([b'# HG changeset patch', b'# Date x', b'# User y'],
...                b'# User ', b'z')
['# HG changeset patch', '# Date x', '# User z']
>>> inserthgheader([b'# HG changeset patch', b'# Date y'], b'# Date ', b'z')
['# HG changeset patch', '# Date z']
>>> inserthgheader([b'# HG changeset patch', b'', b'# Date y'],
...                b'# Date ', b'z')
['# HG changeset patch', '# Date z', '', '# Date y']
>>> inserthgheader([b'# HG changeset patch', b'# Parent  y'],
...                b'# Date ', b'z')
['# HG changeset patch', '# Date z', '# Parent  y']
   # HG changeset patchrg      # )index	HGHEADERSlenrange
startswithmin	enumerateinsert)
linesheadervaluestartnewindexbestposiline	lineindexhs
             r2   inserthgheaderr      s    . KK/014Ev&H%jG5#e*%xu%%'oG%i0LIq!!(%~EH L'!'oG 1 & 
LL5.)Lr6   c                   [         UR                  5          n[        U 5      n[        U 5       H  u  pVSU;   al  UR	                  SS5      S   R                  5       R                  5       n[         R                  XsS-   5      nX:X  a  SX4-  X'   U s  $ X:  a  XT:  a  UnMs  Mu  Mw  U(       a  U R                  US5        XT:  a  Un  O   U R                  USX4-  5        U $ )a  For lines containing a plain patch header, add a header line with value.
>>> insertplainheader([], b'Date', b'z')
['Date: z']
>>> insertplainheader([b''], b'Date', b'z')
['Date: z', '']
>>> insertplainheader([b'x'], b'Date', b'z')
['Date: z', '', 'x']
>>> insertplainheader([b'From: y', b'x'], b'Date', b'z')
['From: y', 'Date: z', '', 'x']
>>> insertplainheader([b' date : x', b' from : y', b''], b'From', b'z')
[' date : x', 'From: z', '']
>>> insertplainheader([b'', b'Date: y'], b'Date', b'z')
['Date: z', '', 'Date: y']
>>> insertplainheader([b'foo: bar', b'DATE: z', b'x'], b'From', b'y')
['From: y', 'foo: bar', 'DATE: z', '', 'x']
r[   rg   r      %s: %sr6   )PLAINHEADERSlowerro   rs   splitr   getrt   )	ru   rv   rw   newpriorz   r{   r|   lheaderlprios	            r2   insertplainheaderr      s    " 6<<>*G%jGU#4<jjq)!,224::<G $$Wk:E$61; $/ Q${ $ 
LL)vo56Lr6   c                  f    \ rS rSrSS jrS rS rS rS rS r	\
R                  " \	5      rS rS	rg
)patchheaderi"  c                   S nS n/ n/ nS nS nS n	S n
S nS nS nSn[        US5       nU GH6  nUR                  5       nUR                  S5      (       d  U(       a  UR                  S5      (       a  Sn  GOSnUR                  S5      (       a  S	nMh  U
S
:X  a  UR                  S5      (       a  USS  nGOUR                  S5      (       a  USS  nGO}UR                  S5      (       a  USS  R                  5       n	GORUR                  S5      (       a  USS  nGO5UR                  S5      (       a  USS  nGOUR                  S5      (       d  U(       a  UR	                  U5        S n
OUS:X  a  / nS
n
OU
S:w  a4  UR                  S5      (       d  UR                  S5      (       a  USS  nSn
OU
S:w  a4  UR                  S5      (       d  UR                  S5      (       a  USS  nSn
OhU
S:w  a4  UR                  S5      (       d  UR                  S5      (       a  USS  nSn
O.U
S:X  a	  US:X  a  Sn
OU(       d  U(       a  UR	                  U5        UR	                  U5        GM9     S S S 5        U" U5        U" U5        [        U5      U l        U" U5        U" U5        U
(       a/  U
R                  S5      (       a  U(       a  UR                  SU5        XPl        X`l	        Xpl
        Xl        Xl        Xl        Xl        US	:  U l        U=(       d2    SU R                  ;  =(       a    [!        S U R                   5       5      U l        g ! , (       d  f       N= f) Nc                    U (       aV  U S   nUR                  S5      (       d,  UR                  S5      (       d  UR                  S5      (       a  U S	 Og U (       a  MU  g g )Ns   diff -s   Index:s   ===========rq   )ru   ls     r2   eatdiff%patchheader.__init__.<locals>.eatdiff$  sL    "ILL++||I..||N33b	 %r6   c                `    U (       a'  U S   R                  5       (       d  U S	 Og U (       a  M&  g g )Nr   )r   )ru   s    r2   eatempty&patchheader.__init__.<locals>.eatempty0  s'    Ry((b		 %r6   r   rb
   diff --gits   +++ rh   s   --- rg   s   hgpatchrb      rc   s	   # Parent 	   rd   re   
   rl   rk   s   tagdones	   Subject: 	   subject: s   tag   From: s   from:       Date: s   date: r6   c              3  t   #    U  H.  nUR                  S 5      =(       d    UR                  S5      v   M0     g7f)r   r   Nr   ).0cs     r2   	<genexpr>'patchheader.__init__.<locals>.<genexpr>  s1      &A Y'B1<<	+BB&s   68)openrstriprq   lstriprJ   ro   diffstartlinert   messagecommentsuserdateparentnodeidbranchhaspatchany	plainmode)r0   pfr   r   r   r   r   r   r   r   formatsubjectr   r   	diffstartfpr|   s                    r2   rX   patchheader.__init__#  s   
		 	"d^r{{}??=11$//'":": !I	??7++ !Iz)z22#ABx44#ABx66!%B" &(  66!%ab77!%bc!__U33t,!%44 G'Fz)OOL11|44"12hG#Fz)OOI..$//)2L2L8D#Fz)OOI..$//)2L2L8D#Fv%$#+ (FNN4(%k  p 	 !] f''//GNN1g& 		!A &dmm;    	[ ^s   H>M
Mc                     [        U R                  SU5        Xl        g ! [         aG    U R                  (       a  [	        U R                  SU5         N;SSU-   /nX R                  -   U l         NWf = f)Nrb   s   Fromrk   )r   r   
ValueErrorr   r   r   )r0   r   tmps      r2   setuserpatchheader.setuser  c    	44==*d; 	  	4~~!$--$?.
T0AB #mm 3	4     2A1A10A1c                     [        U R                  SU5        Xl        g ! [         aG    U R                  (       a  [	        U R                  SU5         N;SSU-   /nX R                  -   U l         NWf = f)Nrc   s   Daterk   )r   r   r   r   r   r   )r0   r   r   s      r2   setdatepatchheader.setdate  r   r   c                     [        U R                  SU5        Xl        g ! [         a.    U R                  (       d  SSU-   /nX R                  -   U l         N>f = f)Nrf   rk   )r   r   r   r   r   )r0   r   r   s      r2   	setparentpatchheader.setparent  sT    	44==-@
 	  	4>>.0FG #mm 3	4s     5AAc                >   U R                   (       a  U R                  5         U/U l        U(       am  U R                  (       a@  U R                   (       a/  U R                   S   (       a  U R                   R	                  S5        U R                   R	                  U5        g g )Nr   r6   )r   _delmsgr   r   rJ   )r0   r   s     r2   
setmessagepatchheader.setmessage  s_    ==LLNy~~$--DMM"4E$$S)MM  ) r6   c                n    SR                  U R                  5      R                  5       nU(       d  gUS-   $ )N   
r6   s   

)joinr   r   )r0   rP   s     r2   r]   patchheader.__bytes__  s-    JJt}}%,,.7{r6   c                   U R                   (       a  SU R                   S   R                  5       -   n[        [        U R                  5      5       HF  nXR                  U   R                  5       :X  d  M%  U R                  U	 U R                   SS U l           O   SnU R                    H;  nX@R                  U   :w  a  US-  nX@R                  U   :w  a  M  U R                  U	 M=     g)zRemove existing message, keeping the rest of the comments fields.
If comments contains 'subject: ', message will prepend
the field and a blank line.r   r   rh   Nrg   )r   r   rp   ro   r   )r0   subjr{   cimis        r2   r   patchheader._delmsg  s     <<$,,q/"7"7"99D3t}}-.==+1133a(#'<<#3DL	 /
 ,,Bb))a b))b! r6   )
r   r   r   r   r   r   r   r   r   r   NF)r>   r?   r@   rA   rX   r   r   r   r   r]   r   r_   r`   r   rB   r/   r6   r2   r   r   "  s9    s
j		*   +G"r6   r   c                l   U R                  5       n Uc1  U R                  R                  SS5      (       a  [        R                  nSS0nUb  XS'   U R                  R                  US5         U R                  R                  SSS5        U R                  " U0 UD6sSSS5        $ ! , (       d  f       g= f)	zhelper dedicated to ensure a commit respect mq.secret setting

It should be used instead of repo.commit inside the mq source for operation
creating new changeset.
Nr#   r)   )   ui   allowemptycommitT)s   phasess
   new-commitr   r   )
unfilteredui
configboolr   secretconfigoverride	setconfigcommit)rK   phaseargskwargs	overridess        r2   	newcommitr     s     ??D}77eY//MME-t4I05,-				5	1%!4d;{{D+F+ 
2	1	1s   ,/B%%
B3c                      \ rS rSrSrg)AbortNoCleanupi  r/   N)r>   r?   r@   rA   rB   r/   r6   r2   r   r     s    r6   r   c                     \ rS rSrS>S jr\R                  S 5       r\R                  S 5       r\R                  S 5       r	\R                  S 5       r
S rS?S	 jrS
 rS rS r\R"                  " S5      rS rS rS rS rS rS rS@S jrS rS rS@S jr     SAS jrS rS>S jrS r S r!        SBS jr"        SBS jr#S@S jr$S  r%S! r&S" r'S# r(S$ r)SCS% jr*S&r+S' r,S@S( jr-S) r.S* r/S+ r0S, r1S@S- jr2         SDS. jr3      SES/ jr4S0 r5S>S1 jr6S@S2 jr7S>S3 jr8     SFS4 jr9S5 r:S@S6 jr;SGS7 jr<S>S8 jr=S9 r>S@S: jr?S; r@     SHS< jrAS=rBg)Iqueuei  Nc                   X0l          [        [        R                  R	                  US5      S5       nUR                  5       R                  5       nS S S 5        W(       d!  [        R                  R	                  US5      nO$[        R                  R	                  USU-   5      n U=(       d    UU l        [        R                  " U R                  5      U l
        Xl        X l        SU l        SU l        / U l        SU l        SU l        SU l        S U l        SU l        UR+                  S	S
5      R-                  5       n[.        R0                  " U5      n	U	b  U	(       a  SnOSnXl        UR5                  S	S5      U l        SU l        g ! , (       d  f       GN>= f! [         a$    [        R                  R	                  US5      n GN"f = f)N   patches.queuer      patches   patches-F   series   status   guardsr#   r$      yes   nor(   T)basepathr   ospathr   readr   OSErrorvfsmodr   openerr   baseuiapplieddirtyseriesdirtyadded
seriespath
statuspath
guardspathactiveguardsguardsdirtyconfigr   r   	parseboolgitmoder   r   checkapplied)
r0   r   r   r   patchdirfhcurcurpathr  boolmodes
             r2   rX   queue.__init__  sf   		5bggll4)9:DARggi&&( B '',,tZ8'',,t[3->? '	jj+! 
###  ))E6*002''0 uh7 A BA  	5ggll44G	5s.   *F F/F #F 
FF *GGc                   ^  U 4S jn T R                   R                  T R                  5      R                  5       n[	        U" U5      5      $ ! [
         a    / s $ f = f)Nc              3  @  >#    U  H  nUR                  SS5      n[        U5      S:  a  Uu  p4[        [        U5      U5      v   MA  UR	                  5       (       d  MX  TR
                  R                  [        S5      [        R                  " U5      -  5        M     g 7f)Nr[   rg   s   malformated mq status line: %s
)
r   ro   rS   r   r   r   warnr   r   pprint)ru   r   entrynrW   r0   s        r2   
parselines!queue.applied.<locals>.parselines  sz     a(u:>#GA%c!fd33WWYYGGLL=>$++E23 s   ABA B)r   r   r   
splitlineslistFileNotFoundError)r0   r  ru   s   `  r2   appliedqueue.applied  sR    
		KK$$T__5@@BE
5)**  	I	s   AA AAc                     U R                   R                  U R                  5      R                  5       $ ! [         a    / s $ f = fr.   )r   r   r   r  r  r\   s    r2   
fullseriesqueue.fullseries+  s=    	;;##DOO4??AA  	I	s   25 AAc                :    U R                  5         U R                  $ r.   )parseseriesseriesr\   s    r2   r  queue.series2  s    {{r6   c                :    U R                  5         U R                  $ r.   )r  seriesguardsr\   s    r2   r  queue.seriesguards7  s       r6   c                    SR                  5        H  nXR                  ;   d  M  [        X5        M!     SU l        SU l        SU l        S U l        g )Nz&applied fullseries series seriesguardsF)r   __dict__delattrr   r   r   r   )r0   as     r2   
invalidatequeue.invalidate<  sJ    9??AAMM!  B "   r6   c                   [         R                  " U R                  USU(       + U(       + S9nU R                  S:X  a  SUl        ObU R                  S:X  a  OQU R                  S;   a  U R                  S:H  Ul        O,[        R                  " [        S5      U R                  -  5      eU(       a  U R                  XB5      nU$ )z|Return diff options tweaked for this mq use, possibly upgrading to
git format, and possibly plain and without lossy options.T)git
whitespaceformatchangingr%      keep)r   r   r   s,   mq.git option can be auto/keep/yes/no got %s)
patchmoddifffeatureoptsr   r  upgrader'  r   Abortr   	patchopts)r0   r;   patchfnplaindiffoptss        r2   r2  queue.diffoptsE  s     ++GG y$9
 <<7"#H\\W$\\_,<<61HL++AB,,  ~~h8Hr6   c                    UR                  5       nUR                  (       dR  U R                  S:X  aB  U H<  nU R                  US5      n[	        S U 5       5      Ul        UR                  5         M>     U$ )z}Return a copy of input diff options with git set to true if
referenced patch is a git patch and should be preserved as such.
r*     rc              3  B   #    U  H  oR                  S 5      v   M     g7f)r   Nr   )r   r|   s     r2   r   "queue.patchopts.<locals>.<genexpr>g  s      #?EtOOM22vs   )copyr'  r  r   r   close)r0   r2  patchesr0  patchfs        r2   r/  queue.patchopts^  sf     ==?|| 7"Wd3" #?E#    # r6   c                X    [         R                  R                  " U R                  /UQ76 $ r.   )r   r   r   )r0   ps     r2   r   
queue.joinm  s    ww||DII***r6   c                p   ^ U4S jn[        U R                  5       H  u  p4U" U5      (       d  M  Us  $    g )Nc                T   > U R                  SS5      S   n U R                  5       T:H  $ )N   #rg   r   )r   r   )r   r   s    r2   
matchpatch$queue.findseries.<locals>.matchpatchq  s)    a #A779%%r6   )rs   r  )r0   r   rC  rm   r   s    `   r2   
findseriesqueue.findseriesp  s2    	& "$//2HE!}} 3 r6   s'   \s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)c                   / U l         / U l        U R                   H  nUR                  S5      nUS:X  a  UnSnOUS:X  a  M'  US U nXS  nUR	                  5       nU(       d  MI  X0R                   ;   a<  [
        R                  " [        S5      X0R                  U R                  5      4-  5      eU R                   R                  U5        U R                  R                  U R                  R                  U5      5        M     g )NrB  r   r6   r   s   %s appears more than once in %s)r  r  r  findr   r   r.  r   r   r   rJ   guard_refindall)r0   r   r~   r   comments        r2   r  queue.parseseries|  s    AtABwa"1B%KKMEuKK'++<= ))DOO"<=>  ""5)!!(()>)>w)GH% !r6   c                    U(       d  [        S5      $ SnUS   nUS;   a  [        S5      UU4-  $ U H  nXA;   d  M
  [        S5      X4-  s  $    g )Ns   guard cannot be an empty strings   # 	
r      -+s*   guard %r starts with invalid character: %rs!   invalid character in guard %r: %rr   )r0   guard	bad_charsfirstr   s        r2   
checkguardqueue.checkguard  si    788!	aE>BCG   Az=>%KK r6   c                   U H1  nU R                  U5      nU(       d  M  [        R                  " U5      e   [        [	        U5      5      nU R
                  R                  SSR                  U5      -  5        Xl        SU l	        g )Ns   active guards: %s
    T)
rR  r   r.  rE   setr   r3   r   r   r   )r0   guardsrO  bads       r2   	setactivequeue.setactive  sk    E//%(Cskk#&&  F$,tyy/@@A"r6   c                   U R                   c  / U l          U R                  R                  U R                  5      R	                  5       n[        U5       Hw  u  p#U R                  U5      nU(       a?  U R                  R                  SU R                  U R                  5      US-   U4-  5        M\  U R                   R                  U5        My     U R                   $ ! [
         a    / n Nf = f)Ns
   %s:%d: %s
rg   )r   r   r   r   r   r  rs   rR  r   r  r   rJ   )r0   rW  r{   rO  rX  s        r2   activequeue.active  s    $ "D))$//:@@B &f-ooe,GGLL&99T__5q1ucBC
 %%,,U3 .     % s   3C C*)C*c                $   U H  n[        U5      S:  a"  [        R                  " [        S5      U-  5      eUS   S;  a"  [        R                  " [        S5      U-  5      eU R	                  USS  5      nU(       d  M|  [        R                  " U5      e   U R
                  R                  SU R                  U   5      nUSR                  U Vs/ s H  nSU-   PM
     sn5      -   U R                  U'   U R                  5         S	U l
        g s  snf )
Nrh   s   guard %r too shortr   rN  s!   guard %r starts with invalid charrg   r6       #T)ro   r   r.  r   rR  rI  rG   r  r   r  r   )r0   idxrW  grX  drops         r2   	setguardsqueue.setguards  s    A1vzkk!$9":Q">??t5 kk!$H"IA"MNN//!AB%(Cskk#&&  }}  dooc&:;#chh6/J6a	6/J&KK 0Ks   D
c           	        [        U[        5      (       a  U R                  R                  U5      nU R                  U   nU(       d  gU R                  5       nU Vs/ s H'  oDR                  S5      (       d  M  USS  U;   d  M%  UPM)     nnU(       a  S[        R                  " US   5      4$ U Vs/ s H  oDR                  S5      (       d  M  UPM     nnU Vs/ s H  oDSS  U;   d  M  UPM     nnU(       aZ  U(       a  S[        R                  " US   5      4$ SSR                  U Vs/ s H  n[        R                  " U5      PM     sn5      4$ g	s  snf s  snf s  snf s  snf )
N)TN   -rg   Fr      +TrU  )Tr6   )

isinstancebytesr  rm   r  r\  rq   r   r  r   )	r0   r`  patchguardsrW  ra  exactnegposexactposr>  s	            r2   pushablequeue.pushable  s5   c5!!++##C(C'',"
"!ll4&8AQqrUf_A{ 	 
 *++HQK888%<+Qd);q+<"6s!evoAs6Z..x{;;;$))3$G3aZ%6%6q%93$GHHH

 =6 %Hs0   E9EE2EEE+E, E$
c                   U(       a  U R                   R                  nOU R                   R                  nU(       d  U R                   R                  (       Ga  [	        U[
        5      (       a  U R                  R                  U5      nU R                  U5      u  pEU(       ax  U(       aq  Uc"  U" [        S5      U R                  U   -  5        OLU(       d"  U" [        S5      U R                  U   -  5        O#U" [        S5      U R                  U   U4-  5        U(       dM  U(       a$  U" [        S5      U R                  U   U4-  5        g U" [        S5      U R                  U   -  5        g g g )Ns"   allowing %s - no guards in effect
s*   allowing %s - no matching negative guards
s   allowing %s - guarded by %s
s   skipping %s - guarded by %s
s!   skipping %s - no matching guards
)
r   writer  verboserh  ri  r  rm   rn  r   )r0   r`  all_patchesrq  rn  whys         r2   explainpushablequeue.explainpushable  s8   GGMMEGGLLE$''///#u%%kk'', MM#.MHx;@A++c*+
 LM"kk#./
 >?#{{3/56 :;;;s+S12
 ?@++c*+ + *r6   c                  ^ ^ U 4S jnT R                   (       a2  U" [        [        T R                  5      T R                  5        ST l         T R
                  (       a$  U" T R                  T R                  5        ST l        T R                  (       a$  U" T R                  T R                  5        ST l        T R                  (       a  T R                  5       mT(       ae  TR                  5          TR                  R                  T5         TS    R!                  U4S jT R                   5       5        S S S 5        S S S 5        / T l        g g ! , (       d  f       N= f! , (       d  f       N(= f)Nc                   > TR                  US5      nU  H  nUR                  SU-  5        M     UR                  5         g )Ns   wb   %s
)r   rq  r9  )itemsr   r   r{   r0   s       r2   	writelist"queue.savedirty.<locals>.writelist  s6    T5)B1% HHJr6   Fc              3  <   >#    U  H  oTS    ;  d  M  Uv   M     g 7fr.   r/   )r   fqrepos     r2   r   "queue.savedirty.<locals>.<genexpr>  s      $#-a%+1E:s   	)r   mapri  r  r   r   r  r   r   r   r   r   r  wlockdirstatechanging_filesadd)r0   r{  r  s   ` @r2   	savedirtyqueue.savedirty  s    	 c%.@ %Ddoot7$Dd''9$D::JJLE[[]ENN$A$A%$H$KOO $#'::$  %I] DJ  %I$H]]s$   .E
)E3E
E	E
E+c                B   UR                  S5      n[        R                  R                  U5      (       d  g  [        R                  " U5        g ! [
         aE  nU R                  R                  [        S5      [        R                  " U5      -  5         S nAg S nAff = f)Ns   undos   error removing undo: %s
)sjoinr   r   existsunlinkr   r   r  r   r   forcebytestr)r0   rK   undoinsts       r2   
removeundoqueue.removeundo  st    zz'"ww~~d##	IIdO 	GGLL./*2I2I$2OO 	s   A 
B;BBc                   [        U5       H  nUR                  U5      n[        R                  R	                  U5      (       d  M:  [
        R                  " U R                  X5      nU R                  R                  [        S5      U[        R                  R                  U5      4-  5        U(       a  [        R                  " XV5        M  [        R                  " XV5        M     g )Ns#   saving current version of %s as %s
)rE   wjoinr   r   lexistsr   
backuppathr   noter   relpathr   copyfilerename)r0   rK   filesr8  r~  absfabsorigs          r2   backupqueue.backup*  s    A::a=Dwwt$$!,,TWWd>=>"''//'234
 MM$0KK. r6   c	                    Uc  0 nUR                  S5      n	[        R                  " X   XX5      n
[        R                  " U R
                  UUX   X   U
UU	U5	        g )Ns   stat)r   r   matchr   diffordiffstatr   )r0   rK   r2  node1node2r  r   changesr;   statms              r2   	printdiffqueue.printdiff:  s_     <Dxx MM$+u3!!GGKK
	
r6   c                   U R                  X/SSUS9u  pxUS:X  a  Xx4$ Uc"  [        R                  " [        S5      U-  5      eU R                  R                  [        S5      U-  5        [        R                  " X5        [        U R                  X/SSS9  X   n	[        R                  " U	SS9n
U
(       a"  [        R                  " [        S	5      U
-  5      e[        US U	R                  5       U	R                  5       SS
9nUc  [        R                  " [        S5      5      e [        UR                  U5      U R                  5      nU R#                  Xd5      nU R%                  US5      n['        U5      nU(       a  UR)                  U5        U R+                  XX8US9  UR-                  5         U R/                  U5        SU4$ ! [          a#    [        R                  " [        S5      U-  5      ef = f)NFT)update_statusstrictmerger   s   apply failed for patch %ss"   patch didn't work out, merging %s
updater  )reminds   update returned %dforce   repo commit faileds   unable to read %s   w)r   )applyr   r.  r   r   r  r   cleanr   r  r   descriptionr   r   r   r   	Exceptionr/  r   ri  rq  r  r9  r  )r0   rK   mergeqheadr   revr2  errr  ctxretphr;  r   s                 r2   mergeonequeue.mergeoneU  s   ::'t3  
 !88O9++a <=EFFQ=>FG 	dggtSu=ihhs5)++a 56<==dD#//"3SXXZtL9++a 5677	?V[[/@B >>(2UD)9LL"tt6:1v  	?++a 45=>>	?s   &%G -G4c                t   UcX  UR                   R                  5       u  p4XAR                  :X  a  U$ U R                  (       d  gU R                  S   R                  $ UR
                  R                  U5      u  p4XAR                  :w  a+  X@R                   Vs/ s H  oUR                  PM     sn;   a  U$ U$ s  snf )zreturn the mq handled parent or p1

In some case where mq get himself in being the parent of a merge the
appropriate parent may be p2.
(eg: an in progress merge started with mq disabled)

If no parent are managed by mq, p1 is returned.
Nr   )r  parentsnullidr  rV   	changelog)r0   rK   r  rD   p2xs         r2   qparentsqueue.qparents}  s     ;}},,.HR[[ 	<<<<#((('','E1'E!EI	 (Fs   B5c           	     "   U R                   (       dJ  Sn[        US SSS9nU R                  U5        U R                   R                  [	        Xe5      5        SU l        U R                  U5      nU GH	  nUR                  USS9nU(       d)  U R                  R                  [        S5      U-  5          gU R                  U5      u  pU	(       d  U R                  USS9  Mp  UR                  U5      nU(       d)  U R                  R                  [        S	5      U-  5          gUS
   nU R                  XXxX5      u  pU(       a+  U R                   R                  [	        Xx5      5        SU l        U(       d  GM  X4s  $    U R                  5         SU4$ )Ns   .hg.patches.merge.markers   [mq]: merge markerTr  r  s   patch %s does not exist
)rg   Nrs  s   patch %s is not applied
rg   r   )r  r   r  rJ   rS   r   r  lookupr   r  r   rn  ru  	isappliedr  r  )r0   rK   r  r  r2  pnamer  r  r   rn  reasoninfor  r  s                 r2   
mergepatchqueue.mergepatch  sT   || 0E$&;4HAOOD!LLA 56 $D}}T"EMM%M5EQ;<uDE #}}U3H$$U$=##E*DQ;<uDE q'CdDOIC##K$<=$(!s{"' ( 	4yr6   c           	        [        5       n [        R                  " U R                  XSUSS9nS[	        U5      U4$ ! [
         a  nU R                  R                  [        R                  " U5      S-   5        U R                  R                  (       d$  U R                  R                  [        S5      5        U R                  R                  5         S[	        U5      S4s SnA$ SnAff = f)zHApply patchfile  to the working directory.
patchfile: name of patch filerg   N)r   r  eolmodeTr   s*   patch failed, unable to continue (try -v)
F)rV  r+  r   r   r  r  r  r   r  rr  r  r   	traceback)r0   rK   	patchfiler  fuzzr  s         r2   r   queue.patch  s     
	/>>D $u+t,, 	/GGLL006>?77??QMNOGG4;..	/s   /< 
C)BC$C)$C)c                0   S =n=p UR                  5       nUR                  5       nUR                  S5      n U R                  UUUUUUUUU	U
S9
nUR	                  5         U R                  5         U[        XU5        U R                  U5        $ ! [         a"    UR	                  5         U R                  5         e    UR                  5         U R                  5         e ! U R                  5         f = f= f! [        XU5        U R                  U5        f = f)N   qpush	all_filestobackupkeepchanges)r  r   transaction_applyr9  r  releaser  r   abortr$  )r0   rK   r  r  r  r  r  r  r  r  r  r  r   trr  s                  r2   r  queue.apply  s
    !   	"JJLE99;D!!(+Bkk!'% + "  
  Be$OOD! " 
 &HHJOO% OO% Be$OOD!s4   1C6 9B ,C3=CC3C00C33C6 6Dc                   U(       d  U R                   nSnSnU GH  nU R                  U5      u  pU(       d  U R                  USS9  M0  U R                  R	                  [        S5      U-  5        [        R                   R                  Xm5      n [        U R                  U5      U R                  5      nUR                  nU(       d  SU-  nO,U(       a  UR                  S	U-  5        S
R                  U5      nUR                  (       a  U	(       ap  [        R                   " U R                  UU5      n[#        U5      U	-  nU(       a#  U
(       a  [%        [        S5      [        S5      S9eU R'                  UUSS9  U	U-
  n	U R)                  UU5      u  nnnUb  UR+                  U5        U(       + nO-U R                  R                  [        S5      U-  5        S/ SnnnU(       az  U(       as  UR,                  R/                  U5         U H  nUR,                  R1                  USS9  M     UR,                  R3                  5       nUR5                  UU5        SSS5        U(       a?  SU;   a9  US   nUS   nSn[6        R8                  " UUUUU5      nUUR;                  5       -  n[<        R>                  " UU=(       d    / 5      nUR@                  RC                  5       n[E        USUURF                  URH                  USS9nUR@                  RC                  5       U:X  a  [J        RL                  " [        S5      5      eUc  [J        RL                  " [        S5      5      eU(       a$  U RN                  R                  [Q        X5      5        U(       a*  U R                  R                  [        S5      5        Sn  X4$ U(       d  GM  U(       d  GM  U R                  R                  [        S5      5        Sn  X4$    X4$ ! [         a/    U R                  R                  [        S5      U-  5        Sn   X4$ f = f! , (       d  f       GN= f)zreturns (error, hash)

error = 1 for unable to read, 2 for patch failed, 3 for patch
fuzz. tobackup is None or a set of files to backup before they
are modified by a patch.
r   NTr  s   applying %s
s   unable to read %s
rg   s   imported patch %s
s   
imported patch %sr   s   conflicting local changes founds   did you forget to qrefresh?hint)r8  s   patch %s is empty

p1_tracked   .hgsubstate   .F)r  r  s(   qpush exactly duplicates child changesets   repository commit faileds0   patch failed, rejects left in working directory
rh   s)   fuzz found when applying patch, stopping
   ))r   rn  ru  r   statusr   r   r   r   r   r   r  r   rJ   r   r+  changedfilesrV  r   r  r   r  r  changing_parentsupdate_file_p1rD   
setparentsr   submergekeysr   
matchfilesr  tipr   r   r   r   r.  r  rS   )r0   rK   r  r  r  r  r  r  r  r  r  r  r  	patchnamern  r  r   r  r   touchedpatcherrr  r  r~  rD   rN   pctx	overwritemergedsubstater  oldtips                                  r2   r  queue._apply  s   ( yyHI#}}Y7H$$YD$AGGNN1-.:;h2B 9!5t~~F jjG09<NN#9I#EF**W-{{&33DGGT2FG!'lX5G;,@A!"#A!B  KKgDK9''1H*.**T2*>'5$($$U+'<Q56BC()2q%]]33D9"44Q44H #))+BOOB.	 : ^y8DzDz!	!,!5!5$dI" ,,..&&tU[b9E^^'')FdGRWWbggU$A ~~!!#v-kkAB  ykk!$?"@AA##K$=>JK  x	 tQLMNxo  n x[  Q56BCT x[H :9s   %PAQ 3P=<P= 
Q	c                  ^ U(       d  U R                  5       nU(       aQ  UR                  5          UR                  R                  U5         US    R	                  U5        S S S 5        S S S 5        U H)  n [
        R                  " U R                  U5      5        M+     / nU(       a%  U R                  S U nU R                  S U2	 SU l
        / n/ nU H>  nU R                  U5      n	U	c  UR                  SU45        M,  UR                  X45        M@     UR                  SS9  U H+  u  pU
S:w  a  U R                  U
	 M  UR                  U5        M-     U(       a  U(       af  U Vs0 s H  oR                  UR                   _M     nnU H9  n[#        S5      mU R$                  R'                  T[)        X   5      U4-  5        M;     O:[#        S5      m[*        R,                  " SR                  U4S jU 5       5      5      eU R/                  5         SU l        U Vs/ s H  oR                   PM     sn$ ! , (       d  f       GN= f! , (       d  f       GN= f! [         a     GM  f = fs  snf s  snf )NTr   reverses*   revision %s refers to unknown patches: %s
s   unknown patches: %s
r6   c              3  .   >#    U  H
  nTU-  v   M     g 7fr.   r/   )r   r>  r1   s     r2   r   !queue._cleanup.<locals>.<genexpr>  s     *DGq37Gs   )r  r  r  r  forgetr   r  r   r  r  r   rE  rJ   sortr  rW   rV   r   r   r  r	   r   r.  r  r   )r0   r:  numrevskeeprr>  	qfinishedunknownsortedseriesr`  r{   r  r  r1   s                @r2   _cleanupqueue._cleanupj  s   

AWWY

 9 9! <dGNN7+ !=YIIdiil+  	Xg.IXgX& $DA//!$C{##RG,##SH-  	$' DABwOOA&q!	 ! ;DE9%zz5::-9E AJKCGGLLcfq'9!9: ! 01kk#((*DG*D"DEE(12	u

	22W != <YY
 ) 8 F 3sA   I	H7!I	7%I( I-I27
I	I		
I
I*)I*c                `   XR                   S   R                     R                  5       n/ n[        U5       H  u  pVXc:  a"  [        R
                  " [        S5      U-  5      eX   nU R                   U   R                  nUR                  5       U:w  a#  [        S5      n	[        R
                  " X-  5      eU R                   U   R                  n
S HC  nUR                  5       X-  :X  d  M  [        S5      n	UR                  R                  X-  5          O   UR                  U
5        M     U$ )Nr   s   revision %d is not manageds/   cannot delete revision %d above applied patches)   [mq]: %ss   imported patch %ss-   patch %s finalized without changeset message
)r  rV   r  rs   r   r.  r   rW   r  r   r  rJ   )r0   rK   revsfirstrevr:  r{   r  r  baser1   r   fmts               r2   _revpatchesqueue._revpatches  s    Q,,-113oFA~kk!$A"BS"HII)C<<?''DxxzT!JKkk#),,LLO((E:??$3MNCGGNN3;/	 ; NN5!# &$ r6   c                   UR                     U R                  U[        U5      5      nU R                  U[	        U5      5      nU(       a  UR
                  R                  SS5      (       a  XS      n[        R                  " UR
                  5      nUR                  5       U:  aU  UR                  5       R                  5       U::  a2  UR                  S5       n[        R                  " XXd5        S S S 5        g g g g g ! , (       d  f       g = f)Nr#   r)   r      qfinish)_phasecacher  rE   r
  ro   r   r   r   newcommitphaser   rD   r  advanceboundary)r0   rK   r  r:  r  oldqbasetphaser  s           r2   finishqueue.finish  s     	""46MM'3w<8	++E9==aL)H**4773F~~&(X[[]-@-@-Bf-L%%j1R**4VG 21 .M(	 >9
 21s   C>>
Dc                4   U(       d5  UR                  S5      (       d  [        R                  " [        S5      5      e/ nU H  nU R	                  USS9nU R                  U5      nU(       a"  [        R                  " [        S5      U-  5      eXPR                  ;  a"  [        R                  " [        S5      U-  5      eXT;  d  M  UR                  U5        M     SnUR                  S5      (       a  U R                  (       d  [        R                  " [        S5      5      e[        R                  " XR                  S5      5      nUR                  5         U R                  X5      n	XI-  n[        U	5      nU R                  XGUR                  S	5      5        g )
N   revs4   qdelete requires at least one revision or patch nameTr  s   cannot delete applied patch %ss   patch %s not in series filer      no patches appliedr*  )r   r   r.  r   r  r  r  rJ   r  r   revranger  r  ro   r
  )
r0   rK   r:  r;   realpatchesr   r  r  r  
revpatchess
             r2   deletequeue.delete  s?   txx//++IJ  EKKdK3E>>%(Dkk!$E"F"NOOKK'kk!$B"Ce"KLL'""5)  88F<<kk!$9":;;&&tXXf-=>DIIK))$5J%K*oGkDHHW,=>r6   c                
   U R                   (       ar  U R                   S   R                  nU R                   S   R                  nUR                  R	                  5       U:w  a  [
        R                  " [        S5      5      eX#4$ g)z'check that working directory is at qtipr   s&   working directory revision is not qtipNN)r  rV   rW   r  rD   r   r.  r   )r0   rK   topr   s       r2   checktoppatchqueue.checktoppatch  sf    <<,,r"''CLL$))E}}!S(kk!$M"NOO:r6   c                   [        U[        5      (       a  US S nO#UR                  UR                  UR                  4n[        S U 5       5      (       a  g UR                  (       d  UR                  (       d  US   R                  S5        g UR                  (       a  US   R                  S5        g US   R                  S5        g )Nr  c              3  ,   #    U  H
  nS U;   v   M     g7f)r  Nr/   )r   r  s     r2   r   ,queue.putsubstate2changes.<locals>.<genexpr>  s     8C5~&C   rg   r  rh   r   )rh  r  modifiedr   removedr   any_trackedrJ   )r0   substatestater  mars       r2   putsubstate2changesqueue.putsubstate2changes  s    gt$$"1+C##W]]GOODC8C888m&?&?FMM.)""FMM.)FMM.)r6   c                .   SnU(       a  Sn[        S5        [        S5        UR                  5       nU(       d  [        R                  " U5        UR                  (       d3  UR
                  (       d"  UR                  (       d  UR                  (       a-  [        S5        [        R                  " [        SU-   5      5      e[        U5      (       a-  [        S5        [        R                  " [        SU-   5      5      e U$ [        R                  " USS9  U$ )	Nr6   s   , qrefresh first#   local changes found, qrefresh firsts,   local changed subrepos found, qrefresh firsts   local changes founds   local changed subrepos foundT)	skipmerge)r   r  r
   checkunfinishedr.  r   r/  deletedr   r.  rQ   )r0   rK   r  refresh	excsuffixrP   s         r2   checklocalchangesqueue.checklocalchanges  s    	+I45=>KKM##D)zzQWW		QYY()kk!$:Y$F"GHHT""12kk5	AB  #  ##DD9r6   )r   r   r   r  s   ..c                   XR                   ;   a"  [        R                  " [        S5      U-  5      eXR	                  5       :w  a  [        R                  " [        S5      5      eS H;  nUR                  U5      (       d  M  [        R                  " [        S5      U-  5      e   S H>  nX1;   d  M
  [        R                  " [        S5      [        R                  " U5      -  5      e   g )Ns*   "%s" cannot be used as the name of a patchs.   patch name cannot begin or end with whitespace)   .hgs   .mqs!   patch name cannot begin with "%s")rB  r[      r   s(   %r cannot be used in the name of a patch)	_reservedr   r.  r   r   rq   r   bytestr)r0   rW   prefixr   s       r2   checkreservednamequeue.checkreservedname  s    >>!++?@4G  ::<++CD  'Fv&&kk:;fD  '
 ,AykkAB&&q)*  ,r6   c                   U R                  U5        U(       d  [        R                  R                  U R	                  U5      5      (       aw  [        R                  R                  U R	                  U5      5      (       a"  [        R                  " [        S5      U-  5      e[        R                  " [        S5      U-  5      eg g )Ns"   "%s" already exists as a directorys   patch "%s" already exists)	rD  r   r   r  r   isdirr   r.  r   )r0   rW   r  s      r2   checkpatchnamequeue.checkpatchname%  s    t$		$88ww}}TYYt_--kk;<tC  kk!$@"AD"HII 9ur6   c                   [         R                  " SSUR                  5       5      R                  S5      nUSS nU(       a   U R	                  U5        OUnUnSn X@R                  ;  a   U R                  U5         U$ US-  nSX54-  nM1  ! [
        R                   a    Un NNf = f! [
        R                   a     N?f = f)z\Return a suitable filename for title, adding a suffix to make
it unique in the existing lists   [\s\W_]+   _NK   r   rg   s   %s__%d)	rerG   r   r   rD  r   r.  r  rH  )r0   titlefallbacknamenamebaserW   r{   s         r2   makepatchnamequeue.makepatchname/  s     66,ekkm<BB4HCR=(&&x0 $H??*''-
  FA},D  ;; ('( {{ s$   B ,B) B&%B&)C ?C c                `    U(       a'  U(       a  [         R                  " [        S5      5      eg g )Ns*   cannot use both --force and --keep-changes)r   r.  r   )r0   r  r  s      r2   checkkeepchangesqueue.checkkeepchangesH  s#    [++a MNOO !5r6   c                r  ^  [         R                  " U5      nUR                  S5      nUR                  S5      nUR                  SS5      nUR                  S5      nUR                  S5      n	U	(       a  [        R                  " U	5      n	U R                  SUR                  S5      0SS	9n
UR                  S
S5      (       a  U R                  U5        [        U5      nU(       a  UR                  R                  S5      nUR                  S5      (       d  UR                  S5      (       d  U(       a,  S n[        R                  " US   X4US9nUR                  US9nOU R                  USS9n[        U5      nUR                  UR                   5        UR                  UR"                  5        UR                  UR$                  5        [        R&                  " UU5      n[)        US   R+                  5       5      S:  a  [,        R.                  " [1        S5      5      eU R3                  U5        U R5                  5       nUR7                  5           U R9                  US5      n SU-  m [B        RD                  " US9nU(       a*  U 4S jn[1        S5      n[B        RD                  " UUUS9nUnOU=(       d    T n[G        USUUU	USUS9nUc  [,        R.                  " [1        S5      5      e U/U RH                  UU& U RJ                  RM                  [O        UU5      5        U RQ                  5         SU l)        SU l*        UU   n[W        U RY                  U5      U RZ                  5      nU(       a  UR]                  U5        U	(       a  UR_                  SU	-  5        URa                  [c        URe                  5       Rg                  5       5      5        URi                  5       Rk                  5       nUT Rk                  5       :X  a  SnURm                  U5        URo                  [q        U5      5        U(       a]  U Rs                  UU5      nU(       a  U Ru                  WU5        [v        Rx                  " UUUUU
S 9nU H  nURo                  U5        M     UR{                  5         U R}                  5       nU(       aS  UR7                  5          UR                  R                  U5         US   R                  U/5        SSS5        SSS5        O U R                  U5        SSS5        g! [:         aG  n[,        R.                  " [1        S5      U[<        R>                  " UR@                  5      4-  5      eSnAff = f! , (       d  f       N= f! , (       d  f       N= f!   UR                  5         e = f! [         aa    U RY                  U5      n [        R                  " U5        e ! [:         a*    U R                  R                  [1        S!5      U-  5         e f = ff = f! , (       d  f       g= f)"zDoptions:
msg: a string or a no-argument function returning a string
   msg   edit   editforms   mq.qnew   userri   r$   Tr1  s	   checknamer  s   includes   excludec                D    U S:w  a  [         R                  " SX4-  5      eg )Nr  r   )r   r.  )r~  r1   s     r2   badfnqueue.new.<locals>.badfn`  s%    &++i1(&:;; 'r6   N)r]  r  r  rg   s   cannot manage merge changesetsr  s   cannot write patch "%s": %sr  editformc                6   > U R                  5       (       a  U $ T$ r.   )r   )desc
defaultmsgs    r2   
finishdescqueue.new.<locals>.finishdesc  s    ;;==#'K#--r6   +   Leave message empty to use default message.re  extramsgra  r  r  editorr     %d %dr6   )r  r  r  r;   s   error unlinking %s
)Hr   byteskwargsr   r   	parsedater2  rH  rQ   r  	get_entryr   r  r  r<  r  extendr.  r   r/  r  ro   r  r   r.  r   r(  fullseriesendr  r   r   r   
strtolocalstrerrorr
   getcommiteditorr   r  r  rJ   rS   r  r   r   r   r   r   r   r   r   r   rD   rV   r  r   r   rq  ri  r  r3  r+  diffr9  r  r  r  rollbackr  r   r  r   r  r  )!r0   rK   r0  patsr;   r1   editra  r   r   r2  rM   r1  r]  r  r  commitfilesrt   r>  erk  re  ri  	commitmsgr  nctxr  r   chunkschunkr  	patchpathrd  s!                                   @r2   new	queue.newL  s    ##D)hhvxx 88K4xx xx %%d+D==&$((6*:!;4=H88L$''( & MM33NCM88J488J#7#74< MM$t*dFEkkk.G,,T,>G8n7++,7==)7??+""45tDz!!#$q(++a ABCC4 ##%ZZ\KK.O(72
 00(C.  !!OPH$44#-!)!)F
 !$I # 1zI!	 9++a(=&>??&6=YDOOF62LL''Aw(?@$$&'+D$(,D%7D$TYYw%7HB

4(

8d?3LLTWWY^^%5!67**,224Cj..00!MM#&GGE"I&"!%tQ!7# 44]GL!) "("#$+!)" &,EGGEN &,GGI

AWWY

(A(A!(DdGKK	2 )EYY  OOD!s \  kk45 3 3AJJ ?@A R )E(DYYMMO  IIg.	IIIi(   IGGLL#:!;i!GHI	e \s   X(T.(BV:0G V$V,VV
V$X(.
U?8AU::U??X(
VV
V!	V$ X(!V$$V77V::X%W-,X%-1X!X% X!!X%%X((
X6c                    [        U R                  5       H/  u  p#UR                  U:X  d  M  X#R                  UR                  4s  $    g)zreturns (index, rev, patch)N)rs   r  rW   rV   )r0   r   r{   r#  s       r2   r  queue.isapplied  s:    dll+DAvv66166** , r6   c                D  ^  U 4S jnUT R                   ;   a  U$ [        R                  R                  T R	                  U5      5      (       Gdo   [        U5      n[        T R                   5      * Us=::  a  [        T R                   5      :  a  O  OT R                   U   $  U(       Gd  U" U5      nU(       a  U$ UR                  S5      nUS:  aa  U" US U 5      nU(       aO  T R                   R                  U5      n [        XS-   S  =(       d    S5      nXx-
  S:  a  T R                   Xx-
     $  UR                  S5      n	U	S:  at  U" US U	 5      nU(       ab  T R                   R                  U5      n [        XS-   S  =(       d    S5      nXx-   [        T R                   5      :  a  T R                   Xx-      $  [        R                  " [        S5      U-  5      e! [        [        4 a     GNQf = f! [        [        4 a     Nf = f! [        [        4 a     Naf = f)Nc                
  > U TR                   ;   a  U $ TR                    Vs/ s H  oU;   d  M
  UPM     nn[        U5      S:  aO  TR                  R                  [	        S5      U -  5        U H!  nTR                  R                  SU-  5        M#     g U(       a  US   $ TR                   (       aM  TR
                  (       a<  U S:X  a!  TR                   TR                  S5      S-
     $ U S:X  a  TR                   S   $ g s  snf )Nrg   s   patch name "%s" is ambiguous:
s     %s
r      qtipT   qbase)r  ro   r   r  r   r  	seriesend)rP   r  matchesr  r0   s       r2   partialname!queue.lookup.<locals>.partialname  s    DKK"&++8+Qaq+G87|aQABQFG AGGLLQ/ !qz!{{t||<;;t~~d';a'?@@=;;q>) 9s
   	D D rf  r   rg   rg  s   patch %s not in series)r  r   r   isfiler   intro   r   OverflowErrorrfindrm   r   r.  r   )
r0   r   r  r  snoresminusr{   offpluss
   `         r2   r  queue.lookup  s   	$ DKKLww~~dii.//,%j $$>c$++.>>;;s++ ? !%(JD)A:%eFUm4C KK--c2<"%eAIK&8&=A">C  !w!|'+{{17'; ;  ,{{4(19%eETl3C KK--c2<"%e1HJ&7&<1"=C  !wT[[)99'+{{17'; ;  :kk!56>??E . " !+M: ! ! !+M: ! !s6   G ?G6 7H G32G36H	H	HHc           
     $   U R                  X5        U R                  5       nUR                  5          / nUR                  5       R	                  5        H  nUR                  U5        M     U(       d  UR                  /nUR                  R                  5       U;  a+  U(       d$  U R                  R                  [        S5      5        U R                  (       d.  U R                  R                  [        S5      5         S S S 5        gU(       Ga8  U R                  U5      nU R                  U5      nU(       aP  US   [!        U R"                  5      S-
  :  a1  U R                  R                  [        S5      U-  5         S S S 5        gU R%                  U5      u  nnU(       aP  U R                  R'                  U5      U R)                  5       :  a"  [*        R,                  " [        S5      U-  5      eOU(       a  [        S5      U-  nO[        S5      nU R                  R                  [        S	5      UU4-  5         S S S 5        gU(       aS  U R                  S
   nU R                  U5      (       a.  U R                  R                  [        S5      5         S S S 5        gU R)                  5       nU[!        U R                  5      :X  a.  U R                  R                  [        S5      5         S S S 5        gU(       d   U
(       d  U R/                  XR"                  S9  U(       Ga  U
(       a  [*        R,                  " [        S5      5      eU(       a  [*        R,                  " [        S5      5      eU R"                  (       a  [*        R,                  " [        S5      5      eU R                  U   n[1        U R3                  U5      U R4                  5      R6                  nU(       d"  [*        R,                  " [        S5      U-  5      eUU   US   :X  d  [8        R:                  " UU5        U(       Ga-  U(       d  [*        R,                  " [        S5      5      e[=        U R>                  5       H8  u  nnU R@                  RC                  US5      S   U R                  U   :X  d  M8    O   [=        U R>                  WS  5       H+  u  nnU R@                  RC                  US5      S   U:X  d  M+    O   UW-   nU[!        U R>                  5      :  d   eU R>                  U   nU R>                  U	 U R>                  RE                  UU5        U RG                  5         SU l$        SU l%        US:  a  U RM                  U5        U(       d  U R                  U   nUS-   nOU R                  R'                  UU5      S-   n[O        5       nU	(       d  U(       d  U
(       a  U R/                  USS9nU
(       aC  UR;                  URP                  URR                  -   URT                  -   URV                  -   5        O(UR;                  URP                  URR                  -   5        U R                  UU n[O        5       n U(       a  U RY                  XUU5      nOU R[                  UUUUUU
S9n U R"                  (       d  US   sS S S 5        $ U R"                  S
   Rf                  n US   (       a3  US   S:  a*  [        S5      n!U R                  Ri                  U!U -  5        O'U R                  Ri                  [        S5      U -  5        US   sS S S 5        $ ! [\         a    e   U R                  R                  [        S5      5        [^        R`                  " U R                  UUS   SS9  U H/  nUUR                  ;  d  M  URb                  Re                  USS9  M1     U R                  R                  [        S5      5        e = f! , (       d  f       g = f)Ns"   (working directory not at a head)
s   no patches in series
r   rg   s    qpush: %s is already at the top
s#   cannot push to a previous patch: %ss   guarded by %ss   no matching guardss   cannot push '%s' - %s
r   s"   all patches are currently applied
s#   patch series already fully applied
)r:  s.   cannot use --exact and --keep-changes togethers&   cannot use --exact and --move togethers(   cannot push --exact with applied patchess"   %s does not have a parent recordedr  s    please specify the patch to moveTr  r  s!   cleaning up working directory...
)	no_backupignoremissings   done
s0   errors during apply, please fix and qrefresh %s
   now at: %s
)5rT  r2  r  	branchmap	iterheadsrp  r  r  rD   r   r  r   r  r  r  r  ro   r  rn  rm   r  r   r.  r<  r   r   r   r   r   r  rs   r  rI  r   rt   r  r   r   r(  rV  r.  r   r/  r9  r  r  r   r
   revertwvfs
unlinkpathrW   rq  )"r0   rK   r   r  r  r  allmoveexactnobackupr  r2  headshsr  rn  r  rx   roottarget	fullstartrpnr{   rm   	fullpatchendr  r  rP   r  r  r~  r'  r1   s"                                     r2   push
queue.push  s    	k1==?ZZ\Enn&002R  3}}!.uq!GHI;;Q89: \" E*~~e,DGs4<<'81'<<GGLL>?%G 1 \4 $(==#7 &{{((/$..2BB#kkDEM  C
 !"#3!4v!=!"#8!9GGLL45G Q \R B>>%((GGLL#I!JK[ \h NN$EDKK((QFGHo \p &&t\\&B++KL  ++CD  <<++EF  {{5)$TYYt_dnnELL++?@4G  F|tDz1IIdF+++a(K&LMM&/&@NIs}}**3215U9KK 'A (	
(CDFAs}}**3215> E "As4??3333 OOE2	OOE*&&y)<  "#'  $Dqy""4(E*aikk''u59uH;//D/AOO ,,' ..) !..) OOFOOfll$BCE#&AI//$8DC**"+!)$/ % C4 <<1vw \x ,,r"''C1v#a&1*LMcCi(a0367q6E \P " QDEFGGJ"	 #A-		,,Qd,C # Qy\*q \sp   C`A8`B6`A`!A`8F,`(A`/F`6]`]%`B`A'_>;A_>>`
`c           	       ^ U R                  Xs5        UR                  5          U(       ac  U R                  U5      nU(       d  U R                  U5      nU R                  U5      nU(       d"  [        R
                  " [        S5      U-  5      eU R                  (       d4  U R                  R                  [        S5      5        U(       + sS S S 5        $ U(       a  Sn	O(U(       a	  WS   S-   n	O[        U R                  5      S-
  n	U	[        U R                  5      :  a1  U R                  R                  [        S5      U-  5         S S S 5        g U(       dv  UR                  R                  5       mU R                   V
s/ s H  oR                  PM     nn
T H0  nX;   d  M
  U R                  R                  [        S5      5        SnM2     OSUS    R                  5        Vs/ s H  oR                  5       PM     snm[        U4S jU R                  U	S   5       5      n[        5       nU(       a  U R!                  X=(       d    US	9nU(       a0  U(       d(  UR#                  UR$                  UR&                  -   5        OIU(       aB  UR#                  UR$                  UR&                  -   UR(                  -   UR*                  -   5        SU l        [        U R                  5      nU R                  U	   R                  n UR.                  R1                  U5      nUU R                  S   R                  /:w  a  [        R
                  " [        S5      5      eXR                  S   R                     R7                  5       (       d'  [        R
                  " [        S5      [        S5      S9eU(       Ga  U R9                  UU5      nUU   nUR;                  US5      nUR$                  UR&                  UR(                  UR*                  4u  nnnnU(       a  [        R
                  " [        S5      5      e[        UU-   U-   5      U-  nU(       a&  U(       a  [        R
                  " [        S5      5      eU R=                  X5        UR                  R?                  U5         U H8  nUR@                  RC                  USS9  UR                  RE                  USSS9  M:     UU-    HR  nUU   nURG                  UURI                  5       URK                  5       5        UR                  RE                  USSS9  MT     URM                  UURN                  5        S S S 5        [Q        U R                  X 5       H4  nU R                  R;                  [        S5      URR                  -  5        M6     U R                  X2	 [U        U R                  UU/SSS9  US   RV                  RY                  5        H)  u  nnUS   R[                  U5      R]                  U5        M+     U R                  (       a?  U R                  R_                  [        S5      U R                  S   RR                  -  5        O$U R                  R_                  [        S5      5        S S S 5        g s  sn
f s  snf ! [        R2                   a.    [5        U5      n[        R
                  " [        S
5      U-  5      ef = f! , (       d  f       GN= f! , (       d  f       g = f)Ns   patch %s is not applied   no patches applied
r   rg   s   qpop: %s is already at the top
s   qpop: forcing dirstate update
Tc              3  @   >#    U  H  oR                   T;   v   M     g 7fr.   )rV   )r   r  r  s     r2   r   queue.pop.<locals>.<genexpr>  s      7KeJJ')7Ks   r  s   trying to pop unknown node %sr   s?   popping would remove a revision not managed by this patch queues&   popping would remove a public revision    see 'hg help phases' for detailsr  r  s!   deletions found between repo revsr6  r  Fr  
wc_trackeds   popping %s
r  r  s   patch queue now empty
)0rT  r  r  r  r   r.  r   r  r   r  ro   r  r  rV   r   rV  r<  r  r.  r   r/  r9  r   r  r  LookupErrorr	   mutabler  r  r  r  r  r  update_filewwritedataflagsr  r  reversedrW   r   rF   rz  rG   r   rq  )r0   rK   r   r  r  r  r  r  r  rx   r  rrr>  r  rP   r  r  r  rV   qpr  str  r#  r  dr~  fctxstater  s                                @r2   pop	queue.pop  s|    	k1ZZ\~~e, KK.E~~e,++a(B&Ce&KLL<< Q678w \  Q!DLL)A-DLL))QBCeKL3 \6 --//1&*ll3lffl3 AwQ'I%JK!% !
 .2$Z-?-?-AB-A668-AB 7;||EF7K  uH**47K*L# 

QWW(<= OO

QWW,qyy8199D !%Ddll#C,,u%**CN,,S1
 b)..//kk7  R(--.6688kk?@>?  ]]4-2h[[T*[["((BJJ

J
1a++a(L&MNNq1uqy>H48++a(N&OPPD+]]33D9		,,Qd,C11%E 2  
 U"1vAtyy{DJJLA11$4 2  # OOB4 : "$,,u"9:q1EJJ>? ;UY'$''4#uUC J//5575T
q!%%e, 8||a04<<3C3H3HHIa :;<] \: 4 C, $$ NSzkk!$D"E"LMMN> :9q \ss   B&[=A3[=/[=>Z
[=!A [=!Z!:D[=>Z&F	[="B6[+D;[=
[=&A[(([=+
[:	5[==
\c           	     "   U R                  U5      u  pEU(       d%  U R                  R                  [        S5      5        g U R	                  X5      nUR                  S5      (       a  S UpOUS pU R                  X55      n	U R                  XXxX#S9  g )Nr  s   reverse)r  r;   )r(  r   rq  r   r  r   r2  r  )
r0   rK   rw  r;   r'  r   r  r  r  r2  s
             r2   ru  
queue.diffD  s{    ''-
GGMM!345]]4%88J5t5==-tu4Kr6   c                (  ^>^? [         R                  " U5      nU R                  (       d%  U R                  R	                  [        S5      5        gUR                  SS5      R                  5       nUR                  S5      nUR                  SS5      nUR                  S5      nUR                  S	5      nU(       a  S
[        R                  " U5      -  nUR                  5       n	 U R                  U5        U R                  S   R                  U R                  S   R                  pUR                  R                  U
5      U
/:w  a  [         R"                  " [        S5      5      eX   R%                  5       (       d'  [         R"                  " [        S5      [        S5      S9eUR                  R'                  U
5      nU R)                  X5      n[+        X5      nU(       a  UR,                  R/                  S5      n[1        U R3                  U5      U R4                  5      m?U R7                  SUR                  S5      0USS9nU(       a  T?R9                  U5        U(       a  T?R;                  U5        T?R=                  [?        U5      5        U RA                  USSS9nURC                  X5      nURD                  URF                  URH                  nnnX   nUS S  n[J        RL                  " US    X#5      nUR                  S5      (       aG  [J        RN                  " UUU-   U-   URQ                  5       -   5      n[J        RL                  " US    US9nO[J        RR                  " U5      nURC                  US9nURD                  URF                  URH                  URT                  4u  nnnn[W        U5      n[W        U5      n[W        U5      nU H  nUU;  d  M  URY                  U5        M     U H>  nUU;   a$  UR[                  U5        URY                  U5        M-  URY                  U5        M@     / n UU-    HO  nUU;   a$  UR[                  U5        U R]                  U5        M-  UR_                  U5        URY                  U5        MQ     [a        U5      n[a        U5      n[a        U5      nURC                  UUS9nURD                  URF                  URH                  URT                  4u  n!n"n#n$[W        U!U"-   U#-   U$-   5      n%UUU4 Vs/ s H  nURc                  U%5      PM     n&n[W        U5      n'U& H  nU'Re                  U5        M     [J        RN                  " UU'5      nX   Rg                  5       n(UR,                  Ri                  U5         URj                  (       d  URl                  (       Ga.  0 n)U Hm  n*UR,                  Ro                  U*5      n+U+b1  U+UR,                  ;   a!  U)Rq                  U+/ 5      R]                  U*5        UR,                  Rs                  U*SSS9  Mo     U Hs  n*UU*   Ru                  5       n+U+(       aK  U)Rq                  U+/ 5      Rw                  U)R                  U*/ 5      5        U*U;   a  U)U+   R]                  U*5        U*U);   d  Mp  U)U*	 Mu     U)Ry                  5        H+  u  n+n,U, H  n*UR,                  R{                  U+U*5        M!     M-     OjU H  n*UR,                  Rs                  U*SSS9  M      [a        UR,                  R}                  5       5       H  n-UR,                  R{                  S U-5        M!     U H  n-UR,                  R                  U-SS9  M     / n[        [        U5      S-
  SS5       H,  n.U" UU.   5      (       a  M  UR]                  UU.   5        UU.	 M.     U H  n-UR,                  R                  U-SS9  M     U H  n-UR,                  R                  U-SS9  M     U  H  n-UR,                  R                  U-SS9  M     T?R                  =(       d    UR                  5       n/X   R                  5       n0UR                  " U6   UR,                  R	                  UR                  5       5        U R                  R                  5         SU lG        [        U R                  X/SSS9  S S S 5         SU-  m>[        R                  " US9n1U(       aM  U>U?4S jn2[        S 5      n3[        R                  " U2U3US!9n1U=(       d    S"R3                  T?R                  5      n4OJU(       d0  T?R                  (       d  T>n4O/S"R3                  T?R                  5      n4OUn4T?R                  U5        S =n5n6 UR                  5       n5UR                  S#5      n6[        UW0U4W/T?R                  USU1S$9n7U& Vs/ s H  n[a        U5      PM     n8nU(       a  U R                  WU85        [        R                  " XU8US%9n9[        T?5      n:U:(       a  UR	                  U:5        U9 H  n;UR	                  U;5        M     UR                  5         UR                  n<U<R                  UU6U( V=s/ s H  n=U=U74PM	     sn=5        U6R                  5         U R                  R]                  [        U7U5      5        [        R                  " U6U55         U	R                  5         U R                  U5        g s  snf ! , (       d  f       GND= fs  snf s  sn=f ! [        R                  " U6U55        f = f!   UR,                  Ri                  U5         XS&      nUR,                  R                  UR                  5       UR                  5       5        S S S 5        O! , (       d  f       O= fU R                  5         U R                  R                  [        S'5      5        e = f! U	R                  5         U R                  U5        f = f)(Nr  rg   rW  r6   rX  rY  s   mq.qrefreshrZ  ri   rl  r   s(   cannot qrefresh a revision with childrens   cannot qrefresh public revisionr  r  r  r$   Tr[  r  )
atomictemp   shortr;   r_  Fr  r  r  r  r`  c                X   > U R                  5       (       a  TR                  U 5        U $ T$ r.   )r   r   )rc  rd  r  s    r2   re  !queue.refresh.<locals>.finishdesc  s%    ;;==MM$/#'K))r6   rg  rh  r   r#   rj  )r  r;   r   sN   qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
)`r   rm  r  r   rq  r   r   r   r   rn  r  r(  rV   rW   r  r  r   r.  r  r  r  rQ   r  ro  r   r   r   r2  r   r   r   r   r   r  r.  r   r/  r   r  r  r  matchallr9  rV  r  removerJ   discardr  intersectionr  	bookmarksr  r'  r-  copied
setdefaultr  
copysourcerp  rz  r8  copiesr  rp   ro   r   r   r  currenttransactionr  r   r   r
   rt  r   r   r   r  r   r   r3  r+  ru  ri  r9  
_bookmarksapplychangesrS   lockmodr  rebuildmanifestr  r  r  )@r0   rK   rw  r;   r1   rx  ra  newusernewdater  r'  r0  cparentspatchparentrM   r1  r2  r;  r  mmaaddr  aaamatch1r  stbr  r#  r  r  r  r  cmcacrcd
allmatchesrefreshchangesr  bmlistr  dstsrcdstsr~  r{   r   oldphaserk  re  ri  r   r   r  r  r   r}  r   r~  marksbmrd  r  s@                                                                 @@r2   r:  queue.refreshQ  s	   ##D)||GGMM!345hhvs#**,xx 88K8((7#((7#!3!3G!<<G

z	"t$"ll2.33T\\"5E5J5J'~~##C(SE1kkAB  9$$&&kk89>? 
 ~~--c2H--2K$T7H $ 7 7 GTYYw/@B}}&)*G4 % H 

7#

7#LL[)* [[$4[@F [.Bbhh

BB)CQ%C]]4:t:F xx!!  **4b21NO tDz=((.++E+*Csyy#++s{{JJAq!QRBRBRB B;FF1I  7IIaLFF1IFF1I  FU7IIaLMM!$JJqMq	  RARARA [7B[["((BJJ

JNBBR"Wr\B./JCEr2,O,QannZ8,NOME#Q $&&tU3EY((*F//5<<8#3#3#3F "mm2237 ?sdmm/C"--c26==cB11Ed 2   !  #!#h113"--c26== &

3 3  #ax &s 2 23 7&= &s  # &,\\^	T#'C MM..sC8 $( &4  !11Ed 2   !
 "$--"6"6"89**43 :AMM00t0D  s1vz2r2A!!A$<<		!A$aD 3 AMM00t0D AMM00t0D AMM00u0E   ww,#((*9??, *##D$;$;$=>  "$(!dggtU5Gy 6|N )72
 00(C*  !!OPH$44#-!)!)F
 ";UZZ

%;G::","'**RZZ"8!GMM#& ! r!.99;D))%0B! #"%	A +99.Qa.A900B%]]18F  %RyHX.!'U+ "(LLN OOE&&tRF1KFb2q'F1KLHHJLL''Aw(?@OOB- MMOOOD!q P 65Z : 2L
 OOB-]]33D9{+CMM))#((*cllnE :99  > MMOOOD!s   %K1o. D2o. l'A+o. DlD l!D)l
o. B;l? ?l# l#Bl# >l<l# l? o. 
lo. 
l# #l<<l? ?o+A n%	o+%
n3	/<o++o. .#pc                J   U(       dM  [         R                  R                  U R                  5      (       a  [        R                  " [        S5      5      e [         R                  " U R                  5        U(       a  U R                  SS9$ g ! [         a    U(       d  e  N+f = f)Ns$   patch queue directory already existsTcreate)	r   r   rG  r   r.  r   mkdirFileExistsErrorr  )r0   rK   r  s      r2   init
queue.init[  s|    "''--		22++a GHII	HHTYY ::T:**   	 	s    B B"!B"c                   U(       a1  X R                   ;  a"  [        R                  " [        S5      U-  5      eU(       d  U R	                  5       nOU R                   R                  U5      S-   n/ n[        U[        U R                   5      5       HM  nU R                  U5      u  pgU(       a  UR                  XPR                   U   45        U R                  U5        MO     U$ )N   patch %s is not in series filerg   )r  r   r.  r   r  rm   rp   ro   rn  rJ   ru  )r0   rK   r   rx   	unappliedr{   rn  r  s           r2   r  queue.unappliedf  s    U++-++a ABUJKKNN$EKK%%e,q0E	uc$++./A#}}Q/H  ![[^!45  #	 0
 r6   c                V  ^ ^ U U4S jnT R                    Vs1 s H  oR                  iM     n	nUc  [        T R                  5      U-
  nU(       d  T R                  R
                  (       a  [        SX4-   S-
  -  5      n
[        X3U-   5       Hz  nT R                  U   nX;   a  Su  pO"T R                  U5      S   (       a  Su  pOSu  pSnT R                  R
                  (       a  S	W
X4-  nOU(       a  X]:w  a  Mq  U" XU5        M|     g / n[        R                  " T R                  5       H  u  nnnU[        T R                  5      S-   S  nU H  n[        R                  R                  UU5      nUT R                  ;  d  M5  UT R                  T R                  T R                  4;  d  M^  UR                  S
5      (       a  Mv  UR!                  U5        M     M     [#        U5       H5  nT R                  R
                  =(       a    S=(       d    SnU" UUS5        M7     g s  snf )Nc                  > U (       a  TR                   R                  U 5        T(       Ga  [        TR                  U5      TR                  5      nUR
                  (       a  UR
                  S   nOSnTR                   R                  5       (       aT  TR                   R                  5       [        U 5      -
  [        U5      -
  S-
  nUS:  a  [        R                  " XE5      nOSnTR                   R                  USU-   S9  TR                   R                  S5        TR                   R                  USU-   S9  OTR                   R                  USU-   S9  TR                   R                  S5        g )	Nr   r6   rh   s   qseries.labels   : s   qseries.message.r   )r   rq  r   r   r   r   	formatted	termwidthro   r   ellipsis)pfxr  r  r  r1   widthr0   summarys         r2   displayname"queue.qseries.<locals>.displayname~  s   c" 9!5t~~F::**Q-CC77$$&& GG--/#c(:S^KaOEqy(11#=!i{U/BCe$c)<u)DEi{U/BCGGMM% r6      %drg   )   A   appliedr   )   U	   unapplied)   G   guardedr6   s   %*d %s r  s   D    missing)r  rW   ro   r  r   rr  rp   rn  r   walkr   r   r   r   r   rq   rJ   rE   )r0   rK   missingrx   lengthr  r  r  r>  r  idxwidthr{   r   charr  r  	msng_listr  dirsr  r  r~  flr  s   `     `                 r2   qseriesqueue.qseriesu  s   	!. $(<<0<a66<0>%-Fwwu(:;<5&.1A#"2KD%]]1%a("4KD%"2KD77??$!'::CC. 2 I%'WWTYY%7!dETYY!+-.Aa+B$++- OO OO OO  !#d 3 3!((,  &8 I&ggoo/%63CJ/ 'K 1s   H&c                &    UR                   S:X  a  gg )N   .hg.patches.save.lineT)rW   )r0   r   s     r2   
issavelinequeue.issaveline  s    66-- .r6   c                0   U R                   R                  5       nU R                  R                  (       a  UR                  (       dw  U R                  R                  Ul        UR	                  SSU R                  R                  SS5      S5        UR	                  SSU R                  R                  SS5      S5        U(       d3  [        R                  R                  U R                  S5      5      (       a  [        R                  " X R                  US9$ g )Nr   s	   formatteds   mqpagers   interactiver?  )r   r  )r   r8  r   pageractiver   r   r   r   rG  r   r   
repository)r0   r  r   s      r2   r  queue.qrepo  s    [[77r~~!WW00BNLLul3	 LLun5	 RWW]]499V#455==))FCC 6r6   c                <   X   R                  5       R                  5       nUR                  5       nS n/ n/ n	S n
[        U5       H  u  pUS:X  a  US-   nM  UR	                  S5      (       aA  UR                  5       nUSS  R                  S5      nU Vs/ s H  n[        U5      PM     n
nMi  Uc  Mn  UR                  5       nUR                  SS5      u  nnU(       a&  U	R                  [        [        U5      U5      5        M  UR                  U5        M     Uc%  U R                  R                  [        S5      5        gU R                  R                  [        S5      US	   -  5        Xl        Xl        U R                  5         S
U l        S
U l        UR$                  R'                  5       nU(       a  UU;  a%  U R                  R                  [        S5      5        OlU R                  R                  [        S5      [)        U5      -  5        UR*                  R-                  5       nUU;   a  S
nOSn[        U R                  X/USS9  U
(       a  U R                  R                  [        S5      [)        U
S	   5      [)        U
S   5      4-  5        U(       a{  U R                  R/                  [        S5      5        U R1                  5       nU(       d%  U R                  R                  [        S5      5        g[2        R4                  " UU
S	   5        g g g s  snf )Ns   Patch Data:rg   s	   Dirstate:r   rU  r[   s   no saved patch data found
s   restoring status: %s
r   Ts*   save entry has children, leaving it alone
s   removing save entry %s
Fr  s&   saved queue repository parents: %s %s
s   updating queue directory
s    unable to load queue repository
)r  r   r  rs   rq   r   r   r   rJ   rS   r   r  r   r  r  r  r   r   r  r  r	   r  r  r  r  r   r  )r0   rK   r  r#  qupdaterc  ru   	datastartr  r  qppr{   r|   r   r  r  rW   r  ppr  r  s                        r2   restorequeue.restore  s{   y$$&,,.!	 'GA~%E	..KKMbcFLL&'()q!s1vq)&KKM''$*4NN;s1vt#<=MM!$ ( GGLL9:;Q01E!H<=  $$&%QMNOQ:;eCjHI]]**,"9!F"FdggtU6%HGGLL<=Q=%A-01 q!>?@JJLGGLL#G!HICF#  ; *s   Lc                   U R                   (       d%  U R                  R                  [        S5      5        gU R	                  U R                   S   5      (       a%  U R                  R                  [        S5      5        gU(       d  [        S5      nOSUR                  S5      -   nU R                  5       nU(       a<  UR                  R                  5       nUS[        US	   5      [        US   5      4-  -  nUS
-  nUSR                  S U R                    5       5      -  nUSR                  S U R                   5       5      -  nUR                  USS9nU(       d%  U R                  R                  [        S5      5        gU R                   R                  [        US5      5        SU l        U R!                  U5        g )Ns"   save: no patches applied, exiting
rg   r   s   status is already saved
s   hg patches saved states   hg patches: s   
s   
Dirstate: %s %sr   s   

Patch Data:
r6   c              3  ,   #    U  H
  nS U-  v   M     g7f)ry  Nr/   r   r  s     r2   r   queue.save.<locals>.<genexpr>	  s     :\!\r-  c              3  ,   #    U  H
  nS U-  v   M     g7f)s   :%s
Nr/   r-  s     r2   r   r.   	  s     >o1or-  Tr  s   repo commit failed
r  )r  r   r  r   r  r   r  r  r  r   r   r  r   rJ   rS   r   r  )r0   rK   r1   r  r(  r  s         r2   save
queue.save	  sZ   ||GGLLABC??4<<+,,GGLL789-.C!CJJw$77CJJL##%B'3r!u:s2a5z*BBBC##sxx:T\\:::sxx>doo>>>KK4K(GGLL234K+CDE r6   c                    U R                   (       aG  U R                   S   R                  nU R                  U5      nUc  [        U R                  5      $ US-   $ g)Nr   rg   r   )r  rW   rE  ro   r  )r0   r>  r  s      r2   rq  queue.fullseriesend)	  sK    <<R %%A//!$C{4??++7Nr6   c                   ^ ^ SnUU 4S jnT R                   (       a@  T R                   S   R                  n T R                  R                  U5      nU" US-   5      $ U" U5      $ ! [         a     gf = f)zIf all_patches is False, return the index of the next pushable patch
in the series, or the series length. If all_patches is True, return the
index of the first patch past the last applied one.
r   c                  > T(       d  U [        TR                  5      :  a  U $ [        U [        TR                  5      5       H2  nTR                  U5      u  p#U(       a  Us  $ TR	                  U5        M4     [        TR                  5      $ r.   )ro   r  rp   rn  ru  )rx   r{   r>  r  rs  r0   s       r2   	nextpatch"queue.seriesend.<locals>.nextpatch9	  sl    es4;;'775#dkk"23 MM!,	H$$Q'	 4
 t{{##r6   r   rg   )r  rW   r  rm   r   )r0   rs  r  r6  r>  s   ``   r2   r  queue.seriesend2	  st    
 	$ <<R %%Akk''* S1W%%~  s   A% %
A21A2c                    U R                   U   R                  nU R                  R                  (       d  UnU$ SU R                  R                  U5      -  S-   U-   nU$ )Nr
  rU  )r  rW   r   rr  r  rm   )r0   rm   r  r>  s       r2   appliednamequeue.appliednameL	  sW    U#((wwA  **511T9EAAr6   c           
       ^  U 4S jnU(       aL  U(       a  [         R                  " [        S5      5      e[        R                  " X5      nUR                  SS9  O&U(       d  [         R                  " [        S5      5      e[        U5      S:  d  [        U5      S:  a&  U(       a  [         R                  " [        S5      5      e/ n	U(       Ga  UR                  R                  UR                  R                  UR                  5       5      5      n
[        U
5      S:  a0  [         R                  " [        S5      UR                  5       -  5      eT R                  (       Ga"  UR                  R                  UR                  5       5      nUT R                   Vs/ s H  oR                  PM     sn;   a0  [         R                  " [        S	5      UR                  5       -  5      eU
T R                  S
   R                  /:w  a0  [         R                  " [        S5      UR                  5       -  5      eUR                  R                  T R                  S   R                  5      nUR                  R                  U5      S   nO_XR                  R                  UR                  5       5      /:w  a0  [         R                  " [        S5      UR                  5       -  5      eS nT R                  SU05      nUR!                  S5       nU GHG  nUU   R#                  5       (       d*  [         R                  " [        S5      U-  [        S5      S9eUR                  R                  U5      u  nnUR                  R                  U5      nU[$        :w  a"  [         R                  " [        S5      U-  5      eU(       a*  UU:w  a$  [         R                  " [        S5      UU4-  5      eUnU(       d9  T R'                  UU   R)                  5       R+                  SS5      S   SU-  5      nU" U5        T R-                  X65        T R.                  R1                  SU5        T R3                  US5       n[4        R6                  " X/UUS9  S S S 5        [9        X5      nT R                  R1                  SU5        T R:                  R=                  U5        U	R=                  U5        S nU(       aH  UR>                  RA                  SS5      (       a'  [B        RD                  " X[B        RF                  U/5        T RI                  5         ST l%        ST l&        GMJ     S S S 5        [O        U5       GH  u  nnU(       Ga.  US:X  a  [         R                  " [        S5      5      e[Q        U5      nT RS                  U5        [T        RV                  " U5      RY                  5       (       aW  T R[                  U5      n[\        R^                  Ra                  U5      (       d"  [         R                  " [        S5      U-  5      eU(       ab  T R-                  X65        T R>                  Rc                  [        S5      UU4-  5        [d        Rf                  " WT R[                  U5      5        GO UnGOUS:X  a&  U(       d  [         R                  " [        S5      5      eU(       d7  [Q        [\        R^                  Ri                  URk                  S 5      5      5      nT R-                  X65         US:X  a%  T R>                  Rl                  Ro                  5       nOB[p        Rr                  " T R>                  U5      nURo                  5       nURu                  5          T R3                  US5      nURc                  U5        URu                  5         U(       d  U" U5        UT Rx                  ;  a#  T R{                  5       U-   nU/T R.                  UU& T RI                  5         ST l&        T R>                  R}                  [        S"5      U-  5        T R:                  R=                  U5        U	R=                  U5        S nGM
     T R                  U5        U	$ s  snf ! , (       d  f       GN= f! , (       d  f       GNP= f! [v         a#    [         R                  " [        S!5      U-  5      ef = f)#Nc                j   > U TR                   ;   a"  [        R                  " [        S5      U -  5      eg )Ns&   patch %s is already in the series file)r  r   r.  r   )r  r0   s    r2   checkseries"queue.qimport.<locals>.checkseries^	  s3    DKK'kk?@9L  (r6   s*   option "-r" not valid when importing filesTr  s   no files or revisions specifiedrg   s5   option "-n" not valid when importing multiple patchess/   revision %d is the root of more than one branchs   revision %d is already managedr   s*   revision %d is not the parent of the queuer   s"   revision %d has unmanaged childrenr$      qimports   revision %d is not mutabler  r  s   cannot import merge revision %ds#   revision %d is not the parent of %dr   s   %d.diffr  r  r#   r)   rf  s%   -e is incompatible with import from -s   patch %s does not exist   renaming %s to %s
s$   need --name to import a patch from -   /s   unable to read file %ss   adding %s to series file
)@r   r.  r   r   r   r  ro   r  r  rV   rQ  lastr  r  
parentrevsr2  r  r  r   rQ  r  r   rH  r  rt   r   r
   
exportfilerS   r   rJ   r   r   r   retractboundaryr   r  r   r   rs   normnamerD  r    urlislocalr   r   r   r  rq  r   r  basenamer   finr   r   openpathr9  r   r  rq  r  r  )r0   rK   r  r  r  existingr  r'  r>  importedr  r  r  
lastparentr2  r  r  rD   r  r   ser{   filename
originpathtextr;  rm   s   `                          r2   qimportqueue.qimportT	  s   	 kkCD  %%d0CHHTH"++a BCDDJNc#hl	++JK   NN(()<)<SYY[)IJE5zA~kkHIhhj!  |||~~**399;7DLL9LqFFL99++;<syy{J  T\\"-2233++GH))+&  ~~))$,,q/*>*>?!^^66t<Q?
^^00=>>++?@399;N  "
}}fc]3H!!*-A7??,,#kk;<q@!"#J!K  "^^66q9FB++A.AW}#kk@AAE  "jAo#kkDE *o.  "$J$$($6$6 G//177qA!D&N%	  	*''	9OO**1i8Y5**4bxH 6 %Q2BLL''2.JJ%%i0OOI. $Itww11%CC..tL$$&(,D%'+D$U  .Z %U+KAxt#++BC  $H-&&x0;;x(0022!%8!4J77>>*55#kk89HD  ''	9GGMM01Xy4II KK
DIIi,@A (I t#I++AB  # ((()>?!I ##I5O4'#ww{{//1[[(;!wwy
 Y5T"I&+**,q009{e,#DGGLL89IEFJJi(OOI&Is ,v 	y :` 65; .-n  O++a(A&BX&MNNOs?   bE(b/bCb"*b1Ab1
bb
b.1-c)r   r   r  r   r   r   r  r  r  r   r   r   r   r   r  r   r  r   r   r   r.   )NNFr   )NNNNN)FTFNNNNF)FT)	NFFNFFFFF)NFTFFF)Nr   NNFr&  )NNNNF)Cr>   r?   r@   rA   rX   r   propertycacher  r  r  r  r$  r2  r/  r   rE  rM  compilerI  r  rR  rY  r\  rc  rn  ru  r  r  r  r  r  r  r  r   r  r  r
  r  r  r#  r(  r3  r<  rA  rD  rH  rQ  rT  r  r  r  r  r  ru  r:  r  r  r  r  r  r)  r0  rq  r  r:  rT  rB   r/   r6   r2   r   r     s;   #!J 
 ( 
  
  
! !!2+ zzEFHI.L !$ (%N2	/* 
6&P*%N/( ."h ob/3b.H?:*. ?I,J2P~"@;@@ ql y=vLH"T	+$ G0RD*5$n64 fr6   r   c                    U R                  SS5      (       a,  UR                  S5      (       d  UR                  S5      (       a  U$ [        U5      nSUS'   U$ )Nr#   r'      force   exactT   keep_changes)r   r   dictr   r;   s     r2   fixkeepchangesoptsr^  	  sN    MM%0088H88H:D DKr6   s   qdelete|qremove|qrm   kr*  s   keep patch filer5  r  s%   stop managing a revision (DEPRECATED)s   REVs   hg qdelete [-k] [PATCH]...)helpcategoryc                    UR                   nUR                  X[        R                  " U5      5        UR	                  5         g)a)  remove patches from queue

The patches must not be applied, and at least one patch is required. Exact
patch identifiers must be given. With -k/--keep, the patch files are
preserved in the patch directory.

To stop managing a patch and move it into permanent history,
use the :hg:`qfinish` command.r   )mqr#  r   rm  r  )r   rK   r:  r;   qs        r2   r#  r#  	
  s2    0 	AHHTH0067KKMr6   s   qapplied   1   lasts%   show only the preceding applied patchs   hg qapplied [-1] [-s] [PATCH]c           	     x   UR                   n[        R                  " U5      nU(       aP  X$R                  ;  a"  [        R
                  " [        S5      U-  5      eUR                  R                  U5      S-   nOUR                  S5      nUR                  S5      (       a"  U(       d  U R                  [        S5      5        gUR                  S5      (       a!  US:X  a  U R                  [        S5      5        gUR                  S5      (       a  US-
  nSnOSnUR                  XUS	UR                  S
5      S9  g)z8print the patches already applied

Returns 0 on success.r  rg   Tre  r     only one patch applied
rh   r   r  r"   )r  rx   r  r  N)rb  r   rm  r  r   r.  r   rm   r  r   rq  r  )r   rK   r   r;   rc  r  rx   s          r2   r  r  '
  s     	A%D ++a ABUJKKhhnnU#a'kk$xx
*+,	'		sax
./0	'		aIIdDHHZ<P  r6   s
   qunapplied   firsts   show only the first patchs   hg qunapplied [-1] [-s] [PATCH]c           	     &   UR                   n[        R                  " U5      nU(       aP  X$R                  ;  a"  [        R
                  " [        S5      U-  5      eUR                  R                  U5      S-   nOUR                  S5      nU[        UR                  5      :X  a1  UR                  S5      (       a  U R                  [        S5      5        gUR                  S5      (       a  SnOSnUR                  UUUSUR                  S5      S	9  g)
z8print the patches not yet applied

Returns 0 on success.r  rg   Trh     all patches applied
Nr  r"   rx   r  r  r  )rb  r   rm  r  r   r.  r   rm   r  ro   r   rq  r  )r   rK   r   r;   rc  rx   r  s          r2   r  r  N
  s     	A%D ++a ABUJKKu%)D!AHH$((8"4"4
+,-xxII$  r6   r@     e   existings   import file in patch directory   n   names   name of patch files   NAME   frY  s   overwrite existing filess)   place existing revisions under mq control   gs   use git extended diff format   P   pushs   qpush after importings>   hg qimport [-e] [-n NAME] [-f] [-g] [-P] [-r REV]... [FILE]...c                8   [         R                  " U5      nUR                  5          UR                  n UR	                  UUUR                  S5      UR                  S5      UR                  S5      UR                  S5      UR                  S5      S9nUR                  5          SSS5        W(       a@  UR                  S5      (       a*  UR                  S5      (       d  WR                  XS	   5      $ g
! UR                  5         f = f! , (       d  f       Nk= f)ao  import a patch or existing changeset

The patch is inserted into the series after the last applied
patch. If no patches have been applied, qimport prepends the patch
to the series.

The patch will have the same name as its source file unless you
give it a new one with -n/--name.

You can register an existing patch inside the patch directory with
the -e/--existing flag.

With -f/--force, an existing patch of the same name will be
overwritten.

An existing changeset may be placed under mq control with -r/--rev
(e.g. qimport --rev . -n patch will place the current revision
under mq control). With -g/--git, patches imported with --rev will
use the git diff format. See the diffs help topic for information
on why this is important for preserving rename/copy information
and permission changes. Use :hg:`qfinish` to remove changesets
from mq control.

To import a patch from standard input, pass - as the patch file.
When importing from standard input, a patch name must be specified
using the --name flag.

To import an existing patch while renaming it::

  hg qimport -e existing-patch -n new-name

Returns 0 if import succeeded.
ro  rm  rY  r  r$   )r  rM  r  r  r'  Nrs  r   r   )r   rm  r   rb  rT  r   r  r  )r   rK   rQ  r;   rc  rN  s         r2   rT  rT  s
  s    j %D	GG	yy((7++.hhx(HHV$HHV$ ! H KKM 
 DHHW%%dhhv.>.>vvdRL))	 KKM 
s#   DA C6D6DD
Dc                   UR                   nUR                  X5      nUR                  5         U(       Gag  UR                  5          UR                  R                  U5         [        R                  R                  UR                  S5      5      (       dw  UR                  SS5      nUR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        UR                  5         [        R                  R                  UR                  S5      5      (       d   UR                  SS5      R                  5         US	   R                  SS/5        [        R                  " X5        S	S	S	5        S	S	S	5        g
g
! , (       d  f       N= f! , (       d  f       g
= f)a  initialize a new queue repository

This command also creates a series file for ordering patches, and
an mq-specific .hgignore file in the queue repository, to exclude
the status and guards files (these contain mostly transient state).

Returns 0 if initialization succeeded.s	   .hgignorer  s   ^\.hg
s   ^\.mq
s   syntax: glob
s   status
s   guards
r   Nr   )rb  r  r  r  r  r  r   r   r  r  r  rq  r9  r  r   )r   rK   r  rc  r  r   s         r2   qinitrv  
  s&    	A	tAKKMWWY

11!477>>!'',"788VVL$/%%*+%%
77>>!'')"455y$'--/dGKKy12LL 5Y  54YY s%   F/"D*FF/
F,	(F//
F=s   qinit   cs   create-repos   create queue repositorys   hg qinit [-c]T)r`  	helpbasicc                4    [        XUR                  S5      S9$ )a  init a new queue repository (DEPRECATED)

The queue repository is unversioned by default. If
-c/--create-repo is specified, qinit will create a separate nested
repository for patches (qinit -c may also be run later to convert
an unversioned patch repository into a versioned one). You can use
qcommit to commit changes to this queue repository.

This command is deprecated. Without -c, it's implied by other relevant
commands. With -c, use :hg:`init --mq` instead.create_repor  )rv  r   r   rK   r;   s      r2   r  r  
  s    $ $((="9::r6   s   qclone   pulls"   use pull protocol to copy metadatar     noupdates)   do not update the new working directories   uncompresseds)   use uncompressed transfer (fast over LAN)   pr   s#   location of source patch repositorys   REPOs#   hg qclone [OPTION]... SOURCE [DEST])r`  norepoc                   [         R                  " U5      nS nUc  [        R                  " U5      n[        R
                  " X5      n[        R                  " XU5      nUR                  S5      (       a&  [        R
                  " XR                  S5      5      nOU" U5      n [        R                  " XU5        Su  pUR                  5       (       a  UR                  5       n
U
R                  R                  (       a  X   R                  5       [         R"                  :w  a  U
R                  R                  S   R$                  n[        R&                  " U5      (       do  [)        U
R+                  5       5      n[-        UR/                  U
R+                  U5      5      5      n	U	R1                  U
R2                  R5                  U5      S   5        O(UR7                  S5      (       a   UR9                  S5      nU R;                  [        S	5      5        [        R<                  " U UUR?                  5       UUR                  S
5      U	SUR                  S5      S9u  plU R;                  [        S5      5        [        R<                  " U UUR                  S5      =(       d    U" U5      U" U5      UR                  S
5      UR                  S5      (       + UR                  S5      S9  UR                  5       (       a  UR                  5       n
U(       a'  U R;                  [        S5      5        [A        X
U/SSS9  UR                  S5      (       dI  U R;                  [        S5      5        [        RB                  " XR2                  RE                  5       5        ggg! [        R                   a     [        R                  " [        S5      5      ef = f! [        R                   a     GNf = f)a(  clone main and patch repository at same time

If source is local, destination will have no patches applied. If
source is remote, this command can not check if patches are
applied in source, so cannot guarantee that patches are not
applied in destination. If you clone remote repository, be sure
before that it has no patches applied.

Source patch repository is looked for in <src>/.hg/patches by
default. Use -p <url> to change.

The patch directory must be a nested Mercurial repository, as
would be created by :hg:`init --mq`.

Return 0 on success.
c                b    U R                  5       nUR                  S5      (       a  USS nUS-   $ )z+compute a patch repo url from a repo objectrB  Nr   s   /.hg/patches)rH  endswith)rK   rH  s     r2   r  clone.<locals>.patchdir  s2    hhj<<cr(C_$$r6   Nr   s4   versioned patch repository not found (see init --mq)r&  r   s   lookupr  s   cloning main repository
r|  Fr~  )pullr  r  streams   cloning patch repository
r}  )r  r  r  s6   stripping applied patches from destination repository
r  s    updating destination repository
)#r   rm  r   defaultdestr    get_clone_path_objpeerr   r   	RepoErrorr.  r   localrb  r  r   r   r   rV   rI  rV  r  r  
differencerJ   r  r  capabler  r  clonerH  r   r  r  )r   sourcedestr;   r  source_pathsrpatches_pathqbasedestrevrK   r  drs                r2   r  r  
  s   \ %D% |~~f%,,R8K	;	'B xx
11"hhz6JK  |

,'
  NE	xxzzxxz77??t{002fmmCGGOOA&++E::d##DJJL)u//

50ABCt~~55e<Q?@	I			IIh'E GGA*+,XX

XXgxx(	FB GGA+,-HH
,XXg88K((xx( 
xxzzxxzGG$ "UGE$?xx$$GGA:;<IIdNN..01 % U ?? 
kkEF
 	

   		s   %N )O 4OO*)O*s   qcommit|qcis	   commit|cis    hg qcommit [OPTION]... [FILE]...)r`  	inferrepoc                    UR                   nUR                  5       nU(       d  [        R                  " S5      e[        R
                  " UR                  U/UQ70 UD6  g)zocommit changes in the queue repository (DEPRECATED)

This command is deprecated; use :hg:`commit --mq` instead.   no queue repositoryN)rb  r  r   r.  r   r   r   )r   rK   rw  r;   rc  r  s         r2   r   r   l  sG     	A		Akk011OOADD!+d+d+r6   s   qseries   mr  s   print patches not in seriess   hg qseries [-ms]c                t    UR                   R                  XR                  S5      UR                  S5      S9  g)z3print the entire series file

Returns 0 on success.r  r  )r  r  r   )rb  r  r   r{  s      r2   r  r  ~  s5     	GGOOhhy)488I3F   r6   s   qtops   hg qtop [-s]c           	         UR                   nUR                  (       a  UR                  S5      nOSnU(       a&  UR                  UUS-
  SSUR	                  S5      S9  gU R                  [        S5      5        g)	z:print the name of the current patch

Returns 0 on success.Tr   rg   r  r  rk  r  N)rb  r  r  r  r   rq  r   )r   rK   r;   rc  ts        r2   r'  r'    sn     	AyyKK			a%HHY' 	 	
 	*+,r6   s   qnexts   hg qnext [-s]c                    UR                   nUR                  5       nU[        UR                  5      :X  a  U R	                  [        S5      5        gUR                  XSUR                  S5      S9  g)z@print the name of the next pushable patch

Returns 0 on success.rj  rg   r  )rx   r  r  N)rb  r  ro   r  rq  r   r  r   )r   rK   r;   rc  r  s        r2   nextr    sX     	A
++-C
c!((m
+,-IIda)1DIEr6   s   qprevs   hg qprev [-s]c           	     r   UR                   n[        UR                  5      nUS:X  a  U R                  [	        S5      5        gU(       d  U R                  [	        S5      5        gUR
                  R                  UR                  S   R                  5      nUR                  XSSUR                  S5      S9  g)	zDprint the name of the preceding applied patch

Returns 0 on success.rg   rg  r  r  r  rk  N)
rb  ro   r  rq  r   r  rm   rW   r  r   )r   rK   r;   rc  r   r`  s         r2   prevr    s     	AAIIAAv
./0
*+,
((..2++
,CII$8K  r6   c                   UR                  S5      (       d)  UR                  S5      (       a  U R                  5       US'   UR                  S5      (       d3  UR                  S5      (       a  S[        R                  " 5       -  US'   g g g )NrZ     currentuserri      currentdaterl  )r   usernamer   makedater]  s     r2   setupheaderoptsr    sj    88G.!9!9W88G.!9!9 8#4#4#66W ":r6   s   qnewrX  s    invoke editor on commit messagess'   import uncommitted changes (DEPRECATED)r  s#   add "From: <current user>" to patch   urZ  s   add "From: <USER>" to patchs   USER   Dr  s#   add "Date: <current date>" to patch   dri   s   add "Date: <DATE>" to patchs   DATEs0   hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...)r`  rx  r  c                   [         R                  " U5      n[        R                  " X5      nUR                  nXTS'   [        X5        UR                  " X/UQ70 [         R                  " U5      D6  UR                  5         g)a  create a new patch

qnew creates a new patch on top of the currently-applied patch (if
any). The patch will be initialized with any outstanding changes
in the working directory. You may also use -I/--include,
-X/--exclude, and/or a list of files after the patch name to add
only changes to matching files to the new patch, leaving the rest
as uncommitted modifications.

-u/--user and -d/--date can be used to set the (given) user and
date, respectively. -U/--currentuser and -D/--currentdate set user
to current user and date to current date.

-e/--edit, -m/--message or -l/--logfile set the patch header as
well as the commit message. If none is specified, the header is
empty and the commit message is '[mq]: PATCH'.

Use the -g/--git option to keep the patch in the git extended diff
format. Read the diffs help topic for more information on why this
is important for preserving permission changes and copy/rename
information.

Returns 0 on successful creation of a new patch.
rW  r   )	r   rm  r
   
logmessagerb  r  r  	strkwargsr  )r   rK   r   r   r;   r1   rc  s          r2   r  r    sj    V %D


R
&CALBEE$99 2 24 89KKMr6   s   qrefreshr  s;   refresh only files already in the patch and specified filess2   add/update author field in patch with current users0   add/update author field in patch with given users0   add/update date field in patch with current dates.   add/update date field in patch with given dates=   hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...c                T   [         R                  " U5      nUR                  n[        R                  " X5      n[        X5        UR                  5          UR                  " X4SU0[         R                  " U5      D6nUR                  5         UsSSS5        $ ! , (       d  f       g= f)a  update the current patch

If any file patterns are provided, the refreshed patch will
contain only the modifications that match those patterns; the
remaining modifications will remain in the working directory.

If -s/--short is specified, files currently included in the patch
will be refreshed just like matched files and remain in the patch.

If -e/--edit is specified, Mercurial will start your configured editor for
you to enter a message. In case qrefresh fails, you will find a backup of
your message in ``.hg/last-message.txt``.

hg add/remove/copy/rename work as usual, though you might want to
use git-style patches (-g/--git or [diff] git=1) to track copies
and renames. See the diffs help topic for more information on the
git diff format.

Returns 0 on success.
r1   N)
r   rm  rb  r
   r  r  r  r:  r  r  )r   rK   rw  r;   rc  r   r  s          r2   r:  r:    sx    D %DA  *GB	iiLL83E3Ed3KL	 
s   ;B
B'   qdiffs   hg qdiff [OPTION]... [FILE]...c                    U R                  S5        UR                  R                  X[        R                  " U5      5        g)a  diff of the current patch and subsequent modifications

Shows a diff which includes the current patch as well as any
changes which have been made in the working directory since the
last refresh (thus showing what the current patch would become
after a qrefresh).

Use :hg:`diff` if you only want to see the changes made since the
last qrefresh, or :hg:`export qtip` if you want to see changes
made by the current patch without including changes made since the
qrefresh.

Returns 0 on success.
r  r   )pagerrb  ru  r   rm  )r   rK   rw  r;   s       r2   ru  ru  `  s0    . HHXGGLLX11$78r6   s   qfolds   keep folded patch filess/   hg qfold [-e] [-k] [-m TEXT] [-l FILE] PATCH...c           	     (   [         R                  " U5      nUR                  nU(       d  [        R                  " [        S5      5      eUR                  U5      S   (       d  [        R                  " [        S5      5      eUR                  5          UR                  U5        [        R                  " X5      nUR                  S5      n/ n/ nU H  n	UR                  U	5      n
X;   d  X:X  a  U R                  [        S5      U
-  5        UR                  U
5      (       a"  [        R                  " [        S5      U
-  5      eUR                  U
5        M     U H  n
U(       dQ  [        UR!                  U
5      UR"                  5      nUR$                  (       a  UR                  UR$                  5        UR!                  U
5      nUR'                  X5      u  pnU(       a  M  [        R                  " [        S5      U
-  5      e   U(       d}  [        UR!                  U5      UR"                  5      nUR$                  nU H5  nU(       d  M  U(       a  UR                  S5        UR)                  U5        M7     S	R!                  U5      nUR*                  " UR-                  5       /UQ76 nUR/                  UUUR0                  UR3                  S
5      SS9  UR5                  XU5        UR7                  5         SSS5        g! , (       d  f       g= f)a  fold the named patches into the current patch

Patches must not yet be applied. Each patch will be successively
applied to the current patch in the order given. If all the
patches apply successfully, the current patch will be refreshed
with the new cumulative patch, and the folded patches will be
deleted. With -k/--keep, the folded patch files will not be
removed afterwards.

The header for each folded patch will be concatenated with the
current patch header, separated by a line of ``* * *``.

Returns 0 on success.s&   qfold requires at least one patch namer   r  r  s!   skipping already folded patch %s
s*   qfold cannot fold already applied patch %ss   error folding patch %ss   * * *r   rX  s   mq.qfold)r1   r'  rx  ra  N)r   rm  rb  r   r.  r   r(  r  r<  r
   r  r  r  r  rJ   r   r   r   r   r   rp  r/  r2  r:  r'  r   r#  r  )r   rK   r  r;   rc  r   r   r:  messagesr~  r>  r  r   patchsuccessr  r1   r2  s                    r2   foldr  |  sR   0 %DAkk!EFGG??4 #kk!1233		D!$$R.'"AA|q{?@1DE{{1~~kkCDqH  NN1  A AKK8::OOBJJ/B*+''$*;'\$<kk!$=">"BCC  QVVF^Q[[9BjjG3x0NN3'	  
 jj)G;;qzz|6g6			'"  	 	
 	
%	_ 
s   EL#A&LB-L
Ls   qgotos   keep-changess&   tolerate non-conflicting local changess   overwrite any local changess	   no-backups"   do not save backup copies of filess   hg qgoto [OPTION]... PATCHc                   [         R                  " U5      n[        X5      nUR                  nUR	                  U5      nUR                  S5      nUR                  S5      nUR                  U5      (       a#  UR                  UUUR                  S5      UUS9nO"UR                  UUUR                  S5      UUS9nUR                  5         U$ )zOpush or pop patches until named patch is at top of stack

Returns 0 on success.	   no_backupr[  rY  )r  r  r  )
r   rm  r^  rb  r  r   r  r  r  r  )r   rK   r   r;   rc  r  r  r  s           r2   gotor    s    & %Db'DAHHUOExx%H((?+K{{5ee((8$#  
 ff((8$#  
 KKMJr6   s   qguard   l   lists   list all patches and guards   nones   drop all guardss8   hg qguard [-l] [-n] [PATCH] [-- [+GUARD]... [-GUARD]...]c                (  ^ ^	^
 U	U
U 4S jnUR                   m
T
R                   Vs1 s H  oUR                  iM     snm	Sn[        U5      nUR	                  S5      (       aj  U(       d  UR	                  S5      (       a  [
        R                  " [        S5      5      e[        [        T
R                  5      5       H  nU" U5        M     gU(       a  US   SS S;   aI  T
R                  (       d  [
        R                  " [        S	5      5      eT
R                  S
   R                  nUc  US   SS S;  a  UR                  S5      nUc  [
        R                  " [        S5      5      eU(       d  UR	                  S5      (       aX  T
R                  U5      nUc"  [
        R                  " [        S5      U-  5      eT
R                  X5        T
R                  5         gU" T
R                  R                  T
R!                  U5      5      5        gs  snf )aL  set or print guards for a patch

Guards control whether a patch can be pushed. A patch with no
guards is always pushed. A patch with a positive guard ("+foo") is
pushed only if the :hg:`qselect` command has activated it. A patch with
a negative guard ("-foo") is never pushed if the :hg:`qselect` command
has activated it.

With no arguments, print the currently active guards.
With arguments, set guards for the named patch.

.. note::

   Specifying negative guards now requires '--'.

To set guards on another patch::

  hg qguard other.patch -- +2.6.17 -stable

Returns 0 on success.
c                ^  > TR                   U    =(       d    S/nTR                  U    T;   a  SnOTR                  U 5      S   (       a  SnOSnSX"4-  nTR                  STR	                  TR                  U    U5      -  5        [        U5       H  u  pEUR                  S5      (       a  TR                  US	S
9  O7UR                  S5      (       a  TR                  USS
9  OTR                  USS
9  U[        U5      S-
  :w  d  Mw  TR                  S5        M     TR                  S5        g )Ns	   unguardedr  r   r  r  s!   qguard.patch qguard.%s qseries.%ss   %s: rg     qguard.positiver   rf     qguard.negative   qguard.unguardedrg   rU  r   )r  r  rn  rq  r  rs   rq   ro   )	r`  rW  r  r  r{   rO  r  rc  r   s	         r2   r  guard.<locals>.status  s   $688C=G#EZZ_Q EE4~E
288AHHSM599:!&)HA%%&89!!$''&89&9:CK!O# * 	r6   Nr  nones.   cannot mix -l/--list with options or argumentsr   rg   rN  r  r   s   no patch to work withs   no patch named %s)rb  r  rW   r  r   r   r.  r   rp   ro   r  r  rE  rc  r  rm   r  )r   rK   r   r;   r  r>  r   r{   r`  r  rc  s   `        @@r2   rO  rO    s   @, 	A yy)y!vvy)GE:Dxx488F##++CD  s188}%A1I &471Q<5(yy++a 5677		"""}a1U2}kk!4566txxll5!;++a 45=>>	C	qxx~~ahhuo./5 *s   Hs   qheaders   hg qheader [PATCH]c                l   UR                   nU(       a  UR                  U5      nO=UR                  (       d  U R                  [	        S5      5        gUR                  S5      n[        UR                  U5      UR                  5      nU R                  SR                  UR                  5      S-   5        g)zIprint the header of the topmost or specified patch

Returns 0 on success.r  rg   r  r   N)	rb  r  r  rq  r   r   r   r   r   )r   rK   r   rc  r  s        r2   rv   rv   N  s}     	AyyHHQ./0!	QVVE]AKK	0BHHUZZ

#e+,r6   c                   [         R                  R                  U 5      u  p[         R                  " U5      n[        R
                  " SU-  5      nS nS nU HE  nUR                  U5      nU(       d  M  [        UR                  S5      5      n	Ub  X:  d  MA  U	nUnMG     U(       a!  [         R                  R                  X5      U4$ g)Ns   %s.([0-9]+)rg   r&  )
r   r   r   listdirrM  rW  r  r  groupr   )
r   	directoryr  namesnameremaxindexmaxnamer~  r  rm   s
             r2   lastsavenamer  f  s    d+YJJy!EZZ-.FHGLLO1
OE5#3   Y0(;;r6   c                @    [        U 5      u  pUc  SnU SUS-   -  -   nU$ )Nr   s   .%drg   )r  )r   rC  rm   newpaths       r2   savenamer  x  s0     &MT|Vuqy))GNr6   r  s   apply on top of local changesrZ  s-   apply the target patch to its recorded parents   list patch name in commit text   a   alls   apply all patches   merges%   merge from another queue (DEPRECATED)s   merge queue name (DEPRECATED)   moves-   reorder patch series and apply only the patchs0   hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]c                   UR                   nSn[        R                  " U5      n[        X5      nUR	                  S5      (       a  UR	                  S5      (       a+  UR
                  R                  UR	                  S5      5      nO[        UR                  5      u  pgU(       d  U R                  [        S5      5        g[        XR                  UR                  U5      nU R                  [        S5      UR                  -  5        UR                  UUUR	                  S5      UR	                  S5      UUR	                  S	5      UR	                  S
5      UR	                  S5      UR	                  S5      UR	                  S5      S9
nU$ )a  push the next patch onto the stack

By default, abort if the working directory contains uncommitted
changes. With --keep-changes, abort only if the uncommitted files
overlap with patched files. With -f/--force, backup and patch over
uncommitted changes.

Return 0 on success.
Nr  ro  s%   no saved queues found, please use -n
rg   s   merging with queue at: %s
rY  r  r  r  rZ  r  r[  )r  r  r  r  r  r  r  r  )rb  r   rm  r^  r   r   r   r  r   r  r   r   r   r  )	r   rK   r   r;   rc  r  r  r{   r  s	            r2   r  r    s6   T 	AF%Db'Dxx88GhhmmDHHW$56G%aff-JGGGA?@Ar;;		7;
01FKK?@
&&hhx XXgHHVXXghhx ,'HH_-  C Jr6   s   qpops   pop all patchess   queue name to pop (DEPRECATED)s)   forget any local changes to patched filess!   hg qpop [-a] [-f] [PATCH | INDEX]c                8   [         R                  " U5      n[        X5      nSnUR                  S5      (       as  [	        XR
                  UR                  UR                  R                  UR                  S5      5      5      nU R                  [        S5      UR                  -  5        SnOUR                  nUR                  UUUR                  S5      UUR                  S5      UR                  S5      UR                  S5      S	9nUR                  5         U$ )
a  pop the current patch off the stack

Without argument, pops off the top of the patch stack. If given a
patch name, keeps popping off patches until the named patch is at
the top of the stack.

By default, abort if the working directory contains uncommitted
changes. With --keep-changes, abort only if the uncommitted files
overlap with patched files. With -f/--force, backup and discard
changes made to such files.

Return 0 on success.
Tro  s   using patch queue: %s
FrY  r  r  r[  )r  r  r  r  r  )r   rm  r^  r   r   r   r   r   r   r  r   rb  r  r  )r   rK   r   r;   localupdaterc  r  s          r2   r  r    s    @ %Db'DKxx"kk499dhhmmDHHW<M.NO
,-67GG
%%hhx HHV,'HH_-  C KKMJr6   s   qrename|qmvs   hg qrename PATCH1 [PATCH2]c                   UR                   nU(       d  UnSnU(       a  UR                  U5      nO=UR                  (       d  U R                  [	        S5      5        gUR                  S5      nUR                  U5      n[        R                  R                  U5      (       aW  [        [        R                  R                  U[        R                  R                  U5      5      5      nUR                  U5      nUR                  U5        U R                  [	        S5      X#4-  5        UR                  U5      nUR                  R                  UR                   U   5      nUSR                  U V	s/ s H  n	SU	-   PM
     sn	5      -   UR                   U'   UR#                  5         SUl        UR'                  U5      n
U
(       a  [)        U
S   U5      UR                  U
S	   '   SUl        [        R                  R-                  U5      n[        R                  R                  U5      (       d  [        R.                  " U5        [0        R2                  " UR                  U5      U5        UR5                  5       nU(       a  X,R6                  ;   a  UR9                  5          UR6                  R;                  U5         US   nUR6                  R=                  U5      R>                  (       a7  UR6                  RA                  U5        UR6                  RC                  U5        O#URE                  X#5        URG                  U/5        SSS5        SSS5        URI                  5         gs  sn	f ! , (       d  f       N,= f! , (       d  f       N5= f)
zrename a patch

With one argument, renames the current patch to PATCH1.
With two arguments, renames PATCH1 to PATCH2.

Returns 0 on success.Nr  r  rA  r6   r_  Trg   r   )%rb  r  r  rq  r   r   r   r   rG  rG  rJ  rH  r  rE  rI  rJ  r  r  r   r  rS   r   dirnamemakedirsr   r  r  r  r  r  ro  r   set_untrackedset_trackedr8  r  r  )r   rK   r   rW   r;   rc  absdestr{   rW  ra  r  destdirr  rN   s                 r2   r  r    sj    	AyyHHQ./0!ffTlG	ww}}WT277+;+;E+BCD&&,TGGA$%56	UAZZQ0FSXX&&A&Quqy&&ABBALLOMMOAM;;uD(a$7		$q'ANggoog&G77==!!
GKKuw'		AUjj WWY

11!4T7Dzz##E*00

((/

&&t,		%&UG$ 5Y KKM1 'B 54YYs+   2M(
!M>=B
M-M>-
M;	7M>>
Ns   qrestore   deletes   delete save entrys   updates   update queue working directorys   hg qrestore [-d] [-u] REVc                    UR                  U5      nUR                  nUR                  XUR                  S5      UR                  S5      S9  UR	                  5         g)zorestore the queue state saved by a revision (DEPRECATED)

This command is deprecated, use :hg:`rebase` instead.r#  r  )r#  r%  r   )r  rb  r)  r   r  )r   rK   r  r;   rc  s        r2   r)  r)  ;  sK     ++c
CAIId 2DHHX<NIOKKMr6   s   qsave   copys   copy patch directorys   copy directory name   emptys   clear queue status files
   force copys5   hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]c                   UR                   n[        R                  " U5      n[        R                  " X5      nUR                  XS9nU(       a  U$ UR                  5         UR                  S5      (       Ga=  UR                  nUR                  S5      (       a  [        R                  R                  UR                  UR                  S5      5      n[        R                  R                  U5      (       a~  [        R                  R                  U5      (       d"  [        R                  " [!        S5      U-  5      eUR                  S5      (       d"  [        R                  " [!        S5      U-  5      eO[#        U5      nU R%                  [!        S5      Xg4-  5        [&        R(                  " Xg5        UR                  S5      (       a&  UR*                  S	S	2	 S
Ul        UR                  5         g)z\save current queue state (DEPRECATED)

This command is deprecated, use :hg:`rebase` instead.)r1   r  ro  s,   destination %s exists and is not a directoryrY  s&   destination %s exists, use -f to forces   copy %s to %s
r  NTr   )rb  r   rm  r
   r  r0  r  r   r   r   r   r   r  rG  r   r.  r   r  r  r   	copyfilesr  r   )r   rK   r;   rc  r   r  r   r  s           r2   r0  r0  O  sl     	A%D  *G
&&&
#C

KKMxxvv88Gggll1::txx/@AGww~~g&&ww}}W--++IJ!"  xx))++CDwN  tnG
$%78t%xxIIaL	r6   s   qselects   disable all guardsr   s   list all guards in series file   pops)   pop to before first guarded applied patch   reapplys   pop, then reapply patchess!   hg qselect [OPTION]... [GUARD]...c                	  ^ UR                   m[        R                  " U5      nTR                  5       nU4S jnU(       d  UR	                  S5      (       Ga  TR                  U5      n[        [        TR                  5      5       Vs/ s H  ou" U5      (       a  M  UPM     nnTR                  U5        TR                  5         U(       d  U R                  [        S5      5        UR	                  S5      (       d  UR	                  S5      (       d  TR                  U5      n	[        [        TR                  5      5       Vs/ s H  ou" U5      (       a  M  UPM     n
n[        U	5      [        U5      :w  a1  U R                  [        S5      [        U5      [        U	5      4-  5        [        U
5      [        U5      :w  a1  U R                  [        S5      [        U5      [        U
5      4-  5        GOcUR	                  S5      (       a  0 nS	nTR                   H6  nU(       d  US
-  nU H!  nUR                  US	5        XM==   S
-  ss'   M#     M8     U R                  (       a  XS'   [!        UR#                  5       5      nUR%                  S S9  U(       aL  U R'                  [        S5      5        U H+  u  pU R'                  SU-  5        U R)                  US5        M-     OrU R'                  [        S5      5        OWU(       a6  U R'                  [        S5      5        U H  nU R)                  US5        M     OU R)                  [        S5      5        UR	                  S5      =(       a,    TR                  =(       a    TR                  S   R*                  nSnUR	                  S5      (       d  UR	                  S5      (       a  [        [        TR                  5      5       Hq  nU" U5      (       a  M  U R                  [        S5      5        SnUS	:X  a  TR-                  USS9  O,TR-                  UTR                  US
-
     R*                  5          O   U(       aE   U(       a,  U R                  [        S5      5        TR/                  UU5        TR                  5         ggs  snf s  snf ! TR                  5         f = f)a  set or print guarded patches to push

Use the :hg:`qguard` command to set or print guards on patch, then use
qselect to tell mq which guards to use. A patch will be pushed if
it has no guards or any positive guards match the currently
selected guard, but will not be pushed if any negative guards
match the current guard. For example::

    qguard foo.patch -- -stable    (negative guard)
    qguard bar.patch    +stable    (positive guard)
    qselect stable

This activates the "stable" guard. mq will skip foo.patch (because
it has a negative match) but push bar.patch (because it has a
positive match).

With no arguments, prints the currently active guards.
With one argument, sets the active guard.

Use -n/--none to deactivate guards (no other arguments needed).
When no guards are active, patches with positive guards are
skipped and patches with negative guards are pushed.

qselect can change the guards on applied patches. It does not pop
guarded patches by default. Use --pop to pop back to the last
applied patch that is not guarded. Use --reapply (which implies
--pop) to push back to the current patch afterwards, but skip
guarded patches.

Use -s/--series to print a list of all guards in the series file
(no other arguments needed). Use -v for more information.

Returns 0 on success.c                Z   > TR                  TR                  U    R                  5      S   $ )Nr   )rn  r  rW   )r{   rc  s    r2   <lambda>select.<locals>.<lambda>  s!    AIIaL$5$56q9r6   r  s   guards deactivated
r  r  sA   number of unguarded, unapplied patches has changed from %d to %d
s=   number of guarded, applied patches has changed from %d to %d
r   r   rg   s   NONEc                    U S   SS  $ Nr   rg   r/   )r  s    r2   r  r    s    !A$qr(r6   )keys   guards in series file:
s   %2d  r   s   no guards in series file
s   active guards:
s   no active guards
r   Fs   popping guarded patches
T)r  s   reapplying unguarded patches
N)rb  r   rm  r\  r   r  rp   ro   r  rY  r  r  r   r  r  rr  r  rz  r  r  rq  rW   r  r  )r   rK   r   r;   rW  rn  old_unappliedr{   old_guardedr  guardednoguardsgsra  rO  countreapplypoppedrc  s                     @r2   selectr    s   \ 	A%DXXZF9Htxx  D)"'AII"7K"7Qx{q"7K	D	IIa/01xx(<(<D)I"'AII"7K"7Qx{q"7GK9~]!33		3 =)3y>:	; 7|s;//		+ ;'W6	7 
)		..BA!!!Q'	Q	  ! ::&7Oflln%*+GGA123 &5()& !' GGA345GGA)*+E"  HHQ,-.hhz"GqyyGQYYr]5G5GGFxx488J//s199~&AA;;		!89:6EE$DE)EE$		!a% 0 5 56 ' 			!=>?tW%KKM  L L| KKMs$   	R)R)R.R.$3R3 3Sr  r  s   finish all applied changesetss   hg qfinish [-a] [REV]...c                v   UR                  S5      (       d&  U(       d  [        R                  " [        S5      5      eUR                  S5      (       a  SU-   nUR                  nUR
                  (       d  U R                  [        S5      5        g[        R                  " X5      nUS   R                  5       U;   a2  US   R                  5       (       a  U R                  [        S5      5        UR                  5          UR                  X5        UR                  5         SSS5        g! , (       d  f       g= f)	a8  move applied patches into repository history

Finishes the specified revisions (corresponding to applied
patches) by moving them out of mq control into regular repository
history.

Accepts a revision range or the -a/--applied option. If --applied
is specified, all applied mq revisions are removed from mq
control. Otherwise, the given revisions must be at the base of the
stack of applied patches.

This can be especially useful if your changes have been applied to
an upstream repository, or if you are about to push your changes
to upstream.

Returns 0 on success.
r  s   no revisions specified)s   qbase::qtipr  r   r  Ns6   warning: uncommitted changes in the working directory
)r   r   r.  r   rb  r  r  r   r   r  r  r  r   r  r  )r   rK   r   r;   rc  r  s         r2   r  r    s    0 88Ixkk!5677	)		$x/A99
		!+,-t.DDz~~4DJ$4$4$6$6
LMN 
		 
  
 s   ?"D**
D8s   qqueues   list all available queues   actives   print name of active queue   creates   create new queue   renames   rename active queues   delete reference to queue   purges"   delete queue, and remove patch dirs   [OPTION] [QUEUE]c                `  ^^^^^^^^ TR                   mSmSmSmU4S jmUU4S jnUUUU4S jnUU4S jnUU4S jmUU4S	 jnU4S
 jnS n	UUUU4S jn
[        R                  " U5      nU(       a,  UR                  S5      (       d  UR                  S5      (       a  T" 5       nUR                  S5      (       a  U R	                  SU4-  5        gU" 5        H[  nU R	                  SU4-  5        X:X  a-  U R
                  (       d  U R	                  [        S5      5        MJ  U R	                  S5        M]     gU	" U5      (       d  [        R                  " [        S5      5      eTR                  5          U" 5       mUR                  S5      (       aN  UT;   a"  [        R                  " [        S5      U-  5      eU" 5       (       a  U" T5        U" U5        U" U5        GO3UR                  S5      (       Gai  T" 5       nX+:X  a"  [        R                  " [        S5      U-  5      eUT;   a"  [        R                  " [        S5      U-  5      eU" U5      nU" U5      n[        R                  R                  U5      (       a"  [        R                  " [        S5      U-  5      eTR                  SS5      nT Hp  nX:X  aS  UR	                  SU4-  5        [        R                  R                  U5      (       a  [        R                  " X5        MY  M[  UR	                  SU4-  5        Mr     UR!                  5         TR                  R                  ST5        T" U5        OUR                  S5      (       a	  U
" U5        OUR                  S5      (       aQ  UT;   a  U
" U5        U" U5      n[        R                  R                  U5      (       a  ["        R$                  " U5        O-UT;  a  [        R                  " [        S5      5      eU" U5        SSS5        g! , (       d  f       g= f)a  manage multiple patch queues

Supports switching between different patch queues, as well as creating
new patch queues and deleting existing ones.

Omitting a queue name or specifying -l/--list will show you the registered
queues - by default the "normal" patches queue is registered. The currently
active queue will be marked with "(active)". Specifying --active will print
only the name of the active queue.

To create a new queue, use -c/--create. The queue is automatically made
active, except in the case where there are applied patches from the
currently active queue in the repository. Then the queue will only be
created and switching will fail.

To delete an existing queue, use --delete. You cannot delete the currently
active queue.

Returns 0 on success.
r   s   patches.queuesr   c                    > [         R                  R                  TR                  5      n U R                  S5      (       a  U SS  n U $ )Nr      )r   r   rJ  rq   )r  rc  s    r2   _getcurrentqqueue.<locals>._getcurrentP  s:    ggqvv&>>+&&ab'C
r6   c                 l   >  TR                  TS5      n U R                  5         g! [         a     gf = f)Nr5  TF)r   r9  r   )r  
_allqueuesrK   s    r2   	_noqueuesqqueue.<locals>._noqueuesV  s:    	*d+BHHJ   		s   "& 
33c                 6  > T" 5       n  TR                  TS5      nU Vs/ s H)  o"R                  5       (       d  M  UR                  5       PM+     nnUR                  5         X;  a  UR                  U 5        [        U5      $ s  snf ! [         a    T/n Nf = f)Nr5  )r   r   r9  rJ   r   rE   )currentr  r   queuesr  _defaultqueuer  rK   s       r2   
_getqueuesqqueue.<locals>._getqueues_  s    -	%*d+B13E{{}mekkmFEHHJ$g& f~ F  	%#_F	%s'   B BB(B B BBc                v   > TR                   (       a  [        R                  " [        S5      5      eT" U 5        g )Ns@   new queue created, but cannot make active as patches are applied)r  r   r.  r   )rW   _setactivenocheckrc  s    r2   
_setactiveqqueue.<locals>._setactivem  s2    99++.  	$r6   c                x   > TR                  TS5      nU S:w  a  UR                  U 5        UR                  5         g )Nr  r   r   rq  r9  )rW   r  _activequeuerK   s     r2   r  !qqueue.<locals>._setactivenocheckw  s/    XXlD):HHTN

r6   c                t   > TR                  TS5      nUR                  SU 4-  5        UR                  5         g )Nr  ry  r  )rW   r  r  rK   s     r2   	_addqueueqqueue.<locals>._addqueue}  s/    XXj$'
D7"#

r6   c                   > U S:X  a  TR                   R                  S5      $ TR                   R                  SU -   5      $ )Nr   r   )r   r   )rW   rK   s    r2   	_queuedirqqueue.<locals>._queuedir  s6    :88==,,88==t!344r6   c                &    U  H  nUS;   d  M    g   g)Ns   :\/.FTr/   )rW   r  s     r2   
_validnameqqueue.<locals>._validname  s    AH}  r6   c                l  > U T;  a  [         R                  " [        S5      5      eT" 5       nX:X  a  [         R                  " [        S5      5      eTR                  SS5      nT H  nX0:X  a  M
  UR	                  SU4-  5        M!     UR                  5         TR                  R                  ST5        g )Ns'   cannot delete queue that does not exists$   cannot delete currently active queue   patches.queues.newr  ry  )r   r.  r   r   rq  r9  r  )rW   r  r  r   r  r  rM  rK   s       r2   _deleteqqueue.<locals>._delete  s    x++a JKLL-?++a GHIIXX+T2E}HHWx'(  	
-z:r6   r  r  ry  Ns   %ss
    (active)
r   s9   invalid queue name, may not contain the characters ":\/."r  s   queue "%s" already existsr  s%   can't rename "%s" to its current names'   non-queue directory "%s" already existsr  r  r  r  s"   use --create to create a new queue)rb  r   rm  r   rq  quietr   r   r.  r  r   r   r  r   r   r  r9  shutilrmtree)r   rK   rW   r;   r  r	  r  r  r  r  r  r  r   olddirnewdirr  qdirr  r  r  r  r  rM  rc  s    `               @@@@@@@r2   qqueuer&  )  sI   D 	AM"J#L  
5; ;" %D488G$$(;(;-88IHHWz)*\EHHUeX%&>*+ " 	dkkKL
 	
 
<88Ixkk!$@"AD"HII{{-(dOtXXi  !mGkk?@4G  xkk!$@"AD"HIIw'Ft_Fww~~f%%kk@AFJ  /6B!#HHWw./ww~~f--F3 . HHWx/0 " HHJHHOO1:>d#XXi  DMXXhxT?Dww~~d##d#8#kk!$I"JKKtc 
s   7JP
P-c                L   U R                   R                  (       a  U R                  R                  SS5      (       a  [        R
                  nO[        R                  nX R                   R                  S   R                     nX   R                  UR                  5       5        U$ )zEcallback used to set mq changeset as secret when no phase data existsr#   r)   r   )
rb  r  r   r   r   r   draftrV   r  r  )rK   rootsmqphaser  s       r2   mqphasedefaultsr+    sl    ww77eY//mmGllGWW__Q',,-599;'Lr6   c                     " S SUR                   5      nUR                  5       (       a&  X!l         UR                  R                  [        5        g g )Nc                     ^  \ rS rSr\R
                  S 5       rU 4S jrS	S jr       S
U 4S jjr	U 4S jr
U 4S jrSrU =r$ )reposetup.<locals>.mqrepoi  c                X    [        U R                  U R                  U R                  5      $ r.   )r   r   r   r   r\   s    r2   rb  reposetup.<locals>.mqrepo.mq  s    $++tyy99r6   c                   > [         TU ]  5         [        R                  " U S5      (       a  [	        U R                  5       S5        g g )Nrb  )superinvalidateallr   hasunfilteredcacher"  r   )r0   	__class__s    r2   r3  'reposetup.<locals>.mqrepo.invalidateall  s7    G!#++D$77)40 8r6   c                  ^ U R                   R                  (       a  U R                   R                  (       a  U(       d{  U R                  R	                  5       nU R                   R                   Vs/ s H  oDR
                  PM     snm[        U4S jU 5       5      (       a  [        R                  " U5      eg g g g s  snf )Nc              3  ,   >#    U  H	  oT;   v   M     g 7fr.   r/   )r   r>  r:  s     r2   r   ?reposetup.<locals>.mqrepo.abortifwdirpatched.<locals>.<genexpr>  s     5WG|Ws   )	rb  r  r  r  r  rV   r   r   r.  )r0   errmsgr  r  rP   r:  s        @r2   abortifwdirpatched,reposetup.<locals>.mqrepo.abortifwdirpatched  s    ww477#7#7--//1+/77??;?a66?;5W555++f-- 6 AF#7;s   1B=c           	     h   > Uc  0 nU R                  [        S5      U5        [        TU ]  XX4XVU5      $ )Ns&   cannot commit over an applied mq patch)r;  r   r2  r   )	r0   rS  r   r   r  r  rk  extrar5  s	           r2   r    reposetup.<locals>.mqrepo.commit  s?     }##;<e 7>$d5%PPr6   c                P  > U R                   R                  (       a  U R                   R                  (       a  UR                  (       d  U R                   R                   Vs/ s H  o"R                  PM     nnUR
                  (       a>  [        UR
                  5      n[        U5       H  nXT;   a    OUR                  5         M     U HF  nX   R                  5       [        R                  :  d  M)  [        R                  " [        S5      5      e   [        TU ]A  U5        g s  snf )Ns   source has mq patches applied)rb  r  r  r  rV   r  rV  r  r  r   r   r   r   r.  r   r2  	checkpush)r0   pushoprz  
outappliedr  rV   r5  s         r2   rA  #reposetup.<locals>.mqrepo.checkpush  s    ww477#7#7.2ggoo>offo
>;;  ,E ( 4=!&NN,	 !5 'Dz'')FMM9#kk!,L*MNN ' Gf%! ?s   !D#c                  > [         TU ]  5       nU R                  nUR                  (       d  U$ UR                   Vs/ s H  o3R                  UR
                  4PM     nn U R                  5       R                  R                  US   S   5        U R                  R                  nU Vs/ s H  oe" US   5      (       d  M  UPM     nnU(       d  U$ UR!                  US   S   S45        UR!                  US   S   S45        UR!                  U R                  R#                  US   S   5      S   S45        US   nU HB  nUS   U;   a,  U R                  R                  [        S5      US   -  5        M8  US   XsS   '   MD     U$ s  snf ! [        R                   a;    U R                  R                  [        S5      [        US   S   5      -  5        Us $ f = fs  snf )	z,augment tags from base class with patch tagsr   r   s)   mq status file refers to unknown node %s
r  r  s   qparentrg   s+   tag %s overrides mq patch of the same name
)r2  	_findtagsrb  r  rV   rW   r   r  r  r   r  r   r  r   r	   hasnoderJ   r  )	r0   resultrc  r   mqtagsincludedmqttagsr5  s	           r2   rF  #reposetup.<locals>.mqrepo._findtags+  s   W&(FA99<=IIFI5zz5::.IFF!++//r
1> ~~--H%+@VcxA/?cVF@MM6":a='23MM6!9Q<23MM4>>11&)A,?BJOP!9D8t#GGLLIJ(#
 &+1XDqN   M? G
 $$ CDF2JqM*+  As$   !F!/F *GGAGGr/   r   )r6   NNNFFN)r>   r?   r@   rA   r   unfilteredpropertycacherb  r3  r;  r   rA  rF  rB   __classcell__)r5  s   @r2   mqrepor.    sQ    		*	*	: 
+	:	1	. 	Q$	&('	 '	r6   rP  )r5  r  _phasedefaultsrJ   r+  )r   rK   rP  s      r2   	reposetuprR    s@    _ _B zz||""?3 r6   c                    [        US5      (       aA  UR                  SS5      (       d*  UR                  [        S5      UR                  S5      5        U " X/UQ70 UD6$ )Nr;  	no_commitFs#   cannot import over an applied patchr  )hasattrr   r;  r   )origr   rK   r   r   s        r2   mqimportrW  Z  s`    t)**6::U4 4 	45vzz'7J	
 *4*6**r6   c                   UR                  SS 5      nU(       d  U " U/UQ70 UD6$ U(       a@  US   n[        R                  " U5      (       d  [        R                  " [        S5      5      eOO[        R                  " [        R                  " 5       5      nU(       d  [        R                  " [        S5      5      e[        R                  " X5      n[        XS5      $ )Nrb  r   s0   only a local queue repository may be initializeds5   there is no Mercurial repository here (.hg not found)T)r  r   rI  r   r.  r   r
   findrepor   getcwdr"  rv  )rV  r   r   r   rb  repopathrK   s          r2   mqinitr\  d  s    	D$	BB((((7zz(##++EF  $
 ##HOO$56++JK  ==&D4  r6   c                    UR                  SS5      nU(       d  U " X/UQ70 UD6$ UR                  nUR                  5       nU(       d  [        R                  " [        S5      5      eU " UR                  U/UQ70 UD6$ )z>Add --mq option to operate on patch repository instead of mainrb  Nr  )r  rb  r  r   r.  r   r   )rV  r   rK   r   r   rb  rc  r  s           r2   	mqcommandr^  z  ss     
D$	BB.t.v..A		Akk!2344a)$)&))r6   c                   UR                   n/ n[        UR                  5      [        UR                  U5      5      pTU(       a-  UR	                  U R                  [        S5      S5      U-  5        U(       a-  UR	                  U R                  [        S5      S5      U-  5        U(       a-  U R                  [        S5      SR                  U5      -  5        g U R                  [        S5      5        g )Ns
   %d applied   qseries.applieds   %d unapplied   qseries.unapplieds   mq:     %s
s   , s   mq:     (empty queue)
)
rb  ro   r  r  rJ   r  r   rq  r   r  )r   rK   rc  r  r#  us         r2   summaryhookrc    s    A
Aqyy>3q{{401q	!M*,>?!CD	!O,.BCaGH
?#ejjm34 	,-.r6   s   mq()c                6   [         R                  " USS[        S5      5        U R                  R                   Vs1 s H  o0UR
                     R                  5       iM!     nn[        R                  " U Vs/ s H  o3U;   d  M
  UPM     sn5      $ s  snf s  snf )zChangesets managed by MQ.r   s   mq takes no arguments)	r   getargsr   rb  r  rV   r  r   baseset)rK   subsetr  r  r  s        r2   revsetmqrh    su     q!Q": ;<+/77??;?aAFF|!?G;?1w,Q?@@ <?s   &B7	BBc                  ^ SSS [        S5      4/m[        R                  " [        R                  S[
        5        [        R                  R                  S[        5        [        R                  " [        R                  S[        5      nUS   R                  T5        U4S jnU" [        R                  5        [        R                  S   n[        R                  " 5        H  u  pEXS:w  d  M  U" [        US	0 5      5        M!     g )
Nr6   r#   s   operate on patch repositorys   imports   initrg   c                   > U R                  5        He  u  p[        R                  " U5      S   nUS   nUR                  (       a  M6  [        R
                  " X[        5      nUS   R                  T5        Mg     g r  )rz  r
   parsealiasesr  r   wrapcommandr^  rp  )cmdtablecmdr  funcmqopts       r2   dotableextsetup.<locals>.dotable  s`    "..*JC&&s+A.C8D{{**8)DE!HOOE" +r6   zhgext.mqrm  )r   r   rl  r   tablerW  r
   summaryhooksr  rc  r\  rp  sysmodulesgetattr)r   r  rq  
thismoduleextname	extmodulerp  s         @r2   extsetupr{    s     5$"@ ABCE8>>9h?UK0""8>>7FCE	!HOOE# HNNZ(J(335"GIz267 6r6   s   reds   yellows   greens   blue bold underlines
   black bolds   red bold)r  r  r  r`  s   qseries.guardeds   qseries.missingra  r.   )x__doc__
__future__r   r   rM  r!  ru  mercurial.i18nr   mercurial.noder   r   r   r	   	mercurialr
   r   r   r   r   r   r   r   r  r   r   r+  r   r   r   r   r   r   r   r   r   r   r   mercurial.utilsr   r   r    r  
seriesoptsrm  command
testedwithconfigtable
configitemrH  KeyErrorr+   loadrQ   normpathrG  rS   rn   r   r   r   r   r   r.  r   r   r^  CATEGORY_CHANGE_ORGANIZATIONr#  r  r  CATEGORY_IMPORT_EXPORTrT  rv  CATEGORY_REPO_CREATIONr  
remoteoptsr  rs  CATEGORY_COMMITTINGr   r  r'  r  r  r  walkopts
commitoptsr  r:  r2  	diffopts2CATEGORY_FILE_CONTENTSru  CATEGORY_CHANGE_MANAGEMENTr  r  rO  rv   r  r  r  r  r  r)  r0  r  r  r&  r+  rR  rW  r\  r^  rc  revsetpredicaterh  i18nfunctionsr{  
colortabler/   r6   r2   <module>r     s  7r # 	 	  
       ,  //Zq)L'MNO



H
%
 #
!!+.
 
	

 	
 	
 	.OOH 	$ ==- -	 (V#Lu" u"p,$	U[[ 	J  J Z@	 		wa 23467fI	
	 #$55 	
GT1EFGH&'55@ 	
HdA:;<=
J()55	> 		{D!$E"FG	wQ45qzB	xq!<=>:;fI	
 
vtQ>?@	wa 89: GH//#&4'&4n8 	
ND!$>"?@A//;; 		gtQDEF:;		
 :;		
 45gJ	
, -. ,-//7:^2;:^2B 	NN< #)*,,,, 		z4#A!BC  55 	o55	. 	55		F	F 	55	$7 		wa CDE	xq!KLM	vtQ>?@	~tQ'M%NO	wQ=>'
K	~tQ'M%NO	wQ=>'
K 	 
 9:,,!$ %$ F 		wa CDE	vtQ>?@LM		
 CD		
 ABgJ	
 AB		
 ?@gJ	
9#H I$J K%L FG,,W,Z[,Z> 	w(((7+;+;;'(//( 		wa CDE	wa :;< 	
 8933	D	DN 	 78		
 
xq!?@A	lD!$I"JK	 #$55< 		wa >?@	wa 234 AB55H0H0V 	55	--$$ 	 78		
 
xq!ABC>?		
 
wa ABC	vtQ345	xq!IJK	wQ?@!G*M>?		
 
lD!$I"JK14 9:55=@%A@%P 		vtQ123	wQ@A1W:N78		
 
xq!MNO	lD!$I"JK *+55!$!%$!H 	#$55	44n 		y$"6 78	y$"C DE "#55 		wa 789	wQ56'
C	xq!;<=	xq/0	  >?55!!H 		wa 567	y$"C DE	fdAJKL	j$"> ?@	 *+55
n
nb 	
Ja @ABC!"55	%%P 		wq!=>?	i"? @A	y%#6!78	i"8 9:	i"> ?@	hq!FGH 55mm`	e4P+!,* /  ++- A A 
8: !!.%#'
kA  
.  OOGIx-
.s   b3 3)c c 