
    	^cH(                        d Z ddlmZ ddlmZmZmZmZm	Z	m
Z
mZmZmZmZmZ i Z ej        e          Zi Z ej        e          Z eddd            eddd           d	Z	 ddZ edddd
 ed          fddd ed          fddd ed           ed          fgej        z   ej        z   ej        z   ej        z    ed          ej                  d             Zd Z edg ej        d          d             Zd
S )aH  uncommit part or all of a local changeset (EXPERIMENTAL)

This command undoes the effect of a local commit, returning the affected
files to their uncommitted state. This means that files modified, added or
removed in the changeset will be left unchanged, and so will remain modified,
added and removed in the working directory.
    )_)cmdutilcommandscontextcopieserrorobsutilpathutilpycompat	registrarrewriteutilscmutil   experimental   uncommitondirtywdirF)default   uncommit.keeps   ships-with-hg-coreNc                    |                                 }t          |                                          }fd|D             }	|	sdS |s&|                                                                 S ||	z
  t	          j        ||          fd                                D             |dffd	}
s'| j                            t          d                     ||
                                }|s|                                }|s|                                }t          j        | |                                | j        g||
|||                                          }|                     |          S )zrRecommit ctx with changed files not in match. Return the new
    node identifier, or None if nothing changed.
    c                 *    h | ]} |          |S  r   ).0fmatchs     0/usr/lib/python3/dist-packages/hgext/uncommit.py	<setcomp>z"_commitfiltered.<locals>.<setcomp>F   s&    333Q%%((3q333    Nc                 $    i | ]\  }}|v 	||S r   r   )r   dstsrcfiless      r   
<dictcomp>z#_commitfiltered.<locals>.<dictcomp>S   s$    FFF83c3r   r   c                    ||vrd S ||         }t          j        | ||                                |                                |                                |                                                    |                    }|S )N)
copysource)r   
memfilectxpathdataislinkisexecget)repomemctxr$   
contentctxredirectfctxmctxcopieds          r   	filectxfnz"_commitfiltered.<locals>.filectxfnU   s|    z!!4$!IIKKIIKKKKMMKKMMzz$''
 
 
 r   s   note: keeping empty commit
parentstextr   r0   userdateextra)p1setr   node	copiesmod
pathcopiesitemsuistatusr   descriptionr4   r5   r   r*   nullidr6   	commitctx)r)   ctxr   
keepcommitmessager4   r5   baseinitialfilesexcluder0   newr/   r   s     `         @@r   _commitfilteredrI   =   s    6688Dsyy{{##L3333,333G  t  vvxx}}7"E!$,,FFFFFv||~~FFFF14r        ;q899::://## xxzz xxzz
.dk*iikk	 	 	C >>#r      uncommitr      keeps(   allow an empty commit after uncommittings   allow-dirty-working-copys'   allow uncommit with outstanding changes   ns   notes   store a note on uncommits   TEXTs   [OPTION]... [FILE]...)helpcategoryc                 j
   t          j        |           t          j        | |           t          j        |          }|                                5  |                                5  |                                }|j        |j	        |j
        |j        f\  }}}}t          t          ||z   |z   |z             t          |          z            }	|d         p|j                            dd          }
|
s'|r|	r#t          j        |t#          d                     |d         }t%          j        ||                                gd           t+          |                                          dk    r!t/          j        t#          d	                    t3          j        |||          }|                                rS|                    |                                |d
          }t          |j	                  t          |j                  z  t          |j
                  z  }t          |                                          |z
  }|r!|d t;          j        |          D             z  }t?          |          D ]}||j         v rt#          d          }n9|j!        "                    |          rt#          d          }nt#          d          }t/          j        t#          d           t3          j#        |          |          z  |          |$                    d          5  |d         s|d         s|%                                |d<   t          j&        | |          }|}|sA|'                    d          |'                    d          }n|                     dd          }tQ          ||||||'                    d          |'                    d                    }|F|                     t#          d                     	 ddd           ddd           ddd           dS i }||                                )                                k    r|f||)                                <   nd||)                                <   |j*        +                                5  t3          j,        |||         |           ddd           n# 1 swxY w Y   t3          j-        ||dd
           ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )a  uncommit part or all of a local changeset

    This command undoes the effect of a local commit, returning the affected
    files to their uncommitted state. This means that files modified or
    deleted in the changeset will be left unchanged, and so will remain
    modified in the working directory.

    If no files are specified, the commit will be pruned, unless --keep is
    given.
    s   allow_dirty_working_copyr   r   s/   requires --allow-dirty-working-copy to uncommit)hint   .rJ      s   cannot uncommit merge changesetT)	listcleanc                     h | ]}|S r   r   )r   r   s     r   r   zuncommit.<locals>.<setcomp>   s    @@@1Q@@@r   s0   file was not changed in working directory parents.   file was untracked in working directory parents   file does not exists   cannot uncommit "%s"s   messages   logfilerK   Nr   s   users   date)rD   r4   r5   s   nothing to uncommit
r   fixphase).r   check_note_sizeresolve_commit_optionsr   byteskwargswlocklockr>   modifiedaddedremoveddeletedanyr8   r=   
configboolbailifchangedr   r   precheckrevlenr2   r   
InputErrorr   r   r   r7   r
   dirssortedcleanwvfsexistsgetuipathfntransactionr?   
logmessager(   rI   r9   dirstateparentchangemovedirstatecleanupnodes)r=   r)   patsoptsstmardisdirtypathallowdirtywcopyoldr   seligiblebadfilesr   rO   rD   rC   newidmappings                         r   uncommitr   {   s   < D!!!"2t,,,%%D	 UL ULtyy{{ UL UL[[]]["(BJ
B
1a#a!eai!m,,s4yy899'
 IW1GHH 	  	 	 	!IJJ    4jTCGGII;<<<s{{}}!!"1%G#H#HIIIc4.. ;;== 	

36688Ud
;;A17||c!*oo5AIFH5;;==))H4H
  A@@h(?(?@@@@H%%  <<K DD Y%%a(( 5NOODD344D&-..1J1DT1J1J11M1MM   
 k** %	L %	L$ 5Z(8 5#&??#4#4Z (T22GJ 88G$$0!%'!2!2JJ!#')9" "J $XXg&&XXg&&  E }		!4556661%	L %	L %	L %	L %	L %	LaUL UL UL UL UL UL UL UL UL UL UL UL UL ULT G''',h

## ')

#++-- ? ?$T4;>>>? ? ? ? ? ? ? ? ? ? ? ? ? ? ?  wdKKKKK%	L %	L %	L %	L %	L %	L %	L %	L %	L %	L %	L %	L %	L %	L %	LaUL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL UL ULs   T('J?T&C#S9	TT(,A5S9!S
	>S9
SS9SS9-T9S==T S=TT(T	T(T	T((T,/T,c              #      K   |                                  j        j                            |                                 d          D ]+}t          j        |                                  |          V  ,dS )zFyields the obsolete markers marking the given changeset as a successorr   N)r)   obsstorepredecessorsr(   r9   r	   marker)rB   r%   s     r   predecessormarkersr      sh      

#044SXXZZDD / /nSXXZZ....../ /r      unamendT)rM   	helpbasicc                 L   |                                 }|                                5  |                                5  |                    d          5  |d         t	          j        |                                gd           t                                                    dk    r!t          j
        t          d                    d}t          fd|D                       s!t          j
        t          d                    t          t                              }t          |          dk    r3t          d          }t          j
        |t          |          z            |d	                                         }||                                         }                                |d
<   fd}	t%          j        |                                                                f                                                                |	                                                                |          }
|                    |
          }||         }|j        }|                                5  t;          j        ||           ddd           n# 1 swxY w Y                                   |fi}t;          j         ||dd           ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )a3  undo the most recent amend operation on a current changeset

    This command will roll back to the previous version of a changeset,
    leaving working directory in state in which it was before running
    `hg amend` (e.g. files modified as part of an amend will be
    marked as modified `hg status`)
    r   rP   rQ   s   cannot unamend merge changeset)s   amend_source   unamend_sourcec              3   D   K   | ]}|                                 v V  d S N)r6   )r   keycurctxs     r   	<genexpr>zunamend.<locals>.<genexpr>  s0      BBS3&,,..(BBBBBBr   sA   working copy parent was not created by 'hg amend' or 'hg unamend's:   changeset must have one predecessor, found %i predecessorsr   r   c                 R    	                      |          S # t          $ r Y d S w xY wr   )filectxKeyError)r)   ctx_r$   predctxs      r   r0   zunamend.<locals>.filectxfn+  s<    t,,,   tts    
&&r1   NTrT   )!
unfilteredrY   rZ   rl   r   rb   rc   rd   r2   r   re   r   r_   listr   prednoder6   hexr   r*   r7   p2r?   r   r4   r5   rA   rn   ro   r   rp   r9   rq   )r=   r)   rs   unfiexpected_keysmarkerser   extrasr0   newctxnewprednode
newpredctxrn   r   r   r   s                  @@r   unamendr      s    ??D	 9G 9Gtyy{{ 9G 9GD$4$4Z$@$@ 9G 9G dTFJJLL>:>>>v~~  1$$"1%F#G#GHHH<BBBBMBBBBB 	"$    )&1122w<<1OPPA"1s7||#34441:&&((x. $*JJLL !	 	 	 	 	 ZZ\\7::<<0$$&&--//	
 	
 	
 nnV,,+&
=""$$ 	3 	3 z222	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 ;;==;.1T7JFFFFs9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9G 9Gs~   L LH,K*J$	K*$J((K*+J(,2K*L*K..L1K.2L5LL	LL		LL L)NNN)__doc__mercurial.i18nr   	mercurialr   r   r   r   r:   r   r	   r
   r   r   r   r   cmdtablecommandconfigtable
configitem
testedwithrI   walkopts
commitoptscommitopts2commitopts3CATEGORY_CHANGE_MANAGEMENTr   r   r   r   r   r   <module>r      s}                                   
)
H
%
%!Y!+..
 

   
 
    #
 AE; ; ; ;| 		gtQQJKKL'A899		
 
wQQ:;;QQwZZH	 
    A3#  &dL dL' &dLN/ / / 	3	  CG CG CG CG CGr   