# HG changeset patch # User Thomas Arendsen Hein # Date 1161187131 -7200 # Node ID 451ec905625b56dfc42f7e829e55bf611b7dfda9 # Parent 10b6fc51f67232b3b4f7d324322c21757631cabc Add new branch info to templater and use it in map-cmdline.default. The template currently shows old (hg log -b style) branch tags, too, but not in the same way as the built in changeset_printer. diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -431,14 +431,15 @@ class changeset_templater(object): if endname in self.t: yield self.t(endname, **args) - if brinfo: - def showbranches(**args): - if changenode in brinfo: - for x in showlist('branch', brinfo[changenode], - plural='branches', **args): - yield x - else: - showbranches = '' + def showbranches(**args): + branch = changes[5].get("branch") + if branch: + yield showlist('branch', [branch], plural='branches', **args) + # add old style branches if requested + if brinfo and changenode in brinfo: + for x in showlist('branch', brinfo[changenode], + plural='branches', **args): + yield x if self.ui.debugflag: def showmanifest(**args): diff --git a/templates/map-cmdline.default b/templates/map-cmdline.default --- a/templates/map-cmdline.default +++ b/templates/map-cmdline.default @@ -1,7 +1,7 @@ -changeset = 'changeset: {rev}:{node|short}\n{tags}{short_parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n' +changeset = 'changeset: {rev}:{node|short}\n{branches}{tags}{short_parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n' changeset_quiet = '{rev}:{node|short}\n' -changeset_verbose = 'changeset: {rev}:{node|short}\n{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n' -changeset_debug = 'changeset: {rev}:{node}\n{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n' +changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n' +changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n' start_files = 'files: ' file = ' {file}' end_files = '\n' @@ -17,4 +17,5 @@ end_file_copies = '\n' short_parent = 'parent: {rev}:{node|short}\n' parent = 'parent: {rev}:{node}\n' manifest = 'manifest: {rev}:{node}\n' +branch = 'branch: {branch}\n' tag = 'tag: {tag}\n'