Tab completion for mercurial qup extension

August 18th, 2009

The qup extension for mercurial (hg) is an extension that allows you to move MQ patches to top of unapplied part of series without using a text editor. This is pretty handy for juggling patches.

However when I installed the extension, I was a little annoyed to see that there was no bash tab completion for patch names. This was pretty important for me, saying as my patch names can be pretty long (I like to keep them descriptive).

Thankfully, I found an easy way to enable this in Ubuntu:

Just add the following to your /etc/bash_completion.d/mercurial file:

_hg_cmd_qup()
{
	_hg_cmd_qpush
}

Then you’ll need to source the file to enable it:

$ source /etc/bash_completion.d/mercurial

This should work with any OS with bash, you just might have to go looking for the right bash_completion file.