changeset 19582:bda1d48bb07f

basefilectx: move __eq__ from filectx We also add type checking for extra protection.
author Sean Farley <sean.michael.farley@gmail.com>
date Sun, 11 Aug 2013 22:49:03 -0500
parents fe50d21be01a
children e5074d82afc9
files mercurial/context.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sun Aug 11 22:47:39 2013 -0500
+++ b/mercurial/context.py	Sun Aug 11 22:49:03 2013 -0500
@@ -467,6 +467,13 @@
         except AttributeError:
             return id(self)
 
+    def __eq__(self, other):
+        try:
+            return (type(self) == type(other) and self._path == other._path
+                    and self._filenode == other._filenode)
+        except AttributeError:
+            return False
+
 class filectx(basefilectx):
     """A filecontext object makes access to data related to a particular
        filerevision convenient."""
@@ -516,13 +523,6 @@
             # considered when solving linkrev issue are on the table.
             return changectx(self._repo.unfiltered(), self._changeid)
 
-    def __eq__(self, other):
-        try:
-            return (self._path == other._path
-                    and self._filenode == other._filenode)
-        except AttributeError:
-            return False
-
     def __ne__(self, other):
         return not (self == other)