changeset 40684:85b14f0dc334

doctest: add a `issnapshot` method to _testrevlog We'll need it soon.
author Boris Feld <boris.feld@octobus.net>
date Tue, 13 Nov 2018 15:06:29 +0100
parents a3183ca7ce8f
children 9c3c697267db
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Tue Nov 13 14:41:04 2018 +0100
+++ b/mercurial/revlogutils/deltas.py	Tue Nov 13 15:06:29 2018 +0100
@@ -38,11 +38,12 @@
 class _testrevlog(object):
     """minimalist fake revlog to use in doctests"""
 
-    def __init__(self, data, density=0.5, mingap=0):
+    def __init__(self, data, density=0.5, mingap=0, snapshot=()):
         """data is an list of revision payload boundaries"""
         self._data = data
         self._srdensitythreshold = density
         self._srmingapsize = mingap
+        self._snapshot = set(snapshot)
 
     def start(self, rev):
         if rev == 0:
@@ -58,6 +59,9 @@
     def __len__(self):
         return len(self._data)
 
+    def issnapshot(self, rev):
+        return rev in self._snapshot
+
 def slicechunk(revlog, revs, targetsize=None):
     """slice revs to reduce the amount of unrelated data to be read from disk.