Can I color hg log output based on content?

166 views Asked by At

Is it possible to color each line of hg log output based on the individual changeset's content and/or description? For instance, I'd like to help the "real" work stand out, by graying out the lines for merges and the lines for changes that only touch testing resources (no programming language files.)

Based on our teams habits, I could get roughly what I want by looking for the words "baseline" and "merge" in the descriptions, but file patterns and directories (for baselines) and topology (for merges) would be more precise.

Is there a way to configure hg to format each line differently?

1

There are 1 answers

2
Boris Feld On

I don't think it's possible to color only based on the content but you could use Mercurial revsets (hg help revset) to display only the relevant changesets.

Something like: hg log -r "not desc('merge') and not file('test/*')" should get you on right track.

Here are some details how it works:

  • desc('merge') will select changesets containing merge in their description.
  • not desc('merge') will filter out such changesets.
  • file('test/*') will select changesets touching files in the tests directory.
  • not file('test/*') will filter out such changesets.

The big problem with this solution is that it would filter out changesets touching files in both the test directory and somewhere else, I'm not sure there is a dedicated revset for that.