Getting hg ( mercurial) completion in bash

On my Fedora 20 environment I'm using Mercurial ( hg ) beside svn & git for
version control.

This is a nice distributed version control system, which was the only one
available on Solaris/Linux/Windows, at the time I switched. Git was available
on windows only by using a cygwin environment.

Now git on my Fedora box has a nice little command/branch-name ...
completion.
When starting commands and typing <TAB> the suitable completion is
searched and shown, if there are multiple ones.


For hg I was missing this, because I install mercurial from source on my
fedora system.

The missing key part is to source in the completion file into .bashrc in the
homedirectory. The completion file is delivered in the source release of mercurial:

e.g.:

if [ -f /tools/DevTools/mercurial/latest/contrib/bash_completion ]; then
    . /tools/DevTools/mercurial/latest/contrib/bash_completion
fi

After resourcing the .bashrc the completion also works for hg

[ewer@lxewer hg-git]$ hg checkout<TAB>
0.1.0    0.2.2    0.2.5    0.3.1    0.3.4    0.6.0    master  
0.2.0    0.2.3    0.2.6    0.3.2    0.4.0    0.6.1    next    
0.2.1    0.2.4    0.3.0    0.3.3    0.5.0    default  tip     
[ewer@lxewer hg-git]$ hg checkout 0.<TAB>
0.1.0  0.2.1  0.2.3  0.2.5  0.3.0  0.3.2  0.3.4  0.5.0  0.6.1 
0.2.0  0.2.2  0.2.4  0.2.6  0.3.1  0.3.3  0.4.0  0.6.0