Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 26820:71d5238f92e9 stable
ui: support paths.default-push without paths.default set (issue4914)
This behavior regressed as part of the paths API refactoring. Previous
behavior was to accept "default-push" without "default" defined. Current
behavior aborts with "default repository not configured!." This patch
restores the old behavior and adds test coverage for the scenario, which
was absent before.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 22 Oct 2015 18:59:03 +0000 |
parents | 1aee2ab0f902 |
children | 5e46123e6c35 00aa37c65e0a |
comparison
equal
deleted
inserted
replaced
26819:ba7eeeac9603 | 26820:71d5238f92e9 |
---|---|
1024 self[name] = path(name, rawloc=loc) | 1024 self[name] = path(name, rawloc=loc) |
1025 | 1025 |
1026 # Handle default-push, which is a one-off that defines the push URL for | 1026 # Handle default-push, which is a one-off that defines the push URL for |
1027 # the "default" path. | 1027 # the "default" path. |
1028 defaultpush = ui.config('paths', 'default-push') | 1028 defaultpush = ui.config('paths', 'default-push') |
1029 if defaultpush and 'default' in self: | 1029 if defaultpush: |
1030 # "default-push" can be defined without "default" entry. This is a | |
1031 # bit weird, but is allowed for backwards compatibility. | |
1032 if 'default' not in self: | |
1033 self['default'] = path('default', rawloc=defaultpush) | |
1030 self['default']._pushloc = defaultpush | 1034 self['default']._pushloc = defaultpush |
1031 | 1035 |
1032 def getpath(self, name, default=None): | 1036 def getpath(self, name, default=None): |
1033 """Return a ``path`` from a string, falling back to a default. | 1037 """Return a ``path`` from a string, falling back to a default. |
1034 | 1038 |