This commit is contained in:
Jephté Clain 2025-02-26 15:54:13 +04:00
parent 73fcc88503
commit 6523bdab17

View File

@ -99,8 +99,15 @@ function init_repo_action() {
function init_develop_action() { function init_develop_action() {
if [ -z "$DevelopBranch" ]; then if [ -z "$DevelopBranch" ]; then
[ -n "$DEVELOP" ] || die "La branche DEVELOP n'a pas été définie"
[ -n "$MAIN" ] || die "La branche MAIN n'a pas été définie"
[ -n "$MainBranch" ] || die "$MAIN: cette branche n'existe pas (le dépôt a-t-il été initialisé?)"
local -a push_branches local -a push_branches
enote "Vous allez créer la branche ${COULEUR_VERTE}$DEVELOP${COULEUR_NORMALE} <-- ${COULEUR_BLEUE}$MAIN${COULEUR_NORMALE}"
ask_yesno "Voulez-vous continuer?" O || die
einfo "Création de la branche $DEVELOP" einfo "Création de la branche $DEVELOP"
git checkout -b "$DEVELOP" "$MAIN" git checkout -b "$DEVELOP" "$MAIN"
push_branches+=("$DEVELOP") push_branches+=("$DEVELOP")
@ -113,10 +120,14 @@ function init_develop_action() {
function init_upstream_action() { function init_upstream_action() {
if [ -z "$UpstreamBranch" ]; then if [ -z "$UpstreamBranch" ]; then
[ -n "$UPSTREAM" ] || die "La branche UPSTREAM n'a pas été définie" [ -n "$UPSTREAM" ] || die "La branche UPSTREAM n'a pas été définie"
[ -n "$DevelopBranch" ] || die "$DEVELOP: cette branche n'existe pas" [ -n "$DEVELOP" ] || die "La branche DEVELOP n'a pas été définie"
[ -n "$DevelopBranch" ] || die "$DEVELOP: cette branche n'existe pas (le dépôt a-t-il été initialisé?)"
local -a push_branches; local config local -a push_branches; local config
enote "Vous allez créer la branche ${COULEUR_VERTE}$UPSTREAM${COULEUR_NORMALE}"
ask_yesno "Voulez-vous continuer?" O || die
# faire une copie de la configuration actuelle # faire une copie de la configuration actuelle
ac_set_tmpfile config ac_set_tmpfile config
cp "$ConfigFile" "$config" cp "$ConfigFile" "$config"
@ -145,10 +156,14 @@ function init_upstream_action() {
function init_dist_action() { function init_dist_action() {
if [ -z "$DistBranch" ]; then if [ -z "$DistBranch" ]; then
[ -n "$DIST" ] || die "La branche DIST n'a pas été définie" [ -n "$DIST" ] || die "La branche DIST n'a pas été définie"
[ -n "$MainBranch" ] || die "$MAIN: cette branche n'existe pas" [ -n "$MAIN" ] || die "La branche MAIN n'a pas été définie"
[ -n "$MainBranch" ] || die "$MAIN: cette branche n'existe pas (le dépôt a-t-il été initialisé?)"
local -a push_branches local -a push_branches
enote "Vous allez créer la branche ${COULEUR_VERTE}$DIST${COULEUR_NORMALE} <-- ${COULEUR_BLEUE}$MAIN${COULEUR_NORMALE}"
ask_yesno "Voulez-vous continuer?" O || die
einfo "Création de la branche $DIST" einfo "Création de la branche $DIST"
git checkout -b "$DIST" "$MAIN" || die git checkout -b "$DIST" "$MAIN" || die
push_branches+=("$DIST") push_branches+=("$DIST")
@ -164,9 +179,13 @@ function init_feature_action() {
branch="$FEATURE$branch" branch="$FEATURE$branch"
if ! array_contains AllBranches "$branch"; then if ! array_contains AllBranches "$branch"; then
[ -n "$DEVELOP" ] || die "La branche DEVELOP n'a pas été définie" [ -n "$DEVELOP" ] || die "La branche DEVELOP n'a pas été définie"
[ -n "$DevelopBranch" ] || die "$DEVELOP: cette branche n'existe pas (le dépôt a-t-il été initialisé?)"
local -a push_branches local -a push_branches
enote "Vous allez créer la branche ${COULEUR_VERTE}$branch${COULEUR_NORMALE} <-- ${COULEUR_BLEUE}$DEVELOP${COULEUR_NORMALE}"
ask_yesno "Voulez-vous continuer?" O || die
einfo "Création de la branche $branch" einfo "Création de la branche $branch"
git checkout -b "$branch" "$DEVELOP" || die git checkout -b "$branch" "$DEVELOP" || die
push_branches+=("$branch") push_branches+=("$branch")
@ -200,7 +219,23 @@ Origin=
Push=1 Push=1
args=( args=(
"gérer un projet git" "gérer un projet git"
"repo|develop|upstream|dist" "repo|develop|upstream|dist
INITIALISATION
Par défaut, le script agit en mode initialisation qui permet de créer et/ou
configurer certaines branches du dépôt si elles n'existent pas déjà
repo
initialiser un dépôt vide et créer les branches $MAIN et $DEVELOP
develop
créer la branche $DEVELOP
upstream
créer la branche ${UPSTREAM:-UPSTREAM} en tant que source de la branche $DEVELOP
dist
créer la branche ${DIST:-DIST} en tant que destination de la branche $MAIN
anything
créer la branche ${FEATURE}anything à partir de la branche $DEVELOP"
-d:,--chdir:BASEDIR chdir= "répertoire dans lequel se placer avant de lancer les opérations" -d:,--chdir:BASEDIR chdir= "répertoire dans lequel se placer avant de lancer les opérations"
-b:,--config-branch ConfigBranch= "++\ -b:,--config-branch ConfigBranch= "++\
branche à partir de laquelle charger la configuration" branche à partir de laquelle charger la configuration"