log template, colors, command line: Linux ok, MacOS no

Craig Ozancin c.ozancin at gmail.com
Sat Jan 21 22:50:44 UTC 2023


Let me make a suggestion. Why not use built in color system instead of
hard-coding the color values.

For example, here is a template that I use. It is for the most part a clone
of the include status template. I added missing topic fields to it:




























*%include
~/.local/lib/python3.10/site-packages/mercurial/templates/map-cmdline.default
  [templates]    # Override base templates    changeset =
'{cset}{branches}{bookmarks}{tags}{ltopics}{parents}{luser}{lobsfate}{ldate}{ltroubles}{summary}{lfiles}\n'
  changeset_verbose =
'{cset}{lgitnode}{branches}{bookmarks}{tags}{ltopics}{parents}{luser}{lobsfate}{ldate}{description}{lfiles}\n'
  changeset_debug =
'{fullcset}{lgitnode}{branches}{bookmarks}{tags}{ltopics}{lphase}{lobsfate}{parents}{manifest}{luser}{ldate}{ltroubles}{extras}{description}{lfiles}\n'
  changeset_quiet =
'{cset}{branches}{bookmarks}{tags}{ltopics}{parents}{luser}{ldate}{ltroubles}{lobsfate}{summary}\n'
  # Template to report topic if defined    ltopics = '{if(topic,
label('log.topic', 'topic:       {topic}\n'))}'    lgitnode = '{if(gitnode,
label('log.git', 'git:         {gitnode|short}\n'))}'    # Override the
file templates    lfiles = '{if(files,              label('ui.note
log.files',
'files:\n'))}{lfile_mods}{lfile_adds}{lfile_dels}'   lfile_adds =
'{file_adds % "{lfile_add}{lfile_src}"}'   lfile_mods = '{file_mods %
"{lfile_mod}{lfile_src}"}'   lfile_add = '{label("status.added", "A
{file}\n")}'   lfile_mod = '{label("status.modified", "M {file}\n")}'
 lfile_src = '{ifcontains(file, file_copies_switch,
 label("status.copied", "  {get(file_copies_switch, file)}\n"))}'
 lfile_dels = '{file_dels % "{label('status.removed', 'R {file}\n')}"}'*

Note the ltopic line:
    ltopics = '{if(topic, label('log.topic', 'topic:       {topic}\n'))}'

This uses the label log.topic as define the color to use (log.topic) color.
This can be defined in the .hgr
c file as:

    [color]
    log.topic           = green bold

This makes it very easy to change the colors at any time.

This may fix your issue as well.

Craig



On Thu, Jan 19, 2023 at 12:51 AM Uwe Brauer <oub at mat.ucm.es> wrote:

>
> Hi
>
> I have set up my log template to
> changeset = "\x1B[33mchangeset:
>  {rev}:{node|short}\n{tags}{bookmarks}{ifeq(remotenames,"","","\x1B[48mRemote_Branch:
> {remotenames}\n")}\x1B[38mBranch:        {branch}\nAuthor:
> {author}\nDate:
> {date|rfc822date}\n{ifeq(topic,"","","\x1B[46mTopic:
>  {topic}\n")}Phase:         {phase}\nSummary:
>  {desc|firstline}\n{nofiles}\n"
> tag = "\x1B[42mtag:           {tag}\n"
> bookmark = "\x1B[48mbookmark:      {bookmark}\n"
>
>
> However, on Linux (Ubuntu) either in tcsh or bash everything works as
> expected and all colors are displayed.
>
> However on MacOS (Catalina) either in tcsh or bash
> the colors
> \x1B[48m
> and
> \x1B[38m
>
> Are not displayed.
>
> Any idea?
>
> Thanks and regards
>
> Uwe Brauer
> --
> Warning: Content may be disturbing to some audiences
> I strongly condemn Putin's war of aggression against the Ukraine.
> I support to deliver weapons to Ukraine's military.
> I support the ban of Russia from SWIFT.
> I support the EU membership of the Ukraine.
>
> https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
> _______________________________________________
> Mercurial mailing list
> Mercurial at lists.mercurial-scm.org
> https://lists.mercurial-scm.org/mailman/listinfo/mercurial
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20230121/44adf57a/attachment.html>


More information about the Mercurial mailing list