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

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

From: Dan Mahn <svn_at_digidescorp.com>
Date: 2006-04-28 20:28:44 CEST

Hello. I have (another) question about merging.

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
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
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.

I'm new to Subversion, and I don't have much experience with merging.
However, I don't know why there were two lines added during the "merge"
but only one line appeared in the "diff".

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().)

Anyway, I thought that the merge operation would only merge the changes
between the specified revisions, rather than updating the whole file to
the latest merge revision. No? If I had wanted this behavior, then I
would have copied the file instead of merging.

Thanks in advance for any clarification you can give.

- Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Apr 28 20:31:04 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.