Mon, 09 Aug 2010 15:09:03 +0200, Torgny Nyblom wrote:

> On 2010-08-03 11:24, Pauli Virtanen wrote:
>> Hi all,
>>
>> I noticed that svn2git (from http://gitorius.org/svn2git) commit
>>
>>          209e6ce Try and branch from the correct svn revision rather
>>          then the last one.
>>
>> can cause corrupt trees to appear in the repository history.
> [...]
> 
> I've commited a fix, please test and report any failures.

Seems to work for the Numpy repo, at least for this commit.

However, the logic is not correct, and some other repositories may still 
be corrupted:

    const int closestCommit = *qLowerBound(commitMarks.keys(),
                                           branchRevNum);
    if(exportedCommits.contains(closestCommit))
    {
        pathFound = whether closestCommit contains changes in the branch
        if(pathFound) {
        ...
        } else {
            qWarning() << branch << "in repository" << name << "is 
branching from a revision that doesn't touch the branch from path, 
branching from current revision"
            branchFromRef = branchFrom.toUtf8();
            if (!branchFromRef.startsWith("refs/"))
                branchFromRef.prepend("refs/heads/");
        }
     }

In SVN it's perfectly OK to do something like this

        r1234   change in /trunk
        r1235   change in /branch/foo
        r1236   change in /trunk
        r1237   copy /tr...@1235 -> /branches/bar

After this /branches/bar is identical to trunk as it was in r1234, not in 
r1236.

So it seems to me there's still a possibility of corruption, although it 
doesn't seem the Numpy repository hits this corner case.

Self-contained example:

    ***

mkdir xxx
svnadmin create xxx
export REPO=file://$PWD/xxx
svn mkdir -m "trunk" $REPO/trunk # r1
svn mkdir -m "branches" $REPO/branches # r2
svn co $REPO/trunk xxx-trunk
pushd xxx-trunk/
echo a > foo
svn add foo
svn commit -m "commit 1" foo # r3
svn cp -m "copy foo" $REPO/trunk $REPO/branches/foo # r4
popd
svn co $REPO/branches/foo xxx-foo
pushd xxx-foo/
echo b > foo
svn commit -m "commit 2 (foo)" . # r5
popd
pushd xxx-trunk/
echo "c" > foo
svn commit -m "commit 3" . # r6
popd
svn cp -m "copy baz" $REPO/tr...@5 $REPO/branches/baz # r7
svn co $REPO/branches/baz xxx-baz
cat <<EOF > xxx.rules
create repository xxx-git
end repository
match /trunk/
    repository xxx-git
    branch master
end match
match /branches/([^/]+)/
    repository xxx-git
    branch \1
end match
EOF
svn-all-fast-export --rules xxx.rules xxx/
git clone xxx-git xxx-git2
pushd xxx-git2
git checkout baz
popd
cat xxx-git2/foo # gives "c"
cat xxx-baz/foo  # gives "a" !

    ***

BTW, how about adding a test suite?

Cheers,
Pauli

_______________________________________________
Kde-scm-interest mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-scm-interest

Reply via email to