summaryrefslogtreecommitdiff
path: root/themes/agnoster.zsh-theme
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-02-27 14:43:29 -0800
committerTuowen Zhao <ztuowen@gmail.com>2020-02-27 14:43:29 -0800
commit0b67340fd2fe9330d8487491e1983ad1a111fb2b (patch)
treefe9cdff80e98deced5c63e79110593d430802adb /themes/agnoster.zsh-theme
parent93a2003db7738e2255a4589ef2073df1be34fe02 (diff)
parent2b499e1a9e8788d607768ecef67851e8234b72b3 (diff)
downloadzsh-0b67340fd2fe9330d8487491e1983ad1a111fb2b.tar.gz
zsh-0b67340fd2fe9330d8487491e1983ad1a111fb2b.tar.bz2
zsh-0b67340fd2fe9330d8487491e1983ad1a111fb2b.zip
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'themes/agnoster.zsh-theme')
-rw-r--r--themes/agnoster.zsh-theme40
1 files changed, 23 insertions, 17 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 05a50cd2b..89b75aa55 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -140,24 +140,30 @@ prompt_git() {
}
prompt_bzr() {
- (( $+commands[bzr] )) || return
- if (bzr status >/dev/null 2>&1); then
- status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
- status_all=`bzr status | head -n1 | wc -m`
- revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
- if [[ $status_mod -gt 0 ]] ; then
- prompt_segment yellow black
- echo -n "bzr@"$revision "✚ "
- else
- if [[ $status_all -gt 0 ]] ; then
- prompt_segment yellow black
- echo -n "bzr@"$revision
- else
- prompt_segment green black
- echo -n "bzr@"$revision
- fi
- fi
+ (( $+commands[bzr] )) || return
+
+ # Test if bzr repository in directory hierarchy
+ local dir="$PWD"
+ while [[ ! -d "$dir/.bzr" ]]; do
+ [[ "$dir" = "/" ]] && return
+ dir="${dir:h}"
+ done
+
+ local bzr_status status_mod status_all revision
+ if bzr_status=$(bzr status 2>&1); then
+ status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
+ status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
+ revision=$(bzr log -r-1 --log-format line | cut -d: -f1)
+ if [[ $status_mod -gt 0 ]] ; then
+ prompt_segment yellow black "bzr@$revision ✚"
+ else
+ if [[ $status_all -gt 0 ]] ; then
+ prompt_segment yellow black "bzr@$revision"
+ else
+ prompt_segment green black "bzr@$revision"
+ fi
fi
+ fi
}
prompt_hg() {