##// END OF EJS Templates
ui: fix ui.configdate for invalid dates...
Boris Feld -
r32449:0ed730f3 default
parent child Browse files
Show More
@@ -607,7 +607,7 b' class ui(object):'
607 (0, 0)
607 (0, 0)
608 """
608 """
609 if self.config(section, name, default, untrusted):
609 if self.config(section, name, default, untrusted):
610 return self.configwith(util.parsedate, section, name, default,
610 return self.configwith(util.rawparsedate, section, name, default,
611 'date', untrusted)
611 'date', untrusted)
612 return default
612 return default
613
613
@@ -32,6 +32,9 b' parsed = dispatch._parseconfig(testui, ['
32 'lists.list16="longer quotation" with "no ending quotation',
32 'lists.list16="longer quotation" with "no ending quotation',
33 'lists.list17=this is \\" "not a quotation mark"',
33 'lists.list17=this is \\" "not a quotation mark"',
34 'lists.list18=\n \n\nding\ndong',
34 'lists.list18=\n \n\nding\ndong',
35 'date.epoch=0 0',
36 'date.birth=2005-04-19T00:00:00',
37 'date.invalid=0'
35 ])
38 ])
36
39
37 print(repr(testui.configitems('values')))
40 print(repr(testui.configitems('values')))
@@ -82,6 +85,9 b" print(repr(testui.configlist('lists', 'u"
82 print(repr(testui.configlist('lists', 'unknown', 'foo, bar')))
85 print(repr(testui.configlist('lists', 'unknown', 'foo, bar')))
83 print(repr(testui.configlist('lists', 'unknown', ['foo bar'])))
86 print(repr(testui.configlist('lists', 'unknown', ['foo bar'])))
84 print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])))
87 print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])))
88 print("---")
89 print(repr(testui.configdate('date', 'epoch')))
90 print(repr(testui.configdate('date', 'birth')))
85
91
86 print(repr(testui.config('values', 'String')))
92 print(repr(testui.config('values', 'String')))
87
93
@@ -101,3 +107,7 b' try:'
101 testui.configint('values', 'intinvalid')
107 testui.configint('values', 'intinvalid')
102 except error.ConfigError:
108 except error.ConfigError:
103 print('intinvalid')
109 print('intinvalid')
110 try:
111 testui.configdate('date', 'invalid')
112 except error.ConfigError:
113 print('dateinvalid')
@@ -43,7 +43,11 b' 42'
43 ['foo', 'bar']
43 ['foo', 'bar']
44 ['foo bar']
44 ['foo bar']
45 ['foo', 'bar']
45 ['foo', 'bar']
46 ---
47 (0, 0)
48 (1113868800, 0)
46 None
49 None
47 True
50 True
48 boolinvalid
51 boolinvalid
49 intinvalid
52 intinvalid
53 dateinvalid
General Comments 0
You need to be logged in to leave comments. Login now