[RFC] [PATCH] ui: differentiate empty configlist from None

Alecs King alecsk at gmail.com
Wed Aug 11 08:05:55 CDT 2010


This is spotted when using the pager extension.

The doc specifies that,

'''
Setting pager.attend to an empty value will cause all commands to be
paged.
'''

Currently pager tries to get pager.attend configuration, and if it's not
set, it uses a default attended list:

            attend = ui.configlist('pager', 'attend', attended)

But at the same time in ui.configlist, it doesnt differentiate a
set-but-empty config list from not-set-at-all.  So it never works as
intended when setting pager.attend to empty -- default is set still.

This patch tries to fix that.  Have tested it a bit but i'm not quite
sure if there's other code that relies on this (mis)feature (or bug, if
you agree).  So is this the correct way to do, or should we remain
ui.configlist untouched but instead make change in pager itself?


 mercurial/ui.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


# HG changeset patch
# User Alecs King <alecsk at gmail.com>
# Date 1281529719 -28800
# Branch my
# Node ID b815f1650d03a054a1e9b40761880b97afaad9ed
# Parent  3d4a8bf13a65ac1878774eaaa07a4ae1f944455d
ui: differentiate empty configlist from None

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -218,7 +218,7 @@ class ui(object):
         def _configlist(s):
             s = s.rstrip(' ,')
             if not s:
-                return None
+                return []
             parser, parts, offset = _parse_plain, [''], 0
             while parser:
                 parser, parts, offset = parser(parts, s, offset)



More information about the Mercurial-devel mailing list