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

Re: Proper way to copy files between a branch and trunk

From: Daniel Becroft <djcbecroft_at_gmail.com>
Date: Fri, 22 Oct 2010 05:58:01 +1000

On Fri, Oct 22, 2010 at 5:08 AM, Mark _ <mark_aok_at_hotmail.com> wrote:

> Hi all,
>
> I have never understood the proper way to transfer files (or directories)
> between a branch and trunk and vice versa.
>
> Originally I thought the svn copy command was the best command to use, but
> then someone on this forum informed me that instead svn merge should be
> used, so that in the future updates can easily be transferered using svn
> merge again.
>
> The problem is...svn merge doesn't work :(
>
> Consider a very simple scenerio:
> I add a directory called myFeature to branchX. I then want to copy this
> myFeature directory to trunk. Using svn copy everything is fine. But check
> what happens when I try to merge:
>
> $ svn merge http://svn/trunk/myFeature@HEAD
> http://svn/branches/branchX/myFeature@1234 .
> svn: '/product/!svn/bc/389517/trunk/myFeature' path not found.
>

You've formatted your merge command incorrectly. Merges are done between
like levels on a tree. You shouldn't try to merge a subdirectory of a branch
with the root of trunk.

So, assuming branchX was created via a 'svn copy trunk branchX' command, and
the myFeature folder was added in r1234, then you would want to do the
following:

$ svn merge -c 1234 http://svn/branches/branchX .

If there were additional revisions that need to come across, then these
would need to be done as well.

Trying to think of the output as 'copy directory myFeature from this branch
to trunk' seems to be causing headaches. Instead, what you're after is 'take
this set of changes from this branch to trunk'.

Regards,
Daniel B.
Received on 2010-10-21 21:59:02 CEST

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.