{"thread":{"id":"33582","subject":"git svn dcommit doesn't work with useSvnsyncProps","startedAt":"2013-04-23T16:07:34Z","lastAt":"2013-04-23T16:07:34Z","messageCount":1,"participants":["Ilya Basin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"215245","messageId":"163892758.20130423200734@gmail.com","threadId":"33582","inReplyTo":null,"subject":"git svn dcommit doesn't work with useSvnsyncProps","fromName":"Ilya Basin","fromEmail":"basinilya@gmail.com","sentAt":"2013-04-23T16:07:34Z","receivedAt":"2013-04-23T16:07:34Z","isPatch":false,"sender":{"key":"basinilya@gmail.com","avatar":null},"body":"Hi list.\nThings often go wrong with git svn. Often you have to try different\nsvn layouts and path ignores.\nThis is why I prefer to do the long lasting svn mirror once and then\nclone the mirror to git with --use-svnsync-props. Why use this option\nat all? Because without it the commits have different commit message\nand are are valid only on local machine.\n\nTill now I only imported from svn and never exported. And today I get\nthis:\n    $ git svn info # or rebase, or dcommit\n    Unable to determine upstream SVN information\n\nI found a workaround:\n    - delete .git/svn/.metadata (once).\n    - to do 'git svn dcommit'  temporarily change the svn url to the\n    real one\n    - to do 'git svn fetch' temporarily change the svn url to the\n    mirror\n\nor\n    - import a few commits from the upstream svn repo to init the\n    metadata\n    - switch to the mirror\n\n    \ntest script:\n\n    testdir=`mktemp -d`\n    echo \"testdir = $testdir\"\n    cd \"$testdir\"\n    \n    pushurl=\"file://$testdir/test.svn\"\n    echo \"creating repo test.svn\"\n    svnadmin create test.svn\n    svn mkdir -m \"\" \"$pushurl/trunk\" \"$pushurl/tags\" \"$pushurl/branches\"\n    \n    echo \"checking out\"\n    svn checkout \"$pushurl/trunk\" \"test\"\n    cd \"test\"\n    \n    echo \"committing\"\n    echo x > f\n    svn add f\n    svn commit -mx >/dev/null\n    \n    svn cp -m\"create testbranch\" \"$pushurl/trunk\" \"$pushurl/branches/testbranch\"\n    \n    for ((i=0; i<4; i++)); do\n    echo $i > f\n      svn commit -m\"$i\" >/dev/null\n    done\n    \n    svn cp -m\"create testtag\" \"$pushurl/trunk\" \"$pushurl/tags/testtag\"\n    \n    cd ..\n    rm -rf test\n    \n    mkdir gitsvn\n    cd gitsvn\n    \n    rourl=file://`pwd`/test.svn\n    \n    svnadmin create \"test.svn\"\n    echo '#!/bin/sh' > \"test.svn/hooks/pre-revprop-change\"\n    chmod +x \"test.svn/hooks/pre-revprop-change\"\n    \n    svnsync init \"$rourl\" \"$pushurl\"\n    svnsync sync \"$rourl\"\n    \n    \n    git svn init --stdlayout $pushurl test\n    cd test\n    git config svn-remote.svn.pushurl \"$pushurl\"\n    \n    # need to fetch one revision from pushurl for proper metadata init\n    git svn fetch --revision BASE:1\n    \n    # switching to mirror\n    git config svn-remote.svn.useSvnsyncProps 1\n    git config svn-remote.svn.url \"$rourl\"\n    \n    # hiding real repo\n    mv $testdir/test.svn{,.1}\n    \n    # feetching from mirror\n    git svn fetch\n    \n    # restoring real repo\n    mv $testdir/test.svn{.1,}\n    \n    # here's the error: Unable to determine upstream SVN information from working tree history\n    git svn info\n    git svn rebase\n    \n    # switching to real repo\n    git config svn-remote.svn.useSvnsyncProps 0\n    git config svn-remote.svn.url \"$pushurl\"\n    \n    # now it works:\n    git svn info\n    git svn rebase\n"}]}