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
$ 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"

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s