Last active
January 1, 2016 23:19
-
-
Save raulillana/8215798 to your computer and use it in GitHub Desktop.
Folders to SVN migrator. Automatically migrates a folder structure of software versions to a SVN working copy and creates tags for each version. <3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# activate logs | |
LOGERROR="/Users/activeuser/Desktop/bash_error.txt" | |
LOGEXEC="/Users/activeuser/Desktop/bash_exec.txt" | |
# print errors to logs | |
exec 1> $LOGEXEC | |
exec 2> $LOGERROR | |
# activate trace on script | |
# -x -> activate trace | |
# -v -> verbose | |
# -e -> end script execution if error | |
set -x -v | |
# versions array | |
VERSIONS="1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.5 1.5.1 1.5.2 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.8 1.8.1 1.8.2 1.8.3 2.0 2.1 2.1.1 2.2 2.3 2.4 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 3.0 3.0.1 3.0.2 3.1 3.1.1 3.2 3.2.1 3.2.2 " | |
# version iteration | |
for VER in $VERSIONS | |
do | |
# rsync version from location to master branch | |
# -r -> recursive | |
# -t -> preserve file timestamps | |
# -v -> verbose | |
# -u -> work with updated only files | |
# --delete -> care of deleted files | |
rsync -rtvu --delete /Users/activeuser/Dropbox/project/$VER/ /Users/activeuser/SVN/project/trunk/ | |
# run status on the project working copy | |
svn st /Users/activeuser/SVN/project/ | |
# add the new files | |
svn add /Users/activeuser/SVN/project/trunk/* | |
# commit new version in trunk | |
svn ci -m "add v$VER" | |
# copy trunk to a new tag folder | |
svn cp /Users/activeuser/SVN/project/trunk/ /Users/activeuser/SVN/project/tags/$VER/ | |
# commit new tag | |
svn ci -m "tag v$VER" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment