9 if [ ! -d pma-svn-git
] ; then
10 # Init repository on first run
13 git svn init
-s --no-metadata https
://phpmyadmin.svn.sourceforge.net
/svnroot
/phpmyadmin
14 git config svn.authorsfile ..
/svn2git-authors
20 git svn fetch
--fetch-all
22 # Back to top level directory
25 # Create working copy of the clone (we will modify it)
26 rm -rf pma-svn-git-work
27 cp -a pma-svn-git pma-svn-git-work
29 # Make local tags and branches
32 # Proper email address
33 git config
--add user.email michal@cihar.com
36 git branch
-r |
sed -rne 's, *tags/([^@]+)$,\1,p' |
grep 'RELEASE\|STABLE\|TESTING' |
while read tag
; do
37 git tag
-a $tag -m "Imported SVN tag for $tag" "tags/${tag}^"
41 git branch
-r |
grep -v ' *tags/' |
grep 'QA_[0-9_]*$\|MAINT_[0-9_]*$' |
while read branch
; do
42 git branch
$branch $branch
45 # First connect orphan MAINT to QA
46 for branch
in `git branch | grep MAINT_` ; do
47 masterbranch
=`echo $branch | sed 's/MAINT_/QA_/; s/_[0-9]*$//'`
48 olddate
="`git log $branch | grep '^Date' | tail -n 1 | sed 's/Date: *//'`"
49 masterdate
="`git log $masterbranch | grep '^Date' | tail -n 1 | sed 's/Date: *//'`"
50 echo "$branch: $olddate / $masterdate"
51 if [ "$masterdate" = "$olddate" ] ; then
54 echo "Branch $branch is outdated!"
55 oldtail
="`git log $branch | grep '^commit' | tail -n 1 | sed 's/commit *//'`"
57 masterpoint
="`git log --before="$olddate" $masterbranch | grep '^commit' | head -n 1 | sed 's/commit *//'`"
58 echo "Will point $oldtail to $masterpoint"
60 git filter-branch
-f --tag-name-filter cat --parent-filter "test \$GIT_COMMIT = $oldtail && echo '-p $masterpoint' || cat" HEAD
64 # Now connect orphan QA to master
65 for branch
in `git branch | grep QA_` ; do
66 olddate
="`git log $branch | grep '^Date' | tail -n 1 | sed 's/Date: *//'`"
67 echo "$branch: $olddate"
68 if [ "Thu May 3 17:25:09 2001 +0000" = "$olddate" ] ; then
71 echo "Branch is outdated!"
72 oldtail
="`git log $branch | grep '^commit' | tail -n 1 | sed 's/commit *//'`"
73 masterpoint
="`git log --before="$olddate" master | grep '^commit' | head -n 1 | sed 's/commit *//'`"
74 echo "Will point $oldtail to $masterpoint"
75 childfilter
=`echo $branch | sed 's/QA_/MAINT_/'`
76 git filter-branch
-f --tag-name-filter cat --parent-filter "test \$GIT_COMMIT = $oldtail && echo '-p $masterpoint' || cat" -- --all
79 # Back to top level directory
82 # Prepare separate repositories
87 # Clone and filter all top level dirs
88 for repo
in data
history localized_docs phpMyAdmin planet scripts themes website
; do
89 git clone ..
/pma-svn-git-work
$repo
91 if [ $repo = phpMyAdmin
-o $repo = themes
] ; then
92 for branch
in `git branch -r | grep 'QA_[0-9_]*$\|MAINT_[0-9_]*$'` ; do
93 git branch
`basename $branch` $branch
96 git config
--add user.email michal@cihar.com
97 git filter-branch
--subdirectory-filter $repo --tag-name-filter cat -- --all