summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2012-02-10 12:42:38 +0100
committerHugues Hiegel <hugues.hiegel@qosmos.com>2012-02-10 12:42:38 +0100
commit235d67525198556878d2a12fce494ca2a6022e66 (patch)
tree3fcb1188c72e1e00b36238c52c0cefa652d2d22e
parent1851f6ff2e38145d831c050fcb4726f8758bd3ee (diff)
[Colors] updated CVS/SVN/GIT to GCL colors, with new 'merging' status
-rw-r--r--01_Internal.zsh47
-rw-r--r--11_Colors.zsh21
-rw-r--r--12_Prompts.zsh6
3 files changed, 38 insertions, 36 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh
index 8e4991a..78832c3 100644
--- a/01_Internal.zsh
+++ b/01_Internal.zsh
@@ -237,20 +237,23 @@ __get_guilt_series ()
# a call to `__get_git_branch`
__get_git_status ()
{
- local my_git_status cached not_up_to_date managment_folder
+ local my_git_status cached changed managment_folder
if [ ! -z "$DO_NOT_CHECK_GIT_STATUS" ]
- then return
+ then
+ return
fi
+ my_git_status=$_gcl_colors[uptodate];
+
if [ -f ".repo/manifests.git/config" ]
then
- echo "$_git_colors[up_to_date]";
+ echo $my_git_status
return
fi
if [ "$(git rev-parse --is-inside-git-dir)" = "true" -o "$(git config --get core.bare)" = "true" ] ; then
- echo "$_git_colors[managment_folder]"
+ echo "$_gcl_colors[gitdir]"
return
fi
@@ -258,32 +261,34 @@ __get_git_status ()
cached="yes"
fi
if [ "$(git ls-files -m 2>&- | head -n1)" != "" ] ; then
- not_up_to_date="yes"
+ changed="yes"
fi
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
- if [ "$cached" != "" -a "$not_up_to_date" != "" ] ; then
- my_git_status="$_git_colors[cached_and_not_up_to_date]"
- elif [ "$cached" != "" ] ; then
- my_git_status="$_git_colors[cached]"
- elif [ "$not_up_to_date" != "" ] ; then
- my_git_status="$_git_colors[not_up_to_date]"
- elif [ "$(git cat-file -t HEAD 2>/dev/null)" != "commit" ] ; then
+ if [ "$cached" != "" -a "$changed" != "" ]
+ then
+ my_git_status="$_gcl_colors[mixed]"
+ elif [ "$cached" != "" ]
+ then
+ my_git_status="$_gcl_colors[cached]"
+ elif [ "$changed" != "" ]
+ then
+ my_git_status="$_gcl_colors[changed]"
+ elif [ "$(git cat-file -t HEAD 2>/dev/null)" != "commit" ]
+ then
if [ ! -z "$(git ls-files)" ] ; then
- my_git_status="$_git_colors[cached]"
+ my_git_status="$_gcl_colors[cached]"
else
- my_git_status="$_git_colors[init_in_progress]"
- fi
- else
- if [ -f $GIT_DIR/MERGE_HEAD ]
- then
- my_git_status="$_git_colors[cached]"
- else
- my_git_status="$_git_colors[up_to_date]"
+ my_git_status="$_gcl_colors[init]"
fi
fi
+ if [ $(git ls-files --unmerged | wc -l) -gt 0 ]
+ then
+ my_git_status="${_gcl_colors[merging]:+$_gcl_colors[merging];}$my_git_status"
+ fi
+
echo $my_git_status
}
diff --git a/11_Colors.zsh b/11_Colors.zsh
index 8afc82b..379a708 100644
--- a/11_Colors.zsh
+++ b/11_Colors.zsh
@@ -8,7 +8,7 @@
## these files with or without this notice.
##
-typeset -A _prompt_colors _git_colors _mail_colors _correct_colors _battery_colors _date_colors _agent_colors _guilt_colors
+typeset -A _prompt_colors _gcl_colors _mail_colors _correct_colors _battery_colors _date_colors _agent_colors _guilt_colors
_correct_colors[error]="$color[red];$color[bold]"
_correct_colors[suggest]="$color[blue];$color[bold]"
@@ -64,18 +64,15 @@ set_prompt_colors ()
_agent_colors[has_keys]="$color[bold];$color[yellow]"
_agent_colors[has_remote_keys]="$_prompt_colors[bold_generic]"
- _prompt_colors[up_to_date]="$_prompt_colors[generic]" # up-to-date
- _prompt_colors[not_up_to_date]="$color[green];$color[bold]" # not up to date
- _prompt_colors[to_be_commited]="$color[yellow];$color[bold]" # changes in cache
+ _gcl_colors[init]="$color[black];$color[bold]"
+ _gcl_colors[gitdir]="$color[red];$color[bold]"
+ _gcl_colors[uptodate]="$_prompt_colors[generic]"
+ _gcl_colors[cached]="$color[yellow];$color[bold]"
+ _gcl_colors[mixed]="$color[green];$color[bold]"
+ _gcl_colors[changed]="$color[green]"
+ _gcl_colors[merging]="$color[bg-black]"
- _git_colors[managment_folder]="$color[red];$color[bold]" # .git/... folder browsing
- _git_colors[cached]="$_prompt_colors[to_be_commited]" # git changes in cache
- _git_colors[cached_and_not_up_to_date]="$_prompt_colors[not_up_to_date];$color[bold]"
- _git_colors[not_up_to_date]="$_prompt_colors[not_up_to_date];$color[normal]" # git changes in working tree
- _git_colors[init_in_progress]="$color[black];$color[bold]" # initialization
- _git_colors[up_to_date]="$_prompt_colors[up_to_date];$color[normal]" # git up-to-date
-
- _guilt_colors[applied]=$_git_colors[cached]
+ _guilt_colors[applied]=$_gcl_colors[cached]
_guilt_colors[unapplied]=$color[black]
}
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 50575fa..e3087f4 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -251,7 +251,7 @@ __update_prompt_elements()
if [ -d CVS ]
then
CVSTAG=$(test -e CVS/Tag && cat CVS/Tag || basename $(cat CVS/Root 2>&- || echo "HEAD") )
- CVSTAG=${CVSTAG:+ $C_$_prompt_colors[up_to_date]$_C$CVSTAG}
+ CVSTAG=${CVSTAG:+ $C_$_gcl_colors[uptodate]$_C$CVSTAG}
fi
# get svn status
@@ -264,7 +264,7 @@ __update_prompt_elements()
if [ ! -z "$CHECK_SVN_STATUS" ]
then
SVNSTATUS="$(svn diff 2>&-)"
- SVNSTATUS=${${SVNSTATUS:+$_prompt_colors[not_up_to_date]}:-$_prompt_colors[up_to_date]}
+ SVNSTATUS=${${SVNSTATUS:+$_gcl_colors[changed]}:-$_gcl_colors[uptodate]}
fi
fi
SVNREV=${SVNREV:+$C_$_prompt_colors[doubledot]$_C $C_$SVNSTATUS$_C"r"$SVNREV}
@@ -328,7 +328,7 @@ __update_prompt_elements()
# then we reduce the path until it reaches the last path element,
spaceleft=$(($spaceleft - $GITBRANCHSIZE))
[ $spaceleft -lt $minimalpathsize ] && spaceleft=$minimalpathsize
- GITBRANCH=${GITBRANCH:+ $C_"$(__get_git_status)"$_C$GITBRANCH}"$(__get_guilt_series)"
+ GITBRANCH=${GITBRANCH:+ $C_"$(__get_git_status)"$_C$GITBRANCH}"$(__get_guilt_series)$C_$color[none]$_C"
CURDIR="$C_$_prompt_colors[path]$_C%`echo $spaceleft`<..<"$MY_PATH"%<<$C_$color[none]$_C"
[ "$DEBUG" = "yes" ] && echo
}