diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py --- a/hgext/remotefilelog/__init__.py +++ b/hgext/remotefilelog/__init__.py @@ -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) diff --git a/hgext/remotefilelog/constants.py b/hgext/remotefilelog/constants.py --- a/hgext/remotefilelog/constants.py +++ b/hgext/remotefilelog/constants.py @@ -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) diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py --- a/hgext/remotefilelog/fileserverclient.py +++ b/hgext/remotefilelog/fileserverclient.py @@ -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 diff --git a/hgext/remotefilelog/remotefilelogserver.py b/hgext/remotefilelog/remotefilelogserver.py --- a/hgext/remotefilelog/remotefilelogserver.py +++ b/hgext/remotefilelog/remotefilelogserver.py @@ -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) diff --git a/hgext/remotefilelog/shallowbundle.py b/hgext/remotefilelog/shallowbundle.py --- a/hgext/remotefilelog/shallowbundle.py +++ b/hgext/remotefilelog/shallowbundle.py @@ -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