
    6h#                        S SK Jr  S SKrSSKJr  SSKJrJr  SSKJ	r	JrJ
r
JrJrJr  \R                  " S5      rSS	1rS
 rSS jrSS jrS rS rS rS rSS jrg)    )annotationsN   )_)hexnullrev)errornodeobsoleteobsutilrevsetscmutils   \b[0-9a-f]{6,64}\bs   sources   intermediate-sourcec                l    UR                  S U R                  5       R                  5        5       5        g)zIpreserve the relevant `extra` entry from old_ctx on rebase-like operationc              3  D   #    U  H  u  pU[         ;   d  M  X4v   M     g 7fN)retained_extras_on_rebase).0keyvalues      7/usr/lib/python3/dist-packages/mercurial/rewriteutil.py	<genexpr>,preserve_extras_on_rebase.<locals>.<genexpr>'   s&      1JC++ 	1s    
 N)updateextraitems)old_ctx	new_extras     r   preserve_extras_on_rebaser   %   s,     !--///1     c                X   U R                   R                  n[        U5      nXB:  a?  U Vs/ s H  n[        R                  " U" U5      5      PM!     nnSR	                  U5      nU$ UR                  5       n[        S5      nU[        R                  " U" U5      5      US-
  4-  nU$ s  snf )zreturns a string summarizing revisions in a decent size

If there are few enough revisions, we list them all. Otherwise we display a
summary of the form:

    1ea73414a91b and 5 others
s   , s   %s and %d othersr   )	changelogr	   lenshortjoinfirstr   )	reporevsmaxrevstonodenumrevsrshortssummaryr$   s	            r   _formatrevsr-   .   s     ^^  F$iG156A$**VAY'6**V$
 N 

'(DJJve}-w{;;N 7s   &B'c                   [         U;   a-  [        S5      U-  n[        S5      n[        R                  " XES9e[	        S U 5       5      (       a$  U R
                  R                  S5        S U 5       n[        U S   R                  5       5      S:  a"  [        R                  " [        S	5      U-  5      eU R                  S
U5      nU(       a9  [        X5      n[        S5      X'4-  n[        S5      n[        R                  " XES9e[        X5      nU(       a7  [        S5      n[        R                  " [        S5      U[        U5      4-  US9eU(       d  g[        R                  " U [        R                  5      (       d  [!        X5      n	U	(       a  U	u  pn[        S5      UU
U4-  nU
R#                  5       UR#                  5       :w  a  U[        S5      U-  -  nU R
                  R$                  (       ae  U
R#                  5       UR#                  5       :w  a  U[        S5      X4-  -  nU[        S5      XU
4-  -  n[        R                  " U[        S5      S9e[        R                  " U[        S5      S9egg)a  check if revs can be rewritten
action is used to control the error message.

check_divergence allows skipping the divergence checks in cases like adding
a prune marker (A, ()) to obsstore (which can't be diverging).

Make sure this function is called after taking the lock.
s   cannot %s the null revisions   no changeset checked out)hintc              3  :   #    U  H  n[        US 5      v   M     g7f)revN)hasattrr   r*   s     r   r   precheck.<locals>.<genexpr>P   s     
+d71eds   s-   rewriteutil.precheck called with ctx not revsc              3  @   #    U  H  oR                  5       v   M     g 7fr   )r1   r3   s     r   r   r4   R   s     &As   Nr   s"   cannot %s changesets while mergings   %ld and public()s   cannot %s public changesets: %ss    see 'hg help phases' for detailss#   see 'hg help evolution.instability's7   cannot %s changeset, as that will orphan %d descendantss8   cannot %s %s, as that creates content-divergence with %ss	   , from %ss0   
    changeset %s is a successor of changeset %ss   
    changeset %s already has a successor in changeset %s
    rewriting changeset %s would create "content-divergence"
    set experimental.evolution.allowdivergence=True to skip this checksE   see 'hg help evolution.instability' for details on content-divergences@   add --verbose for details or see 'hg help evolution.instability')r   r   r   
InputErroranyui	develwarnr!   parents
StateErrorr&   r-   disallowednewunstabler
   	isenabledallowdivergenceopt_find_new_divergencer1   verbose)r%   r&   actioncheck_divergencemsgr/   
publicrevsr,   newunstablenew_divergence	local_ctx	other_ctxbase_ctxs                r   precheckrJ   B   ss    $./&8,-s..

+d
+++JK&&
4: 1$34v=
 	
 .5Jd/23v6GG45s..'3K78HIs;'()
 	
 dH$?$?@@-d9-;*I(K C }}(,,.0q11ww==?hlln41P"-. .C q' )45 5 &&`  &&; ?  Ar   c                    [         R                  " U [         R                  5      nU(       a  [        R                  " 5       $ U R                  SX5      $ )zChecks whether editing the revs will create new unstable changesets and
are we allowed to create them.

To allow new unstable changesets, set the config:
    `experimental.evolution.allowunstable=True`
s   (%ld::) - %ld)r
   r=   allowunstableoptr   basesetr&   )r%   r&   allowunstables      r   r<   r<      s>     &&tX-F-FGM~~99%t22r   c                    U R                  SU5      nU H:  n[        X U   5      nU(       d  M  X   XS      U R                  5       US      4s  $    g )Ns   %ld and obsolete()r   r   )r&   find_new_divergence_from
unfiltered)r%   r&   obsrevsr*   divs        r   r?   r?      sZ    ii-t4G&t!W53GTa&\4??+<SV+DEE  r   c                   UR                  5       (       d  g[        R                  " XR                  5       5      nU(       a  US   S   UR                  5       4$ [        R                  " X5      nU(       a  US   S   nUS   S   nUS   U4$ g)zreturn divergent revision if rewriting an obsolete cset (ctx) will
create divergence

Returns (<other node>, <common ancestor node>) or None
Nr   s   divergentnodess   commonpredecessor)r
   r   successorssetsr	   divergentsets)r%   ctxssetdivsetsnsuccsetprecs         r   rP   rP      s     <<>> !!$
3DQ
CHHJ'' ''2qz"34H1:23DQK&&r   c                    U R                  SS5      nUS:X  a  gUS:X  a  g[        R                  " [        S5      X4-  5      e)N   rewrites   empty-successors   skipTs   keepFsf   %s doesn't know how to handle config rewrite.empty-successor=%s (only 'skip' and 'keep' are supported))configr   ConfigErrorr   )r8   commandempty_successors      r   skip_empty_successorrb      sV    ii
,>?O'!	G	#
 ()
 	
r   c           	        U(       d  0 n0 n[         R                  " [        U5      nU R                  5       nU GH  n [        R
                  " XV5      nUc  M   XW   nUR                  5       (       d  UR                  U5      n	U	c  MO  U	/n	O#[        R                  " XR                  5       US9n	[        U	5      S:X  ap  [        U	S   5      S:X  a^  U	S   S   n
U
b*  [        U
5      nUR!                  XkS[        U5       5      nM  U R"                  R%                  ['        S5      U-  5        M  U R"                  R%                  ['        S5      U-  5        GM     U$ ! [        R                  [        R                  4 a     GMK  f = f)a  Replace all obsolete commit hashes in the message with the current hash.

If the obsolete commit was split or is divergent, the hash is not replaced
as there's no way to know which successor to choose.

For commands that update a series of commits in the current transaction, the
new obsolete markers can be considered by setting ``pending`` to a mapping
of ``pending[oldnode] = [successor_node1, successor_node2,..]``.
N)cacher   r   sb   The stale commit message reference to %s could not be updated
(The referenced commit was dropped)
s>   The stale commit message reference to %s could not be updated
)refindallNODE_RErQ   r   resolvehexnodeidprefixr   WdirUnsupportedAmbiguousPrefixLookupErrorr
   getr   rU   r	   r!   r   replacer8   noter   )r%   	commitmsgpendingrd   hashesunfihfullnoderW   
successors	successornewhashs               r   update_hash_refsrw      sx    EZZ+F??D	55d>H
 n||~~ X.J!$J //hhjNJ z?aC
1$6!$;"1a(I$i.%--a3q61BC	Q 	 GGLL( 	G V Q %%u'G'GH 	 	s   E$FF)   )r]   Tr   )
__future__r   re   i18nr   r	   r   r    r   r
   r   r   r   compilerg   r   r   r-   rJ   r<   r?   rP   rb   rw    r   r   <module>r~      sj    # 	 
  **+
,  (Qh
32
":r   