changeset 46916:7061eee84151

push-dests: rework the handling of default value This new core is more straightforward and doing this early will make the next changeset simpler. Differential Revision: https://phab.mercurial-scm.org/D10384
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 13 Apr 2021 15:32:59 +0200
parents efc6f6a794bd
children efadec3ea8e2
files mercurial/utils/urlutil.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/urlutil.py	Sun Apr 11 20:00:46 2021 +0200
+++ b/mercurial/utils/urlutil.py	Tue Apr 13 15:32:59 2021 +0200
@@ -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=()):