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:

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

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:

custom.rev = red
custom.decorate = yellow = green = blue bold

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

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

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


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

Newer post Older post