docs/wiki/quickstart/index.mdown @ c4095c3519d6

Fixed bug that was thowing a KeyError when including "{bookmark}" in the output.

This resolves issue #17 (Bookmarks have moved into core for 1.8) on https://bitbucket.org/sjl/hg-prompt/.

The end of the stack track was....
-----------------------------
  File "/Users/dak180/Applications/Build/hgExtensions/hg-prompt/prompt.py", line 101, in _bookmark
    book = extensions.find('bookmarks').current(repo)
  File "/sw/lib/python2.6/site-packages/mercurial/extensions.py", line 30, in find
    raise KeyError(name)
KeyError: 'bookmarks'
-----------------------------

I personally was getting this error on mercurial versions 1.8.1 and 1.6.3 (although I am not exactly sure why I got it on 1.6.3).
author Shaun Ek <shaune@providentmetals.com>
date Wed, 23 Mar 2011 15:42:04 -0400
parents e35a2b4aa170
children (none)
Quick Start
===========

This guide will get you up and running so you can put some useful information
into your shell prompt.

If you haven't already [installed][install] it, do that now.

[install]: /installation/

A Simple (But Useful) Prompt
----------------------------

Edit your `~/.bashrc` file to include something like this:

    :::bash
    hg_ps1() {
        hg prompt "{ on {branch}}{ at {bookmark}}{status}" 2> /dev/null
    }
    
    export PS1='\u at \h in \w$(hg_ps1)\n$ '

`source ~/.bashrc` after to test it out. Make sure you're in a Mercurial
repository or you won't see anything. This little prompt will give you
something like this:

    :::console
    steve at myhost in ~/src/hg-prompt on default at feature-bookmark?
    $

An Advanced Prompt
------------------

How about something a little more interesting?

    :::bash
    hg_ps1() {
        hg prompt "{[+{incoming|count}]-->}{root|basename}{/{branch}}{-->[+{outgoing|count}]}{ at {bookmark}}{status}" 2> /dev/null
    }
    
    export PS1='$(hg_ps1)\n\u at \h in \w\n$ '

And the result (this example assumes one incoming changeset and two outgoing):

    :::console
    [+1]-->hg-prompt/default-->[+2] at feature-bookmark
    steve at myhost in ~/src/hg-prompt
    $

Learn More
----------

From here you can take a look at the [full documentation][] to see all the
interesting things `hg-prompt` can do.

[full documentation]: /documentation/