diff --git a/mercurial/templates/map-cmdline.default b/mercurial/templates/map-cmdline.default --- a/mercurial/templates/map-cmdline.default +++ b/mercurial/templates/map-cmdline.default @@ -1,25 +1,73 @@ -changeset = 'changeset: {rev}:{node|short}\n{branches}{bookmarks}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n' -changeset_quiet = '{rev}:{node|short}\n' -changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{bookmarks}{tags}{parents}user: {author}\ndate: {date|date}\n{files}{file_copies_switch}description:\n{desc|strip}\n\n\n' -changeset_debug = 'changeset: {rev}:{node}\n{branches}{bookmarks}{tags}phase: {phase}\n{parents}{manifest}user: {author}\ndate: {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{extras}description:\n{desc|strip}\n\n\n' -start_files = 'files: ' -file = ' {file}' -end_files = '\n' -start_file_mods = 'files: ' -file_mod = ' {file_mod}' -end_file_mods = '\n' -start_file_adds = 'files+: ' -file_add = ' {file_add}' -end_file_adds = '\n' -start_file_dels = 'files-: ' -file_del = ' {file_del}' -end_file_dels = '\n' -start_file_copies = 'copies: ' -file_copy = ' {name} ({source})' -end_file_copies = '\n' -parent = 'parent: {rev}:{node|formatnode}\n' -manifest = 'manifest: {rev}:{node}\n' -branch = 'branch: {branch}\n' -tag = 'tag: {tag}\n' -bookmark = 'bookmark: {bookmark}\n' -extra = 'extra: {key}={value|stringescape}\n' +# Base templates. Due to name clashes with existing keywords, we have +# to replace some keywords with 'lkeyword', for 'labelled keyword' +changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}\n' +changeset_quiet = '{node}' +changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n' +changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n' + +# File templates +lfiles = '{if(files, + label("ui.note log.files", + "files: {files}\n"))}' + +lfile_mods = '{if(file_mods, + label("ui.debug log.files", + "files: {file_mods}\n"))}' + +lfile_adds = '{if(file_adds, + label("ui.debug log.files", + "files+: {file_adds}\n"))}' + +lfile_dels = '{if(file_dels, + label("ui.debug log.files", + "files-: {file_dels}\n"))}' + +lfile_copies_switch = '{if(file_copies_switch, + label("ui.note log.copies", + "copies: {file_copies_switch + % ' {name} ({source})'}\n"))}' + +# General templates +cset = '{label("log.changeset changeset.{phase}", + "changeset: {rev}:{node|short}")}\n' + +lphase = '{label("log.phase", + "phase: {phase}")}\n' + +fullcset = '{label("log.changeset changeset.{phase}", + "changeset: {rev}:{node}")}\n' + +parent = '{label("log.parent changeset.{phase}", + "parent: {rev}:{node|formatnode}")}\n' + +node = '{label("log.node", + "{rev}:{node|short}")}\n' + +manifest = '{label("ui.debug log.manifest", + "manifest: {rev}:{node}")}\n' + +branch = '{label("log.branch", + "branch: {branch}")}\n' + +tag = '{label("log.tag", + "tag: {tag}")}\n' + +bookmark = '{label("log.bookmark", + "bookmark: {bookmark}")}\n' + +user = '{label("log.user", + "user: {author}")}\n' + +summary = '{label("log.summary", + "summary: {desc|firstline}")}\n' + +ldate = '{label("log.date", + "date: {date|date}")}\n' + +extra = '{label("ui.debug log.extra", + "extra: {key}={value|stringescape}")}\n' + +description = '{label("ui.note log.description", + "description:")} + {label("ui.note log.description", + "{desc|strip}")}\n\n' diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -105,6 +105,26 @@ Default style is like normal output: $ hg log --debug --style default > style.out $ cmp log.out style.out || diff -u log.out style.out +Default style should also preserve color information (issue2866): + + $ cp $HGRCPATH $HGRCPATH-bak + $ cat <> $HGRCPATH + > [extensions] + > color= + > EOF + + $ hg --color=debug log > log.out + $ hg --color=debug log --style default > style.out + $ cmp log.out style.out || diff -u log.out style.out + $ hg --color=debug -v log > log.out + $ hg --color=debug -v log --style default > style.out + $ cmp log.out style.out || diff -u log.out style.out + $ hg --color=debug --debug log > log.out + $ hg --color=debug --debug log --style default > style.out + $ cmp log.out style.out || diff -u log.out style.out + + $ mv $HGRCPATH-bak $HGRCPATH + Revision with no copies (used to print a traceback): $ hg tip -v --template '\n'