[PATCH] upgrade: correct implementation of improvement.__ne__

Benjamin Peterson benjamin at python.org
Fri Dec 14 07:24:44 UTC 2018


# HG changeset patch
# User Benjamin Peterson <benjamin at python.org>
# Date 1544772028 28800
#      Thu Dec 13 23:20:28 2018 -0800
# Branch ne-impl
# Node ID dace81bda054a90fa22312d4fc2a57280518a942
# Parent  4591c9791a829e927388ba92a64971ae9ab301ec
upgrade: correct implementation of improvement.__ne__

The "not" operator binds more closely than "==":
>>> not False == False
False

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -142,7 +142,7 @@ class improvement(object):
         return self.name == other.name
 
     def __ne__(self, other):
-        return not self == other
+        return not (self == other)
 
     def __hash__(self):
         return hash(self.name)


More information about the Mercurial-devel mailing list