comparison mercurial/subrepo.py @ 25172:ca9c02cb81be

subrepo: further replacement of try/except with 'next' Burn StopIteration, Burn!
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 18 May 2015 12:31:41 -0500
parents df63d4843581
children 63a57a2727b6
comparison
equal deleted inserted replaced
25171:d647f97f88dd 25172:ca9c02cb81be
594 lock.release() 594 lock.release()
595 595
596 def _storeclean(self, path): 596 def _storeclean(self, path):
597 clean = True 597 clean = True
598 itercache = self._calcstorehash(path) 598 itercache = self._calcstorehash(path)
599 try: 599 for filehash in self._readstorehashcache(path):
600 for filehash in self._readstorehashcache(path): 600 if filehash != next(itercache, None):
601 if filehash != itercache.next(): 601 clean = False
602 clean = False 602 break
603 break 603 if clean:
604 except StopIteration: 604 # if not empty:
605 # the cached and current pull states have a different size 605 # the cached and current pull states have a different size
606 clean = False 606 clean = next(itercache, None) is None
607 if clean:
608 try:
609 itercache.next()
610 # the cached and current pull states have a different size
611 clean = False
612 except StopIteration:
613 pass
614 return clean 607 return clean
615 608
616 def _calcstorehash(self, remotepath): 609 def _calcstorehash(self, remotepath):
617 '''calculate a unique "store hash" 610 '''calculate a unique "store hash"
618 611