localrepo.__getitem__: add slicing support
This allows the python slice syntax to be used with revision numbers when
indexing into a repository, such as repo[8:]
--- a/mercurial/localrepo.py Tue Dec 16 14:34:53 2014 -0800
+++ b/mercurial/localrepo.py Thu Dec 18 11:30:10 2014 -0800
@@ -454,6 +454,10 @@
def __getitem__(self, changeid):
if changeid is None:
return context.workingctx(self)
+ if isinstance(changeid, slice):
+ return [context.changectx(self, i)
+ for i in xrange(*changeid.indices(len(self)))
+ if i not in self.changelog.filteredrevs]
return context.changectx(self, changeid)
def __contains__(self, changeid):