git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Grimm <koreth@midwinter.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Joakim Tjernlund <joakim.tjernlund@transmode.se>,
	git@vger.kernel.org
Subject: Re: [PATCH] git-svn: allow dcommit to retain local merge information
Date: Wed, 13 Jun 2007 23:30:58 -0700	[thread overview]
Message-ID: <4670E0A2.9060103@midwinter.com> (raw)
In-Reply-To: <20070613092328.GA30318@muzzle>

Eric Wong wrote:
>  Joakim/Steven:
>    Any further testing and test cases would be appreciated.  Be very
>    careful with real-world repositories, and run dcommit with the
>    '-n' flag before actually committing to verify the diffs are sane.
>   

I poked at this some tonight with an eye toward the use case of using 
git to merge svn branches. I ran into one inconvenience and one bug. 
I'll try playing with the "use lots of git branches to develop on one 
svn branch" use case some too, but for now, here are the notes I took, 
along with the commands if anyone wants to reproduce what I did. 
Hopefully this won't be too annoying to read. The bug is near the bottom.

svn repo with a trunk and a branch, each with changes (no conflicts at 
first, keep it simple to start)

$ svnadmin create svnrepo
$ svn co file://`pwd`/svnrepo svnclient
$ cd svnclient
$ mkdir trunk tags branches
$ echo test file number 1 > trunk/testfile1
$ echo test file number 2 > trunk/testfile2
$ svn add *
$ svn commit -m "initial commit"
$ echo trunk change 1 >> trunk/testfile1
$ svn commit -m "trunk change 1"
$ echo trunk change 2 >> trunk/testfile2
$ svn commit -m "trunk change 2"
$ svn cp trunk branches/mybranch
$ svn commit -m "make a branch"
$ echo trunk change 3 >> trunk/testfile1
$ svn commit -m "post-branch change in trunk"
$ echo branch change 1 >> branches/mybranch/testfile2
$ svn commit -m "change in branch"

git-svn clone of this dinky repo

$ cd ..
$ git-svn clone --trunk=trunk --branches=branches --tags=tags 
file://`pwd`/svnrepo gitclone
$ cd gitclone

Try to merge trunk change into branch using git

$ git reset --hard mybranch
$ git merge trunk

Conflicts! what's going on?

$ gitk --all

Aha, looks like git-svn guessed wrong about where I made the branch; it 
thinks the branch comes from the initial rev. Easy enough to hack 
around, but might be nice to be able to do this using git-svn's history 
rewriting rather than a grafts file.

$ echo `git-svn find-rev r4` `git-svn find-rev r3 trunk` > .git/info/grafts
$ git reset --hard mybranch
$ git merge trunk

No conflicts now. Let's see what git-svn thinks it should do

$ git-svn dcommit -n

Looks like the right diff

$ git-svn dcommit

Refresh gitk display. Looks good, the new revision is a merge with the 
right parents. Let's check it out in svn land

$ cd ../svnclient
$ svn up
$ cat branches/mybranch/testfile1

Yep, the trunk change is there, nice! Now for a couple more revs with a 
conflict.

$ echo post-merge trunk change >> trunk/testfile1
$ svn commit -m "trunk change after merge"
$ echo post-merge conflicting change >> trunk/testfile2
$ svn commit -m "trunk change with conflict"
$ cd ../gitclone
$ git-svn fetch
$ git merge -m "change with conflict" trunk

Conflict, as expected

$ vi testfile2
$ git add testfile2
$ git commit
$ git-svn dcommit
Transaction is out of date: Out of date: '/trunk/testfile1' in 
transaction '9-1' at /Users/koreth/git/git-svn line 398

Hmm, this merge was in mybranch, not in trunk

$ git log --first-parent

Yes, the most recent commit with a git-svn-id line has a mybranch URL. 
So why is it complaining about a trunk file being out of date?

My experimentation pretty much ended there (I tried a few things to 
clear the error up, but none of them helped.)

This machine is an OS X laptop. Subversion is 1.4.3 (r23084) from 
MacPorts. I used the git-svn from the "pu" branch since it had this 
patch and all the recent fixes.

Let me know if you need more details. Hope this is helpful.

-Steve

  parent reply	other threads:[~2007-06-14  6:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08 17:25 git-svn set-tree bug Joakim Tjernlund
2007-06-10  1:47 ` Eric Wong
2007-06-10 17:21   ` Joakim Tjernlund
2007-06-10 17:27     ` Joakim Tjernlund
2007-06-10 21:33     ` Eric Wong
2007-06-10 23:27       ` Joakim Tjernlund
2007-06-10 23:37         ` Steven Grimm
2007-06-10 23:55           ` Joakim Tjernlund
2007-06-11  4:25             ` Eric Wong
2007-06-11  5:52               ` Junio C Hamano
2007-06-12  7:20                 ` Eric Wong
2007-06-12  7:34                   ` Junio C Hamano
2007-06-12  8:39                     ` Eric Wong
2007-06-12  9:21                       ` Joakim Tjernlund
2007-06-12 12:15                       ` Steven Grimm
2007-06-13  9:23                       ` [PATCH] git-svn: allow dcommit to retain local merge information Eric Wong
2007-06-13 17:13                         ` Joakim Tjernlund
2007-06-13 23:17                           ` Joakim Tjernlund
2007-06-20  7:04                             ` Eric Wong
2007-06-20  6:56                           ` Eric Wong
2007-06-21 16:54                             ` Joakim Tjernlund
2007-07-01 13:09                             ` Joakim Tjernlund
2007-06-14  6:30                         ` Steven Grimm [this message]
2007-06-22 11:55                           ` Joakim Tjernlund
2007-06-12  8:04                   ` git-svn set-tree bug Lars Hjemli
2007-06-11  6:58               ` Steven Grimm
2007-06-11  8:52                 ` Joakim Tjernlund
  -- strict thread matches above, loose matches on Subject: below --
2007-06-23 17:56 [PATCH] git-svn: allow dcommit to retain local merge information Tjernlund

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=4670E0A2.9060103@midwinter.com \
    --to=koreth@midwinter.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=joakim.tjernlund@transmode.se \
    --cc=normalperson@yhbt.net \
    /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).