38 return retval |
39 return retval |
39 |
40 |
40 def _getfile(self, tmpfile, filename, hash): |
41 def _getfile(self, tmpfile, filename, hash): |
41 path = lfutil.findfile(self.remote, hash) |
42 path = lfutil.findfile(self.remote, hash) |
42 if not path: |
43 if not path: |
43 raise basestore.StoreError(filename, hash, self.url, |
44 raise basestore.StoreError( |
44 _("can't get file locally")) |
45 filename, hash, self.url, _("can't get file locally") |
|
46 ) |
45 with open(path, 'rb') as fd: |
47 with open(path, 'rb') as fd: |
46 return lfutil.copyandhash( |
48 return lfutil.copyandhash(util.filechunkiter(fd), tmpfile) |
47 util.filechunkiter(fd), tmpfile) |
|
48 |
49 |
49 def _verifyfiles(self, contents, filestocheck): |
50 def _verifyfiles(self, contents, filestocheck): |
50 failed = False |
51 failed = False |
51 for cset, filename, expectedhash in filestocheck: |
52 for cset, filename, expectedhash in filestocheck: |
52 storepath, exists = lfutil.findstorepath(self.repo, expectedhash) |
53 storepath, exists = lfutil.findstorepath(self.repo, expectedhash) |
53 if not exists: |
54 if not exists: |
54 storepath, exists = lfutil.findstorepath( |
55 storepath, exists = lfutil.findstorepath( |
55 self.remote, expectedhash) |
56 self.remote, expectedhash |
|
57 ) |
56 if not exists: |
58 if not exists: |
57 self.ui.warn( |
59 self.ui.warn( |
58 _('changeset %s: %s references missing %s\n') |
60 _('changeset %s: %s references missing %s\n') |
59 % (cset, filename, storepath)) |
61 % (cset, filename, storepath) |
|
62 ) |
60 failed = True |
63 failed = True |
61 elif contents: |
64 elif contents: |
62 actualhash = lfutil.hashfile(storepath) |
65 actualhash = lfutil.hashfile(storepath) |
63 if actualhash != expectedhash: |
66 if actualhash != expectedhash: |
64 self.ui.warn( |
67 self.ui.warn( |
65 _('changeset %s: %s references corrupted %s\n') |
68 _('changeset %s: %s references corrupted %s\n') |
66 % (cset, filename, storepath)) |
69 % (cset, filename, storepath) |
|
70 ) |
67 failed = True |
71 failed = True |
68 return failed |
72 return failed |