changeset 40559:ed19958dbf5d

remotefilelog: consolidate and rename bundle2 capability Bonus: we catch a spot where the shallowrepo requirement was being misused as the bundle2 capability. Differential Revision: https://phab.mercurial-scm.org/D5127
author Augie Fackler <augie@google.com>
date Tue, 16 Oct 2018 17:30:47 -0400
parents 354acd0dc637
children fc2766860796
files hgext/remotefilelog/__init__.py hgext/remotefilelog/constants.py hgext/remotefilelog/fileserverclient.py hgext/remotefilelog/remotefilelogserver.py hgext/remotefilelog/shallowbundle.py
diffstat 5 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/__init__.py	Tue Oct 16 16:38:40 2018 -0400
+++ b/hgext/remotefilelog/__init__.py	Tue Oct 16 17:30:47 2018 -0400
@@ -962,7 +962,7 @@
                        **kwargs):
         if not bundlecaps:
             bundlecaps = set()
-        bundlecaps.add('remotefilelog')
+        bundlecaps.add(constants.BUNDLE2_CAPABLITY)
         return orig(source, heads=heads, common=common, bundlecaps=bundlecaps,
                     **kwargs)
 
--- a/hgext/remotefilelog/constants.py	Tue Oct 16 16:38:40 2018 -0400
+++ b/hgext/remotefilelog/constants.py	Tue Oct 16 17:30:47 2018 -0400
@@ -8,6 +8,8 @@
 
 NETWORK_CAP_LEGACY_SSH_GETFILES = 'exp-remotefilelog-ssh-getfiles-1'
 
+BUNDLE2_CAPABLITY = "exp-remotefilelog-b2cap-1"
+
 FILENAMESTRUCT = '!H'
 FILENAMESIZE = struct.calcsize(FILENAMESTRUCT)
 
--- a/hgext/remotefilelog/fileserverclient.py	Tue Oct 16 16:38:40 2018 -0400
+++ b/hgext/remotefilelog/fileserverclient.py	Tue Oct 16 17:30:47 2018 -0400
@@ -99,7 +99,7 @@
             # getbundle args before it goes across the wire. Once we get rid
             # of bundle1, we can use bundle2's _pullbundle2extraprepare to
             # do this more cleanly.
-            bundlecaps.append('remotefilelog')
+            bundlecaps.append(constants.BUNDLE2_CAPABLITY)
             if self._localrepo.includepattern:
                 patterns = '\0'.join(self._localrepo.includepattern)
                 includecap = "includepattern=" + patterns
--- a/hgext/remotefilelog/remotefilelogserver.py	Tue Oct 16 16:38:40 2018 -0400
+++ b/hgext/remotefilelog/remotefilelogserver.py	Tue Oct 16 17:30:47 2018 -0400
@@ -45,7 +45,7 @@
     def generatefiles(orig, self, changedfiles, linknodes, commonrevs, source,
                       *args, **kwargs):
         caps = self._bundlecaps or []
-        if shallowrepo.requirement in caps:
+        if constants.BUNDLE2_CAPABLITY in caps:
             # only send files that don't match the specified patterns
             includepattern = None
             excludepattern = None
@@ -184,7 +184,7 @@
     def getbundleshallow(repo, proto, others):
         bundlecaps = others.get('bundlecaps', '')
         bundlecaps = set(bundlecaps.split(','))
-        bundlecaps.add('remotefilelog')
+        bundlecaps.add(constants.BUNDLE2_CAPABLITY)
         others['bundlecaps'] = ','.join(bundlecaps)
 
         return wireprotov1server.commands["getbundle"][0](repo, proto, others)
--- a/hgext/remotefilelog/shallowbundle.py	Tue Oct 16 16:38:40 2018 -0400
+++ b/hgext/remotefilelog/shallowbundle.py	Tue Oct 16 17:30:47 2018 -0400
@@ -17,6 +17,7 @@
     pycompat,
 )
 from . import (
+    constants,
     remotefilelog,
     shallowutil,
 )
@@ -100,7 +101,7 @@
 
         caps = self._bundlecaps or []
         if source == "serve" or source == "pull":
-            if 'remotefilelog' in caps:
+            if constants.BUNDLE2_CAPABLITY in caps:
                 return LocalFiles
             else:
                 # Serving to a full repo requires us to serve everything