D3270: largefiles: use command executor for batch operation
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Apr 13 19:14:43 UTC 2018
indygreg updated this revision to Diff 8123.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D3270?vs=8036&id=8123
REVISION DETAIL
https://phab.mercurial-scm.org/D3270
AFFECTED FILES
hgext/largefiles/wirestore.py
tests/test-largefiles-wireproto.t
CHANGE DETAILS
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}
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list