Patchwork D10385: push-dests: move the code around missing default dest inside `get_push_paths`

login
register
mail settings
Submitter phabricator
Date April 13, 2021, 2:53 p.m.
Message ID <differential-rev-PHID-DREV-bs7fc4dxjnzac2gvn5kz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48702/
State Superseded
Headers show

Comments

phabricator - April 13, 2021, 2:53 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This function has a clear semantic and moving the code dealing with this inside
  it will help reduce duplication.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10385

AFFECTED FILES
  mercurial/commands.py
  mercurial/utils/urlutil.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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 @@ 
         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)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5702,11 +5702,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))