Comments
Patch
@@ -531,9 +531,16 @@ class ui(object):
"""Return repository location relative to cwd or from [paths]"""
if util.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
return loc
- p = self.paths.getpath(loc, default=default)
+ if loc == 'default-push':
+ p = self.paths.getpath(loc, default=True)
+ elif loc == 'default':
+ p = self.paths.getpath(loc)
+ else:
+ assert default != 'default-push'
+ p = self.paths.getpath(loc, default=default=='default')
+
if p:
return p.loc
return loc
@@ -959,19 +966,32 @@ class paths(object):
def getpath(self, name, default=None):
"""Return a ``path`` for the specified name.
+ If ``default`` is True, we attempt to resolve the default path
+ if ``name`` could not be resolved. If ``default`` is the string
+ ``push``, we attempt to resolve the default push path.
+
Returns None if the specified path or the default path was not
found.
"""
try:
return self[name]
except KeyError:
- if default is not None:
- try:
- return self[default]
- except KeyError:
- pass
+ pass
+
+ if default == 'push':
+ try:
+ return self['default-push']
+ except KeyError:
+ # Fall through to "default"
+ pass
+
+ if default:
+ try:
+ return self['default']
+ except KeyError:
+ pass
return None
class path(object):