rendered paste body# HG changeset patch# User Nicolas Dumazet <nicdumz.commits@gmail.com># Date 1280384705 -32400# Node ID 4f11a43499f273f92c60f583513bd72f81328adf# Parent e95bacedae12cf0d29251c70faca59535d55b82e[mq]: rawdiff --git a/hgext/color.py b/hgext/color.py--- a/hgext/color.py+++ b/hgext/color.py@@ -62,6 +62,9 @@ bookmarks.current = green + branches.closed = black bold+ branches.current = green+ The color extension will try to detect whether to use ANSI codes or Win32 console APIs, unless it is made explicit:: @@ -87,6 +90,8 @@ 'cyan_background': 46, 'white_background': 47} _styles = {'grep.match': 'red bold',+ 'branches.closed': 'black bold',+ 'branches.current': 'green', 'diff.changed': 'white', 'diff.deleted': 'red', 'diff.diffline': 'bold',diff --git a/mercurial/commands.py b/mercurial/commands.py--- a/mercurial/commands.py+++ b/mercurial/commands.py@@ -512,16 +512,22 @@ else: hn = repo.lookup(node) if isactive:+ label = 'branches.active' notice = '' elif hn not in repo.branchheads(tag, closed=False): if not closed: continue+ label = 'branches.closed' notice = _(' (closed)') else:+ label = 'branches.inactive' notice = _(' (inactive)')+ if tag == repo.dirstate.branch():+ label = 'branches.current' rev = str(node).rjust(31 - encoding.colwidth(encodedtag))- data = encodedtag, rev, hexfunc(hn), notice- ui.write("%s %s:%s%s\n" % data)+ rev = ui.label('%s:%s' % (rev, hexfunc(hn)), 'log.changeset')+ encodedtag = ui.label(encodedtag, label)+ ui.write("%s %s%s\n" % (encodedtag, rev, notice)) def bundle(ui, repo, fname, dest=None, **opts): """create a changegroup filediff --git a/tests/test-branches b/tests/test-branches--- a/tests/test-branches+++ b/tests/test-branches@@ -92,3 +92,26 @@ echo '% branch b' hg heads b hg heads --closed b++hg up -C c+hg commit -d '9 0' --close-branch -m 'reclosing this branch'+hg up -C b++echo "[extensions]" >> $HGRCPATH+echo "color =" >> $HGRCPATH+echo '-------'+hg branches --color=always+echo '-------'+hg branches --closed --color=always++echo "[color]" >> $HGRCPATH+echo "branches.active = green" >> $HGRCPATH+echo "branches.closed = blue" >> $HGRCPATH+echo "branches.current = red" >> $HGRCPATH+echo "branches.inactive = magenta" >> $HGRCPATH+echo "log.changeset = cyan" >> $HGRCPATH++echo '-------'+hg branches --color=always+echo '-------'+hg branches --color=always --closeddiff --git a/tests/test-branches.out b/tests/test-branches.out--- a/tests/test-branches.out+++ b/tests/test-branches.out@@ -242,3 +242,27 @@ date: Thu Jan 01 00:00:09 1970 +0000 summary: prune bad branch +3 files updated, 0 files merged, 2 files removed, 0 files unresolved+2 files updated, 0 files merged, 3 files removed, 0 files unresolved+-------+[0;32mb[0m [0;33m 13:6ac12926b8c3[0m+a branch name much longer than the default justification used by branches [0;33m7:10ff5895aa57[0m+a [0;33m 5:d8cbc61dbaa6[0m (inactive)+default [0;33m 0:19709c5a4e75[0m (inactive)+-------+[0;32mb[0m [0;33m 13:6ac12926b8c3[0m+a branch name much longer than the default justification used by branches [0;33m7:10ff5895aa57[0m+[0;30;1mc[0m [0;33m 14:717d2e6fabe1[0m (closed)+a [0;33m 5:d8cbc61dbaa6[0m (inactive)+default [0;33m 0:19709c5a4e75[0m (inactive)+-------+[0;31mb[0m [0;36m 13:6ac12926b8c3[0m+[0;32ma branch name much longer than the default justification used by branches[0m [0;36m7:10ff5895aa57[0m+[0;35ma[0m [0;36m 5:d8cbc61dbaa6[0m (inactive)+[0;35mdefault[0m [0;36m 0:19709c5a4e75[0m (inactive)+-------+[0;31mb[0m [0;36m 13:6ac12926b8c3[0m+[0;32ma branch name much longer than the default justification used by branches[0m [0;36m7:10ff5895aa57[0m+[0;34mc[0m [0;36m 14:717d2e6fabe1[0m (closed)+[0;35ma[0m [0;36m 5:d8cbc61dbaa6[0m (inactive)+[0;35mdefault[0m [0;36m 0:19709c5a4e75[0m (inactive)