HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/reconfigure.cpython-39.pyc
a

�*�^|E�@s2dZddlmZddlmZmZmZmZmZm	Z	ddl
mZGdd�dej�Z
Gdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�Zd$S)%z�Reconfigure a controldir into a new tree/branch/repository layout.

Various types of reconfiguration operation are available either by
constructing a class or using a factory method on Reconfigure.
�)�absolute_import�)�branch�
controldir�errors�trace�ui�urlutils)�gettextc@seZdZdd�ZdS)�BzrDirErrorcCs$t�|jd�}tjj|||d�dS)N�ascii)r�display_url)r	�unescape_for_display�user_urlr�BzrError�__init__)�selfrr
�r�4/usr/lib/python3/dist-packages/breezy/reconfigure.pyr*s�
�zBzrDirError.__init__N)�__name__�
__module__�__qualname__rrrrrr(src@seZdZdZdS)�NoBindLocationz9No location could be found to bind to at %(display_url)s.N�rrr�_fmtrrrrr1src@seZdZdZdd�ZdS)�UnsyncedBrancheszY'%(display_url)s' is not in sync with %(target_url)s.  See brz help sync-for-reconfigure.cCs.tj�||�ddlm}|�|jd�|_dS)Nr)r	r)rrr�r	r�baseZ
target_url)rrZ
target_branchr	rrrr;s
�zUnsyncedBranches.__init__N)rrrrrrrrrr6src@seZdZdZdS)�
AlreadyBranchz&'%(display_url)s' is already a branch.NrrrrrrBsrc@seZdZdZdS)�AlreadyTreez$'%(display_url)s' is already a tree.NrrrrrrGsrc@seZdZdZdS)�AlreadyCheckoutz('%(display_url)s' is already a checkout.Nrrrrrr Lsr c@seZdZdZdS)�AlreadyLightweightCheckoutz4'%(display_url)s' is already a lightweight checkout.Nrrrrrr!Qsr!c@seZdZdZdS)�AlreadyUsingSharedz7'%(display_url)s' is already using a shared repository.Nrrrrrr"Vsr"c@seZdZdZdS)�AlreadyStandalonez('%(display_url)s' is already standalone.Nrrrrrr#[sr#c@seZdZdZdS)�AlreadyWithTreeszBShared repository '%(display_url)s' already creates working trees.Nrrrrrr$`sr$c@seZdZdZdS)�AlreadyWithNoTreeszIShared repository '%(display_url)s' already doesn't create working trees.Nrrrrrr%fsr%c@seZdZdZdS)�ReconfigurationNotSupportedz@Requested reconfiguration of '%(display_url)s' is not supported.Nrrrrrr&lsr&c@seZdZdZdd�ZdS)�ReconfigureStackedOnz6Reconfigures a branch to be stacked on another branch.cCsx|��}t�|jt�|��}|���@|�|�t��sVt	j
�td��
|j|����Wd�n1sj0YdS)Nz{0} is now stacked on {1}
)�open_branchr	Zrelative_urlrZ
normalize_url�
lock_write�set_stacked_on_urlr�is_quietr�
ui_factory�noter
�formatZget_stacked_on_url)rrZstacked_on_urlrZon_urlrrr�applyts�

�
�zReconfigureStackedOn.applyN)rrr�__doc__r/rrrrr'qsr'c@seZdZdd�ZdS)�ReconfigureUnstackedcCs^|��}|���:|�d�t��s<tj�td�|j	f�Wd�n1sP0YdS)Nz%s is now not stacked
)
r(r)r*rr+rr,r-r
r)rrrrrrr/�s

��zReconfigureUnstacked.applyN)rrrr/rrrrr1�sr1c@s�eZdZddd�Zedd��Zedd��Zed dd	��Zed!d
d��Z	edd
��Z
edd��Zedd��Zdd�Z
d"dd�Zdd�Zdd�Zdd�Zd#dd�ZdS)$�ReconfigureNcCs*||_||_d|_z|j��|_Wn tjyBd|_d|_Yn"0|jj|jjkr^|j|_nd|_z4|j��}|j|jkr�||_	d|_
nd|_	||_
Wn tjy�d|_	d|_
Yn0z|��|_
Wntjy�d|_
Yn0d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)NF)r�new_bound_location�local_repository�find_repository�
repositoryrZNoRepositoryPresentrr(�local_branch�referenced_branchZNotBranchErrorZopen_workingtree�treeZ
NoWorkingTree�_unbind�_bind�_destroy_reference�_create_reference�_destroy_branch�_create_branch�
_destroy_tree�_create_tree�_create_repository�_destroy_repository�_repository_trees)rrr3rrrrr�sH


zReconfigure.__init__cCs.t|�}|jddddd�|��s*t|��|S)z�Return a Reconfiguration to convert this controldir into a branch

        :param controldir: The controldir to reconfigure
        :raise AlreadyBranch: if controldir is already a branch
        FT��	want_tree�want_branch�
want_bound�want_reference)r2�
_plan_changes�changes_plannedr�r�reconfigurationrrr�	to_branch�s�zReconfigure.to_branchcCs.t|�}|jddddd�|��s*t|��|S)z�Return a Reconfiguration to convert this controldir into a tree

        :param controldir: The controldir to reconfigure
        :raise AlreadyTree: if controldir is already a tree
        TFrE)r2rJrKrrLrrr�to_tree�s�zReconfigure.to_treecCs0t||�}|jddddd�|��s,t|��|S)aReturn a Reconfiguration to convert this controldir into a checkout

        :param controldir: The controldir to reconfigure
        :param bound_location: The location the checkout should be bound to.
        :raise AlreadyCheckout: if controldir is already a checkout
        TFrE)r2rJrKr )rZbound_locationrMrrr�to_checkout�s
�zReconfigure.to_checkoutcCs0|||�}|jddddd�|��s,t|��|S)a?Make a Reconfiguration to convert controldir into a lightweight checkout

        :param controldir: The controldir to reconfigure
        :param bound_location: The location the checkout should be bound to.
        :raise AlreadyLightweightCheckout: if controldir is already a
            lightweight checkout
        TFrE)rJrKr!)�klassrZreference_locationrMrrr�to_lightweight_checkout�s	
�z#Reconfigure.to_lightweight_checkoutcCs(||�}|jdd�|��s$t|��|S)z4Convert a standalone branch into a repository branchT��
use_shared)�_set_use_sharedrKr"�rQrrMrrr�
to_use_shared�s
zReconfigure.to_use_sharedcCs(||�}|jdd�|��s$t|��|S)z4Convert a repository branch into a standalone branchFrS)rUrKr#rVrrr�
to_standalone�s
zReconfigure.to_standalonecCsV||�}|j��st|j��|r4|j��r4t|��n|sL|j��sLt|��n||_|S)z3Adjust a repository's working tree presence default)r6�	is_sharedr&rZmake_working_treesr$r%rD)rQrZ
with_treesrMrrr�set_repository_treess


�
z Reconfigure.set_repository_treescCs|s|st|j��|r$|r$t|j��|jdur:|s^d|_n$|r^|jj|jjkr^|j��s^d|_|jdur�|r�d|_|j	dur�d|_
n
|s�d|_|j	dur�|dur�d|_|r�d|_
n.|r�|j	��dur�d|_
n|j	��dur�d|_|s�|jdur�d|_|�r|jdu�rd|_dS)z>Determine which changes are needed to assume the configurationNT)r&rr6rBrrYrCr8r=r7r>r<r?r;�get_bound_locationr:r9r@rA)rrFrGrHrIrrrrJsB


�



zReconfigure._plan_changescCs6|durdS|r"|jdur2d|_n|jdur2d|_dS)NT)r4rCrB)rrTrrrrU=s

zReconfigure._set_use_sharedcCs6|jp4|jp4|jp4|jp4|jp4|jp4|jp4|jp4|jS)z3Return True if changes are planned, False otherwise)	r:r;r@rAr<r?rBr=rC)rrrrrKGs������zReconfigure.changes_plannedcCs^|jr|j��rt�|j��|jrZ|jdurZtj�	|�
��}|��|j��krZt|j
|��dS)z4Raise if reconfiguration would destroy local changesN)r@r9Zhas_changesrZUncommittedChangesr=r7r�Branch�open�_select_bind_location�
last_revisionrr)r�reference_branchrrr�_checkNs�zReconfigure._checkcCs�|jdur|jS|jdurt|j��}|dur0|S|j��}|durF|S|j��}|dur\|S|j��}|dur�|Sn|jdur�|jjSt|j	��dS)a�Select a location to bind or create a reference to.

        Preference is:
        1. user specified location
        2. branch reference location (it's a kind of bind location)
        3. current bind location
        4. previous bind location (it was a good choice once)
        5. push location (it's writeable, so committable)
        6. parent location (it's pullable, so update-from-able)
        N)
r3r7r[Zget_old_bound_locationZget_push_locationZ
get_parentr8rrr)r�boundZ	old_boundZ
push_location�parentrrrr^Xs$






z!Reconfigure._select_bind_locationFcCs�|s|��|jr�|jr(|js(|jj}n|jrB|jdurB|jj}nd}|durV|j}nd}|durp|�|j	�}n
|j	�
�}|jr�|js�|�|jj|j���n|j}|jr�|jdur�|�|jj|j���|j
r�tj�|���}|j�rD|j
r�|j�|j�nF|jdu�rD|j�sD|jj�d�}t	j�|�d}|��}|�|j�d}	|j�rd|j��}	|j	��|j�r�|j��}	|j
�r�|jj�|j�|j	��|j�r�|j	��}
|	du�r�|
j|	�|j�r�|jj�|
j�|j�|
�n|j}
|j
�r�|j	� |�|j!�r|j	�"�|j#�r"|j	�$�|j%�r4|j�&�|j'�rV|��}|
�(tj�|��|j�rh|j	�)�|j*du�r�|�+|j*�dS)a~Apply the reconfiguration

        :param force: If true, the reconfiguration is applied even if it will
            destroy local changes.
        :raise errors.UncommittedChanges: if the local tree is to be destroyed
            but contains uncommitted changes.
        :raise NoBindLocation: if no bind location was specified and
            none could be autodetected.
        Nz..r),rarBr7r>r6r?r8Z_formatZ
initializerZcreate_repositoryZfetchr_r=rr\r]r^rCZuser_transportZcloneZ
ControlDirZopen_containing_from_transportr5r<�last_revision_infoZdestroy_branchZtagsZmerge_toZ
create_branchZset_last_revision_infoZupdate_referencesZset_branch_referencer@Zdestroy_workingtreerAZcreate_workingtreer:Zunbindr;ZbindZdestroy_repositoryrDZset_make_working_trees)rZforceZold_repoZrepository_formatZrepor`ZupZ
up_controldirZnew_repordr7Z
bind_locationrrrr/vs�




�
���










zReconfigure.apply)N)N)N)N)F)rrrr�staticmethodrNrOrP�classmethodrRrWrXrZrJrUrKrar^r/rrrrr2�s*
)






(


r2N)r0Z
__future__rrrrrrrr	Zi18nr
rrrrrrr r!r"r#r$r%r&�objectr'r1r2rrrr�<module>s$