widening: trust user to give full "known" set
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 10 Oct 2019 22:41:50 -0700
changeset 43248 2673f9a74968
parent 43247 599e0e62b597
child 43249 63d440bef72a
widening: trust user to give full "known" set The new narrow_widen wire protocol command is supposed to return data for exactly the revisions that the client requested (in order for it to be strip-free). So we should not add ancestors the client didn't ask for. Differential Revision: https://phab.mercurial-scm.org/D7098
hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py	Fri Oct 11 00:06:27 2019 -0700
+++ b/hgext/narrow/narrowbundle2.py	Thu Oct 10 22:41:50 2019 -0700
@@ -143,14 +143,12 @@
     # c) goto a
     #
     # until they've built up the full new state.
-    # Convert to revnums and intersect with "common". The client should
-    # have made it a subset of "common" already, but let's be safe.
-    known = set(repo.revs(b"%ln & ::%ln", known, common))
+    knownrevs = {repo.changelog.rev(n) for n in known}
     # TODO: we could send only roots() of this set, and the
     # list of nodes in common, and the client could work out
     # what to strip, instead of us explicitly sending every
     # single node.
-    deadrevs = known
+    deadrevs = knownrevs
 
     def genkills():
         for r in deadrevs:
@@ -160,7 +158,7 @@
 
     bundler.newpart(_CHANGESPECPART, data=genkills())
     newvisit, newfull, newellipsis = exchange._computeellipsis(
-        repo, set(), common, known, newmatch
+        repo, set(), common, knownrevs, newmatch
     )
     if newvisit:
         packer = changegroup.getbundler(