[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: Gavin 'Beau' Baumanis <beau_at_palcare.com.au>
Date: Sat, 21 Feb 2009 12:46:58 +1100

Sorry all, i just re-read the post below and I am not sure why... but
the path SRC and DESTS are prety "screwy"
please find a corrected version below.

Hi and thanks for the replies.

Here is the recipe.

I have a trunk/file1_at_r10
it contains the following;
"
This is line 1
This is line 2
"

file1 already exists in trunk/myOtherDirectory/file1

The contents of trunk/myOtherDirectory/file1 aren't really
important... but for ease of illustration - lets assume it is
currently identical to trunk/file1
That is: trunk/myOtherDirectory/file1 contains
"
This is line 1
This is line 2
"

I then edit trunk/file1 and now have the following for trunk/file1_at_r11
"
This is line 1
This is line 2
This is line 3
"

I replicate this process several times (1 line per revision) until I
have the contents of trunk/file1_at_r15
"
This is line 1
This is line 2
This is line 3
This is line 4
This is line 5
This is line 6
This is line 7
"

Now when I do run the following command within my WC,
svn merge -r 13:15 trunk/file1 trunk/myOtherDirectory/file1

I expect trunk/myOtherDirectory/file1
to contain;

"
This is line 1
This is line 2
This is line 6
This is line 7
"

I don't really care what happened to trunk/file1 prior to r14, I just
want the changes made in trunk/file1_at_r14:15 to be "patched" to trunk/
myOtherDirectory/file1

What I found myself doing, (automatically) was choosing (tf) Their
File - which competely explains, why trunk/myOtherDirectory/file1 is
now a copy trunk/file1

But it still leaves me with the issue of how do I get just those
changes in r14:15 of trunk/file1 into trunk/myOtherDirectory/file1?

If I choose (e) edit, then I get the differences between the two
files... I.e. the merge-right section contains ALL that is different
and not just what was changed in r14:15 of trunk/file1
So it makes it a little difficult to know how to manually edit the
file to correctly merge in just the changes of r14:15

Once again, Thanks or any help you might be able to provide.

Gavin

>
>
> On 21/02/2009, at 2:09 AM, Stefan Sperling wrote:
>
>> 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

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1201747

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-02-21 09:16:25 CET

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