Mercurial > hg-stable
diff mercurial/context.py @ 4909:1fd7a99d98f6
context: add __contains__, __getitem__, and __iter__
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 21 Jul 2007 16:02:09 -0500 |
parents | 3b081f2a77b2 |
children | 26c060922085 |
line wrap: on
line diff
--- a/mercurial/context.py Sat Jul 21 16:02:09 2007 -0500 +++ b/mercurial/context.py Sat Jul 21 16:02:09 2007 -0500 @@ -60,6 +60,18 @@ else: raise AttributeError, name + def __contains__(self, key): + return key in self._manifest + + def __getitem__(self, key): + return self.filectx(key) + + def __iter__(self): + a = self._manifest.keys() + a.sort() + for f in a: + return f + def changeset(self): return self._changeset def manifest(self): return self._manifest