Patchwork [2,of,6] config: allow remapping the default section

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 14, 2017, 10:41 a.m.
Message ID <f9e359b56a221e7cd9a8.1507977671@mimosa>
Download mbox | patch
Permalink /patch/24888/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 14, 2017, 10:41 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1507970501 -32400
#      Sat Oct 14 17:41:41 2017 +0900
# Node ID f9e359b56a221e7cd9a83ee4c65cb3eae9f0d814
# Parent  4725df3708cfa2117b12c9e1ee0d1a6143d7e87d
config: allow remapping the default section

The next patch depends on it. It doesn't make sense that the default section
can't be remapped with {'': whatever}.

Patch

diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -118,6 +118,9 @@  class config(object):
         line = 0
         cont = False
 
+        if remap:
+            section = remap.get(section, section)
+
         for l in data.splitlines(True):
             line += 1
             if line == 1 and l.startswith('\xef\xbb\xbf'):