[PATCH 4 of 5 remotefilelog-http] remotefilelog: introduce new getfile method

Durham Goode durham at fb.com
Thu Jul 16 12:36:12 CDT 2015



On 7/16/15, 8:36 AM, "raf at durin42.com" <raf at durin42.com> wrote:

># HG changeset patch
># User Augie Fackler <augie at google.com>
># Date 1435699951 14400
>#      Tue Jun 30 17:32:31 2015 -0400
># Node ID ea8c6483a58df0eb0c296abc17cc846be80ed8cb
># Parent  0080461e46716fa9732df990232f968ea3eb6d28
>remotefilelog: introduce new getfile method
>
>Right now, this is a naive fetch-one-file method. The next change will
>mark the method as batchable and use a batch in the client so that
>many files can be requested in a single RPC.

>
>diff --git a/remotefilelog/remotefilelogserver.py
>b/remotefilelog/remotefilelogserver.py
>--- a/remotefilelog/remotefilelogserver.py
>+++ b/remotefilelog/remotefilelogserver.py
>@@ -53,6 +53,7 @@ def onetimesetup(ui):
> 
>     # support file content requests
>     wireproto.commands['getfiles'] = (getfiles, '')
>+    wireproto.commands['getfile'] = (getfile, 'file node')
> 
>     class streamstate(object):
>         match = None
>@@ -155,9 +156,11 @@ def onetimesetup(ui):
>     def _capabilities(orig, repo, proto):
>         caps = orig(repo, proto)
>         if ((shallowrepo.requirement in repo.requirements or
>-            ui.configbool('remotefilelog', 'server'))
>-            and isinstance(proto, sshserver.sshserver)):
>-            caps.append(shallowrepo.requirement)
>+            ui.configbool('remotefilelog', 'server'))):
>+            if isinstance(proto, sshserver.sshserver):
>+                # legacy getfiles method which only works over ssh
>+                caps.append(shallowrepo.requirement)
>+            caps.append("getfile")

By always appending the getfile capability, won't this force even ssh
connections to use the new behavior? If that's intentional, do we have
numbers on how that affects perf?



More information about the Mercurial-devel mailing list