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

Re: Merge Behaviour.

From: Stefan Sperling <stsp_at_elego.de>
Date: Fri, 20 Feb 2009 15:09:40 +0000

On Fri, Feb 20, 2009 at 09:49:32AM -0500, Bob Archer wrote:
> > using the following command;
> > svn merge -r 1234:head /trunk/directoryA/file1 /trunk/directoryB/file3
> >
> > I expected all changes that were made file1 from revision 1235: head
> > to be placed into file3.
>
> I really don't think merge was designed to work the way you expect. You
> really need to do a svn diff then apply that diff to file3.

No. It was designed for this.
svn merge is essentially just like diff+patch (+ merge-tracking).
What Gavin wants to do works for me (see below).

Gavin, make sure you specified paths correctly.
The command you posted looks incorrect:

  svn merge -r 1234:head /trunk/directoryA/file1 /trunk/directoryB/file3

This would look for a file on your disk, in a working copy called
/trunk. Use a full URL for file1, or proper working copy path for file1.
Use a proper working copy path for file3.

Use svn diff to see what changes would be merged, before running
svn merge. Once you are happy with the diff, just replace 'diff' with 'merge'
on the command line, and add the destination path, to do the merge.

Working example, inside a working copy (with a trunk client, but
should also work with 1.5):

$ cat alpha
alpha, modified
$ cat beta
beta
$ svn diff -r2:3 alpha
Index: alpha
===================================================================
--- alpha (revision 2)
+++ alpha (revision 3)
@@ -1 +1 @@
-alpha
+alpha, modified
$ svn merge -r2:3 alpha beta
Conflict discovered in 'beta'.
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: p
--- Merging r3 into 'beta':
C beta
Summary of conflicts:
  Text conflicts: 1
$ cat beta
<<<<<<< .working
beta
=======
alpha, modified
>>>>>>> .merge-right.r3
$

Stefan
Received on 2009-02-20 16:10:55 CET

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