[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Merging a single edit, but the file was moved during the commit.

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-04-28 23:25:56 CEST

On Apr 28, 2006, at 20:28, Dan Mahn wrote:

> I have a file that I edited in a branch (this is a test file) and
> I'm merging the change back to the trunk.
>
> If I do a "diff" between the revisions I want to merge, I get a
> single line of difference. However, when I do the "merge" with the
> same revision numbers as the "diff", I get a "conflict", and two
> lines were added to the file instead of one.
>
> For instance, here's the "diff" output showing the change I want to
> merge back to trunk:
>
> >svn diff -r 68:69 https://<etc., etc.)/myproject.c

"etc., etc." is the URL to your branch, yes? The branch where the
change that you want to merge was made?

> Index: myproject.c
> ===================================================================
> --- myproject.c (revision 68)
> +++ myproject.c (revision 69)
> @@ -2,6 +2,7 @@
>
> func()
> {
> +printf("What about task starter?\n");
> printf("Starting up ...\n");
> return 0;
> }
>
>
> The contents of the pre-merge (trunk working copy) "myproject.c"
> file are (without the equals signs):
>
> =====
> //This is a test
>
> func()
> {
> return 0;
> }
> =====
>
>
> The result of a "merge" is:
>
> >svn merge -r 68:69 https://<etc., etc.>/myproject.c

"etc., etc." is still the URL to the same branch, yes?

You don't have to type the name of the file there at the end of the
path, by the way; just the directory that matches the one in the
working copy you're in will suffice. Unless there are other changes
in r69 made to other files in the same directory and you don't want
to merge those. But I think that would be unusual.

> C myproject.c
>
> >svn diff
> Index: myproject.c
> ===================================================================
> --- myproject.c (revision 70)
> +++ myproject.c (working copy)
> @@ -2,5 +2,10 @@
>
> func()
> {
> +<<<<<<< .working
> +=======
> +printf("What about task starter?\n");
> +printf("Starting up ...\n");
> +>>>>>>> .merge-right.r69
> return 0;
> }
>
> It's funny, but there appears to be an extra line in there. The
> lower printf() call has been added, but I didn't expect that.

Honestly, I didn't expect that either. Was your trunk working copy up-
to-date before you tried this merge?

> One extenuating circumstance is that the file ("myproject.c") had
> been moved to a sub-directory in a previous edit to the branch.
> However, I'm not sure if this ought to affect the outcome. (The
> file had been first moved to a new directory when working on
> "trunk", then I created a branch from the working copy, then I
> added the "Starting up" printf(), then I added the "task starter"
> printf().)

It may end up being traceable to the same problem as in your last
mail: the first revision of your branch does not match any revision
of the trunk, therefore merges won't make sense. Try it again
following the advice I sent in the other mail and see if you can
still produce the problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Apr 28 23:27:26 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.