Using git-svn it is possible to use all the cool features of git that allow you to work off-line and still commit your work to a central SVN repository.

This page explains how to do this for DebianInstaller.

Creating your own checkout

You can of course run git-svn yourself to create a checkout. Note that this is a fairly slow process and requires a lot more disk space than needed for the eventual repository.

/!\ An easier way to get started can be found further down this page.

Full checkout

A full checkout using

$ git-svn clone svn+ssh://svn.debian.org/svn/d-i -T trunk -b branches -t tags

takes quite a while to complete (imagine running 'svn up' for 47880 revisions...).

It contains over 730000 objects and initially requires 6.3 GB of diskspace. Luckily this can be compressed to 875MB (!) by running 'git-gc'.

The full checkout includes tags and branches (see below). It does not contain the "people" directory, but ten again, it can be argued that git was designed exactly to avoid the need for a people directory.

/!\ See [http://bugs.debian.org/430091 #430091] for a description of an issue you will run into during a full checkout.

Partial checkout

It is also possible to start a checkout of the repository at any commit. This could be an interesting option if you're only interested in the current state and not in all the history, or if you are short on disk space.

To get just the current version of the repository (without tags and branches), you'd use:

$ git-svn init svn+ssh://svn.debian.org/svn/d-i -T trunk
$ git-svn fetch -r HEAD

This is basically the smallest checkout you can do.

To also get a bit of history (in this example since the release of Etch), you'd use:

$ git-svn init clone svn+ssh://svn.debian.org/svn/d-i -T trunk
$ git-svn fetch -r 45723:HEAD

This last will result in an initial archive of about 450MB. After running 'git-gc' this is compressed to 170MB, which means it is only half the size of an SVN trunk checkout (and that includes some 4 months of history!).

Shortcut to creating a full checkout

There is a tarball available for download from alioth that contains a git repository for a full git-svn checkout at about revision r47880 (FIXME: replace with exact revision).

Follow these steps to create your own local D-I git-svn repo with full history (you probably need to be running testing/unstable):

Using svn:ignore info

svn:ignore info can be used to exclude files from being listed as "changes" by git-status, but needs to be updated semi-manually, and can only be updated from svn to git.

To set svn:ignore info for your git repository, run:

$ echo "## Excludes below imported from SVN (svn:ignore)" >> .git/info/exclude
$ git-svn show-ignore >> .git/info/exclude

If you need to update this, you should first delete the current excludes (only what was added with the previous commands!) and then run these commands again.

See also [http://bugs.debian.org/424136 #424136].

Tags and branches

Tags and branches are preserved using what's called "git remotes". This means that there are no real git tags and branches visible, but that the SVN trunk, tags and branches are tracked as separate repositories. Downside is that you need to switch to to the remotes individually before you can update them.

All tags and branches are listed under .git/refs/remotes/ and can be checked out, but it is somewhat confusing as all old schemes for using tags and branches are there too...

The still relevant branches are:

The relevant tags are:

And there is also the branch remotes/fromcvs and tags remotes/tags/fromcvs.

Accessing tags and branches

So, to get to tags for packages, you have to:

$ git reset --hard tags/packages

This immediately increases the diskspace needed to 2.4GB (307000+ files) because you now have all versions of all components "unpacked". For example:

$ ls anna/
0.054/ 0.055/ 0.056/ ....

Checking out tags/installer requires 1.4 GB.

To get back to trunk:

$ git reset --hard trunk

I have no idea yet how it would be possible to create tags/branches using commits from the git repository. It seems tricky because it basically requires separate checkouts. Conclusion: everything is there, but it's not really pretty.

Committing changes back to SVN

If you plan to commit directly from git-svn to SVN, please make sure that you are subscribed to the SVN commit messages for [http://packages.qa.debian.org/debian-installer debian-installer in the PTS], so that you can check if your commits landed correctly and you should probably use git-like log entries (short description of change, optionally followed by a blank line and longer description).

You should probably create a ~/.gitconfig to set your name/email:

$ cat ~/.gitconfig
[user]
        name = "Frans Pop"
        email = "fjp@debian.org"

/!\ Note: releasing packages (uploading) should always be done from an SVN checkout!

Time traveling

The git repository makes it really easy to travel through time and see how D-I looked at any time in its history. Here's an example to revision 500, 10 Feb 2001:

$ git-svn find-rev r500
8cc534cef204753a9ac404fc8b92a0104ebd41b8
$ git checkout 8cc534ce
$ ls
anna  build  doc  kernel-image-di  libd-i  main-menu  retriever  rootskel  tools
$ git checkout master

References

The following documents can be useful to get started: