subrepo: further replacement of try/except with 'next'
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 18 May 2015 12:31:41 -0500
changeset 25172 ca9c02cb81be
parent 25171 d647f97f88dd
child 25173 7358b5d9991e
subrepo: further replacement of try/except with 'next' Burn StopIteration, Burn!
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):