Mercurial > hg-stable
changeset 40561:466dd4d70bff
remotefilelog: rename wireproto methods and remaining capabilities
This is a mess, in part because there should be more constants
throughout. I know we typically do exp- instead of the x_ business in
this change, but I also had to use this in some function names, so I
figured until I can break that coupling I'd go with this. If it's too
unpleasant during review, let me know and I can probably clean it up
some more.
# no-check-commit due to new foo_bar naming - too hard to avoid right now :(
Differential Revision: https://phab.mercurial-scm.org/D5129
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 04 Oct 2018 10:03:10 -0400 |
parents | fc2766860796 |
children | b35a096b9bff |
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 |
diffstat | 6 files changed, 30 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/remotefilelog/fileserverclient.py Tue Oct 16 17:02:48 2018 -0400 +++ b/hgext/remotefilelog/fileserverclient.py Thu Oct 04 10:03:10 2018 -0400 @@ -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:
--- a/hgext/remotefilelog/remotefilelogserver.py Tue Oct 16 17:02:48 2018 -0400 +++ b/hgext/remotefilelog/remotefilelogserver.py Thu Oct 04 10:03:10 2018 -0400 @@ -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)
--- a/tests/remotefilelog-getflogheads.py Tue Oct 16 17:02:48 2018 -0400 +++ b/tests/remotefilelog-getflogheads.py Thu Oct 04 10:03:10 2018 -0400 @@ -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:
--- a/tests/test-remotefilelog-http.t Tue Oct 16 17:02:48 2018 -0400 +++ b/tests/test-remotefilelog-http.t Thu Oct 04 10:03:10 2018 -0400 @@ -16,7 +16,7 @@ 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 @@ -25,7 +25,7 @@ 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
--- a/tests/test-remotefilelog-pull-noshallow.t Tue Oct 16 17:02:48 2018 -0400 +++ b/tests/test-remotefilelog-pull-noshallow.t Thu Oct 04 10:03:10 2018 -0400 @@ -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
--- a/tests/test-remotefilelog-push-pull.t Tue Oct 16 17:02:48 2018 -0400 +++ b/tests/test-remotefilelog-push-pull.t Thu Oct 04 10:03:10 2018 -0400 @@ -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