hgext/largefiles/remotestore.py
changeset 19008 9d33d6e0d442
parent 19004 6614e5e24e66
child 19948 72214af683a2
equal deleted inserted replaced
19007:266b5fb72f26 19008:9d33d6e0d442
    45         finally:
    45         finally:
    46             if fd:
    46             if fd:
    47                 fd.close()
    47                 fd.close()
    48 
    48 
    49     def _getfile(self, tmpfile, filename, hash):
    49     def _getfile(self, tmpfile, filename, hash):
    50         # quit if the largefile isn't there
       
    51         stat = self._stat([hash])[hash]
       
    52         if stat == 1:
       
    53             raise util.Abort(_('remotestore: largefile %s is invalid') % hash)
       
    54         elif stat == 2:
       
    55             raise util.Abort(_('remotestore: largefile %s is missing') % hash)
       
    56         elif stat != 0:
       
    57             raise RuntimeError('error getting file: unexpected response from '
       
    58                                'statlfile (%r)' % stat)
       
    59 
       
    60         try:
    50         try:
    61             chunks = self._get(hash)
    51             chunks = self._get(hash)
    62         except urllib2.HTTPError, e:
    52         except urllib2.HTTPError, e:
    63             # 401s get converted to util.Aborts; everything else is fine being
    53             # 401s get converted to util.Aborts; everything else is fine being
    64             # turned into a StoreError
    54             # turned into a StoreError