narrow: move changegroup.supportedoutgoingversions() override to core
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 28 Feb 2018 10:55:21 -0800
changeset 36495 94709406f10d
parent 36494 3f0af89e008d
child 36496 a8b4d7673d8e
narrow: move changegroup.supportedoutgoingversions() override to core Also document why we need cg3 or higher. Differential Revision: https://phab.mercurial-scm.org/D2488
hgext/narrow/narrowchangegroup.py
mercurial/changegroup.py
--- a/hgext/narrow/narrowchangegroup.py	Wed Feb 28 10:21:43 2018 -0800
+++ b/hgext/narrow/narrowchangegroup.py	Wed Feb 28 10:55:21 2018 -0800
@@ -21,16 +21,6 @@
 
 def setup():
 
-    def supportedoutgoingversions(orig, repo):
-        versions = orig(repo)
-        if changegroup.NARROW_REQUIREMENT in repo.requirements:
-            versions.discard('01')
-            versions.discard('02')
-        return versions
-
-    extensions.wrapfunction(changegroup, 'supportedoutgoingversions',
-                            supportedoutgoingversions)
-
     def prune(orig, self, revlog, missing, commonrevs):
         if isinstance(revlog, manifest.manifestrevlog):
             matcher = getattr(self._repo, 'narrowmatch',
--- a/mercurial/changegroup.py	Wed Feb 28 10:21:43 2018 -0800
+++ b/mercurial/changegroup.py	Wed Feb 28 10:55:21 2018 -0800
@@ -898,6 +898,11 @@
         # support versions 01 and 02.
         versions.discard('01')
         versions.discard('02')
+    if NARROW_REQUIREMENT in repo.requirements:
+        # Versions 01 and 02 don't support revlog flags, and we need to
+        # support that for stripping and unbundling to work.
+        versions.discard('01')
+        versions.discard('02')
     return versions
 
 def localversion(repo):