Mercurial > public > mercurial-scm > hg
diff mercurial/ui.py @ 46721:e3f15c553522
paths: add a `*` special path to define default sub option
Differential Revision: https://phab.mercurial-scm.org/D10163
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 11 Mar 2021 11:22:54 +0100 |
parents | 66fb04552122 |
children | d4ba4d51f85f |
line wrap: on
line diff
--- a/mercurial/ui.py Thu Mar 11 17:26:49 2021 +0100 +++ b/mercurial/ui.py Thu Mar 11 11:22:54 2021 +0100 @@ -2190,12 +2190,16 @@ def __init__(self, ui): dict.__init__(self) + _path, base_sub_options = ui.configsuboptions(b'paths', b'*') for name, loc in ui.configitems(b'paths', ignoresub=True): # No location is the same as not existing. if not loc: continue loc, sub = ui.configsuboptions(b'paths', name) - self[name] = path(ui, name, rawloc=loc, suboptions=sub) + sub_opts = base_sub_options.copy() + sub_opts.update(sub) + self[name] = path(ui, name, rawloc=loc, suboptions=sub_opts) + self._default_sub_opts = base_sub_options def getpath(self, ui, name, default=None): """Return a ``path`` from a string, falling back to default. @@ -2230,7 +2234,9 @@ # Try to resolve as a local path or URI. try: # we pass the ui instance are warning might need to be issued - return path(ui, None, rawloc=name) + return path( + ui, None, rawloc=name, suboptions=self._default_sub_opts + ) except ValueError: raise error.RepoError(_(b'repository %s does not exist') % name)