Mercurial Bookmarks Revisited – Part I

Bookmarks is an extension to the Mercurial SCM, which adds git-like branches to Mercurial. The extension is distributed together with Mercurial.
Recently the extension has received a major update. Time to look back.

This is a series of blogposts that consists of three parts:

(1) Part I: History of Bookmarks
(2) Part II: Daily Bookmarking
(3) Part III: Pushable Bookmarks


I stumbled over Mercurial in August 2007. Back then I had already
used Git for 6 months, but wanted
to try out different distributed version control systems (DVCS).
I soon began to like Mercurial’s approach because of its simple and
intuitive interface and its clean codebase. While playing around
with Mercurial for a few weeks I was content with its concepts.
There was one feature missing
that I really like in Git: git-like branches.

Unlike in Mercurial or in any other version control system, branches in
Git are simply lightweight markers pointing to a commit. Every ancestor of
the commit is considered part of the branch. Back then, this sounded odd to me. Later I realized it was a really good tool to create small local branches. You can create a small branch
for a feature, merge it into your mainline, and remove the branch
without anyone knowing you ever had a branch called
‘stupid-little-feature‘. To make a long story short: It’s a good
idea to have a similar concept in Mercurial, but none existed back in 2008.

In June 2008 I started developing Mercurial References providing lightweight branches similar to those available in Git. Although the initial work was appreciated by the community, it was rejected
in favor of a concept more natural to Mercurial. Matt Mackall, the author of
Mercurial proposed Mercurial Bookmarks.

Bookmarks

The concept of bookmarks is easy:
You can bookmark a commit with a unique name. So it’s similar to
a tag, with one exception, a bookmark advanced when you commit.
(Like real bookmarks when you go to the next page).

I wrote an initial version of Mercurial Bookmarks in August, that
was finally accepted in October. This improved git like workflows
in Mercurial but still the implementation was far away from what I
wanted. By adding the notion of a so called “current bookmark”, it
got better. Still bookmarks had one major drawback in comparison
to git style branches. They were local only. There was no way to
push or pull bookmarks.

Pushable bookmarks

This was the status for the past two years. I tried to make bookmarks
pushable during this time. A proposal by me how extensions in general
can exchange arbitrary information over the wire was rejected in
early 2009 because it was too unrestrictive for the protocol. A new
concept, so called ‘pushkey concept’ was developed in 2009. This
was discussed and accepted during the Mercurial Sprint in Paris,
January 2010.

Matt Mackall, who now gets sponsored to work on Mercurial,
worked on the initial implementationof pushkey and
pushable bookmarks. And finally after two years of ongoing complains
by people about local-only bookmarks, Mercurial 1.6 will have
pushable bookmarks and introduces a great new concept to exchange
metadata information between repositories.

The next blogpost will show you how to use bookmarks.

Posted June 23rd, 2010 in Open Source, Programming, Version Control. Tagged: , , , , .

7 comments:

  1. C-J Berg:

    I want to thank you for your work on the bookmarks extension, it’s been very helpful. I like Mercurial for the same reasons you mention (and the fact that it works great on Windows), but I’ve always wanted git-style branching for all those small branches not deserving a named branch or a clone. With push support, bookmarks will work great in a team, so I expect that many teams will start using it frequently now.

  2. Peter:

    I sure would like to see part 2 & 3 of this series… Any update on this?

  3. Zada:

    Hei, I need updates! Stop playing Starcraft!

  4. Landon:

    Please sir, post an update. I am getting near to possibly begging for parts 2 and 3. Bookmarks are very helpful, and I need more information. Every day, I come to see if there is an update. There is none. I weep. Please stop playing (for a moment only) what you call the “Starcraft” and please post an update. Please. Thanks.

  5. dsp:

    Seriously guys, I’m on it :). Already wrote the first lines. It’s on the way….

  6. FallenGameR:

    Not fast enough =)
    Will there be parts 2,3 in the near future?

    PS Thanks for your contributions.

  7. experimentalworks » Blog Archive » Bookmarks Revisited Part II: Daily Bookmarking:

    […] been a long time since I’ve written part I of the bookmarks revisited series. In the last two years, bookmarks changed a lot. They became part Mercurial’s core […]

Leave a response: