Pretty HG Log Style

There’s a somewhat famous styled git log I have in my config. The guy I grabbed it from said it was from scm-breeze, I think maybe he meant tiimgreen’s github-cheat-sheet. In any case, The Git one is like:

alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Consulting the docs, (who does that, right?), it’s not insane to figure out what this is doing:

Great.
But I’ve been using HG. Can Mercurial haz it, too?
Sources:

This helps us get a plain one-liner

I’m trying for “direct equivalence”. YMMV, since Git/HG don’t exactly share all concepts. (e.g. every commit in HG has the notion of a ‘branch’, etc.).
So, note that when building the template, this is the stuff to put within the {}:

So, my .hgrc has:

[color]
custom.rev = red
custom.decorate = yellow
custom.date = green
custom.author = blue bold

With the hg alias: alias hl="hg log --style ~/.hgrc.d/fancy.style". (Or do this from your shell, whatever).

And, finally, ~/.hgrc.d/fancy.style is:

changeset = "* {label('custom.rev', node|short)} - ({label('custom.decorate', branch)}) {desc|strip|firstline} ({label('custom.date', date|age)}) <{label('custom.author' , author)}>\n"

Screenshot:

(The repo is old, because I don’t use HG so much, okay?).


Newer post Older post