aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2012-06-08 13:35:22 +1200
committerTom Ryder <tom@sanctum.geek.nz>2012-06-08 13:35:22 +1200
commit1f5ed184adae7803d77d6c2cf89926e9898fe558 (patch)
treecc22211ee36e645d6a0810a5a631b9e0e8f4b56a /bash
parentRepository detection for prompt (diff)
downloaddotfiles-1f5ed184adae7803d77d6c2cf89926e9898fe558.tar.gz
dotfiles-1f5ed184adae7803d77d6c2cf89926e9898fe558.zip
Forgot Mercurial
Diffstat (limited to 'bash')
-rw-r--r--bash/bashrc13
1 files changed, 11 insertions, 2 deletions
diff --git a/bash/bashrc b/bash/bashrc
index e94eec38..32666088 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -89,7 +89,7 @@ fi
function prompt_git {
BRANCH="$(git symbolic-ref HEAD 2>/dev/null)"
if [[ -n "$BRANCH" ]]; then
- CHANGES=$(git status 2>/dev/null | grep '# \(Untracked\|Changes\|Changed but not updated:\)')
+ CHANGES=$(git status 2>/dev/null | grep '# \(Untracked\|Changes\|Changed but not updated\)')
if [[ -n "$CHANGES" ]]; then
STATUS="!"
fi
@@ -97,7 +97,16 @@ function prompt_git {
fi
}
+# Function to display branch of a Mercurial repository.
+function prompt_hg {
+ BRANCH="$(hg branch 2>/dev/null)"
+ if [[ -n "$BRANCH" ]]; then
+ echo -n "(hg:${BRANCH})"
+ fi
+}
+
# Function to display branch of an SVN working copy.
+
function prompt_svn {
URL="$(svn info 2>/dev/null | awk -F': ' '$1 == "URL" {print $2}')"
if [[ -n "$URL" ]]; then
@@ -111,7 +120,7 @@ function prompt_svn {
}
# Uncolored bits of my prompt, we'll color them if appropriate shortly.
-PS1='[\u@\h:\w]$(prompt_git)$(prompt_svn)\$'
+PS1='[\u@\h:\w]$(prompt_git)$(prompt_hg)$(prompt_svn)\$'
# Save some color codes based on our colour space.
if [[ $COLORS -ge 256 ]]; then