Commit c6e8ec7d authored by Jan Grewe's avatar Jan Grewe
Browse files

initial commit

parents
Edit sv2ngit.sh to reflect your environment, then create a Git repository
that matches the SVN repositories' name and run:
./svn2git.sh <repository name>
#!/bin/bash
if [ -z ${1} ]; then
echo "Usage: $0 <repository name>"
exit 1
fi
REPO="$1"
# your SVN repo
SVN="svn://svn.example.com"
# your GitLab installation
GITLAB="https://git.example.com"
# your GitLab username
NAMESPACE="johndoe"
# your "SVN username = Full GitLab name <email@address>"
AUTHOR="jdoe = John Doe <john@example.com>"
echo ${AUTHOR} > /tmp/svn2git-author.txt
git svn clone ${SVN}/${REPO} --no-metadata -A /tmp/svn2git-author.txt /tmp/git/${REPO}
cd /tmp/git/${REPO}
git svn show-ignore --id git-svn > .gitignore
git add .gitignore
git commit -m 'Convert svn:ignore properties to .gitignore.'
git init --bare /tmp/git/${REPO}.git
cd ../${REPO}.git
git symbolic-ref HEAD refs/heads/git-svn
cd ../${REPO}
git remote add bare /tmp/git/${REPO}.git
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
git push bare
git push bare master:git-svn
cd ../${REPO}.git
git branch -m git-svn master
git for-each-ref --format='%(refname)' refs/heads/tags | cut -d / -f 4 | while read ref; do git tag "$ref" "refs/heads/tags/$ref"; git branch -D "tags/$ref"; done
# automatic project creation disabled, they don't show up in the Web UI?
#sudo -u git /srv/git/gitlab-shell/bin/gitlab-projects add-project ${NAMESPACE}/${REPO}.git
git push --mirror ${GITLAB}/${NAMESPACE}/${REPO}.git
rm -r /tmp/git/${REPO}
rm -r /tmp/git/${REPO}.git
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment