Extensions like Hg-Prompt help print the version control status to the command prompt, as described here. But, it is written in Python and launching the Python interpreter on every command is too slow at the command prompt. That is the last place where you need things to be slow!
The solution for speed is always C/C++! VCPrompt is a tool that is written in C/C++ by Greg Ward that can be used to print status of version control in the shell prompt. It is extremely fast due to it being a binary. It can handle Mercurial, Git and Subversion repositories.
To install from PPA:
$ sudo add-apt-repository ppa:voronov84/andreyv $ sudo apt-get update $ sudo apt install vcprompt
To install it from source:
$ hg clone https://bitbucket.org/gward/vcprompt $ cd vcprompt $ autoconf $ ./configure $ make $ sudo make install
To use vcprompt, specify the information you need in its format specifier:
$ vcprompt -f "%n:%r:%u%m" hg:123:+
It can be easily incorporated into a shell prompt, by grabbing its output.
Note: VCPrompt has a few missing features, including not being able to show details of Git submodule. There is another VCPrompt inspired by this one here which has these features. However, it is written in Python, which makes its choice moot.
Tried with: Ubuntu 14.04