Mercurial > public > mercurial-scm > hg-stable
diff hgext/schemes.py @ 27982:bf1d5c223ac0
schemes: add debugexpandscheme command, resolving a scheme to canonical form
author | Jason R. Coombs <jaraco@jaraco.com> |
---|---|
date | Fri, 29 Jan 2016 14:53:44 -0500 |
parents | d630eac3a5db |
children | 27a9032374a7 |
line wrap: on
line diff
--- a/hgext/schemes.py Fri Jan 29 14:40:41 2016 -0500 +++ b/hgext/schemes.py Fri Jan 29 14:53:44 2016 -0500 @@ -41,9 +41,11 @@ """ import os, re -from mercurial import extensions, hg, templater, util, error +from mercurial import extensions, hg, templater, util, error, cmdutil from mercurial.i18n import _ +cmdtable = {} +command = cmdutil.command(cmdtable) # Note for extension authors: ONLY specify testedwith = 'internal' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or @@ -109,3 +111,12 @@ hg.schemes[scheme] = ShortRepository(url, scheme, t) extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter) + +@command('debugexpandscheme', norepo=True) +def expandscheme(ui, url, **opts): + """given a repo path, provide the scheme-expanded path + """ + repo = hg._peerlookup(url) + if isinstance(repo, ShortRepository): + url = repo.resolve(url) + ui.write(url + '\n')