git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jukka Zitting" <jukka.zitting@gmail.com>
To: git@vger.kernel.org
Subject: git-svn: Trouble after project has moved in svn
Date: Thu, 17 Jul 2008 01:12:00 +0300	[thread overview]
Message-ID: <510143ac0807161512w44a612bcndc53713639b0b70a@mail.gmail.com> (raw)

Hi,

Somewhat related to the recent thread about Apache Synapse, I'm having
trouble making a git-svn clone of a project that has been moved around
in a Subversion repository.

See the script at the end of this message for a simple test case that
does the following svn commits:

    PREPARE: creates projectA with the standard trunk,branches,tags structure
    VERSION1: first version of README.txt in projectA/trunk
    TAG1: tags projectA/trunk to projectA/tags/v1
    MOVE: moves projectA to projectB
    VERSION2: second version of README.txt in projectB/trunk
    TAG2: tags projectB/trunk to projectB/tags/v2

The resulting repository structure is:

    /projectB/
        trunk/
            README.txt # version 2
        branches/
        tags/
            v1/
                README.txt # version 1
            v2/
                README.txt # version 2

Here's the git commit graph created by the test case:

    * TAG2 <- refs/remotes/tags/v2
    | * VERSION2 <- refs/remotes/trunk
    |/
    * MOVE
    * VERSION1 <- refs/remotes/trunk@3
    | * MOVE <- refs/remotes/tags/v1
    | * TAG1 <- refs/remotes/tags/v1@3
    |/
    * PREPARE <- refs/remotes/tags/v1@1

The most pressing issue is that the refs/remotes/tags/v1 branch starts
directly from the first PREPARE commit instead of VERSION1. Also, the
branch point of refs/remotes/tags/v2 seems to be incorrect, it should
be based on the VERSION2 commit instead of MOVE.

A more accurate commit graph would be:

    * TAG2 <- refs/remotes/tags/v2
    * VERSION2 <- refs/remotes/trunk
    * MOVE
    | * MOVE <- refs/remotes/tags/v1
    | * TAG1
    |/
    * VERSION1
    * PREPARE

Or even (but I guess git-svn needs to map each svn commit to at least
one git commit, so this probably wouldn't work):

    * VERSION2 <- refs/remotes/trunk, refs/remotes/tags/v2
    * VERSION1 <- refs/remotes/tags/v1
    * PREPARE

I tried working my way through git-svn.perl to figure out how to
improve the way git-svn tracks svn moves, but so far I couldn't figure
out how to do that. Any ideas or hints?

BR,

Jukka Zitting

=====
#!/bin/sh

REPO=`pwd`/repo
svnadmin create $REPO

svn checkout file://$REPO checkout
cd checkout

svn mkdir projectA
svn mkdir projectA/trunk
svn mkdir projectA/branches
svn mkdir projectA/tags
svn commit -m PREPARE

echo VERSION1 > projectA/trunk/README.txt
svn add projectA/trunk/README.txt
svn commit -m VERSION1

svn copy projectA/trunk projectA/tags/v1
svn commit -m TAG1
svn update

svn move projectA projectB
svn commit -m MOVE

echo VERSION2 > projectB/trunk/README.txt
svn commit -m VERSION2

svn copy projectB/trunk projectB/tags/v2
svn commit -m TAG2
svn update

mkdir ../git
cd ../git

git svn init -s file://$REPO/projectB
git svn fetch

             reply	other threads:[~2008-07-16 22:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 22:12 Jukka Zitting [this message]
2008-07-17  8:55 ` git-svn: Trouble after project has moved in svn Michael J Gruber
2008-07-18 18:27 ` Jukka Zitting

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=510143ac0807161512w44a612bcndc53713639b0b70a@mail.gmail.com \
    --to=jukka.zitting@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).