Patchwork D9922: config: use the right API to access template access

login
register
mail settings
Submitter phabricator
Date Jan. 30, 2021, 1:39 a.m.
Message ID <differential-rev-PHID-DREV-ktqitblhmoqwqrptoa3s-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48233/
State Superseded
Headers show

Comments

phabricator - Jan. 30, 2021, 1:39 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Preventing direct access to the underlying dict will help a coming refactoring
  of `config`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9922

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -891,7 +891,7 @@ 
         fp = _open_mapfile(path)
         cache, tmap, aliases = _readmapfile(fp, path)
 
-    for key, val in conf[b'templates'].items():
+    for key, val in conf.items(b'templates'):
         if not val:
             raise error.ParseError(
                 _(b'missing value'), conf.source(b'templates', key)
@@ -904,7 +904,7 @@ 
             cache[key] = unquotestring(val)
         elif key != b'__base__':
             tmap[key] = os.path.join(base, val)
-    aliases.extend(conf[b'templatealias'].items())
+    aliases.extend(conf.items(b'templatealias'))
     return cache, tmap, aliases