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/hgext/convert/__pycache__/bzr.cpython-310.pyc
o

^�Ub|0�@s�ddlmZddlZddlmZddlmZmZmZm	Z	ddl
mZej�
gd��z"ddlZddlZddlZddlZejjZejZejZejZejWn	eyUYnwdZGd	d
�d
ej�ZdS)�)�absolute_importN)�_)�demandimport�error�pycompat�util�)�common)sbreezy.transactionssbreezy.urlutilssElementPath)�file�symlinkcs�eZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Z�ZS)�
bzr_sourcez>Reads Bazaar repositories by using the Bazaar Python librariesNcs�tt|�j||||d�tj�tj�|d��s t�t	d�|��zt
Wnty8t�t	d�t	d�d��wt�
|�}|�|�zt
j�|���}|��|_Wntjyct�t	d�|��wi|_|�dd�|_dS)	N)�revss.bzrs)%s does not look like a Bazaar repositorys"Bazaar modules could not be loadeds  (try installing the %s package)sbzrsconvertsbzr.saverev)�superr�__init__�os�path�exists�joinr	�NoRepor�bzrdir�	NameErrorr�abspath�_checkrepotype�BzrDir�open�decode�open_repository�
sourcerepo�errors�NoRepositoryPresent�
_parentids�
configbool�_saverev)�self�ui�repotyperr
�bzr_dir��	__class__��3/usr/lib/python3/dist-packages/hgext/convert/bzr.pyr7s0
�

��


��zbzr_source.__init__c	Cs�zHtj�|���d}z|jdd�}|j}Wntjtjfy)d}|�	�}Ynw|durC|j
jj|j
jjkrF|j
�td��WdSWdSWdStyZ|j
�td��YdSw)NrF)�recommend_upgradesawarning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
s(bzr source type could not be determined
)rr�open_containingr�open_workingtree�branchr�
NoWorkingTree�NotLocalUrl�open_branch�
controldir�root_transport�baser$�warnr�	Exception�note)r#r�dir�treer.r)r)r*rRs.
���
��
�zbzr_source._checkrepotypecCs|j��dS)aBefore the conversion begins, acquire a read lock
        for all the operations that might need it. Fortunately
        read locks don't block other reads or writes to the
        repository, so this shouldn't have any impact on the usage of
        the source repository.

        The alternative would be locking on every operation that
        needs locks (there are currently two: getting the file and
        getting the parent map) and releasing immediately after,
        but this approach can take even 40% longer.N)r�	lock_read�r#r)r)r*�beforelszbzr_source.beforecCs|j��dS�N)r�unlockr;r)r)r*�aftery�zbzr_source.aftercCs|jjdd�S)NT)�using)r�
find_branchesr;r)r)r*�_bzrbranches|r@zbzr_source._bzrbranchesc	Cs�|jstdd�|��D��}n>d}|��D]$}z|jd��}tj�|�}|�|�}Wn
tj	y5Ynw|j
}q|durJt�t
d�|jd��|g}dd�|D�}|S)NcSsg|]}|���qSr))�
last_revision)�.0�br)r)r*�
<listcomp>��z'bzr_source.getheads.<locals>.<listcomp>rs%s is not a valid revisioncSsg|]}|dkr|�qS)snull:r))rE�hr)r)r*rG��)r
�sortedrCr�revisionspec�RevisionSpec�from_string�
in_historyr�BzrError�rev_idr�Abortr)r#�heads�revidr.�revspec�r�infor)r)r*�getheadss&��zbzr_source.getheadscCs�|��}|j�|�}z|�|�}WntjjyYdSw|tvr$dS|j|�	�|f}|dkrK|�
|�}|durEt�t
d�||f��|�	�|fS|�|�}|��|fS)N)NNrs%s.%s symlink has no target)rr�
revision_tree�kind�breezyr�
NoSuchFile�supportedkinds�
_modecache�encode�get_symlink_targetrrRr�get_file�read)r#�name�rev�revtreerZ�mode�target�sior)r)r*�getfile�s&�
�
zbzr_source.getfilecCs`|r	t�td���i|_|j�|�|_|j�|�}|j�|d�}|�	|j|�\}}||t
�fS)Ns(convert from cvs does not support --fullr)rrRrr^rrY�_revtreer �pop�_gettreechanges�set)r#�version�full�	parentids�prevtree�files�changesr)r)r*�
getchanges�szbzr_source.getchangesc	Cs�|j�|�}|jsg}tjf|j|<n|�|j�}||j|<|j�dd�}|dkr+d}t	j
|d|j|jf|�
|j�|�
|j�|�d�||jd�S)Nzbranch-nick�default�trunks%d %d�utf8)�parents�date�author�descr.rd�saverev)r�get_revision�
parent_ids�revision�
NULL_REVISIONr �
_filterghosts�
properties�getr	�commit�	timestamp�timezone�recode�	committer�messager_r")r#rnrdrxr.r)r)r*�	getcommit�s$


�zbzr_source.getcommitcCsRi}|��D] }|��siS|j��}t�|�D]\}}|||�|�<qq|Sr=)rC�
supports_tags�tags�get_tag_dictr�	iteritemsr�)r#�bytetagsr.�tagdictrcrdr)r)r*�gettags�s
�zbzr_source.gettagscCsZi|_|j�|�}|dur|j||}ntj}|j�|�}dd�|�||�dD�}|S)NcS�g|]}|d�qS)rr)�rE�er)r)r*rG�rHz.bzr_source.getchangedfiles.<locals>.<listcomp>r)r^rrYr rr�rl)r#rd�i�curtree�parentidrqrsr)r)r*�getchangedfiles�szbzr_source.getchangedfilescCsv|j}g}i}t�}z|j}Wnty|j}Ynwdd�}t|�|�|dd�}	|	D�]	}
|
j}|
j}|
j	}
|ddksD|ddkrEq,|ddkr�|dd	vr]|�
|�|d�|f�|ddkr�d|vr�|d|dk}|�|d�}|�
|�D]T\}}|jdkr�q{|�|dd
|�}||vr�q{|�|�|s�q{|�|dd
|�}|�
||f�|�
||f�|j	r�dp�|jdko�d
p�d}||j||f<|||<q{q,|\}}|dur�|�|�}|dur�|�|�}|�|p�|�|dur�|�
||f�q,|�r
||k�r
|||<|�
||f�dd�||
fD�\}}
|
�rd�p'|dk�r&d�p'd}||j||f<|�
||f�q,||fS)NcSs|jdp|jdpdS)Nrr�)r)�cr)r)r*�key�sz'bzr_source._gettreechanges.<locals>.keyT)r��reverserr�r�	directory)Nr��/�xr�s�cSr�)rr)r�r)r)r*rGGrHz.bzr_source._gettreechanges.<locals>.<listcomp>�l)�_revision_idrm�root_inventory�AttributeError�	inventoryrK�iter_changesrrZ�
executable�appendr��path2id�iter_entries�addr^)r#�current�originrTrs�renames�seenr�r��
curchanges�change�pathsrZr��renaming�subdirrc�entry�frompath�topathrfrr)r)r*rl�s�

��



��


 zbzr_source._gettreechangescs&|j�|��t�fdd�|D��}|S)zqFilters out ghost revisions which hg does not support, see
        <http://bazaar-vcs.org/GhostRevision>
        csg|]}|�vr|�qSr)r))rE�parent��	parentmapr)r*rGSrJz,bzr_source._filterghosts.<locals>.<listcomp>)r�get_parent_map�tuple)r#�idsrxr)r�r*r�Nszbzr_source._filterghostsr=)�__name__�
__module__�__qualname__�__doc__rrr<r?rCrXrirtr�r�r�rlr��
__classcell__r)r)r'r*r4s


gr)�
__future__rr�mercurial.i18nr�	mercurialrrrrr�r	�IGNORES�update�breezy.bzr.bzrdirr[�
breezy.errors�breezy.revision�breezy.revisionspec�bzrrrrrLrM�ImportErrorr]�converter_sourcerr)r)r)r*�<module>s.
�
�