Patchwork [3,of,5] filteredset: drop __getitem__ implementation

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 15, 2014, 7:58 p.m.
Message ID <fc1641ed19d7a454c10e.1413403080@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6282/
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 1413401912 25200
#      Wed Oct 15 12:38:32 2014 -0700
# Node ID fc1641ed19d7a454c10e24711135b4a3d770fe11
# Parent  98ec45f8b54e2935711b64132f179924586ccc33
filteredset: 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
@@ -2443,15 +2443,10 @@  class filteredset(abstractsmartset):
     def __len__(self):
         # Basic implementation to be changed in future patches.
         l = baseset([r for r in self])
         return len(l)
 
-    def __getitem__(self, x):
-        # Basic implementation to be changed in future patches.
-        l = baseset([r for r in self])
-        return l[x]
-
     def sort(self, reverse=False):
         self._subset.sort(reverse=reverse)
 
     def reverse(self):
         self._subset.reverse()