Mercurial > hg-stable
changeset 29068:305f9c36a0f5
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.
author | liscju <piotr.listkiewicz@gmail.com> |
---|---|
date | Tue, 03 May 2016 23:48:31 +0200 |
parents | 207c0db08953 |
children | e2a1648a6ce7 |
files | hgext/largefiles/remotestore.py tests/test-largefiles-wireproto.t |
diffstat | 2 files changed, 46 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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(
--- 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