[PATCH 1 of 2] revset: changed spanset to take a repo argument

Lucas Moscovicz lmoscovicz at fb.com
Tue Feb 18 15:03:58 CST 2014


# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1392752283 28800
#      Tue Feb 18 11:38:03 2014 -0800
# Node ID cdfd878d0fa54f86ac77f1e5ae0c33f26a8e7c0e
# Parent  84f626df10a5df208b211d3ad907562034d33c1e
revset: changed spanset to take a repo argument

This way, we can have by default the length of the repo as the end argument
and less code has to be aware of hidden revisions.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2132,10 +2132,13 @@
     """Duck type for baseset class which represents a range of revisions and
     can work lazily and without having all the range in memory
     """
-    def __init__(self, start, end, hiddenrevs=set()):
+    def __init__(self, repo, start=0, end=None):
         self._start = start
-        self._end = end
-        self._hiddenrevs = hiddenrevs
+        if end is not None:
+            self._end = end
+        else:
+            self._end = len(repo)
+        self._hiddenrevs = repo.changelog.filteredrevs
 
     def _contained(self, rev):
         return (rev <= self._start and rev > self._end) or (rev >= self._start


More information about the Mercurial-devel mailing list