From: Valentin Samir Date: Mon, 22 Jul 2013 14:14:27 +0000 (+0200) Subject: Extanded get_vcs_info, their are other vcs than git and darcs X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=7f7c09cf5e7e965ff981cae4137e7d27ed522ce5;p=config-20-100.git Extanded get_vcs_info, their are other vcs than git and darcs --- diff --git a/.bashrc b/.bashrc index 9017ff4..a7ecdda 100644 --- a/.bashrc +++ b/.bashrc @@ -47,26 +47,33 @@ fi #~# get_vcs_info () { #~# # Donne les infos sur le dépôt VCS courant. #~# # priorité à git, puis darcs -#~# local BRANCH TYPE violet orange vert +#~# local LBRANCH LTYPE BRANCH TYPE violet orange vert #~# violet="\[\e[35m\]" #~# orange="\[\e[33m\]" #~# vert="\[\e[32m\]" #~# nocolor="\[\e[0m\]" -#~# BRANCH=$(git branch 2>/dev/null | sed -r "s/^[^*].*$//" | paste -s -d '' | sed -r "s/^[*] //") -#~# if [ -n "$BRANCH" ]; -#~# then -#~# TYPE="git" -#~# else -#~# BRANCH=$(darcs show repo 2>/dev/null| egrep '^ *Cache' | sed 's@.*/\([^/]*\),.*@\1@') -#~# if [ -n "$BRANCH" ]; -#~# then -#~# TYPE="darcs" +#~# declare -a TYPE +#~# declare -a BRANCH +#~# TYPE[0]="git" +#~# TYPE[1]="mercurial" +#~# TYPE[2]="darcs" +#~# TYPE[3]="svn" +#~# BRANCH[0]='git branch 2>/dev/null | sed -r "s/^[^*].*$//" | paste -s -d "" | sed -r "s/^[*] //"' +#~# BRANCH[1]='hg branch 2>/dev/null' +#~# BRANCH[2]="darcs show repo 2>/dev/null| egrep '^ *Cache' | sed 's@.*/\([^/]*\),.*@\1@'" +#~# BRANCH[3]="svn info 2>/dev/null | head -n 6 | tail -n 1" +#~# for i in $(seq 0 $((${#BRANCH[*]}-1))); do +#~# LBRANCH=$(eval "${BRANCH[$i]}") +#~# if [ -n "$LBRANCH" ]; then +#~# LTYPE="${TYPE[$i]}" +#~# break #~# fi -#~# fi -#~# if [ -n "$TYPE" ]; +#~# done +#~# if [ -n "$LTYPE" ]; #~# then -#~# VCS_info="${nocolor}${violet}(${nocolor}$TYPE${violet})-${violet}[${vert}$BRANCH${violet}]${nocolor}" -#~# VCS_size=$((${#TYPE}+${#BRANCH}+5)) +#~# echo $LTYPE +#~# VCS_info="${nocolor}${violet}(${nocolor}$LTYPE${violet})-${violet}[${vert}$LBRANCH${violet}]${nocolor}" +#~# VCS_size=$((${#LTYPE}+${#LBRANCH}+5)) #~# else #~# VCS_info="" #~# VCS_size=0