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

Re: how to merge partial

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: 2007-10-09 02:48:07 CEST

On Oct 8, 2007, at 19:30, paptimusx scirocco wrote:

> On Oct 5, 2007, at 06:23, Erik Huelsmann wrote:
>
>> On Oct 5, 2007, at 04:48, paptimusx scirocco wrote:
>>
>>> How should be done merge partial?
>>>
>>> I did so in cvs.
>>> on branch subdir (cvs) % cvs up -j HEAD UPDATE.TXT
>>>
>>> How should I do in svn?
>>>
>>> on branch sbudir (svn) % svn merge ???????????
>>>
>>> file:///c:/var2/svnroot/PROJ/trunk/SRC/SUBDIR
>>> file:///c:/var2/svnroot/PROJ/branch/br_test/SRC/SUBDIR
>>>
>>> I know if it is all branches. (It is too hard to me..)
>>> on branch top % svn merge \
>>> file:///c:/var2/svnroot/PROJ/trunk@{2007-10-04} \
>>> file:///c:/var2/svnroot/PROJ/trunk_at_HEAD \
>>
>> Have you read http://svnbook.red-bean.com/en/1.4/
>> svn.branchmerge.html ?
>
> It doesn't write there. It seems there is no method of merging
> only single file (or subdirectory).

I hope I've restored the quoting successfully.

Of course you can merge a single file or directory if you like. You
just need to issue the correct merge command.

Re-reading your original post, it sounds like you're asking how to
merge only the changes to the file SRC/SUBDIR/UPDATE.TXT from the
trunk into the br_test branch. (I'm not familiar with CVS so I hope
I've got that right.)

First, let's go to the basic example of wanting to merge *all*
changes from the trunk into the branch. Subversion does not have
merge tracking yet. Subversion 1.5 should have this, but for earlier
Subversion, you need to track merges yourself. So. You need to know
the revision in which br_test was created. "svn log --limit 1 -r
1:HEAD file:///c:/var2/svnroot/PROJ/branches/br_test" will show you.
Let's assume br_test was created in revision 150, and that the
repository is currently at revision 200. Here's how you would merge
all trunk changes from revision 150 to 200 into the br_test branch:

$ cd wc_of_br_test
$ svn merge -r150:200 file:///c:/var2/svnroot/PROJ/trunk .

If there are any conflicts, resolve them. Now test and make sure the
changes work. Then commit them. Be sure to note in the commit message
that you have merged revisions 150 to 200 from the trunk.

If later, say at revision 250, you want to merge more trunk changes
into the branch, you need to start at revision 200, not 150:

$ cd wc_of_br_test
$ svn merge -r200:250 file:///c:/var2/svnroot/PROJ/trunk .

Ok. That's the basic use case. Now. You wanted to merge just a single
file's changes. Not a problem:

$ cd wc_of_br_test
$ svn merge -r150:200 file:///c:/var2/svnroot/PROJ/trunk/SRC/SUBDIR/
UPDATE.TXT SRC/SUBDIR/UPDATE.TXT

Resolve conflicts, test, and commit, being sure to note in the commit
message that you have merged revisions 150 to 200 of this particular
file from the trunk.

If you later want to merge other changes from the trunk, be sure to
exclude the changes to SRC/SUBDIR/UPDATE.TXT which you have already
merged. I'm not entirely sure off-hand how you will go about doing
this... you may have to let Subversion just do the merge again, and
be prepared that it may result in conflicts to SRC/SUBDIR/UPDATE.TXT,
which you would "resolve" by "svn revert"ing SRC/SUBDIR/UPDATE.TXT
(since it already has the changes).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Oct 9 02:50:27 2007

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.