D5129: remotefilelog: rename wireproto methods and remaining capabilities
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Mon Nov 5 19:57:16 UTC 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG466dd4d70bff: remotefilelog: rename wireproto methods and remaining capabilities (authored by durin42, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5129?vs=12188&id=12423
REVISION DETAIL
https://phab.mercurial-scm.org/D5129
AFFECTED FILES
hgext/remotefilelog/fileserverclient.py
hgext/remotefilelog/remotefilelogserver.py
tests/remotefilelog-getflogheads.py
tests/test-remotefilelog-http.t
tests/test-remotefilelog-pull-noshallow.t
tests/test-remotefilelog-push-pull.t
CHANGE DETAILS
diff --git a/tests/test-remotefilelog-push-pull.t b/tests/test-remotefilelog-push-pull.t
--- a/tests/test-remotefilelog-push-pull.t
+++ b/tests/test-remotefilelog-push-pull.t
@@ -24,12 +24,12 @@
$ cd master
$ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps
exp-remotefilelog-ssh-getfiles-1
- getfile
- getflogheads
+ x_rfl_getfile
+ x_rfl_getflogheads
$ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo
exp-remotefilelog-ssh-getfiles-1
- getfile
- getflogheads
+ x_rfl_getfile
+ x_rfl_getflogheads
# pull to shallow from full
diff --git a/tests/test-remotefilelog-pull-noshallow.t b/tests/test-remotefilelog-pull-noshallow.t
--- a/tests/test-remotefilelog-pull-noshallow.t
+++ b/tests/test-remotefilelog-pull-noshallow.t
@@ -37,12 +37,12 @@
$ cd master
$ echo 'hello' | hg -R . serve --stdio | grep capa | identifyrflcaps
exp-remotefilelog-ssh-getfiles-1
- getfile
- getflogheads
+ x_rfl_getfile
+ x_rfl_getflogheads
$ echo 'capabilities' | hg -R . serve --stdio | identifyrflcaps ; echo
exp-remotefilelog-ssh-getfiles-1
- getfile
- getflogheads
+ x_rfl_getfile
+ x_rfl_getflogheads
Pull to the child repository. Use our custom setupremotefilelog extension
diff --git a/tests/test-remotefilelog-http.t b/tests/test-remotefilelog-http.t
--- a/tests/test-remotefilelog-http.t
+++ b/tests/test-remotefilelog-http.t
@@ -16,16 +16,16 @@
Build a query string for later use:
$ GET=`hg debugdata -m 0 | $PYTHON -c \
- > 'import sys ; print [("?cmd=getfile&file=%s&node=%s" % tuple(s.split("\0"))) for s in sys.stdin.read().splitlines()][0]'`
+ > 'import sys ; print [("?cmd=x_rfl_getfile&file=%s&node=%s" % tuple(s.split("\0"))) for s in sys.stdin.read().splitlines()][0]'`
$ cd ..
$ cat hg1.pid >> $DAEMON_PIDS
$ hgcloneshallow http://localhost:$HGPORT/ shallow -q
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
$ grep getfile access.log
- * "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=getfile+*node%3D1406e74118627694268417491f018a4a883152f0* (glob)
+ * "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=x_rfl_getfile+*node%3D1406e74118627694268417491f018a4a883152f0* (glob)
Clear filenode cache so we can test fetching with a modified batch size
$ rm -r $TESTTMP/hgcache
@@ -37,17 +37,17 @@
The 'remotefilelog' capability should *not* be exported over http(s),
as the getfile method it offers doesn't work with http.
$ get-with-headers.py localhost:$HGPORT '?cmd=capabilities' | grep lookup | identifyrflcaps
- getfile
- getflogheads
+ x_rfl_getfile
+ x_rfl_getflogheads
$ get-with-headers.py localhost:$HGPORT '?cmd=hello' | grep lookup | identifyrflcaps
- getfile
- getflogheads
+ x_rfl_getfile
+ x_rfl_getflogheads
$ get-with-headers.py localhost:$HGPORT '?cmd=this-command-does-not-exist' | head -n 1
400 no such method: this-command-does-not-exist
- $ get-with-headers.py localhost:$HGPORT '?cmd=getfiles' | head -n 1
- 400 no such method: getfiles
+ $ get-with-headers.py localhost:$HGPORT '?cmd=x_rfl_getfiles' | head -n 1
+ 400 no such method: x_rfl_getfiles
Verify serving from a shallow clone doesn't allow for remotefile
fetches. This also serves to test the error handling for our batchable
diff --git a/tests/remotefilelog-getflogheads.py b/tests/remotefilelog-getflogheads.py
--- a/tests/remotefilelog-getflogheads.py
+++ b/tests/remotefilelog-getflogheads.py
@@ -22,7 +22,7 @@
dest = repo.ui.expandpath('default')
peer = hg.peer(repo, {}, dest)
- flogheads = peer.getflogheads(path)
+ flogheads = peer.x_rfl_getflogheads(path)
if flogheads:
for head in flogheads:
diff --git a/hgext/remotefilelog/remotefilelogserver.py b/hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py
+++ b/hgext/remotefilelog/remotefilelogserver.py
@@ -77,11 +77,11 @@
# support file content requests
wireprotov1server.wireprotocommand(
- 'getflogheads', 'path', permission='pull')(getflogheads)
+ 'x_rfl_getflogheads', 'path', permission='pull')(getflogheads)
wireprotov1server.wireprotocommand(
- 'getfiles', '', permission='pull')(getfiles)
+ 'x_rfl_getfiles', '', permission='pull')(getfiles)
wireprotov1server.wireprotocommand(
- 'getfile', 'file node', permission='pull')(getfile)
+ 'x_rfl_getfile', 'file node', permission='pull')(getfile)
class streamstate(object):
match = None
@@ -198,8 +198,8 @@
if isinstance(proto, _sshv1server):
# legacy getfiles method which only works over ssh
caps.append(constants.NETWORK_CAP_LEGACY_SSH_GETFILES)
- caps.append('getflogheads')
- caps.append('getfile')
+ caps.append('x_rfl_getflogheads')
+ caps.append('x_rfl_getfile')
return caps
extensions.wrapfunction(wireprotov1server, '_capabilities', _capabilities)
@@ -215,7 +215,7 @@
context.basefilectx, '_adjustlinkrev', _adjustlinkrev)
def _iscmd(orig, cmd):
- if cmd == 'getfiles':
+ if cmd == 'x_rfl_getfiles':
return False
return orig(cmd)
diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py
--- a/hgext/remotefilelog/fileserverclient.py
+++ b/hgext/remotefilelog/fileserverclient.py
@@ -54,8 +54,8 @@
class remotefilepeer(peer.__class__):
@wireprotov1peer.batchable
- def getfile(self, file, node):
- if not self.capable('getfile'):
+ def x_rfl_getfile(self, file, node):
+ if not self.capable('x_rfl_getfile'):
raise error.Abort(
'configured remotefile server does not support getfile')
f = wireprotov1peer.future()
@@ -66,8 +66,8 @@
yield data
@wireprotov1peer.batchable
- def getflogheads(self, path):
- if not self.capable('getflogheads'):
+ def x_rfl_getflogheads(self, path):
+ if not self.capable('x_rfl_getflogheads'):
raise error.Abort('configured remotefile server does not '
'support getflogheads')
f = wireprotov1peer.future()
@@ -204,7 +204,7 @@
with remote.commandexecutor() as e:
futures = []
for m in missed:
- futures.append(e.callcommand('getfile', {
+ futures.append(e.callcommand('x_rfl_getfile', {
'file': idmap[m],
'node': m[-40:]
}))
@@ -219,7 +219,7 @@
def _getfiles_optimistic(
remote, receivemissing, progresstick, missed, idmap, step):
- remote._callstream("getfiles")
+ remote._callstream("x_rfl_getfiles")
i = 0
pipeo = remote._pipeo
pipei = remote._pipei
@@ -394,7 +394,7 @@
_getfiles = _getfiles_optimistic
_getfiles(remote, self.receivemissing, progresstick,
missed, idmap, step)
- elif remote.capable("getfile"):
+ elif remote.capable("x_rfl_getfile"):
if remote.capable('batch'):
batchdefault = 100
else:
To: durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
More information about the Mercurial-devel
mailing list