comparison hgext/largefiles/remotestore.py @ 18573:003730ca254d

largefiles: fold oddly named _verify into remotestore.exists
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 08 Feb 2013 13:00:08 +0100
parents d43823f928fe
children 2a35296a6304
comparison
equal deleted inserted replaced
18572:5fe58f9332a4 18573:003730ca254d
27 % (source, self.url)) 27 % (source, self.url))
28 self.ui.debug( 28 self.ui.debug(
29 _('remotestore: put %s to remote store %s') % (source, self.url)) 29 _('remotestore: put %s to remote store %s') % (source, self.url))
30 30
31 def exists(self, hashes): 31 def exists(self, hashes):
32 return self._verify(hashes) 32 return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems())
33 33
34 def sendfile(self, filename, hash): 34 def sendfile(self, filename, hash):
35 self.ui.debug('remotestore: sendfile(%s, %s)\n' % (filename, hash)) 35 self.ui.debug('remotestore: sendfile(%s, %s)\n' % (filename, hash))
36 fd = None 36 fd = None
37 try: 37 try:
74 # Mercurial does not close its SSH connections after writing a stream 74 # Mercurial does not close its SSH connections after writing a stream
75 if length is not None: 75 if length is not None:
76 infile = lfutil.limitreader(infile, length) 76 infile = lfutil.limitreader(infile, length)
77 return lfutil.copyandhash(lfutil.blockstream(infile), tmpfile) 77 return lfutil.copyandhash(lfutil.blockstream(infile), tmpfile)
78 78
79 def _verify(self, hashes):
80 return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems())
81
82 def _verifyfile(self, cctx, cset, contents, standin, verified): 79 def _verifyfile(self, cctx, cset, contents, standin, verified):
83 filename = lfutil.splitstandin(standin) 80 filename = lfutil.splitstandin(standin)
84 if not filename: 81 if not filename:
85 return False 82 return False
86 fctx = cctx[standin] 83 fctx = cctx[standin]