HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/mercurial/__pycache__/rewriteutil.cpython-310.pyc
o

�]Lb�!�@s�ddlmZddlZddlmZddlmZmZddlm	Z	mZm
Z
mZmZm
Z
mZe�d�Zdd	d
�Zdd
d�Zdd�Zdd�Zdd�Zdd�Zddd�ZdS)�)�absolute_importN�)�_)�hex�nullrev)�error�node�obsolete�obsutil�revset�scmutil�utils\b[0-9a-f]{6,64}\b�csf|jj�t|�}||kr�fdd�|D�}d�|�}|S|��}td�}|t��|��|df;}|S)z�returns 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
    csg|]	}t��|���qS�)r�short��.0�r��tonoder�7/usr/lib/python3/dist-packages/mercurial/rewriteutil.py�
<listcomp>+sz_formatrevs.<locals>.<listcomp>s, s%s and %d othersr)�	changelogr�len�join�firstrr)�repo�revs�maxrevs�numrevs�shorts�summaryrrrr�_formatrevs s
�r"�rewriteTc
Cs�t|vrtd�|}td�}tj||d��tdd�|D��r+|j�d�dd�|D�}t|d���d	kr>t�	td
�|��|�
d|�}|r^t||�}td�||f}td
�}tj||d��t||�}|rxtd�}tjtd�|t|�f|d��|s|dSt
�|t
j�s�t||�}	|	r�|	\}
}}td�||
|f}|
��|��kr�|td�|7}|jjr�|
��|��kr�|td�|
|f7}|td�|||
f7}tj|td�d��tj|td�d��dSdS)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.
    scannot %s the null revisionsno changeset checked out)�hintcss�|]	}t�|d�VqdS)�revN)r
�safehasattrrrrr�	<genexpr>Bs�zprecheck.<locals>.<genexpr>s-rewriteutil.precheck called with ctx not revscss�|]}|��VqdS�N)r%rrrrr'Ds�Nrs"cannot %s changesets while mergings%ld and public()scannot %s public changesets: %ss see 'hg help phases' for detailss#see 'hg help evolution.instability's7cannot %s changeset, as that will orphan %d descendantss8cannot %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 checksEsee 'hg help evolution.instability' for details on content-divergences@add --verbose for details or see 'hg help evolution.instability')rrr�
InputError�any�ui�	develwarnr�parents�
StateErrorrr"�disallowednewunstabler	�	isenabled�allowdivergenceopt�_find_new_divergencer%�verbose)
rr�action�check_divergence�msgr$�
publicrevsr!�newunstable�new_divergence�	local_ctx�	other_ctx�base_ctxrrr�precheck4s�	
�


��

������������r=cCs(t�|tj�}|r
t��S|�d||�S)z�Checks 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	r0�allowunstableoptr�basesetr)rr�
allowunstablerrrr/�sr/cCsR|�d|�}|D]}t|||�}|r&||||d|��|dfSqdS)Ns%ld and obsolete()rr)r�find_new_divergence_from�
unfiltered)rr�obsrevsr�divrrrr2�s&�r2cCsl|��sdSt�||���}|r|dd|��fSt�||�}|r4|dd}|dd}|d|fSdS)z�return divergent revision if rewriting an obsolete cset (ctx) will
    create divergence

    Returns (<other node>, <common ancestor node>) or None
    Nrsdivergentnodesscommonpredecessor)r	r
�successorssetsr�
divergentsets)r�ctx�sset�divsets�nsuccset�precrrrrA�srAcCs:|�dd�}|dkrdS|dkrdSt�td�||f��)Nr#sempty-successorsskipTskeepFsf%s doesn't know how to handle config rewrite.empty-successor=%s (only 'skip' and 'keep' are supported))�configr�ConfigErrorr)r+�command�empty_successorrrr�skip_empty_successor�s���rPc	Cs|si}i}t�t|�}|��}|D]x}zt�||�}Wn
tjy&Yqw|dur,q||}|��sB|�	|�}	|	dur>q|	g}	n
t
j||��|d�}	t
|	�dkr�t
|	d�dkr�|	dd}
|
durut|
�}|�||dt
|���}q|j�td�|�q|j�td�|�q|S)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)�cacherrsbThe 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_RErBr�resolvehexnodeidprefixr�WdirUnsupportedr	�getr
rErrr�replacer+�noter)r�	commitmsg�pendingrQ�hashes�unfi�h�fullnoderG�
successors�	successor�newhashrrr�update_hash_refs�sP
�
������rc)r)r#Tr()�
__future__rrR�i18nrrrr�rr	r
rrr
�compilerTr"r=r/r2rArPrcrrrr�<module>s$


T