All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Basin <basinilya@gmail.com>
To: git@vger.kernel.org
Subject: git svn dcommit  doesn't work with useSvnsyncProps
Date: Tue, 23 Apr 2013 20:07:34 +0400	[thread overview]
Message-ID: <163892758.20130423200734@gmail.com> (raw)

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

                 reply	other threads:[~2013-04-23 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163892758.20130423200734@gmail.com \
    --to=basinilya@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.