<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>experimentalworks &#187; bookmarks</title>
	<atom:link href="http://blog.experimentalworks.net/tag/bookmarks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.experimentalworks.net</link>
	<description></description>
	<lastBuildDate>Fri, 27 Jan 2012 10:07:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Mercurial Bookmarks Revisited &#8211; Part I</title>
		<link>http://blog.experimentalworks.net/2010/06/mercurial-bookmarks-revisited-part-i/</link>
		<comments>http://blog.experimentalworks.net/2010/06/mercurial-bookmarks-revisited-part-i/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 08:53:51 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Version Control]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[dvcs]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://blog.experimentalworks.net/?p=453</guid>
		<description><![CDATA[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  ...]]></description>
			<content:encoded><![CDATA[<p>Bookmarks is an extension to the <a href="http://mercurial-scm.org">Mercurial SCM</a>, which adds git-like branches to Mercurial. The extension is distributed together with Mercurial.<br />
Recently the extension has received a major update. Time to look back.</p>
<p>This is a series of blogposts that consists of three parts:</p>
<p> <strong>(1) Part   I: History of Bookmarks</strong><br />
 (2) Part  II: Daily Bookmarking<br />
 (3) Part III: Pushable Bookmarks</p>
<p><strong>UPDATE</strong> I&#8217;m aware that people wait for Part II. Let me see if I can write about it this weekend&#8230;in the meantime, click the flattr button :)<br />
<span id="more-453"></span><br />
I stumbled over Mercurial in August 2007. Back then I had already<br />
used <a href="http://git-scm.org">Git</a> for 6 months, but wanted<br />
to try out different distributed version control systems (<a href="http://en.wikipedia.org/wiki/Distributed_revision_control">DVCS</a>).<br />
I soon began to like Mercurial&#8217;s approach because of its simple and<br />
intuitive interface and its clean codebase. While playing around<br />
with Mercurial for a few weeks I was content with its concepts.<br />
There was one feature missing<br />
that I really like in Git: <a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html">git-like branches</a>.</p>
<p>Unlike in Mercurial or in any other version control system, branches in<br />
Git are simply lightweight markers pointing to a commit. Every ancestor of<br />
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<br />
for a feature, merge it into your mainline, and remove the branch<br />
without anyone knowing you ever had a branch called<br />
<em>&#8216;stupid-little-feature</em>&#8216;. To make a long story short: It&#8217;s a good<br />
idea to have a similar concept in Mercurial, but none existed back in 2008.</p>
<p>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<br />
in favor of a concept more natural to Mercurial. Matt Mackall, the author of<br />
Mercurial proposed Mercurial Bookmarks.</p>
<h3>Bookmarks</h3>
<p>The concept of <a href="http://en.wikipedia.org/wiki/Bookmark">bookmarks</a> is easy:<br />
You can bookmark a commit with a unique name.  So it&#8217;s similar to<br />
a tag, with one exception, a bookmark advanced when you commit.<br />
(Like real bookmarks when you go to the next page).</p>
<p>I wrote an initial version of Mercurial Bookmarks in August, that<br />
was finally accepted in October. This improved git like workflows<br />
in Mercurial but still the implementation was far away from what I<br />
wanted. By adding the notion of a so called &#8220;current bookmark&#8221;, it<br />
got better. Still bookmarks had one major drawback in comparison<br />
to git style branches. They were local only. There was no way to<br />
push or pull bookmarks.</p>
<h3>Pushable bookmarks</h3>
<p>This was the status for the past two years. I tried to make bookmarks<br />
pushable during this time. A proposal by me how extensions in general<br />
can exchange arbitrary information over the wire was rejected in<br />
early 2009 because it was too unrestrictive for the protocol. A new<br />
concept, so called &#8216;pushkey concept&#8217; was developed in 2009.  This<br />
was discussed and accepted during the Mercurial Sprint in Paris,<br />
January 2010.</p>
<p>Matt Mackall, who now gets <a href="http://mercurial.selenic.com/sponsors/">sponsored</a> to work on Mercurial,<br />
worked on the <a href="http://selenic.com/hg/rev/ca4fc993087c">initial implementation</a>of pushkey and<br />
pushable bookmarks. And finally after two years of ongoing complains<br />
by people about local-only bookmarks, Mercurial 1.6 will have<br />
pushable bookmarks and introduces a great new concept to exchange<br />
metadata information between repositories.</p>
<p>The next blogpost will show you how to use bookmarks.</p>
<p class="wp-flattr-button"></p> <p><a href="http://blog.experimentalworks.net/?flattrss_redirect&amp;id=453&amp;md5=6168d680a8f2a3c2086cec08e10d8f7c" title="Flattr" target="_blank"><img src="http://blog.experimentalworks.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2010/06/mercurial-bookmarks-revisited-part-i/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Mercurial bookmarks</title>
		<link>http://blog.experimentalworks.net/2008/11/mercurial-bookmarks/</link>
		<comments>http://blog.experimentalworks.net/2008/11/mercurial-bookmarks/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 11:39:37 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Version Control]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[dvcs]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://wp.experimentalworks.net/?p=80</guid>
		<description><![CDATA[
Please note that this blog post is outdated. please refer to the mercurial help for more information about bookmarks.

A few month ago, Matt Mackall the maintainer of the Mercurial version control system, came up with the idea to implement so called bookmarks for mercurial.
Basic idea
The basic idea of these bookmarks is simple. Instead of ...]]></description>
			<content:encoded><![CDATA[<blockquote style="background-color: #fffad1; font-weight: bold; color: black"><p>
Please note that this blog post is outdated. please refer to the mercurial help for more information about bookmarks.
</p></blockquote>
<p>A few month ago, <a href="http://selenic.com" >Matt Mackall</a> the maintainer of the <a href="http://en.wikipedia.org/wiki/Mercurial_(software)" >Mercurial</a> version control system, came up with <a href="http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/15744" >the idea</a> to implement so called <i>bookmarks</i> for mercurial.<br />
<span id="more-80"></span><b>Basic idea</b><br />
The basic idea of these bookmarks is simple. Instead of referring to a commit by it&#8217;s linear rev number or it&#8217;s SHA1 key, the user should be able to set a <i>bookmark</i> on a commit and use this name to refer to the commit. So you can do:</p>
<blockquote><p>
 $ hg bookmark -r 132 my-bookmark<br />
 $ hg update my-bookmark
</p></blockquote>
<p><b>Further thoughts</b><br />
Just referring to a commit by a given name is nice, but it is not quite why we finally introduced bookmarks. A lot of people using both <a href="http://git.or.cz" >git</a> and Mercurial like Mercurial for it&#8217;s simplicity and it&#8217;s clear interface. Nevertheless they are missing certain features from git and one of the most often requested are git-styled branches. Let me just give you a short overview of the differences between the branch implementation of both systems:</p>
<p><i>Mercurial branches</i><br />
<a href="http://www.selenic.com/mercurial/wiki/index.cgi/Branch" >Mercurial branches</a> have a lot in common with branches in <a href="http://subversion.tigris.org" >Subversion</a> or <a href="http://www.nongnu.org/cvs/" >CVS</a>. If you commit to a branch, the name of the branch is stored in the <a href="http://www.selenic.com/mercurial/wiki/index.cgi/ChangeSet" >changeset</a> and therefore an immutable part of the history. This means, unlike bookmarks, branches can not be deleted if you created them, and that you will always know to which branch a certain commit belongs.</p>
<p><i>git branches</i><br />
In git&#8217;s notion of <a href="http://www.kernel.org/pub/software/scm/git/docs/git-branch.html" >branches</a> a branch is just a fork in the directed acyclic graph (DAG) of the history. Therefore the branch name is not recorded in the changeset. Branches are just pointers to a certain head of a <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph" >DAG</a> branch that move forward with every commit to that branch. This gives you the opportunity to create branches just for testing purposes or with stupid names that might be <a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge.html" >merged</a> or <a href="http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html" >rebased</a> later. If you delete the branch name, the branch in the DAG resides, but the name is gone.</p>
<p>As bookmarks are also just pointers to commits in the history, it is quite obvious that it is easy to implement a mechanism equal to the branch mechanism of git. Therefore bookmarks are not just pointers, but they move forward to the next commit if you create a child commit on a commit that is referred by a bookmark.</p>
<p><b>Problems</b><br />
As the branch notion in mercurial is different from git, it is clear the the internal design of mercurial makes some assumptions that rely on this behavior. This leads to some design decisions that might confuse people that come from git. If you switch to a branch in git and commit to it, only the branch that you are on is moved forward even though the parent commit has two branch names. Mercurial bookmarks are always forwarded if the parent commit is referred by a bookmark. Therefore you might forward bookmarks on commit without evening knowing. We don&#8217;t have a notion of a <i>current</i> bookmark. Furthermore bookmarks are local. There is no way to push or pull bookmarks. This is a limitation by the wire protocol of mercurial. There are patches floating around that implement a way to bring push/pull mechanism for various data including bookmarks, but as the wire protocol is a critical part of mercurial, the developer usually don&#8217;t like to enhance or change the protocol. You can use bookmarks remotely and do a lookup on them, but it requires a certain amount of deep knowledge.</p>
<p><b>Implementation</b><br />
As already mentioned, we have a <a href="http://www.selenic.com/hg/index.cgi/rev/135003a470f3" >working bookmark implementation now</a>. I worked on these bookmark stuff for several months. With the help of the mercurial community we finally made our way to the main tree (mpm&#8217;s and the crew tree) and therefore my extension will be part of the upcoming Mercurial 1.1 release. I&#8217;m currently <a href="http://www.bitbucket.org/segv/bookmarks" >maintaining the bookmarks</a> on <a href="http://bitbucket.org" >bitbucket.org</a> and a crew member is usually merging changes from me into the crew tree from time to time.</p>
<p><b>Example</b><br />
Let&#8217;s give you a short example how bookmarks work. First of all we have to checkout recent versions of Mercurial. You can get an hourly snapshot <a href="http://www.selenic.com/mercurial-snapshot.tar.gz" >here</a>. Then we have to setup the extension by adding the following lines to our <i>~/.hgrc</i>:</p>
<blockquote><p>
[extensions]<br />
hgext.bookmarks =
</p></blockquote>
<p>Now let&#8217;s go into a Mercurial repository. You can run <i>hg help bookmarks</i> to show the available flags.<br />
Let&#8217;s start with a basic listing of available bookmarks:</p>
<blockquote><p>
 $ hg bookmarks<br />
 no bookmarks set
</p></blockquote>
<p>Create a bookmark on the current tip of the repository:</p>
<blockquote><p>
 $ hg bookmark my-tip<br />
 $ hg bookmarks<br />
   + my-tip                    7348:1a5c9ca2bfd5
</p></blockquote>
<p>Let&#8217;s create a bookmark on an other revision in the history:</p>
<blockquote><p>
 $ hg bookmark -r 7300 hgweb-fix<br />
 $ hg bookmarks<br />
   + my-tip                  7348:1a5c9ca2bfd5<br />
     hgweb-fix               7300:591767e6ea7a
</p></blockquote>
<p>We can than update to the revision:</p>
<blockquote><p>
 $ hg update hgweb-fix<br />
 82 files updated, 0 files merged, 31 files removed, 0 files unresolved<br />
 $ hg bookmarks<br />
      my-tip                  7348:1a5c9ca2bfd5<br />
   +  hgweb-fix               7300:591767e6ea7a
</p></blockquote>
<p>We also can now commit to this bookmark and create a new head:</p>
<blockquote><p>
 &#8230;hack..hack..<br />
 $ hg commit -m&#8217;Another hgweb bugfix&#8217;<br />
 $ hg bookmarks<br />
      my-tip                  7348:1a5c9ca2bfd5<br />
   +  hgweb-fix               7349:ca3fbad32554
</p></blockquote>
<p>Let&#8217;s go back to our tip and merge our change into it:</p>
<blockquote><p>
 $ hg update my-tip<br />
 $ hg merge hgweb-fix<br />
 $ hg commit -m&#8217;Merge bookmark hgweb-fix&#8217;
</p></blockquote>
<p>Now we can just delete our bookmarks</p>
<blockquote><p>
 $ hg bookmark -d hgweb-fix<br />
 $ hg bookmarks<br />
      + my-tip                  7350:3acda44343da
</p></blockquote>
<p>You can use bookmarks in every rev lookup. This means you can also do <i>hg log my-tip</i> or <i>hg qimport -r my-tip</i>. It is even possible to look them up using <i>hg id -r <bookmark> <remoteurl></remoteurl></bookmark></i>. I hope you enjoy it. If you encounter any bugs don&#8217;t hesitate to file an issue at the mercurial bugtracker.</p>
<p><b>Thanks to</b><br />
A lot of people were involved in the development of the bookmarks extension either by giving ideas or by actually patching it. Thanks to ronny, mpm, tonfa, piranha, parren, joel, dimitriy and #mercurial.</p>
<p><b>Links</b></p>
<ul>
<li><a href="http://selenic.com/mercurial" >Mercurial</a></li>
<li><a href="http://hg.intevation.org/mercurial/crew" >Crew repository</a></li>
<li><a href="http://thread.gmane.org/gmane.comp.version-control.mercurial.general/9936" >Announcement of the bookmark extension</a></li>
<li><a href="http://www.bitbucket.org/segv/bookmarks" >My bookmark repository</a></li>
</ul>
<p><i>Mercurial is a fast decentralized version control system used by projects like Mozilla and OpenJDK for their software development. It is written in python and currently maintained by Matt Mackall.</i></p>
<p class="wp-flattr-button"></p> <p><a href="http://blog.experimentalworks.net/?flattrss_redirect&amp;id=80&amp;md5=33aaed8787567aa7a45981da513f46de" title="Flattr" target="_blank"><img src="http://blog.experimentalworks.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2008/11/mercurial-bookmarks/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

