comparison mercurial/graphmod.py @ 16130:33f702e52906

graph: in hgrc specify line color for main branch You can specify color to visually distinguish main branch (trunk) on hgweb's graph page. If color specified, all branch heads will share same color. Settings format is branch_name.color = value, where color is six hexadecimal digits e.g.: [graph] default.color = FF0000
author Constantine Linnick <theaspect@gmail.com>
date Sun, 22 Jan 2012 19:47:03 +0700
parents 5e50982c633c
children 6f236c8bdc01
comparison
equal deleted inserted replaced
16129:5e50982c633c 16130:33f702e52906
16 context of the graph returned. Type is a constant specifying the node type. 16 context of the graph returned. Type is a constant specifying the node type.
17 Data depends on type. 17 Data depends on type.
18 """ 18 """
19 19
20 from mercurial.node import nullrev 20 from mercurial.node import nullrev
21 import re
21 22
22 CHANGESET = 'C' 23 CHANGESET = 'C'
23 24
24 def dagwalker(repo, revs): 25 def dagwalker(repo, revs):
25 """cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples 26 """cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples
90 continue 91 continue
91 branch, setting = key.rsplit('.', 1) 92 branch, setting = key.rsplit('.', 1)
92 gdict = config.setdefault(branch, {}) 93 gdict = config.setdefault(branch, {})
93 94
94 # Validation 95 # Validation
95 if (setting == "width" and val.isdigit() and 0 < int(val) < 30): 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))):
96 gdict[setting] = val 98 gdict[setting] = val
97 else: 99 else:
98 continue 100 continue
99 101
100 for (cur, type, data, parents) in dag: 102 for (cur, type, data, parents) in dag: