diff mercurial/commands.py @ 46954:5d91eeac37ab

summary: use the new APIs Summary can perform some incoming/outgoing queries (that should be common to the other command with the same needs, but that is another story). We now use the new APIs to do so. The current code behavior is a bit fishy, relying to the fact "default" will be picked as the destination in last resort. I did not altered that, but left various comment to highlight the issue. Differential Revision: https://phab.mercurial-scm.org/D10420
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 14 Apr 2021 19:30:48 +0200
parents 82366464190a
children d55b71393907
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Apr 14 18:37:29 2021 +0200
+++ b/mercurial/commands.py	Wed Apr 14 19:30:48 2021 +0200
@@ -7210,7 +7210,12 @@
             return
 
     def getincoming():
-        source, branches = urlutil.parseurl(ui.expandpath(b'default'))
+        # XXX We should actually skip this if no default is specified, instead
+        # of passing "default" which will resolve as "./default/" if no default
+        # path is defined.
+        source, branches = urlutil.get_unique_pull_path(
+            b'summary', repo, ui, b'default'
+        )
         sbranch = branches[0]
         try:
             other = hg.peer(repo, {}, source)
@@ -7233,11 +7238,22 @@
         source = sbranch = sother = commoninc = incoming = None
 
     def getoutgoing():
-        dest, branches = urlutil.parseurl(
-            ui.expandpath(b'default-push', b'default')
-        )
-        dbranch = branches[0]
-        revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
+        # XXX We should actually skip this if no default is specified, instead
+        # of passing "default" which will resolve as "./default/" if no default
+        # path is defined.
+        d = None
+        if b'default-push' in ui.paths:
+            d = b'default-push'
+        elif b'default' in ui.paths:
+            d = b'default'
+        if d is not None:
+            path = urlutil.get_unique_push_path(b'summary', repo, ui, d)
+            dest = path.pushloc or path.loc
+            dbranch = path.branch
+        else:
+            dest = b'default'
+            dbranch = None
+        revs, checkout = hg.addbranchrevs(repo, repo, (dbranch, []), None)
         if source != dest:
             try:
                 dother = hg.peer(repo, {}, dest)