TASVideos

Tool-assisted game movies
When human skills are just not enough

Feos / Google Code Recovery

How to recover a Google Code SVN Project and migrate to Github


Google Code shut down a year ago, and recently also their “Migrate to Github” feature was disabled.

Because I have/had also a old project hosted (and some people where asking about it recently), I had to find a way on how to migrate the project to Github anyway.

I did these steps

  1. Download the svn dump'ed repo:
      wget https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/spring-security-facelets-taglib/repo.svndump.gz
  2. Unzip:
      gunzip repo.svndump.gz
  3. Create the repo:
      svnadmin create /tmp/testgc
  4. Restore it:
      svnadmin load /tmp/testgc/ < repo.svndump
  5. Launch a local svn daemon:
      svnserve --foreground -d
  6. In another terminal, checkout the repo from localhost in order to generate authors.txt:
      svn checkout svn://localhost/tmp/testgc/ testgc-svn
  7. Enter the svn repo:
      cd testgc-svn/
  8. Dump the authors to the list:
      svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > ../authors.txt
  9. Edit the file so that each name on the left remains the same, and on the right you have git hosting site account names for every person and their email addresses in the brackets (resolve different svn credentials a single person might have with the same git credential)
      author1@mail.com = author1 <author1@mail.com>
      author1 = author1 <author1@mail.com>
      author2 = author2 <author2@mail.com>
  10. Exit the svn repo:
      cd ..
  11. Clone your repo now using git svn [1]:
      git svn --stdlayout -A authors.txt clone svn://localhost/tmp/testgc/
  12. Go into the cloned git repo:
      cd testgc/
  13. Add the upstream github repo:
      git remote add origin https://github.com/domdorn/spring-security-facelets-taglib.git
  14. Push it:
      git push --set-upstream origin master
  15. Till now, we only have the trunk / master branch
  16. Get atlassians svn-migration-scripts.jar from https://bitbucket.org/atlassian/svn-migration-scripts/downloads:
      wget https://bitbucket.org/atlassian/svn-migration-scripts/downloads/svn-migration-scripts.jar
  17. Run the scripts and expect the suggested actions:
      java -Dfile.encoding=utf-8 -jar svn-migration-scripts.jar clean-git
  18. If you like what you see (usually you do..), perform the actions:
      java -Dfile.encoding=utf-8 -jar svn-migration-scripts.jar clean-git --force
  19. After this i had a branch structure like this:
      git branch -a
     * master
      remotes/origin/0.2_nate
      remotes/origin/0.4_gblaszczyk
      remotes/origin/jsf-1.2-spring-2
      remotes/origin/jsf-1.2-spring-3
      remotes/origin/jsf-2.0-spring-2
      remotes/origin/jsf-2.0-spring-3
      remotes/origin/master
      remotes/origin/site
      remotes/origin/site@17
      remotes/origin/tags/0.1
      remotes/origin/tags/0.3_jsf-1.2-spring-2
      remotes/origin/tags/0.3_jsf-1.2-spring-3
      remotes/origin/tags/0.3_jsf-2.0_spring-2
      remotes/origin/tags/0.3_jsf-2.0_spring-3
      remotes/origin/tags/0.5
      remotes/origin/trunk
  20. Checkout each branch (except tags and trunk) and push it:
      for i in `git branch -r | grep -v 'tags\|trunk' `; do git checkout ${i/origin\// }; git push; done
  21. Push the branches:
      git push --all origin
  22. Checkout each tag and create a tag with the same name:
      for i in `git branch -r | grep 'tags'`; do git checkout $i; git tag ${i/origin\/tags\// }; done
  23. Push the tags:
      git push --tags origin

Thanks to @chrsmith for responding quickly to my google code email (4 minutes, wow!) and telling me about how to download the repo in the svn dump file format.

Thanks to Atlassian for their svn migration scripts

You can see the result of this work at my Spring Security JSF Taglib Github Project.


[1]: Use the --no-metadata switch, if you don't want every commit message to contain "git-svn-id ...", or clean it up in some other way, as mentioned at http://stackoverflow.com/questions/16092509/how-to-remove-svn-url-from-commit-messages


Combined RSS Feed
Feos/GoogleCodeRecovery last edited by feos on 2017-06-02 18:44:09
Page info and history | Latest diff | List referrers | View Source