Differences between revisions 18 and 19
Revision 18 as of 2008-12-31 14:53:07
Size: 3188
Editor: peter kovac
Comment:
Revision 19 as of 2008-12-31 14:53:57
Size: 3187
Editor: peter kovac
Comment:
Deletions are marked like this. Additions are marked like this.
Line 104: Line 104:
Delete the changesets as well (requires mq extension): Delete the changeset as well (requires mq extension):

Bookmarks Extension

This extension is distributed (as of 24.10.2008) with Mercurial.

Author: DavidSoria

Repository: http://www.bitbucket.org/segv/bookmarks/overview/

Announcement: http://selenic.com/pipermail/mercurial/2008-October/021749.html

README: http://www.bitbucket.org/segv/hgbookmarks/src/tip/README

Additional information, also for people coming from GIT: [http://ub0.cc/6M/s bookmarks extension explained]

Overview

Bookmarks are markers on commits that move on commit. Therefore you can do a 'hg book newfeature' and work on that and the bookmark will move forward with every commit you do.

Bookmarks can be used to access the commit whenever a usual lookup is allowed, therefore you can merge and update bookmarks by their names.

Bookmarks are stored localy. You can use rsync or scp to copy the .hg/bookmarks file to a remote repository. You can also use hg id -r <bookmark> <repourl> to get the id of a bookmark (and therefore might manually track it).

An example usage:

$ hg book ds/feature-x
.. hack .. hack ..
$ hg commit
.. hack .. hack ..
$ hg commit
$ hg update 4
# go back to old rev
$ hg merge ds/feature-x

Configuration

Configure your .hgrc to enable the extension by adding following lines:

[extensions]
hgext.bookmarks =

Usage

Let’s give you a short example how bookmarks work.

Now let’s go into a Mercurial repository. You can run hg help bookmarks to show the available flags. Let’s start with a basic listing of available bookmarks:

 $ hg bookmarks
 no bookmarks set

Create a bookmark on the current tip of the repository:

 $ hg bookmark my-tip
 $ hg bookmarks
   * my-tip                    7348:1a5c9ca2bfd5

Let’s create a bookmark on an other revision in the history:

 $ hg bookmark -r 7300 hgweb-fix
 $ hg bookmarks
   * my-tip                  7348:1a5c9ca2bfd5
     hgweb-fix               7300:591767e6ea7a

We can then update to the revision:

 $ hg update hgweb-fix
 82 files updated, 0 files merged, 31 files removed, 0 files unresolved
 $ hg bookmarks
      my-tip                  7348:1a5c9ca2bfd5
   *  hgweb-fix               7300:591767e6ea7a

We also can now commit to this bookmark and create a new head:

 ...hack..hack..
 $ hg commit -m’Another hgweb bugfix’
 $ hg bookmarks
      my-tip                  7348:1a5c9ca2bfd5
   *  hgweb-fix               7349:ca3fbad32554

Let’s go back to our tip and merge our change into it:

 $ hg update -C my-tip
 $ hg merge hgweb-fix
 $ hg commit -m’Merge bookmark hgweb-fix’

Now we can just delete our bookmarks:

 $ hg bookmark -d hgweb-fix
 $ hg bookmarks
   * my-tip                  7350:3acda44343da

Delete the changeset as well (requires mq extension):

hg tag -r bookmark bookmark-tag
hg book -d bookmark
hg strip bookmark-tag

You can use bookmarks in every rev lookup. This means you can also do hg log -prf my-tip:0 or hg qimport -r my-tip. It is even possible to look them up using hg id -r .


CategoryExtension