[Updated] [+- ] D10416: incoming: kill the `repo._subtoppath =` hack

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


marmoute updated this revision to Diff 26919.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10416?vs=26872&id=26919

BRANCH
  default

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

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

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
@@ -882,7 +882,8 @@
             opts = copy.copy(opts)
             opts.pop(b'rev', None)
             opts.pop(b'branch', None)
-        return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
+        subpath = subrepoutil.repo_rel_or_abs_source(self._repo)
+        return hg.incoming(ui, self._repo, source, opts, subpath=subpath)
 
     @annotatesubrepoerror
     def files(self):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1255,7 +1255,14 @@
 
 
 def _incoming(
-    displaychlist, subreporecurse, ui, repo, source, opts, buffered=False
+    displaychlist,
+    subreporecurse,
+    ui,
+    repo,
+    source,
+    opts,
+    buffered=False,
+    subpath=None,
 ):
     """
     Helper for incoming / gincoming.
@@ -1270,6 +1277,14 @@
         msg %= len(srcs)
         raise error.Abort(msg)
     source, branches = srcs[0]
+    if subpath is not None:
+        subpath = urlutil.url(subpath)
+        if subpath.isabs():
+            source = bytes(subpath)
+        else:
+            p = urlutil.url(source)
+            p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+            source = bytes(p)
     other = peer(repo, opts, source)
     cleanupfn = other.close
     try:
@@ -1297,7 +1312,7 @@
     return 0  # exit code is zero since we found incoming changes
 
 
-def incoming(ui, repo, source, opts):
+def incoming(ui, repo, source, opts, subpath=None):
     def subreporecurse():
         ret = 1
         if opts.get(b'subrepos'):
@@ -1321,7 +1336,9 @@
             count += 1
             displayer.show(other[n])
 
-    return _incoming(display, subreporecurse, ui, repo, source, opts)
+    return _incoming(
+        display, subreporecurse, ui, repo, source, opts, subpath=subpath
+    )
 
 
 def _outgoing(ui, repo, dests, opts, subpath=None):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4351,11 +4351,7 @@
             finally:
                 other.close()
 
-    repo._subtoppath = ui.expandpath(source)
-    try:
-        return hg.incoming(ui, repo, source, opts)
-    finally:
-        del repo._subtoppath
+    return hg.incoming(ui, repo, source, opts)
 
 
 @command(



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


More information about the Mercurial-patches mailing list