[PATCH 3 of 4 V3] config: add a __hash__ method to config object

Laurent Charignon lcharignon at fb.com
Tue Jul 7 18:07:38 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1435880907 25200
#      Thu Jul 02 16:48:27 2015 -0700
# Node ID a6918b3efa1a7b593867ba43901ffd2e4d6f3f79
# Parent  d95f59ccaa461bf57be38e5b6376dbb2b49cbb5c
config: add a __hash__ method to config object

This will be used by the command server to detect config file change.

diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -30,6 +30,8 @@ class config(object):
         return section in self._data
     def __getitem__(self, section):
         return self._data.get(section, {})
+    def __hash__(self):
+        return self.computehash()
     def __iter__(self):
         for d in self.sections():
             yield d


More information about the Mercurial-devel mailing list