templates and the log --debug output the extra fields

Craig Ozancin c.ozancin at gmail.com
Mon Jan 4 00:34:09 UTC 2021


Uwe,

I would be happy to share a couple templates that I have hacked together.

The first is called nlog. It is a modified version of the status templates
with topics added in.

%include map-cmdline.status

ltopics = '{if(topics, label('log.topic', 'Topic:       {topics}\n'))}'

[templates]
# Override base templates
changeset = '{cset}{branches}{bookmarks}{ltopics}{tags}{parents}{luser}{
ldate}{summ
ary}{lfiles}\n'

changeset_quiet = '{cset}{branches}{bookmarks}{ltopics}{tags}{parents}{luser
}{ldate
}{summary}\n'

changeset_verbose = '{cset}{branches}{bookmarks}{ltopics}{tags}{parents}{
luser}{lda
te}{label('log.nlog.description', "Description:\n")}{desc}\n\n{lfiles}\n'

changeset_debug = '{fullcset}{branches}{bookmarks}{{ltopics
}tags}{parents}{manifest
}{luser}{ldate}{extras}{description}{lfiles}\n'

# Override the file templates
lfiles = '{if(files,
             label('ui.note log.nlog.files',
                   'Files:\n'))}{lfile_mods}{lfile_adds}{lfile_dels}'

The second is call mlog (for minimal log). with the --quiet log option is
really give a very minimal
amount if info. Phases are color differently. With the --verbose option it
give something very similar
to the what the Mozilla people were using. Default is enough information
for my needs.

luser       = '{label("log.user",
                   author|person)}'

lrev        = '{label("log.changeset changeset.{phase}",
                   "{rev}")}'

ltag        = '{label("log.tag",
                   if(tags,"{tags} "))}'

ltopics     = '{if(topics, label('log.topic', '\{{topics}} '))}'

#lbookmarks  = '{if(bookmarks, label('log.bookmark','<{bookmarks}> '))}'

lbookmarks  = '{bookmarks % "{ifeq(bookmark, currentbookmark,
                   label('log.activebookmark', bookmark),
                   label('log.bookmark', '<bookmark>'))} "}'

lbranches   = '{if(branches, label('log.branch',
                   '[{branches}] '))}'

activedesc  = '{label(ifcontains(rev, revset('parents()'),
                   'log.active.desc'),desc|firstline|strip)}'


[templates]

changeset = '{lrev} {lbranches}{lbookmarks}{ltopics}{ltag} {activedesc}\n'

changeset_quiet = '{lbranches}{lbookmarks}{ltopics}{label("changeset.{phase}",
desc
|firstline|strip)}\n'

changeset_verbose = '{pad(lrev, 6)} {luser} {lbranches}{lbookmarks}{ltopics
}{ltag}\
n       {activedesc}\n'


I create template files as:

~/.hgtemplates/templates/map-cmdline.nlog
~/.hgtemplates/templates/map-cmdline.mlog

I have created a couple aliases:

[alias]
nlog         = log -T ~/.hgtemplates/map-cmdline.nlog
mlog         = log -T ~/.hgtemplates/map-cmdline.mlog

Of important note, my personal color defines in ~/.hgrc are:

[color]
## status colors
status.modified     = cyan
status.added        = green
status.removed      = red
status.deleted      = magenta
status.unknown      = blue
status.ignored      = bold

## diff colors
diff.diffline       = bold
diff.extended       = cyan
diff.file_a         = red
diff.file_b         = green
diff.hunk           = magenta
diff.deleted        = red
diff.inserted       = green
diff.changed        = blue
diff.trailingwhitespace = bold red_background

## log colors
log.branch          = cyan
log.topic           = magenta
log.bookmark        = green

log.summary         =
log.user            = yellow
log.date            =
log.description     =
log.tag             = red bold

log.activebookmark  = green inverse

log.active.desc     = white bold cyan_background

## phase colors
changeset.secret    = red bold
changeset.draft     = blue
changeset.public    = green

I hope this helps.

Craig

On Sun, Jan 3, 2021 at 8:48 AM Uwe Brauer <oub at mat.ucm.es> wrote:

>
>
> Hi
>
> Hg log -G --debug
>
> Shows me
>
>  changeset:   432:cb80c31c1d905f4f5e94957b7c9b1f9f17e8b566
> │  branch:      year-20-21
> │  tag:         tip
> │  topic:       fechas-controles
> │  phase:       draft
> │  parent:      431:ceb486e510e0a490b8d3e20260c21683c5b1e726
> │  parent:      -1:0000000000000000000000000000000000000000
> │  manifest:    417:cc0fb0f5e65d48e54b640dc9fcd046a171889358
> │  user:        Uwe Brauer <oub at mat.ucm.es>
> │  date:        Fri Dec 25 09:12:30 2020 +0100
> │  files:       aulas-controles.org
> │  extra:       branch=year-20-21
> │  extra:       topic=fechas-controles
> │  description:
>
> I would like to create a template (with colors) to include the topic
> extra field
>
>
>   extra:       topic=fechas-controles
>
> Can anybody please point out to me the required syntax for this field?
>
> Thanks
>
> Uwe Brauer
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20210103/55e2a5d2/attachment-0002.html>


More information about the Mercurial mailing list