This repository has been archived by the owner on Mar 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate
executable file
·113 lines (94 loc) · 3.22 KB
/
migrate
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
REPO="file://"`pwd`"/svn-repo"
USER=`pwd`"/users.txt"
BASE="file://"`pwd`
# Start from scratch
rm -rf git
rm -rf tmp
# Initial import of git repository for arbit trunk
if [ ! -d "import/" ]; then
mkdir tmp
cd tmp
git svn init "$REPO/trunk" --no-metadata
git config svn.authorsfile "$USER"
git svn fetch
cd ../
# Copy repository into a new one get rid of the git-svn stuff
git clone --no-hardlinks "${BASE}/tmp/" import/
rm -rf tmp
fi
# Extract modules into their own repositories
for MODULE in ci faq importer jslint notification pdepend phpcs phpdoc phploc phpunit source tracker wiki ; do
MODULE_PATH="git/module-$MODULE"
rm -rf tmp
git clone --no-hardlinks "import/" "tmp/"
cd "tmp/"
git filter-branch --index-filter \
'git ls-files -s |
sed -e "s-\(^.*\t\"*\)tests/modules_'$MODULE'_suite.php-\\1src/modules/'$MODULE'/tests/suite.php-" \
-e "s-\(^.*\t\"*\)tests/modules/'$MODULE'/\(.*\)\$-\\1src/modules/'$MODULE'/tests/\\2-" \
-e "s-\(^.*\t\"*\)src/modules/'$MODULE'/classes/\(.*\)\$-\\1src/modules/'$MODULE'/src/\\2-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
git filter-branch -f --subdirectory-filter 'src/modules/'$MODULE HEAD
git filter-branch -f --prune-empty HEAD
git reset --hard
git gc --aggressive
git prune
cd ../
git clone --no-hardlinks "${BASE}/tmp/" "${MODULE_PATH}"
rm -rf tmp/
cd "$MODULE_PATH"
../../findExternals "$REPO/trunk//src/modules/$MODULE" > externals.txt
git add externals.txt
git commit -m "Added project externals" externals.txt
cd ../../
done
# Remove all modules and store as framework repository
rm -rf tmp/
git clone --no-hardlinks "${BASE}/import/" tmp/
cd tmp/
git filter-branch --tree-filter 'rm -rf tests/modules_* tests/modules/ src/modules/' HEAD
git reset --hard
git gc --aggressive
git prune
../findExternals "$REPO/trunk" > externals.txt
git add externals.txt
git commit -m "Added project externals" externals.txt
cd ../
git clone --no-hardlinks "${BASE}/tmp/" "git/framework/"
# Clone framework into core repository
git clone --no-hardlinks "${BASE}/git/framework/" "git/arbit/"
# Clone project dirs
for PROJECT in installer periodic phpcs phync vcs_wrapper xml ; do
rm -rf tmp
mkdir tmp
cd tmp
git svn init "$REPO/projects/$PROJECT/trunk" --no-metadata
git config svn.authorsfile "$USER"
git svn fetch
cd ../
git clone --no-hardlinks "${BASE}/tmp/" "git/$PROJECT"
./findExternals "$REPO/projects/$PROJECT/trunk" > "git/$PROJECT/externals.txt"
cd "git/$PROJECT"
git add externals.txt
git commit -m "Added project externals" externals.txt
cd ../../
rm -rf tmp/
done
# Clone website repository
rm -rf tmp
mkdir tmp
cd tmp
git svn init "$REPO/website" --no-metadata
git config svn.authorsfile "$USER"
git svn fetch
cd ../
# Copy repository into a new one get rid of the git-svn stuff
git clone --no-hardlinks tmp/ git/website/
./findExternals "$REPO/website" > git/website/externals.txt
cd "git/website"
git add externals.txt
git commit -m "Added project externals" externals.txt
cd ../../
rm -rf tmp