
    6h0                   
   S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	J
r
JrJrJrJrJrJrJr  SSKJr  SSKJrJrJr  SSKJr  \R                   (       a  S SK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/J0r0J1r1J2r2J3r3J4r4J5r5J6r7J8r8J9r9J:r:J;r;J<r<J=r>  SS	K?J@r@JArAJBrB  SS
KCJDrE  \(       a  SSKFJGrH  SSKJIrJ  \<R                  rKSSS\" S5      4/rLSSS\" S5      4/rMSSS\" S5      \" S5      4SSS\" S5      \" S5      4SSS\" S5      4/rNSS/ \" S5      \" S5      4SS / \" S!5      \" S5      4/rOS"S#S\" S$5      \" S%5      4S&S'S\" S(5      \" S)5      4/rPS*S+S\" S,5      \" S-5      4S.S/S\" S05      \" S15      4/rQS2S3S\" S45      4S5S6S\" S75      4/rRS8S9S\" S:5      \" S;5      4/rSSS<S\" S=5      \" S>5      4S8S9S\" S:5      \" S;5      4/rTS?S@S\" SA5      4SBSCS\" SD5      4S&SES\" SF5      \" SG5      4SHSIS\" SJ5      4SSKS\" SL5      4SMSNS\" SO5      4/\T-   rUSPSQS\" SR5      4SBSCS\" SS5      4SSTS\" SU5      4SSVS\" SW5      4/rVSXSYS\" SZ5      4S[S\S\" S]5      4S^S_S\" S`5      4SaSbS\" Sc5      4/rWSSdS\" Se5      4S?SfS\" Sg5      4SShS\" Si5      4/\W-   S5SjS\" Sk5      \" SG5      4SSKS\" SL5      4SSlS\" Sm5      \" Sn5      4/-   rXSoSpS\" Sq5      \" Sr5      4/rYSsStS\" Su5      \" Sv5      4/rZSwSxS\" Sy5      4/r[SzS{S|\" S}5      4S"S~S|\" S5      4SSS\" S5      4/r\Sr]      SS jr^        SS jr_SS jr`SS jraS rbS rcS rdS reS rfSS jrgSS jrhS riS rj " S S5      rkSS jrlS rm\R                  " SS9 " S S5      5       roS rpSS jrqSS jrrS rsSS jrtSS jruSS jrvS rw SS jrxS ryS rzSS jr{SS jr|SS jr}SS jr~S r " S S5      r S     SS jjrSS jrS rSSS jjr/ r/ r0 r0 rS r/ r0 rS rS rS rS r    SS jrSS jrSS jrS rS rS rS rS r SS jrS rS rS r " S S5      rS rS rSS jrSS jr    SS jrS rS rS rSS jrS rS r  SS jr\<GRP                  " 5       r\<GRP                  " 5       r\<GRP                  " 5       rSS jrS rS rS rS rS rS r      SS jrS rS rSS jrg)    )annotationsN)	AnyAnyStrBinaryIODictIterableLiteralOptionalTYPE_CHECKINGcast   )_)hexnullrevshort)attr)	bookmarksbundle2	changelogcopiescrecordencodingerrorexchange	formatter
logcmdutilmatchmerge
mergestate	mergeutilobsoletepatchpathutilphasespycompatrepairrevlogrewriteutilscmutilstatestreamclonesubrepoutil
templatekw	templaterutilvfs)dateutil
stringutilurlutil)	constants)status)ui   ns   dry-runs)   do not perform actions, just print output    s   confirms   ask before applying actions   es   sshs   specify ssh command to uses   CMDs	   remotecmds,   specify hg command to run on the remote sides   insecures>   do not verify server certificate (ignoring web.cacerts config)   Is   includes)   include names matching the given patternss   PATTERN   Xs   excludes)   exclude names matching the given patterns   m   messages   use text as commit messages   TEXT   l   logfiles   read commit message from files   FILE   d   dates(   record the specified date as commit dates   DATE   u   users&   record the specified user as committers   USER   Ds   currentdates&   record the current date as commit date   Us   currentusers$   record the current user as committer   Ts   templates   display with templates   TEMPLATEs   styles,   display using template map file (DEPRECATED)s   STYLE   ps   patchs
   show patch   gs   gits   use git extended diff formats   limits!   limit number of changes displayeds   NUM   Ms	   no-mergess   do not show mergess   stats(   output diffstat-style summary of changes   Gs   graphs   show the revision DAG   as   texts   treat all files as texts0   use git extended diff format (DEFAULT: diff.git)s   binarys+   generate binary diffs in git mode (default)s   nodatess   omit dates from diff headers   ws   ignore-all-spaces'   ignore white space when comparing lines   bs   ignore-space-changes+   ignore changes in the amount of white space   Bs   ignore-blank-liness(   ignore changes whose lines are all blank   Zs   ignore-space-at-eols#   ignore changes in whitespace at EOLs   noprefixs&   omit a/ and b/ prefixes from filenamess   show-functions>   show which function each change is in (DEFAULT: diff.showfunc)s   reverses&   produce a diff that undoes the changess   unifieds"   number of lines of context to shows   roots&   produce diffs relative to subdirectorys   DIR   ts   tools   specify merge tools   TOOL   s
   similaritys-   guess renamed files by similarity (0<=s<=100)s
   SIMILARITY   S   subreposs   recurse into subrepositories   c	   changelogFs   open changelog   manifests   open manifest   dirs   open directory manifests:   ^HG: ------------------------ >8 ------------------------$c                    SS jnSnU HT  nU R                  U5      (       d  M  U(       a0  [        R                  " [        S5      U" U5      U" U5      4-  5      eUnMV     U$ )zyabort if more than one of the arguments are in opts

Returns the unique argument or None if none of them were specified.
c                N    [         R                  " U 5      R                  SS5      $ )N   _   -)r%   sysbytesreplacenames    3/usr/lib/python3/dist-packages/mercurial/cmdutil.py
to_display)check_at_most_one_arg.<locals>.to_display*  s       &..tT::r8   Ns!   cannot specify both --%s and --%s)r`   r   returnbytes)getr   
InputErrorr   )optsargsrb   previousxs        ra   check_at_most_one_argrl   !  sh    ; H88A;;&&:;!(+Z];<  H  Or8   c                .    U H  n[        XU5        M     g)zabort if the first argument is given along with any of the others

Unlike check_at_most_one_arg(), `others` are not mutually exclusive
among themselves, and they're passed as a single collection.
N)rl   )rh   firstothersothers       ra   check_incompatible_argumentsrq   9  s     d51 r8   c                   [        USS5        [        USS5        SnUR                  S5      (       a  S[        R                  " 5       -  US'   O\UR                  S5      (       dF  U R	                  SS5      (       a/  UR                  S5      c  S[        R                  " 5       -  US'   S	nUR                  S5      (       a  U R                  5       US'   U$ )
zmodify commit options dict to handle related options

The return value indicates that ``rewrite.update-timestamp`` is the reason
the ``date`` option is set.
datecurrentdateusercurrentuserFs   %d %d   rewrites   update-timestampT)rl   rf   r1   makedate
configboolusername)r6   rh   datemaydiffers      ra   resolve_commit_optionsr|   G  s     $6$6Mxx("3"3"55VHHVMM*&9::HH]#+("3"3"55Vxx{{}Vr8   c                    U R                  S5      nU(       d  g[        U5      S:  a  [        R                  " [	        S5      5      eSU;   a  [        R                  " [	        S5      5      eg)z!make sure note is of valid formatnoteN   s*   cannot store a note of more than 255 bytes   
s   note cannot contain a newline)rf   lenr   rg   r   )rh   r~   s     ra   check_note_sizer   b  s]     88FD
4y3q!NOPP}q!ABCC r8   c                X    [         R                  [        R                  4n[	        X5      $ N)
crecordmoduihunkr"   
recordhunk
isinstance)rk   hunkclassess     ra   ishunkr   o  s#    $$e&6&67Ka%%r8   c                X    [         R                  [        R                  4n[	        X5      $ r   )r   uiheaderr"   headerr   )rk   headerclassess     ra   isheaderr   t  s!    ((%,,7Ma''r8   c                F   [        5       n[        5       nU  H  n[        U5      (       d  M  UR                  5       (       d  M,  UR                  UR	                  5       5        UR                  [        UR                  5       5      UR	                  5       1-
  5        M     X4$ r   )setr   	isnewfileaddfilenameupdatefiles)chunksnewlyaddedandmodifiedfilesalsorestorechunks       ra   newandmodifiedr   y  sx    !$%KE??u00&**5>>+;<s5;;=1U^^5E4FFG  &22r8   c                    U R                  S5      n[        U5      n/ nU HF  nSU;   d  M  UR                  SS5      nXR;  d  M$  UR                  U5        UR	                  U5        MH     UR                  U5        U$ )N   |r\   r8   )splitr   r^   r   appendextend)cmdbase_aliasesall_aliasesextra_aliasesaliasfolded_aliass         ra   parsealiasesr     su    99T?Ll#KM5= ==s3L.-$$\2  &r8   c                P   ^^ S mU R                   mUU4S jn[        U SU5        T$ )Nc                   ^ UR                  SS5      n[        R                  " U4S j5       H  u  pEU " XCU-   S9  M     g )Nlabelr8   c                    > T $ r    )ri   s   ra   <lambda>8setupwrapcolorwrite.<locals>.wrapwrite.<locals>.<lambda>  s    r8   r   )popr"   	difflabel)origri   kwr   r   ls    `    ra   	wrapwrite&setupwrapcolorwrite.<locals>.wrapwrite  s4    w$5HEai( 6r8   c                    > T" T/U Q70 UD6$ r   r   )ri   kwargsoldwriter   s     ra   wrap!setupwrapcolorwrite.<locals>.wrap  s    3D3F33r8   write)r   setattr)r6   r   r   r   s     @@ra   setupwrapcolorwriter     s+    )
 xxH4 BOr8   c                    U(       aT  U(       a&  [         R                  " U[         R                  5      nO[         R                  n[         R                  " XXe5      $  [        R                  " XXE5      $ ! [         R
                   a8  nU R                  SU-  5        U R                  [        S5      5         S nAN^S nAff = f)N   %s
s   falling back to text mode
)	r   testdecoratortestchunkselectorchunkselectorfilterpatchfallbackerrorwarnr   r"   )r6   originalhunks	usecursestestfiler   	operationrecordfnes           ra   filterchunksr     s    3%33j:: &33))8   RAA	 ## 3
!
01223s   AA5 5C	.B<<Cc                    [         R                  " U 5      nU R                  SS5      n[        U 5      n [	        XXEX#5      u  pxX`l        Xx4$ ! X`l        f = f)zPrompts the user to filter the originalhunks and return a list of
selected hunks.
*operation* is used for to build ui messages to indicate the user what
kind of filtering they are doing: reverting, committing, shelving, etc.
(see patch.filterpatch).
   experimentals   crecordtest)r   checkcursesconfigr   r   r   )	r6   r   r   r   r   r   r   	newchunksnewoptss	            ra   recordfilterr     s`     &&r*Iyy.9H"2&H)yE
	  s   A Ac	                   UR                  5       c   eUR                  S5      (       d
  [        USS9  US   n	[        U	R	                  5       5      S:  n
U
(       a  [
        R                  " [        S5      5      eS nUR                  S5      nU(       d  [        R                  " X;5      nUR                  US	9nS
S0nUR                  R                  US5         [        R                  " [        R                  " UR                   5      [        R                  " UR"                  5      [        R                  " UR$                  5      [        R                  " UR&                  5      [        R                  " UR(                  5      [        R                  " UR*                  5      [        R                  " UR,                  5      5      n[.        R0                  " UR                  XUSS9u  nnnU H?  nUU;   d  M  U	R3                  U5      R5                  S5      n[
        R6                  " U5      e   SSS5        U(       d  UR9                  XX5        [:        R<                  " U USSSS9nSUl        SUl         SUl!        [:        RD                  " XUS9n[:        RF                  " U5      n[        RH                  " US   U5      n U" U UU5      u  nnURQ                  U5        [S        U5      u  nn[U        5       nU H=  n[W        U5      (       d  M  URQ                  [U        URY                  5       5      5        M?     UR                   UR"                  -   UR$                  -   nU V s/ s H  n U U;   d  M  U PM     n!n U!(       d  U R                  [        S5      5        g[U        UR                   5      n"U(       a  Un#O U! V s/ s H  n U U";   d  U U;   d  M  U PM     n#n 0 n$U#(       a2  URZ                  R]                  S5      n% [^        R`                  " U%5         U# H  n [d        Rf                  " [^        Rh                  Rk                  U 5      S-   W%S9u  n&n'[^        Rl                  " U&5        U Ro                  SU U'4-  5        [p        Rr                  " URu                  U 5      U'SS9  U'U$U '   M     [w        5       n(U H,  n)U)Ry                  5       n*U*U$;   d  M  U)R{                  U(5        M.     U(R}                  5       n+U(R                  S5        UR                  SS5      (       a  [        R                  [        R                  -   U(R                  5       -   n,U R                  U,SSURh                  S9n-U(R                  S5        U(R{                  U-5        U(R                  S5        U V)s/ s H(  n)[^        R                  " URu                  U)5      5      PM*       n)U$(       aI  [        R                  " U[U        U$R                  5       5      U-  5      n.[        R                  " US   U.S9  U+(       aH   U Ro                  S 5        U Ro                  U(R                  5       5        [:        R                  " XU(SSS!9  A(U! V/s/ s H  n/URu                  U/5      PM     n!n/U" X/U!Q70 [d        R                  " U5      D6 UR                  n0U$R                  5        H  u  n1n'U Ro                  S"U'U14-  5        U0R                  U15      R                  (       a,  U0R                  U5         U0R                  U1SSSS#9  SSS5        [p        Rr                  " U'URu                  U15      SS9  [^        R                  " U'5        M     U#(       a  [^        R                  " W%5        $ $ ! , (       d  f       GNu= f! [
        RJ                   a'  n[
        R                  " [        S5      U-  5      eSnAf[
        RL                   a'  n[
        RN                  " [        S5      U-  5      eSnAff = fs  sn f s  sn f ! [b         a     GN%f = fs  sn)f ! [
        RJ                   a/  n[
        R                  " [d        R                  " U5      5      eSnAf[
        RL                   a/  n[
        RN                  " [d        R                  " U5      5      eSnAff = fs  sn/f ! , (       d  f       GN= f! [         a     $ f = f!  UR                  n0U$R                  5        H  u  n1n'U Ro                  S"U'U14-  5        U0R                  U15      R                  (       a>  U0R                  U5         U0R                  U1SSSS#9  SSS5        O! , (       d  f       O= f[p        Rr                  " U'URu                  U15      SS9  [^        R                  " U'5        M     U#(       a  [^        R                  " W%5        f f ! [         a     f f = f= f)$a  This is generic record driver.

Its job is to interactively filter local changes, and
accordingly prepare working directory into a state in which the
job can be delegated to a non-interactive commit command such as
'commit' or 'qrefresh'.

After the actual job is done by non-interactive command, the
working directory is restored to its original state.

In the end we'll record interesting changes, and everything else
will be left in place, so the user can continue working.
Ns   interactive-unshelveT)commitr   s9   cannot partially commit a merge (use "hg commit" instead)c                6    [         R                  " SX4-  5      e)Ns   %s: %s)r   rg   )fmsgs     ra   fail_record.<locals>.fail  s    yA8344r8      forcer   )   uis   commitsubreposs   record)force   commandss   commit.interactive.)rh   
whitespacesectionconfigprefix)changesrh      error parsing patch: %s   error applying patch: %ss   no changes to record
r   s   record-backups   .)prefixdirs   backup %r as %r
copystats   reviewFr8   s   diff)actionrepopath)matchers   applying patch
eolmodes   restoring %r to %r

p1_tracked
wc_trackedpossibly_dirty)Wcurrentwlockrf   checkunfinishedr   parentsr   rg   r   matchmodbadmatchr5   r6   configoverrider)   copymodcopymodifiedaddedremoveddeletedunknownignoredcleanr,   	precommitsubdirtyreasonAbortcheckcommitpatternsr"   difffeatureoptsnodatesgitshowfuncdiff
parsepatchr   PatchParseErrorPatchApplicationError
StateErrorr   r   r   r   r   r0   joinosmkdirFileExistsErrorr%   mkstemppathbasenameclosedebugr/   copyfilewjoinstringior   r   tellseekr   diffhelptextpatchhelptextreadedittruncateunlink
matchfileskeysmergemod	revert_togetvalueinternalpatchbytestr	strkwargsdirstateitems	get_entrymaybe_cleanchanging_parentsupdate_filermdirOSError)2r6   repomessager   rh   
commitfunc	backupallfilterfnpatswctxr   r   r   r5   	overrides	tmpstatussubs
commitsubsnewstatesr  diffoptsoriginaldifforiginal_headersr   r   errr   r   
contendershchangedr   newfilesr   tobackupbackups	backupdirfdtmpnamefpcfnamedopatch	patchtextreviewedpatchmnfr.  realnames2                                                     ra   _recordrY    s$   0 ***88+,,T*:D!#ENO
 	
5 HHXE!!%.[[u[%F+T2I				9	5NNLL)LL&LL(LL(LL(LL(LL&
	 &1%:%:GGTe4&
"j( AJ"hhqk55d;kk+.. ! 
6*   f;$$
+H HHLH::dBL''5MM$t*d+EE"2'7?
 	KK /=V.D+JA;;c!'')n-  oo,v~~=G"67aa:o7H6
		!-./6??#H  
H}%? ?  	 

 GHHMM"34		HHY[A"**ww''*T1yKB HHRLHH)QL89MM$**Q-4@ GAJ  ZAJJLE  '')

 88Iu%%''**B*BBRWWYN  GG3w $ M KKNHH]#GGAJ+EF+Ea4::a=	!+EF""4W\\^)<{)JKAtDz15 >,-'##Bb!TB
  .66XrDJJrNX6"JXJ1C1CD1IJ!	}}H%,]]_!'0GX3FFG%%h/;; "2248 ,,$'+'++/	 -  9 gtzz(';dK		'"7 &58 # U 
6	5P    Dq!;<sBCC&& Eq!<=CDDE  7
  		B 	G (( >&&x'7'7'<==.. >&&x'7'7'<==> 7& 98"  		A!	}}H%,]]_!'0GX3FFG%%h/;; "2248 ,,$'+'++/	 -  988 gtzz(';dK		'"7 &58 #  		s/  D^"<8^"^4 +
`+9`+`0`0`5 B:c9 Cc9 ./aAc9 7Aa >c9 c!c9  A)c))c<A$c)"
^14`("_**`("`##`(5
aac9 c*b		c *c

cc9 
c&!c))
c65c69g?;A)g/$f 	7	g/ 
f
A#g/-g?/
g<9g?;g<<g?c                d   [         R                  " U5      nU R                  5       (       d7  U(       a  [        S5      U-  nO[        S5      n[        R
                  " U5      eUR                  S5      (       d  U R                  5         [        R                  " [        UUUUS9n	[        XXU5      $ )Ns)   running non-interactively, use %s insteads   running non-interactivelyrC   )r8  r9  r:  r;  )r%   byteskwargsinteractiver   r   rg   rf   rz   	functoolspartialrY  r   )
r6   r6  r8  
cmdsuggestr9  r:  r;  rh   r   funcs
             ra   dorecordra    s     %D>>@AJNC01Cs## 88G
D "D--r8   c                  6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
dirnodei  a  
Represent a directory in user working copy with information required for
the purpose of tersing its status.

path is the path to the directory, without a trailing '/'

statuses is a set of statuses of all files in this directory (this includes
all the files in all the subdirectories too)

files is a list of files which are direct child of this directory

subdirs is a dictionary of sub-directory name as the key and it's own
dirnode object as the value
c                J    Xl         [        5       U l        / U l        0 U l        g r   )r  r   statusesr   subdirs)selfdirpaths     ra   __init__dirnode.__init__  s    	
r8   c                <    U R                   R                  X45        g)z/Add a file in this directory as a direct child.N)r   r   )rg  r   r5   s      ra   _addfileindirdirnode._addfileindir  s    

8,-r8   c                ~   SU;   a{  UR                  SS5      u  p4X0R                  ;  a9  [        R                  " U R                  U5      n[        U5      U R                  U'   U R                  U   R                  XB5        OU R                  X5        X R                  ;  a  U R                  R                  U5        gg)z
Add a file to this directory or to its direct parent directory.

If the file is not direct child of this directory, we traverse to the
directory of which this file is a direct child of and add the file
there.
   /r   N)
r   rf  r#   r  r  rc  addfilerl  re  r   )rg  r   r5   subdirfilep
subdirpaths         ra   rp  dirnode.addfile  s     8$NN43MF \\)%]]499f=
'.z':V$ LL ((7 x0&MMf% 'r8   c              #     #    U R                    H*  u  pU[        R                  " U R                  U5      4v   M,     g7f)z=Yield (status, path) for files directly under this directory.N)r   r#   r  r  )rg  r   sts      ra   iterfilepathsdirnode.iterfilepaths  s/     ZZEAhmmDIIq111  s   <>c              #  N  #    [        U R                  5      S:X  a2  U R                  R                  5       nX!;   a  X R                  S-   4v   gU R	                  5        Sh  vN   U R
                  R                  5        H  nUR                  U5       Sh  vN   M     g N? N7f)a  
Yield (status, path) obtained by processing the status of this
dirnode.

terseargs is the string of arguments passed by the user with `--terse`
flag.

Following are the cases which can happen:

1) All the files in the directory (including all the files in its
subdirectories) share the same status and the user has asked us to terse
that status. -> yield (status, dirpath).  dirpath will end in '/'.

2) Otherwise, we do following:

        a) Yield (status, filepath)  for all the files which are in this
            directory (only the ones in this directory, not the subdirs)

        b) Recurse the function on all the subdirectories of this
           directory
r   ro  N)r   re  r   r  rw  rf  values	tersewalk)rg  	terseargsonlystdirobjs       ra   r{  dirnode.tersewalk  s     . t}}"]]&&(F "ii$... %%''' ll))+F''	222 , 	( 3s$   AB%!B!"5B%B#
B%#B%)r   r  re  rf  N)__name__
__module____qualname____firstlineno____doc__ri  rl  rp  rw  r{  __static_attributes__r   r8   ra   rc  rc    s     .&82
%3r8   rc  c                   Sn[         R                  " U5       H*  nX2;  d  M
  [        R                  " [	        S5      U-  5      e   [        S5      nSn0 nU H,  u  px[        X5       H  n	UR                  X5        M     / Xh'   M.     UR                  5        H  u  pXj   R                  U5        M     UR                  R                  5        H0  nUR                  U5       H  u  pXj   R                  U	5        M     M2     / nU H(  n
Xj   R                  5         UR                  Xj   5        M*     [        R                  " U6 $ )a  
Terse the status if all the files in a directory shares the same status.

statuslist is scmutil.status() object which contains a list of files for
each status.
terseargs is string which is passed by the user as the argument to `--terse`
flag.

The function makes a tree of objects of dirnode class, and at each node it
stores the information required to know whether we can terse a certain
directory or not.
)r<   rK      rr@   rB      irU   s   '%s' not recognizedr8   ))r   r<   )r   rK   )r   r@   )r  rU   )r  rB   )r  r  )r   r  )r%   r,  r   rg   r   rc  getattrrp  rw  r   rf  rz  r{  sortr)   r5   )
statuslistr|  allstrB  rootobjpstatus	tersedictattrname
statuscharr   rv  fpathrq  
tersedlists                 ra   tersedirr  "  s1    7E i(>""1%;#<q#@AA )
 clGG I '.AOOA* / "	 !( **,	U# - //((*%%i0EBM  # 1 + J)-(  >>:&&r8   c                ~    U R                  5       nU Vs/ s H  nSU-  PM
     nnSR                  U5      S-   $ s  snf )z0Surround lineswith a comment char and a new lines   # %sr   )
splitlinesr  )rawlineslinecommentedliness       ra   _commentlinesr  Z  s?    NNE167gnN7::n%-- 8s   :T)frozenc                      \ rS rSr\R
                  " 5       r\R
                  " 5       r\R
                  " 5       r\R
                  " 5       r	\R
                  " 5       r
\R
                  " S\" 5       S9rSrS rS rS rSrg	)

morestatusia  F)initdefaults   status.morestatusc                    U R                   R                  U5        U R                  (       a   XR                  ;   a  UR	                  SS9  g g g )NT)
unresolved)_formattedpathsr   activemergeunresolvedpathsdata)rg  r  fms      ra   
formatfilemorestatus.formatfilek  s@      &(<(< <GGtG$ !=r8   c                P   U R                   (       d  U R                  (       a  UR                  5         UR                  SS9  U R                   (       aW  UR                  U R                   S9  [	        S5      U R                   -  nUR                  S[        U5      -  U R                  S9  U R                  (       a  UR                  U R                  S9  U R                  U5        U R                  (       a1  UR                  S[        U R                  5      -  U R                  S9  g g )Ns
   morestatus)itemtype)
unfinisheds.   The repository is in an unfinished *%s* state.r   r   )unfinishedmsg)	unfinishedopr  	startitemr  r   plainr  _label_formatconflicts)rg  r  statemsgs      ra   formatfootermorestatus.formatfooterp  s     2 2LLNGG]G+GGt00G1CD##$  HHW}X66dkkHJGG$"4"4G5 	b!HH-(:(:;;4;;   r8   c                h   U R                   (       d  g U R                  (       a  SR                  U R                   Vs/ s HE  nS[        R                  " U R
                  R                  [        R                  " 5       U5      -  PMG     sn5      n[        S5      U-  nU R                   HN  nXPR                  ;   a  M  UR                  5         UR                  U R
                  S9  UR                  SUSS9  MP     O[        S5      nUR                  S	[        U5      -  U R                   S
9  g s  snf )Nr   s       %ssS   Unresolved merge conflicts:

%s

To mark files as resolved:  hg resolve --mark FILE)r6  s   fileT)r  r  r  s   No unresolved merge conflicts.r   r   )r  r  r  r/   pathtor6  rootr   getcwdr   r  r  contextr  r  r  r  )rg  r  r  mergeliststrr   r   s         ra   r  morestatus._formatconflicts  s    :: !% 4 4 !5 kk$))..(//2CTJK 4L 6   )),,,

		
* qTB * 56C
=--T[[ACs   AD/r   N)r  r  r  r  r   ibr6  r  r  r  r  r   r  r  r  r  r  r  r   r8   ra   r  r  a  s`    779D779LGGIM'')KggiOgg5#%8O!F%
.'Br8   r  c                $   [         R                  " U 5      n[        R                  R	                  U 5      nUR                  5       nU(       d  U(       d  gS=n=pVU(       a  Uu  pEU(       a  [        UR                  5       5      n[        XXSU5      $ )z=Returns a morestatus object if the repo has unfinished state.N)	statemodgetrepostatemergestatemodr   r"  activesortedr  r  )r6  
statetupler   r  r  r  r  s          ra   readmorestatusr    s    &&t,J))..t4J##%Kk044L4=&0#J1134
M
 r8   c                   0 n0 nX;   a  U /nOUR                  5       n/ nU H  n[        U5      nUR                  U5        Sn	X;   a  U n	O*U(       d#  U H  n
U
R                  U 5      (       d  M  U
n	  O   U	c  MX  US   R                  S5      (       d  U	R                  S5      (       a
  XU   4XI'   M  XU   4X9'   M     U(       d	  U(       a  UnX64$ )z
Return cmd -> (aliases, command table entry)
for each matching command.
Return debug commands (or their aliases) only if no normal command matches.
Nr   s   debug)r'  r   r   
startswith)r   tablestrictchoicedebugchoicer'  allcmdsr   aliasesfoundas              ra   findpossibler    s     FK
|uzz|Gq/w>E<<$$E  qz$$X..%2B2B82L2L&-Qx%8"!(( 3 " k?r8   c                   [        XU5      u  p4X;   a  X0   $ [        U5      S:  a!  [        U5      n[        R                  " X5      eU(       a  [        UR                  5       5      S   $ [        R                  " X5      e)z9Return (aliases, command table entry) for command string.r   r   )r  r   r  r   AmbiguousCommandlistrz  UnknownCommand)r   r  r  r  r  clists         ra   findcmdr    sl    "3v6OF
}{
6{Qv$$S00FMMO$Q''


s
,,r8   c                  ^ UR                  5          UR                  5          UR                  S5         [        U5        [        R
                  " X5      nU(       d  [        R                  " S5      eUR                  SU5      n[        U5      S:  a  [        R                  " [        S5      5      e[        R                  " XS5        XR                  5          nUR                  5        Vs1 s H  owR                  5       iM     nnUR!                  S5      (       d7  X8;  a2  X1R#                  5       ;   a  [        R                  " [        S5      5      eUR                  S	U5      (       a  [        R                  " [        S
5      5      e0 n	SSKJn
  U GHg  nX   mTR                  5       nX:X  a  M  U4S jnU R)                  S[+        TR-                  5       5      X4-  5        TR/                  5       n[+        TR-                  5       5      US'   TR1                  5       R-                  5       nTR3                  5       R-                  5       nX;   a  X   S   nUU	;   a  U	U   S   nU
R5                  UUU4TR7                  5       TR9                  5       UTR;                  5       TR=                  5       UUS9	nUR?                  U5      nU4U	TR-                  5       '   U R)                  S[+        U5      -  5        GMj     [@        RB                  " XSSS9  US   n[        UR                  5       5      S:X  aJ  U	R!                  UR1                  5       R-                  5       5      nUb  SSKJ"n  URG                  UUS   SS9  U RI                  [        S5      [        U	5      -  5        SSS5        SSS5        SSS5        gs  snf ! , (       d  f       N$= f! , (       d  f       N-= f! , (       d  f       g= f)z-Change the branch name of given revs to labels   branchess   empty revision set
   roots(%ld)r   s,   cannot change branch of non-linear revisionss   change branch ofr   s(   a branch of the same name already existss   heads(%ld) - head()s)   cannot change branch in middle of a stackr  c                D   >  TU   $ ! [         R                   a     g f = fr   )r   ManifestLookupError)r6  newctxr  ctxs      ra   	filectxfnchangebranch.<locals>.filectxfn(  s*     t9$00   s    s*   changing branch of '%s' from '%s' to '%s'
s   branch_changer   )ru   rs   extrabranchs   new node id is %s
s   branch-changeTfixphaseNhg)
quietemptys    changed branch on %d changesets
)%wlocklocktransactionbailifchangedr   revranger   rg   revsr   r   r(   precheckrn   r   r  rf   	branchmap r  r  r   noder  p1p2memctxdescriptionr   ru   rs   	commitctxr)   cleanupnodesr  r   r5   )r6   r6  r  r   rh   rootsr  parentrpbreplacementsr  rev	oldbranchr  r  r  r  mcnewnoder<  newidr  r  s                         @ra   changebranchr     s=    
tyy{D$4$4[$Ad""4.""#899		-.u:>""AB  	T)<=KKM"-1\\^<^6}}^<!! ))""=> 
 99+T22"">?   	C)C

I!  HH>sxxz?I56 IIKE&)#((*oE"# BB!!%a(\!!"%a(R!		XXZXXZ   
B nnR(G(/zL$HH+c'l:;W \ 	 04	

 Dzt||~!# $$TWWY^^%56E  !		$aT	:
		!89C<MMNC %B{ = %B$A{{sM   O+OB:O	/O
J#O	+O3O+O		
OO
O(	$O++
O9c                ^   [         R                  R                  [         R                  R                  U S5      5      (       dj  U [         R                  R	                  U 5      pX:X  a  g [         R                  R                  [         R                  R                  U S5      5      (       d  Mj  U $ )Ns   .hg)r  r  isdirr  dirname)poldps     ra   findrepor  b  sk    ggmmBGGLLF344RWW__Q'a9 ggmmBGGLLF344
 Hr8   c                    U(       aF  U R                   R                  5       U R                  :w  a  [        R                  " [        S5      US9eU R                  5       nUR                  (       d3  UR                  (       d"  UR                  (       d  UR                  (       a  [        R                  " [        S5      US9eU S   n[        UR                  5       H!  nUR                  U5      R                  US9  M#     g)zenforce the precondition that working directory must be clean.

'merge' can be set to false if a pending uncommitted merge should be
ignored (such as when 'update --check' runs).

'hint' is the usual hint given to Abort exception.
s   outstanding uncommitted mergehints   uncommitted changesN)r.  r  nullidr   r  r   r5   r   r   r   r   r  substater  r  )r6  r   r	  rv  r  rB  s         ra   r  r  k  s     !!#t{{2q!ABNN	B	{{bhh"**

q!78tDD
t*CCLL!
  d + "r8   c                   [        USS5        [        [        [           UR	                  S5      5      nUR	                  S5      nU(       dj  U(       ac   [        U5      (       a  U R                  R                  5       nU$ SR                  [        R                  " U5      R                  5       5      n U$ U$ ! [         aG  n[        R                  " [        S5      U[         R"                  " UR$                  5      4-  5      eSnAff = f)z1get the log message according to -m and -l optionr=   r?   r   s"   can't read commit message '%s': %sN)rl   r   r
   re   rf   isstdiofilenamefinr"  r  r/   readfiler  r5  r   r  r   r   
strtolocalstrerror)r6   rh   r7  logfileinsts        ra   
logmessager  ~  s     $
J78E?DHHZ$89Ghhz"Gw		w''&&++- N  **T]]7%;%F%F%HI N7N  	++78H//>?@ 	s   *B8  3B8 8
D	ADD	c                    [        U [        5      (       a  U (       a  US-   $  US-   $ [        U R                  5       5      S:  a  US-   $ US-   $ )a  return appropriate editform name (referencing a committemplate)

'ctxorbool' is either a ctx to be committed, or a bool indicating whether
merging is committed.

This returns baseformname with '.merge' appended if it is a merge,
otherwise '.normal' is appended.
s   .merger   s   .normal)r   boolr   r   )	ctxorboolbaseformnames     ra   mergeeditformr    s_     )T"")++ 
 *$$ 
Y 	!A	%i''*$$r8   c                h   ^^^ U (       d  T(       d  T(       a  UUU4S j$ T(       a  U4S j$ [         $ )a  get appropriate commit message editor according to '--edit' option

'finishdesc' is a function to be called with edited commit message
(= 'description' of the new changeset) just after editing, but
before checking empty-ness. It should return actual text to be
stored into history. This allows to change description before
storing.

'extramsg' is a extra message to be shown in the editor instead of
'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
is automatically added.

'editform' is a dot-separated list of names, to distinguish
the purpose of commit text editing.

'getcommiteditor' returns 'commitforceeditor' regardless of
'edit', if one of 'finishdesc' or 'extramsg' is specified, because
they are specific for usage in MQ.
c           	        > [        XUTTTS9$ )N)
finishdescextramsgeditform)commitforceeditor)rrQ  rB  r  r  r  s      ra   r   !getcommiteditor.<locals>.<lambda>  s    0!
X 
r8   c                   > [        XUTS9$ )Nr  commiteditor)r   rQ  rB  r  s      ra   r   r!    s    |A!hGr8   r$  )r#  r  r  r  rh   s    ``` ra   getcommiteditorr&    s'    , zX
 	
 
GGr8   c                    / n[         R                  " U SS9 HH  u  p#nUS:X  a)  UR                  [        R                  " XU 5      5        M5  UR                  XU 5        MJ     SR                  U5      $ )NTr     stringr8   )r.   scantemplater   r2   	escapestrr  )tmplpartstypstartends        ra   _escapecommandtemplater1    sf    E$11$DAC)LL--do>?LLC)	 B
 88E?r8   c                v    U(       d  U$ [         R                  " U [        U5      5      nUR                  U5      $ )a|  Expand a literal template 'tmpl' in a way suitable for command line

'\' in outermost string is not taken as an escape character because it
is a directory separator on Windows.

>>> from . import ui as uimod
>>> ui = uimod.ui()
>>> rendercommandtemplate(ui, b'c:\\{path}', {b'path': b'foo'})
'c:\\foo'
>>> rendercommandtemplate(ui, b'{"c:\\{path}"}', {'path': b'foo'})
'c:{path}'
)r   maketemplaterr1  renderdefault)r6   r,  propsts       ra   rendercommandtemplater7    s3     $:4$@AA??5!!r8   c                   U R                  5       n[        R                  " UR                  U5      n[        R                  " UR                  U[
        R                  US9nSU 0nU(       a  UR                  U5        UR                  U5      $ )zExpand a literal template 'tmpl' byte-string against one changeset

Each props item must be a stringify-able value or a callable returning
such value, i.e. no bare list nor dict should be passed.
)defaults	resourcess   ctx)	r6  r   templateresourcesr6   r3  r-   keywordsr   r4  )r  r,  r5  r6  tresr6  mappings          ra   rendertemplater?    sq     88:D&&tww5D
 3 3t	A smGu??7##r8   c                    SnU(       a  U R                  SSU-  S5      nU(       d  U R                  SS5      nU(       d  UnU(       d  Sn[        X5      nUR                  S5      S   $ )z&Format a changeset summary (one line).Ns   command-templatess   oneline-summary.%ss   oneline-summarys  {separate(" ", label("oneline-summary.changeset", "{rev}:{node|short}"), join(filter(namespaces % "{ifeq(namespace, "branches", "", join(names % "{label("oneline-summary.{namespace}", name)}", " "))}"), " "))} "{label("oneline-summary.desc", desc|firstline)}"r   r   )r   r?  r   )r6   r  commanddefault_specspectexts         ra   format_changeset_summaryrE    sr    Dyy "7'"A4
 yy-/ABA 	 #$D::eQr8   c                   SSSSSSSS.nUb  S	US
'   Ub  SUS'   Ub  Ub  SUS'   Ub  SUS'   SUS'   SUS'   / n[         R                  " U SS9 H  u  pxn	US:w  a  UR                  XU	 5        M!  Un
X:  d  M*  U R                  SX5      nUS:  a)  UR                  [        R
                  " X
U	 5      5        Mk  UR                  [        R
                  " X
U 5      5        US-   U	:  a  [        R                  " [        S5      5      eXS-   US-    nUS-   n
 UR                  X\   5        X:  a  M  M     SR                  U5      $ ! [         a#    [        R                  " [        S5      U-  5      ef = f)a  Convert old-style filename format string to template string

>>> _buildfntemplate(b'foo-%b-%n.patch', seqno=0)
'foo-{reporoot|basename}-{seqno}.patch'
>>> _buildfntemplate(b'%R{tags % "{tag}"}%H')
'{rev}{tags % "{tag}"}{node}'

'\' in outermost strings has to be escaped because it is a directory
separator on Windows:

>>> _buildfntemplate(b'c:\\tmp\\%R\\%n.patch', seqno=0)
'c:\\\\tmp\\\\{rev}\\\\{seqno}.patch'
>>> _buildfntemplate(b'\\\\foo\\bar.patch')
'\\\\\\\\foo\\\\bar.patch'
>>> _buildfntemplate(b'\\{tags % "{tag}"}')
'\\\\{tags % "{tag}"}'

but inner strings follow the template rules (i.e. '\' is taken as an
escape character):

>>> _buildfntemplate(br'{"c:\tmp"}', seqno=0)
'{"c:\\tmp"}'
s   {node}s   {rev}s   {node|short}s$   {sub(r"[^\w]", "_", desc|firstline)}s7   {if(revwidth, pad(rev, revwidth, "0", left=True), rev)}   %s   {reporoot|basename})   H   R   hr<   r  rG  rM   s   {total}   Ns   {seqno}r7   s3   {pad(seqno, total|stringify|count, "0", left=True)}s   {pathname|basename}rQ   s-   {if(pathname|dirname, pathname|dirname, ".")}r@   s
   {pathname}rG   Tr(  r)  r      s)   incomplete format spec in output filenamer   s-   invalid format spec '%%%s' in output filenamer8   )r.   r*  r   findr2   r+  r   r  r   KeyErrorr  )pattotalseqnorevwidthpathnameexpandernewnamer.  r/  r0  inrQ  s                ra   _buildfntemplaterX    s   2 6H$H ##U.O/I&G$11#4@C)NN3S>*gq&A1uz33C#J?@NN://a9:1us{kkBC  EAE"AAAx{+ g A. 88G	  kkFG!K s   E-E5c                l    U(       d  U$ [        U40 UD6n[        X[        R                  " U5      5      $ r   )rX  r?  r%   r[  )r  rO  r5  r,  s       ra   makefilenamerZ  S  s3    
C)5)D #X%9%9%%@AAr8   c                (    U (       + =(       d    U S:H  $ )zATrue if the given pat looks like a filename denoting stdin/stdoutr\   r   )rO  s    ra   r  r  ]  s    7!cTk!r8   c                  <    \ rS rSrS
S jrS rS rS rS rS r	Sr
g	)_unclosablefileib  c                    Xl         g r   _fp)rg  rP  s     ra   ri  _unclosablefile.__init__c  s    r8   c                    g r   r   rg  s    ra   r  _unclosablefile.closef      r8   c                ,    [        U R                  5      $ r   )iterr`  rc  s    ra   __iter___unclosablefile.__iter__i  s    DHH~r8   c                .    [        U R                  U5      $ r   )r  r`  )rg  r   s     ra   __getattr___unclosablefile.__getattr__l  s    txx&&r8   c                    U $ r   r   rc  s    ra   	__enter___unclosablefile.__enter__o  s    r8   c                    g r   r   )rg  exc_type	exc_valueexc_tbs       ra   __exit___unclosablefile.__exit__r  re  r8   r_  N)rP  r   rd   None)r  r  r  r  ri  r  rh  rk  rn  rt  r  r   r8   ra   r]  r]  b  s     'r8   r]  c                *   US;  n[        U5      (       ah  U R                  5       nU(       a  UR                  R                  nOUR                  R                  n[
        R                  " [        [        U5      5      $ [        X40 UD6n[        Xr5      $ )N)r   rb)r  r6  r6   foutr  typingr   r   r]  rZ  open)r  rO  moder5  writabler6  rP  fns           ra   makefileobjr  v  sp     ;&HsxxzBB{{8_R%899	c	(%	(B>r8   c                   US   nUS   nUS   nSnU(       a  U(       a  [        S5      nOTU(       a  U(       a  [        S5      nO:U(       d  U(       d  U(       a%  U(       a  [        S5      nOU (       d  [        S5      nU(       a  [        R                  " U5      eSn	U (       Gac  U(       a  U R                  5       R                  n	OU(       a  [
        R                  " U 5      (       d  [        R                  " [        S	5      5      eUR                  S
5      (       d  US
-   nU R                  R                  U5      n
[        U
5      (       a  U
n	OMU(       a  U R                  R                  S5      n	O*U(       a#  U R                  U5      n[        U5      (       a  Un	U(       ac  [        U	[        R                  5      (       a  OC[        U	S5      (       a  U	R                  n	O%U	b"  [        R                  " [        S5      U	-  5      eU	(       d  U(       d  [        R                  " [        S5      5      eU(       d   [        R                   " U[        S5      5      e["        R$                  R'                  U5      (       d"  [        R                  " [        S5      U-  5      e[(        R*                  SU-  4n[        R                  " [,        R.                  " [0        R2                  " 5       SS9UUSS S9n	U	$ )z:opens the changelog, manifest, a filelog or a given revlogrV   rW   rX   Ns:   cannot specify --changelog and --manifest at the same times5   cannot specify --changelog and --dir at the same times6   cannot specify filename with --changelog or --manifestsF   cannot specify --changelog or --manifest or --dir without a repositorys9   --dir can only be used on repos with treemanifest enabledro  r8   _revlogs!   %r does not appear to be a revlogs   cannot give path to non-revlogs   invalid argumentss   revlog '%s' not founds   free-form:%sF)audit)targetradix)r   r   rg   
unfilteredr   r)   istreemanifestendswithmanifestlog
getstorager   filer   r'   hasattrr  CommandErrorr  r  isfilerevlog_constants
KIND_OTHERvfsmodr0   r   r  )r6  r   file_rh   returnrevlogclmfr   r   r   dirlogfilelogr  s                ra   openstorager    sS   	l	B	k	B
v,C
C	bMN	HI	rSMNC(C s##A!++A))$//&&0  <<%%Dj%%005F6{{  ++C0Aii&G7|| !V]]++I&&II&&:;a?  ""1%F#GHH$$S!,@*ABBww~~e$$""1%=#>#FGG"--/FGMMJJx(6*

 Hr8   c                    [        XX#SS9$ )aX  Obtain a revlog backing storage of an item.

This is similar to ``openstorage()`` except it always returns a revlog.

In most cases, a caller cares about the main storage object - not the
revlog backing it. Therefore, this function should only be used by code
that needs to examine low-level revlog implementation details. e.g. debug
commands.
T)r  )r  )r6  r   r  rh   s       ra   
openrevlogr    s     t%DAAr8   c           
     8  ^ ^^^^!^"^#^$^%^&^'^( [        TSS/5        TR                  5       m#0 m'TR                  S5      nTR                  S5      m!TR                  S5      m%TR                  S5      nU(       a  U(       d&  T!(       d  [        R                  " [        S5      5      e[        R                  " TU5      m"[        T"R                  5       5      S:  a  [        R                  " [        S5      5      eOTS    m"T"R                  5       m&[        R                  " TSS	9m(U(       Gan  T"R                  5       c  T"nO[        T"R                  5       5      S:  a  [        R                  " [        S
5      5      eSSKJn  [         R"                  " TT"R                  5       /S5        UR%                  T5      nUR'                  T"R                  5       5        [(        R*                  " TT"US9  [        R,                  " T"UT5      n	T"R/                  5       n
U
R1                  T"R3                  5       5        [        R                  " T5      m(T"R5                  U	5       HX  nX;   a  X{   R7                  S 5        M  U	R9                  U5      (       d  M5  T R;                  [        S5      T(" U5      -  5        MZ     T"R                  5       b  TR=                  5          UR?                  T"5      nURA                  5       nTRB                  R                  5       T"RE                  5       :X  a>  TRB                  RG                  T5         [        RH                  " TTU   5        S S S 5        T"RE                  5       U/0n[        RJ                  " TUSSS9  S S S 5        g g [        RL                  " U5      nU(       d  [        R                  " [        S5      5      e[        U5      S:X  a  [        R                  " [        S5      5      eURO                  5       nU!U"UU&U U(4S jnT"R                  5       Gbu  [         R"                  " TT"R                  5       /S5        [P        RR                  " TRT                  T#U5      nT"RW                  U5      (       a(  [        R                  " [        S5      T(" U5      -  5      eUT";  a*  [        R                  " [        S5      T(" U5      T"4-  5      eSSKJn  / nU H2  nU" U5      nU(       d  M  U H  u  nnnURY                  U5        M     M4     U(       d  [        R                  " [        S5      5      e[        U5      S:w  a  [        R                  " [        S5      5      eUR%                  T5      nUR'                  T"R                  5       5        [(        R*                  " TT"US9  UR7                  UUS   5        TR=                  5          UR?                  T"5      nURA                  5       nTRB                  R                  5       T"RE                  5       :X  a>  TRB                  RG                  T5         [        RH                  " TTU   5        S S S 5        T"RE                  5       U/0n[        RJ                  " TUSSS9  S S S 5        g U!U"U#U%UU&UUU'U 4
S jnU#U$U4S jnU#U$U4S jn[Z        R\                  R_                  U5      =(       a$    [Z        R\                  Ra                  U5      (       + m$T$(       d  [        U5      S:  d  [b        Rd                  " US   5      (       a  [        R                  " [        S5      5      e[f        Rh                  " U5      (       a"  [        R                  " [        S5      U-  5      eUnT!(       a  Un/ nU H/  nU" U5      nU(       d  M  URY                  U" UUU5      U45        M1     U(       d2  S nT(       a  [        S5      n[        R                  " [        S5      US9eSnU H0  u  nnU H$  u  nn nU" UU U" U5      U5      (       d  M  US-  nM&     M2     US:g  $ ! , (       d  f       GN = f! , (       d  f       g = f! , (       d  f       GN= f! , (       d  f       g = f) N   forget   dry_runs   afters   at_revs   --at-rev requires --afterr   s'   cannot mark/unmark copy in merge commitTlegacyrelativevalues"   cannot unmark copy in merge commitr  s   uncopy)r<  s9   %s: not unmarking as copy - file is not marked as copied
r  s"   no source or destination specifieds   no destination specifiedc                  > / nTR                  5       c  TOT
n[        R                  " X /T	SS9nUR                  U5       H  nT" U5      nUR	                  U5      nUT;  aZ  UT
;   a.  T(       d&  U(       a  TR                  [        S5      U-  5        MU  O&U(       a  TR                  [        S5      U-  5        M|  UR                  XEU45        M     U$ )NT)globbeds2   %s: not copying - file has been marked for remove
s&   %s: not copying - file is not managed
)r  r)   r   walkexactr   r   r   )rO  srcsctx_to_walkrV  absrelr  afterr  rh   pctxr6   uipathfns          ra   walkpatcopy.<locals>.walkpat1  s     !WWY.cDMM+udDA##A&C3-CGGCLE#~$;  GG !%4!" #&	!& ! ! HICO  KK5)*1 '2 r8   s8   %s: --at-rev does not support a directory as destinations)   %s: copy destination does not exist in %ss   no files to copys!   --at-rev requires a single sourcer   s   copyc           
       >
^ ^ [         R                  " TR                  TU5      mST;   a5  TR                  SS5      u  pETR                  R                  U5      S-   U-   mTR                  TT5      nTR                  T5      nTR                  T 5      nTR                  R                  T5      n	U	R                  =(       a    U	R                  (       + n
[        R                  " T!T5        T R                  T5      nUbA  T!R                  [        S5      UTR                  T T5      TR                  UT5      4-  5        g[         R"                  R%                  U5      nSnU(       ag  T T:w  aa  TR                  R                  T 5      TR                  R                  T5      :X  a)  T(       d  T!R                  [        S5      U-  5        gSnSnT(       d  U(       d  T(       a  U
(       a  TS   (       d  U
(       a  [        S5      nTT;   =(       a$    ['        U U4S	 jTR)                  5        5       5      nU(       a  T(       a  [        S
5      nOf[        S5      nOZT(       a  SnOSnT(       a  [        S5      U-  nO8[        S5      U-  nO)[        S5      nT(       a  [        S5      nO[        S5      nT!R                  X-  5        T!R                  U5        gT(       aM  U(       dE  T(       a  T!R                  [        S5      X4-  5        gT!R                  [        S5      X4-  5        gOT(       d   U(       a  [         R*                  " U5        [         R"                  R-                  U5      =(       d    Sn[         R"                  R/                  U5      (       d  [         R0                  " U5        U(       a4  US-   n[         R2                  " UU5        [         R2                  " UU5        O[4        R6                  " XTS9  SnT!RD                  (       d  U(       dD  T(       a  T!RG                  [        S5      X4-  5        OT!RG                  [        S5      X4-  5        T T T'   [        RH                  " T!TTT TTTS9  T(       af  T(       d^  T(       dD  W(       a=  U(       d6  TRJ                  RM                  SS5      nTRN                  RQ                  T US9  TRS                  T /5        g g g ! [8         a  nUR:                  [:        R<                  :X  a%  T!R                  [        S5      U-  5        Sn S nAGN6T!R                  [        S5      U[>        R@                  " URB                  5      4-  5         S nAgS nAff = f) Nro  r   s*   %s: not overwriting - %s collides with %s
TFs   %s: can't copy - same file
r   s-   %s: not overwriting - file already committed
c              3  F   >#    U  H  nTU;   =(       a    TU;  v   M     g 7fr   r   ).0gpctxabssrc	abstargets     ra   	<genexpr>)copy.<locals>.copyfile.<locals>.<genexpr>  s*      H%3E %BIU,BB%3s   !sP   ('hg rename --at-rev .' to record the rename in the parent of the working copy)
sL   ('hg copy --at-rev .' to record the copy in the parent of the working copy)
s   --after --forces   --forces;   ('hg rename %s' to replace the file by recording a rename)
s7   ('hg copy %s' to replace the file by recording a copy)
s"   %s: not overwriting - file exists
s+   ('hg rename --after' to record the rename)
s'   ('hg copy --after' to record the copy)
s+   %s: not recording move - %s does not exist
s+   %s: not recording copy - %s does not exist
r   s	   ~hgrenamer   s!   %s: deleted in working directory
s   %s: cannot copy - %s
s   moving %s to %s
s   copying %s to %s
)dryruncwdr      removeemptydirsr4  )*r#   	canonpathr  rsplitr.  	normalizer  r  r0  trackedr   r)   checkportablerf   r   r   r  r  lexistsanyr   r%  r  r  makedirsrenamer/   r  r5  errnoENOENTr   r  r  verboser5   dirstatecopyr6   ry   wvfs
unlinkpathforget)"r  relsrcotargetr  abspathabsname	reltargetr  srcentryalready_commitedprevsrcexistssamefiler   looks_like_copy_in_pctxr	  flags	targetdirtmp	srcexistsr  r4  r  r  r  r  r  rh   r  r  r6  targetsr6   s"   `                      @ra   r  copy.<locals>.copyfile  s   &&tyy#w?	9  )//a8G//84?'IIKK	3/	I&jj ''	2 ==<_b), ++i(GG@AKK,KK-  (f	)}}&&v.$--2I2I3  GGA=>JK5-=>#MNC /84.? /C H%)\\^H E+ /!#$!H$D
 $%!E$D
 !$6E$.E! !%=!" #(	!( ! !"%;!" #(	!( ! BCC K   !!LM(GGIJ!-. 	 GGIJ!-.    IIf%GGOOF3;t	ww}}Y//KK	* </CIIc3'IIc6* MM#? 	 ::U		!01V4GGH		!12f5HHI#	 	c69V	
 &Yx**?<NO		$$V5$9JJx 	 !6/  	 ::-GGACDvMN %IGG34!8#6#6t}}#EFG  	 s   8CS2 2
V<=V?=VVc                  >^^ [         R                  R                  U 5      (       a  [        R                  " TR
                  TU 5      n[        R                  " U5      nT(       a,  [        [         R                  R                  U5      S   5      mO[        U5      mT(       a  T[        [        R                  5      -  mUU4S jnU$ T(       a  U4S jnU$ U4S jnU$ )Nr   c                r   > [         R                  R                  T[        R                  " U 5      TS  5      $ r   r  r  r  r/   	localpathr  deststriplens    ra   r   ,copy.<locals>.targetpathfn.<locals>.<lambda>0  s$    BGGLLt~~a/@/KLr8   c                   > [         R                  R                  T[         R                  R                  [        R
                  " U 5      5      5      $ r   r  r  r  r  r/   r  r  r  s    ra   r   r  2  /    BGGLLbgg&&t~~a'89r8   c                   > T$ r   r   r  s    ra   r   r  6  s    Dr8   )r  r  r  r#   r  r  r/   r  r   r   r%   ossep)	rO  r  r  abspfxresr  r  destdirexistsr6  s	    `   @ra   targetpathfncopy.<locals>.targetpathfn&  s    77==''		3<F^^F+Frww}}V4Q78v;C//LC 
 C
 
 !C
r8   c                4  >^^^ [         R                  " U 5      (       a  U4S jnU$ [        R                  " TR                  T	U 5      n[        U5      [        TS   S   5      :  Ga  UU4S jn[        R                  " U5      n[        U5      mT(       a  T[        [        R                  5      -  m[        R                  R                  [        R                  R                  T[        R                  R                  U5      S   5      5      (       ad  U" T5      n[        [        R                  R                  U5      S   5      nU(       a  U[        [        R                  5      -  nU" U5      U:  a  UmUU4S jnU$ T
(       a  U4S jnU$ U4S jnU$ )Nc                   > [         R                  R                  T[         R                  R                  [        R
                  " U 5      5      5      $ r   r  r  s    ra   r   1copy.<locals>.targetpathafterfn.<locals>.<lambda>@  r  r8   r   c                   > SnT Hh  n[         R                  R                  T[        R                  " US   5      U S  5      n[         R                  R                  U5      (       d  Mc  US-  nMj     U$ )Nr   r   )r  r  r  r/   r  r  )r  scorerB  r6  r  r  s       ra   evalpath1copy.<locals>.targetpathafterfn.<locals>.evalpathH  s]    E!GGLLt~~ad/CHI/NO77??1--!QJE " !Lr8   r   c                r   > [         R                  R                  T[        R                  " U 5      TS  5      $ r   r  r  s    ra   r   r  [  s$    T4>>!3DXY3O Pr8   c                   > [         R                  R                  T[         R                  R                  [        R
                  " U 5      5      5      $ r   r  r  s    ra   r   r  _  s/    BGGLLbgg..t~~a/@A%r8   c                   > T$ r   r   r  s    ra   r   r  c  s    Dr8   )r   patkindr#   r  r  r   r/   r  r%   r  r  r  r  r  r   )rO  r  r  r  r  r  r  	striplen1r  r  r  r6  s    ``     @ra   targetpathafterfncopy.<locals>.targetpathafterfn=  s7   C  CH 
A ''		3<F6{Sa_,! /v;HNN 33H77==dBGGMM&4I!4L!MNN$X.E #BGGMM&$9!$< =I !S%88		*U2#,P 
 !C
 
 )C
r8   s@   with multiple sources, destination must be an existing directorys!   destination %s is not a directorys)   maybe you meant to use --after --at-rev=.r  )5rq   r  rf   r   rg   r   r   	revsingler   r   r  r)   getuipathfnr  r  r  r(   r  overlayworkingctxsetbaser(  graftr   p1copiesr   p2copiesr  
markcopiedr  r   r  tomemctx_for_amendr   r.  r  r2  movedirstater  
expandpatsr   r#   r  r  hasdirr   r  r  r  islinkr   r  r/   endswithsep))r6   r6  r;  rh   r  r  r  new_ctxr  r   current_copiesr   mem_ctxnew_noder  r  r  absdestcopylistrO  r  r  r  r  r  r  r  tfnr	  errors
targetpathr  r  r  r  r  r  r  r  r  r  s)   `` ``                            @@@@@@@@ra   r   r     s    y:,? ++-CGXXi FHHXEXXj!F
((9
C
e ""1%A#BCC""4-s{{}!""<=  "
 4j668D""4TBH779G3;;=!A%&&q)N'OPP!  	{I>//5GOOCFFH%NN473c4.clln-&&t,%A"
%%d+QU qk"	 ! 779 !44S9">>+==##%377=,,T4>B > #
XJ7$$,	D  	d#Dq!FGHH
4yA~q!<=>>88:D B wwyTCGGI;	:$$TYYT:::g""MN7#$  #"">?G$c*+  	C3<D#'S%$ $(	  ""1%8#9:: x=A""1%I#JKK++D1!tSw/7HQK0YY[005G~~'H}}!SXXZ/]]33D9((tH~> :HHJ
3L  |WtL  	
X! X!|.'R GGMM$'Dt0D,DMt9q=H,,T!W55""*  D!!""67$>  CHs|S$-t45	 
 ABDq!45DAAF$
D%)!FFE
6(:EBB! &* %
 Q;Q >=  	l :9 [ 	sJ   A)a(a2a(&A)ba9*2b
a%	 a((
a69
b	b
bc                   SSK Jn  UR                  S5      nUR                  S5      n	UR                  S5      =(       d    UR                  S5      n
UR                  S5      =(       d    UR                  S5      nUR                  S5      nUR                  S5      nUR                  S	5      nUR                  S
5      nUR                  S5      nUR                  S5      nUR                  S5      (       + nUS   nUS   n[        UR                  S5      =(       d    S5      nU(       d  gSn[	        X5      nU(       a  Un	OU	(       a  U	R                  5       n	OSn	U R                  SU	=(       d    S-  5        [        U5      S:X  a  UR                  U[           5        UR                  S5      (       aC  U(       a  U(       d  [        R                  " [        S5      5      eX   nX=(       d    [           nO]U(       aR   X   nX   nXS   :w  a  US   nU[           nUR                  5       [        :X  a  U R                  [        S5      5        OUu  pSnU(       Ga6  XS   :w  a  U" XR!                  5       5        XS   :w  a.  UR#                  UR!                  5       UR!                  5       5        UR                  S5      (       d  U(       a3  UR$                  R'                  U=(       d    SUR)                  5       5        UR                  SS5      n[+        5       n [,        R,                  " U UUUUUSUS-  S9  [9        U5      nU(       a  U	(       a  UR                  U	5        GOZUR                  S5      (       d  U(       a  SnO [:        R<                  " UU=(       d    / 5      n[?        US   S!5      nUR                  S5      (       a  SnO![A        S0S"U0[0        RB                  " U5      D6n0 n[D         H  n [F        U    " XUU5        M     0 n!U(       a  S U!S#'   UR                  S$5      (       a  S$U!S%'   URH                  RK                  U!S&5         URM                  XUUUUS'9n[N         H  n [P        U    " UU   5        M     SSS5        GO/UR                  S5      (       d  U(       a  U=(       d    SnOURS                  5       n[,        RT                  " 5       n" [+        5       n [,        RV                  " U UUU"UUUUSS(9	  UR                  S5      (       a  SnO	[A        S)S*9nUR]                  UUR!                  5       UR!                  5       4U	UU"U
UUUS+9	n#0 n!UR                  S$5      (       a  S$U!S%'   URH                  RK                  U!S&5         U#RM                  5       nSSS5        U"R_                  5         UR                  S5      (       a"  U(       a  U R                  [        S,5      5        OKUR                  S5      (       a5  U(       a  [a        U5      U:w  a  [        Rb                  " [        S-5      5      e[        S.5      n$U(       a  [        S/5      [e        U5      -  n$U$UU4$ ! [        R                   a    Uu  p GNrf = f! [        R.                   a7  n[        R                  " [0        R2                  " U5      [        S5      S9eSnAf[        R4                   aE  nU(       d*  [        R6                  " [0        R2                  " U5      5      eU(       a  S n SnAGNSnAff = f! , (       d  f       GN= f! [        R.                   a7  n[        R                  " [X        RZ                  " U5      [        S5      S9eSnAf[        R4                   a/  n[        R6                  " [X        RZ                  " U5      5      eSnAff = f! , (       d  f       GN5= f! U"R_                  5         f = f)1a  Utility function used by commands.import to import a single patch

This function is explicitly defined here to help the evolve extension to
wrap this part of the import logic.

The API is currently a bit ugly because it a simple code translation from
the import command. Feel free to make it better.

:patchdata: a dictionary containing parsed patch data (such as from
            ``patch.extract()``)
:parents: nodes that will be parent of the created commit
:opts: the full dict of option passed to the import command
:msgs: list to save commit message to.
       (used in case we need to save it when failing)
:updatefunc: a function that update a repo to a given node
             updatefunc(<repo>, <node>)
r   r  s   filenamer=   rC   rA      branchs   nodeids   p1s   p2s	   no_commits   import_branchs   bypasss   strips   prefixrR   r   )NNFFNs   message:
%s
r8   s   exacts   not a Mercurial patchs\   warning: import the patch as a normal revision
(use --exact to import the patch as a merge)
   defaults   partialg      Y@)stripr   r   r   
similaritys7   check that whitespace in the patch has not been mangledr  Ts   import.normalr  )r   s   allowemptycommit   secret)s   phasess
   new-commits   import)r   editorr  r   s   import.bypassr#  )r   r  ru   rs   r  r  s3   warning: can't check exact import with --no-commit
s%   patch is damaged or loses informations   applied to working directorys
   created %sr   )3r  r  rf   floatr  r  r  r   r   r   r   rg   r   	RepoErrorr  r   r  
setparentsr.  	setbranchcurrenttransactionr   r"   r  r%   r,  r  r  r  r)   r&  r  r&  r-  extrapreimportextrapreimportmapr6   r   r   extrapostimportextrapostimportmapr  	filestore	patchrepor2   forcebytestrr  r  r   r  r   )%r6   r6  	patchdatar   rh   msgs
updatefuncr  rO  r7  ru   rs   r  nodeidr  r  nocommitimportbranchr   r  r   simrejectscmdline_messagerW  r^  r   r   rV  r  r  r  idfuncr=  storer  r   s%                                        ra   tryimportoner1    s   & mmK(GmmJ'G88G6	g 6D88G6	g 6D]]9%F]]9%F	u	B	u	Bxx%H88,-L)$$FNE)_F
',1
-C G *O!	--/ HH'.S12
7|qtG}%xxR""1%=#>??X- 	
	BB QZQZ'] 668wGGF AtWWY'OOBGGIrwwy188HMM##$*d&=&=&? ((:u-	KK;	. UG$xx!!R &&tU[b9$T$Z1ABHxx!!( %)1););D)A E(!&)$5$G )I:>	67xx	""8A	45''	9=KK4qu    .F&v.tAw7 .	 >= 88H)zFYY[F!-	EEC 
( xx!!(2BC^^BGGI& $ 
F Ixx	""8A	45''	9=MMO > KKMxxh 	IJK	(		Q#a&F*:kk!DEFF
+
,Cq)7?c  	FB	J $$ 	""  #N  ** 	&&x'7'7':;;		B >=4 (( &&++A.R  .. C&&z'>'>q'ABBC* >= KKMs   Y7 "Z 3\;&
_. 1] B_. _._. 7ZZ\8*2[\83:\33\8;
]
_!2^_**___. 
_+&_. .` c                   [         R                  " U5      nUR                  5        Vs/ s H  o(       d  M  UR                  5       PM     n	nUR	                  5       n
U(       a  U	R                  5         U	(       a  U	S   nOU R                  nUR                  US9  UR                  S5        UR                  SSUR                  5       5        UR                  SUR                  5       -  5        UR                  SSUR                  UR                  5       5      5        UR                  U
=(       a    U
S	:g  S
SU
5        UR                  SS[        U5      5        UR                  S[        U5      -  5        [        U	5      S:  a   UR                  S[        U	S   5      -  5        UR!                  UR#                  [$        R&                  " [        U	5      SS9S9  [(         H+  n[*        U   " XQ5      nUc  M  UR                  SU-  5        M-     UR                  SSUR-                  5       R/                  5       5        UR                  S5        UR1                  5       (       a3  [2        R4                  " XXsUS9nU H  u  nnUR                  UUS9  M     g [2        R6                  " XXsUS9nUR!                  SR9                  U5      S9  g s  snf )Nr   r  s   # HG changeset patch
rC   s
   # User %s
s   # Date %d %d
rA   s
   #      %s
r  r  s   # Branch %s
   nodes   # Node ID %s
s   # Parent  %s
r   r_   )r   s   # %s
s   descr   r   rh   r   r8   )r  )r)   binnoder   r  r  reverser
  r  r  r   ru   rs   
formatdate	condwriter   r   r  
formatlistr%   maplistextraexportextraexportmapr  rstripisplainr"   diffuir  r  )r6  r  r  r   switch_parentrQ  rC  r  r  r   r  prevheaderidr   	chunkiterr   r   s                    ra   _exportsinglerE    s/   ??3D!$4A!xqvvxG4ZZ\Fqz{{JJ3JHH&'HHWnchhj1HH+,HHWnbmmCHHJ&?@LL'6Z'4Df HHW'T3HHT*+
7|a
"S_45GGBMM("2"23"@wMOGP  )%5HHY'(  
 HHWgs0779:HHUO	zz||LLTxH	%LE5HHU%H( & JJt4XF	
SXXi()Q 5s
   
KKc           
         [        US5       H[  u  pxX   n	UR                  S5      (       d  U R                  R                  SU-  5        UR	                  5         [        X	X&XGU5        M]     g)z,Export changesets to stdout or a single filer      <r   N)	enumerater  r6   r~   r  rE  )
r6  r  r  r  rA  rC  r   rQ  r  r  s
             ra   _exportfilerI    sV    a(
it$$GGLL4(
dM(K )r8   c                   [        U5      n[        S U 5       5      n[        R                  " 5       n	[	        US5       H6  u  pX   n[        XXzUS9nU	R                  U/ 5      R                  X45        M8     U	 Ho  n[        R                  " X-5       nU R                  R                  SU-  5        X    H'  u  pUR                  5         X   n[        XXXJU5        M)     SSS5        Mq     g! , (       d  f       M  = f)z,Export changesets to possibly multiple filesc              3  J   #    U  H  n[        [        U5      5      v   M     g 7fr   )r   str)r  r  s     ra   r  $_exportfntemplate.<locals>.<genexpr>  s     1DS3s3x==Ds   !#r   )rP  rQ  rR  r   N)r   maxr/   sortdictrH  rZ  
setdefaultr   r   maybereopenr6   r~   r  rE  )r6  r  basefm
fntemplaterA  rC  r   rP  rR  filemaprQ  r  r  r  r  s                  ra   _exportfntemplaterU    s     IE1D11HmmoGa(
i5
 	4$++UL9 ) ""60BGGLL4(%m
ir- , 10 00s   AC//
C>	c                2   [        5       nU HC  nX   R                  5        H*  nU(       a  U" U5      (       d  M  UR                  U5        M,     ME     [        R                  " X5      nU Vs/ s H  oDU4PM     nn[        R
                  " X5        g s  snf r   )r   r   r   r)   r&  prefetchfiles)r6  r  r   allfilesr  r  
revmatchess          ra   _prefetchchangedfilesrZ    sx    uHIOO%DE$KKT" &  t.E*./$3,$J/$+ 0s   .Bc           	     f    [        XU5        U(       d  [        XUSXEU5        g[        XX#XEU5        g)aR  export changesets as hg patches

Args:
  repo: The repository from which we're exporting revisions.
  revs: A list of revisions to export as revision numbers.
  basefm: A formatter to which patches should be written.
  fntemplate: An optional string to use for generating patch file names.
  switch_parent: If True, show diffs against second parent when not nullid.
                 Default is false, which always shows diff against p1.
  opts: diff options to use for generating the patch.
  match: If specified, only export changes to files matching this matcher.

Returns:
  Nothing.

Side Effect:
  "HG Changeset Patch" data is emitted to one of the following
  destinations:
    fntemplate specified: Each rev is written to a unique file named using
                        the given template.
    Otherwise: All revs will be written to basefm.
	   <unnamed>N)rZ  rI  rU  )r6  r  rR  rS  rA  rh   r   s          ra   exportr]    s7    > $e,m5	
 	M	
r8   c           
         [        XU5        [        USS5      n[        R                  " U R                  US0 5       n[	        XXvX4U5        SSS5        g! , (       d  f       g= f)z*Export changesets to the given file streamr`   r\  s   exportN)rZ  r  r   r6   rI  )r6  r  rP  rA  rh   r   r  r  s           ra   
exportfiler_  	  sN    $e,2v|,D			TWWb)R	8BD-uE 
9	8	8s   A
A#c                <   Ub  U R                  SSU5        U R                  SS[        UR                  5       5      5        UR                  5       nU R	                  USSU R                  [        [        U5      SS95        U R                  S	S
UR                  5       5        UR                  5       nUb0  U R                  SSU R                  [        [        U5      SSS95        U R                  SSU R                  UR                  5       5      5        UR                  5       R                  5       nUR                  SS5        [        R                  " [        R                   U5      nU R                  SSU R#                  USSS95        U R%                  S5        g)z`utility function to display obsolescence marker in a readable way

To be used by debug function.Ns   indexs   %i s   prednodes   %s s	   succnodesr4  r_   s   flags   %X s   parentnodess   {%s}    , )r`   seprA   s   (%s) s   metadatas   {%s}s   %r: %r)fmtrb  r   )r   r   prednode	succnodesr9  r:  mapr  parentnodesr8  rs   metadatar   r   r%   rapplymaybebytestr
formatdictr  )r  markerindexsuccsr   metasmetas          ra   
showmarkerrq  	  sO    
65)HH[&#foo&7"89ELL
c#uoG4	 HHWfflln-  "G
MM#c7+'uME	

 HHWhfkkm <=??!!#DHHWdOOH1148EHHWbmmEyemL HHUOr8   c                2   UR                  SU5      n UR                  5       nU R                  [        S5      U[        R                  " X   R                  5       5      4-  5        SU-  $ ! [         a     [        R                  " [        S5      5      ef = f)z;Find the tipmost changeset that matches the given date specs   date(%s)s    revision matching date not founds   found revision %d from %s
s   %d)
r  rN  
ValueErrorr   rg   r   r5   r1   datestrrs   )r6   r6  rs   mrevsr  s        ra   finddaterv  6	  s    IIk4(EGiik II	
()  !12
3	4 3;  Gq!DEFFGs   A, ,*Bc           
       ^^ / mUU4S jn/ nUS    n	S n
[         R                  " U 5      u  pU(       d  U(       a!  [         R                  " XUR                  5      n
UR	                  TSS9m[
        R                  " TU5      nUR                  n[        UR                  U[        U	R                  5      SSSS95       H  nUR                  U5      nU=(       a    UR                  nTR                  U5      nU(       d;  U(       a  MJ  X;  d  MQ  UR                  R                  U5      (       d  Ms  U(       a  M|  U
(       a  U
" U5        UR                  U5        U R                   (       d	  U(       a  M  U R#                  [%        S5      U" U5      -  SS9  M     [        U	R                  5       H  nU	R'                  U5      n [
        R(                  " UT5      nUR                  R+                  UU5      n[         R,                  " UU5      nUR/                  S	5      (       a(  TR1                  UR2                  " U UUUS40 UD65        M  TR1                  UR2                  " U UUUS40 UD65        M     UR/                  S5      (       d,  U	R3                  X5      nTR1                  U4S jU 5       5        T$ ! [4        R6                   a(    U R#                  [%        S
5      U" U5      -  5         GMF  f = f)Nc                V   > TR                  U 5      =(       d    TR                  X5      $ r   r   badrk   yrz  r   s     ra   r   add.<locals>.<lambda>H	      A9%))A/9r8   T)includeexactF)subreposr  r  full
   adding %s
s   ui.addremove.addedr   r  #   skipping missing subrepository: %s
dry_runc              3  R   >#    U  H  oTR                  5       ;   d  M  Uv   M     g 7fr   r   r  r   r   s     ra   r  add.<locals>.<genexpr>	       =hu{{}*<11h   '	')r)   checkportabilityalertcasecollisionauditorr.  narrowmatchr   r   r  r  r  r0  r   r  r  r  r   r  r5   r   r  subdirmatcherreljoinsubdiruipathfnrf   r   r   r   LookupError)r6   r6  r   r   r  explicitonlyrh   badfnnamesr<  ccaabortr   r   r.  r   r  r   r  subpathr  submatch	subprefixsubuipathfnrejectedrz  s     `                      @ra   r   r   E	  s   
C9EE:D
C//3KE**2dmmDU6E  .H}}H DMM* 	 	
 ""1% )EMMA<		!!!$$GALLOzz		n%3;P  5< $--(hhw	--gu=H		))&':I!00(CKxx
##

GGB)[%P4P 

GGB)[$O$O )& 88I88E*

=h==J    	II9:Xg=NN 	s   BJ:&J::7K65K6c                   U R                   X!'   U R                  R                  SXR                   4-  5        U R                  S5       H:  nX   nUR                   H#  nUR                  U5      R                  X5        M%     M<     g )Ns   adding %s = %s
s   filelog("path:.hgsub"))r  r6   r  r  r  r  addwebdirpath)r6  
serverpathwebconfr   r  r  s         ra   r  r  	  sk    ))GGGMM%YY(??@YY01g||GGGG**:? $ 2r8   c           	     	  ^^^ U(       a&  U(       a  [         R                  " [        S5      5      e/ mUU4S jnUS    n	/ n
UR                  [        R
                  " TU5      SS9n[        UR                  UR                  -   UR                  -   UR                  -   5      nU(       a*  U Vs/ s H  nTR                  U5      (       d  M  UPM     nn[        U	R                  5       H  nU	R                  U5      n[        R                  " UT5      nUR                  R!                  X>5      n["        R$                  " X5      n UR'                  UUUUUS9u  nnTR)                  U Vs/ s H
  oS-   U-   PM     sn5        U
R)                  U Vs/ s H
  oS-   U-   PM     sn5        M     U(       d  TR-                  5        H  nXR.                  ;  d  M  UR                  R1                  U5      (       a  M6  X;  d  M=  UR                  R3                  U5      (       aN  UR.                  R5                  U5      UR.                  ;   a  M  U R7                  [        S5      U" U5      -  5        TR9                  U5        M     U(       Ga  [        S	5      nUS S   H  nU R;                  [        S
5      U" U5      U4-  5      nUS:X  a{  US:X  au  U R=                  U5      S    H0  u  nnU R?                  SU[@        RB                  " U5      4-  5        M2     U R;                  [        S
5      U" U5      U4-  5      nUS:X  a  Mu  US:X  a  M  US:X  a  URE                  U5        M  US:X  a  URG                  U5      nUUS 2	   OUS:X  d  M    O   U HU  nU RH                  (       d  TR                  U5      (       a	  U(       d  M3  U R                  [        S5      U" U5      -  SS9  MW     U(       dG  U	R'                  X5      mTR)                  U4S jT 5       5        U
R)                  U4S jU 5       5        TU
4$ s  snf s  snf s  snf ! [         R*                   a(    U R                  [        S5      U" U5      -  5         GM  f = f)Ns/   cannot specify both --dry-run and --interactivec                V   > TR                  U 5      =(       d    TR                  X5      $ r   ry  r{  s     ra   r   forget.<locals>.<lambda>	  r~  r8   Tr   r  )r  r\  ro  r  s+   not removing %s: file is already untracked
s   [Ynsa?]$$ &Yes, forget this file$$ &No, skip this file$$ &Skip remaining files$$ Include &all remaining files$$ &? (display help)s   forget %s %s   r   s   %s - %s
r   rL        removing %s
   ui.addremove.removedr   c              3  R   >#    U  H  oTR                  5       ;   d  M  Uv   M     g 7fr   r  r  s     ra   r  forget.<locals>.<genexpr>	  r  r  c              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7fr   r   )r  r   r  s     ra   r  r  	  s     =AH+<aas   		)%r   rg   r   r5   r   r   r  r   r   r   r  r  r  r  r  r  r  r)   r  r  r   r  r   r.  r  r  r  r   r   promptchoiceextractchoicesr   r   lowerremoverm  r  )r6   r6  r   r   r  r  r  r\  r  r<  forgotrB  r  r   r  r  r  r  r  subbad	subforgot	responsesr   r   rQ  r6  fnindexrz  r  s     `                        @@ra   r  r  	  s    +@A
 	
 C9E:DF(++E59FAAJJ(1994qww>?F#6Vu{{1~!V6$--(hhw))'59II%%f6	,,W?	 #

' !+ !FI JJF;Fq$*F;<MMyAy!T>A-yAB )( A%diiooa.@.@?yy''**
  ==2215F$!? 'qk	* JJqM# & $
	 q	H/"hx&8)%DDA Av1f " 1 1) <Q ?1HNN14E0F!FG !@/*hx.@)-LLA 1f Avah'a ,,x078$a) ", ::U[[^^{{II"#hqk19P    ;;v.

=h=====;g 7 <A   	II9:Xg=NN 	s<   -P=P=%Q*Q
;QQ
"Q
Q7RRc           	        SnU R                   =(       d    SS1UR                  5       -  nUR                  5       (       a  U(       d  / n	UR                  U5       HR  n
U	R	                  XS" U
5      -  5        [        U	5      S:  a%  U R                  SR                  U	5      5        U	S S 2	 SnMT     U	(       a   U R                  SR                  U	5      5        OUR                  U5       H  n
UR                  5         UR                  US9  U(       a4  X   nUR                  SS	UR                  5       UR                  5       5        UR                  U
S
9  UR                  XS" U
5      -  5        SnM     [        UR                  5       H  n[         R"                  " X5      n[$        R&                  " X5      nU(       d6  UR)                  U5      (       d   [+        UR-                  5       5      (       d  Ml  UR/                  U5      n UR)                  U5      =(       d    UnUR1                  XXUU5      S:X  a  SnM  M     U$ ! [2        R4                   a'    U R7                  [9        S5      U" U5      -  5         M  f = f)Nr   s   sizes   flagsd   r8   r   r3  s
   size flagss   % 10d % 1s r  r  )r  datahintr?  matchesr   r   r   r  r  r  sizer  r  r  r  r  r   r  r)   r  r  r  r   r  
printfilesr   r  r5   r   )r6   r  rV  r  r  rc  r  ret	needsfctxbufr   fcr  r  r  r  recurses                    ra   r   r   	  s    
C

Aw1BKKMAI	zz||I QAJJsXa[()3x#~#'FC   HHSXXc]#QALLNJJ3JV	288:NGGGOHHS8A;&'C   #,,'))'5,,W?qwww''3x~~/?+@+@'''"C'''*6hNN2#wO C ($ J $$ 		=>w'(s   4I7I>=I>c
                  ^ ^! Sn
UR                  USS9nUR                  UR                  UR                  UR                  4u  ppUS    m!U	c  / n	SnOSn[        T!R                  5      nU R                  [        S5      [        U5      [        S5      S9nU H  n[        R                  " UU5      nUR                  R                  UU5      n[        R                  " UU5      nU(       d6  UR!                  U5      (       d   [#        UR%                  5       5      (       d  M  UR'                  5         T!R)                  U5      n UR+                  UUUUUUUU	5      (       a  Sn
M  M     UR3                  5         [4        R6                  " U5      nUR%                  5       nU R                  [        S
5      [        U5      [        S5      S9nU H  m U U!4S jnUR'                  5         T U;   =(       d    T!R9                  T 5      nT UR:                  ;   d  U(       d  T S:X  d  U" 5       (       d  T U;   a  Mh  UR                  R=                  T 5      (       ag  UR                  R?                  T 5      (       a$  U	R1                  [        S5      U" T 5      -  5        O#U	R1                  [        S5      U" T 5      -  5        Sn
M     UR3                  5         U(       a  X-   U-   U-   nGOjU(       a  UnX-   U-   nU R                  [        S5      [        U5      [        S5      S9nU HO  m UR'                  5         U R@                  (       d  T U;   a#  U	R1                  [        S5      U" T 5      -  5        Sn
MQ     UR3                  5         OX-   nU R                  [        S5      [        U5      [        U5      -   [        S5      S9nU H8  m UR'                  5         U	R1                  [        S5      U" T 5      -  5        Sn
M:     U H8  m UR'                  5         U	R1                  [        S5      U" T 5      -  5        Sn
M:     UR3                  5         [        U5      nU R                  [        S
5      [        U5      [        S5      S9nU H^  m U R@                  (       d  UR!                  T 5      (       a  M,  UR'                  5         U R                  [        S5      U" T 5      -  SS9  M`     UR3                  5         U(       d|  URC                  5          U(       dH  U HB  m T U;   a  M  URD                  RG                  SS5      nUR                  RI                  T SUS9  MD     US    RK                  U5        S S S 5        U(       a  U	 H  nU RM                  U5        M     U
$ ! [,        R.                   a(    U	R1                  [        S	5      U" U5      -  5         GMC  f = f! , (       d  f       Np= f)Nr   Tr  Fs	   searchingrT   )rP  unitr   r  s   deletings   filesc                 b   > TR                    H  n TR                  U S-   5      (       d  M    g   g)Nro  TF)r  r  )r  r   r<  s    ra   	insubreporemove.<locals>.insubrepo`
  s,    ==<<$// ) r8   r   s"   not removing %s: no tracked files
s#   not removing %s: file is untracked
s   skippings#   not removing %s: file still exists
s<   not removing %s: file is modified (use -f to force removal)
sL   not removing %s: file has been marked for add (use 'hg forget' to undo add)
r  r  r   r   r  )ignoremissingr4  )'r5   r   r   r   r  r  r  makeprogressr   r   r   r  r  r  r)   r  r  r  r   	incrementr  removefilesr   r  r   completer#   dirsr  r.  r  r  r  r  r6   ry   r  r  r   )"r6   r6  rV  r   r  r  r   r  r  warningsr  rB  r   r   r   r  r   r?  progressr  r  r  r  r  deleteddirsr   r  r  r  	remainingr4  warningr   r<  s"                                   @@ra   r  r  +
  sQ    C!4(A&'jj!''199agg&M#HW:D$-- D	,s4yq~  H ))'15II%%fg6	,,Wh?qwww''3x~~/?+@+@ ((7#C??	 	 C	 0  --(KGGIE	+c%jq{  H 	 	[ 2DKKN!t)y{{a4i99Ayyq!!<=K =>!L / 0 !E)E1	$u,	??kN#i.q{ # 
 A zza5j=>!L C  	??kN3x=3u:#=Qx[ # 
 A OO, 1+	 C  A OO8 1+	 C  	$<D	+c$iak  H ::QWWQZZ II"#hqk19P    ZZ\AEz  GG..');E II(($e(L  Jd#  GGGG   J] $$ =>w'( ~ \s   V A$W 7WW
W-c                `    U R                  5       (       + =(       d    SU R                  5       ;   $ )N   data)r  )r  s    ra   _catfmtneedsdatar  
  s!    {{}82;;= 88r8   c                   Sn[        U 5      (       a8  X   R                  5       nU(       a  UR                  5       R                  X55      nU R	                  5         U R                  US9  U R                  SSU5        U R                  US9  g)zHook for adding data to the formatter used by ``hg cat``.

Extensions (e.g., lfs) can wrap this to inject keywords/data, but must call
this method first.r8   r3  r  s   %sr  N)r  r  r6  
wwritedatar  r  r   )r  r  r   r  decoder  s         ra   _updatecatformatterr  
  sp     Dy~~88:((4DLLNJJ3JHHWeT"GGGr8   c                :  ^^^^^^ SnUUUUUU4S jn	[        TR                  5       5      S:X  a  TR                  5       (       d  TR                  5       S   n
UR                  nTR	                  5       n U(       a\  X   R                  U
5      S   (       aA  [        T5      (       a(  [        R                  " UTR                  5       T4/5        U	" U
5        g[        T5      (       a(  [        R                  " UTR                  5       T4/5        TR                  T5       H  nU	" U5        SnM     [        R                  " USS9n[        TR                  5       Hk  nTR                  U5      n [         R"                  " UT5      n[$        R&                  R)                  TU5      nUR*                  " UTTU40 TD6(       d  SnMk  Mm     U$ ! [         a     GNf = f! [,        R.                   a'    U R1                  [3        S5      U" U5      -  5         M  f = f)Nr   c           
       > S nT(       a]  [        TT[        R                  R                  TU 5      S9n [        R                  " [        R                  R                  U5      5        [        R                  " TU5       n[        UTTU TR                  S5      5        S S S 5        g ! [         a     NKf = f! , (       d  f       g = f)N)rS  r  )rZ  r  r  r  r  r  r5  r   rQ  r  rf   )	r  r   r  rR  r  rS  r   rh   r   s	      ra   r   cat.<locals>.write
  s    #Z"'',,vt*DHBGGOOH56 ""684C$8JK 54  44s   3B' ?B7'
B43B47
Cr   Tr  r  )r   r   anypatsr  manifestnoderM  r  r)   rW  r  rN  r  r  r  r  r  r   r  r  r  r  catr   RepoLookupErrorr5   r   )r6   r6  r  r   rR  rS  r   rh   rF  r   r  mflmfnoder  r  r  r  r  r  s     ``````           ra   r  r  
  s   
CL L  7==?q ):):}}q!!!#	#+**403#F++))$#'')W1E0FGd dcggi%9$:;xx c
 ! ""4TBH#,,'ggg	--gw?HVW5I77	
   ($ J;  		0 $$ 	II9:Xg=NN	s&   6A"G 2AG
GG7HHc                  6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
_AddRemoveContexti  a	  a small (hacky) context to deal with lazy opening of context

This is to be used in the `commit` function right below. This deals with
lazily open a `changing_files` context inside a `transaction` that span the
full commit operation.

We need :
- a `changing_files` context to wrap the dirstate change within the
  "addremove" operation,
- a transaction to make sure these change are not written right after the
  addremove, but when the commit operation succeed.

However it get complicated because:
- opening a transaction "this early" shuffle hooks order, especially the
  `precommit` one happening after the `pretxtopen` one which I am not too
  enthusiastic about.
- the `mq` extensions + the `record` extension stacks many layers of call
  to implement `qrefresh --interactive` and this result with `mq` calling a
  `strip` in the middle of this function. Which prevent the existence of
  transaction wrapping all of its function code. (however, `qrefresh` never
  call the `addremove` bits.
- the largefile extensions (and maybe other extensions?) wraps `addremove`
  so slicing `addremove` in smaller bits is a complex endeavour.

So I eventually took a this shortcut that open the transaction if we
actually needs it, not disturbing much of the rest of the code.

It will result in some hooks order change for `hg commit --addremove`,
however it seems a corner case enough to ignore that for now (hopefully).

Notes that None of the above problems seems insurmountable, however I have
been fighting with this specific piece of code for a couple of day already
and I need a solution to keep moving forward on the bigger work around
`changing_files` context that is being introduced at the same time as this
hack.

Each problem seems to have a solution:
- the hook order issue could be solved by refactoring the many-layer stack
  that currently composes a commit and calling them earlier,
- the mq issue could be solved by refactoring `mq` so that the final strip
  is done after transaction closure. Be warned that the mq code is quite
  antic however.
- large-file could be reworked in parallel of the `addremove` to be
  friendlier to this.

However each of these tasks are too much a diversion right now. In addition
they will be much easier to undertake when the `changing_files` dust has
settled.c                :    Xl         S U l        S U l        S U l        g r   )_repo_transaction_dirstate_context_state)rg  r6  s     ra   ri  _AddRemoveContext.__init__H  s    
 !%r8   c                2    U R                   b   eSU l         U $ )NT)r  rc  s    ra   rn  _AddRemoveContext.__enter__N  s    {{"""r8   c                h   U R                   c   eU R                  c:  U R                  R                  S5      U l        U R                  R	                  5         U R
                  cO  U R                  R                  R                  U R                  5      U l        U R
                  R	                  5         gg)a+  open a `transaction` and `changing_files` context

Call this when you know that change to the dirstate will be needed and
we need to open the transaction early

This will also open the dirstate `changing_files` context, so you should
call `close_dirstate_context` when the distate changes are done.
N   commit)r  r  r  r  rn  r  r.  changing_filesrc  s    ra   open_transaction"_AddRemoveContext.open_transactionS  s     {{&&&$ $

 6 6y AD'')!!)%)ZZ%8%8%G%G

&D" "",,.	 *r8   c                h    U R                   b%  U R                   R                  SSS5        SU l         gg)zclose the change_files if any

Call this after the (potential) `open_transaction` call to close the
(potential) changing_files context.
N)r  rt  rc  s    ra   close_dirstate_context(_AddRemoveContext.close_dirstate_contextf  s5     !!-""++D$=%)D" .r8   c                    U R                   b  U R                   R                  " U6   U R                  b  U R                  R                  " U6   g g r   )r  rt  r  )rg  ri   s     ra   rt  _AddRemoveContext.__exit__p  sG    !!-""++T2(&&- )r8   )r  r  r  r  N)r  r  r  r  r  ri  rn  r  r  rt  r  r   r8   ra   r  r    s!    /b
/&*.r8   r  c                   UR                  S5      nU(       a  [        R                  " U5      US'   UR                  5          UR	                  5          [        X5      n[        R                  " US   X45      n[        U5       nUR                  S5      (       au  [        R                  " X45      n	[        R                  " UU	S9n
[        R                  " UUSU
UUR                  S9n[        S5      nUS:w  a  [        R                  " U5      eUR!                  5         U" XXgU5      sSSS5        sSSS5        sSSS5        $ ! , (       d  f       O= f SSS5        O! , (       d  f       O= fSSS5        g! , (       d  f       g= f)	z5commit the specified files or all outstanding changesrA   N	   addremover  r8   )open_tr5   failed to mark all new/missing files as added/removedr   )rf   r1   	parsedater  r  r  r)   r   r  r  r  	addremover  r   r   r  r  )r6   r6  r8  r;  rh   rs   r7  r   rQ  relativer  r   rV  s                ra   r   r   w  s)   88GD **40W	tyy{R&--T
D7t$ xx%%"??46"..(0 %%.. NO6++a.($$&b$?+ %$	 #{ %$$	 #{{sC   E:1E B%E)	E 2	E:
EE 	E: 
E.	*E::
Fc                4   XR                  5       ;   at  UR                  U 5      nXR                  5       ;   aO  UR                  U 5      nUR                  U5      (       + =(       a!    UR                  5       UR                  5       :H  $ gXR                  5       ;  $ NF)manifestfilectxcmpr  )r   ctx1ctx2r  bs        ra   r  r    sl    MMOLLOQAuuQx<:AGGI$::''r8   c                ~  ^^'^(^)^* SSK Jm'  [        R                  " U[        R                  5      (       a  U R                  5         U R                  [        S5      T-  5        TR                  5       nUR                  5          UR                  5          UR                  S5         US    m*UR                  5       nUR                  TR                  5       5        UR                  T*R                  5       5        [        X5      n[         R"                  " U5      nTR%                  5       nUR'                  S5      (       a%  [(        R*                  " UR'                  S5      5      nUR'                  S5      =(       d    TR-                  5       n	[/        TR1                  5       5      S:  aS  UR3                  T5      n
[5        U
R6                  5      [5        U
R8                  5      -  [5        U
R:                  5      -  nO[5        TR=                  5       5      n[>        R@                  " T*XE5      n[>        RB                  " XE5      n[>        RD                  " XS9nUR'                  S5      (       ab  URF                  RI                  U5         [>        RJ                  " XS	X5      S
:w  a!  [        S5      n[L        RN                  " U5      e S S S 5        ST*;   d  ST;   aN  [P        RR                  " U T*T*RT                  U5      u  nnnU(       a   eU(       a  [P        RV                  " UU5        [X        RZ                  R]                  U5      n[^        R`                  " U5        T*R=                  5        Vs1 s H  nU" U5      (       d  M  UiM     snm)[/        T)5      S
:  nURb                  Re                  SS5      S:g  nU(       d  U(       a  [f        Rh                  " UT*5      m(TRk                  5       (       a4  T(R                  [f        Rh                  " TRk                  5       T*5      5        UR                  T)5        U Vs/ s H  nUT);  d  [m        UT*U5      (       a  M  UPM!     nnU'U(U)UU*4S jnO%U R                  [        S5      TU4-  5        U4S jn[o        X5      n[q        TS5      nU(       d3  TRs                  5       nU(       + =(       d    UR'                  S5      S;   nOUR'                  S5      SL n[u        UUS9nUR                  5       nTRw                  5       US'   T'Ry                  UUR{                  5       TRk                  5       R{                  5       /UUUU	UUUS9	n[|        R~                  " URs                  5       5      nU(       d  UTRs                  5       :X  an  U	TR-                  5       :X  aZ  UTR%                  5       :X  d  U(       a?  UTR                  5       :X  a+  TR{                  5       sS S S 5        sS S S 5        sS S S 5        $ S nUR'                  S5      (       a  [        R                  nO&UR'                  S5      (       a  [        R                  nUR                  U5      n UR                  5         URF                  R                  U5         UR                  U UR                  5        URF                  n![5        T*R7                  5       T*R9                  5       -   5      T)-  n"U" H  nU!R                  USSSS9  M     [5        T*R;                  5       5      T)-  n#U# H  nU!R                  USSS9  M     S S S 5        TR{                  5       U 40n$S n%UR'                  S5      (       a  S[        R                  " US   5      0n%U R                  S S!5      n&[>        R                  " UU$SU%SUU&S"9  S S S 5        S S S 5        S S S 5        W $ ! , (       d  f       GN= fs  snf s  snf ! , (       d  f       N= f! , (       d  f       NM= f! , (       d  f       NV= f! , (       d  f       W $ = f)#Nr   r  s   amending changeset %s
s   amendrA   rC   r  r  r8   r   r  s   .hgsubr   s   copies.read-froms   filelog-onlyc                :  >  UT;   a  UT
R                  5       ;   a  g T
U   nOT	R                  U5      nUR                  5       nTR                  U UUR	                  5       UR                  5       SU;   SU;   TR                  U5      S9nU$ ! [         a     g f = f)Nr>      x)r  isexec
copysource)r   r  r  
memfilectxr  r  rf   rN  )r6  ctx_r  fctxr  mctxr  copiedfilestoamendoldr<  s         ra   r  amend.<locals>.filectxfn  s      |+4<<>1#'#Dz"{{40 JJLE"--				#u}#u}#)::d#3 . D  K   s   B A.B 
BBs   copying changeset %s to %s
c                H   >  TR                  U5      $ ! [         a     g f = fr   )r  rN  )r6  r	  r  r  s      ra   r  r  /  s)     ;;t,,   s    
!!s   commit.amends   editTNT)r#  r  s   amend_source)r   rD  r   r  ru   rs   r  r  r  s   draftr   F)r   r   s   noterw   s   backup-bundle)rh  r  targetphasebackup)Mr  r  r!   	isenabledcreatemarkersoptrz   r~   r   r  r  r  r  r   r   r  r|   r%   r[  rs   rf   r1   r  ru   r   r   r5   r   r   r   r   r   r)   r   r  r  r.  r  r  r   r  r,   r  _status
writestater  r   r"  r    checkunresolvedr6   r   r   
pathcopiesr  r  r  r  r  r&  r   r  r  r   	stripdescr$   secretdraftr  resetr2  r  r
  r3  r   	fromlocalry   r  )+r6   r6  r  r  r;  rh   baser{   rs   ru   rv  r   r   r  r  rV  r?  r@  newsubstatemsr   r   changeset_copiesr  r7  r  doeditr  	pureextranewnewdesccommitphaser  r.  normalfilesremovedfilesr>  obsmetadatar  r  r  r  r<  s+     `                                    @@@@ra   amendr+    sm    $ 9 9::
GGA()C/0668D	tyy{D$4$4X$> Dz 

 	SYY[! 	TZZ\" /r8##D)xxz88G%%dhhw&78Dxx .CHHJs{{}! S!B$s288}4s2::FE		$E --d1??4.&&tJ88L!!--d3$$TCHAMPA  ++a.(	 N 4 	S 0,7,A,AD$,,-)D*k "!>&&t[9%%**40!!"%#'::<><a71:<>l#a'GGNN?,?@ 	 &&&tT2Fvvxxf//$?@ LL& A\)!T41H      : GGA56#tDE  R& o6oo'G ![EDHHW$5$EF XXg&$.F fx@JJL	!$onnYY[#&&(--/2  

 %%coo&783??,,
"#}SYY[( 88:c %?$>{{f 88I --KXXh ,,Ks#

]]++D1OOE4;;/ }}H dmmo

<=LK $$$4 %  ! t||~.=L!$$Q5U$K "1 26 88:x(88G"H$6$6tG}$EFKz+;< #	
w %?{J Lu 43, ?.F 21w %?$>{{J Ls   `-`&G#`	>_	B)`1_0
_0
B3`?_5
_5
%F`<	`	`-B`#B'_:	
A:```-
_-(`:
``
``
`*	&`--
`<c                b    UR                  5       (       a  UR                  5       $ [        XX#SS9$ )NT)r  unchangedmessagedetection)r  r  )r6  r  r?  r  s       ra   r%  r%    s0    
  4d r8   c           
        U(       d  [        S5      nUR                  S5       Vs/ s H  ow(       d  M  UPM     nnUR                  SS5        S n	U(       aZ  SR                  U5      n
U R                  R                  SU
5      (       a  [        XX$U
5      =pO%UR                  5         U(       a  MZ  [        XX$5      n[        R                  " 5       n[        R                  " U R                  5        U R                  5       nU R                  R!                  U5        U=(       a#    UR#                  5       =(       a    U R                  nU R                  R%                  UUR'                  5       UR)                  5       UUU R*                  SS9nUn[,        R.                  " [0        U[,        R2                  S9nU(       a  US UR5                  5        n[,        R6                  " S	S
U5      n[        R                  " U5        U(       a  U" U5      nUR9                  5       (       d  [:        R<                  " [        S5      5      eU(       a$  X:X  a  [:        R<                  " [        S5      5      eU$ s  snf )Ns$   Leave message empty to abort commit.r   r   s	   changeset   committemplater  )r  pendingr   r   )r  s   (?m)^HG:.*(
|$)r8   s   empty commit messages   commit message unchanged)r   r   insertr  r6   r   buildcommittemplater   buildcommittextr   r  r  chdirr  r  r.  r   writependingr#  ru   r  r  research
_linebelow	MULTILINEr/  r  r  r   rg   )r6  r  r?  r  r  r  r-  r   formstemplatetextref
committextolddirtrr0  
editortextrD  
stripbelows                     ra   r  r    s    <= t,2,1Q,E2	LLL!L
ii77>>+S11(;43) L 		 % %T?
 __FHHTYY 
	 	 	"BMM4R__&4499G
		  J D :t2<<@J(j&&()66%sD1DHHV$::<<q!89:: Z%?q!<=>>Ke 3s
   
I0I0c                n   U R                   n[        R                  " U5      n[        R                  " XPU5      nUR
                  R                  R                  S U R                   R                  S5       5       5        U(       d  SnUR                  5         UR                  XS9  UR                  5       $ )Nc              3  V   #    U  H  u  pU[         R                  " U5      4v   M!     g 7fr   )r.   unquotestring)r  kvs      ra   r  &buildcommittemplate.<locals>.<genexpr>  s)      :DA 
I##A&':s   ')r/  r8   )r  )r6   r   reference_templatespecr   changesettemplaterr6  cacher   configitems
pushbuffershow	popbuffer)r6  r  r?  r  r<  r6   rC  r6  s           ra   r2  r2    s    	B++C0D%%b5ACCII GG''(9: 
 MMOFF3F"<<>r8   c                    SR                  U R                  S5       Vs/ s H  o(       d  M  SU-  PM     sn5      $ s  snf )Nr   s   HG: %s)r  r   )r   r  s     ra   hgprefixrP    s6    ::cii.>D.>!}y1}.>DEEDs   
=	=c           
     @   / nUR                  5       UR                  5       UR                  5       pvnUR                  5       (       a  UR	                  UR                  5       5        UR	                  S5        UR	                  S5        UR	                  [        [        S5      5      5        UR	                  [        U5      5        UR	                  S5        UR	                  [        [        S5      UR                  5       -  5      5        UR                  5       (       a#  UR	                  [        [        S5      5      5        UR                  5       (       a4  UR	                  [        [        S5      UR                  5       -  5      5        [        R                  " U 5      (       a0  UR	                  [        [        S5      U R                  -  5      5        UR                  U Vs/ s H  n[        [        S5      U-  5      PM     sn5        UR                  U V	s/ s H  n	[        [        S	5      U	-  5      PM     sn	5        UR                  U V	s/ s H  n	[        [        S
5      U	-  5      PM     sn	5        UR                  U V	s/ s H  n	[        [        S5      U	-  5      PM     sn	5        U(       d1  U(       d*  U(       d#  UR	                  [        [        S5      5      5        UR	                  S5        SR                  U5      $ s  snf s  sn	f s  sn	f s  sn	f )Nr8   s>   Enter commit message.  Lines beginning with 'HG:' are removed.s   HG: --s   user: %ss   branch merges   branch '%s's   bookmark '%s's
   subrepo %ss   added %ss
   changed %ss
   removed %ss   no files changedr   )r   r   r   r  r   rP  r   ru   r  r  r   isactivewdirparent_activebookmarkr   r  )
r6  r  r?  r  edittextr   r   r   rB  r   s
             ra   r3  r3    s+   H"||~syy{CKKMWH
)*OOCOOCOO=	
 OOHX&'OOIOOHQ{^chhj89:
vvxx?!345
zz||>!2SZZ\!ABC##D))#3!4t7K7K!KLMOOTBTXa.23TBCOO5A5aXanq015ABOOXFXXa.23XFGOOWEWXa.23WEF'#6!789OOC::h CAFEs   %!L!L!L
!Lc                  ^^ X   nUR                  5       nUbC  U R                  R                  5       U:X  a%  U R                  R	                  [        S5      5        ObUR                  S5      (       dL  T(       aE  UT;  a?  [        UU4S jU 5       5      (       d$  U R                  R                  [        S5      5        UR                  S5      (       dk  U He  nUR                  5       (       d  M  UR                  5       T:X  d  M0  U R                  R                  [        S5      UR                  5       -  5        Mg     U R                  R                  (       aF  U R                  R                  [        S5      UR                  5       UR                  5       4-  5        g U R                  R                  (       a8  U R                  R                  [        S5      UR                  5       U4-  5        g g )Ns3   warning: commit already existed in the repository!
r+  c              3  |   >#    U  H1  oR                  5       T;   =(       a    UR                  5       T:H  v   M3     g 7fr   )r  r  )r  r  bheadsr  s     ra   r  commitstatus.<locals>.<genexpr>'  s0      
AHAFFH7188:#77s   9<s   created new head
close_branchs    reopening closed branch head %d
s   committed changeset %d:%s
)r   r   tipr6   r   r   rf   r  r5   closesbranchr  r  	debugflagr   r   r  )	r6  r  r  rW  rZ  rh   r  r   r   s	     ``     ra   commitstatusr]    sa   
*CkkmG
4>>--/36 	QNOPHHW 
AH
 
 
 	q./0< 88N##A~~AHHJ&$8:;aeegE  ww,-CGGI0FF	
 
a673779c:JJK 
r8   c                P    U R                  [        R                  " U S    X5      S9$ )Nr   )r5   r)   r   )r6  r;  rh   s      ra   postcommitstatusr_  X  s"    ;;W]]4:tB;CCr8   c                H  ^ ^^=^>^? [         R                  " U5      nUR                  R                  5       u  pVTR	                  5       nTR                  5       nXv:X  a  Un0 m>[        R                  " USS9m?UR                  5          UR                  R                  U5         UR                  SS5      n	US    n
[        R                  " XU5      m=[        U=4S jU
R                   5       5      nT=R                  5       (       d  [        R                   " T=S 5      nU
R#                  U5       H  nT=R%                  U5      T>U'   M     UU>U U?4S jnTR#                  [        R                   " T=U5      5       H  nUT>;  d  M  T=R%                  U5      T>U'   M!     [        R&                  " UT>5      m=UR)                  UT=SSSS9nOMUR)                  UT=S	9nU H   nU H  nT=R%                  U5      T>U'   M     M"     [        R&                  " UT>5      m=[+        UR,                  5      n[+        UR.                  5      n[+        UR0                  5      n[+        UR2                  5      n[+        UR4                  5      nUR7                  UR8                  5        [+        UR:                  5      n[+        5       nXW:X  a*  UnUnUnUU-  n[+        5       [+        5       [+        5       nnnOUR)                  UT=S	9n[+        UR,                  5      n[+        UR.                  5      n[+        UR0                  5      nUU-  nUUU-
  -  nUU-  nUU-  nUU-  nUU-  nUU-  nUUU-  -  nUU-  nUnXaR<                  :w  a7  [+        U5      nU H  nUU;   d  M  UR?                  U5        M     UU-  nUU-  nU Hq  nUR                  RA                  U5      nU(       d  M'  UT>;  d  M/  UR                  RC                  U5      R0                  (       d  M[  URE                  U5        ST>U'   Ms     [+        U5      n U H  nUU;   d  M  U R?                  U5        M     UU -
  n![+        5       nU H@  nUR                  RC                  U5      R.                  (       a  M/  URE                  U5        MB     UU-  nU  H@  nUR                  RC                  U5      R.                  (       d  M/  URE                  U5        MB     U U-  n [+        5       n"U HK  nURG                  U5      n#[H        RJ                  RM                  U#5      (       d  M:  U"RE                  U5        MM     UU"-  n[+        5       n$U HK  nURG                  U5      n#[H        RJ                  RM                  U#5      (       d  M:  U$RE                  U5        MM     UU$-  n/ [O        S
5      4/ [O        S5      4/ [O        S5      4/ [O        S5      4/ [O        S5      4/ [O        S5      4S [O        S5      4S [O        S5      4S.n%Sn&Sn'Sn(Sn)UR                  S5      (       a  U)=n&=n'n(U	(       a  U&n*OU'n*[+        5       n+U%S   n,UR                  S5      (       d  U%S   n,UU%S   U)4U!U%S   U)4UU%S   U*4UU%S   U)4UU%S   U)4UU,U'4U U%S   U)4UU%S   U)4U"U%S   U(4UU%S   U)4U$U%S   U(4UU%S   U)4UU%S   U)44n-[        T>RQ                  5       5       GH  u  nn.URG                  U5      n#U- GH  u  n/u  n0n1n2UU/;  a  M  U0GbP  U0RS                  U5        U2(       a  U2U&:X  a  U+RE                  U5        OU'U2::  d  X   RU                  TU   5      (       a  [        RV                  " T X5      n3[H        RJ                  RY                  U3URZ                  S9n4T R]                  [O        S 5      T?" U5      T?" U45      4-  5        UR                  S!5      (       d6  U	(       a  [^        R`                  " U#U35        O[^        Rb                  " U#U35        UR                  S!5      (       a2  T Rd                  (       d  U.(       d  T R)                  U1T?" U5      -  5        O!U.(       a  T Rg                  U1T?" U5      -  5          GM     GM     UR                  S!5      (       d  S"n5U5 V6s/ s H  n6U%U6   S   PM     n7n6[        Rh                  n8[        R&                  " UU7 V9Vs/ s H  n9U9  H  nUPM     M     snn95      n:U8" UTRk                  5       U:4/5        [        R                  " US    U5      n;[m        UTT>T?U%U;U	U+5        U(       aP  U HJ  n< U
Ro                  U<5      Rp                  " TR                  U<   /UQ70 [         Rr                  " U5      D6  ML     S S S 5        S S S 5        g s  sn6f s  snn9f ! [t         a3    [v        Rx                  " S#U<[{        TR	                  5       5      4-  5      ef = f! , (       d  f       Nb= f! , (       d  f       g = f)$NTr  s   interactiveFc              3  F   >#    U  H  nT" U5      (       d  M  Uv   M     g 7fr   r   )r  rB  rV  s     ra   r  revert.<locals>.<genexpr>z  s     =}!!AA}s   !	!c                    gr  r   )rk   r|  s     ra   r   revert.<locals>.<lambda>}  s    r8   c                   > U T;   a  g U TR                   ;   a  g U S-   nT H  nUR                  U5      (       d  M    g    TR                  ST" U 5      U4-  5        g )Nro  s   %s: %s
)r  r  r   )r  r   path_r   r  r  r6   r  s       ra   r  revert.<locals>.badfn  s]    5=3<<'tA||E**  x~s&;;<r8   )node1r   r  r  r  )rh  r   s   reverting %s
r  r  s   forgetting %s
s   undeleting %s
s   no changes needed to %s
s   file not managed: %s
)   revert   add   remove   dropr     undelete   noop   unknownr  rL  r   r   s	   no_backuprk  rl  ri  r  rj  rm  rn  ro  )r/  s#   saving current version of %s as %s
r  )ri  rj  rm  s(   subrepository '%s' does not exist in %s!)>r%   r[  r.  r   r  r  r)   r  r  r  rf   r   r  r  alwaysr   r   r  r  r&  r5   r   r   r   r   r   r  r   r  r  r
  r  r  r0  r   r  r  r  r  r   r/  r   r  
backuppathrelpathr  r~   r/   r  r  r  r   rW  r  _performrevertr  revertr-  rN  r   r  r   )@r6   r6  r  r;  rh   r  r  r  r  r\  r<  
targetsubsr   r  r  r   kindr   r   r   _deletedr  r  modadded
dsmodifieddsadded	dsremovedlocalchangesmergeaddr  r   r  deladdedr   removunkr  
dsremovunkactionsbackupinteractiver  checkdiscarddsmodifiedbackuprK  backupanddel	disptabler  r  xlistr   dobackup
absbaknamebaknameneeddatar`   oplistprefetchsublistr&  r   r  rV  r  r  s@   ` `                                                          @@@ra   rt  rt  \  s	   %D&&(JF88:D	Bz E""4TBH	t}}33D9 hh~u5DzMM$d+ =t}}==
xxzz''+=>Gyy)WWS\c
 *
	= 	= xx 1 1!U ;<e#!"E#J =
 ""4/Akk!T4t " G kkAk6GC!"E#J     ""4/Aw''(GMM"goo&w'goo&w'GMM"5 >!JGI%/L'*uceSUWeHWkkak8GW--.J'--(GGOO,I%/L Y((E Iy Gz)HXE ("J(W,,J
"H
 G :H"2:OOD) # xG("J A--&&q)C u$MM++C0888c"!c
  x=Drz%  X% C==**3/555		#  	5C}}&&s+111C   	G 5CZZ_Fwwv&&S!  	8U
CZZ_Fwwv&&s#  	Z	
 A/01>*+A./0!,-.A012a 234A:;<q!:;<	
 88L!!18880%5y)xx%%"7+L wy)73gi('2+-=>GI&0gi('2|V,ww'1gfow/wv.,g6-u5 GG$g.gj)73A!
	F !/JCZZ_F 2;-|sXe#$LL% $'88$LL-#x/49==S3J3J)0););B)JJ&(ggoo *$)) '6 'G GG !"I J#+C=(72C"D!E $(88J#7#7#.$(MM&*$E$(KK
$Cxx
++::UIIcHSM&9:GGC(3-/0; 2; 0J xx
##7H3;<84gdmA&8F<,,H ++@W1qq@J '')Z() MM$t*d3E	 !HHSM((S),04<4F4Ft4L "w :H = A2   ++Cchhj 123 A	 :9s   h"ChH	hAhh (h.h>AhAhAh>AhLh1f7(h+f<AhAg"h&h7h=g?	?h
h	h
h!c                  ^ ^^^^^& T R                   R                  5       u  pTR                  5       n
/ nUU 4S jnU 4S jnUUU U4S jn[        R                  " T R
                  SS9nTS   S    H  nU(       al  T R                  R                  [        S5      T" U5      -  5      nUS:X  a&  U" SU5        T R                   R                  U5        Mc  UR                  U5        Mv  U" SU5        T R                   R                  U5        M     TS	   S    H|  nU" U5        U(       aY  T R                  R                  [        S
5      T" U5      -  5      nUS:X  a  U" S	U5        U" U5        MX  UR                  U5        Mk  U" S	U5        U" U5        M~     TS   S    H/  nU" U5        U" SU5        T R                   R                  U5        M1     U	T R                  :H  m&U U&4S jn[        5       nU(       Ga  TS   S    Vs/ s H  nUU;  d  M  UPM     nn[        R                  " T U5      n[        R                   " T R                  SSSS9nSUl        SUl        SnX:X  a&  T R                  R'                  SS5      (       a  SnOSnUS:X  a'  [        R(                  " T STR                  5       UUS9nO&[        R(                  " T TR                  5       SUUS9n[        R*                  " U5      n [-        T R                  UUUS9u  nnUS:X  a  [        R.                  " U5      n[;        U5      u  nnUc
  [        5       n[=        5       n[?        U Vs1 s H/  n[A        U5      (       d  M  URB                  RE                  5       iM1     sn5       H  nU" SU5        M     [        5       n U H  n[A        U5      (       a  URB                  RE                  5       n!URB                  RE                  5       U;   a[  T RG                  U!5      n"[        RH                  " T R                  T U!5      n#[J        RL                  " U"U#5        URO                  U!5        U!U ;  a  U RQ                  U!5        US:X  a  U" U!5        URS                  U5        M     URU                  5       n$URW                  S5        U$(       a#   [        RX                  " T R                  T USSS9  AO1TS   S    H%  nU" SU5        U" U5        U(       d  M  U" U5        M'     TS   S    Hs  nUU;   a  M  U(       a5  T R                  R                  [        S5      T" U5      -  5      nUS:w  a  MG  U" SU5        U" U5        T R                   R_                  U5        Mu     TS   S    H~  nU(       a[  T R                  R                  [        S 5      U-  5      nUS:X  a  U" SU5        U" U5        U" U5        MR  UR                  U5        Me  U" SU5        U" U5        U" U5        M     [`        Rb                  " T U   T5      n%TS   S   TS   S   -   TS   S   -    H*  nUU%;   d  M  T R                   Re                  U%U   U5        M,     gs  snf ! [0        R2                   a'  n[0        R4                  " [        S5      U-  5      eSnAf[0        R6                   a'  n[0        R8                  " [        S5      U-  5      eSnAff = fs  snf ! [0        R2                   a/  n[0        R4                  " [Z        R\                  " U5      5      eSnAf[0        R6                   a/  n[0        R8                  " [Z        R\                  " U5      5      eSnAff = f)!zfunction that actually perform all the actions computed for revert

This is an independent function to let extension to plug in and react to
the imminent revert.

Make sure you have the working directory locked when calling this function.
c                l   > TU    nTR                  XR                  5       UR                  5       5        g r   )wwriter  r  )r   r  r  r6  s     ra   checkout _performrevert.<locals>.checkout  s&    VAwwy"((*-r8   c                   >  TR                   R                  SS5      nTR                  R                  XS9  TR
                  R                  U 5        g ! [         a     N(f = f)Nr   r  r  )r6   ry   r  r  r5  r.  set_untracked)r   r4  r6  s     ra   doremove _performrevert.<locals>.doremove  s\    	GG&&8JKEII   0 	##A&  		s   5A 
A! A!c                   > TU   nTR                   R                  (       d  U(       d+  TR                   R                  TU    S   T" U5      -  5        g g )Nr   )r6   r  r5   )r   r   r  r  r  r6  r  s      ra   prntstatusmsg%_performrevert.<locals>.prntstatusmsg  s@    a77??%GGNN76?1-;< #(r8   T)cachedr  r   s(   forget added file %s (Yn)?$$ &Yes $$ &Nork  s(   remove added file %s (Yn)?$$ &Yes $$ &Norl  c                8   > TR                   R                  U TS9$ )N)
reset_copy)r.  set_tracked)r   r6  r  s    ra   normal_performrevert.<locals>.normal  s    }}((j(IIr8   ri  r   s   revert.interactive.)r   r   r   s   applyr   s!   revert.interactive.select-to-keeps   keeps   discardNr5  )r   r   r   r   r   rj  s#   add new file %s (Yn)?$$ &Yes $$ &Norm  s,   add back removed file %s (Yn)?$$ &Yes $$ &No)3r.  r   r  r#   pathauditorr  r6   r  r   r  r   r
  r   r)   r&  r"   r	  r
  r  ry   r  r  r   reversehunksr   r  rg   r  r  r   r  r  r   r   r   r  rq  r/   r  r  r   r   r  r  r+  r%   r,  r  r   r  r   )'r6  r  r  r  r  r   r\  rK  r  r  r  excluded_filesr  r  r  
audit_pathr   r  r  r   torevertrV  rC  r   r  rE  r   rh   rF  unusedalsorestorerP  rQ  r   r  r  r  rS  r  r  s'   `````                                 @ra   rs  rs    s   " &&(JF88:DN.'= =
 %%dii=JY"WW))=>!LF {i+++A.%%a()Q'MM''* # Y"1WW))=>!LF {i+%%a()Q'QK # Wa 1gq!##A& ! t{{"JJ "%&y1!4P4!8OA4PtX.((GG/	
  	>ww!!!E  $	&	 ::dD#((*ahGD::dCHHJahGD ++D1
	I')5ILFD J&++F3 9Gv8N5"$5uHZfJfq	,**,fJKA)Q' LAayyhh'')88$$&(2!ZZ_F%00$DGMM&'2OOC(e#IIcN G+ GGBK  '')

>##DGGT2q$G
 #A&A)Q'QKvq		 ' V_Q**WW))89HQKGF {fa !!!$   [!!$WW))ABQFF {k1-q	%%a(+q)QK1I %  tF|S1F 	W[1!44wy7I!7LL 	
 ;MMvay!, 	Mi Q@ $$ 	H""1%?#@3#FGG** 	I""1%@#AC#GHH	I K, (( >&&x'7'7'<==.. >&&x'7'7'<==>s`   
Y>Y>85Z [:3[:="[? [7"Z99[7"[22[7?^*\==^*]>>^c                   [         R                   H  nUR                  (       d)  U(       a  UR                  (       d  UR                  (       a  M?  UR                  U 5      (       d  MW  [        R                  " UR                  5       UR                  5       S9e   [         R                   H  nUR                  (       a@  U(       a  UR                  (       d(  UR                  S:X  a  U(       d  UR                  (       a  MV  UR                  U 5      (       d  Mn  [        R                  " UR                  5       UR                  5       S9e   g)zLook for an unfinished multistep operation, like graft, and abort
if found. It's probably good to check this right before
bailifchanged().
r     mergeN)r  _unfinishedstates
_clearable_allowcommit_reportonlyisunfinishedr   r  r   r	  _opname)r6  r   	skipmerger*   rB  s        ra   r   r   x  s     ++5--  d##""599;UZZ\BB , ''1>>		X%)}}>>$""1557:: (r8   c                H   [         R                   Hp  nUR                  (       a  M  UR                  (       a  M)  UR	                  U 5      (       d  MA  [
        R                  " UR                  5       UR                  5       S9e   [         R                   H  nUR                  S:X  d  UR                  (       a  M&  UR                  (       d  M9  UR	                  U 5      (       d  MQ  [        R                  " U R                  R                  UR                  5      5        M     g)zSCheck for unfinished operations (as above), and clear the ones
that are clearable.
r  r  N)r  r  r  r  r  r   r  r   r	  r  r/   r%  r0   r  _fname)r6  r*   rB  s      ra   clearunfinishedr    s     ++E$6$6t$<$<""599;UZZ\BB	 , ''99 AMM<<<ANN400KKahh/0	 (r8   c                f    [         R                   H  nUR                  U 5      (       d  M  Us  $    g)zEChecks for unfinished operations and returns statecheck object
for itN)r  r  r  )r6  r*   s     ra   getunfinishedstater    s/     ++d##L , r8   c                   [        S5      n[        R                   HB  nUR                  (       d  M  UR	                  U 5      (       d  M.  XR                  5       -  S4s  $    U S   R                  SSSS9(       a  U[        S5      -  S4$ g)aM  Check for an unfinished operation and return the command to finish
it.

statemod._unfinishedstates list is checked for an unfinished operation
and the corresponding message to finish it is generated if a method to
continue is supported by the operation.

Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
a boolean.
s   continue: %sTNF)missingr   r  s	   hg commitNN)r   r  r  _continueflagr  continuemsgdirty)r6  contmsgr*   s      ra   howtocontinuer    s      G++""d##..00$66	 ,
 DzE%@<(%//r8   c                    [        U 5      u  pUbE  U(       a  U R                  R                  SU-  5        gU R                  R                  SU-  5        gg)zInform the user about the next action after completing hg resolve

If there's a an unfinished operation that supports continue flag,
howtocontinue will yield repo.ui.warn as the reporter.

Otherwise, it will yield repo.ui.note.
Nr   )r  r6   r   r~   )r6  r   r  s      ra   checkafterresolvedr    sE     !&LC
GGLL3'GGLL3'	 r8   c                |    [        U 5      nSnUS   (       a  US   n[        R                  " [        S5      U-  US9e)zRaise an abort suggesting how to properly continue if there is an
active task.

Uses howtocontinue() to find the active task.

If there's no task (repo.ui.note for 'hg commit'), it does not offer
a hint.
Nr   r   s   no %s in progressr  )r  r   r  r   )r6  taskr  r	  s       ra   wrongtooltocontinuer    sA     $EDQxQx


112T9
EEr8   c           	       ^ UR                  5       (       d  [        R                  " [        S5      5      e[	        TU5      nUR                  S5      nUc  [        R                  " [        S5      5      e[        U5      S:  a  TUS      R                  5       nOTS   nSnU(       Ga  U Vs/ s H  nTU   R                  5       PM     nnSnU Vs/ s H  nTU   R                  5       (       a  M  UPM!     n	nU	(       aJ  TR                  R                  [        S	5      S
R                  U4S jU	 5       5      -  [        S5      S9  Sn[        TR                  R!                  U5      5      n
U
[        U5      -
  (       a&  TR                  R                  [        S5      5        SnU(       a  TR#                  5          TR%                  5          [&        R(                  " U5        TR                  SU5       Vs/ s H  oR+                  5       PM     nn[,        R.                  " TR                  TUSS9  SSS5        SSS5        U(       d  TS   n[&        R(                  " U5        U R1                  [        S5      5        U R1                  [        S5      UR3                  5       SS -  5        UR5                  5         gs  snf s  snf s  snf ! , (       d  f       N= f! , (       d  f       N= f)zOabort the interrupted graft and rollbacks to the state before interrupted
grafts   no interrupted graft to aborts   newnodesNs$   cannot abort using an old graftstater   r   FTs%   cannot clean up public changesets %s
ra  c              3  @   >#    U  H  n[        TU   5      v   M     g 7fr   )re   )r  r   r6  s     ra   r  abortgraft.<locals>.<genexpr>  s     ?YU47^^Ys   s    see 'hg help phases' for detailsr  s;   new changesets detected on destination branch, can't strip
r  )r  s   graft aborted
s   working directory is now at %s
   )r  r   r  r   readgraftstaterf   r  r   r  r  mutabler6   r   r  r   r   descendantsr  r  r(  clean_updater  r&   r  r5   r   delete)r6   r6  
graftstate	statedatanewnodesstartctxcleanupr   rQ  	immutabledescstrippointss    `          ra   
abortgraftr    s^    q!ABCCtZ0I}}[)H kk!CDEE 8}q$''):G+348aDGKKM84 (B1Q0AQ	BGGLL;<**?Y??@:;  
 G 4>>--h78#h-GGLL- Gtyy{%%h/ '+hh}h&G&GFFH&G   TWWdKF  + :h'IIa"#$IIa34x||~cr7JJKQ 5 C0  +{sH   .KK3K K#+K<K#K8K#K
K 	K##
K1c                     UR                  5       $ ! [        R                   a0    U R                  R                  S5      R	                  5       nSU0s $ f = f)zDread the graft state file and return a dict of the data stored in it
   graftstates   nodes)r"  r   CorruptedStater0   r  )r6  r  nodess      ra   r  r  %  sO    
!   !m,779%  !s    AAAc                    UR                  5          [        R                  " US5      n[        XU5      sSSS5        $ ! , (       d  f       g= f)z/abort logic for aborting graft using 'hg abort'r  N)r  r  cmdstater  )r6   r6  r  s      ra   hgabortgraftr  1  s1    	&&t];
"J/ 
s	   #>
Ac                   US:X  a  gU(       a  SSK Jn   UR                  XXE5      $ U R                  (       a   gUb|  US:  av  [        UR                  5       5      n
X:X  a  U R                  [        S5      5        gU
S:  a  U R                  [        S	5      5        gU R                  [        S
5      5         gU R                  SS5      (       d  U R                  [        S5      5        g! [        R                   aG  n[        S5      [        R                  " U5      -  nUR                  n	[        R                  " XS9eSnAff = f)a  Run after a changegroup has been added via pull/unbundle

This takes arguments below:

:modheads: change of heads by pull/unbundle
:optupdate: updating working directory is needed or not
:checkout: update destination revision (or None to default destination)
:brev: a name, which might be a bookmark to be activated after updating

return True if update raise any conflict, False otherwise.
r   Fr   r  s   not updating: %sr  Ns3   (run 'hg heads' to see heads, 'hg merge' to merge)
s5   (run 'hg heads .' to see heads, 'hg merge' to merge)
s   (run 'hg heads' to see heads)
r   s   update.requiredests(   (run 'hg update' to get a working copy)
)r  r  updatetotallyr   UpdateAbortr   r2   r%  r	  quietr   branchheadsr5   ry   )r6   r6  modheads	optupdater  brevr  r  r   r	  currentbranchheadss              ra   postincomingr  8  s2    1}	4##Bh==
 
xx  
	(Q, !1!1!34)IIIJ   !#IIKL  IIa:;<  ]];(=>>
		!@AB)    	4'(:+B+B4+HHC99D##C33	4s   C, ,E AEEc                (   U(       d   eSSK Jn  UR                  5          U H  nUR                  X5      n[        R
                  " XU5      n[        U[        R                  5      (       a'  [        R                  " [        S5      [        S5      S9eSU-   n Sn	[        U[        R                  5      (       d  S[        R                  " U5      -  n	UR!                  U	5       n
[        R"                  " UUU
UUS	9nS
S
S
5        [        R(                  " W5      nM     S
S
S
5        W$ ! , (       d  f       N2= f! [        R$                   a0  n[        R&                  " [        S5      X\4-  [        S5      S9eS
nAff = f! , (       d  f       W$ = f)z2utility for `hg unbundle` and `hg debug::unbundle`r   r  s3   packed bundles cannot be applied with "hg unbundle"s$   use "hg debugapplystreamclonebundle"r  s   bundle:   unbundles   unbundle
%s)sourceurlNs   %s: unknown bundle feature, %ssE   see https://mercurial-scm.org/wiki/BundleFeature for more information)r  r  r  openpathr   
readbundler   r+   streamcloneapplierr   rg   r   r   
unbundle20r3   hidepasswordr  applybundleBundleUnknownFeatureErrorr  combinechangegroupresults)r6   r6  fnamesunbundle_sourcer  rR  r   genr  txnnamer?  opexcr  s                 ra   unbundle_filesr  c  sm   M6	EB&A%%bU3C#{==>>&&) BC  u$C%!#w'9'9::-0D0DS0IIG%%g." ,,.B /" 88<HC  
F O% /. 22 kk78E<G' 3 
F OsU   A9FAD;%D*>D;F*
D84D;7F8D;;E?+E::E??F
F)rh   Dict[AnyStr, Any]ri   r   rd   zOptional[AnyStr])rh   r  rn   r   ro   zIterable[AnyStr]rd   rv  )r6   uimod.uirh   Dict[str, Any]rd   r  )rh   r  rd   rv  r   )r  istatus.Statusrd   r  )F)T)r  re   rd   Optional[bytes]r  )r6   r  rh   Dict[bytes, Any]rd   r  )FNNr8   r  )NNNN)rO  re   )wb)rO  re   r|  zLiteral['rb', 'wb']rd   r   )rh   r  )s   hg-%h.patchFNN)FNN)rh   r  )r8   )NNr8   F)FN)FF)r6  r   r  zstatemod.cmdstaterd   r  )r  )
__future__r   r   r   r  r]  r  r6  rz  r   r   r   r   r   r	   r
   r   r   i18nr   r  r   r   r   
thirdpartyr   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(  r   r  r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r  r+   r,   r-   r.   r/   r0   r  utilsr1   r2   r3   revlogutilsr4   r  
interfacesr5   istatusr6   uimodr  
dryrunoptsconfirmopts
remoteoptswalkopts
commitoptscommitopts2commitopts3formatteroptstemplateoptslogoptsrC  
diffwsopts	diffopts2mergetooloptssimilarityoptssubrepooptsdebugrevlogoptsr8  rl   rq   r|   r   r   r   r   r   r   r   r   rY  ra  rc  r  r  rB  r  r  r  r  r   r  r  r  r  r&  r1  r7  r?  rE  rX  rZ  r  r]  r  r  r  r  r!  r   r"  r1  r<  r=  rE  rI  rU  rZ  r]  r_  rq  rv  r   r  r  r   r  r  r  r  r  r   r  r+  r%  r  r2  rP  r3  r]  r_  rt  rs  hooksoutgoinghookssummaryhookssummaryremotehooksr   r  r  r  r  r  r  r  r  r  r  r   r8   ra   <module>r     s   #    	 	 
 
 
  
  
       B   ==
 
:tQKLM

 	*dA<=>
 
6378!F)D	
9:	&	 		
KL	
& 	
	
67	* 	
	
67	*$ 
:sA;<ajI	:sA>?7L
 		
56	'
 		
34	'
$ 
>4#L!MN	>4#J!KL 
;Q78!K.I 		
9:	( 
;Q78!K.I	 
8T1]+,	64:;<	8S!@A1V9M	<q!678'4FGH	8T1567  
7D!678	
=>	 	)T1KLM*dA=>?
 		
45	 		
89	 		
56	 		
01	'
: 
k4#L!MNQ		
 
j$"K LM  34fI	
 
gtQJKL78fI	
 
D 
7C011W:> 		
:;	- k4+J)KLM 
<"3 45	;q!123&#q345 K

 02
22 2 
	26
D&
(
3 B(&Zz.4`3 `3F5'p. tLB LB LB^$$N-"dON,&,%& :=@"&$" 0DNB"
 * 26. HV
Bk`     Xz  **ZL4, 	
(
VF@DN@bJ-b MQTn9&:z^. ^.B@D	(qh #>B"F  F;L|DyF
 J-` 

 zz| ZZ\ ;:1",( F =@	!
	!!	! 	!0(V)r8   