Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 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 | b68984d288d4 |
comparison
equal
deleted
inserted
replaced
20428:2e33cda452f6 | 20429:f5b560c60bcd |
---|---|
2098 | 2098 |
2099 def __add__(self, x): | 2099 def __add__(self, x): |
2100 l = baseset([r for r in self]) | 2100 l = baseset([r for r in self]) |
2101 return l + baseset(x) | 2101 return l + baseset(x) |
2102 | 2102 |
2103 def __len__(self): | |
2104 # Basic implementation to be changed in future patches. | |
2105 l = baseset([r for r in self]) | |
2106 return len(l) | |
2107 | |
2108 def __getitem__(self, x): | |
2109 # Basic implementation to be changed in future patches. | |
2110 l = baseset([r for r in self]) | |
2111 return l[x] | |
2112 | |
2113 def sort(self, reverse=False): | |
2114 # Basic implementation to be changed in future patches. | |
2115 self._subset = baseset(self._subset) | |
2116 self._subset.sort(reverse=reverse) | |
2117 | |
2118 def reverse(self): | |
2119 self._subset.reverse() | |
2120 | |
2121 def set(self): | |
2122 return set([r for r in self]) | |
2123 | |
2103 # tell hggettext to extract docstrings from these functions: | 2124 # tell hggettext to extract docstrings from these functions: |
2104 i18nfunctions = symbols.values() | 2125 i18nfunctions = symbols.values() |