]> git.donarmstrong.com Git - zsh.git/commitdiff
Add bzr support
authormartin f. krafft <madduck@madduck.net>
Tue, 6 May 2008 22:58:56 +0000 (23:58 +0100)
committermartin f. krafft <madduck@madduck.net>
Tue, 6 May 2008 22:58:56 +0000 (23:58 +0100)
.zsh/zshrc/85_vcs_prompt

index b608a6c7f806497bea37f9de897bbbde3f019bdf..267b1788cdb73d88a2d62112dd0c33f4c071f2da 100644 (file)
@@ -41,6 +41,28 @@ __hg_get_branch()
   echo "hg:$(hg branch)"
 }
 
+__bzr_get_reporoot()
+{
+  local reporoot
+  reporoot="$(bzr info | sed -rne 's, *branch root: ,,p')"
+  case "$reporoot" in
+    .) echo "$PWD";;
+    *) echo "$reporoot";;
+  esac
+}
+
+__bzr_get_branch()
+{
+  local branch revno
+  bzr version-info | while read i j; do
+      case "$i" in
+        revno:) revno="$j";;
+        branch-nick:) branch="$j";;
+      esac
+    done
+  echo "${branch}@$revno"
+}
+
 __vcs_get_repo_type()
 {
   # return the type of the closest repository in the path hierarchy
@@ -131,6 +153,12 @@ __vcs_set_prompt_variables()
       branch="$(__hg_get_branch)" ||
         { error "could not determine hg branch"; return 1 }
       ;;
+    bzr)
+      reporoot="$(__bzr_get_reporoot)" ||
+        { error "could not determine bzr repository root"; return 1 }
+      branch="$(__bzr_get_branch)" ||
+        { error "could not determine bzr branch"; return 1 }
+      ;;
     *)
       case "$repotype" in
         NONE) :;;