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

login
register
mail settings
Submitter Laurent Charignon
Date July 7, 2015, 11:07 p.m.
Message ID <a6918b3efa1a7b593867.1436310458@lcharignon-mbp.local>
Download mbox | patch
Permalink /patch/9909/
State Changes Requested
Headers show

Comments

Laurent Charignon - July 7, 2015, 11:07 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@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.

Patch

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