py3: fix test-remotefilelog-repack.t
authorAugie Fackler <augie@google.com>
Thu, 31 Jan 2019 11:12:59 -0500
changeset 41501 13dad5cb4b99
parent 41500 8c13f7b0ace6
child 41502 2f7408b7d247
py3: fix test-remotefilelog-repack.t This is uglier, but more obviously correct in my opinion. I guess Python 3 doesn't hang on to the exception as long, which seems reasonable. Differential Revision: https://phab.mercurial-scm.org/D5781
contrib/python3-whitelist
hgext/remotefilelog/basestore.py
--- a/contrib/python3-whitelist	Wed Jan 30 19:43:43 2019 -0500
+++ b/contrib/python3-whitelist	Thu Jan 31 11:12:59 2019 -0500
@@ -603,6 +603,7 @@
 test-remotefilelog-permisssions.t
 test-remotefilelog-prefetch.t
 test-remotefilelog-pull-noshallow.t
+test-remotefilelog-repack.t
 test-remotefilelog-share.t
 test-remotefilelog-sparse.t
 test-remotefilelog-tags.t
--- a/hgext/remotefilelog/basestore.py	Wed Jan 30 19:43:43 2019 -0500
+++ b/hgext/remotefilelog/basestore.py	Thu Jan 31 11:12:59 2019 -0500
@@ -410,16 +410,18 @@
         def wrapped(self, *args, **kwargs):
             retrylog = self.retrylog or noop
             funcname = fn.__name__
-            for i in pycompat.xrange(self.numattempts):
+            i = 0
+            while i < self.numattempts:
                 if i > 0:
                     retrylog('re-attempting (n=%d) %s\n' % (i, funcname))
                     self.markforrefresh()
+                i += 1
                 try:
                     return fn(self, *args, **kwargs)
                 except KeyError:
-                    pass
-            # retries exhausted
-            retrylog('retries exhausted in %s, raising KeyError\n' %
-                     pycompat.sysbytes(funcname))
-            raise
+                    if i == self.numattempts:
+                        # retries exhausted
+                        retrylog('retries exhausted in %s, raising KeyError\n' %
+                                 pycompat.sysbytes(funcname))
+                        raise
         return wrapped