changeset 20429:f5b560c60bcd

revset: added operations to duck type baseset Added more operations which are not lazy but only used so far to duck type baseset. Their implementations will be changed in future patches.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Thu, 06 Feb 2014 14:29:37 -0800
parents 2e33cda452f6
children d98ba4a87427
files mercurial/revset.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Feb 06 14:25:37 2014 -0800
+++ b/mercurial/revset.py	Thu Feb 06 14:29:37 2014 -0800
@@ -2100,5 +2100,26 @@
         l = baseset([r for r in self])
         return l + baseset(x)
 
+    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):
+        # Basic implementation to be changed in future patches.
+        self._subset = baseset(self._subset)
+        self._subset.sort(reverse=reverse)
+
+    def reverse(self):
+        self._subset.reverse()
+
+    def set(self):
+        return set([r for r in self])
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = symbols.values()