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__/directory_service.cpython-39.pyc
a

�*�^��@s�dZddlmZddlmZmZddlmZee�d�Gdd�dej�Z	Gd	d
�d
e	�Z
Gdd�de	�ZGd
d�dej�Z
e
�ZGdd�de�ZGdd�de�Ze�ded�Gdd�de�Ze�ded�dS)z�Directory service registration and usage.

Directory services are utilities that provide a mapping from URL-like strings
to true URLs.  Examples include lp:urls and per-user location aliases.
�)�absolute_import�)�errors�registry)�lazy_importzh
from breezy import (
    branch as _mod_branch,
    controldir as _mod_controldir,
    urlutils,
    )
c@seZdZdZdS)�DirectoryLookupFailurezBase type for lookup errors.N)�__name__�
__module__�__qualname__�__doc__�rr�:/usr/lib/python3/dist-packages/breezy/directory_service.pyr'src@seZdZdZdd�ZdS)�InvalidLocationAliasz/"%(alias_name)s" is not a valid location alias.cCstj||d�dS)N��
alias_name�r�__init__��selfrrrr
r/szInvalidLocationAlias.__init__N�rr	r
Z_fmtrrrrr
r+src@seZdZdZdd�ZdS)�UnsetLocationAliasz$No %(alias_name)s location assigned.cCstj||dd�d�dS)Nrrrrrrr
r7szUnsetLocationAlias.__init__Nrrrrr
r3src@seZdZdZddd�ZdS)�DirectoryServiceRegistrya�This object maintains and uses a list of directory services.

    Directory services may be registered via the standard Registry methods.
    They will be invoked if their key is a prefix of the supplied URL.

    Each item registered should be a factory of objects that provide a look_up
    method, as invoked by dereference.  Specifically, look_up should accept a
    name and URL, and return a URL.
    NcCsZ|�|�}|dur|S|\}}|�}z|j|||d�WStyT|�||�YS0dS)a�Dereference a supplied URL if possible.

        URLs that match a registered directory service prefix are looked up in
        it.  Non-matching urls are returned verbatim.

        This is applied only once; the resulting URL must not be one that
        requires further dereferencing.

        :param url: The URL to dereference
        :param purpose: Purpose of the URL ('read', 'write' or None - if not declared)
        :return: The dereferenced URL if applicable, the input URL otherwise.
        N)�purpose)Z
get_prefix�look_up�	TypeError)r�urlr�matchZservice�nameZ	directoryrrr
�dereferenceFs
z$DirectoryServiceRegistry.dereference)N)rr	r
rrrrrr
r;s
rc@seZdZdZddd�ZdS)�	Directoryz Abstract directory lookup class.NcCst|j��dS)aLook up an entry in a directory.

        :param name: Directory name
        :param url: The URL to dereference
        :param purpose: Purpose of the URL ('read', 'write' or None - if not declared)
        :return: The dereferenced URL if applicable, the input URL otherwise.
        N)�NotImplementedErrorr)rrrrrrr
reszDirectory.look_up)N�rr	r
rrrrrr
rbsrc@s�eZdZdZe��Zejddd�dd�ejddd�d	d�ejd
dd�dd�ejd
dd�dd�ejddd�dd�ejddd�dd�ddd�Ze	dd��Z
dS)�AliasDirectoryz�Directory lookup for locations associated with a branch.

    :parent, :submit, :public, :push, :this, and :bound are currently
    supported.  On error, a subclass of DirectoryLookupFailure will be raised.
    �parentcCs|��S�N)Z
get_parent��brrr
�<lambda>x�zAliasDirectory.<lambda>zThe parent of this branch.)�helpZsubmitcCs|��Sr$)Zget_submit_branchr%rrr
r'zr(z"The submit branch for this branch.ZpubliccCs|��Sr$)Zget_public_branchr%rrr
r'|r(z#The public location of this branch.�boundcCs|��Sr$)Zget_bound_locationr%rrr
r'~r(z7The branch this branch is bound to, for bound branches.�pushcCs|��Sr$)Zget_push_locationr%rrr
r'�r(z9The saved location used for `brz push` with no arguments.�thiscCs|jSr$)�baser%rrr
r'�r(zThis branch.Nc	Cs�tj�d�d}|�dd�}t|�dkr2|\}}n
|\}d}z|j�|dd��}Wntynt|��Yn
0||�}|dur�t	|��|dur�t
�||�}|S)N�.r�/r�)Z_mod_branchZBranch�open_containing�split�len�branch_aliases�get�KeyErrorrr�urlutils�join)	rrrr�branch�partsZextra�method�resultrrr
r�s 
zAliasDirectory.look_upcCs@g}|j��D]"}|j�|�}|�d||f�qdd�|�S)Nz  :%-10s%s
aLocation aliases
================

Bazaar defines several aliases for locations associated with a branch.  These
can be used with most commands that expect a location, such as `brz push`.

The aliases are::

%s
For example, to push to the parent location::

    brz push :parent
�)r4�keysZget_help�appendr8)�clsZtopicZalias_lines�keyr)rrr
�	help_text�s
�zAliasDirectory.help_text)N)rr	r
rr�Registryr4�registerr�classmethodrBrrrr
r"ps.������
r"�:z*Easy access to remembered branch locationsc@seZdZdZddd�ZdS)�ColocatedDirectoryz�Directory lookup for colocated branches.

    co:somename will resolve to the colocated branch with "somename" in
    the current directory.
    NcCs(tj�d�d}t�|jdt�|�i�S)Nr.rr9)Z_mod_controldirZ
ControlDirr1r7Zjoin_segment_parametersZuser_url�escape)rrrr�dirrrr
r�s�zColocatedDirectory.look_up)Nr!rrrr
rG�srGzco:z!Easy access to colocated branchesN)rZ
__future__rr=rrr�globalsZBzrErrorrrrrCrZdirectories�objectrr"rDrGrrrr
�<module>s$	$?�
�