D3922: revlog: adjust doctest examples to be portable to Python 3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Jul 11 17:56:30 UTC 2018


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

REVISION SUMMARY
  The range() builtin returns a special object rather than a list, but
  we really wanted a list in these examples.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -329,7 +329,7 @@
     ...  91, #15 (5)
     ... ])
 
-    >>> list(_slicechunk(revlog, range(16)))
+    >>> list(_slicechunk(revlog, list(range(16))))
     [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]]
     >>> list(_slicechunk(revlog, [0, 15]))
     [[0], [15]]
@@ -460,7 +460,7 @@
     ...  91, #15 (5)
     ... ])
 
-    >>> list(_slicechunktodensity(revlog, range(16)))
+    >>> list(_slicechunktodensity(revlog, list(range(16))))
     [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]]
     >>> list(_slicechunktodensity(revlog, [0, 15]))
     [[0], [15]]



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


More information about the Mercurial-devel mailing list