
    q&f              
       6   d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZ i Z ej*                  e      ZdZ edd	d
d ed       ed      fddd ed      fgej.                  z    ed      ej0                  d      d        Zd Zd Zy)z=command to split a changeset into smaller ones (EXPERIMENTAL)    )_)nullrevshort)	bookmarkscmdutilcommandserrorhg
logcmdutil	registrar
revsetlangrewriteutilscmutilutil   )rebases   ships-with-hg-core   split   rs   rev    s   revision to splits   REVs   rebaseTs   rebase descendants after splits!   hg split [--no-rebase] [[-r] REV])helpcategory	helpbasicc           
         g }|j                  d      r |j                  |j                  d             |j                  |       |j                         5  |j	                         5  |j                  d      }t        j                  |      5  t        j                  ||xs dg      }t        |      dkD  rt        j                  t        d            |j                         }|	|t        k(  r4| j!                  t        d             	 ddd       ddd       ddd       y||   }|j#                         t        j                  t        d            |j                  d	      r9t%        |j'                  d
||            }t%        |j'                  d||            }	ng }	t)        j*                  ||g|	z   d       t        |j-                               dkD  rt        j                  t        d            t/        j0                  |       |j2                  }
|
r5|j4                  |
   |j#                         k7  rt7        j8                  |       |d   j#                         }d}	 t;        | |||fi |}|||j#                         k7  rt=        j>                  ||d       |
rt7        j@                  ||
       	 |	r|rtC        | ||	|       ddd       ddd       ddd       y# |||j#                         k7  rt=        j>                  ||d       |
rt7        j@                  ||
       w w xY w# 1 sw Y   exY w# 1 sw Y   ixY w# 1 sw Y   yxY w)af  split a changeset into smaller ones

    Repeatedly prompt changes and commit message for new changesets until there
    is nothing left in the original changeset.

    If --rev was not given, split the working directory parent.

    By default, rebase connected non-obsoleted descendants onto the new
    changeset. Use --no-rebase to avoid the rebase.
    revr      .r   s   cannot split multiple revisionsNs   nothing to split
s   cannot split working directoryr   s   (%d::) - (%d)s   %ld - (%ld & obsolete())::s   cannot split a merge changesetF
show_stats)"getappendextendwlocklocktransactionr   acceptinterventionr   revrangelenr	   
InputErrorr   firstr   statusnodelistrevsr   precheckparentsr   bailifchanged_activebookmark
_bookmarksr   
deactivatedosplitr
   cleanactivatedorebase)uirepor+   optsrevlisttrr   ctxdescendantstorebasebnamewnodetops                -/usr/lib/python3/dist-packages/hgext/split.pysplitrB   -   s   , Gxxtxx'NN4	 72tyy{ 72h' $$R( 3	2&&tW->?D4y1}&&q)K'LMM**,C {cWn		!1233	2	72 72 72 s)Cxxz!&&q)J'KLLxx! #499-=sC#HIII5{K   ux'7B3;;=!A%&&q)J'KLL!!$' ((E/388:=$$T*JOO%EC4b$C848 ;%388:"5HHT5U;&&tU3CT8S1g3	2	72 72 72d ;%388:"5HHT5U;&&tU3 a3	2 3	2	72 72 72 72sj   M	&'L=A>L1L=M	$EL1&K&5AL1L=M	&AL.	.L11L:6L==M	M		Mc           	         g }|j                         |j                  j                         k7  r&t        j                  ||j                         d       |j                  j                  |      5  t        j                  ||j                                d d d        d } ||      r+|rt        d      t        |j                               z  }| j                  ddid      5  |D ]*  }t        j                  | |d      }	|t        d      |	z  z  }, 	 d d d        |t        d	      z  }n%t        d
      t        |j                               z  }|j                  dd||j                         z   d       |d   }
t        j                   | |fi | |d   }|
j                         |j                         k7  r|j#                  |        ||      r+|st%        j&                  t        d            t)        |      dk7  s$|d   j                         |j                         k7  rEt        j*                  ||j                         |D cg c]  }|j                          c}idd       |d   S # 1 sw Y   xY w# 1 sw Y   jxY wc c}w )NFr   c                     | j                         }t        |j                  |j                  |j                  |j
                  f      S )N)r(   anymodifiedaddedremoveddeleted)r7   sts     rA   
incompletezdosplit.<locals>.incomplete   s1    [[]BKK2::rzzBCCr   s1   HG: Splitting %s. So far it has been split into:
)s   templatealiass
   label(l,x)   xr   s	   HG: - %s
s7   HG: Write commit message for the next split changeset.
sF   HG: Splitting %s. Write commit message for the first split changeset.
T)editinteractivemessager   s   cannot split an empty revisionr   r   )	operationfixphase)r)   dirstatep1r
   r3   changing_parentsr   movedirstater   r   configoverrider   format_changeset_summaryupdatedescriptionr   commitr   r	   r&   r%   cleanupnodes)r6   r7   r:   r;   r8   	committedrK   headercsummaryorigctxnewctxs               rA   r2   r2      sY   I xxzT]]%%''
sxxze4		'	'	- -T3668,-D
 T
Echhj!"F
 ""2D98 9 # 9A%>>r1hOGa.88F99 aK F , chhj!"F 	#!COO$55	
 t*D)D)d <<>V[[]*V$E T
H q!BCDD
9~il//1SXXZ? 	XXZI6q!&&(67		
 R=u- - 9 9J 7s   /%I/#0I<J	/I9<Jc           
          t        j                   | |t        j                  d|      gt        j                  d|j                                      y )Ns   %lds   %d)r   dest)r   r   
formatspecr   )r6   r7   srcdestctxs       rA   r5   r5      s=    
MM
""63/0""5'++-8	r   N)__doc__mercurial.i18nr   mercurial.noder   r   	mercurialr   r   r   r	   r
   r   r   r   r   r   r    r   cmdtablecommand
testedwithcommitopts2CATEGORY_CHANGE_MANAGEMENTrB   r2   r5    r   rA   <module>rs      s    D 
    
)

H
% #
 		vsA23QvY?	iq!BCD 	
 *+33
F2
F2R@Fr   