Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/schemes.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s�dZddlZddlZddlmZmZmZmZddlm	Z	dZ
defd��YZd�Z
id	d
6dd6d
d6dd6dd6Zd�ZdS(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://[email protected]/
  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�N(t
extensionsthgt	templatertutil(t_tinternaltShortRepositorycBs#eZd�Zd�Zd�ZRS(cCsg||_||_||_y+ttttjd|j���|_Wnt	k
rbd|_nXdS(Ns	\{(\d+)\}i(
tschemeRturltmaxtmaptinttretfindalltpartst
ValueError(tselfRRR((s1/sys/lib/python2.7/site-packages/hgext/schemes.pyt__init__3s			+
cCsd|jS(Ns<ShortRepository: %s>(R(R((s1/sys/lib/python2.7/site-packages/hgext/schemes.pyt__repr__<scCs�y|jdd�d}Wn*tk
rFtjtd�|��nX|jd|j�}t|�|jkr�|d}|d }nd}td�t|�D��}dj	|j
j|j|��|}t
j|�j|||�S(Ns://isno '://' in scheme url '%s't/i�tcss+|]!\}}t|d�|fVqdS(iN(tstr(t.0titv((s1/sys/lib/python2.7/site-packages/hgext/schemes.pys	<genexpr>Ks(tsplitt
IndexErrorRtAbortRRtlentdictt	enumeratetjoinRtprocessRRt_peerlookuptinstance(RtuiRtcreateRttailtcontext((s1/sys/lib/python2.7/site-packages/hgext/schemes.pyR"?s


%(t__name__t
__module__RRR"(((s1/sys/lib/python2.7/site-packages/hgext/schemes.pyR2s			cCs;|r1x(tD]}|j|d�r
tSq
Wn||�S(Nt:(tschemest
startswithtFalse(torigtpathR((s1/sys/lib/python2.7/site-packages/hgext/schemes.pythasdriveletterOs

shttp://hg.python.org/tpyshttps://bitbucket.org/tbbsssh://[email protected]/sbb+sshshttps://{1}.googlecode.com/hg/tgcodeshttps://{1}.kilnhg.com/Repo/tkilncCs�tjt|jd���tjd��}x�tj�D]�\}}tjdkr�t	|�dkr�|j
�r�tjjd|�r�t
jtd�||j�f��nt|||�tj|<q;Wtjt
dt�dS(NR*cSs|S(N((tx((s1/sys/lib/python2.7/site-packages/hgext/schemes.pyt<lambda>`stntis%s:\s5custom scheme %s:// conflicts with drive letter %s:\
R/(R*tupdateRtconfigitemsRtenginetitemstostnameRtisalphaR.texistsRRRtupperRRRtwrapfunctionR/(R#ttRR((s1/sys/lib/python2.7/site-packages/hgext/schemes.pytextsetup^s-(t__doc__R;Rt	mercurialRRRRtmercurial.i18nRt
testedwithtobjectRR/R*RB(((s1/sys/lib/python2.7/site-packages/hgext/schemes.pyt<module>)s"	


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].