changeset 46933:9519312ecd81

outgoing: use `get_push_paths` in the revset too The revsets now use the same code as everyone and is ready for entry in `[paths]` pointing to multiple entries. Differential Revision: https://phab.mercurial-scm.org/D10393
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 11 Apr 2021 19:18:54 +0200
parents dec31caf5fd6
children ebb13f9a9ba8
files mercurial/revset.py
diffstat 1 files changed, 21 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Apr 14 02:14:15 2021 +0200
+++ b/mercurial/revset.py	Sun Apr 11 19:18:54 2021 +0200
@@ -1855,30 +1855,29 @@
     dest = (
         l and getstring(l[0], _(b"outgoing requires a repository path")) or b''
     )
-    if not dest:
+    if dest:
         # ui.getpath() explicitly tests for None, not just a boolean
-        dest = None
-    path = repo.ui.getpath(dest, default=(b'default-push', b'default'))
-    if not path:
-        raise error.Abort(
-            _(b'default repository not configured!'),
-            hint=_(b"see 'hg help config.paths'"),
-        )
-    dest = path.pushloc or path.loc
-    branches = path.branch, []
-
-    revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
-    if revs:
-        revs = [repo.lookup(rev) for rev in revs]
-    other = hg.peer(repo, {}, dest)
-    try:
-        repo.ui.pushbuffer()
-        outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
-        repo.ui.popbuffer()
-    finally:
-        other.close()
+        dests = [dest]
+    else:
+        dests = []
+    missing = set()
+    for path in urlutil.get_push_paths(repo, repo.ui, dests):
+        dest = path.pushloc or path.loc
+        branches = path.branch, []
+
+        revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
+        if revs:
+            revs = [repo.lookup(rev) for rev in revs]
+        other = hg.peer(repo, {}, dest)
+        try:
+            repo.ui.pushbuffer()
+            outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
+            repo.ui.popbuffer()
+        finally:
+            other.close()
+        missing.update(outgoing.missing)
     cl = repo.changelog
-    o = {cl.rev(r) for r in outgoing.missing}
+    o = {cl.rev(r) for r in missing}
     return subset & o