# HG changeset patch # User Pierre-Yves David # Date 1431970301 18000 # Node ID ca9c02cb81be0fa90fe511fbdfda0e1263406bf6 # Parent d647f97f88ddb072b48a09186fb2a1d239aa4390 subrepo: further replacement of try/except with 'next' Burn StopIteration, Burn! diff -r d647f97f88dd -r ca9c02cb81be mercurial/subrepo.py --- a/mercurial/subrepo.py Mon May 18 12:27:15 2015 -0500 +++ b/mercurial/subrepo.py Mon May 18 12:31:41 2015 -0500 @@ -596,21 +596,14 @@ def _storeclean(self, path): clean = True itercache = self._calcstorehash(path) - try: - for filehash in self._readstorehashcache(path): - if filehash != itercache.next(): - clean = False - break - except StopIteration: + for filehash in self._readstorehashcache(path): + if filehash != next(itercache, None): + clean = False + break + if clean: + # if not empty: # the cached and current pull states have a different size - clean = False - if clean: - try: - itercache.next() - # the cached and current pull states have a different size - clean = False - except StopIteration: - pass + clean = next(itercache, None) is None return clean def _calcstorehash(self, remotepath):