
    	^c"                        d dl m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mZ ej        Zi Z ej        e          Zd%dZd Z	 	 	 	 	 d&d	Z ed
ddg  ed           ed          fddd ed          fddd ed          fddd ed          fddd ed          fddd ed          fddg  ed           ed          fdd d ed!          fg ed"          ej        #          d$             ZdS )'   )_)getattr)	bookmarkscmdutilerrorhglock
logcmdutil
mergestatepycompat	registrarrepairscmutilutilFc                     |                                  }|s)t          j        |            t          j        |            nt          j        | d           |S )NT)	skipmerge)statusr   checkunfinishedbailifchanged)repoforcess      1/usr/lib/python3/dist-packages/mercurial/strip.pychecklocalchangesr      sW    A 6%%%d####5555H    c           	         | j                             |d                   \  }}| d                                          }t          j        | d          r&|| j        k    r|d | j        j        D             v r|}nm|| |                                         k    rOd}d}|                     |||||||          }|r.| j         }|	                    |
                                          }|S )N    s   mqc                     g | ]	}|j         
S  node).0xs     r   
<listcomp>z%_findupdatetarget.<locals>.<listcomp>)   s    333a16333r   s   parents(wdir())s7   max(((parents(%ln::%r) + %r) - %ln::%r) and branch(%s)))	changelogparentsbranchr   safehasattrnullidmqappliedrevsr!   first)	r   nodesunodep2currentbranchpwdirrevsetbranchtargetcls	            r   _findupdatetargetr6   "   s    &&uQx00IE2J%%''M 	u%%2$+3347?33333	$u+,,..	.	."KyyE5%}
 
  	2BGGL..0011ELr   TNc           	      8   |                                 5  |                                5  |rbt          ||           t          ||          }t	          j        ||           |j                            |                                           |rt          j
        | |||           nt          j        | |||           |j        }	|r|                    d          5 }
|j        |v rt          j        |           |	                    ||
d |D                        d d d            n# 1 swxY w Y   t%          |          D ]'}|                     t'          d          |z             (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 )N)r   s   stripc                     g | ]}|d fS Nr   r"   bs     r   r$   zstrip.<locals>.<listcomp>U   s    1O1O1O1d)1O1O1Or      bookmark '%s' deleted
)wlockr	   r   r6   r   cleandirstatewritecurrenttransactionr   	softstripstrip
_bookmarkstransaction_activebookmarkbookmarksmod
deactivateapplychangessortedr   )uir   r,   updatebackupr   r   softurev	repomarkstrbookmarks               r   rC   rC   9   s    
 C Ctyy{{ C C 	;d%0000$T400DHT4   M 7 7 9 9::: 	1RtV4444LT4000O	 	C!!(++ Qr'944 +D111&&tR1O1OY1O1O1OPPPQ Q Q Q Q Q Q Q Q Q Q Q Q Q Q #9-- C C566ABBBB)C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C CsY   FB4E7?D)E7)D--E70D-1:E7+F7E;	;F>E;	?FFFs
   debugstrip   r   revsN   strip specified revision (optional, can specify revisions without this option)s   REV   f   forcesD   force removal of changesets, discard uncommitted changes (no backup)r   s	   no-backups   do not save backup bundle   nobackups&   do not save backup bundle (DEPRECATED)   ns   ignored  (DEPRECATED)   k   keeps,   do not modify working directory during strip   B   bookmarks.   remove revs only reachable from given bookmarks   BOOKMARK   softs:   simply drop changesets from visible history (EXPERIMENTAL)s1   hg debugstrip [-k] [-f] [-B bookmark] [-r] REV...)helpcategoryc                 *    t          j        |          }d}|                    d          s|                    d          rd}j        t	          |          |                    d          z   }t          t          j        |                    }                                5  t          |                    d                    }|rj	        }|
                    |          sft          j        t          d          d                    t          |t          |                                          z
                      z            i }|                                D ].\  }}	|                    |	g                               |           /|                                D ]T}
|                    |
          r=t-          j        |
d	                   }|                    t          |                     U|s                                5                      d          5 }d
 |D             }|                    ||           ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   t          |          D ]'}|                     t          d          |z             (|s!t          j        t          d                    t                              |                    }|                    |           |                    |          }tA           fdj!        "                                D                       }fd|D             }tG          dd          }||j$        r%                    &                    d                     v rbd|_'        d	}tQ          |j$                  }tS          |j$                  D ]\  }}|j*        |v r|} n|j$        ||= |+                                 t          |          }|r/|                    d          rtY          |          }|         }-                    d|%                                          }g }|D ]/}|.                    |         /                                           0j!        fdD             }|.                    |           j!        0                    ||1                                |           j!                            2                                           tf          j4        5                               d}tm          | ||||                    d          ||d                    ddd           n# 1 swxY w Y   d	S )a  strip changesets and all their descendants from the repository

    The strip command removes the specified changesets and all their
    descendants. If the working directory has uncommitted changes, the
    operation is aborted unless the --force flag is supplied, in which
    case changes will be discarded.

    If a parent of the working directory is stripped, then the working
    directory will automatically be updated to the most recent
    available ancestor of the stripped parent after the operation
    completes.

    Any stripped changesets are stored in ``.hg/strip-backup`` as a
    bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
    be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
    where BUNDLE is the bundle file created by the strip. Note that
    the local revision numbers will in general be different after the
    restore.

    Use the --no-backup option to discard the backup bundle once the
    operation completes.

    Strip is not a history-rewriting operation and can be used on
    changesets in the public phase. But if the stripped changesets have
    been pushed to a remote repository you will likely pull them again.

    Return 0 on success.
    Ts	   no_backuprW   FrT   r\   s   bookmark '%s' not found   ,r   c                     g | ]}|d fS r9   r   r:   s     r   r$   zdebugstrip.<locals>.<listcomp>   s     > > >q!T > > >r   Nr<   s   empty revision setc              3   \   K   | ]&}|j         k    o                    |          v V  'd S r9   )r)   rev)r"   pr5   r   strippedrevss     r   	<genexpr>zdebugstrip.<locals>.<genexpr>   sR       
 
 :l!:
 
 
 
 
 
r   c                 :    h | ]}                     |          S r   r    )r"   rr5   s     r   	<setcomp>zdebugstrip.<locals>.<setcomp>   s#    ///ARWWQZZ///r   r*   s   qtiprZ   s   only(., %d)c                 H    g | ]}                     |          j        |S r   )	get_entrymaybe_clean)r"   fr?   s     r   r$   zdebugstrip.<locals>.<listcomp>  s?       8+=+=a+@+@+L  r   rV   r]   )rM   rL   r   r   rN   )7r   byteskwargsgetr%   listsetr
   revranger=   rD   issubsetr   Abortr   joinrJ   keysitems
setdefaultappendvalues
issupersetr   bookmarkrevsrL   r	   rE   rI   r@   descendantsunion
differenceanyr?   r&   r   r+   rc   lookupapplieddirtylen	enumerater!   	savedirtyr6   r,   extendfilesrebuildmanifestrA   mergestatemodr   r>   rC   )!rK   r   r,   optsrM   r   rP   nodetobookmarksmarkr!   marksrsrevsrQ   	bmchangesrR   r}   rootsrL   	rootnodesqstartendistatusentryrO   uctxdescendantrevschangedfilesrc   
dirchangesr5   r?   re   s!    `                            @@@r   
debugstripr   Z   s   f %%DFxx +!6!6 	B::(((Dz"4..//D	 a
 a
--..	 	GI%%i00 k011iiy3y~~7G7G3H3H'H I IJJK   !O'oo// B B
d**444;;DAAAA(//11 - -''.. -$1$aAAFKKF,,, GYY[[ @ @$"2"2;"?"? @2 > >I > > >I**4Y???@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ !'y 1 1 G GHHHQ9::XEFFFF 	8+a 566777"....//zz+..,,  
 
 
 
 
 
]**,,
 
 
 
 

 0//////	D$%%=QY= vvdkk'**++|;;!%!)nn&/	&:&:  NA{"'944 !"	 5
 IeCi(i   	dhhw'' 	$T400D:D "YY~txxzzBBNL% 7 7##DIOO$5$56666 }H   #  J 
+++M!!$FFFM 7 7 9 9::: $**4000F((8$$g		
 		
 		
 		
qa
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
F 1s\   )E,VI2+$II2II2"I#I2&V2I6	6V9I6	:LVVV)F)TTNNF)i18nr   r   r    r   rG   r   r   r   r	   lockmodr
   r   r   r   r   r   r   releasecmdtablecommandr   r6   rC   CATEGORY_MAINTENANCEr   r   r   r   <module>r      s                                          /
)
H
%
%     6 
	C C C CB 	 A 
 AfII
	
 A3 		
 
lD!!$@"A"ABA788		
 
sD!!4556A=>>		
 A?@@AkNN	
 AKLL		
U0b A:;;-i5 5 5lI Im5 5lI I Ir   