##// END OF EJS Templates
sparse: refactor sparsechecksum()...
Gregory Szorc -
r33295:c72e9c61 default
parent child Browse files
Show More
@@ -493,9 +493,9 b' def _wraprepo(ui, repo):'
493 # resolve and can be slow.
493 # resolve and can be slow.
494 return self.filectx(profile, changeid=changeid).data()
494 return self.filectx(profile, changeid=changeid).data()
495
495
496 def sparsechecksum(self, filepath):
496 def _sparsechecksum(self, path):
497 fh = open(filepath)
497 data = self.vfs.read(path)
498 return hashlib.sha1(fh.read()).hexdigest()
498 return hashlib.sha1(data).hexdigest()
499
499
500 def _sparsesignature(self, includetemp=True):
500 def _sparsesignature(self, includetemp=True):
501 """Returns the signature string representing the contents of the
501 """Returns the signature string representing the contents of the
@@ -511,8 +511,7 b' def _wraprepo(ui, repo):'
511 if signature is None or (includetemp and tempsignature is None):
511 if signature is None or (includetemp and tempsignature is None):
512 signature = 0
512 signature = 0
513 try:
513 try:
514 sparsepath = self.vfs.join('sparse')
514 signature = self._sparsechecksum('sparse')
515 signature = self.sparsechecksum(sparsepath)
516 except (OSError, IOError):
515 except (OSError, IOError):
517 pass
516 pass
518 signaturecache['signature'] = signature
517 signaturecache['signature'] = signature
@@ -520,8 +519,7 b' def _wraprepo(ui, repo):'
520 tempsignature = 0
519 tempsignature = 0
521 if includetemp:
520 if includetemp:
522 try:
521 try:
523 tempsparsepath = self.vfs.join('tempsparse')
522 tempsignature = self._sparsechecksum('tempsparse')
524 tempsignature = self.sparsechecksum(tempsparsepath)
525 except (OSError, IOError):
523 except (OSError, IOError):
526 pass
524 pass
527 signaturecache['tempsignature'] = tempsignature
525 signaturecache['tempsignature'] = tempsignature
General Comments 0
You need to be logged in to leave comments. Login now