Skip to content

Instantly share code, notes, and snippets.

@startergo
Created September 2, 2023 19:20
Show Gist options
  • Save startergo/a467fb50dd5a58936985c455ca3a26cc to your computer and use it in GitHub Desktop.
Save startergo/a467fb50dd5a58936985c455ca3a26cc to your computer and use it in GitHub Desktop.
Migrate Archive Google Code SVN to Git

Migrate Archive Google Code SVN to Git

Requirements

  • git
  • git-svn

Setup¹

sudo apt-get install git
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git-svn

¹ Ubuntu 14.04

How To

  1. Download svn dump from Google archive.
  2. Create a local svn repo by load the svn dump.
  3. Start svn daemon.
  4. Create authors.txt to map all svn users to git users.
  5. Create a bare git repo.
  6. git svn clone.
  7. Add git remote then push.
  8. Done.
wget https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/your-google-code-project/repo.svndump.gz
gunzip repo.svndump.gz
svnadmin create /tmp/repo1
svnadmin load /tmp/repo1/ < repo.svndump
svnserve --foreground -d

Start a new terminal Window

svn log -q file:///tmp/repo1 | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors.txt
cd repo1
git remote add origin https://repo.git
git push --set-upstream origin master

authors.txt

Must map all svn users to git users.

user1 = user1 <[email protected]>
user2 = user2 <[email protected]>
(no author) = user3 <[email protected]>

Credits

@startergo
Copy link
Author

startergo commented Sep 2, 2023

Forked from here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment