[PATCH 4 of 5] _spanset: drop __getitem__ implementation

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Oct 15 14:58:01 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1413401927 25200
#      Wed Oct 15 12:38:47 2014 -0700
# Node ID 7673821316853069c725ee50ce037434bb5d30db
# Parent  fc1641ed19d7a454c10e24711135b4a3d770fe11
_spanset: drop __getitem__ implementation

It is expensive and not part of the official smartset API.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2905,15 +2905,10 @@ class _spanset(abstractsmartset):
             for rev in self._hiddenrevs:
                 if (end < rev <= start) or (start <= rev < end):
                     count += 1
             return abs(self._end - self._start) - count
 
-    def __getitem__(self, x):
-        # Basic implementation to be changed in future patches.
-        l = baseset([r for r in self])
-        return l[x]
-
     def isascending(self):
         return self._start <= self._end
 
     def isdescending(self):
         return self._start >= self._end


More information about the Mercurial-devel mailing list