changeset 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 d647f97f88dd
children 7358b5d9991e
files mercurial/subrepo.py
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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):