-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmigration.sh
executable file
·55 lines (43 loc) · 1.84 KB
/
migration.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
MIG_SVN_PATH="/full/path/to/zetacomponents/svn/repo/"
MIG_SVN_SERVER_SSH_URI="[email protected]:/home/svn/repos/asf/incubator/zetacomponents"
MIG_USERS="users.txt"
MIG_DIR="migration"
MIG_GITHUB="[email protected]:zetacomponents/zeta.git"
TMP_SIZE="600M"
TMP_INODES="100k"
if [ -z "${SSH_AGENT_PID}" -o -z "${SSH_AUTH_SOCK}" ]; then
echo "ssh-agent not found"
exit 1
fi
# Syncing with rsync from svn server over ssh
echo -e "\033[1mSyncing\033[0m"
rsync -havz -e ssh $MIG_SVN_SERVER_SSH_URI $MIG_SVN_PATH
# To speedup the process, mounting a directory in memory with tmpfs
echo -e "\033[1mCreating migration directory\033[0m"
mkdir $MIG_DIR
sudo mount -t tmpfs tmpfs -o size=$TMP_SIZE,nr_inodes=$TMP_INODES $MIG_DIR
cd $MIG_DIR
echo -e "\033[1mImporting to git\033[0m"
svn2git -v --trunk trunk --authors $MIG_USERS file://$MIG_SVN_PATH > ../svn2git.out 2> ../svn2git.err
cd ..
echo -e "\033[1mCopying to new directory\033[0m"
cp --recursive --preserve $MIG_DIR $MIG_DIR.copy
cd $MIG_DIR.copy
# For eZ Publish, branches were stored inside /stable directory and tags under /release, zeta has a much more
# complex model...
#
# # Renaming branches, they are prefixed with "stable-"
# echo -e "\033[1mRenaming branches\033[0m"
# for branch in $(svn ls file://$MIG_SVN_PATH/stable | sed 's/\///') ; do git branch -m $branch stable-$branch ; done
#
# # Renaming tags, they are prefixed with "release-"
# echo -e "\033[1mRenaming tags\033[0m"
# for branch in $(svn ls file://$MIG_SVN_PATH/release | sed 's/\///') ; do git branch -m $branch release-$branch ; done
echo -e "\033[1mConfiguring github\033[0m"
git remote add origin $MIG_GITHUB
echo -e "\033[1mPushing to github\033[0m"
git push origin master
# echo -e "\033[1mPushing branches to github\033[0m"
# git push origin $(git branch | grep release)
# git push origin $(git branch | grep stable)