hgext/largefiles/localstore.py
changeset 27769 40bd01be5c25
parent 24630 c082a4756ed7
child 29067 207c0db08953
equal deleted inserted replaced
27768:5ef99738a562 27769:40bd01be5c25
    37     def _getfile(self, tmpfile, filename, hash):
    37     def _getfile(self, tmpfile, filename, hash):
    38         path = lfutil.findfile(self.remote, hash)
    38         path = lfutil.findfile(self.remote, hash)
    39         if not path:
    39         if not path:
    40             raise basestore.StoreError(filename, hash, self.url,
    40             raise basestore.StoreError(filename, hash, self.url,
    41                 _("can't get file locally"))
    41                 _("can't get file locally"))
    42         fd = open(path, 'rb')
    42         with open(path, 'rb') as fd:
    43         try:
       
    44             return lfutil.copyandhash(fd, tmpfile)
    43             return lfutil.copyandhash(fd, tmpfile)
    45         finally:
       
    46             fd.close()
       
    47 
    44 
    48     def _verifyfile(self, cctx, cset, contents, standin, verified):
    45     def _verifyfile(self, cctx, cset, contents, standin, verified):
    49         filename = lfutil.splitstandin(standin)
    46         filename = lfutil.splitstandin(standin)
    50         if not filename:
    47         if not filename:
    51             return False
    48             return False