view tests/test-ui-config @ 4188:dd0d9bd91e0a

dirstate.statwalk: explicitly test for ignored directories This removes a hack where we appended '/' to a dirname so that: - it would not appear on the "dc" dict - it would always be matched by the match function This was a contorted way of checking if the directory was matched by some hgignore pattern, and it would still fail with some uses of --include/--exclude patterns. Things would still work fine if we removed the check altogether and just appended things to "work" directly, but then we would end up walking ignored directories too, which could be quite a bit of work. This allows further simplification of the match function returned by util._matcher, and fixes walking the working directory with a --include pattern that matches only the end of a name.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 10 Mar 2007 23:00:54 -0300
parents 1700a103458e
children 3fef134832d8
line wrap: on
line source

#!/usr/bin/env python

from mercurial import ui, util, commands

testui = ui.ui()
parsed = commands.parseconfig([
    'values.string=string value',
    'values.bool1=true',
    'values.bool2=false',
    'lists.list1=foo',
    'lists.list2=foo bar baz',
    'lists.list3=alice, bob',
    'lists.list4=foo bar baz alice, bob',
    'interpolation.value1=hallo',
    'interpolation.value2=%(value1)s world',
    'interpolation.value3=%(novalue)s',
    'interpolation.value4=%(bad)1',
    'interpolation.value5=%bad2',
])
testui.updateopts(config=parsed)

print repr(testui.configitems('values'))
print repr(testui.configitems('lists'))
try:
    print repr(testui.configitems('interpolation'))
except util.Abort, inst:
    print inst
print "---"
print repr(testui.config('values', 'string'))
print repr(testui.config('values', 'bool1'))
print repr(testui.config('values', 'bool2'))
print repr(testui.config('values', 'unknown'))
print "---"
try:
    print repr(testui.configbool('values', 'string'))
except ValueError, why:
    print why
print repr(testui.configbool('values', 'bool1'))
print repr(testui.configbool('values', 'bool2'))
print repr(testui.configbool('values', 'bool2', True))
print repr(testui.configbool('values', 'unknown'))
print repr(testui.configbool('values', 'unknown', True))
print "---"
print repr(testui.configlist('lists', 'list1'))
print repr(testui.configlist('lists', 'list2'))
print repr(testui.configlist('lists', 'list3'))
print repr(testui.configlist('lists', 'list4'))
print repr(testui.configlist('lists', 'list4', ['foo']))
print repr(testui.configlist('lists', 'unknown'))
print repr(testui.configlist('lists', 'unknown', ''))
print repr(testui.configlist('lists', 'unknown', 'foo'))
print repr(testui.configlist('lists', 'unknown', ['foo']))
print repr(testui.configlist('lists', 'unknown', 'foo bar'))
print repr(testui.configlist('lists', 'unknown', 'foo, bar'))
print repr(testui.configlist('lists', 'unknown', ['foo bar']))
print repr(testui.configlist('lists', 'unknown', ['foo', 'bar']))
print "---"
print repr(testui.config('interpolation', 'value1'))
print repr(testui.config('interpolation', 'value2'))
try:
    print repr(testui.config('interpolation', 'value3'))
except util.Abort, inst:
    print inst
try:
    print repr(testui.config('interpolation', 'value4'))
except util.Abort, inst:
    print inst
try:
    print repr(testui.config('interpolation', 'value5'))
except util.Abort, inst:
    print inst
print "---"