# HG changeset patch # User Matt Mackall # Date 1159570071 18000 # Node ID 05c588e1803dc96b29913f81a0878414eb274f0c # Parent e67c22bc8bba14d5bf57abed4b48be81502a36fe context: add __nonzero__ methods diff -r e67c22bc8bba -r 05c588e1803d mercurial/context.py --- a/mercurial/context.py Fri Sep 29 16:39:38 2006 -0500 +++ b/mercurial/context.py Fri Sep 29 17:47:51 2006 -0500 @@ -37,6 +37,9 @@ def __eq__(self, other): return self._rev == other._rev + def __nonzero__(self): + return self._rev != -1 + def changeset(self): try: return self._changeset @@ -129,6 +132,9 @@ else: raise AttributeError, name + def __nonzero__(self): + return self._filerev != nullid + def __str__(self): return "%s@%s" % (self.path(), short(self.node()))