====== svn To git Transition ====== This was done against trunk/rosegarden, so the history begins at 2006-02-24 r7161 [3398d014]. ===== TODO ===== * Convert svn repo to git * Backup push to github * [[https://github.com/tedfelix/rosegarden-official]] * Decide what to do with all the branches it created. Probably just delete them. Could make a note of them here before deleting. Then they can be easily recreated. * Push to sf * Recreate tags * This is incomplete and might be incorrect for the older tags. * Create a new "using git" page. * Update wiki instructions related to version control * [[dev:eclipse-201510]] * [[dev:eclipsecdt]] * [[dev:running_under_cygwin]] * [[dev:notes_on_porting_to_qt4]] * [[dev:a_programme_for_tedium]] * [[dev:slog_endgame]] * [[:stable_from_svn]] * [[dev:branching]] * [[dev:contributing]] * [[dev:subversion]] * [[:development_from_svn]] * [[translator:add_or_update_translation]] * [[dev:eclipse]] * Update the website. It has links to svn-related pages on the wiki. * [[https://www.rosegardenmusic.com/getting/source/]] * Announce completion * Get myself set up for development with git now. Follow [[dev:eclipse]] instructions. * Update the README wiki page links and commit. * github cleanup * //[Philip already did this.]// Transition [[https://github.com/tedfelix/rosegarden]] pull requests to rosegarden-official or sourceforge. Worst-case generate patches and bring them over. Then close the pull requests. * Rename [[https://github.com/tedfelix/rosegarden]] to rosegarden-old and mark as archived? Or just delete? * Find some docs on sourceforge explaining working with forks. Link to those from the [[dev:Using git]] page. * The sourceforge docs are quite bad. Github's docs are better. Actually my docs are better. Think I'm done here. * Release Process * Update make-release-tarball script to use git * Update [[dev:release_process]] page for the new make-release-tarball script. * Update the About box to present the git hash instead of the svn rev * ''git rev-parse --short HEAD'' * See ''src/buildkey.cmake'' which creates ''svnversion.h''. * https://www.mattkeeter.com/blog/2018-01-06-versioning/ * More? * 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 alvarudras = alvar udras bownie = Richard Bown cannam = Chris Cannam cjnfryer = Chris Fryer dfaure_kde = David Faure didierburli = didierburli dmmcintyr = D. Michael McIntyre emrum = Emanuel Rumpf glaurent = Guillaume Laurent gperciva = Graham Percival gzoumix = Michaƫl Lienhardt hannibal203 = hannibal203 hansk = Hans Kieserman hean01 = Henrik Andersson hjunes = Heikki Junes iangardner = Ian Gardner ilan1 = Ilan Tal janifr = Jani Frilander jkyro = Jaakko H Kyro marcospcmusica = Marcos Guglielmetti markhymers = Mark Hymers msjulie = Julie S. (no author) = (no author) <(no author)> nvdberg = Niek van den Berg phisto_3h = Phil Mac pjhacnau = Peter Howard plcl = Pedro Lopez-Cabanillas prokoudine = Alexandre Prokoudine raboofje = Arnout Engelen root = root tedfelix = Ted Felix tehom = Tom Breton titola = Tito Latini uid21183 = uid21183 uid26034 = uid26034 vacuum-for-time = Shelagh Manton williamrg = William yguillemot = Yves Guillemot 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