hgext/largefiles/remotestore.py
changeset 15253 67d010779907
parent 15252 6e809bb4f969
child 17127 9e1616307c4c
equal deleted inserted replaced
15252:6e809bb4f969 15253:67d010779907
    48                 fd.close()
    48                 fd.close()
    49 
    49 
    50     def _getfile(self, tmpfile, filename, hash):
    50     def _getfile(self, tmpfile, filename, hash):
    51         # quit if the largefile isn't there
    51         # quit if the largefile isn't there
    52         stat = self._stat(hash)
    52         stat = self._stat(hash)
    53         if stat:
    53         if stat == 1:
    54             raise util.Abort(_('remotestore: largefile %s is %s') %
    54             raise util.Abort(_('remotestore: largefile %s is invalid') % hash)
    55                              (hash, stat == 1 and 'invalid' or 'missing'))
    55         elif stat == 2:
       
    56             raise util.Abort(_('remotestore: largefile %s is missing') % hash)
    56 
    57 
    57         try:
    58         try:
    58             length, infile = self._get(hash)
    59             length, infile = self._get(hash)
    59         except urllib2.HTTPError, e:
    60         except urllib2.HTTPError, e:
    60             # 401s get converted to util.Aborts; everything else is fine being
    61             # 401s get converted to util.Aborts; everything else is fine being
    62             raise basestore.StoreError(filename, hash, self.url, str(e))
    63             raise basestore.StoreError(filename, hash, self.url, str(e))
    63         except urllib2.URLError, e:
    64         except urllib2.URLError, e:
    64             # This usually indicates a connection problem, so don't
    65             # This usually indicates a connection problem, so don't
    65             # keep trying with the other files... they will probably
    66             # keep trying with the other files... they will probably
    66             # all fail too.
    67             # all fail too.
    67             raise util.Abort('%s: %s' % (self.url, str(e.reason)))
    68             raise util.Abort('%s: %s' % (self.url, e.reason))
    68         except IOError, e:
    69         except IOError, e:
    69             raise basestore.StoreError(filename, hash, self.url, str(e))
    70             raise basestore.StoreError(filename, hash, self.url, str(e))
    70 
    71 
    71         # Mercurial does not close its SSH connections after writing a stream
    72         # Mercurial does not close its SSH connections after writing a stream
    72         if length is not None:
    73         if length is not None:
    99             self.ui.warn(
   100             self.ui.warn(
   100                 _('changeset %s: %s missing\n')
   101                 _('changeset %s: %s missing\n')
   101                 % (cset, filename))
   102                 % (cset, filename))
   102             return True # failed
   103             return True # failed
   103         else:
   104         else:
   104             raise util.Abort(_('check failed, unexpected response'
   105             raise RuntimeError('verify failed: unexpected response from '
   105                                'statlfile: %d') % stat)
   106                                'statlfile (%r)' % stat)