Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up bazaar by simulating bzr root with bash #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions bash/bash_vcs.sh
Expand Up @@ -84,7 +84,15 @@ __prompt_command() {
}

bzr_dir() {
base_dir=$(bzr root 2>/dev/null) || return 1
# bzr root is really slow, so we simulate it
# with a bash script I modified frome here:
# http://unix.stackexchange.com/questions/6463/find-searching-in-parent-directories-instead-of-subdirectories
bzr_root=$(pwd -P 2>/dev/null || command pwd)
while [ ! -e "$bzr_root/.bzr" ]; do
bzr_root=${bzr_root%/*}
if [ "$bzr_root" = "" ]; then break; fi
done
base_dir=$bzr_root || return 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line doesn't quite work yet. I haven't had time to fix it.
At the moment, this is a regression, because it shows (bzr) even when you are not a a bzr directory.

This is because $bzr_root can never return a non zero exit status, because it is not a function.

I don't know quite enough bash to fix this, and don't have time to learn at the moment.

if [ -n "$base_dir" ]; then
base_dir=`cd $base_dir; pwd`
else
Expand Down Expand Up @@ -139,4 +147,4 @@ if [ -z "$TM_SUPPORT_PATH"]; then
trap 'echo -e "\e]1;$project>$BASH_COMMAND<\007\c"' DEBUG # show currently executing command in tab title
;;
esac
fi
fi