diff mercurial/context.py @ 3715:6cb3aca69cdc

Make context __eq__ handle arbitrary RHS values
author Brendan Cully <brendan@kublai.com>
date Mon, 27 Nov 2006 15:27:09 -0800
parents 1bd70d40ec57
children 676b75547d13
line wrap: on
line diff
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -36,7 +36,10 @@ class changectx(object):
         return "<changectx %s>" % str(self)
 
     def __eq__(self, other):
-        return self._rev == other._rev
+        try:
+            return self._rev == other._rev
+        except AttributeError:
+            return False
 
     def __nonzero__(self):
         return self._rev != nullrev
@@ -176,7 +179,11 @@ class filectx(object):
         return "<filectx %s>" % str(self)
 
     def __eq__(self, other):
-        return self._path == other._path and self._changeid == other._changeid
+        try:
+            return (self._path == other._path
+                    and self._changeid == other._changeid)
+        except AttributeError:
+            return False
 
     def filectx(self, fileid):
         '''opens an arbitrary revision of the file without