All of lore.kernel.org
 help / color / mirror / Atom feed
* git svn dcommit  doesn't work with useSvnsyncProps
@ 2013-04-23 16:07 Ilya Basin
  0 siblings, 0 replies; only message in thread
From: Ilya Basin @ 2013-04-23 16:07 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-23 16:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 16:07 git svn dcommit doesn't work with useSvnsyncProps Ilya Basin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.