Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/hgext/__pycache__/ |
Upload File : |
o �]Lb\ � @ s� d Z ddlmZ ddlZddlZddlmZ ddlmZm Z m Z mZmZm Z ddlmZ i Ze�e�ZdZe�d�ZG d d � d e�Zdd� Zd ddddd�Zdd� Zeddd�dd� �ZdS )a' extend schemes with shortcuts to repository swarms This extension allows you to specify shortcuts for parent URLs with a lot of repositories to act like a scheme, for example:: [schemes] py = http://code.python.org/hg/ After that you can use it like:: hg clone py://trunk/ Additionally there is support for some more complex schemas, for example used by Google Code:: [schemes] gcode = http://{1}.googlecode.com/hg/ The syntax is taken from Mercurial templates, and you have unlimited number of variables, starting with ``{1}`` and continuing with ``{2}``, ``{3}`` and so on. This variables will receive parts of URL supplied, split by ``/``. Anything not specified as ``{part}`` will be just appended to an URL. For convenience, the extension adds these schemes by default:: [schemes] py = http://hg.python.org/ bb = https://bitbucket.org/ bb+ssh = ssh://hg@bitbucket.org/ gcode = https://{1}.googlecode.com/hg/ kiln = https://{1}.kilnhg.com/Repo/ You can override a predefined scheme by defining a new scheme with the same name. � )�absolute_importN)�_)�error� extensions�hg�pycompat� registrar� templater)�urlutils ships-with-hg-cores {(\d+)\}c @ s. e Zd Zdd� Zdd� Zd dd�Zdd � ZdS )�ShortRepositoryc C sL || _ || _|| _ztttt�| j���| _W d S t y% d| _Y d S w )Nr ) �schemer �url�max�map�int�_partre�findall�parts� ValueError)�selfr r r � r �//usr/lib/python3/dist-packages/hgext/schemes.py�__init__H s �zShortRepository.__init__c C s d| j S )Ns <ShortRepository: %s>)r )r r r r �__repr__Q s zShortRepository.__repr__Nc C s$ | � |�}t�|�j|||||d�S )N)�intents� createopts)�resolver �_peerlookup�instance)r �uir �creater r r r r r T s �zShortRepository.instancec C s� z |� dd�d }W n ty t�td�| ��w |� d| j�}t|�| jkr4|d }|d d� }nd}dd� t|�D �}d�| j � | j|��| S ) Ns ://� s no '://' in scheme url '%s'� /���� c S s i | ]\}}d |d |�qS )s %dr! r )�.0�i�vr r r � <dictcomp>f s z+ShortRepository.resolve.<locals>.<dictcomp>)�split� IndexErrorr �Abortr r �len� enumerate�joinr �processr )r r r �tail�contextr r r r Z s �zShortRepository.resolve)NN)�__name__� __module__�__qualname__r r r r r r r r r G s r c C s* |rt D ]}|�|d �r dS q| |�S )N� :F)�schemes� startswith)�orig�pathr r r r �hasdriveletterj s �r: s http://hg.python.org/s https://bitbucket.org/s ssh://hg@bitbucket.org/s https://{1}.googlecode.com/hg/s https://{1}.kilnhg.com/Repo/)s pys bbs bb+sshs gcodes kilnc C s� t �t| �d��� t�tj�}t �� D ]/\}}tj r:t |�dkr:|�� r:tj �d| �r:t�td�||�� f ��t|||�tj |<