# HG changeset patch # User Pierre-Yves David # Date 1498650620 -7200 # Node ID 77e666f943a6c246d7fc970a8a36cd8b2023e03b # Parent a14e2e7f7d1fa1aae957c85edb01af5c32787cd7 configitems: support callable as a default value Yuya pointed out that using mutable value as the default could be problematic. To work around this we now support callable object as default value. This allows for creating new mutable objects on demand when needed. diff -r a14e2e7f7d1f -r 77e666f943a6 mercurial/configitems.py --- a/mercurial/configitems.py Tue Jun 27 02:06:15 2017 +0200 +++ b/mercurial/configitems.py Wed Jun 28 13:50:20 2017 +0200 @@ -60,7 +60,7 @@ default=2, ) coreconfigitem('ui', 'clonebundleprefers', - default=[], + default=list, ) coreconfigitem('ui', 'interactive', default=None, diff -r a14e2e7f7d1f -r 77e666f943a6 mercurial/ui.py --- a/mercurial/ui.py Tue Jun 27 02:06:15 2017 +0200 +++ b/mercurial/ui.py Wed Jun 28 13:50:20 2017 +0200 @@ -455,6 +455,8 @@ if default is _unset: if item is None: value = default + elif callable(item.default): + value = item.default() else: value = item.default elif item is not None: