changeset 46917:efadec3ea8e2

push-dests: move the code around missing default dest inside `get_push_paths` This function has a clear semantic and moving the code dealing with this inside it will help reduce duplication. Differential Revision: https://phab.mercurial-scm.org/D10385
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 13 Apr 2021 15:30:32 +0200
parents 7061eee84151
children 248cbe173203
files mercurial/commands.py mercurial/utils/urlutil.py
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Apr 13 15:32:59 2021 +0200
+++ b/mercurial/commands.py	Tue Apr 13 15:30:32 2021 +0200
@@ -5703,11 +5703,6 @@
     some_pushed = False
     result = 0
     for path in urlutil.get_push_paths(repo, ui, dests):
-        if not path:
-            raise error.ConfigError(
-                _(b'default repository not configured!'),
-                hint=_(b"see 'hg help config.paths'"),
-            )
         dest = path.pushloc or path.loc
         branches = (path.branch, opts.get(b'branch') or [])
         ui.status(_(b'pushing to %s\n') % urlutil.hidepassword(dest))
--- a/mercurial/utils/urlutil.py	Tue Apr 13 15:32:59 2021 +0200
+++ b/mercurial/utils/urlutil.py	Tue Apr 13 15:30:32 2021 +0200
@@ -453,7 +453,10 @@
         elif b'default' in ui.paths:
             yield ui.paths[b'default']
         else:
-            yield None
+            raise error.ConfigError(
+                _(b'default repository not configured!'),
+                hint=_(b"see 'hg help config.paths'"),
+            )
     else:
         for dest in dests:
             yield ui.getpath(dest)