# HG changeset patch # User Brendan Cully # Date 1164670029 28800 # Node ID 6cb3aca69cdc6ebec395cf145b686f478fd0f84e # Parent 198173f3957cde1fb59c35ebb26664023f9e4084 Make context __eq__ handle arbitrary RHS values diff -r 198173f3957c -r 6cb3aca69cdc mercurial/context.py --- a/mercurial/context.py Mon Nov 27 15:13:01 2006 -0800 +++ b/mercurial/context.py Mon Nov 27 15:27:09 2006 -0800 @@ -36,7 +36,10 @@ return "" % 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 @@ return "" % 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 diff -r 198173f3957c -r 6cb3aca69cdc mercurial/merge.py --- a/mercurial/merge.py Mon Nov 27 15:13:01 2006 -0800 +++ b/mercurial/merge.py Mon Nov 27 15:27:09 2006 -0800 @@ -139,9 +139,9 @@ ''' check if an apparent pair actually matches ''' c2 = ctx(f2, man[f2]) ca = c.ancestor(c2) - if c == ca or c2 == ca: + if not ca or c == ca or c2 == ca: return - if ca and ca.path() == c.path() or ca.path() == c2.path(): + if ca.path() == c.path() or ca.path() == c2.path(): copy[c.path()] = f2 copy[f2] = c.path()