pman: ajout init pman
This commit is contained in:
parent
939f7726ab
commit
bbb55599f7
29
bin/pman
29
bin/pman
@ -34,16 +34,12 @@ function show_action() {
|
|||||||
# Initialisation
|
# Initialisation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
function init_repo_action() {
|
function _init_pman() {
|
||||||
[ ${#LocalBranches[*]} -eq 0 ] || die "Ce dépôt a déjà été initialisé"
|
|
||||||
|
|
||||||
local -a push_branches
|
|
||||||
|
|
||||||
if [ ! -f .pman.conf ]; then
|
if [ ! -f .pman.conf ]; then
|
||||||
ac_set_tmpfile config
|
ac_set_tmpfile config
|
||||||
cp "$ConfigFile" "$config"
|
cp "$ConfigFile" "$config"
|
||||||
"${EDITOR:-nano}" "$config"
|
"${EDITOR:-nano}" "$config"
|
||||||
[ -s "$config" ] || exit_with ewarn "Initialisation du dépôt annulée"
|
[ -s "$config" ] || return 1
|
||||||
|
|
||||||
cp "$config" .pman.conf
|
cp "$config" .pman.conf
|
||||||
if testdiff .pman.conf "$ConfigFile"; then
|
if testdiff .pman.conf "$ConfigFile"; then
|
||||||
@ -59,6 +55,15 @@ function init_repo_action() {
|
|||||||
.*.swp"
|
.*.swp"
|
||||||
git add .gitignore
|
git add .gitignore
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function init_repo_action() {
|
||||||
|
[ ${#LocalBranches[*]} -eq 0 ] || die "Ce dépôt a déjà été initialisé"
|
||||||
|
|
||||||
|
local -a push_branches
|
||||||
|
|
||||||
|
_init_pman || exit_with ewarn "Initialisation du dépôt annulée"
|
||||||
|
|
||||||
einfo "Création de la branche $MAIN"
|
einfo "Création de la branche $MAIN"
|
||||||
git symbolic-ref HEAD "refs/heads/$MAIN"
|
git symbolic-ref HEAD "refs/heads/$MAIN"
|
||||||
@ -72,6 +77,17 @@ function init_repo_action() {
|
|||||||
_push_branches
|
_push_branches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function init_pman_action() {
|
||||||
|
[ ${#LocalBranches[*]} -eq 0 ] || die "Ce dépôt a déjà été initialisé"
|
||||||
|
|
||||||
|
local -a push_branches
|
||||||
|
|
||||||
|
_init_pman || exit_with ewarn "Initialisation de pman annulée"
|
||||||
|
push_branches+=("$CurrentBranch")
|
||||||
|
|
||||||
|
_push_branches
|
||||||
|
}
|
||||||
|
|
||||||
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 "$DEVELOP" ] || die "La branche DEVELOP n'a pas été définie"
|
||||||
@ -174,6 +190,7 @@ function init_action() {
|
|||||||
local what="${1:-develop}"; shift
|
local what="${1:-develop}"; shift
|
||||||
case "$what" in
|
case "$what" in
|
||||||
init|repo|r) init_repo_action "$@";;
|
init|repo|r) init_repo_action "$@";;
|
||||||
|
pman) init_pman_action "$@";;
|
||||||
main|m) git checkout -q "$MAIN";;
|
main|m) git checkout -q "$MAIN";;
|
||||||
develop|dev|d) init_develop_action "$@";;
|
develop|dev|d) init_develop_action "$@";;
|
||||||
upstream|up|u) init_upstream_action "$@";;
|
upstream|up|u) init_upstream_action "$@";;
|
||||||
|
Loading…
Reference in New Issue
Block a user