简体   繁体   中英

Can I color hg log output based on content?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM