[PATCH 4 of 4] largefiles: makes verify batching stat calls to remote
Yuya Nishihara
yuya at tcha.org
Tue May 3 04:18:27 EDT 2016
On Mon, 02 May 2016 22:19:12 +0200, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1462210631 -7200
> # Mon May 02 19:37:11 2016 +0200
> # Branch stable
> # Node ID 5ca4f289ae02c580e19eafe7bf6168bda92664eb
> # Parent 889c3537ab941231ebc6881af6c1be6f0321294b
> largefiles: makes verify batching stat calls to remote
>
> Instead of sending stat calls for each file separately, it send
> one batch call with stat invocations for all files.
>
> diff -r 889c3537ab94 -r 5ca4f289ae02 hgext/largefiles/remotestore.py
> --- a/hgext/largefiles/remotestore.py Mon May 02 18:52:49 2016 +0200
> +++ b/hgext/largefiles/remotestore.py Mon May 02 19:37:11 2016 +0200
> @@ -67,28 +67,31 @@ class remotestore(basestore.basestore):
>
> def _verify(self, revs, contents, verified):
> failed = False
> + # filestocheck is list of (cset, filename, expectedhash)
> + filestocheck = []
> for rev in revs:
> cctx = self.repo[rev]
> cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
>
> for standin in cctx:
> - if self._verifyfile(cctx, cset, contents, standin, verified):
> - failed = True
> + filename = lfutil.splitstandin(standin)
> + if filename:
> + fctx = cctx[standin]
> + key = (filename, fctx.filenode())
> + expectedhash = fctx.data()[0:40]
> + verified.add(key)
> + filestocheck.append((cset, filename, expectedhash))
filestocheck would have duplicated entries if you do "verify --large --lfa".
> + expectedhashes = [expecthash for _, _, expecthash in filestocheck]
Hiding i18n._() isn't good.
> - def _verifyfile(self, cctx, cset, contents, standin, verified):
> - filename = lfutil.splitstandin(standin)
> - if not filename:
> - return False
> - fctx = cctx[standin]
> - key = (filename, fctx.filenode())
> - if key in verified:
> - return False
Before, duplicated entries would be dropped here.
I have no idea if the direction of this series is good. Since 'filestocheck'
can be built locally, another option would be to make _verifyfiles(filestocheck)
an abstract interface.
More information about the Mercurial-devel
mailing list