changeset 3165:e78185746554

Add equality operators to changectx and filectx
author Matt Mackall <mpm@selenic.com>
date Fri, 29 Sep 2006 16:01:46 -0500
parents ff15ba23c1cf
children ebdb3f616bc0
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Sep 29 15:56:36 2006 -0500
+++ b/mercurial/context.py	Fri Sep 29 16:01:46 2006 -0500
@@ -31,6 +31,9 @@
     def __repr__(self):
         return "<changectx %s>" % short(self.node())
 
+    def __eq__(self, other):
+        return self._rev == other._rev
+
     def changeset(self):
         try:
             return self._changeset
@@ -126,6 +129,9 @@
     def __repr__(self):
         return "<filectx %s@%s>" % (self.path(), short(self.node()))
 
+    def __eq__(self, other):
+        return self._path == other._path and self._changeid == other._changeid
+
     def filerev(self): return self._filerev
     def filenode(self): return self._filenode
     def filelog(self): return self._filelog