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

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 18, 2014, 9:03 p.m.
Message ID <cdfd878d0fa54f86ac77.1392757438@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3688/
State Accepted
Commit aa73a6327df46ab2c0a9747101f971ff1afe901a
Headers show

Comments

Lucas Moscovicz - Feb. 18, 2014, 9:03 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@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.

Patch

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