logo_kerberos.gif

Using git-svn (historical)

From K5Wiki
Revision as of 17:41, 17 May 2011 by TomYu (Talk | contribs)

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 start from cloning the GitHub repository and end up with a git-svn repository that you can use to commit to the master SVN repository: [XXXX needs testing]

git clone git://github.com/krb5/krb5-anonsvn krb5-github
cd krb5-github
git svn init -s --rewrite-root=svn://anonsvn.mit.edu/krb5 --prefix=origin/ svn+ssh://svn.mit.edu/krb5
git svn fetch
git update-ref -d refs/remotes/origin/HEAD
git update-ref -d refs/remotes/origin/master
git checkout -b trunk origin/trunk
git branch -d master

The git update-ref commands are to delete some spurious branches that are caused by the existence of a SVN branch named "HEAD" (don't ask) in our SVN repository.

The git-svn repository created using the above commands may be updated using either git svn fetch (updates from the master SVN repository) or git fetch (updates from GitHub).

Alternatively, you might use the following git svn init command instead of the one above:

git svn init -s --commit-url=svn+ssh://svn.mit.edu/krb5 --prefix=origin/ svn://anonsvn.mit.edu/krb5

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

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

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 in the behavior of git-svn, 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 after 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 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]

Personal tools