Show More
@@ -69,7 +69,7 b' class ShortRepository(object):' | |||
|
69 | 69 | tail = '' |
|
70 | 70 | context = dict((str(i + 1), v) for i, v in enumerate(parts)) |
|
71 | 71 | url = ''.join(self.templater.process(self.url, context)) + tail |
|
72 | return hg._lookup(url).instance(ui, url, create) | |
|
72 | return hg._peerlookup(url).instance(ui, url, create) | |
|
73 | 73 | |
|
74 | 74 | def hasdriveletter(orig, path): |
|
75 | 75 | for scheme in schemes: |
@@ -93,6 +93,6 b' def extsetup(ui):' | |||
|
93 | 93 | and os.path.exists('%s:\\' % scheme)): |
|
94 | 94 | raise util.Abort(_('custom scheme %s:// conflicts with drive ' |
|
95 | 95 | 'letter %s:\\\n') % (scheme, scheme.upper())) |
|
96 | hg.schemes[scheme] = ShortRepository(url, scheme, t) | |
|
96 | hg._peerschemes[scheme] = ShortRepository(url, scheme, t) | |
|
97 | 97 | |
|
98 | 98 | extensions.wrapfunction(util, 'hasdriveletter', hasdriveletter) |
@@ -61,7 +61,7 b' def parseurl(path, branches=None):' | |||
|
61 | 61 | u.fragment = None |
|
62 | 62 | return str(u), (branch, branches or []) |
|
63 | 63 | |
|
64 | schemes = { | |
|
64 | _reposchemes = { | |
|
65 | 65 | 'bundle': bundlerepo, |
|
66 | 66 | 'file': _local, |
|
67 | 67 | 'http': httprepo, |
@@ -70,10 +70,10 b' schemes = {' | |||
|
70 | 70 | 'static-http': statichttprepo, |
|
71 | 71 | } |
|
72 | 72 | |
|
73 | def _lookup(path): | |
|
73 | def _repolookup(path): | |
|
74 | 74 | u = util.url(path) |
|
75 | 75 | scheme = u.scheme or 'file' |
|
76 | thing = schemes.get(scheme) or schemes['file'] | |
|
76 | thing = _reposchemes.get(scheme) or _reposchemes['file'] | |
|
77 | 77 | try: |
|
78 | 78 | return thing(path) |
|
79 | 79 | except TypeError: |
@@ -83,14 +83,14 b' def islocal(repo):' | |||
|
83 | 83 | '''return true if repo or path is local''' |
|
84 | 84 | if isinstance(repo, str): |
|
85 | 85 | try: |
|
86 | return _lookup(repo).islocal(repo) | |
|
86 | return _repolookup(repo).islocal(repo) | |
|
87 | 87 | except AttributeError: |
|
88 | 88 | return False |
|
89 | 89 | return repo.local() |
|
90 | 90 | |
|
91 | 91 | def repository(ui, path='', create=False): |
|
92 | 92 | """return a repository object for the specified path""" |
|
93 | repo = _lookup(path).instance(ui, path, create) | |
|
93 | repo = _repolookup(path).instance(ui, path, create) | |
|
94 | 94 | ui = getattr(repo, "ui", ui) |
|
95 | 95 | for name, module in extensions.extensions(): |
|
96 | 96 | hook = getattr(module, 'reposetup', None) |
@@ -98,10 +98,28 b" def repository(ui, path='', create=False" | |||
|
98 | 98 | hook(ui, repo) |
|
99 | 99 | return repo |
|
100 | 100 | |
|
101 | _peerschemes = { | |
|
102 | 'bundle': bundlerepo, | |
|
103 | 'file': _local, | |
|
104 | 'http': httprepo, | |
|
105 | 'https': httprepo, | |
|
106 | 'ssh': sshrepo, | |
|
107 | 'static-http': statichttprepo, | |
|
108 | } | |
|
109 | ||
|
110 | def _peerlookup(path): | |
|
111 | u = util.url(path) | |
|
112 | scheme = u.scheme or 'file' | |
|
113 | thing = _peerschemes.get(scheme) or _peerschemes['file'] | |
|
114 | try: | |
|
115 | return thing(path) | |
|
116 | except TypeError: | |
|
117 | return thing | |
|
118 | ||
|
101 | 119 | def peer(ui, opts, path, create=False): |
|
102 | 120 | '''return a repository peer for the specified path''' |
|
103 | 121 | rui = remoteui(ui, opts) |
|
104 | return _lookup(path).instance(rui, path, create) | |
|
122 | return _peerlookup(path).instance(rui, path, create) | |
|
105 | 123 | |
|
106 | 124 | def defaultdest(source): |
|
107 | 125 | '''return default destination of clone if none is given''' |
General Comments 0
You need to be logged in to leave comments.
Login now