
    q&f%D                        d dl mZ d dlmZmZmZmZmZ d Zd Z	d Z
d Zd Zg dZe	e
eedZd-d	Z ed
       ed      f ed       ed      fd ed       ed      f ed       ed      fd ed       ed      f ed       ed      fd ed       ed      f ed       ed      fd ed       ed      f ed       ed      fd ed      df ed      dfd ed       ed      f ed       ed      fd ed       ed      f ed       ed      fd ed       df ed       dfd ed!      df ed"       ed#      fdd$
Zd.d%Z	 d/d&Z	 d/d'Zd( Zd) Zd* Zd+ Zd, Zy)0   )_)	bookmarkserrorobsutilscmutilstackc                    | j                   j                  }| j                   j                  }| j                   j                  }t	               }t         ||            }|rv|j                         }t        j                  |  ||            }|s|j                   ||             n-|D ](  }	|	D ]!  }
 ||
      }|dk7  s|j                  |       # * |rv|S )zReturn all changesets that may be a new parent for orphan `rev`.

    This function works fine on non-orphan revisions, it's just silly
    because there's no destination implied by obsolete markers, so
    it'll return nothing.
    )	changelognode
parentrevsrevsetlistpopr   successorssetsextendadd)repor   tonodeparentstorevdesttovisitrsuccsetsssndrs               4/usr/lib/python3/dist-packages/mercurial/destutil.pyorphanpossibledestinationr!      s     ^^  Fnn''GNNE5D73< G
KKM))$q	: NN71:&  % %AqBRx%% & K    c                 >   d}| d   }|j                         }d}|j                         r|j                         st        j                  | |j                               }|r9|D cg c]  }|D ]  }|  }}}| j                  d|      j                         }nQ|j                         }|j                         r!|j                         }|j                         r!|j                         }|(t        j                  |       r| d   j                         }||dfS c c}}w )z9decide of an update destination from obsolescence markersNs   max(%ln)   .)
p1obsoletechildrenr   r   r   revsfirstr   isactivewdirparent)	r   cleanr   wcr%   movemark
successorssubr   s	            r    _destupdateobsr0   /   s    D	dB	BH	{{}R[[]++D"'')<
  (2?3?a!?!?J? 99[*5;;=DB++-UUW ++-779D	 < <T BDz(H4 @s   %Dc                 x    d}t        j                  | j                  |       \  }}|| j                  |   }|||fS )z4decide on an update destination from active bookmarkN)r   calculateupdateui
_bookmarks)r   r+   r   
activemarkr-   s        r    _destupdatebookr6   Z   sE     D$44TWWdCJz*:%%r"   c                    | d   }dx}}|j                         }|r| d   j                         }|| j                         v r\| j                  |      }|r | j                  d|      j	                         }t        j                  |       r\| d   j                         }nH|dk(  r0|j                         s | j                  d      j	                         }n| d   j                         }||dfS )z_decide on an update destination from current branch

    This ignores closed branch heads.
    Nr$      max(.::(%ln))s   defaults   max(head() and not closed()))	branch	branchmapbranchheadsr(   r)   r   r*   r   r%   )r   r+   r,   r-   r   currentbranchheadss          r    _destupdatebranchr>   d   s    
 
dBHtIIKMT
))+((  /99-u5;;=D''-Dz(H	*	$RUUW yy89??ADz 4r"   c                 n   | d   }|j                         }d}|| j                         v rn| j                  |d      }|sJ d       | j                  d|      j	                         }|J d       t        j                  |       r.| d   j                         }n| j                  d      }|J d	       ||dfS )
zCdecide on an update destination from closed heads in current branchNTcloseds    any branch has at least one headr8   s4   any revision has at least one descendant branch headr$   s   tips%   'tip' exists even in empty repository)	r9   r:   r;   r(   r)   r   r*   r   lookup)r   r+   r,   r<   r-   r=   r   s          r    _destupdatebranchfallbackrC      s    	dBIIKMH((  t <999uyy)51779	CB	C''-Dz(H {{6"I!II4r"   )s	   evolutions   bookmarks   branchs   branchfallbackc                     dx}x}}t         D ]  }t        |   | |      \  }}}| n | |   j                         }|||fS )a"  destination for bare update operation

    return (rev, movemark, activemark)

    - rev: the revision to update to,
    - movemark: node to move the active bookmark from
                (cf bookmark.calculate update),
    - activemark: a bookmark to activate at the end of the update.
    N)destupdatestepsdestupdatestepmapr   )r   r+   r   r-   r5   stepr   s          r    
destupdaterH      sb     $('D'8j %6t%<T5%I"h
 t*..
C*$$r"   sT   multiple matching bookmarks to merge - please merge with an explicit rev or bookmarks4   run 'hg heads' to see all heads, specify rev with -rsT   multiple matching bookmarks to rebase - please rebase to an explicit rev or bookmarks<   run 'hg heads' to see all heads, specify destination with -d)   merges   rebasesM   no matching bookmark to merge - please merge with an explicit rev or bookmarksM   no matching bookmark to rebase - please rebase to an explicit rev or bookmarks<   branch '%s' has %d heads - please merge with an explicit revs2   run 'hg heads .' to see heads, specify rev with -rs;   branch '%s' has %d heads - please rebase to an explicit revs:   run 'hg heads .' to see heads, specify destination with -ds8   heads are bookmarked - please merge with an explicit revs7   heads are bookmarked - please rebase to an explicit revs<   branch '%s' has one head - please merge with an explicit revs;   branch '%s' has one head - please rebase to an explicit revs   nothing to mergeNs   nothing to rebases   use 'hg update' insteads(   working directory not at a head revisions2   use 'hg update' or merge with an explicit revisions1   use 'hg update' or rebase to an explicit revisions   source set is emptys)   source set is rooted in multiple branchess.   rebaseset is rooted in multiple named branchess+   specify an explicit destination with --dest)
   toomanybookmarks   nootherbookmarks   toomanyheads   bookmarkedheads   nootherbranchheads   nootherheads   nootherheadsbehind
   notatheads   emptysourceset   multiplebranchessourcesetc                    d}t        j                  |       }| j                  | j                     }t	        |      dk(  r||d   k(  r|d   }nn|d   }nht	        |      dkD  r&t
        d   |   \  }}t        j                  ||      t	        |      dk  r&t
        d   |   \  }}t        j                  ||      |J |S )z2find merge destination in the active bookmark caseN       r   rJ   hintrK   )	r   headsforactiver4   _activebookmarklenmsgdestmerger   ManyMergeDestAbortNoMergeDestAbort)	r   action	sourceset	destspacer   bmheadscurheadmsgrX   s	            r    _destmergebookre     s    D&&t,Good223G
7|qgaj 1:D1:D	W	 !45f=	T&&s66	W	 !45f=	T$$St44Kr"   c                    d}|G| | j                   j                            j                         g}| j                   j                         }n|s&t        d   |   \  }}t        j                  ||      d}| j                  d||      D ]M  }	|9|	j                         |k7  r&t        d   |   \  }}t        j                  ||      |	j                         }O | j                  |      }
| j                  d||
      }|rT|sRt        | j                               dk  rt        d   |   \  }}nt        d	   |   \  }}t        j                  ||      t        | j                  d
|
|            }
t        | j                  d|
            }|t        | j                  d||            }t        |      dkD  r9t        d   |   \  }}||t        |
      dz   fz  }t        j                  ||      |s{|
rt        d   |   \  }}nRt        | j                               dkD  rt        d   |   \  }}||z  }n!|st        d   |   \  }}nt        d   |   \  }}t        j                  ||      |d   }|J |S )z,find merge destination based on branch headsNrR   rW   s   roots(%ld::%ld)rS   s   %ld and %lnr   rP   rQ   s   %ln - (%ld::)s   %ld - bookmark()s   %ld and %ldrL   rM   rN   rO   rV   )dirstater%   r   r9   r\   r   r^   r   r]   r;   r(   r[   r=   Abortr   )r   r_   r`   onheadcheckra   r   r9   rd   rX   ctxbheadsonheadnbhss                r    _destmergebranchrn   1  s    D$--**,-1134	%%' !23F;	T$$St4488.	9E 	"C!cjjlf&<()EFvN	T..s>>ZZ\F		" f%FYY~y&9F6 tzz|!$%:;FCIC$]3F;ICkk#D))$)),fi@AF		-v67D DIIni>?
4y1} !1&9	TFa((&&s66
 $%78@IC"$%:;FCIC6MC %%:;FCIC$_5f=IC$$St44AwKr"   c                     | j                   rt        | |||      }nt        | ||||      }| |   j                         S )zreturn the default destination for a merge

    (or raise exception about why it can't pick one)

    :action: the action being performed, controls emitted error message
    )r_   r`   ra   )r_   r`   ri   ra   )rZ   re   rn   r   )r   r_   r`   ri   ra   r   s         r    	destmergerp   z  sN     9	
  #
 :>>r"   c                     | j                  dd      }|t        j                  |      }n8|rt        j                  ||g      }nt        j                  t        d            |r|j                         S y)z0Default base revision to edit for `hg histedit`.s   histedits
   defaultrevNs0   config option histedit.defaultrev can't be empty)	configr   getstackr   revranger   ConfigErrorr   min)r3   r   defaultr(   s       r    desthisteditrx     sl    ii]3G~~d#	wi0AB
 	
 xxzr"   c                 T    t        j                  |      }|r|j                         S d S )N)r   rs   r)   )r3   r   r(   s      r    	stackbaserz     s#    >>$D4::<)T)r"   c                 (   t        j                  |      }|j                  |j                     }|j	                  d|      rM|D cg c]
  }||k7  s	| }}|r5t        d      }| j                  |t        |      |j                  fz         y y y c c}w )Ns   %n and parents()s&   %i other divergent bookmarks for "%s"
)r   rY   r4   rZ   r(   r   statusr[   )r3   r   rb   rc   brd   s         r    _statusotherbookr~     s    &&t,Good223Gyy$g.%6A166>?CIIcS\4+?+?@@A  /6s   
BBc                    |j                   j                         }|j                  |d      }|j                  |      }|j                  d|      r|j                  d|      }|d   j	                         rd| j                  t        d      |z         |r'| j                  t        d      t        |      z         y | j                  t        d      |z         y |rm|d   }| j                  t        d	      ||j                         j                  d
      d   fz         | j                  t        d      t        |      |fz         y y y )NTr@   s   %ln and parents()s   %ln - parents()r$   sC   no open descendant heads on branch "%s", updating to a closed head
sJ   (committing will reopen the head, use 'hg heads .' to see %i other heads)
s%   (committing will reopen branch "%s")
s   updated to "%s: %s"
   
rV   s   %i other heads for branch "%s"
)rg   r9   r;   r(   closesbranchwarnr   r[   r|   descriptionsplit)r3   r   r<   allheadsr=   
otherheadsrc   s          r    _statusotherbranchheadsr     sS   MM((*Md;H]+Eyy%x0 YY159
:""$GG3  	  E :	( ?@=P 4jGII*+G//177>qABC II56z?M23 ? 1r"   c                 N    |j                   rt        | |       yt        | |       y)zPrint message about other headN)rZ   r~   r   )r3   r   s     r    statusotherdestsr     s!    
 T"D)r"   )F)rI   NN)rI   NTN)i18nr    r   r   r   r   r   r!   r0   r6   r>   rC   rE   rF   rH   r\   re   rn   rp   rx   rz   r~   r   r    r"   r    <module>r      s    7 7D( V& 6 0 L !  0	 %2 B EF
 A MN
& A EF
 @ MN
& MNCD

 LMKL
	 IJEF

 HIMN
	 MNEF

 LMMN
	 ()40*+T2 ()1-G+HI*+Q/I-JK 9:CD

 9:BC
	 +,d3,-t4
 ABDI?@<=
#{dN* HLFT HL4(*
B,^*r"   