# HG changeset patch # User Steve Losh # Date 1595173019 14400 # Node ID 25b0cf6b43f5caa10c2db1acd668119655bca3ee # Parent e2d60e4e3caf5c158dcbe7f3ed63e2871b3ea5bd Port documentation to d diff -r e2d60e4e3caf -r 25b0cf6b43f5 .hgignore --- a/.hgignore Tue May 26 14:57:58 2020 +0200 +++ b/.hgignore Sun Jul 19 11:36:59 2020 -0400 @@ -3,6 +3,5 @@ .DS_Store *.pyc .idea/ -docs/.html -docs/.tmp +docs/build diff -r e2d60e4e3caf -r 25b0cf6b43f5 Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,15 @@ +.PHONY: docs pubdocs + +docfiles = $(shell ls docs/*.markdown) + +# Documentation --------------------------------------------------------------- +docs/build/index.html: $(docfiles) docs/title + cd docs && ~/.virtualenvs/d/bin/d + +docs: docs/build/index.html + +pubdocs: docs + hg -R ~/src/docs.stevelosh.com pull -u + rsync --delete -a ./docs/build/ ~/src/docs.stevelosh.com/hg-prompt + hg -R ~/src/docs.stevelosh.com commit -Am 'hg-prompt: Update site.' + hg -R ~/src/docs.stevelosh.com push diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/.venv --- a/docs/.venv Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -markdoc diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/01-installation.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/01-installation.markdown Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,25 @@ +Installation +============ + +Installing `hg-prompt` requires [Python][] 2.5+ and (obviously) Mercurial. + +[Python]: http://python.org/ + +First, clone the repository: + + $ hg clone http://bitbucket.org/sjl/hg-prompt/ + +Edit the `[extensions]` section in your `~/.hgrc` file: + + [extensions] + prompt = (path to)/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. + +[Quick Start]: ../quickstart/ diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/02-quickstart.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/02-quickstart.markdown Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,54 @@ +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/ + +[TOC] + +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. + +[full documentation]: ../full-documentation/ diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/03-full-documentation.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/03-full-documentation.markdown Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,249 @@ +Documentation +============= + +This page contains the full documentation for `hg-prompt`. + +[TOC] + +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 + +You can give the `--angle-brackets` option to use angle brackets for keywords +instead of curly brackets. This can come in handy when combining a simple +prompt string with more complicated shell functionality (like color +variables): + + $ hg prompt "{currently on {branch}}" + currently on default + + $ hg prompt --angle-brackets ">" + currently on default + +Keywords +-------- + +There a number of keywords available. 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. + +* `|quiet`: Display the current branch only if it is not the default branch. + +### `closed` + +Display `X` if working on a closed branch (i.e. if committing now would reopen +the branch). + +### `count` + +Display the number of revisions in the given revset (the revset `all()` will be +used if none is given). + +See `hg help revsets` for more information. + +* `|REVSET`: The revset to count. + +### `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. +* `|quiet`: Display a number only if there are any patches in the queue. + +### `patches` + +Display a list of the current patches in the queue. It will look like this: + + $ hg prompt '{patches}' + bottom-patch -> middle-patch -> top-patch + +* `|reverse`: Display the patches in reverse order (i.e. topmost first). +* `|hide_applied`: Do not display applied patches. +* `|hide_unapplied`: Do not display unapplied patches. +* `|join(SEP)`: Display `SEP` between each patch, instead of the default ` -> `. +* `|pre_applied(STRING)`: Display `STRING` immediately before each applied patch. Useful for adding color codes. +* `|post_applied(STRING)`: Display `STRING` immediately after each applied patch. Useful for resetting color codes. +* `|pre_unapplied(STRING)`: Display `STRING` immediately before each unapplied patch. Useful for adding color codes. +* `|post_unapplied(STRING)`: Display `STRING` immediately after each unapplied patch. Useful for resetting color codes. + +### `queue` + +Display the name of the current MQ 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. + +* `|quiet`: Display the tags of the current parent, excluding the tag `tip`. +* `|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 + +Sample Prompts +-------------- + +`hg-prompt` supports many keywords, but you probably don't want to use them all +at once. Which keywords you'll find useful depends on the workflow(s) you +commonly use. + +Here are some example prompts to get you started. + +### A Basic Prompt + +A very simple prompt could tell you: + +* Which named branch you're currently working on. +* If there are any uncommitted changes in the working directory. +* If you're at a revision that's not a branch tip (i.e. if running `hg update` + would do something). + +To get a prompt like this you could add this to your `~/.bashrc` file: + + export PS1='\u in \w`hg prompt "{on {branch}}{status}{update}" 2>/dev/null` $' + +The result would look something like this: + + username in ~/src $ cd project + username in ~/src/project on feature-branch $ touch sample + username in ~/src/project on feature-branch? $ hg add sample + username in ~/src/project on feature-branch! $ hg commit -m 'Add a file.' + username in ~/src/project on feature-branch $ hg update default + username in ~/src/project on default $ hg update 0 + username in ~/src/project on default^ $ + +The `2>/dev/null` part of the prompt command prevents errors from showing when +you're not currently in a Mercurial repository. + +The keywords (`{branch}`, `{status}` and `{update}`) display the relevant +information. + +The extra text in the `{branch}` keyword will only display if a branch exists, +so you won't see the word "on" if you're not in a repository. + +### A More Compact Basic Prompt + +Some people prefer a smaller, less obtrusive prompt. To get that kind of +prompt you can omit some of the less important text: + + export PS1='\w`hg prompt "[{branch}{status}{update}]" 2>/dev/null` $' + +That will give you something like this: + + ~/src $ cd project + ~/src/project[feature-branch] $ touch sample + ~/src/project[feature-branch?] $ hg add sample + ~/src/project[feature-branch!] $ hg commit -m 'Add a file.' + ~/src/project[feature-branch] $ hg update default + ~/src/project[default] $ hg update 0 + ~/src/project[default^] $ diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/footer.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/footer.markdown Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,6 @@ +Made by [Steve Losh][]. + +

Rochester Made

+ +[Steve Losh]: https://stevelosh.com/ +[roc]: https://rochestermade.com/ diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/index.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/index.markdown Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,8 @@ +`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. + +* **Documentation:** +* **Code:** + +![My bash prompt while using hg-prompt.](http://stevelosh.com/media/images/projects/hg-prompt/prompt.png "My bash prompt while using hg-prompt.") diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/markdoc.yaml --- a/docs/markdoc.yaml Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -wiki-name: "hg-prompt" - - -static-dir: "static" - -hide-prefix: "." -document-extensions: [.md, .mdown, .markdown] -generate-listing: always -listing-filename: "list.html" - -use-default-static: false - -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 e2d60e4e3caf -r 25b0cf6b43f5 docs/publish.sh --- a/docs/publish.sh Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -markdoc build -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 e2d60e4e3caf -r 25b0cf6b43f5 docs/static/media/css/layout.css --- a/docs/static/media/css/layout.css Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* @override http://localhost:8008/media/css/layout.css */ -body, html { - background-color: #226F89; - margin: 0; - padding: 0; -} - -div#breadcrumbs { - border-bottom: 4px dashed #265565; - border-right: 1px solid #265565; - padding: 0em 1.5em; - background-color: #fff; - width: 55em; - margin: 0em 0em 0em -1.5em; -} -div#breadcrumbs p { - margin: 0.5em auto; -} -div#content { - background-color: #fff; - height: 100%; - margin: 0 auto 3em; - overflow: hidden; - padding: 0em 1.5em 0em 1.5em; - width: 55em; - border-left: 1px solid #265565; - border-right: 1px solid #265565; -} - -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; -} -a { - color: #133C4C; -} -a:hover { - color: #F14800; -} - -p#footer { - background-color: #fff; - border-top: 4px dashed #265565; - width: 55em; - padding: 0.75em 1.5em; - text-align: center; - color: #666; - margin-left: -1.5em; - margin-bottom: 0em; -} - -ul { - padding-left: 1.5em; -} -ul li { - list-style-type: disc; - margin-left: 1.5em; - margin-top: 0.4em; -} - -div.toc ul { - padding: 0; -} -div.toc ul li { - list-style-type: none; - margin: 0; -} -div.toc > ul > li { - list-style-type: none; - margin: 0; -} -div.toc > ul ul { - margin: 0 3em; -} - -code { - background-color: #f6f6f6; - border: 1px solid #999; - padding: 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; -} - -img { - background-color: #f6f6f6; - border: 1px solid #999; - padding: 1em; - display: block; - margin: 0 auto; -} - -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; - display: block; - line-height: 1.5em; - margin-left: 1.5em; - margin-right: 1.5em; - 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 e2d60e4e3caf -r 25b0cf6b43f5 docs/static/media/css/pygments.css --- a/docs/static/media/css/pygments.css Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -.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 e2d60e4e3caf -r 25b0cf6b43f5 docs/static/media/css/reset.css --- a/docs/static/media/css/reset.css Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -/* -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 e2d60e4e3caf -r 25b0cf6b43f5 docs/static/media/css/typography.css --- a/docs/static/media/css/typography.css Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -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 { - font-weight: bold; - text-decoration: none; -} - -table#files a:hover, table#subdirs a:hover, table#pages a:hover { - color: #a00000; -} - -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: Monaco, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Menlo, Inconsolata, Consolas, "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 e2d60e4e3caf -r 25b0cf6b43f5 docs/title --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/title Sun Jul 19 11:36:59 2020 -0400 @@ -0,0 +1,1 @@ +hg-prompt diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/documentation/index.mdown --- a/docs/wiki/documentation/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -Documentation -============= - -##[Usage](/documentation/usage/)## - -How the `hg prompt` command can be used. - -##[Keywords](/documentation/keywords/)## - -Keywords available to use with the command. - -##[Sample Prompts](/documentation/samples/)## - -Some sample prompts to get you started. \ No newline at end of file diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/documentation/keywords/index.mdown --- a/docs/wiki/documentation/keywords/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +0,0 @@ -Keywords -======== - -There a number of keywords available. If you have any suggestions for more -please [let me know][issues]. - -[issues]: http://bitbucket.org/sjl/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. - - |quiet - : Display the current branch only if it is not the default branch. - -##closed## -: Display `X` if working on a closed branch (i.e. if committing now would - reopen the branch). - -##count## -: Display the number of revisions in the given revset (the revset `all()` - will be used if none is given). - - See `hg help revsets` for more information. - - |REVSET - : The revset to count. - -##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. - - |quiet - : Display a number only if there are any patches in the queue. - -##patches## -: Display a list of the current patches in the queue. It will look like - this: - - :::console - $ hg prompt '{patches}' - bottom-patch -> middle-patch -> top-patch - - |reverse - : Display the patches in reverse order (i.e. topmost first). - - |hide_applied - : Do not display applied patches. - - |hide_unapplied - : Do not display unapplied patches. - - |join(SEP) - : Display SEP between each patch, instead of the default ` -> `. - - |pre_applied(STRING) - : Display STRING immediately before each applied patch. Useful for - adding color codes. - - |post_applied(STRING) - : Display STRING immediately after each applied patch. Useful for - resetting color codes. - - |pre_unapplied(STRING) - : Display STRING immediately before each unapplied patch. Useful for - adding color codes. - - |post_unapplied(STRING) - : Display STRING immediately after each unapplied patch. Useful for - resetting color codes. - -##queue## -: Display the name of the current MQ 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. - - |quiet - Display the tags of the current parent, excluding the tag "tip". - - |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 diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/documentation/samples/index.mdown --- a/docs/wiki/documentation/samples/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -Sample Prompts -============== - -`hg-prompt` supports many keywords, but you probably don't want to use them -all at once. Which keywords you'll find useful depends on the workflow(s) you -commonly use. - -Here are some example prompts to get you started. - -A Basic Prompt --------------- - -A very simple prompt could tell you: - -* Which named branch you're currently working on. -* If there are any uncommitted changes in the working directory. -* If you're at a revision that's not a branch tip (i.e. if running `hg update` - would do something). - -To get a prompt like this you could add this to your `~/.bashrc` file: - - :::bash - export PS1='\u in \w`hg prompt "{on {branch}}{status}{update}" 2>/dev/null` $' - -The result would look something like this: - - :::text - username in ~/src $ cd project - username in ~/src/project on feature-branch $ touch sample - username in ~/src/project on feature-branch? $ hg add sample - username in ~/src/project on feature-branch! $ hg commit -m 'Add a file.' - username in ~/src/project on feature-branch $ hg update default - username in ~/src/project on default $ hg update 0 - username in ~/src/project on default^ $ - -The `2>/dev/null` part of the prompt command prevents errors from showing when -you're not currently in a Mercurial repository. - -The keywords (`{branch}`, `{status}` and `{update}`) display the relevant -information. - -The extra text in the `{branch}` keyword will only display if a branch exists, -so you won't see the word "on" if you're not in a repository. - -A More Compact Basic Prompt ---------------------------- - -Some people prefer a smaller, less obtrusive prompt. To get that kind of -prompt you can omit some of the less important text: - - :::bash - export PS1='\w`hg prompt "[{branch}{status}{update}]" 2>/dev/null` $' - -That will give you something like this: - - :::text - ~/src $ cd project - ~/src/project[feature-branch] $ touch sample - ~/src/project[feature-branch?] $ hg add sample - ~/src/project[feature-branch!] $ hg commit -m 'Add a file.' - ~/src/project[feature-branch] $ hg update default - ~/src/project[default] $ hg update 0 - ~/src/project[default^] $ diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/documentation/usage/index.mdown --- a/docs/wiki/documentation/usage/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -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 - -You can give the `--angle-brackets` option to use angle brackets for keywords -instead of curly brackets. This can come in handy when combining a simple -prompt string with more complicated shell functionality (like color -variables): - - :::console - $ hg prompt "{currently on {branch}}" - currently on default - - $ hg prompt --angle-brackets ">" - currently on default - -Take a look at the [keywords][] documentation to see all the keywords -`hg-prompt` supports. - -[keywords]: /documentation/keywords/ \ No newline at end of file diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/index.mdown --- a/docs/wiki/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -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][] ----------------------- - -[Code][] --------- - -[Installation]: /installation/ -[Quick Start]: /quickstart/ -[Full Documentation]: /documentation/ -[Code]: http://bitbucket.org/sjl - -Screenshot ----------- - -![My bash prompt while using hg-prompt.](http://stevelosh.com/media/images/projects/hg-prompt/prompt.png "My bash prompt while using hg-prompt.") diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/installation/index.mdown --- a/docs/wiki/installation/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -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)/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]: /quickstart/ \ No newline at end of file diff -r e2d60e4e3caf -r 25b0cf6b43f5 docs/wiki/quickstart/index.mdown --- a/docs/wiki/quickstart/index.mdown Tue May 26 14:57:58 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -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/ \ No newline at end of file