hgext/largefiles/localstore.py
changeset 43077 687b865b95ad
parent 43076 2372284d9457
child 43085 eef9a2d67051
equal deleted inserted replaced
43076:2372284d9457 43077:687b865b95ad
    40 
    40 
    41     def _getfile(self, tmpfile, filename, hash):
    41     def _getfile(self, tmpfile, filename, hash):
    42         path = lfutil.findfile(self.remote, hash)
    42         path = lfutil.findfile(self.remote, hash)
    43         if not path:
    43         if not path:
    44             raise basestore.StoreError(
    44             raise basestore.StoreError(
    45                 filename, hash, self.url, _("can't get file locally")
    45                 filename, hash, self.url, _(b"can't get file locally")
    46             )
    46             )
    47         with open(path, 'rb') as fd:
    47         with open(path, b'rb') as fd:
    48             return lfutil.copyandhash(util.filechunkiter(fd), tmpfile)
    48             return lfutil.copyandhash(util.filechunkiter(fd), tmpfile)
    49 
    49 
    50     def _verifyfiles(self, contents, filestocheck):
    50     def _verifyfiles(self, contents, filestocheck):
    51         failed = False
    51         failed = False
    52         for cset, filename, expectedhash in filestocheck:
    52         for cset, filename, expectedhash in filestocheck:
    55                 storepath, exists = lfutil.findstorepath(
    55                 storepath, exists = lfutil.findstorepath(
    56                     self.remote, expectedhash
    56                     self.remote, expectedhash
    57                 )
    57                 )
    58             if not exists:
    58             if not exists:
    59                 self.ui.warn(
    59                 self.ui.warn(
    60                     _('changeset %s: %s references missing %s\n')
    60                     _(b'changeset %s: %s references missing %s\n')
    61                     % (cset, filename, storepath)
    61                     % (cset, filename, storepath)
    62                 )
    62                 )
    63                 failed = True
    63                 failed = True
    64             elif contents:
    64             elif contents:
    65                 actualhash = lfutil.hashfile(storepath)
    65                 actualhash = lfutil.hashfile(storepath)
    66                 if actualhash != expectedhash:
    66                 if actualhash != expectedhash:
    67                     self.ui.warn(
    67                     self.ui.warn(
    68                         _('changeset %s: %s references corrupted %s\n')
    68                         _(b'changeset %s: %s references corrupted %s\n')
    69                         % (cset, filename, storepath)
    69                         % (cset, filename, storepath)
    70                     )
    70                     )
    71                     failed = True
    71                     failed = True
    72         return failed
    72         return failed