Using git-svn (historical)

From K5Wiki
Revision as of 11:11, 17 May 2011 by TomYu (talk | contribs) (For committers)

Jump to: navigation, search

This guide is still incomplete.

For committers

If you have commit access to the master SVN repository, you may wish to configure a git-svn repository that allows you to review and commit pull requests from contributors who do not have commit access. To make it easier for non-committers to interact with both Git and SVN, use the svn://anonsvn.mit.edu/krb5 URL as the SVN root that git-svn writes into the commit objects.

To set up such a git-svn repository that you fetch from the master SVN repository, [XXXX test this; it looks like rewrite-root breaks on a SVK merge ticket, at least in Git (tested on Ubuntu Lucid). also note merge ticket incompatibility]

git init krb5-gitsvn
cd krb5-gitsvn
git svn init -s --rewrite-root=svn://anonsvn.mit.edu/krb5 svn+ssh://svn.mit.edu/krb5
git svn fetch

This has the advantage of fetching the commits from SVN using a secure transport.

Fetching all those revisions from svn.mit.edu might take a really long time (many hours), so alternatives that begin with cloning the existing git-svn mirror might be preferable. If you have an existing git-svn repository whose SVN root is the master SVN repository, you could use git filter-branch to rewrite the URLs, or start over by cloning the published git-svn mirror.

Merge ticket incompatibility

The git-svn mirror of our master SVN repository has some quirks.

Since release 1.6.6 of Git, git-svn can read merge tickets generated by SVK and SVN, and uses these merge tickets to create merge commits in Git. Some developers created git-svn repositories prior to this change, and these repositories have incompatible commit histories for otherwise identical tree histories. The commits that are most problematic in this way are XXXXX. The git-svn mirror that we host on krbdev.mit.edu and GitHub does not contain any merges that would be created by Git releases prior to 1.6.6. If you have an existing git-svn repository that you would like to make compatible with the published git-svn mirror, you will probably need to use the git filter-branch with some graft points that delete the extra parent commits of the merge commits. You will need to rerun git svn fetch afterward (which should operate locally without contacting the SVN repository if nothing has changed in SVN) to rebuild the git-svn metadata. [XXXX more details later]