Differences between revisions 21 and 22
Revision 21 as of 2011-01-17 22:36:09
Size: 7038
Editor: JoeyHess
Comment:
Revision 22 as of 2012-07-16 21:36:24
Size: 472
Comment: removing obsolete content on git-svn gateway to former SVN repository for d-i
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
== Old page ==


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.

== Using Joey Hess' repository ==

Joey Hess has [[http://lists.debian.org/debian-boot/2007/11/msg00200.html|announced]] the availability of a git repository of DebianInstaller.

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

 * {{{aptitude install git-svn}}} # and optionally: {{{git-completion}}}
 * {{{git clone git://git.debian.org/~joeyh/d-i.git}}}
This repository can be used to prepare patches.

(This repository was not being updated, due to commits that broke git-svn, but that is now resolved, and a new
build of this repository is available for cloning at the above location.)

== Using Joey's repository to bootstrap git-svn ==

You can also set up your checkout so that changes can be committed back using {{{git-svn}}} and can be updated in the same fashion.

To be able to {{{git svn rebase}}} and to do commits in trunk you need to tweak the .git info (note that interaction with joey's git repo will be broken after these commands):

{{{
git config remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch origin
git svn init svn+ssh://svn.debian.org/svn/d-i/trunk
git svn fetch
}}}

== 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.

==== 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}}}'.

Running '{{{git-repack}}}' is also a good idea. This should trim it down substantially, but will take some time: {{{
git repack -f -a -d --depth=250 --window=250
}}}

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

==== 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 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!).

== 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.

== 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:

 * {{{remotes/d-i}}}
 * {{{remotes/packages}}}
The relevant tags are:

 * {{{remotes/tags/installer}}}
 * {{{remotes/tags/packages}}}
 * {{{remotes/tags/scripts}}}
 * {{{remotes/tags/manual}}}
 * {{{remotes/tags/d-i}}}
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}}}

This page is obsolete

DebianInstaller has switched natively to git, so git-svn no longer need be used.

References

The following documents can be useful to get started: