From 006678e2725e9a1c6ca009111f167310322833e9 Mon Sep 17 00:00:00 2001 From: nico wellpott Date: Tue, 8 Jun 2021 10:26:07 +0200 Subject: [PATCH] structurize script + seperate actions into functions for maintainability + use command line parameters for the svn list --- svnmigrate.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/svnmigrate.sh b/svnmigrate.sh index 5535474..85ed6fa 100644 --- a/svnmigrate.sh +++ b/svnmigrate.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash -REPOS=(skript scare scare2) +REPOS=( "$@" ) BASE_PATH="/home/user/nwellpott/svnMigration" -for REPO in "${REPOS[@]}"; do +function migrate() { # change dir /usr/bin/printf "changing directory to %s\n" "$REPO" cd "$BASE_PATH/$REPO" || exit 1 @@ -11,7 +11,26 @@ for REPO in "${REPOS[@]}"; do # rebase /usr/bin/printf "attempt to fetch %s commits\n" "$REPO" /usr/bin/svn2git --rebase +} +function clean() { + # clean up git tree thoroughly + /usr/bin/git gc --aggressive +} + +function push() { # push changes - # /usr/bin/git push --all + /usr/bin/git push --all + + # push tags + /usr/bin/git push --tags +} + +# main +for REPO in "${REPOS[@]}"; do + migrate + + clean + + push done