# HG changeset patch # User Steve Losh # Date 1258595280 18000 # Node ID b698f1159c04215cd8a42ae823618cba8da32448 Add the hg-prompt docs. diff -r 000000000000 -r b698f1159c04 hg-prompt/documentation/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/documentation/index.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,54 @@ + + + + + + + + hg-prompt » Documentation + + + + + + + + + +
+ + + + + + +

Documentation

+

Usage

+

How the hg prompt command can be used.

+

Keywords

+

Keywords available to use with the command.

+ + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/documentation/keywords.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/documentation/keywords.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,182 @@ + + + + + + + + hg-prompt » Keywords + + + + + + + + + +
+ + + + + + +

Keywords

+

There a number of keywords available. If you have any suggestions for more please let me know.

+

Some of the keywords support filters. These filters can be combined when it makes sense. If in doubt, try it!

+ +

bookmark

+
+
Display the current bookmark (requires the bookmarks extension).
+
+

branch

+
+
Display the current branch.
+
+

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.
+
+
+
+

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.
+
+ + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/documentation/list.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/documentation/list.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,84 @@ + + + + + + + + hg-prompt » ls /documentation + + + + + + + + + +
+ + + + + + +

ls /documentation

+ + + + +

Pages

+ + + + + + + + + + + + + +
5K + + Keywords + +
4K + + Usage + +
+ + + + + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/documentation/usage.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/documentation/usage.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,83 @@ + + + + + + + + hg-prompt » Usage + + + + + + + + + +
+ + + + + + +

Usage

+

The hg prompt command takes a single string as an argument and outputs it. Here's a simple (and useless) example:

+
$ hg prompt "test"
+test
+
+ + +

Keywords in curly braces can be used to output repository information:

+
$ hg prompt "currently on {branch}"
+currently on default
+
+ + +

Keywords also have an extended form:

+
{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:

+
$ 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
+
+ + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/index.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,52 @@ + + + + + + + + hg-prompt » hg-prompt + + + + + + + + + +
+ + + + + + +

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

+

Screenshot

+

My bash prompt while using hg-prompt.

+ + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/installation.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/installation.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,69 @@ + + + + + + + + hg-prompt » Installation + + + + + + + + + +
+ + + + + + +

Installation

+

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

+

First, 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
+
+ + +

Make sure everything is working:

+
$ hg prompt 'test'
+test
+
+ + +

Take a look at the Quick Start guide to learn how to put some useful information into your shell prompt.

+ + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/list.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/list.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,102 @@ + + + + + + + + hg-prompt » ls / + + + + + + + + + +
+ + + + + + +

ls /

+ + +

Directories

+ + + + + + + + + + + +
+ + documentation/ + +
+ + media/ + +
+ + + +

Pages

+ + + + + + + + + + + + + +
3K + + Installation + +
5K + + Quick Start + +
+ + + + + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/media/css/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/css/index.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,106 @@ + + + + + + + + hg-prompt » ls /media/css + + + + + + + + + +
+ + + + + + +

ls /media/css

+ + + + + + +

Files

+ + + + + + + + + + + + + + + + + + + + + + + +
2K + + layout.css + +
3K + + pygments.css + +
940B + + reset.css + +
1K + + typography.css + +
+ + + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/media/css/layout.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/css/layout.css Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,168 @@ +body, html { + background-color: #f6f6f6; + margin: 0; + padding: 0; +} + +div#breadcrumbs { + border-bottom: 4px dashed #f6f6f6; + margin: 0 -1.2em; + padding: 0.3em 1.4em 0.3em 1.4em; +} + +div#breadcrumbs p { + margin-bottom: 0.2em; +} + +div#content { + background-color: #fff; + height: 100%; + margin: 0 auto; + overflow: hidden; + padding: 0 1.2em 1.2em 1.2em; + width: 700px; +} + +h1 { + margin: 0.3em 0; + padding: 0.1em 0; +} + +h2, h3, h4, h5, h6 { + margin-top: 1em; + margin-bottom: 0.4em; +} + +p, ul, blockquote { + line-height: 1.8em; + margin-top: 0; + margin-bottom: 1em; +} + +p#footer { + border-top: 1px solid #999; + font-size: 0.7em; + margin-bottom: 0; + padding: 0.7em 0; + text-align: center; +} + +ul { + padding-left: 1.5em; +} + +ul li { + list-style-type: disc; + margin-left: 1.5em; + margin-top: 0.4em; +} + +code { + background-color: #f6f6f6; + border: 1px solid #999; + border-left: none; + border-right: none; + padding-left: 2px; + padding-right: 2px; + white-space: nowrap; +} + +pre code { + border: none; + padding: 0; + background: none; + white-space: pre-wrap; +} + +a code { + background: none; + border: none; + margin: 0; + padding: 0; + text-decoration: inherit; +} + +a.code { + background-color: #3f3f3f; +} + +dt { + font-weight: bold; + margin-top: 1em; +} + +dd { + line-height: 1.8em; + margin-left: 1.5em; +} + +blockquote p { + margin: 0; +} + +table { + margin: 1em; +} + +table thead { + background-color: #f6f6f6; +} + +table thead th { + border: 1px solid #999; + padding: 0.5em 1em; +} + +table tbody tr td { + border: 1px solid #999; + padding: 0.5em 1em; +} + +pre, blockquote, table.codehilitetable { + background-color: #f6f6f6; + border: 1px solid #999; + border-left: none; + border-right: none; + display: block; + line-height: 1.5em; + margin-left: 1.2em; + margin-right: 1em; + padding: 0.5em; + padding-left: 1em; +} + +pre, table.codehilitetable { + margin-bottom: 1em; +} + +table.codehilitetable div.linenodiv { + border-right: 1px solid #ccc; + margin-right: 1em; + padding-right: 1em; +} + +table.codehilitetable pre { + background: none; + border: none; + margin: 0; + padding: 0; +} + +table#pages tr, table#subdirs tr, table#files tr { + border-top: 1px solid #999; + border-bottom: 1px solid #999; +} + +table tr td.name a { + display: block; + padding: 0.5em 1em; +} + +table tr td.name a:hover { + background-color: #f6f6f6; +} + +table tr td.size { + padding: 0.5em 1em; + width: 40px; +} diff -r 000000000000 -r b698f1159c04 hg-prompt/media/css/list.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/css/list.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,106 @@ + + + + + + + + hg-prompt » ls /media/css + + + + + + + + + +
+ + + + + + +

ls /media/css

+ + + + + + +

Files

+ + + + + + + + + + + + + + + + + + + + + + + +
2K + + layout.css + +
3K + + pygments.css + +
940B + + reset.css + +
1K + + typography.css + +
+ + + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/media/css/pygments.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/css/pygments.css Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,61 @@ +.hll { background-color: #ffffcc } +.c { color: #808080 } /* Comment */ +.err { color: #F00000; background-color: #F0A0A0 } /* Error */ +.k { color: #008000; font-weight: bold } /* Keyword */ +.o { color: #303030 } /* Operator */ +.cm { color: #808080 } /* Comment.Multiline */ +.cp { color: #507090 } /* Comment.Preproc */ +.c1 { color: #808080 } /* Comment.Single */ +.cs { color: #cc0000; font-weight: bold } /* Comment.Special */ +.gd { color: #A00000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.gi { color: #00A000 } /* Generic.Inserted */ +.go { color: #808080 } /* Generic.Output */ +.gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.gt { color: #0040D0 } /* Generic.Traceback */ +.kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #003080; font-weight: bold } /* Keyword.Pseudo */ +.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #303090; font-weight: bold } /* Keyword.Type */ +.m { color: #6000E0; font-weight: bold } /* Literal.Number */ +.s { background-color: #fff0f0 } /* Literal.String */ +.na { color: #0000C0 } /* Name.Attribute */ +.nb { color: #007020 } /* Name.Builtin */ +.nc { color: #B00060; font-weight: bold } /* Name.Class */ +.no { color: #003060; font-weight: bold } /* Name.Constant */ +.nd { color: #505050; font-weight: bold } /* Name.Decorator */ +.ni { color: #800000; font-weight: bold } /* Name.Entity */ +.ne { color: #F00000; font-weight: bold } /* Name.Exception */ +.nf { color: #0060B0; font-weight: bold } /* Name.Function */ +.nl { color: #907000; font-weight: bold } /* Name.Label */ +.nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.nt { color: #007000 } /* Name.Tag */ +.nv { color: #906030 } /* Name.Variable */ +.ow { color: #000000; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #6000E0; font-weight: bold } /* Literal.Number.Float */ +.mh { color: #005080; font-weight: bold } /* Literal.Number.Hex */ +.mi { color: #0000D0; font-weight: bold } /* Literal.Number.Integer */ +.mo { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */ +.sb { background-color: #fff0f0 } /* Literal.String.Backtick */ +.sc { color: #0040D0 } /* Literal.String.Char */ +.sd { color: #D04020 } /* Literal.String.Doc */ +.s2 { background-color: #fff0f0 } /* Literal.String.Double */ +.se { color: #606060; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */ +.sh { background-color: #fff0f0 } /* Literal.String.Heredoc */ +.si { background-color: #e0e0e0 } /* Literal.String.Interpol */ +.sx { color: #D02000; background-color: #fff0f0 } /* Literal.String.Other */ +.sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */ +.s1 { background-color: #fff0f0 } /* Literal.String.Single */ +.ss { color: #A06000 } /* Literal.String.Symbol */ +.bp { color: #007020 } /* Name.Builtin.Pseudo */ +.vc { color: #306090 } /* Name.Variable.Class */ +.vg { color: #d07000; font-weight: bold } /* Name.Variable.Global */ +.vi { color: #3030B0 } /* Name.Variable.Instance */ +.il { color: #0000D0; font-weight: bold } /* Literal.Number.Integer.Long */ diff -r 000000000000 -r b698f1159c04 hg-prompt/media/css/reset.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/css/reset.css Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,7 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.7.0 +*/ +html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;} \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/media/css/typography.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/css/typography.css Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,94 @@ +html { + font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif; + font-size: 10pt; +} + +h1, h2, h3, h4, h5, h6 { + font-weight: bold; +} + +h1 { + font-size: 2em; +} + +h2 { + font-size: 1.6em; +} + +h3 { + font-size: 1.3em; +} + +h4 { + font-size: 1.1em; + font-weight: bold; +} + +em { + font-style: italic; +} + +strong { + font-weight: bold; +} + +a { + color: #ba0000; + text-decoration: none; +} + +a:hover { + color: #e34400; +} + +table#files a:hover, table#subdirs a:hover, table#pages a:hover { + color: #a00000; +} + +a[href^="http:"] { + text-decoration: underline; +} + +p#footer a { + text-decoration: none; +} + +p code, ul code, ol code, dl code, blockquote code, tbody code, thead code { + font-size: 8pt; +} + +pre, code, tt, table#subdirs tr td.name, table#files tr td.name, table tr td.size { + font-family: "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Menlo, Inconsolata, Consolas, Monaco, "Courier New", Courier; +} + +table#subdirs code, table#files code { + font-size: 10pt; +} + +table.codehilitetable div.linenodiv { + color: #777; +} + +blockquote { + color: #222; + font-style: italic; +} + +pre { + overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */ + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + /* width: 99%; */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + +table thead th { + font-weight: bold; +} + +.list-crumb { + color: #777; + font-variant: italic; +} \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/media/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/index.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,74 @@ + + + + + + + + hg-prompt » ls /media + + + + + + + + + +
+ + + + + + +

ls /media

+ + +

Directories

+ + + + + + + +
+ + css/ + +
+ + + + + + + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/media/list.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/media/list.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,74 @@ + + + + + + + + hg-prompt » ls /media + + + + + + + + + +
+ + + + + + +

ls /media

+ + +

Directories

+ + + + + + + +
+ + css/ + +
+ + + + + + + + + +
+ + \ No newline at end of file diff -r 000000000000 -r b698f1159c04 hg-prompt/quickstart.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hg-prompt/quickstart.html Wed Nov 18 20:48:00 2009 -0500 @@ -0,0 +1,87 @@ + + + + + + + + hg-prompt » Quick Start + + + + + + + + + +
+ + + + + + +

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 it, do that now.

+

A Simple (But Useful) Prompt

+

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

+
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:

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

An Advanced Prompt

+

How about something a little more interesting?

+
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):

+
[+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.

+ + + + +
+ + \ No newline at end of file