diff options
Diffstat (limited to 'prompt')
-rwxr-xr-x | prompt | 50 |
1 files changed, 47 insertions, 3 deletions
@@ -242,6 +242,43 @@ PROMPT_COMMAND=' # LOCALS # SVN # ... + + if [[ -d .svn ]]; then + + ### get rev + eval ` + svn info | + sed -n " + s@^URL[^/]*//@repo_dir=@p + s/^Revision: /rev=/p + " + ` + ### get status + + eval `svn -q status 2>/dev/null | + sed -n " + s/^A /modified=modified; git_modified_files+=\" \"/p + s/^M /modified=modified; git_modified_files+=\" \"/p + " + ` + + ### sort statuses, choose primary (for branch color) + status=${op+op} + status=${status:-$detached} + status=${status:-$clean} + status=${status:-$modified} + status=${status:-$added} + status=${status:-$untracked} + # at least one should be set + : ${status?prompt internal error: git status} + eval git_color="\${git_$status}" + git_color=${git_color:-$WHITE} # default + + ### compose + tail_local="($git_status$rev)" + tail_local="${tail_local+$git_color $tail_local}${dir_color}" + fi + # make # ... @@ -315,12 +352,19 @@ PROMPT_COMMAND=' ### branch - #head_tail=`echo $head | sed 's/[^^~]*//'` # we cut head to leave only ^~, and reattach to branch name branch=${branch/master/M} grep -q "^ref:" $git_dir/HEAD 2>/dev/null || detached=detached [[ -n "$detached" ]] && branch="<detached:`git-name-rev --name-only HEAD 2>/dev/null`>" + if [[ "$op" == "merge" ]] ; then + branch="$op: $branch <~ $(git-name-rev --name-only $(<$git_dir/MERGE_HEAD))" + + elif [[ -n "$op" ]]; then + branch="<$op:$branch>" + + fi + head_rev=`git-rev-parse HEAD 2>/dev/null` head_rev=${head_rev/HEAD/} head_rev=${head_rev:0:6} @@ -336,7 +380,7 @@ PROMPT_COMMAND=' # at least one should be set : ${status?prompt internal error: git status} eval git_color="\${git_$status}" - git_color=${git_color:-$WHITE} + git_color=${git_color:-$WHITE} # default ### compose local label @@ -345,7 +389,7 @@ PROMPT_COMMAND=' file_list+="${git_modified_files+$git_modified$git_modified_files}" file_list+="${git_untracked_files+$git_untracked$git_untracked_files}" [[ $file_list ]] && file_list=":${file_list}" # ${+ does not works (?) - tail_local="(${branch} $white$head_rev$git_color${op+ / $op}$git_color${file_list}$git_color)" + tail_local="(${branch} $white$head_rev$git_color$git_color${file_list}$git_color)" ### fringes (added depended on location) head_local="${head_local+$git_color $head_local\n}" |