remotefilelog: rename capability for legacy ssh file fetching method
I think I want to delete this, but for now we'll just rename this so
it's easy to tell apart from other strings that have the same value.
Differential Revision: https://phab.mercurial-scm.org/D5126
--- a/hgext/remotefilelog/__init__.py Thu Oct 04 00:11:37 2018 -0400
+++ b/hgext/remotefilelog/__init__.py Tue Oct 16 16:38:40 2018 -0400
@@ -114,6 +114,7 @@
util,
)
from . import (
+ constants,
debugcommands,
fileserverclient,
remotefilectx,
@@ -282,7 +283,7 @@
# patterns.
def stream_out_shallow(orig):
caps = remote.capabilities()
- if shallowrepo.requirement in caps:
+ if constants.NETWORK_CAP_LEGACY_SSH_GETFILES in caps:
opts = {}
if repo.includepattern:
opts['includepattern'] = '\0'.join(repo.includepattern)
--- a/hgext/remotefilelog/constants.py Thu Oct 04 00:11:37 2018 -0400
+++ b/hgext/remotefilelog/constants.py Tue Oct 16 16:38:40 2018 -0400
@@ -6,6 +6,8 @@
REQUIREMENT = "remotefilelog"
+NETWORK_CAP_LEGACY_SSH_GETFILES = 'exp-remotefilelog-ssh-getfiles-1'
+
FILENAMESTRUCT = '!H'
FILENAMESIZE = struct.calcsize(FILENAMESTRUCT)
--- a/hgext/remotefilelog/fileserverclient.py Thu Oct 04 00:11:37 2018 -0400
+++ b/hgext/remotefilelog/fileserverclient.py Tue Oct 16 16:38:40 2018 -0400
@@ -78,7 +78,8 @@
def _updatecallstreamopts(self, command, opts):
if command != 'getbundle':
return
- if 'remotefilelog' not in self.capabilities():
+ if (constants.NETWORK_CAP_LEGACY_SSH_GETFILES
+ not in self.capabilities()):
return
if not util.safehasattr(self, '_localrepo'):
return
@@ -377,9 +378,8 @@
try:
with self._connect() as conn:
remote = conn.peer
- # TODO: deduplicate this with the constant in
- # shallowrepo
- if remote.capable("remotefilelog"):
+ if remote.capable(
+ constants.NETWORK_CAP_LEGACY_SSH_GETFILES):
if not isinstance(remote, _sshv1peer):
raise error.Abort('remotefilelog requires ssh '
'servers')
--- a/hgext/remotefilelog/remotefilelogserver.py Thu Oct 04 00:11:37 2018 -0400
+++ b/hgext/remotefilelog/remotefilelogserver.py Tue Oct 16 16:38:40 2018 -0400
@@ -29,6 +29,7 @@
wireprotov1server,
)
from . import (
+ constants,
shallowrepo,
shallowutil,
)
@@ -197,7 +198,7 @@
ui.configbool('remotefilelog', 'server'))):
if isinstance(proto, _sshv1server):
# legacy getfiles method which only works over ssh
- caps.append(shallowrepo.requirement)
+ caps.append(constants.NETWORK_CAP_LEGACY_SSH_GETFILES)
caps.append('getflogheads')
caps.append('getfile')
return caps
--- a/tests/test-remotefilelog-pull-noshallow.t Thu Oct 04 00:11:37 2018 -0400
+++ b/tests/test-remotefilelog-pull-noshallow.t Tue Oct 16 16:38:40 2018 -0400
@@ -36,13 +36,13 @@
$ cd master
$ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps
+ exp-remotefilelog-ssh-getfiles-1
getfile
getflogheads
- remotefilelog
$ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo
+ exp-remotefilelog-ssh-getfiles-1
getfile
getflogheads
- remotefilelog
Pull to the child repository. Use our custom setupremotefilelog extension
--- a/tests/test-remotefilelog-push-pull.t Thu Oct 04 00:11:37 2018 -0400
+++ b/tests/test-remotefilelog-push-pull.t Tue Oct 16 16:38:40 2018 -0400
@@ -23,13 +23,13 @@
$ cd master
$ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps
+ exp-remotefilelog-ssh-getfiles-1
getfile
getflogheads
- remotefilelog
$ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo
+ exp-remotefilelog-ssh-getfiles-1
getfile
getflogheads
- remotefilelog
# pull to shallow from full