diff --git a/mercurial/templates/map-cmdline.show b/mercurial/templates/map-cmdline.show --- a/mercurial/templates/map-cmdline.show +++ b/mercurial/templates/map-cmdline.show @@ -5,8 +5,14 @@ # map-cmdline.default. showbookmarks = '{if(active, "*", " ")} {pad(bookmark, longestbookmarklen + 4)}{shortest(node, 5)}\n' -showwork = '{cset_shortnode}{cset_names} {cset_shortdesc}' +showwork = '{cset_shortnode}{namespaces % cset_namespace} {cset_shortdesc}' cset_shortnode = '{label("log.changeset changeset.{phase}", shortest(node, 5))}' -cset_names = '{if(branches, " ({label("log.branch", branch)})")}{if(bookmarks, " ({label("log.bookmarks", bookmarks)})")}' + +# Treat branch and tags specially so we don't display "default" or "tip" +cset_namespace = '{ifeq(namespace, "branches", names_branches, ifeq(namespace, "tags", names_tags, names_others))}' +names_branches = '{ifeq(branch, "default", "", " ({label('log.{colorname}', branch)})")}' +names_tags = '{if(names % "{ifeq(name, 'tip', '', name)}", " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}' +names_others = '{if(names, " ({label('log.{colorname}', join(names, ' '))})")}' + cset_shortdesc = '{label("log.description", desc|firstline)}' diff --git a/tests/test-show-work.t b/tests/test-show-work.t --- a/tests/test-show-work.t +++ b/tests/test-show-work.t @@ -181,10 +181,9 @@ Tags are rendered $ hg commit -m 'commit 3' $ hg tag 0.2 -TODO tags aren't yet rendered $ hg show work @ 37582 Added tag 0.2 for changeset 6379c25b76f1 - o 6379c commit 3 + o 6379c (0.2) commit 3 o a2ad9 Added tag 0.1 for changeset 6a75536ea0b1 | ~ @@ -206,14 +205,14 @@ Multiple names on same changeset render $ hg commit -m 'commit 2' $ hg show work - @ 34834 (mybranch) (mybook) commit 2 + @ 34834 (mybook) (mybranch) commit 2 o 97fcc commit 1 Multiple bookmarks on same changeset render properly $ hg book mybook2 $ hg show work - @ 34834 (mybranch) (mybook mybook2) commit 2 + @ 34834 (mybook mybook2) (mybranch) commit 2 o 97fcc commit 1 $ cd .. @@ -230,10 +229,9 @@ Extra namespaces are rendered $ echo 2 > foo $ hg commit -m 'commit 3' -TODO don't yet render extra namespaces $ hg --config extensions.revnames=$TESTDIR/revnamesext.py show work - @ 32f3e commit 3 - o 6a755 commit 2 - o 97fcc commit 1 + @ 32f3e (r2) commit 3 + o 6a755 (r1) commit 2 + o 97fcc (r0) commit 1 $ cd ..