[PATCH 11 of 36] context: move __eq__ from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 13:13:11 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375740009 18000
#      Mon Aug 05 17:00:09 2013 -0500
# Node ID b6fba3a11c94e653cab0a481788724c9a6b356df
# Parent  d5f3b9240f8d6596e97917a18bf870d60fe7fe88
context: move __eq__ from changectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -42,10 +42,16 @@
         return self.rev()
 
     def __repr__(self):
         return "<%s %s>" % (type(self).__name__, str(self))
 
+    def __eq__(self, other):
+        try:
+            return self._rev == other._rev
+        except AttributeError:
+            return False
+
     def rev(self):
         return self._rev
     def node(self):
         return self._node
     def hex(self):
@@ -154,16 +160,10 @@
         try:
             return hash(self._rev)
         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)
 
     def __nonzero__(self):
         return self._rev != nullrev


More information about the Mercurial-devel mailing list