This tutorial describes how to move from SVN to Github, and does not force you to do so. Piwigo.org SVN repository is still alive and there is no plan to shut it down.
Since November 2014, the plugins repository and the translation platform both support Github repositories, in addition to our Subversion repository. That mean you can use the power of Github (issues, forks, pull-requests) and seamlessly integrate with piwigo.org (no more need of manual releases and/or git/svn mirrors).
This tutorial will guide you in the process to migrate your SVN repository to Github without loosing its history. It is inspired by Atlassian tutorial for migrating to Bitbucket but cleaned and adapted for Github. It is adapted for plugins with only one branch (trunk), if you have branches and/or tags on your plugin and wish to migrate them, please refer to the original tutorial.
I assume you will start with a fresh OS but you certainly have some or all of the required software. (The process was tested on Windows 7 and Ubuntu 14).
You can get Java JRE on Oracle website.
Subversion binaries can be found on Apache website.
Also install mysysGit containing both core Git and Git SVN.
You will need these packages :
openjdk-7-jre
(or openjdk-8-jre
)subversion
git
git-svn
You will also need a little tool created by Atlassian: svn-migration-scripts.jar.
If you have several repositories to migrate you can also use this NodeJS script I (Mistic) created to migrate my 25 plugins: piwigo-svn2github.js.
In order to get a consistent commit history on Github you will have to tell Git SVN who is who. Open a terminal where svn-migration-scripts.jar
is located (Shift+Click on Windows or right-click→Git Bash Here) and enter the following command:
java -jar svn-migration-scripts.jar authors http://piwigo.org/svn/extensions/YOURPLUGIN > authors_YOURPLUGIN.txt
This will create a TXT file with the following syntax:
j.doe = j.doe <j.doe@mycompany.com> m.smith = m.smith <m.smith@mycompany.com>
Left part is Subversion login, right part is Github login and email.
Now modify the right part of each line to match an actual Github accounts. The email must be one of the emails associated to the Github account.
You will certainly get TranslationTeam
in this file, the SVN user used to commit language files. Complete the line as following:
TranslationTeam = Piwigo-TranslationTeam <translate-github@piwigo.org>
Also if plg
or mistic100
made changes in your plugin, use theses:
plg = plegall <plg@piwigo.org> mistic100 = mistic100 <mistic@piwigo.org>
For any other users, replace mycompany.com
by piwigo.org
.
And of course don't forget to specify the correct mapping for your own account!
Open your terminal on your working directory and type:
git svn clone --authors-file=authors_YOURPLUGIN.txt http://piwigo.org/svn/extensions/YOURPLUGIN
This will fetch all commits on your plugin and create locally all relevant Git commits.
Now it's time to push your plugin to Github.
Create a new repository. You must leave it empty (no README.md, no LICENSE, no .gitignore).
Still in your terminal (on windows the previous command should have created a new folder /YOURPLUGIN, so redo right-click→Git Bash Here) type:
git remote add origin https://github.com/YOURLOGIN/YOURREPOSITORY git push -u origin --all
Hooray ! Your plugin is now published to Github.