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

login
register
mail settings
Submitter Pierre-Yves David
Date April 17, 2017, 11:42 a.m.
Message ID <43cf55c35f2b747d78ee.1492429332@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20246/
State Accepted
Headers show

Comments

Pierre-Yves David - April 17, 2017, 11:42 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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)