[Kde-scm-interest] svn-all-fast-export versus the FreeBSD svn repository

Ulrich Spörlein uqs at spoerlein.net
Wed Apr 28 16:27:35 CEST 2010


On Tue, 27.04.2010 at 09:25:59 +0200, Thiago Macieira wrote:
> Em Terça-feira 20. Abril 2010, às 20.35.41, você escreveu:
> > I finally managed to invest some time and coerce the code into doing the
> > right thing for this very conversion. It's still creating some branches
> > the wrong way (only branches that were created during the cvs 2 svn
> > conversion seem to be affected).
> 
> Yeah, it's because of the way cvs2svn creates branches. I thought I had caught 
> most of the issues when doing KDE.
> 
> But, then again, cvs2svn botched the process for us, so we're not really 
> looking at the problem. That is to say, the branches in SVN itself are wrong, 
> so there's little we can do to fix it when converting to Git.
> 
> > Exporting revision 1401
> > ."cvs2svn/branches/AMANCIO" is not a known branch in repository
> > "freebsd.git" Going to create it automatically
> > ......................................    /cvs2svn/branches/AMANCIO was
> > copied from /head rev 653 .freebsd.git : branch cvs2svn/branches/AMANCIO
> > is branching from master "cvs2svn/branches/AMANCIO" is not a known branch
> > in repository "freebsd.git" Going to create it automatically
> > ......................................... 457 modifications from SVN
> > /cvs2svn/branches/AMANCIO/ to freebsd.git/cvs2svn/branches/AMANCIO done
> 
> 
> > commit 46945c89920691b8e9908583000cebb092d02a81
> > Author: cvs2svn <cvs2svn at FreeBSD.org>
> > Date:   Sat Apr 23 01:55:46 1994 +0000
> > 
> >     This commit was manufactured by cvs2svn to create branch 'AMANCIO'.
> > 
> >     svn path=/cvs2svn/branches/AMANCIO/; revision=1401
> > 
> > commit 98d78347791b039132bc0d12219bd7df13f833b7
> > Author: Andrey A. Chernov;  Black Mage <ache at FreeBSD.org>
> > Date:   Sat Apr 23 01:55:45 1994 +0000
> > 
> >     Updated to version 2.5
> > 
> >     svn path=/head/; revision=1400
> > 
> > commit 3e9c475abe03e6da25d0e9b2f921eb1c1918f70c
> > Author: Andrey A. Chernov;  Black Mage <ache at FreeBSD.org>
> > Date:   Sat Apr 23 01:50:14 1994 +0000
> > 
> >     Update sound driver to version 2.5
> > 
> >     svn path=/head/; revision=1399
> > 
> > So the branch is an successor of rev1400 and not rev 653 like it should
> > have been created. Can you give me a clue as to how I might proceed here?
> 
> That's a different issue, one that a colleague has run into yesterday too. So 
> I'm placing the KDE mailing list for the conversion on Cc.
> 
> When creating a branch, the tool simply takes the latest commit from the 
> source branch and works off from there.

Yes, I thought as much ...

> As you can see, it can find which SVN revision was the origin in SVN. It's a 
> matter of matching that SVN revision to a Git commit it made. Remember that in 
> SVN you can branch off a past revision that wasn't a commit to the files and 
> paths affected.

Hmmm, this complicates things of course, also the branchpoint might not
even have been created in git, as it was ignored by some rule. The newly
created branch however might be of interest to the conversion.

> The solution, that I can think of, is to ensure that all commits are marked 
> with git-fast-import, and that the list of commits that were exported be kept 
> in memory in the tool (QVector<int> in the Repository class is probably 
> enough). 

I intent to use svn2git incrementally to keep up-to-date git repos of
some svn repos, so this is not exactly what I had in mind. Instead, I'd
try to use the meta-data that svn2git is adding to find the suitable
branch point.

In fact, this could be combined. When first hitting a branch point,
check the vector if we know where to branch, otherwise do something
like:

% git log --grep="svn path=.*; revision=.*"

and use this to map svn revisions to git sha1s. This only needs to be
done on an as-needed basis.

> Later, when a branch is being made, it searches what was the SVN commit 
> immediately prior to the the source revision (qLowerBound will do that) and 
> tells git-fast-import that that's the source. In Repository:;createBranch, 
> where it says:
> 
>     fastImport.write("reset " + branchRef + "\nfrom " + branchFromRef + 
> "\n\n");
> 
> It needs to replace 
> 	"\nfrom " + branchFromRef
> with
> 	"\nfrom :" + QByteArray::number(mark)
> 
> Note, however, that this list of commits would not be saved, which means this 
> process would work only for a full run of the tool. Incremental runs wouldn't 
> load previous marks and the tool wouldn't know which commits it exported.

My C++ fu is pretty weak, if someone could send me some rough patches
to get me started I might be able to finish and debug them.

Also, please have a look at
https://www.spoerlein.net/gitweb/?p=svn2git.git;a=commitdiff;h=2eab29849a16b6ffa4f78d0392088e98b059d960
or git://acme.spoerlein.net/svn2git.git

where I implemented the svn "replace" action for directories, which is
required to get the main branches of the FreeBSD svn repo converted
correctly.

Bye,
Uli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-scm-interest/attachments/20100428/fc515049/attachment.sig 


More information about the Kde-scm-interest mailing list