File: //kunden/lib/python3/dist-packages/breezy/__pycache__/uncommit.cpython-39.pyc
a
�*�^= � @ sN d Z ddlmZ ddlmZmZ ddlmZ ddlm Z dd� Z
d
dd�Zd
S )z@Remove the last revision from the history of the current branch.� )�absolute_import� )�errors�revision)�Branch)�BoundBranchOutOfDatec
C sZ | j �� }|�||�}g }|�� D ]2\}}||vr4q"|D ]} | j �| � |�| � q8q"|S )a Remove tags on revisions between old_tip and new_tip.
:param branch: Branch to remove tags from
:param graph: Graph object for branch repository
:param old_tip: Old branch tip
:param parents: New parents
:return: Names of the removed tags
)�tagsZget_reverse_tag_dictZfind_unique_ancestors�itemsZ
delete_tag�append)
�branch�graph�old_tip�parentsZreverse_tagsZ ancestorsZremoved_tagsZrevidr �tag� r �1/usr/lib/python3/dist-packages/breezy/uncommit.py�remove_tags s
r FNc C sh g }�zB|dur"|� � |�|� | � � |�| � g }|durP|�� dd� }|rnd} | �� du r�t�� �n"| �� } | dur�| � � |�| � | �� \}
}| dur�|| �� kr�t | | ��|du r�|
}|d }|
}
|}| j
�� }|�|�D ]h}|
|k�r|} �qZ|�rt
d|
|f � |
d8 }
|�|g��|d�}|�s<q�|�t|dd� �� q�tj}|�s.| du�rv| �||� | �||� | du �r�d}| }n| }| }tjd D ],}|}|tjk�r�d}||||
|||� �q�t�|��s�|g}ng }|du�r|�t|�� |�|� | �� �r.|�s.t| |||� W t|�D ]}|�� �q8nt|�D ]}|�� �qR0 dS )a� Remove the last revision from the supplied branch.
:param dry_run: Don't actually change anything
:param verbose: Print each step as you do it
:param revno: Remove back to this revision
:param local: If this branch is bound, only remove the revisions from the
local branch. If this branch is not bound, it is an error to pass
local=True.
:param keep_tags: Whether to keep tags pointing at the removed revisions
around.
Nr zRemoving revno %d: %sZ
post_uncommit)Z
lock_writer
Zget_parent_idsZget_bound_locationr ZLocalRequiresBoundBranchZget_master_branchZlast_revision_infoZ
last_revisionr Z
repositoryZ get_graphZiter_lefthand_ancestry�printZget_parent_map�get�extend�reversed�
_mod_revisionZ
NULL_REVISIONZset_last_revision_infor ZhooksZis_nullZset_parent_idsZ
supports_tagsr Zunlock)r Zdry_run�verboseZrevnoZtreeZlocalZ keep_tagsZ
unlockableZpending_mergesZmasterZ old_revnor
Z new_revnoZ cur_revnoZnew_revision_idr Zrev_idr Z
hook_localZhook_master�hookZhook_new_tip�itemr r r �uncommit4 s�
�
�r )FFNNFF)�__doc__Z
__future__r � r r r r r r r r r r r r �<module> s �