ajout de -d et --force-delete
This commit is contained in:
parent
38f04ff046
commit
dd2a712b86
36
pdev
36
pdev
|
@ -77,6 +77,7 @@ projdir=
|
||||||
origin=origin
|
origin=origin
|
||||||
action=branch
|
action=branch
|
||||||
merge_delete=1
|
merge_delete=1
|
||||||
|
force_delete=
|
||||||
log=
|
log=
|
||||||
diff=
|
diff=
|
||||||
parse_opts "${PRETTYOPTS[@]}" \
|
parse_opts "${PRETTYOPTS[@]}" \
|
||||||
|
@ -87,6 +88,8 @@ parse_opts "${PRETTYOPTS[@]}" \
|
||||||
--online UTOOLS_VCS_OFFLINE= \
|
--online UTOOLS_VCS_OFFLINE= \
|
||||||
-m,--merge action=merge \
|
-m,--merge action=merge \
|
||||||
-k,--keep merge_delete= \
|
-k,--keep merge_delete= \
|
||||||
|
-d,--delete action=delete \
|
||||||
|
--force-delete '$action=delete; force_delete=1' \
|
||||||
-l,--log '$action=diff; log=1' \
|
-l,--log '$action=diff; log=1' \
|
||||||
-d,--diff '$action=diff; diff=1' \
|
-d,--diff '$action=diff; diff=1' \
|
||||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||||
|
@ -103,7 +106,6 @@ if ! git_have_branch develop; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setx branch=git_get_branch
|
setx branch=git_get_branch
|
||||||
|
|
||||||
if [ "$action" == branch ]; then
|
if [ "$action" == branch ]; then
|
||||||
feature="$1"
|
feature="$1"
|
||||||
source="${2:-develop}"
|
source="${2:-develop}"
|
||||||
|
@ -154,6 +156,9 @@ Vous allez créer la nouvelle feature branch ${COULEUR_VERTE}$feature${COULEUR_N
|
||||||
git_fast_forward "$feature" "" "$origin"
|
git_fast_forward "$feature" "" "$origin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# mettre à jour la branche sur laquelle on se trouve
|
||||||
|
setx branch=git_get_branch
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -185,10 +190,27 @@ if [ "$action" == merge ]; then
|
||||||
estepn "Intégration ${COULEUR_VERTE}$feature${COULEUR_NORMALE} --> ${COULEUR_BLEUE}develop${COULEUR_NORMALE}"
|
estepn "Intégration ${COULEUR_VERTE}$feature${COULEUR_NORMALE} --> ${COULEUR_BLEUE}develop${COULEUR_NORMALE}"
|
||||||
ask_yesno "Voulez-vous continuer?" O || die
|
ask_yesno "Voulez-vous continuer?" O || die
|
||||||
|
|
||||||
git checkout develop
|
git checkout develop || die
|
||||||
git merge "$feature" -m "Intégration de la feature branch $feature" --no-ff || die
|
git merge "$feature" -m "Intégration de la feature branch $feature" --no-ff || die
|
||||||
|
|
||||||
if [ -n "$merge_delete" ]; then
|
# mettre à jour la branche sur laquelle on se trouve
|
||||||
|
setx branch=git_get_branch
|
||||||
|
|
||||||
|
[ -n "$merge_delete" ] && action=delete
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$action" == delete ]; then
|
||||||
|
if [ -z "$force_delete" ]; then
|
||||||
|
# vérifier que la branche a été fusionnée
|
||||||
|
git_is_merged "$feature" develop || die "Refus de supprimer la branche $feature: elle n'a pas été fusionnée dans develop"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$branch" == "$feature" ]; then
|
||||||
|
# si on est sur la branche en question, en sortir pour pouvoir la
|
||||||
|
# supprimer
|
||||||
|
git checkout develop || die
|
||||||
|
fi
|
||||||
|
|
||||||
estepi "Suppression de la branche locale"
|
estepi "Suppression de la branche locale"
|
||||||
git branch -D "$feature"
|
git branch -D "$feature"
|
||||||
|
|
||||||
|
@ -196,16 +218,16 @@ if [ "$action" == merge ]; then
|
||||||
if [ -z "$UTOOLS_VCS_OFFLINE" ]; then
|
if [ -z "$UTOOLS_VCS_OFFLINE" ]; then
|
||||||
estepi "Suppression de la branche distante"
|
estepi "Suppression de la branche distante"
|
||||||
git push "$origin" ":$feature"
|
git push "$origin" ":$feature"
|
||||||
else
|
elif git_have_rbranch "$feature" "$origin"; then
|
||||||
eimportant "\
|
eimportant "\
|
||||||
La branche $feature n'a plus lieu d'être, mais la configuration actuelle interdit de la supprimer dans le dépôt distant.
|
La branche $origin/$feature n'a plus lieu d'être, mais la configuration actuelle interdit de la supprimer.
|
||||||
Veuillez le faire manuellement avec la commande suivante:
|
Veuillez le faire manuellement avec la commande suivante:
|
||||||
$(quoted_args git push "$origin" ":$feature")"
|
$(quoted_args git push "$origin" ":$feature")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$action" == diff ]; then
|
if [ "$action" == diff ]; then
|
||||||
if [ -n "$log" ]; then
|
if [ -n "$log" ]; then
|
||||||
if [ -n "$feature" ]; then
|
if [ -n "$feature" ]; then
|
||||||
git log ${diff:+-p} develop.."$feature"
|
git log ${diff:+-p} develop.."$feature"
|
||||||
|
|
Loading…
Reference in New Issue