# HG changeset patch # User Pierre-Yves David # Date 2021-04-13 13:30:32 # Node ID efadec3ea8e225cca6a8f30de20d5d17628c0832 # Parent 7061eee84151b4c7118c5b435840dab1bd305bc5 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 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5703,11 +5703,6 @@ def push(ui, repo, *dests, **opts): 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)) diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py +++ b/mercurial/utils/urlutil.py @@ -453,7 +453,10 @@ def get_push_paths(repo, ui, dests): 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)