diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -515,6 +515,10 @@ class templateformatter(baseformatter): if part not in self._parts: return ref = self._parts[part] + # None can't be put in the mapping dict since it means + for k, v in item.items(): + if v is None: + item[k] = templateutil.wrappedvalue(v) self._out.write(self._t.render(ref, item)) @util.propertycache diff --git a/tests/test-config.t b/tests/test-config.t --- a/tests/test-config.t +++ b/tests/test-config.t @@ -122,7 +122,7 @@ Test config default of various types: ] $ hg config --config auth.cookiefile= auth -T'json(defaultvalue)' [ - {"defaultvalue": ""} + {"defaultvalue": null} ] $ hg config --config auth.cookiefile= auth -T'{defaultvalue}\n'