Mercurial > hg
diff hgext/largefiles/localstore.py @ 29067:207c0db08953
largefiles: change basestore._verifyfile to take list of files to check
Makes it easier to use batch stat calls in remotestore to decrease
number of round trips.
author | liscju <piotr.listkiewicz@gmail.com> |
---|---|
date | Tue, 03 May 2016 23:31:32 +0200 |
parents | 40bd01be5c25 |
children | f89f83c8393a |
line wrap: on
line diff
--- a/hgext/largefiles/localstore.py Mon Apr 11 21:33:07 2016 +0000 +++ b/hgext/largefiles/localstore.py Tue May 03 23:31:32 2016 +0200 @@ -42,29 +42,20 @@ with open(path, 'rb') as fd: return lfutil.copyandhash(fd, tmpfile) - 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 - - expecthash = fctx.data()[0:40] - storepath, exists = lfutil.findstorepath(self.remote, expecthash) - verified.add(key) - if not exists: - self.ui.warn( - _('changeset %s: %s references missing %s\n') - % (cset, filename, storepath)) - return True # failed - - if contents: - actualhash = lfutil.hashfile(storepath) - if actualhash != expecthash: + def _verifyfiles(self, contents, filestocheck): + failed = False + for cset, filename, expectedhash in filestocheck: + storepath, exists = lfutil.findstorepath(self.remote, expectedhash) + if not exists: self.ui.warn( - _('changeset %s: %s references corrupted %s\n') + _('changeset %s: %s references missing %s\n') % (cset, filename, storepath)) - return True # failed - return False + failed = True + elif contents: + actualhash = lfutil.hashfile(storepath) + if actualhash != expectedhash: + self.ui.warn( + _('changeset %s: %s references corrupted %s\n') + % (cset, filename, storepath)) + failed = True + return failed