Mercurial > hg
diff hgext/largefiles/remotestore.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 | 032c4c2f802a |
children | 305f9c36a0f5 |
line wrap: on
line diff
--- a/hgext/largefiles/remotestore.py Mon Apr 11 21:33:07 2016 +0000 +++ b/hgext/largefiles/remotestore.py Tue May 03 23:31:32 2016 +0200 @@ -65,34 +65,25 @@ return lfutil.copyandhash(chunks, 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 - - verified.add(key) - - expecthash = fctx.data()[0:40] - stat = self._stat([expecthash])[expecthash] - if not stat: - return False - elif stat == 1: - self.ui.warn( - _('changeset %s: %s: contents differ\n') - % (cset, filename)) - return True # failed - elif stat == 2: - self.ui.warn( - _('changeset %s: %s missing\n') - % (cset, filename)) - return True # failed - else: - raise RuntimeError('verify failed: unexpected response from ' - 'statlfile (%r)' % stat) + def _verifyfiles(self, contents, filestocheck): + failed = False + for cset, filename, expectedhash in filestocheck: + stat = self._stat([expectedhash])[expectedhash] + if stat: + if stat == 1: + self.ui.warn( + _('changeset %s: %s: contents differ\n') + % (cset, filename)) + failed = True + elif stat == 2: + self.ui.warn( + _('changeset %s: %s missing\n') + % (cset, filename)) + failed = True + else: + raise RuntimeError('verify failed: unexpected response ' + 'from statlfile (%r)' % stat) + return failed def batch(self): '''Support for remote batching.'''