From 8e9cf45200391db787b3a25ae00f4352d7a11e8e Mon Sep 17 00:00:00 2001
From: Yohann Bianchi <sbooob@gmail.com>
Date: Sat, 19 Jan 2013 00:52:09 +0100
Subject: ADDED: Mercurial repository info

---
 themes/agnoster.zsh-theme | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index c3107c06c..7ce5a77f8 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -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
 }
 
-- 
cgit v1.2.3-70-g09d2


From 28b737416fe1eadd1a0e0bad460941651ac20e49 Mon Sep 17 00:00:00 2001
From: Yohann Bianchi <sbooob@gmail.com>
Date: Sun, 20 Jan 2013 13:10:31 +0100
Subject: ADDED: Mercurial prompt info support even if hg prompt extension is
 unavailable

---
 themes/agnoster.zsh-theme | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 7ce5a77f8..e2074b713 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -87,18 +87,35 @@ 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
+			st=$(hg prompt {status})
+			if [[ $st = "?" ]]; then
+				# if files are not added
 				prompt_segment red white
-				rev='±'
-			elif [[ -n $rev ]]; then
+				st='±'
+			elif [[ -n $st ]]; then
+				# if any modification
 				prompt_segment yellow black
-				rev='±'
+				st='±'
 			else
+				# if working copy is clean
 				prompt_segment green black
 			fi
+			echo -n $(hg prompt "⭠ {rev}@{branch}") $st
+		else
+			st=""
+			rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
+			branch=$(hg id -b 2>/dev/null)
+			if `hg st | grep -Eq "^\?"`; then
+				prompt_segment red black
+				st='±'
+			elif `hg st | grep -Eq "^(M|A)"`; then
+				prompt_segment yellow black
+				st='±'
+			else
+				prompt_segment green black
+			fi
+			echo -n "⭠ $rev@$branch" $st
 		fi
-		echo -n $(hg prompt "⭠ {rev}@{branch}") $rev
 	fi
 }
 
-- 
cgit v1.2.3-70-g09d2


From 5128669a76a744883ad51df7682577e6654418e1 Mon Sep 17 00:00:00 2001
From: Yohann Bianchi <sbooob@gmail.com>
Date: Tue, 26 Mar 2013 09:57:11 +0100
Subject: IMPROVED: untracked file status has priority over modified (ie: if
 you have both modified and untracked files, your prompt will be red
 indicating the presence of untracked files)

---
 themes/agnoster.zsh-theme | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index e2074b713..75e095776 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -87,12 +87,11 @@ prompt_hg() {
 	local rev status
 	if $(hg id >/dev/null 2>&1); then
 		if $(hg prompt >/dev/null 2>&1); then
-			st=$(hg prompt {status})
-			if [[ $st = "?" ]]; then
+			if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
 				# if files are not added
 				prompt_segment red white
 				st='±'
-			elif [[ -n $st ]]; then
+			elif [[ -n $(hg prompt "{status|modified}") ]]; then
 				# if any modification
 				prompt_segment yellow black
 				st='±'
-- 
cgit v1.2.3-70-g09d2