mercurial/ui.py
changeset 46721 e3f15c553522
parent 46720 66fb04552122
child 46819 d4ba4d51f85f
equal deleted inserted replaced
46720:66fb04552122 46721:e3f15c553522
  2188     """
  2188     """
  2189 
  2189 
  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'*')
  2193         for name, loc in ui.configitems(b'paths', ignoresub=True):
  2194         for name, loc in ui.configitems(b'paths', ignoresub=True):
  2194             # No location is the same as not existing.
  2195             # No location is the same as not existing.
  2195             if not loc:
  2196             if not loc:
  2196                 continue
  2197                 continue
  2197             loc, sub = ui.configsuboptions(b'paths', name)
  2198             loc, sub = ui.configsuboptions(b'paths', name)
  2198             self[name] = path(ui, name, rawloc=loc, suboptions=sub)
  2199             sub_opts = base_sub_options.copy()
       
  2200             sub_opts.update(sub)
       
  2201             self[name] = path(ui, name, rawloc=loc, suboptions=sub_opts)
       
  2202         self._default_sub_opts = base_sub_options
  2199 
  2203 
  2200     def getpath(self, ui, name, default=None):
  2204     def getpath(self, ui, name, default=None):
  2201         """Return a ``path`` from a string, falling back to default.
  2205         """Return a ``path`` from a string, falling back to default.
  2202 
  2206 
  2203         ``name`` can be a named path or locations. Locations are filesystem
  2207         ``name`` can be a named path or locations. Locations are filesystem
  2228             return self[name]
  2232             return self[name]
  2229         except KeyError:
  2233         except KeyError:
  2230             # Try to resolve as a local path or URI.
  2234             # Try to resolve as a local path or URI.
  2231             try:
  2235             try:
  2232                 # we pass the ui instance are warning might need to be issued
  2236                 # we pass the ui instance are warning might need to be issued
  2233                 return path(ui, None, rawloc=name)
  2237                 return path(
       
  2238                     ui, None, rawloc=name, suboptions=self._default_sub_opts
       
  2239                 )
  2234             except ValueError:
  2240             except ValueError:
  2235                 raise error.RepoError(_(b'repository %s does not exist') % name)
  2241                 raise error.RepoError(_(b'repository %s does not exist') % name)
  2236 
  2242 
  2237 
  2243 
  2238 _pathsuboptions = {}
  2244 _pathsuboptions = {}