[Updated] D10390: outgoing: pass subrepo path using function argument instead of abssource hack

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Apr 15 07:37:50 UTC 2021


marmoute edited the summary of this revision.
marmoute updated this revision to Diff 26912.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10390?vs=26846&id=26912

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10390/new/

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/hg.py
  mercurial/subrepo.py

CHANGE DETAILS

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -873,7 +873,8 @@
             opts = copy.copy(opts)
             opts.pop(b'rev', None)
             opts.pop(b'branch', None)
-        return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
+        subpath = subrepoutil.repo_rel_or_abs_source(self._repo)
+        return hg.outgoing(ui, self._repo, dest, opts, subpath=subpath)
 
     @annotatesubrepoerror
     def incoming(self, ui, source, opts):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -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:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4985,11 +4985,7 @@
         finally:
             other.close()
 
-    repo._subtoppath = path.pushloc or path.loc
-    try:
-        return hg.outgoing(ui, repo, dest, opts)
-    finally:
-        del repo._subtoppath
+    return hg.outgoing(ui, repo, dest, opts)
 
 
 @command(



To: marmoute, #hg-reviewers
Cc: pulkit, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210415/acd2849d/attachment-0002.html>


More information about the Mercurial-patches mailing list