##// END OF EJS Templates
graphmod: rewrite graph config validation...
Matt Mackall -
r16131:6f236c8b default
parent child Browse files
Show More
@@ -18,7 +18,6 b' Data depends on type.'
18 """
18 """
19
19
20 from mercurial.node import nullrev
20 from mercurial.node import nullrev
21 import re
22
21
23 CHANGESET = 'C'
22 CHANGESET = 'C'
24
23
@@ -87,17 +86,14 b' def colored(dag, repo):'
87 config = {}
86 config = {}
88
87
89 for key, val in repo.ui.configitems('graph'):
88 for key, val in repo.ui.configitems('graph'):
90 if '.' not in key:
89 if '.' in key:
91 continue
90 branch, setting = key.rsplit('.', 1)
92 branch, setting = key.rsplit('.', 1)
91 # Validation
93 gdict = config.setdefault(branch, {})
92 if setting == "width" and val.isdigit():
93 config.setdefault(branch, {})[setting] = val
94 elif setting == "color" and val.isalnum():
95 config.setdefault(branch, {})[setting] = val
94
96
95 # Validation
96 if ((setting == "width" and val.isdigit() and 0 < int(val) < 30) or
97 (setting == "color" and re.match('^[0-9a-fA-F]{6}$', val))):
98 gdict[setting] = val
99 else:
100 continue
101
97
102 for (cur, type, data, parents) in dag:
98 for (cur, type, data, parents) in dag:
103
99
General Comments 0
You need to be logged in to leave comments. Login now