19

I want to migrate this project https://code.google.com/archive/p/majesticuo to GitHub maintaining the history.

When i try to use the 'Export to GitHub' button, it says 'The Google Code project export tool is no longer available

The Google Code to GitHub exporter tool is no longer available. The source code for Google Code projects can now be found in the Google Code Archive.'

What would be the best way to do it manually? I have no svn knowledge and know a little bit of git. Thanks so much!

niceguy335
  • 361
  • 1
  • 3
  • 7

5 Answers5

19

Updated 06 Nov 2017

It appears that you can recover and download the project's history in form of gzipped svn dump stream file. Follow these steps:

  1. Navigate to the Google Code archive page for the project. E.g. https://code.google.com/archive/p/majesticuo/
  2. Copy the download URL under Source.
  3. In the URL, change source-archive.zip to repo.svndump.gz and download the file.

Example URL:

https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/majesticuo/repo.svndump.gz

The file is a gzipped svn repository dump stream file and you can use svnadmin load tool to load it into a new repository.

kenorb
  • 155,785
  • 88
  • 678
  • 743
bahrep
  • 29,961
  • 12
  • 103
  • 150
  • 1
    This answer is not constructive. @JeffClites solution works. It's a pity that Google does not advertise the trick to replace end of the project download URL with `repo.svndump.gz`. It worked today (2017-10-05). – Stéphane Gourichon Nov 05 '17 at 09:00
  • @StéphaneGourichon Hi, I edited the answer, because I can confirm that the solution still just works (2018-05-18). – JiriHnidek May 21 '18 at 07:34
  • 2
    The `source-archive.zip` URL works for me but when I try replacing the file aprt with `repo.svndump.gz` I get an error: `AccessDenied - Anonymous caller does not have storage.objects.get access to google-code-archive-source/v2/code.google.com/ala-collectory/repo.svndump.gz.` – nickdos Sep 03 '18 at 00:02
  • @nickdos just a guess, but have you tried authenticating to Google services? – bahrep Sep 04 '18 at 09:06
  • @bahrep: How should I authenticate to "Google services", what ever that is. Could you please update your answer with instructions on how to do this? – Jarl Oct 22 '18 at 07:13
  • @Jarl that means being logged on to google with your google account https://accounts.google.com/ – bahrep Oct 22 '18 at 09:06
  • @bahrep: In that case I have tried that and still get `AccessDenied`. – Jarl Oct 24 '18 at 09:21
  • 2
    @Jarl this URL works for me: https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/majesticuo/repo.svndump.gz – bahrep Oct 24 '18 at 09:47
  • 1
    @bahrep: That one also works for me. But not this one: https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/pynxc/repo.svndump.gz – Jarl Oct 24 '18 at 14:59
  • *No source repositories were detected at `https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/certlock/repo.svndump.gz`. Please check the URL and try again.* – JamesTheAwesomeDude May 10 '21 at 09:44
10

If you navigate to your project's page in Google Code, then click on "Source" in the sidebar, and then click on "source" inside the resulting page, you'll be taken to a page with a "Download" link. That will lead to a file called "source-archive.zip", which contains some sort of archive of your project--I'm not sure how complete that it, but it does contain some svn metadata. However, if change the last part of that URL from "source-archive.zip" to "repo.svndump.gz", you'll get an svn "dump" of your repo. That should contain the full history and be convertible to git format with various svn-to-git migration tools. (I figured that out based on information in this blog post, which also lists some suggested steps for the final conversion. But if your first attempt at converting the dump fails, try other tools; there are many options and there's a bit of an art to it if your repo history is complicated.)

Jeff Clites
  • 618
  • 5
  • 10
  • Do you know anyway to do this with other repository types like Git and Mercurial? Do you know how to get all the issues and histories of the wiki pages? – Melab Jul 08 '17 at 22:33
  • @Melab: No I don't know what to do in those other cases. – Jeff Clites Jul 09 '17 at 07:52
  • 1
    Update: tried this today ang got the following error: "Access denied. Anonymous caller does not have storage.objects.get access to google-code-archive-source/v2/code.google.com//repo.svndump.gz." – casals Aug 27 '19 at 13:07
6

Here is the procedure I performed lately to move Google Code archive of gil-contributions to GitHub repo, locally without any instance of Subversion server.

  1. Follow bahred's explained to download the repo.svndump.gz archive.

  2. Create local Subversion repository and import the dump

    svnadmin create /home/mloskot/svn
    svnadmin load /home/mloskot/svn < /home/mloskot/repo.svndump
    
  3. Checkout the Subversion repo to generate the authors file

    svn checkout file:///home/mloskot/svn
    

    and find one of many scripts to generate the authors.txt.

  4. Download latest SubGit from https://subgit.com

  5. Read the SubGit importing guide, https://subgit.com/documentation/import-book.html

  6. Initialize the Git repo where SubGit will translate the Subversion repo

    subgit configure --minimal-revision 1 --layout std file:///home/mloskot/svn /home/mloskot/git
    
  7. Edit the subgit/config file generated in /home/mloskot/git/subgit/config

  8. Import the Subversion repo into Git

    subgit import /home/mloskot/git
    subgit uninstall --purge /home/mloskot/git
    
  9. Clone the Git repo, also as a verification step, and push it to GitHub

      git clone --mirror /home/mloskot/git repo
      cd repo
      git config remote.origin.mirror false
      git clone --mirror <GITHUB REPO URL>
      git remote set-url origin <GITHUB REPO URL>
      git push --all origin
      git push --tags origin
    
  10. Enjoy your code's new home!

mloskot
  • 37,086
  • 11
  • 109
  • 136
2

Cherry-picking (heh!)

  1. from bahrep's/JiriHnidek's reply for downloading the gzipped SVN "image",
  2. from mloskot's reply for svnadmin use,
  3. and Coleman Corrigan's reply describing how to use Git to import from SVN,

here are the steps I took with a project name $PROJECT archived at https://code.google.com/archive/p/$PROJECT:

wget https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/${PROJECT}/repo.svndump.gz
svnadmin create p
time zcat repo.svndump.gz|svnadmin load p
git svn init file://$(pwd)/p --stdlayout ${PROJECT}
cd ${PROJECT}
time git svn fetch --all
git remote add origin https://github.com/${USER}/${PROJECT}
git fetch origin
time git push -u origin master
cd ..
rm -rf p repo.svndump
jbatista
  • 2,747
  • 8
  • 30
  • 48
-1

Just tested the accepted answer today and got the following error:

"Access denied. Anonymous caller does not have storage.objects.get access to google-code-archive-source/v2/code.google.com//repo.svndump.gz."

There is, however, a way to import it to git, including the commit history:

  • Download the "source-archive.zip" file using the provided button/url;
  • Use the hg-git Mercurial extension to convert it to a git repository (instructions for Windows can be found here).

I just did it using an empty GitHub repository (created just for that, no README.md file) and it worked on the first try. The hg-git extension will generate a local branch on your git repo called "hg" that can be pushed to your Github remote.

casals
  • 343
  • 4
  • 10