upgrade: implement equality for 'improvement' object
Through the code, we use a mix of 'improvement' object and string. Having a
single type would be simpler. For this we need the object to be comparable.
--- a/mercurial/upgrade.py Mon Apr 10 22:15:17 2017 +0200
+++ b/mercurial/upgrade.py Mon Apr 10 23:10:03 2017 +0200
@@ -138,6 +138,12 @@
for k, v in kwargs.items():
setattr(self, k, v)
+ def __eq__(self, other):
+ if not isinstance(other, improvement):
+ # This is what python tell use to do
+ return NotImplemented
+ return self.name == other.name
+
def finddeficiencies(repo):
"""returns a list of deficiencies that the repo suffer from"""
newreporeqs = localrepo.newreporequirements(repo)