Overview

-*- markdown -*-

hg-prompt
=========

hg-prompt adds an 'hg prompt' command to Mercurial for viewing repository information.  It's designed to be used in a shell prompt.


Requirements
------------

hg-prompt requires Python 2.5+ and (obviously) Mercurial.


Installing
----------

Clone the repository:

    $ hg clone http://bitbucket.org/sjl/hg-prompt/

Edit the `[extensions]` section in your `~/.hgrc` file:

    [extensions]
    prompt = (path to)/hg-prompt/prompt.py


Documentation
-------------

The documentation for hg-prompt is at the [project page][project].  There's a [Quick Start guide][quickstart], [Full Usage Guide][usage], [Keyword List][keywords], and a few other things there.

The documentation is stored in the `docs/` directory of the repository if you prefer to read it offline.

[project]: http://sjl.bitbucket.org/hg-prompt/
[quickstart]: http://sjl.bitbucket.org/hg-prompt/quickstart/
[usage]: http://sjl.bitbucket.org/hg-prompt/documentation/usage/
[keywords]: http://sjl.bitbucket.org/hg-prompt/documentation/keywords/

Example of using prompt_startup.py:
    prompt_startup.py "{ {branch}}{[{bookmark}]}{({closed})}"
In general, replace 'hg prompt' as in 'hg prompt <arg> [<options>]' with 'prompt_startup.py'.

Example of using colorized output of 'hg prompt' in command prompt:

    hg_prompt() {
        script -q /dev/null prompt_startup.py "{ {branch}}{[{bookmark}]}{({closed})}{status}"
    }
    export PS1='\h$(hg_prompt)\n\W> '

Colors can be customized in the .hgrc file. Available color names and text effects:
    'none', 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white',
    'bold', 'italic', 'underline', 'inverse',
    'black_background', 'red_background', 'green_background', 'yellow_background',
    'blue_background', 'purple_background', 'cyan_background', 'white_background'

Keywords added in the [color] section and default values
    prompt.bookmark : "red",
    prompt.branch   : "magenta",
    prompt.closed   : "red",
    prompt.count    : "none",
    prompt.node     : "none",
    prompt.patch    : "none",
    prompt.patches  : "none",
    prompt.queue    : "none",
    prompt.rev      : "none",
    prompt.root     : "none",
    prompt.status   : "green",
    prompt.tags     : "yellow bold",
    prompt.task     : "none",
    prompt.tip      : "none",
    prompt.update   : "none",
    prompt.incoming : "none",
    prompt.outgoing : "none",


Questions, Comments, Suggestions
--------------------------------

The code was kind of thrown together in a few nights after I got tired of chaining three or four hg runs together to get what I wanted.  I'm sure it's not perfect, so if you've got a way to improve it please add an issue and let me know.

Patches are also welcome!