DJabberd now lives on git and github
Alex Vandiver
alexmv at bestpractical.com
Tue May 25 01:08:41 UTC 2010
On Mon, 2010-05-24 at 17:27 -0700, Yann Kerherve wrote:
> So maybe there is a better way of working around the 'svn mv' that
> happend back then, if you know it, please chime in by annoting the
> rough steps that we took:
You want to use .git/info/grafts, and filter-branch. They're the
power-tools which are almost always necessary to do this kind of small
cleanup after a conversion of a complicated repository. For instance,
they're what I used to stitch together the 6 different repositories that
RT has lived in over time -- fetch all of the repositories into one
central place, graft them together, and filter-branch to make the grafts
permanent.
> git svn clone -A ~/svn_authors --stdlayout http://code.sixapart.com/svn/djabberd
>
> cd djabberd
>
> ls -d DJabberd* > /tmp/subrepo
>
> for i in `cat /tmp/subrepo`; do git checkout -b $i master; git reset
> --hard master; git filter-branch --subdirectory-filter $i; rm -r
> .git/refs/original; done
>
> for i in bench bin dev doc etc examples website debian; do git co -b
> $i master; git filter-branch --subdirectory-filter $i; rm -rf
> .git/refs/original; done
>
> git co DJabberd
I don't have your svn_authors, so the SHAs will be wrong here (but it
fou want to follow along, they're accurate for a git-svn clone with no
authors). But the idea is:
* Use `gitk` to find the SHA of the commit you want to reparent -- it
should be the earliest commit in the DJabberd branch. Without a
svn-authors file, it's 3b4e27e. For the one on github, it's 4f36798.
* Use `git svn find-rev r683` to find the SHA of the commit that
preceded that. For a clone without a svn-authors file, it's 4268f9b.
* Make a file .git/info/grafts with contents of:
<full sha you want to change> <full sha of parent to set it to>
So, for my repo, it's:
3b4e27eb7200cbb72b95f944b9ff330bfbcfb7db 4268f9b203238e17f19095abad92d523a86dd7c8
* Check, using `gitk`, that this results in the tree you want.
* This graft is still local, though, and pushing won't include it. To
rewrite it into the tree, (which will change all commits descended from
it) you need to filter-branch it. Use `git filter-branch DJabberd` to
walk the commit tree and remake the commits.
* `rm -rf .git/refs/original` as you did above
Ideally, you would go back through and remove commits which touched
{bench,bin,dev,doc,etc,examples,website,debian} before you did the
graft, so you didn't have duplicate commits for those bits of history.
But better too much than too little.
- Alex
More information about the Djabberd
mailing list