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

Laurent Charignon lcharignon at fb.com
Mon Jul 6 13:42:42 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 86a06a67556f2c5e15c0517ac3b13b82327e734c
# Parent  19d4a2676ee71fc8f30731ebd32cb544b28663ca
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