File: //usr/lib/python2.7/dist-packages/hgext/schemes.pyc
ó
ÛXc @@ s÷ d Z d d l m Z d d l Z d d l Z d d l m Z d d l m Z m Z m
Z
m Z m Z m
Z
i Z e j e ƒ Z d Z d e f d „ ƒ YZ d „ Z i d
d 6d d
6d d 6d d 6d d 6Z d „ Z e d d e ƒd „ ƒ Z d S( s' 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.
i ( t absolute_importN( t _( t cmdutilt errort
extensionst hgt templatert utils ships-with-hg-coret ShortRepositoryc B@ s, e Z d „ Z d „ Z d „ Z d „ Z RS( c C@ sg | | _ | | _ | | _ y+ t t t t j d | j ƒ ƒ ƒ | _ Wn t k
rb d | _ n Xd S( Ns \{(\d+)\}i (
t schemeR t urlt maxt mapt intt ret findallt partst
ValueError( t selfR
R R ( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyt __init__C s +
c C@ s d | j S( Ns <ShortRepository: %s>( R ( R ( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyt __repr__L s c C@ s+ | j | ƒ } t j | ƒ j | | | ƒ S( N( t resolveR t _peerlookupt instance( R t uiR
t create( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyR O s c C@ sÍ y | j d d ƒ d } Wn* t k
rF t j t d ƒ | ƒ ‚ n X| j d | j ƒ } t | ƒ | j k rˆ | d } | d } n d } t d „ t | ƒ Dƒ ƒ } d j | j
j | j | ƒ ƒ | S( Ns ://i s no '://' in scheme url '%s't /iÿÿÿÿt c s@ s+ | ]! \ } } t | d ƒ | f Vq d S( i N( t str( t .0t it v( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pys <genexpr>_ s (
t splitt
IndexErrorR t AbortR R t lent dictt enumeratet joinR t processR
( R R
R t tailt context( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyR S s
( t __name__t
__module__R R R R ( ( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyR B s c C@ s; | r1 x( t D] } | j | d ƒ r
t Sq
Wn | | ƒ S( Nt :( t schemest
startswitht False( t origt pathR ( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyt hasdriveletterb s
s http://hg.python.org/t pys https://bitbucket.org/t bbs ssh://hg@bitbucket.org/s bb+sshs https://{1}.googlecode.com/hg/t gcodes https://{1}.kilnhg.com/Repo/t kilnc C@ sæ t j t | j d ƒ ƒ ƒ t j d „ ƒ } xž t j ƒ D] \ } } t j d k r² t | ƒ d k r² | j
ƒ r² t j j d | ƒ r² t
j t d ƒ | | j ƒ f ƒ ‚ n t | | | ƒ t j | <q; Wt j t d t ƒ d S( NR- c S@ s | S( N( ( t x( ( s1 /usr/lib/python2.7/dist-packages/hgext/schemes.pyt <lambda>s s t nti s %s:\s5 custom scheme %s:// conflicts with drive letter %s:\
R2 ( R- t updateR$ t configitemsR t enginet itemst ost nameR# t isalphaR1 t existsR R"