renommer UTOOLS en UTOOLS_AUTO et NOPUSH en UTOOLS_NOPUSH

bug avec git_commit qui ne tenait plus compte de UTOOLS_NOPUSH
This commit is contained in:
Jephté Clain 2014-02-25 05:34:54 +04:00
parent 9e8b262d6c
commit c877207f20
4 changed files with 33 additions and 32 deletions

View File

@ -14,7 +14,7 @@ if [ -n "$UTOOLS_BASH_PROMPT" ]; then
fi fi
GENERATE_PS1='function __genps1() { GENERATE_PS1='function __genps1() {
local cvs svn git uinst woinst suffix p="$PWD" local cvs svn git uinst woinst suffix p="$PWD"
if [ -n "$UTOOLS" ]; then if [ -n "$UTOOLS_AUTO" ]; then
PS1= PS1=
while [ "$p" != "$HOME" -a "$p" != "" ]; do while [ "$p" != "$HOME" -a "$p" != "" ]; do
if [ -z "$cvs" -a -d "$p/CVS" ]; then if [ -z "$cvs" -a -d "$p/CVS" ]; then
@ -22,7 +22,7 @@ if [ -n "$UTOOLS" ]; then
cvs=1 cvs=1
fi fi
if [ -z "$svn" -a -d "$p/.svn" ]; then if [ -z "$svn" -a -d "$p/.svn" ]; then
if [ "$UTOOLS" != "f" ]; then if [ "$UTOOLS_AUTO" != "f" ]; then
flag="?svn" flag="?svn"
elif [ -n "$(svn status -q --ignore-externals 2>/dev/null)" ]; then elif [ -n "$(svn status -q --ignore-externals 2>/dev/null)" ]; then
flag="*svn" flag="*svn"
@ -33,7 +33,7 @@ if [ -n "$UTOOLS" ]; then
svn=1 svn=1
fi fi
if [ -z "$git" -a -d "$p/.git" ]; then if [ -z "$git" -a -d "$p/.git" ]; then
if [ "$UTOOLS" != "f" ]; then if [ "$UTOOLS_AUTO" != "f" ]; then
flag="?git" flag="?git"
elif [ -n "$(git status -s 2>/dev/null)" ]; then elif [ -n "$(git status -s 2>/dev/null)" ]; then
flag="*git" flag="*git"
@ -42,7 +42,7 @@ if [ -n "$UTOOLS" ]; then
fi fi
branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
[ "$branch" != "master" ] && flag="$flag:$branch" [ "$branch" != "master" ] && flag="$flag:$branch"
if [ -n "$NOPUSH" ]; then if [ -n "$UTOOLS_NOPUSH" ]; then
flag="$flag,nopush" flag="$flag,nopush"
fi fi
PS1="${PS1:+$PS1,}$flag" PS1="${PS1:+$PS1,}$flag"
@ -87,7 +87,7 @@ fi
case "$TERM" in case "$TERM" in
xterm*|rxvt|Eterm|eterm) xterm*|rxvt|Eterm|eterm)
PROMPT_COMMAND=' PROMPT_COMMAND='
if [ -n "$UTOOLS" ]; then if [ -n "$UTOOLS_AUTO" ]; then
echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} $( echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} $(
if [ -f build.properties ]; then if [ -f build.properties ]; then
if grep -q "^project\(_\|\.\)name=" build.properties; then if grep -q "^project\(_\|\.\)name=" build.properties; then
@ -114,7 +114,7 @@ eval "$GENERATE_PS1"
;; ;;
screen) screen)
PROMPT_COMMAND=' PROMPT_COMMAND='
if [ -n "$UTOOLS" ]; then if [ -n "$UTOOLS_AUTO" ]; then
echo -ne "\033_[screen] ${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} $(if [ -f build.properties ]; then echo -ne "\033_[screen] ${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~} $(if [ -f build.properties ]; then
if grep -q "^project\(_\|\.\)name=" build.properties; then if grep -q "^project\(_\|\.\)name=" build.properties; then
if grep -q "^project\.name=" build.properties; then if grep -q "^project\.name=" build.properties; then
@ -140,7 +140,7 @@ eval "$GENERATE_PS1"
;; ;;
*) *)
PROMPT_COMMAND=' PROMPT_COMMAND='
if [ -n "$UTOOLS" ]; then if [ -n "$UTOOLS_AUTO" ]; then
if [ -f build.properties ]; then if [ -f build.properties ]; then
if grep -q "^project\(_\|\.\)name=" build.properties; then if grep -q "^project\(_\|\.\)name=" build.properties; then
if grep -q "^project\.name=" build.properties; then if grep -q "^project\.name=" build.properties; then

View File

@ -7,8 +7,8 @@
# Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants: # Au 18/06/2013, cela ne concerne que les scripts/fichiers suivants:
# - lib/profile.d/bash_prompt # - lib/profile.d/bash_prompt
# - ulib/vcs {git_commit} # - ulib/vcs {git_commit}
: "${UTOOLS:=1}" "${NOPUSH:=}" : "${UTOOLS_AUTO:=1}" "${UTOOLS_NOPUSH:=}"
export UTOOLS NOPUSH export UTOOLS_AUTO UTOOLS_NOPUSH
# fonctions utilitaires pour les chemins # fonctions utilitaires pour les chemins
function __udelpath() { function __udelpath() {
@ -37,43 +37,43 @@ function pcd() {
function nutools() { function nutools() {
if [ -n "$1" ]; then if [ -n "$1" ]; then
case "$1" in case "$1" in
0|d|dis|disable) UTOOLS=;; 0|d|dis|disable) UTOOLS_AUTO=;;
1|e|ena|enable) UTOOLS=1;; 1|e|ena|enable) UTOOLS_AUTO=1;;
f|full) UTOOLS=f;; f|full) UTOOLS_AUTO=f;;
cycle) cycle)
case "$UTOOLS" in case "$UTOOLS_AUTO" in
1) UTOOLS=f;; 1) UTOOLS_AUTO=f;;
f) UTOOLS=;; f) UTOOLS_AUTO=;;
*) UTOOLS=1;; *) UTOOLS_AUTO=1;;
esac esac
;; ;;
n|np|nopush) NOPUSH=1;; n|np|nopush) UTOOLS_NOPUSH=1;;
push) NOPUSH=;; push) UTOOLS_NOPUSH=;;
p|cyclep) p|cyclep)
case "$NOPUSH" in case "$UTOOLS_NOPUSH" in
"") NOPUSH=1;; "") UTOOLS_NOPUSH=1;;
*) NOPUSH=;; *) UTOOLS_NOPUSH=;;
esac esac
;; ;;
esac esac
echo "UTOOLS=$UTOOLS; NOPUSH=$NOPUSH" 1>&2 echo "UTOOLS_AUTO=$UTOOLS_AUTO; UTOOLS_NOPUSH=$UTOOLS_NOPUSH" 1>&2
else else
local PS3 prompt nopush local PS3 prompt nopush
echo "=== Type de prompt ===" 1>&2 echo "=== Type de prompt ===" 1>&2
PS3="Veuillez choisir le type de prompt: " PS3="Veuillez choisir le type de prompt: "
select prompt in Aucun$([ -z "$UTOOLS" ] && echo "*") Minimum$([ "$UTOOLS" == 1 ] && echo "*") Complet$([ "$UTOOLS" == f ] && echo "*"); do select prompt in Aucun$([ -z "$UTOOLS_AUTO" ] && echo "*") Minimum$([ "$UTOOLS_AUTO" == 1 ] && echo "*") Complet$([ "$UTOOLS_AUTO" == f ] && echo "*"); do
case "$prompt" in case "$prompt" in
Aucun*) UTOOLS=; break;; Aucun*) UTOOLS_AUTO=; break;;
Minimum*) UTOOLS=1; break;; Minimum*) UTOOLS_AUTO=1; break;;
Complet*) UTOOLS=f; break;; Complet*) UTOOLS_AUTO=f; break;;
esac esac
done done
echo "=== git push automatique ===" 1>&2 echo "=== git push automatique ===" 1>&2
PS3="Veuillez choisir le type de push: " PS3="Veuillez choisir le type de push: "
select nopush in "Après git commit, faire git push$([ -z "$NOPUSH" ] && echo "*")" "Pas de git push auto$([ -n "$NOPUSH" ] && echo "*")"; do select nopush in "Après git commit, faire git push$([ -z "$UTOOLS_NOPUSH" ] && echo "*")" "Pas de git push auto$([ -n "$UTOOLS_NOPUSH" ] && echo "*")"; do
case "$nopush" in case "$nopush" in
"Après git commit, faire git push"*) NOPUSH=; break;; "Après git commit, faire git push"*) UTOOLS_NOPUSH=; break;;
"Pas de git push auto"*) NOPUSH=1; break;; "Pas de git push auto"*) UTOOLS_NOPUSH=1; break;;
esac esac
done done
fi fi

View File

@ -1 +1 @@
22 23

View File

@ -363,8 +363,9 @@ function git_mkdir() {
git mkdir "$@" git mkdir "$@"
} }
function git_commit() { function git_commit() {
local all=auto push=auto args local all=auto push=auto nopush args
normyesval nopush "$NOPUSH" normyesval nopush "$UTOOLS_NOPUSH"
[ -n "$nopush" ] && push=
parse_opts + "${PRETTYOPTS[@]}" \ parse_opts + "${PRETTYOPTS[@]}" \
-a,--all all=1 \ -a,--all all=1 \
-c,--cached all= \ -c,--cached all= \