Hi list.
Things often go wrong with git svn. Often you have to try different
svn layouts and path ignores.
This is why I prefer to do the long lasting svn mirror once and then
clone the mirror to git with --use-svnsync-props. Why use this option
at all? Because without it the commits have different commit message
and are are valid only on local machine.

Till now I only imported from svn and never exported. And today I get
this:
    $ git svn info # or rebase, or dcommit
    Unable to determine upstream SVN information

I found a workaround:
    - delete .git/svn/.metadata (once).
    - to do 'git svn dcommit'  temporarily change the svn url to the
    real one
    - to do 'git svn fetch' temporarily change the svn url to the
    mirror

or
    - import a few commits from the upstream svn repo to init the
    metadata
    - switch to the mirror

    
test script:

    testdir=`mktemp -d`
    echo "testdir = $testdir"
    cd "$testdir"
    
    pushurl="file://$testdir/test.svn"
    echo "creating repo test.svn"
    svnadmin create test.svn
    svn mkdir -m "" "$pushurl/trunk" "$pushurl/tags" "$pushurl/branches"
    
    echo "checking out"
    svn checkout "$pushurl/trunk" "test"
    cd "test"
    
    echo "committing"
    echo x > f
    svn add f
    svn commit -mx >/dev/null
    
    svn cp -m"create testbranch" "$pushurl/trunk" "$pushurl/branches/testbranch"
    
    for ((i=0; i<4; i++)); do
    echo $i > f
      svn commit -m"$i" >/dev/null
    done
    
    svn cp -m"create testtag" "$pushurl/trunk" "$pushurl/tags/testtag"
    
    cd ..
    rm -rf test
    
    mkdir gitsvn
    cd gitsvn
    
    rourl=file://`pwd`/test.svn
    
    svnadmin create "test.svn"
    echo '#!/bin/sh' > "test.svn/hooks/pre-revprop-change"
    chmod +x "test.svn/hooks/pre-revprop-change"
    
    svnsync init "$rourl" "$pushurl"
    svnsync sync "$rourl"
    
    
    git svn init --stdlayout $pushurl test
    cd test
    git config svn-remote.svn.pushurl "$pushurl"
    
    # need to fetch one revision from pushurl for proper metadata init
    git svn fetch --revision BASE:1
    
    # switching to mirror
    git config svn-remote.svn.useSvnsyncProps 1
    git config svn-remote.svn.url "$rourl"
    
    # hiding real repo
    mv $testdir/test.svn{,.1}
    
    # feetching from mirror
    git svn fetch
    
    # restoring real repo
    mv $testdir/test.svn{.1,}
    
    # here's the error: Unable to determine upstream SVN information from 
working tree history
    git svn info
    git svn rebase
    
    # switching to real repo
    git config svn-remote.svn.useSvnsyncProps 0
    git config svn-remote.svn.url "$pushurl"
    
    # now it works:
    git svn info
    git svn rebase


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to