[PATCH 2 of 5 V2] upgrade: implement '__hash__' on 'improvement' class

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Apr 17 07:42:12 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1492427251 -7200
#      Mon Apr 17 13:07:31 2017 +0200
# Node ID 43cf55c35f2b747d78ee19fe4f8684eef20dbe03
# Parent  49c2ac7c9a542808367b28d6c03d424a0fce1077
# EXP-Topic upgraderepo
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 43cf55c35f2b
upgrade: implement '__hash__' on 'improvement' class

The pythonomicon request its implementation.

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -147,6 +147,9 @@ class improvement(object):
     def __ne__(self, other):
         return not self == other
 
+    def __hash__(self):
+        return hash(self.name)
+
 def finddeficiencies(repo):
     """returns a list of deficiencies that the repo suffer from"""
     newreporeqs = localrepo.newreporequirements(repo)


More information about the Mercurial-devel mailing list