# HG changeset patch # User Sean Farley # Date 2013-08-05 22:00:09 # Node ID 0537c0cfd87c307904a7eb38063b7c2b5fe826fb # Parent a45cf68dd9a254af14268e188e96b38c13a580da basectx: move __eq__ from changectx We also add type checking for extra protection. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -44,6 +44,12 @@ class basectx(object): 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 @@ class changectx(basectx): 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)