Patchwork D3270: largefiles: use command executor for batch operation

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 9:45 p.m.
Message ID <76c4553fe3b36593aae106e7f2e23817@localhost.localdomain>
Download mbox | patch
Permalink /patch/30909/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2018, 9:45 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6c55ce51d6c3: largefiles: use command executor for batch operation (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3270?vs=8123&id=8168

REVISION DETAIL
  https://phab.mercurial-scm.org/D3270

AFFECTED FILES
  hgext/largefiles/wirestore.py
  tests/test-largefiles-wireproto.t

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t
--- a/tests/test-largefiles-wireproto.t
+++ b/tests/test-largefiles-wireproto.t
@@ -312,7 +312,7 @@ 
   getting changed largefiles
   using http://localhost:$HGPORT2/
   sending capabilities command
-  sending batch command
+  sending statlfile command
   getting largefiles: 0/1 files (0.00%)
   getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90
   sending getlfile command
@@ -400,7 +400,7 @@ 
   searching 3 changesets for largefiles
   verified existence of 3 revisions of 3 largefiles
   $ tail -1 access.log
-  $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3Dc8559c3c9cfb42131794b7d8009230403b9b454c x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
+  $LOCALIP - - [$LOGDATE$] "GET /?cmd=statlfile HTTP/1.1" 200 - x-hgarg-1:sha=c8559c3c9cfb42131794b7d8009230403b9b454c x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
 
   $ killdaemons.py
 
diff --git a/hgext/largefiles/wirestore.py b/hgext/largefiles/wirestore.py
--- a/hgext/largefiles/wirestore.py
+++ b/hgext/largefiles/wirestore.py
@@ -32,8 +32,12 @@ 
         '''For each hash, return 0 if it is available, other values if not.
         It is usually 2 if the largefile is missing, but might be 1 the server
         has a corrupted copy.'''
-        batch = self.remote.iterbatch()
-        for hash in hashes:
-            batch.statlfile(hash)
-        batch.submit()
-        return dict(zip(hashes, batch.results()))
+
+        with self.remote.commandexecutor() as e:
+            fs = []
+            for hash in hashes:
+                fs.append((hash, e.callcommand('statlfile', {
+                    'sha': hash,
+                })))
+
+            return {hash: f.result() for hash, f in fs}