mercurial/hg.py
changeset 46930 0afe96e374a7
parent 46915 efc6f6a794bd
child 46931 d4e4ccb75f99
--- a/mercurial/hg.py	Thu Apr 15 09:23:19 2021 +0200
+++ b/mercurial/hg.py	Thu Apr 15 09:23:28 2021 +0200
@@ -1320,7 +1320,7 @@
     return _incoming(display, subreporecurse, ui, repo, source, opts)
 
 
-def _outgoing(ui, repo, dest, opts):
+def _outgoing(ui, repo, dest, opts, subpath=None):
     path = ui.getpath(dest, default=(b'default-push', b'default'))
     if not path:
         raise error.Abort(
@@ -1328,6 +1328,15 @@
             hint=_(b"see 'hg help config.paths'"),
         )
     dest = path.pushloc or path.loc
+    if subpath is not None:
+        subpath = urlutil.url(subpath)
+        if subpath.isabs():
+            dest = bytes(subpath)
+        else:
+            p = urlutil.url(dest)
+            p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+            dest = bytes(p)
+
     branches = path.branch, opts.get(b'branch') or []
 
     ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest))
@@ -1382,10 +1391,10 @@
         yield n
 
 
-def outgoing(ui, repo, dest, opts):
+def outgoing(ui, repo, dest, opts, subpath=None):
     if opts.get(b'graph'):
         logcmdutil.checkunsupportedgraphflags([], opts)
-    o, other = _outgoing(ui, repo, dest, opts)
+    o, other = _outgoing(ui, repo, dest, opts, subpath=subpath)
     ret = 1
     try:
         if o: