# HG changeset patch # User Steve Losh # Date 1245463761 14400 # Node ID 64e12f95da2e62fde52a6b6a3d5b98db28b3ab94 # Parent c4ce712862c3cb52d0cd14d9be27878686911168 Added more to the README. diff -r c4ce712862c3 -r 64e12f95da2e README --- a/README Fri Jun 19 21:57:19 2009 -0400 +++ b/README Fri Jun 19 22:09:21 2009 -0400 @@ -55,6 +55,31 @@ * bookmark: the current bookmark * branch: the current branch * status: - * `!` if the repository has any changed, added, removed or deleted files, otherwise - * `?` if the repository has any untracked (but not ignored) files, otherwise - * nothing \ No newline at end of file + * `!` if the repository has any changed, added, removed or deleted files, otherwise + * `?` if the repository has any untracked (but not ignored) files, otherwise + * nothing + +Putting it in a Bash Prompt +--------------------------- + +To put it in your bash 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) $ ' + +Putting the call in a separate function helps keep things readable if you start adding color codes: + + D=$'\e[37;40m' + MAGENTA=$'\e[35;40m' + GREEN=$'\e[32;40m' + YELLOW=$'\e[33;40m' + + hg_ps1() { + hg prompt "{${D} on ${MAGENTA}{branch}}{${D} at ${YELLOW}{bookmark}}{${GREEN}{status}}" 2> /dev/null + } + + export PS1='\n${MAGENTA}\u ${D}at ${YELLOW}\h ${D}in ${GREEN}\w$(hg_ps1)\ + ${D}\n$ ' \ No newline at end of file