Patchwork D10384: push-dests: rework the handling of default value

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

Comments

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

REVISION SUMMARY
  This new core is more straightforward and doing this early will make the next
  changeset simpler.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  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
@@ -448,9 +448,15 @@ 
 def get_push_paths(repo, ui, dests):
     """yields all the `path` selected as push destination by `dests`"""
     if not dests:
-        dests = [None]
-    for dest in dests:
-        yield ui.getpath(dest, default=(b'default-push', b'default'))
+        if b'default-push' in ui.paths:
+            yield ui.paths[b'default-push']
+        elif b'default' in ui.paths:
+            yield ui.paths[b'default']
+        else:
+            yield None
+    else:
+        for dest in dests:
+            yield ui.getpath(dest)
 
 
 def get_pull_paths(repo, ui, sources, default_branches=()):