Fossil support: more cleanup

This commit is contained in:
Olivier Mengué 2014-02-14 18:28:54 +01:00
parent 9f0c0e6d47
commit f48f56ab30

View File

@ -952,31 +952,29 @@ _lp_fossil_branch_color()
branch="$(_lp_fossil_branch)" branch="$(_lp_fossil_branch)"
if [ -n "$branch" ]; then if [ -n "$branch" ]; then
local C2E # Modified files (added or edited) local -i C2E # Modified files (added or edited)
local C2A # Extras files local C2A # Extras files
local ret local ret
C2E=$(fossil changes | wc -l) C2E=$(fossil changes | wc -l)
C2A=$(fossil extras | wc -l) C2A=$(fossil extras | wc -l)
ret=$(fossil diff -v | awk "/^(+[^+])|(+$)/ { plus+=1; } /^(-[^-])|(-$)/ { minus+=1; } END { total=\"\"; if(plus>0){ total=\"+\"plus; if(minus>0) total=total\"/\"; } if(minus>0) total=total\"-\"minus; print total;}") ret=$(fossil diff -v | awk "/^(+[^+])|(+$)/ { plus+=1; } /^(-[^-])|(-$)/ { minus+=1; } END { total=\"\"; if(plus>0){ total=\"+\"plus; if(minus>0) total=total\"/\"; } if(minus>0) total=total\"-\"minus; print total;}")
if [ "$C2E" -gt 0 ]; then if (( C2E > 0 )); then
if [ -n "$ret" ]; then [[ -n "$ret" ]] && ret+=" in "
ret+=" in "
fi
ret="(${LP_COLOR_DIFF}${ret}${C2E}${NO_COL})" ret="(${LP_COLOR_DIFF}${ret}${C2E}${NO_COL})"
fi fi
if [ "$C2A" -gt 0 ]; then if (( $C2A > 0 )); then
C2A="$LP_COLOR_CHANGES$LP_MARK_UNTRACKED" C2A="$LP_COLOR_CHANGES$LP_MARK_UNTRACKED"
else else
C2A="" C2A=""
fi fi
if [ "$branch" = "no-tag" ]; then if [[ "$branch" = "no-tag" ]]; then
# Warning, your branch has no tag name ! # Warning, your branch has no tag name !
branch="${LP_COLOR_COMMITS}$branch${NO_COL}$ret${LP_COLOR_COMMITS}$C2A${NO_COL}" branch="${LP_COLOR_COMMITS}$branch${NO_COL}$ret${LP_COLOR_COMMITS}$C2A${NO_COL}"
else else
if [ "$C2E" -eq 0 ]; then if (( C2E == 0 )); then
# All is up-to-date # All is up-to-date
branch="${LP_COLOR_UP}$branch$C2A${NO_COL}" branch="${LP_COLOR_UP}$branch$C2A${NO_COL}"
else else