Table of Contents

svn To git Transition

This was done against trunk/rosegarden, so the history begins at 2006-02-24 r7161 [3398d014].

TODO

  • Decide how to prevent accidental pushing to the old svn repo
    • I've removed developer write privileges. So long as admins are careful, this shouldn't be an issue.
    • A pre-commit hook that returns 1 (exit 1) should prevent any and all commits. Problem is that we still use svn for the website and for backing up the wiki. So we'll need to be a little less heavy handed.
  • Mirror new repo on github

Resources

backup.sh script to get a full copy of the rg svn repo to your local drive. This speeds up the conversion massively.

#!/bin/bash
 
# -a is equivalent to -rlptgoD
# We don't want group or owner.
# -r - Recursive
# -l - Symlinks as symlinks
# -p - Permissions
# -t - Times
# -g - Group (we don't want this)
# -o - Owner (we don't want this)
# -D - Devices and Specials
 
rsync -rlptDv svn.code.sf.net::p/rosegarden/code .

rg-svn-authors script to extract all authors from the local copy of the svn repo.

#!/bin/bash
 
# https://danielpocock.com/migrating-a-sourceforge-project-from-subversion-to-git/
 
cd /tmp
 
# Checkout a temporary copy from my copy of the server.
svn co file:///home/ted/devel/rosegarden-svn-backup/code/trunk rg-trunk
cd rg-trunk
 
# Extract authors from the log.
svn log -q | \
  awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' \
  | sort -u > ../authors.txt

Authors.txt needed for git-svn to convert. It must be complete.

alteholz = Thorsten Alteholz <rosegarden@alteholz.de>
alvarudras = alvar udras <alvar.udras@gmail.com>
bownie = Richard Bown <rich@xyglo.com>
cannam = Chris Cannam <cannam@all-day-breakfast.com>
cjnfryer = Chris Fryer <chrisf1874@googlemail.com>
dfaure_kde = David Faure <faure@kde.org>
didierburli = didierburli <didierburli@users.sf.net>
dmmcintyr = D. Michael McIntyre <michael.mcintyre@rosegardenmusic.com>
emrum = Emanuel Rumpf <em.rumpf@gmail.com>
glaurent = Guillaume Laurent <glaurent@telegraph-road.org>
gperciva = Graham Percival <g.percival@elec.gla.ac.uk>
gzoumix = Michaël Lienhardt <gzoumix@users.sourceforge.net>
hannibal203 = hannibal203 <hannibal203@users.sourceforge.net>
hansk = Hans Kieserman <hansk@users.sf.net>
hean01 = Henrik Andersson <hean01@users.sf.net>
hjunes = Heikki Junes <hjunes@gmail.com>
iangardner = Ian Gardner <ilgardner@yahoo.co.uk>
ilan1 = Ilan Tal <ilan.tal@gmail.com>
janifr = Jani Frilander <j.frilander@gmail.com>
jkyro = Jaakko H Kyro <jkyro@users.sf.net>
marcospcmusica = Marcos Guglielmetti <marcospcmusica@users.sf.net>
markhymers = Mark Hymers <markhymers@users.sf.net>
msjulie = Julie S. <msjulie_s@yahoo.com>
(no author) = (no author) <(no author)>
nvdberg = Niek van den Berg <Niek.vandenBerg@inter.nl.net>
phisto_3h = Phil Mac <phisto_3h@users.sf.net>
pjhacnau = Peter Howard <pjhacnau@users.sourceforge.net>
plcl = Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
prokoudine = Alexandre Prokoudine <alexandre.prokoudine@gmail.com>
raboofje = Arnout Engelen <rosegarden@bzzt.net>
root = root <root>
tedfelix = Ted Felix <ted@tedfelix.com>
tehom = Tom Breton <tehom@panix.com>
titola = Tito Latini <titola@users.sf.net>
uid21183 = uid21183 <uid21183>
uid26034 = uid26034 <uid26034>
vacuum-for-time = Shelagh Manton <shelagh.manton@gmail.com>
williamrg = William <williamrg@users.sf.net>
yguillemot = Yves Guillemot <yc.guillemot@wanadoo.fr>

rg-git2svn script

#!/bin/bash
 
# https://danielpocock.com/migrating-a-sourceforge-project-from-subversion-to-git/
 
readonly authors=/tmp/authors.txt
readonly srcdir=/home/ted/devel/rosegarden-svn-backup/code
readonly destdir=/tmp/rg-conversion
 
mkdir "$destdir"
cd "$destdir"
 
echo Performing an svn clone.  This will take about two hours...
 
# These git svn clone options cause an inordinate amount of extra work.
# Like days worth.  Seriously.  It gets the commit history starting from
# r1 for *every branch and tag*.  It is unreal.
# I can recreate the important tags in less than an hour.  Using gitk!
#
#              --tags tags \
#              --branches branches \
#
# Even without those there were some changes that require rescanning from
# the beginning, but it's not all that bad.
 
# git svn clone file:///home/ted/devel/rosegarden-svn-backup/code --trunk trunk/rosegarden -A /tmp/authors.txt rosegarden-git-tmp2
 
time git svn clone "file://$srcdir" \
              --trunk trunk/rosegarden \
              -A "$authors" rosegarden-git-tmp
 
# This compresses down to about 193M.
 
# Next we need to convert to a bare git repo.
# I assume this is because we don't want svn connected anymore.
 
echo Pushing to bare repo.  This will take a moment...
 
# Create a new bare git repo.
mkdir "$destdir/rosegarden.git"
cd "$destdir/rosegarden.git"
git init --bare .
# Create a "trunk" branch?
git symbolic-ref HEAD refs/heads/trunk
 
# Get ready to push from $destdir/rosegarden-git-tmp
cd "$destdir/rosegarden-git-tmp"
git remote add bare "$destdir/rosegarden.git"
# Make git-push push all remotes and heads.
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
 
# Push all the commits from $destdir/rosegarden-git-tmp
# to $destdir/rosegarden.git.
git push bare
 
# Now the bare repo should have all of the commits.
 
cd "$destdir/rosegarden.git/"
 
# For each "origin/xxx" branch, rename to xxx
git for-each-ref --format='%(refname)' refs/heads/origin | cut -d / -f 4 | while read ref; \
  do
     # Create a simpler branch name.  Remove "origin" from the name.
     git branch "$ref" "refs/heads/origin/$ref"
     # Delete the original
     git branch -D "origin/$ref"
  done
 
# Rename trunk to the more git familiar master.
git branch -m trunk master
 
# No sense wasting space.  It's about 142Meg when finished.
git gc --aggressive
 
# The rest of this is just pushing to the destination repo.
 
#git remote add origin ssh://d_pocock@dynalogin.git.sourceforge.net/gitroot/dynalogin/dynalogin
#git config branch.master.remote origin
#git config branch.master.merge refs/heads/master
#git push --tags origin master

Branches

git-svn generated these branches while it was resolving merges from svn. I'm going to delete them since I have no use for them. Keeping them here in case anyone is interested in them.

* master      65121a34d fix bug with BasicCommand bruteForceRedo
  trunk@10148 745d37839 * commit some random exploratory work to clear it out before the trunk swap I   forgot to do an hour ago on schedule.  Oops.
  trunk@10149 49ac87286 * trunk swap step 3: move branches/qt4 to trunk/
  trunk@10151 90cc5fce4 * blast!  that didn't work as expected: trunk/qt4 moves to foo/ now
  trunk@10152 7a98ef76c * foo/ moves to trunk/
  trunk@10154 c80adcbca * on second thought, move trunk/ to dingle/
  trunk@7559  2bc47cfd7 * Pull PortIterator typedef into AudioPlugin
  trunk@7666  6bc2cad35 (from trunk): Fix bug #1570181 "Changing key to minor is not possible" by i18n "Minor" in all necessary places.
  trunk@7666- 9d4257e28 (from trunk): Fix bug #1570181 "Changing key to minor is not possible" by i18n "Minor" in all necessary places.
  trunk@7953  165e6fc86 since I merged the trunk in the branch rather than the opposite, mv the trunk to a backup branch and then rename the branch to be the trunk *sigh*.
  trunk@9069  e874b1025 * Merge from trunk
 
 
dev/svn_to_git_transition.txt · Last modified: 2022/05/06 16:07 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki