paths: do not process default-push as pushurl of default path (issue5000)
authorYuya Nishihara <yuya@tcha.org>
Sat, 26 Dec 2015 16:06:12 +0900
changeset 27563 56c2caffde3d
parent 27562 cb0cfa9fd340
child 27564 80b53082a353
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.
mercurial/ui.py
--- a/mercurial/ui.py	Sat Dec 26 16:12:28 2015 +0900
+++ b/mercurial/ui.py	Sat Dec 26 16:06:12 2015 +0900
@@ -1097,23 +1097,9 @@
             # No location is the same as not existing.
             if not loc:
                 continue
-
-            # TODO ignore default-push once all consumers stop referencing it
-            # since it is handled specifically below.
-
             loc, sub = ui.configsuboptions('paths', name)
             self[name] = path(ui, name, rawloc=loc, suboptions=sub)
 
-        # Handle default-push, which is a one-off that defines the push URL for
-        # the "default" path.
-        defaultpush = ui.config('paths', 'default-push')
-        if defaultpush:
-            # "default-push" can be defined without "default" entry. This is a
-            # bit weird, but is allowed for backwards compatibility.
-            if 'default' not in self:
-                self['default'] = path(ui, 'default', rawloc=defaultpush)
-            self['default'].pushloc = defaultpush
-
     def getpath(self, name, default=None):
         """Return a ``path`` from a string, falling back to default.