Show More
@@ -41,9 +41,11 b' same name.' | |||||
41 | """ |
|
41 | """ | |
42 |
|
42 | |||
43 | import os, re |
|
43 | import os, re | |
44 | from mercurial import extensions, hg, templater, util, error |
|
44 | from mercurial import extensions, hg, templater, util, error, cmdutil | |
45 | from mercurial.i18n import _ |
|
45 | from mercurial.i18n import _ | |
46 |
|
46 | |||
|
47 | cmdtable = {} | |||
|
48 | command = cmdutil.command(cmdtable) | |||
47 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
|
49 | # Note for extension authors: ONLY specify testedwith = 'internal' for | |
48 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
50 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
49 | # be specifying the version(s) of Mercurial they are tested with, or |
|
51 | # be specifying the version(s) of Mercurial they are tested with, or | |
@@ -109,3 +111,12 b' def extsetup(ui):' | |||||
109 | hg.schemes[scheme] = ShortRepository(url, scheme, t) |
|
111 | hg.schemes[scheme] = ShortRepository(url, scheme, t) | |
110 |
|
112 | |||
111 | extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter) |
|
113 | extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter) | |
|
114 | ||||
|
115 | @command('debugexpandscheme', norepo=True) | |||
|
116 | def expandscheme(ui, url, **opts): | |||
|
117 | """given a repo path, provide the scheme-expanded path | |||
|
118 | """ | |||
|
119 | repo = hg._peerlookup(url) | |||
|
120 | if isinstance(repo, ShortRepository): | |||
|
121 | url = repo.resolve(url) | |||
|
122 | ui.write(url + '\n') |
@@ -52,6 +52,21 b' check that paths are expanded' | |||||
52 | no changes found |
|
52 | no changes found | |
53 | [1] |
|
53 | [1] | |
54 |
|
54 | |||
|
55 | check that debugexpandscheme outputs the canonical form | |||
|
56 | ||||
|
57 | $ hg debugexpandscheme bb://user/repo | |||
|
58 | https://bitbucket.org/user/repo | |||
|
59 | ||||
|
60 | expanding an unknown scheme emits the input | |||
|
61 | ||||
|
62 | $ hg debugexpandscheme foobar://this/that | |||
|
63 | foobar://this/that | |||
|
64 | ||||
|
65 | expanding a canonical URL emits the input | |||
|
66 | ||||
|
67 | $ hg debugexpandscheme https://bitbucket.org/user/repo | |||
|
68 | https://bitbucket.org/user/repo | |||
|
69 | ||||
55 | errors |
|
70 | errors | |
56 |
|
71 | |||
57 | $ cat errors.log |
|
72 | $ cat errors.log |
General Comments 0
You need to be logged in to leave comments.
Login now