comparison mercurial/ui.py @ 27563:56c2caffde3d

paths: do not process default-push as pushurl of default path (issue5000) It didn't work because "default-push" and "default" are independent named items. Without this patch, "hg push default" would push to "default-push" because paths["default"].pushloc was overwritten by "default-push". Also, we shouldn't ban a user from doing "hg push default-push" so long as "default-push" item is defined, not "default:pushurl". Otherwise, he would be confused by missing "default-push" path. Tests are included in a patch for stable branch.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 26 Dec 2015 16:06:12 +0900
parents 723413ee000e
children e70c97cc9243
comparison
equal deleted inserted replaced
27562:cb0cfa9fd340 27563:56c2caffde3d
1095 1095
1096 for name, loc in ui.configitems('paths', ignoresub=True): 1096 for name, loc in ui.configitems('paths', ignoresub=True):
1097 # No location is the same as not existing. 1097 # No location is the same as not existing.
1098 if not loc: 1098 if not loc:
1099 continue 1099 continue
1100
1101 # TODO ignore default-push once all consumers stop referencing it
1102 # since it is handled specifically below.
1103
1104 loc, sub = ui.configsuboptions('paths', name) 1100 loc, sub = ui.configsuboptions('paths', name)
1105 self[name] = path(ui, name, rawloc=loc, suboptions=sub) 1101 self[name] = path(ui, name, rawloc=loc, suboptions=sub)
1106
1107 # Handle default-push, which is a one-off that defines the push URL for
1108 # the "default" path.
1109 defaultpush = ui.config('paths', 'default-push')
1110 if defaultpush:
1111 # "default-push" can be defined without "default" entry. This is a
1112 # bit weird, but is allowed for backwards compatibility.
1113 if 'default' not in self:
1114 self['default'] = path(ui, 'default', rawloc=defaultpush)
1115 self['default'].pushloc = defaultpush
1116 1102
1117 def getpath(self, name, default=None): 1103 def getpath(self, name, default=None):
1118 """Return a ``path`` from a string, falling back to default. 1104 """Return a ``path`` from a string, falling back to default.
1119 1105
1120 ``name`` can be a named path or locations. Locations are filesystem 1106 ``name`` can be a named path or locations. Locations are filesystem