changeset 38639:2dd4cf273804

revlog: add a doctest for _segmentspan
author Boris Feld <boris.feld@octobus.net>
date Tue, 10 Jul 2018 10:18:46 +0200
parents 740f7d447222
children f62b8fb0a484
files mercurial/revlog.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Tue Jul 10 10:04:44 2018 +0200
+++ b/mercurial/revlog.py	Tue Jul 10 10:18:46 2018 +0200
@@ -269,6 +269,25 @@
     """Get the byte span of a segment of revisions
 
     revs is a sorted array of revision numbers
+
+    >>> revlog = _testrevlog([
+    ...  5,  #0
+    ...  10, #1
+    ...  12, #2
+    ...  12, #3 (empty)
+    ...  17, #4
+    ... ])
+
+    >>> _segmentspan(revlog, [0, 1, 2, 3, 4])
+    17
+    >>> _segmentspan(revlog, [0, 4])
+    17
+    >>> _segmentspan(revlog, [3, 4])
+    5
+    >>> _segmentspan(revlog, [1, 2, 3,])
+    7
+    >>> _segmentspan(revlog, [1, 3])
+    7
     """
     if not revs:
         return 0