# HG changeset patch # User liscju # Date 1462312111 -7200 # Node ID 305f9c36a0f567641a73b230fc4c9c73c0dc3d2a # Parent 207c0db0895310d3b1910f0931136bc1acc06f7f largefiles: makes verify batching stat calls to remote Instead of sending stat calls for each files separately, it sends one batch call with stat invocations for all files. diff -r 207c0db08953 -r 305f9c36a0f5 hgext/largefiles/remotestore.py --- a/hgext/largefiles/remotestore.py Tue May 03 23:31:32 2016 +0200 +++ b/hgext/largefiles/remotestore.py Tue May 03 23:48:31 2016 +0200 @@ -67,8 +67,11 @@ def _verifyfiles(self, contents, filestocheck): failed = False + expectedhashes = [expectedhash + for cset, filename, expectedhash in filestocheck] + stats = self._stat(expectedhashes) for cset, filename, expectedhash in filestocheck: - stat = self._stat([expectedhash])[expectedhash] + stat = stats[expectedhash] if stat: if stat == 1: self.ui.warn( diff -r 207c0db08953 -r 305f9c36a0f5 tests/test-largefiles-wireproto.t --- a/tests/test-largefiles-wireproto.t Tue May 03 23:31:32 2016 +0200 +++ b/tests/test-largefiles-wireproto.t Tue May 03 23:48:31 2016 +0200 @@ -306,4 +306,46 @@ used all HGPORTs, kill all daemons $ killdaemons.py +largefiles should batch verify remote calls + + $ hg init batchverifymain + $ cd batchverifymain + $ echo "aaa" >> a + $ hg add --large a + $ hg commit -m "a" + Invoking status precommit hook + A a + $ echo "bbb" >> b + $ hg add --large b + $ hg commit -m "b" + Invoking status precommit hook + A b + $ cd .. + $ hg serve -R batchverifymain -d -p $HGPORT --pid-file hg.pid \ + > -A access.log + $ cat hg.pid >> $DAEMON_PIDS + $ hg clone http://localhost:$HGPORT batchverifyclone + requesting all changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + updating to branch default + getting changed largefiles + 2 largefiles updated, 0 removed + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg -R batchverifyclone verify --large + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 2 changesets, 2 total revisions + searching 1 changesets for largefiles + verified existence of 2 revisions of 2 largefiles + $ tail -1 access.log + 127.0.0.1 - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a (glob) + $ rm access.log + + $ killdaemons.py + #endif