I’ve been using Mercurial every day, since I joined BugSense a few months ago. At the time, I was an advanced Git user and it took me a while to understand what exactly is Mercurial’s philosophy and adapt my workflow to the new system.
So, I spent a good amount of time to finetune my configuration and find the perfect setup for my Mercurial workflow. I use a handful of already built-in (but not enabled by default) extensions, some external extensions and some custom aliases to facilitate some more complex tasks.
As of this writing, the
hg --version is 2.6. If you haven’t update it yet,
please do since some the following extensions are available only in
newer versions of Mercurial.
I think the feature of git that I really missed is
rebase. Mercurial’s rebase is not as hardcore as Git’s rebase but it
does the work done. You can enable it in your
I mainly use rebase for fetching commits from the upstream repository (Bitbucket, self-hosted hg, you name it). This is a very basic usage of rebase extension and it actually does have a lot more built-in functions but I don’t really need them in my current workflow.
This is very useful in my case because it solves Mercurial’s serious flaw (in my opinion) with continuous merges, that litter repo’s history with useless merge commits.
This is an awesome extension by Steve Losh, that allows you to display all the useful info about the Mercurial current repo in your terminal.
Graphlog is a built-in extension for Mercurial, which is the equivalent of
git log --graph and it formats the output as a graph representing the revision history using ASCII characters to the left of the log, quoting extension’s description.
In order to use it just enable it in your
file and your good to go.
You can use it by typing the following in your terminal:
1 2 3
Personally, I use it via an alias, just a shorthand to make it more accessible, nothing fancy at all. It still accepts all the options of glog.
One other Git command that Mercurial really needs is the
blame. This one isn’t exactly what you might think, it’s just for
finding in which commit or changeset a line was added or last modified.
It’s pretty handy as the time goes by and chances are you have forgotten
what you have written a few months ago.
So the solution I found on Stack Overflow was using the
annotate command with a few arguments. I took this and after I added my preferred arguments I create an alias in order to create
Here is the code for this alias:
Now, you can just type the following and you will be greeted with a nice output showing user and changeset number next to each line.
Combine that with
ack and you have a
power tool in your hands!
Very nice and handy plugin to add
less-like functionality for commands that have huge outputs, eg. log, diff etc.
It’s easy to setup and already included with Mercurial.
1 2 3
I will come back with a second part, covering the rest of the plugins I’m using.
Head over to Hacker News for the discussion