git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git svn dcommit doesn't work with useSvnsyncProps

From
IBIlya Basin <basinilya@gmail.com>
Date
Apr 23, 2013, 16:07 UTC
Message-ID
<163892758.20130423200734@gmail.com>

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
Message 1 of 1 in “git svn dcommit doesn't work with useSvnsyncProps”
  1. Ilya BasinApr 23, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.