So far, Struts 2 is using SVN. There are plans to move on to GIT but the plannings have not been completed yet. In addition well only move with new versions of Struts to Git. Struts 1 will stay in SVN.
Luckily there is a way to work with Git backed by SVN. This document explains, how a developer:
This page reflects some knowledge from the Git at Apache project.
git clone git://git.apache.org/struts2.git cd struts2/.git wget http://git.apache.org/authors.txt cd .. git config svn.authorsfile ".git/authors.txt" # check if your username and email are identical to those in the author file git config user.name git config user.email # if they are not identical, set the ASF values locally # git config user.name <Your Name> # git config user.email <Your Email> git svn init --prefix=originsvn/ -s https://svn.apache.org/repos/asf/struts/struts2/ git svn rebase
You might need to accept SSL certificates from Apache. Please check the fingerprint of the servers. If in doubt, ask at Struts mailing list or Apache infra.
If you are frequently asked on the certificates or if you get that error:
Unable to determine upstream SVN information from working tree history
then you should make sure you are using SVN version 1.7 (not 1.8, not 1.6). Please also consult the troubleshooting page.
You can go on for now and ignore this message. After this, youll need to fetch the old history.
git svn fetch --log-window-size 10000
Heads up: this command above will need a good while to run - please plan accordingly. When you change something in the code, you can commit it with:
git svn dcommit
This will commit all your git commits to svn. One git commit == 1 svn revision. Consider rebase. Please dont forget, there is the dry-run option, which tests the commit only.
It will output things like:
diff-tree 56bfadfc12a8129e5ea6668714fae34704242636~1 56bfadfc12a8129e5ea6668714fae34704242636
You can watch the modification with git again:
git diff-tree 56bfadfc12a8129e5ea6668714fae34704242636~1 56bfadfc12a8129e5ea6668714fae34704242636
Which will output for example:
:000000 100644 0000000000000000000000000000000000000000 e2b24b623fc1cf2d0316a48bb1d69a9eeb7e0719 A .gitignore
Create a new local branch and switch to it in GIT:
git checkout -b mybranch-svn origin/mybranch
Map the GIT branch to the according SVN branch:
git reset --hard origin/mybranch
For reference, you can override the commit url:
git svn dcommit --commit-url https://svn.apache.org/repos/asf/struts/struts2/branches/mybranch
If you would like to contribute using the GitHub tools you need to know we can only accept your work if we have your ICLA on file. Please read the document carefully, sign and send it to us. Basically this document protects you and the end users for legal problems. It allows the Apache Software Foundation to use your code and distribute it. You should receive an email a few days after you submitted it and appear in the committer index in the section unlisted CLAs.
Once done, you can clone the Apache Struts mirror on GitHub:
git clone firstname.lastname@example.org:apache/struts2.git struts2-mirror.git
Please create an issue on our issue tracker. Youll receive an issue number which you should use to create a working branch (for example WW-4196).
If you are sending a pull request, please send it to the Apache Struts teams repo and not the official mirror. We cannot accept and close pull requests there which is the reason we have an own account. You can find it here:
Please send the pull request to trunk.
It is of course possible to add us as upstream repo:
git remote add upstream email@example.com:apachestruts/struts2
You can add a remote branch from GitHub like this:
git remote add opensourceio https://github.com/opensourceio/struts.git
Pull changes with:
git pull opensourceio anotherbranch
When merge conflicts happen, these can be resolved using:
After the merge, you need to commit the changes to svn with:
git svn dcommit
When git svn messed up the repository, you just can revert the SVN revision. Reverting in SVN is basically merging a previous commit. Like:
svn merge -r1521783:1521602 . svn commit -m 'reverted wrong git svn dcommit' .