Patchwork [v2] fileserverclient: make iterbatch() case work with new store

login
register
mail settings
Submitter via Mercurial-devel
Date May 20, 2016, 8:12 p.m.
Message ID <bd7f8f061431ae80d576.1463775133@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/15179/
State Accepted
Headers show

Comments

via Mercurial-devel - May 20, 2016, 8:12 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1463636360 25200
#      Wed May 18 22:39:20 2016 -0700
# Node ID bd7f8f061431ae80d5769e51cf7f1ac055a9780b
# Parent  3df8af03df789dee35c6026fce5ec1a59b43cca0
fileserverclient: make iterbatch() case work with new store

The iterbatch() handling added in 08ca5042a8a1 (fileserverclient: use
new iterbatch() method, 2016-03-22) was broken by 06d5f64ccb7c (store:
change fileserviceclient to write via new store, 2016-04-04). Fix it
by copying the pattern introduced elsewhere in that change.
Durham Goode - May 23, 2016, 12:55 p.m.
Accepted and pushed, thanks

On 5/20/16, 9:12 PM, "Martin von Zweigbergk" <martinvonz@google.com> wrote:

># HG changeset patch

># User Martin von Zweigbergk <martinvonz@google.com>

># Date 1463636360 25200

>#      Wed May 18 22:39:20 2016 -0700

># Node ID bd7f8f061431ae80d5769e51cf7f1ac055a9780b

># Parent  3df8af03df789dee35c6026fce5ec1a59b43cca0

>fileserverclient: make iterbatch() case work with new store

>

>The iterbatch() handling added in 08ca5042a8a1 (fileserverclient: use

>new iterbatch() method, 2016-03-22) was broken by 06d5f64ccb7c (store:

>change fileserviceclient to write via new store, 2016-04-04). Fix it

>by copying the pattern introduced elsewhere in that change.

>

>diff -r 3df8af03df78 -r bd7f8f061431 remotefilelog/fileserverclient.py

>--- a/remotefilelog/fileserverclient.py	Mon Jan 04 21:32:21 2016 -0800

>+++ b/remotefilelog/fileserverclient.py	Wed May 18 22:39:20 2016 -0700

>@@ -146,7 +146,9 @@

>             b.getfile(file_, node)

>         b.submit()

>         for m, r in itertools.izip(missed, b.results()):

>-            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), m)

>+            file_ = idmap[m]

>+            node = m[-40:]

>+            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), file_, node)

>             progresstick()

>         return

>     while missed:

>diff -r 3df8af03df78 -r bd7f8f061431 tests/test-http.t

>--- a/tests/test-http.t	Mon Jan 04 21:32:21 2016 -0800

>+++ b/tests/test-http.t	Wed May 18 22:39:20 2016 -0700

>@@ -77,6 +77,21 @@

>   

>   1\x00cannot fetch remote files from shallow repo (no-eol) (esc)

> 

>-Both error logs should be empty:

>+Clones should work with httppostargs turned on

>+

>+  $ cd master

>+  $ hg --config experimental.httppostargs=1 serve -p $HGPORT2 -d --pid-file=../hg3.pid -E ../error3.log

>+

>+  $ cd ..

>+  $ cat hg3.pid >> $DAEMON_PIDS

>+

>+Clear filenode cache so we can test fetching with a modified batch size

>+  $ rm -r $TESTTMP/hgcache

>+

>+  $ hgcloneshallow https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A-24HGPORT2_&d=CwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=y6rE490sDWIB2FFUgod6A5PoIj391JLRZnRsCX0gUU8&s=_8zrSk7p3wpT9X2FrZNXSrK4yzcbG3Iz638Wh8A_Y6A&e=  shallow-postargs -q

>+  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)

>+

>+All error logs should be empty:

>   $ cat error.log

>   $ cat error2.log

>+  $ cat error3.log

Patch

diff -r 3df8af03df78 -r bd7f8f061431 remotefilelog/fileserverclient.py
--- a/remotefilelog/fileserverclient.py	Mon Jan 04 21:32:21 2016 -0800
+++ b/remotefilelog/fileserverclient.py	Wed May 18 22:39:20 2016 -0700
@@ -146,7 +146,9 @@ 
             b.getfile(file_, node)
         b.submit()
         for m, r in itertools.izip(missed, b.results()):
-            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), m)
+            file_ = idmap[m]
+            node = m[-40:]
+            receivemissing(io.BytesIO('%d\n%s' % (len(r), r)), file_, node)
             progresstick()
         return
     while missed:
diff -r 3df8af03df78 -r bd7f8f061431 tests/test-http.t
--- a/tests/test-http.t	Mon Jan 04 21:32:21 2016 -0800
+++ b/tests/test-http.t	Wed May 18 22:39:20 2016 -0700
@@ -77,6 +77,21 @@ 
   
   1\x00cannot fetch remote files from shallow repo (no-eol) (esc)
 
-Both error logs should be empty:
+Clones should work with httppostargs turned on
+
+  $ cd master
+  $ hg --config experimental.httppostargs=1 serve -p $HGPORT2 -d --pid-file=../hg3.pid -E ../error3.log
+
+  $ cd ..
+  $ cat hg3.pid >> $DAEMON_PIDS
+
+Clear filenode cache so we can test fetching with a modified batch size
+  $ rm -r $TESTTMP/hgcache
+
+  $ hgcloneshallow http://localhost:$HGPORT2/ shallow-postargs -q
+  1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
+
+All error logs should be empty:
   $ cat error.log
   $ cat error2.log
+  $ cat error3.log