From 83caced2a8a49130b5c54f14a3e12718a5630b82 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Tue, 16 Feb 2010 10:52:39 +0100 Subject: Archive the SVN->Git conversion scripts. Not distributed. --- vcs-tools/fetchmail-svn2git.sh | 69 ++++++++++++++++++++++++++++++++++++++++++ vcs-tools/fetchmail.authors | 6 ++++ vcs-tools/fetchmail.rules | 35 +++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100755 vcs-tools/fetchmail-svn2git.sh create mode 100644 vcs-tools/fetchmail.authors create mode 100644 vcs-tools/fetchmail.rules diff --git a/vcs-tools/fetchmail-svn2git.sh b/vcs-tools/fetchmail-svn2git.sh new file mode 100755 index 00000000..debf9491 --- /dev/null +++ b/vcs-tools/fetchmail-svn2git.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# fetchmail-svn2git.sh - (C) 2009, 2010 by Matthias Andree, GNU GPL v3. + +set -eu + +####################################################################### +# Adjust the next three settings below: + +# safe can be obtained from +# and must be built before we can use it: +safe="$HOME/VCS-other/svn-all-fast-export/svn-all-fast-export" + +# svn is the path to a verbatim copy of the server-side SVN repository +# obtained with rsync or with svnadmin dump and load: +svn="$HOME/VCS-mine/fetchmail.svnrepo.backup" + +# git specifies where you want the converted repository to end up. +git="$HOME/fetchmail.git" + +# +####################################################################### + +# There should be no need to change anything below: + +####################################################################### + +# obtain current directory +dir="$(dirname $0)" + +# obtain absolute directory +dir="$( ( cd "$dir" && pwd ) )" + +# Pluck these from the same directory as this script +auth="$dir/fetchmail.authors" +rule="$dir/fetchmail.rules" + +# create git repository +mkdir "$git" +cd "$git" +git init + +# run svn-all-fast-export, which already imports stuff into git +"$safe" --identity-map="$auth" "$rule" "$svn" + +# turn tags/ branches into tags +git branch -a \ +| grep _tag_ \ +| while read a ; do + if git show-ref -q "$a" ; then + ( + 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") + MSG=$(git log -1 --pretty="tformat:%s%n%n%b" "$a") + export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE + export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE + if test "$GIT_AUTHOR_NAME" = nobody ; then + # cvs2svn tag => lightweight + git tag "${a##_tag_}" "$a" + else + # keep message + git tag -a -m "$MSG" "${a##_tag_}" "$a" + fi + git branch -D "$a" + ) + fi +done + +# clean up +git gc --aggressive diff --git a/vcs-tools/fetchmail.authors b/vcs-tools/fetchmail.authors new file mode 100644 index 00000000..2ad0ab31 --- /dev/null +++ b/vcs-tools/fetchmail.authors @@ -0,0 +1,6 @@ +m-a Matthias Andree +esr Eric S. Raymond +yangyanl Yangyan Li +mojmir Mojmir Svoboda +bob Graham Wilson +rfunk Rob Funk diff --git a/vcs-tools/fetchmail.rules b/vcs-tools/fetchmail.rules new file mode 100644 index 00000000..d447c5fe --- /dev/null +++ b/vcs-tools/fetchmail.rules @@ -0,0 +1,35 @@ +# +# Declare the repositories we know about: +# + +create repository fetchmail +end repository + +# +# Declare the rules +# Note: rules must end in a slash +# + +match /branches/([^/]+)/ + repository fetchmail + branch \1 +end match + +match /tags/([^/]+)/ + repository fetchmail + branch _tag_\1 +end match + +match /trunk/ + repository fetchmail + branch master +end match + +match /vendor/([^/]+)/ + repository fetchmail + branch vendor_\1 +end match + +# fix a goofup +match /branches/branch_6-2 +end match -- cgit v1.2.3