[PATCH 4 of 4] largefiles: makes verify batching stat calls to remote

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Tue May 3 18:10:36 EDT 2016


>
> filestocheck would have duplicated entries if you do "verify --large
> --lfa".


You are right, i changed it in V2

 Hiding i18n._() isn't good.


Changed in V2

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.


I totally agree, i changed it in V2 and it looks much better. Thanks for
suggestion.


2016-05-03 10:18 GMT+02:00 Yuya Nishihara <yuya at tcha.org>:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160504/fb65314c/attachment.html>


More information about the Mercurial-devel mailing list