3 # fetchmail-svn2git.sh - (C) 2009, 2010 by Matthias Andree, GNU GPL v3.
7 #######################################################################
8 # Adjust the next three settings below:
10 # safe can be obtained from <git://repo.or.cz/svn-all-fast-export.git>
11 # and must be built before we can use it:
12 safe="$HOME/VCS-other/svn-all-fast-export/svn-all-fast-export"
14 # svn is the path to a verbatim copy of the server-side SVN repository
15 # obtained with rsync or with svnadmin dump and load:
16 svn="$HOME/VCS-mine/fetchmail.svnrepo.backup"
18 # git specifies where you want the converted repository to end up.
19 git="$HOME/fetchmail.git"
22 #######################################################################
24 # There should be no need to change anything below:
26 #######################################################################
28 # obtain current directory
31 # obtain absolute directory
32 dir="$( ( cd "$dir" && pwd ) )"
34 # Pluck these from the same directory as this script
35 auth="$dir/fetchmail.authors"
36 rule="$dir/fetchmail.rules"
38 # create git repository
43 # run svn-all-fast-export, which already imports stuff into git
44 "$safe" --identity-map="$auth" "$rule" "$svn"
46 # turn tags/ branches into tags
50 if git show-ref -q "$a" ; then
52 eval $(git log -1 --format="tformat:GIT_AUTHOR_NAME=\"%an\"%nGIT_AUTHOR_EMAIL=\"%ae\"%nGIT_AUTHOR_DATE=\"%ai\"%nGIT_COMMITTER_NAME=\"%cn\"%nGIT_COMMITTER_EMAIL=\"%ce\"%nGIT_COMMITTER_DATE=\"%ci\"" "$a")
53 MSG=$(git log -1 --pretty="tformat:%s%n%n%b" "$a")
54 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
55 export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
56 if test "$GIT_AUTHOR_NAME" = nobody ; then
57 # cvs2svn tag => lightweight
58 git tag "${a##_tag_}" "$a"
61 git tag -a -m "$MSG" "${a##_tag_}" "$a"