diff 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
line wrap: on
line diff
--- a/mercurial/graphmod.py	Sun Jan 22 19:35:26 2012 +0700
+++ b/mercurial/graphmod.py	Sun Jan 22 19:47:03 2012 +0700
@@ -18,6 +18,7 @@
 """
 
 from mercurial.node import nullrev
+import re
 
 CHANGESET = 'C'
 
@@ -92,7 +93,8 @@
         gdict = config.setdefault(branch, {})
 
         # Validation
-        if (setting == "width" and val.isdigit() and 0 < int(val) < 30):
+        if ((setting == "width" and val.isdigit() and 0 < int(val) < 30) or
+                (setting == "color" and re.match('^[0-9a-fA-F]{6}$', val))):
             gdict[setting] = val
         else:
             continue