ó çƒQc@s«dZddlZddlZddlmZmZmZmZddlm Z dZ de fd„ƒYZ d„Z id d 6d d 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://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ÿÿÿÿ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   + cCs d|jS(Ns(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 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://hg@bitbucket.org/sbb+sshshttps://{1}.googlecode.com/hg/tgcodeshttps://{1}.kilnhg.com/Repo/tkilncCsætjt|jdƒƒƒtjd„ƒ}xžtjƒD]\}}tjdkr²t |ƒdkr²|j ƒr²tj j d|ƒr²t jtdƒ||jƒfƒ‚nt|||ƒtj|`stntis%s:\s5custom scheme %s:// conflicts with drive letter %s:\ R/(R*tupdateRt configitemsRtenginetitemstostnameRtisalphaR.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)s"