Today's Mercurial command alias: a short form hg incoming

May 24, 2012

Like other modern VCSes, Mercurial allows you to define command aliases. This is a feature that I don't use as much as I could, but every so often I work out one that's really handy. Today's alias is something I've called 'hg pending', a short form summary version of 'hg incoming'.

From my .hgrc:

[alias]
pending = incoming --template '* {desc|firstline}\n'

This shows something that looks like:

* exp/html: detect "integration points" in SVG and MathML content
* runtime: faster GC mark phase
* cmd/cc: fix uint right shift in constant evaluation
* cmd/6g: peephole fixes/additions

When I'm checking up on what's coming from an upstream repository that I'm tracking, this is basically just what I want; I don't care about who authored the change or its long description or the other full information, I'd just like to get a quick overview of what I'll get with a pull.

(This assumes that you are tracking Mercurial repositories that use the decent and correct format for commit messages.)

Possibly I should make a version of this for hg log too, but I haven't felt the urge yet.

(I have no strong reason for calling it 'pending' instead of anything else and there is probably a better term for it since I am bad with names.)

Bonus: sdiff, a sysadmin-friendly diff alias

Another Mercurial 'alias' (sort of) that we've become very accustomed to is something we call hg sdiff:

[extensions]
hgext.extdiff =

[extdiff]
cmd.sdiff = diff
opts.sdiff = -Nr

This gives us an old-style diff of changes. This is not something you would use as a programmer, but for sysadmins it turns out that the context from unified diffs is basically pointless for many changes to configuration files. In fact, zero-context diffs can be easier to read because there is less clutter obscuring the actual changes.

(The one drawback of this is that Mercurial doesn't report the file that has changed if there's only one. 'hg status' is your friend here.)

This especially matters to us because we often record configuration file changes (in some diff form) in worklog entries (which also helps other sysadmins to stay on top of the changes). When we initially switched to Mercurial from RCS, the increased verbosity of the default hg diff unified diff output became vaguely annoying. Creating hg sdiff helped significantly.

(Having written this, I guess we could experiment with forcing zero lines of context for unified diffs. However we're well accustomed to old-style diff output as it is, so I suspect we wouldn't really find it much of an improvement.)

Written on 24 May 2012.
« How we do milter-based spam rejection with Exim
How CSLab currently does server side email anti-spam stuff (version 2) »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu May 24 17:11:24 2012
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.