Show More
@@ -2190,16 +2190,12 b' class paths(dict):' | |||||
2190 | def __init__(self, ui): |
|
2190 | def __init__(self, ui): | |
2191 | dict.__init__(self) |
|
2191 | dict.__init__(self) | |
2192 |
|
2192 | |||
2193 | _path, base_sub_options = ui.configsuboptions(b'paths', b'*') |
|
|||
2194 | for name, loc in ui.configitems(b'paths', ignoresub=True): |
|
2193 | for name, loc in ui.configitems(b'paths', ignoresub=True): | |
2195 | # No location is the same as not existing. |
|
2194 | # No location is the same as not existing. | |
2196 | if not loc: |
|
2195 | if not loc: | |
2197 | continue |
|
2196 | continue | |
2198 | loc, sub = ui.configsuboptions(b'paths', name) |
|
2197 | loc, sub_opts = ui.configsuboptions(b'paths', name) | |
2199 | sub_opts = base_sub_options.copy() |
|
|||
2200 | sub_opts.update(sub) |
|
|||
2201 | self[name] = path(ui, name, rawloc=loc, suboptions=sub_opts) |
|
2198 | self[name] = path(ui, name, rawloc=loc, suboptions=sub_opts) | |
2202 | self._default_sub_opts = base_sub_options |
|
|||
2203 |
|
2199 | |||
2204 | def getpath(self, ui, name, default=None): |
|
2200 | def getpath(self, ui, name, default=None): | |
2205 | """Return a ``path`` from a string, falling back to default. |
|
2201 | """Return a ``path`` from a string, falling back to default. | |
@@ -2234,9 +2230,7 b' class paths(dict):' | |||||
2234 | # Try to resolve as a local path or URI. |
|
2230 | # Try to resolve as a local path or URI. | |
2235 | try: |
|
2231 | try: | |
2236 | # we pass the ui instance are warning might need to be issued |
|
2232 | # we pass the ui instance are warning might need to be issued | |
2237 | return path( |
|
2233 | return path(ui, None, rawloc=name) | |
2238 | ui, None, rawloc=name, suboptions=self._default_sub_opts |
|
|||
2239 | ) |
|
|||
2240 | except ValueError: |
|
2234 | except ValueError: | |
2241 | raise error.RepoError(_(b'repository %s does not exist') % name) |
|
2235 | raise error.RepoError(_(b'repository %s does not exist') % name) | |
2242 |
|
2236 | |||
@@ -2334,17 +2328,19 b' class path(object):' | |||||
2334 | b'repo: %s' % rawloc |
|
2328 | b'repo: %s' % rawloc | |
2335 | ) |
|
2329 | ) | |
2336 |
|
2330 | |||
2337 | suboptions = suboptions or {} |
|
2331 | _path, sub_opts = ui.configsuboptions(b'paths', b'*') | |
|
2332 | if suboptions is not None: | |||
|
2333 | sub_opts.update(suboptions) | |||
2338 |
|
2334 | |||
2339 | # Now process the sub-options. If a sub-option is registered, its |
|
2335 | # Now process the sub-options. If a sub-option is registered, its | |
2340 | # attribute will always be present. The value will be None if there |
|
2336 | # attribute will always be present. The value will be None if there | |
2341 | # was no valid sub-option. |
|
2337 | # was no valid sub-option. | |
2342 | for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions): |
|
2338 | for suboption, (attr, func) in pycompat.iteritems(_pathsuboptions): | |
2343 |
if suboption not in subopt |
|
2339 | if suboption not in sub_opts: | |
2344 | setattr(self, attr, None) |
|
2340 | setattr(self, attr, None) | |
2345 | continue |
|
2341 | continue | |
2346 |
|
2342 | |||
2347 |
value = func(ui, self, subopt |
|
2343 | value = func(ui, self, sub_opts[suboption]) | |
2348 | setattr(self, attr, value) |
|
2344 | setattr(self, attr, value) | |
2349 |
|
2345 | |||
2350 | def _isvalidlocalpath(self, path): |
|
2346 | def _isvalidlocalpath(self, path): |
General Comments 0
You need to be logged in to leave comments.
Login now