Patchwork [03,of,10] chgserver: add an array hashing config items

login
register
mail settings
Submitter Jun Wu
Date June 30, 2016, 4:58 p.m.
Message ID <169a0f4db80746bcd7ae.1467305938@x1c>
Download mbox | patch
Permalink /patch/15689/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - June 30, 2016, 4:58 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1467279127 -3600
#      Thu Jun 30 10:32:07 2016 +0100
# Node ID 169a0f4db80746bcd7ae1e04ae1daa2e4e0d9872
# Parent  1d101ceeac163f43962347f9c8ee597a701f241a
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 169a0f4db807
chgserver: add an array hashing config items

Previously we only hash config sections. This patch adds an array hashing
config items.

Patch

diff --git a/hgext/chgserver.py b/hgext/chgserver.py
--- a/hgext/chgserver.py
+++ b/hgext/chgserver.py
@@ -87,6 +87,7 @@  def _hashlist(items):
     'extdiff',  # uisetup will register new commands
     'extensions',
 ]
+_configitems = []  # [(section, name)]
 
 # sensitive environment variables affecting confighash
 _envre = re.compile(r'''\A(?:
@@ -115,6 +116,8 @@  def _confighash(ui):
     sectionitems = []
     for section in _configsections:
         sectionitems.append(ui.configitems(section))
+    for section, name in _configitems:
+        sectionitems.append(ui.config(section, name))
     sectionhash = _hashlist(sectionitems)
     envitems = [(k, v) for k, v in os.environ.iteritems() if _envre.match(k)]
     envhash = _hashlist(sorted(envitems))