Permalink
Browse files

ADDED: Mercurial repository info

  • Loading branch information...
1 parent 615e41b commit 8e9cf45200391db787b3a25ae00f4352d7a11e8e @nstCactus committed Jan 18, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 themes/agnoster.zsh-theme
View
@@ -83,6 +83,25 @@ prompt_git() {
fi
}
+prompt_hg() {
+ local rev status
+ if $(hg id >/dev/null 2>&1); then
+ if $(hg prompt >/dev/null 2>&1); then
+ rev=$(hg prompt {status})
+ if [[ $rev = "?" ]]; then
+ prompt_segment red white
+ rev='±'
+ elif [[ -n $rev ]]; then
+ prompt_segment yellow black
+ rev='±'
+ else
+ prompt_segment green black
+ fi
+ fi
+ echo -n $(hg prompt "⭠ {rev}@{branch}") $rev
+ fi
+}
+
# Dir: current working directory
prompt_dir() {
prompt_segment blue black '%~'
@@ -109,6 +128,7 @@ build_prompt() {
prompt_context
prompt_dir
prompt_git
+ prompt_hg
prompt_end
}

2 comments on commit 8e9cf45

Thank you. I've previously tried and failed to get this working.

Owner

nstCactus replied Jan 27, 2013

You're welcome. Glad it helped someone.
If you need to make it work without the prompt extension, see my next commit.

Please sign in to comment.