# HG changeset patch # User Steve Losh # Date 1258685635 18000 # Node ID f9616d40630b65e551d1a87317c64b05ba7aace5 # Parent fdde523e86f1ca5c864c3aed14575cf252e8a1c9 Create the documentation (using markdoc). diff -r fdde523e86f1 -r f9616d40630b .hgignore --- a/.hgignore Sun Nov 08 22:31:24 2009 +0100 +++ b/.hgignore Thu Nov 19 21:53:55 2009 -0500 @@ -1,2 +1,4 @@ syntax: glob *.pyc +docs/.html +docs/.tmp diff -r fdde523e86f1 -r f9616d40630b docs/markdoc.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/markdoc.yaml Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,17 @@ +wiki-name: "hg-prompt" +hide-prefix: "." +document-extensions: [.md, .mdown, .markdown] +generate-listing: always +listing-filename: "list.html" +use-default-static: true +use-default-templates: true + +markdown: + safe_mode: false + output_format: xhtml1 + extensions: [codehilite, def_list, toc] + +server: + bind: '127.0.0.1' + port: 8010 + server_name: 'sjl.bitbucket.org' \ No newline at end of file diff -r fdde523e86f1 -r f9616d40630b docs/publish.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/publish.sh Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +markdoc build --document-root '/hg-prompt/' +rsync --delete -az .html/ ~/src/sjl.bitbucket.org/hg-prompt +hg -R ~/src/sjl.bitbucket.org commit -Am 'hg-prompt: Update documentation.' +hg -R ~/src/sjl.bitbucket.org push diff -r fdde523e86f1 -r f9616d40630b docs/wiki/documentation/index.mdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/documentation/index.mdown Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,10 @@ +Documentation +============= + +##[Usage](/hg-prompt/documentation/usage/)## + +How the `hg prompt` command can be used. + +##[Keywords](/hg-prompt/documentation/keywords/)## + +Keywords available to use with the command. diff -r fdde523e86f1 -r f9616d40630b docs/wiki/documentation/keywords/index.mdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/documentation/keywords/index.mdown Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,123 @@ +Keywords +======== + +There a number of keywords available. If you have any suggestions for more please [let me know][issues]. + +[issues]: http://bitbucket.org/sjl/hg-prompt/issues + +Some of the keywords support filters. These filters can be combined when it makes sense. If in doubt, try it! + +[TOC] + +##bookmark## +: Display the current bookmark (requires the [bookmarks][] extension). + +##branch## +: Display the current branch. + +##incoming## +: Display nothing, but if the default path contains incoming changesets the + extra text will be expanded. + + For example: `{incoming changes{incoming}}` will expand to + `incoming changes` if there are changes, otherwise nothing. + + Checking for incoming changesets is an expensive operation, so `hg-prompt` + will cache the results in `.hg/prompt/cache/` and refresh them every 15 + minutes. + + |count + : Display the number of incoming changesets (if greater than 0). + +##node## +: Display the (full) changeset hash of the current parent. + + |short + : Display the hash as the short, 12-character form. + + |merge + : Display the hash of the changeset you're merging with. + +##outgoing## +: Display nothing, but if the current repository contains outgoing + changesets (to default) the extra text will be expanded. + + For example: `{outgoing changes{outgoing}}` will expand to + `outgoing changes` if there are changes, otherwise nothing. + + Checking for outgoing changesets is an expensive operation, so `hg-prompt` + will cache the results in `.hg/prompt/cache/` and refresh them every 15 + minutes. + + |count + : Display the number of outgoing changesets (if greater than 0). + +##patch## +: Display the topmost currently-applied patch (requires the [mq][] + extension). + + |count + : Display the number of patches in the queue. + + |applied + : Display the number of currently applied patches in the queue. + + |unapplied + : Display the number of currently unapplied patches in the queue. + +##rev## +: Display the repository-local changeset number of the current parent. + + |merge + : Display the repository-local changeset number of the changeset you're + merging with. + +##root## +: Display the full path to the root of the current repository, without a + trailing slash. + + |basename + : Display the directory name of the root of the current repository. For + example, if the repository is in `/home/u/myrepo` then this keyword + would expand to `myrepo`. + +##status## +: Display `!` if the repository has any changed/added/removed files, + otherwise `?` if it has any untracked (but not ignored) files, otherwise + nothing. + + |modified + : Display `!` if the current repository contains files that have been + modified, added, removed, or deleted, otherwise nothing. + + |unknown + : Display `?` if the current repository contains untracked files, + otherwise nothing. + +##tags## +: Display the tags of the current parent, separated by a space. + + |SEP + : Display the tags of the current parent, separated by `SEP`. + +##task## +: Display the current task (requires the [tasks][] extension). + +##tip## +: Display the repository-local changeset number of the current tip. + + |node + : Display the (full) changeset hash of the current tip. + + |short + : Display a short form of the changeset hash of the current tip (must be + used with the **|node** filter) + +##update## +: Display `^` if the current parent is not the tip of the current branch, + otherwise nothing. In effect, this lets you see if running `hg update` + would do something. + +[bookmarks]: http://mercurial.selenic.com/wiki/BookmarksExtension +[tasks]: http://bitbucket.org/alu/hgtasks/wiki/Home +[mq]: http://mercurial.selenic.com/wiki/MqExtension \ No newline at end of file diff -r fdde523e86f1 -r f9616d40630b docs/wiki/documentation/usage/index.mdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/documentation/usage/index.mdown Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,37 @@ +Usage +===== + +The `hg prompt` command takes a single string as an argument and outputs it. Here's a simple (and useless) example: + + :::console + $ hg prompt "test" + test + +Keywords in curly braces can be used to output repository information: + + :::console + $ hg prompt "currently on {branch}" + currently on default + +Keywords also have an extended form: + + :::text + {optional text{branch}more optional text} + +This form will output the text and the expanded keyword **only** if the keyword successfully expands. This can be useful for displaying extra text only if it's applicable: + + :::console + $ hg prompt "currently on {branch} and at {bookmark}" + currently on branch default and at + + $ hg prompt "currently on {branch} {and at {bookmark}}" + currently on branch default + + $ hg bookmark my-book + + $ hg prompt "currently on {branch} {and at {bookmark}}" + currently on branch default and at my-book + +Take a look at the [keywords][] documentation to see all the keywords `hg-prompt` supports. + +[keywords]: /hg-prompt/documentation/keywords/ \ No newline at end of file diff -r fdde523e86f1 -r f9616d40630b docs/wiki/index.mdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/index.mdown Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,22 @@ +hg-prompt +========= + +`hg-prompt` is a Mercurial extension that adds an 'hg prompt' command to Mercurial for viewing repository information. It's designed to be used in a shell prompt. + +[Installation][] +---------------- + +[Quick Start][] +--------------- + +[Full Documentation][] +---------------------- + +[Installation]: /hg-prompt/installation/ +[Quick Start]: /hg-prompt/quickstart/ +[Full Documentation]: /hg-prompt/documentation/ + +Screenshot +---------- + +![My bash prompt while using hg-prompt.](http://stevelosh.com/site-media/storage/projects/2009-06-19-hg-prompt/hg-prompt.png "My bash prompt while using hg-prompt.") diff -r fdde523e86f1 -r f9616d40630b docs/wiki/installation/index.mdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/installation/index.mdown Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,27 @@ +Installation +============ + +Installing `hg-prompt` requires [Python][] 2.5+ and (obviously) Mercurial. + +[Python]: http://python.org/ + +First, clone the repository: + + :::console + $ hg clone http://bitbucket.org/sjl/hg-prompt/ + +Edit the `[extensions]` section in your `~/.hgrc` file: + + :::cfg + [extensions] + prompt = (path to)/hg-prompt/prompt.py + +Make sure everything is working: + + :::console + $ hg prompt 'test' + test + +Take a look at the [Quick Start][] guide to learn how to put some useful information into your shell prompt. + +[Quick Start]: /hg-prompt/quickstart/ \ No newline at end of file diff -r fdde523e86f1 -r f9616d40630b docs/wiki/quickstart/index.mdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/wiki/quickstart/index.mdown Thu Nov 19 21:53:55 2009 -0500 @@ -0,0 +1,52 @@ +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]: /hg-prompt/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]: /hg-prompt/documentation/ \ No newline at end of file