You can add some Mercurial information to your shell prompt, but it can be quite a pain to do this using the commands in Mercurial. Steve Losh created the Hg-Prompt extension purely for the purpose of using it in shell prompts.
To install this extension, first clone the repository somewhere:
$ hg clone https://bitbucket.org/sjl/hg-prompt/
And add the path to the prompt.py in your hgrc file:
I typically check the Mercurial history of a repository using the log or the graphical log -G method. I sometimes find it convenient to view only the tags or heads in the same log format. This is as if the log was filtered out to show only the tags or heads log entries.
This can be done by passing the resulting list of revisions from the tag or head functions to the log option:
The Punchcard extension of Mercurial can be used to obtain a calendar chart of your contributions to a repository, as shown in here. If you need to view the classic line graph of activities in a Mercurial repository, then the Activity extension is a great solution.
This extension uses Matplotlib and requires a recent version. Matplotlib that ships with Ubuntu is typically ancient, so uninstall that and install the latest using pip:
One of the coolest feature of Github is the calendar chart that is shows for your contributions. You can get a similar chart for any Mercurial repository on your computer using the Punchcard extension.
First clone the Punchcard repository in a suitable directory:
Mercurial is very convenient to use at the commandline. However, there are certain operations that are better with the GUI. For example, I prefer to use a GUI to go through the diff of uncommitted changes. The ExtDiff extension can be used to launch a GUI Diff tool to view the diff of a single file or across the entire repository.
To enable the ExtDiff extension, add this line to your hgrc:
To view the diff of a particular file using a GUI diff program, for example meld:
$ hg extdiff -p meld src/bar/foo.cpp
To view the diff of all uncommitted files using a GUI diff program, for example meld:
$ hg extdiff -p meld
Make sure that the GUI diff program you use has the ability to show the diff of multiple files in a directory hierarchy.
If you want to always launch a particular GUI diff program, then it is better to add a custom command for it. For example, to launch meld using a new command named vdiff, add this line to your hgrc:
cmd.vdiff = meld
After this, you can view the diff using the vdiff command:
The Shelve extension of Mercurial is useful to temporarily store away your uncommitted changes and then restore them back. For example, if you are working on some changes, and before you commit it, someone comes in and asks you to test something on an earlier version. You can shelve away your changes, finish the testing and unshelve the changes and continue.
That is, it has the login, the source location (directory or internet domain), the repository owner and finally the repository name. This assigns a symbolic name of default to this repository. After this any push or pull command is done with this repository.
If you created a new Mercurial repository and want to push it to another existing repository, then the command is:
$ hg push https://firstname.lastname@example.org/joe/foobar
If you want to push or pull without having to specify the repository, then just create a .hg/hgrc file and add the above lines to it.
If you want to add other repositories to push-pull from, add them on separate lines with a different symbolic name, not default:
It is sometimes useful to see which files are being ignored in a Mercurial repository. For example, there might be some .hgignore rules that might be getting applied without your full knowledge. Such files will not be tracked or committed.
Seeing the list of ignored files in a local repository is easy: