Patchwork [remotefilelog-ext] fileserverclient: add option to provide file path to cacheprocess

login
register
mail settings
Submitter Augie Fackler
Date Jan. 19, 2016, 3:48 p.m.
Message ID <acf7a6bb3ce489c12065.1453218492@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/12831/
State Accepted
Headers show

Comments

Augie Fackler - Jan. 19, 2016, 3:48 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1453218309 18000
#      Tue Jan 19 10:45:09 2016 -0500
# Node ID acf7a6bb3ce489c12065b171e4e7f44f49ce37b7
# Parent  b57b617d85adb373dc5c7b22e9fa750430163632
fileserverclient: add option to provide file path to cacheprocess

For our uses of remotefilelog, life is significantly easier if we also
have the file path rather than just a hash of the file path. Hide this
behind a config knob so users can enable it or not as makes sense.
Durham Goode - Jan. 19, 2016, 11:50 p.m.
On 1/19/16 7:48 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1453218309 18000
> #      Tue Jan 19 10:45:09 2016 -0500
> # Node ID acf7a6bb3ce489c12065b171e4e7f44f49ce37b7
> # Parent  b57b617d85adb373dc5c7b22e9fa750430163632
> fileserverclient: add option to provide file path to cacheprocess
>
> For our uses of remotefilelog, life is significantly easier if we also
> have the file path rather than just a hash of the file path. Hide this
> behind a config knob so users can enable it or not as makes sense.
>
> diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py
> --- a/remotefilelog/fileserverclient.py
> +++ b/remotefilelog/fileserverclient.py
> @@ -166,6 +166,8 @@ class fileserverclient(object):
>           self.cacheprocess = ui.config("remotefilelog", "cacheprocess")
>           if self.cacheprocess:
>               self.cacheprocess = util.expandpath(self.cacheprocess)
> +        self.cacheprocesspath = ui.configbool(
I don't really like calling it 'cacheprocesspath', since it's not the 
path to the cache process (which is what self.cacheprocess is). Mind if 
I change it inflight?  I'll leave the ui facing option name alone.
> +            "remotefilelog", "cacheprocess.includepath")
>           self.debugoutput = ui.configbool("remotefilelog", "debug")
>   
>           self.localcache = localcache(repo)
> @@ -204,6 +206,8 @@ class fileserverclient(object):
>           reponame = repo.name
>           for file, id in fileids:
>               fullid = getcachekey(reponame, file, id)
> +            if self.cacheprocesspath:
> +                request += file + '\0'
>               request += fullid + "\n"
>               idmap[fullid] = file
>
Augie Fackler - Jan. 19, 2016, 11:51 p.m.
On Jan 19, 2016 18:50, "Durham Goode" <durham@fb.com> wrote:
>
> On 1/19/16 7:48 AM, Augie Fackler wrote:
>>
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1453218309 18000
>> #      Tue Jan 19 10:45:09 2016 -0500
>> # Node ID acf7a6bb3ce489c12065b171e4e7f44f49ce37b7
>> # Parent  b57b617d85adb373dc5c7b22e9fa750430163632
>> fileserverclient: add option to provide file path to cacheprocess
>>
>> For our uses of remotefilelog, life is significantly easier if we also
>> have the file path rather than just a hash of the file path. Hide this
>> behind a config knob so users can enable it or not as makes sense.
>>
>> diff --git a/remotefilelog/fileserverclient.py
b/remotefilelog/fileserverclient.py
>> --- a/remotefilelog/fileserverclient.py
>> +++ b/remotefilelog/fileserverclient.py
>> @@ -166,6 +166,8 @@ class fileserverclient(object):
>>           self.cacheprocess = ui.config("remotefilelog", "cacheprocess")
>>           if self.cacheprocess:
>>               self.cacheprocess = util.expandpath(self.cacheprocess)
>> +        self.cacheprocesspath = ui.configbool(
>
> I don't really like calling it 'cacheprocesspath', since it's not the
path to the cache process (which is what self.cacheprocess is). Mind if I
change it inflight?  I'll leave the ui facing option name alone.

By all means. I had no good name so I just picked something. Thanks!

>
>> +            "remotefilelog", "cacheprocess.includepath")
>>           self.debugoutput = ui.configbool("remotefilelog", "debug")
>>             self.localcache = localcache(repo)
>> @@ -204,6 +206,8 @@ class fileserverclient(object):
>>           reponame = repo.name
>>           for file, id in fileids:
>>               fullid = getcachekey(reponame, file, id)
>> +            if self.cacheprocesspath:
>> +                request += file + '\0'
>>               request += fullid + "\n"
>>               idmap[fullid] = file
>>
>
>
Durham Goode - Jan. 27, 2016, 9:25 p.m.
On 1/19/16, 7:48 AM, "Augie Fackler" <raf@durin42.com> wrote:



># HG changeset patch

># User Augie Fackler <augie@google.com>

># Date 1453218309 18000

>#      Tue Jan 19 10:45:09 2016 -0500

># Node ID acf7a6bb3ce489c12065b171e4e7f44f49ce37b7

># Parent  b57b617d85adb373dc5c7b22e9fa750430163632

>fileserverclient: add option to provide file path to cacheprocess

>

>For our uses of remotefilelog, life is significantly easier if we also

>have the file path rather than just a hash of the file path. Hide this

>behind a config knob so users can enable it or not as makes sense.


Pushed, with the local variable renamed to cacheprocesspasspath and with a comment in the code.

Patch

diff --git a/remotefilelog/fileserverclient.py b/remotefilelog/fileserverclient.py
--- a/remotefilelog/fileserverclient.py
+++ b/remotefilelog/fileserverclient.py
@@ -166,6 +166,8 @@  class fileserverclient(object):
         self.cacheprocess = ui.config("remotefilelog", "cacheprocess")
         if self.cacheprocess:
             self.cacheprocess = util.expandpath(self.cacheprocess)
+        self.cacheprocesspath = ui.configbool(
+            "remotefilelog", "cacheprocess.includepath")
         self.debugoutput = ui.configbool("remotefilelog", "debug")
 
         self.localcache = localcache(repo)
@@ -204,6 +206,8 @@  class fileserverclient(object):
         reponame = repo.name
         for file, id in fileids:
             fullid = getcachekey(reponame, file, id)
+            if self.cacheprocesspath:
+                request += file + '\0'
             request += fullid + "\n"
             idmap[fullid] = file