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

Re: Understanding merging.

From: William Nagel <bill_at_stagelogic.com>
Date: 2005-10-26 17:57:41 CEST

On Oct 26, 2005, at 10:08 AM, Anastasios Angelidis wrote:

> Ryan Schmidt wrote:
>
>
>> On Oct 26, 2005, at 15:54, Anastasios Angelidis wrote:
>>
>>
>>> I run: svn log --verbose svn://myserver/Development/Test_Project
>>> and get listing below.
>>>
>>> I would like to merge r4 into r5 so I run: svn merge -r 4:5
>>> svn:// mtlw-angt-01/Development/Test_Project/Trunk But I get a
>>> blank response. Bassically svn returns to the prompt again. What
>>> I'm I doing wrong?
>>>
>>> Thanks
>>>
>>> --------------------------------------------------------------------
>>> -- --
>>> r5 | tassoa | 2005-10-25 16:46:20 -0400 (Tue, 25 Oct 2005) | 1 line
>>> Changed paths:
>>> M /Test_Project/Trunk/index.html
>>>
>>> Added new paragraph.
>>> --------------------------------------------------------------------
>>> -- --
>>> r4 | tassoa | 2005-10-25 16:44:57 -0400 (Tue, 25 Oct 2005) | 1 line
>>> Changed paths:
>>> M /Test_Project/Branches/Bug_Fixes/index.html
>>>
>>> Fixed spelling mistake found in the <title> tag. Should read
>>> "Hello World!" and not "Hello Wrld!".
>>> --------------------------------------------------------------------
>>> -- --
>>>
>>
>>
>> You're confused about terminology.
>>
>> A revision of the repository represents a point in time. At
>> revision 4, it looked one way, and at revision 5, it looked a
>> slightly different way. Revisions are permanent and never get
>> changed again.
>>
>> In revision 4, you made a change to a file in a directory
>> Bug_Fixes in the directory Branches. I assume what you want to do
>> is to make that same change to the same file in the directory Trunk.
>>
>
> Yes
>
>
>>
>> In that case, get a working copy of Trunk, go into it, and merge
>> the change into the working copy:
>>
>> cd /path/to/working/copy/of/Trunk
>> svn merge -r3:4 svn://myserver/Development/Test_Project/Branches/
>> Bug_Fixes
>>
>> This means "Make a recipe that transforms revision 3 of the
>> Bug_Fixes branch into revision 4, and apply that recipe to the
>> working copy I'm in right now."
>>
>
> Ok it worked but I'm not exactly understanding why -r3:4. The
> working copy is at r5 and I want to merge r4 into it... to make the
> working copy finally r6. Maybe you can explain it differently? Thanks

You're thinking of a revision as a change. It's not. It's a static
state. Let's say your repository is at revision 3. Now, on
Thursday, you commit some changes. The repository is now at revision
4, which represents the state of the repository with those changes
applied. Then on Friday you make some modifications and commit
again. Now you're at revision 5, with revision 4 representing the
state of the repository on Thursday and revision 3 representing the
state of the repository on Wednesday.

Ok, so you want to merge the changes that were applied in revision 4
to a branch. Revision 4 by itself doesn't have any changes, though.
It's just a static snapshot of the repository as it looked on
Thursday. What you really want to do is not merge "revision 4" but
rather merge the difference between revision 3 and revision 4, hence
the need to merge -r3:4. If you instead wanted to merge all of the
changes that were applied in both revision 3 and 4 you'd want to
merge the difference between revisions 2 and 4 and would type -r2:4.
You can also merge the difference between revisions that are out of
order. For example, you could type "merge -r4:3", which would do a
reverse diff from 4 to 3 (you can use this to remove a revision from
the head).

Ok, now that I've probably thoroughly confused you, let me try to
state things slightly more simply:

Merge takes two revisions and creates a diff of those two revisions
(similar to if you'd used the diff command). It then applies that
diff to the current working copy (similar if you'd used the patch
command). So, the "-rX:Y" doesn't tell merge to merge from X into
Y. Instead, it tells merge to merge the difference between X and Y
into the local working copy.

-Bill

>
>
>>
>> Now you resolve any conflicts that might have occurred, test the
>> change to make sure it works, then you commit the working copy,
>> stating in your commit message that you merged revision 4 of the
>> Bug_Fixes branch into the trunk.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: users-help@subversion.tigris.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Oct 26 18:01:55 2005

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.