-
Notifications
You must be signed in to change notification settings - Fork 1
/
migration-recipe.txt
231 lines (186 loc) · 8.05 KB
/
migration-recipe.txt
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
I. Announce the migration
~~~~~~~~~~~~~~~~~~~~~~~~~
1. Send email.
2. Switch SVN to readonly when doing the last final migration.
II. Migrate the Valgrind code repository
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Init the VEX repo
git svn init svn://svn.valgrind.org/vex --prefix='svn/' -s valgrind-vex-git
cd valgrind-vex-git
git config svn.authorsfile ../authors.txt
2. Fetch the stuff from VEX repo
git svn fetch
git svn show-ignore > .gitignore
3. Fix tags and branches
for t in $(git for-each-ref --format='%(refname:short)' refs/remotes/svn/tags); do git tag ${t/tags\//} $t && git branch -D -r $t; done
for b in $(git for-each-ref --format='%(refname:short)' refs/remotes); do git branch $b refs/remotes/$b && git branch -D -r $b; done
cd ..
4. Due to a bug in git-svn (dumps core with SIGSEGV), the same approach for Valgrind repo
as for VEX is not possible. Use a slightly longer route with SVN dump/load:
svnrdump dump svn://svn.valgrind.org/valgrind > valgrind-svn-repo.dump
svnadmin create valgrind-svn-repo
svnadmin load valgrind-svn-repo < valgrind-svn-repo.dump
5. Init the Valgrind repo
git svn init file:///$(pwd)/valgrind-svn-repo --prefix='svn/' \
--rewrite-root='svn://svn.valgrind.org/valgrind' -s valgrind-svn-git
cd valgrind-svn-git
git config svn.authorsfile ../authors.txt
6. Fetch the stuff from Valgrind repo
git svn fetch
git svn show-ignore > .gitignore
7. Fix tags and branches
for t in $(git for-each-ref --format='%(refname:short)' refs/remotes/svn/tags); do git tag ${t/tags\//} $t && git branch -D -r $t; done
for b in $(git for-each-ref --format='%(refname:short)' refs/remotes); do git branch $b refs/remotes/$b && git branch -D -r $b; done
cd ..
8. Copy the two repos together
rm -rf valgrind-git-combined
cp -r --preserve=links valgrind-svn-git valgrind-git-combined
cp -r --preserve=links valgrind-vex-git valgrind-git-combined/VEX
9. Delete non-production branches and tags
cd valgrind-git-combined
git branch | grep -v master | egrep -v 'svn/VALGRIND_.*_BRANCH' | xargs git branch -D
git tag | egrep -v 'svn/VALGRIND_.*_.$' | xargs git tag -d
cd VEX
git branch | grep -v master | egrep -v 'svn/VEX_.*_BRANCH' | xargs git branch -D
cd ..
10. Rewrite the commit messages to get rid of extra junk after git-svn-id revision
git filter-branch --msg-filter 'perl -ape "s/git-svn-id:\s+(\S+).*$/git-svn-id: \$1/"' \
--tag-name-filter 'cat' -- --all
cd VEX
git filter-branch --msg-filter 'perl -ape "s/git-svn-id:\s+(\S+).*$/git-svn-id: \$1/"' \
--tag-name-filter 'cat' -- --all
cd ..
11. Fix the VEX history in all branches (issues warning for the first commit)
cd VEX
cat << 'EOF' > doit.sh
#!/bin/bash
git ls-files -s | sed "s-\t-&VEX/-" | GIT_INDEX_FILE="$GIT_INDEX_FILE.new" git update-index --index-info
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE" || true
EOF
chmod a+x doit.sh
git filter-branch -f --index-filter "$PWD/doit.sh" -- --all
rm doit.sh
cd ..
12. Pull VEX repo into Valgrind one.
git remote add vex VEX
git fetch vex
git merge --allow-unrelated-histories -m "Merge VEX/HEAD into Valgrind/HEAD" vex/master
13. Move latest 3.x.y tags to the last commit on that branch.
Majority of branches have only 3.x.0 and 3.x.1 with the exception of 3.2.y.
for ver in 0 1 2 3 4 5 6 7 8 9 10 11 12 13; do
git checkout svn/VALGRIND_3_${ver}_BRANCH
git merge --allow-unrelated-histories -m "Merge VEX_3_${ver}_BRANCH into VALGRIND_3_${ver}_BRANCH" \
remotes/vex/svn/VEX_3_${ver}_BRANCH
latest_tag=$(git tag | grep VALGRIND_3_${ver}_ | sort -u | tail -1)
git tag -f -a -m "Move tag ${latest_tag} to the latest commit on VALGRIND_3_${ver}_BRANCH" \
$latest_tag
done
# Do BGQ branch separately
git checkout svn/VALGRIND_3_8_BRANCH_BGQ
git merge --allow-unrelated-histories -m "Merge VEX_3_8_BRANCH_BGQ into VALGRIND_3_8_BRANCH_BGQ" \
remotes/vex/svn/VEX_3_8_BRANCH_BGQ
git remote rm vex
git checkout master
14. Combine .gitignore files together
sed -e 's|^/|/VEX/|' -e 's|^# /|# /VEX/|' VEX/.gitignore >> .gitignore
git add .gitignore
git commit -m 'Convert svn:ignore properties to combined .gitignore.'
15. Push it!
git for-each-ref --format="%(refname)" "refs/original/" | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git remote add origin ssh://[email protected]/git/valgrind.git/
git push origin --mirror
cd ..
16. Verify the same content for HEAD, all 3.x branches and latest 3.x.y tags
(Valgrind 2.x did not have separate VEX subrepo):
rm -rf valgrind-git-branches
git clone git://sourceware.org/git/valgrind.git/ valgrind-git-branches
cd valgrind-git-branches
git fetch --all --tags --prune
cd ..
echo "" > branches.diffs
for ver in 0 1 2 3 4 5 6 7 8 9 10 11 12 13; do
branch="VALGRIND_3_${ver}_BRANCH"
echo "DIFFS for ${branch}:" >> branches.diffs
cp -r --preserve=links valgrind-git-branches valgrind-git-3_${ver}_branch
cd valgrind-git-3_${ver}_branch
git checkout svn/${branch}
cd ..
svn co svn://svn.valgrind.org/valgrind/branches/${branch} valgrind-svn-3_${ver}_branch
diff -ur valgrind-svn-3_${ver}_branch valgrind-git-3_${ver}_branch >> branches.diffs
rm -rf valgrind-svn-3_${ver}_branch valgrind-git-3_${ver}_branch
done
echo "" > tags.diffs
for tag in 3_0_1 3_1_1 3_2_3 3_3_1 3_4_1 3_5_0 3_6_1 3_7_0 3_8_1 3_9_0 3_10_1 3_11_0 3_12_0 3_13_0; do
tag="VALGRIND_${tag}"
echo "DIFFS for tag ${tag}:" >> tags.diffs
cp -r --preserve=links valgrind-git-branches valgrind-git-${tag}_tag
cd valgrind-git-${tag}_tag
git checkout svn/${tag} -b ${tag}_TAG
cd ..
svn co svn://svn.valgrind.org/valgrind/tags/${tag} valgrind-svn-${tag}_tag
diff -ur valgrind-svn-${tag}_tag valgrind-git-${tag}_tag >> tags.diffs
rm -rf valgrind-svn-${tag}_tag valgrind-git-${tag}_tag
done
svn co svn://svn.valgrind.org/valgrind/trunk valgrind-svn-HEAD
echo "DIFFS for HEAD:" >> branches.diffs
diff -ur valgrind-svn-HEAD valgrind-git-branches >> branches.diffs
rm -rf valgrind-git-branches valgrind-svn-HEAD
cat branches.diffs tags.diffs
17. Add SVN->GIT patches
git clone ssh://[email protected]/git/valgrind.git/ valgrind-git
cd valgrind-git
git am ../001-Change-SVN-to-GIT-in-various-places.patch
git am ../002-Update-auxprogs-update-demangler-for-Valgrind-in-GIT.patch
git am ../003-Fix-nightly-build-script-to-work-with-git.patch
git am ../004-fix-verbose-version-reporting-for-git.patch
git am ../005-Change-Subversion-to-GIT-in-various-places.patch
git am ../006-Convert-release-HOWTO.txt-from-SVN-to-GIT.patch
git am ../007-git-HOWTO.txt.patch
git am ../008-Add-missing-entries-to-.gitignore.patch
git push origin
cd ..
III. Configure git repo afterwards:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Allow only fast-forward merges:
git config receive.denynonfastforwards true
2. Configure AdaCore git hooks [1] which are used at sourceware.org
according to git-hooks-config.txt in this directory.
cd valgrind-git
git branch meta/config
git checkout meta/config
cp .../git-hooks-config.txt project.config
git add project.config
git commit -m "AdaCore git hooks configuration for Valgrind git repository"
git push origin meta/config:refs/meta/config
rm project.config
git checkout master
[1] https://sourceware.org/gdb/wiki/GitHooksUsersGuide
3. Enable AdaCore git hooks.
Create the following symlink for whole directory:
/sourceware/git/valgrind.git/hooks -> /sourceware/projects/src-home/git-hooks/hooks
Create an empty bash file:
/git/valgrind.git/hooks-bin/style_checker
This needs to be done by someone who has an account at sourceware.org,
such as Mark Wielaard.
IV. Commit www changes:
~~~~~~~~~~~~~~~~~~~~~~~~
1. Apply changes against valgrind-www repository:
cd valgrind-www
patch -p0 -i ../valgrind-www-changes.patch
svn commit -m "Changes for SVN->GIT core repository migration"
V. Announce the migration completed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(.) Push an empty local repo to start from "scratch":
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkdir empty
cd empty
git init
echo "This is the README" > README
git add .
git commit -m "(initial commit)"
git remote add origin ssh://[email protected]/git/valgrind.git/
git push origin --mirror
cd ..
rm -rf empty