D5604: tests: fix up uses of xrange in remotefilelog tests for py3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Jan 16 16:16:45 UTC 2019


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5604

AFFECTED FILES
  tests/test-remotefilelog-cacheprocess.t
  tests/test-remotefilelog-datapack.py

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-datapack.py b/tests/test-remotefilelog-datapack.py
--- a/tests/test-remotefilelog-datapack.py
+++ b/tests/test-remotefilelog-datapack.py
@@ -18,6 +18,7 @@
 sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
 from mercurial.node import nullid
 from mercurial import (
+    pycompat,
     ui as uimod,
 )
 from hgext.remotefilelog import (
@@ -245,7 +246,7 @@
         revisions = []
         blobs = {}
         total = basepack.SMALLFANOUTCUTOFF + 1
-        for i in xrange(total):
+        for i in pycompat.xrange(total):
             filename = "filename-%s" % i
             content = filename
             node = self.getHash(content)
@@ -328,7 +329,7 @@
         ]
         for packsize in packsizes:
             revisions = []
-            for i in xrange(packsize):
+            for i in pycompat.xrange(packsize):
                 filename = "filename-%s" % i
                 content = "content-%s" % i
                 node = self.getHash(content)
diff --git a/tests/test-remotefilelog-cacheprocess.t b/tests/test-remotefilelog-cacheprocess.t
--- a/tests/test-remotefilelog-cacheprocess.t
+++ b/tests/test-remotefilelog-cacheprocess.t
@@ -18,6 +18,8 @@
   > import os
   > import shutil
   > import sys
+  > if sys.version_info[0] > 2:
+  >     xrange = range
   > f = open('$TESTTMP/cachelog.log', 'w')
   > srccache = os.path.join('$TESTTMP', 'oldhgcache')
   > def log(message):



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list