Patchwork [4,of,5] _spanset: drop __getitem__ implementation

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 15, 2014, 7:58 p.m.
Message ID <7673821316853069c725.1413403081@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6284/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 15, 2014, 7:58 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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