basectx: move __eq__ from changectx
authorSean Farley <sean.michael.farley@gmail.com>
Mon, 05 Aug 2013 17:00:09 -0500
changeset 19547 0537c0cfd87c
parent 19546 a45cf68dd9a2
child 19548 730fdcaa791d
basectx: move __eq__ from changectx We also add type checking for extra protection.
mercurial/context.py
--- a/mercurial/context.py	Fri Aug 02 18:24:08 2013 -0500
+++ b/mercurial/context.py	Mon Aug 05 17:00:09 2013 -0500
@@ -44,6 +44,12 @@
     def __repr__(self):
         return "<%s %s>" % (type(self).__name__, str(self))
 
+    def __eq__(self, other):
+        try:
+            return type(self) == type(other) and self._rev == other._rev
+        except AttributeError:
+            return False
+
     def rev(self):
         return self._rev
     def node(self):
@@ -162,12 +168,6 @@
         except AttributeError:
             return id(self)
 
-    def __eq__(self, other):
-        try:
-            return self._rev == other._rev
-        except AttributeError:
-            return False
-
     def __ne__(self, other):
         return not (self == other)