tags:

views:

132

answers:

3

I am a beginner in SVN.I have the SVN directory structure like this:

|-trunk
  |-file1.php
  |-file2.php
|-branches
  |-branch_1
    |-file1.php
    |-file2.php
  |-branch_2
    |-file1.php
    |-file2.php

In the trunk I have the main version of my application. I have two branches for different clients which have the modifications only in some files. When I find some core bug I fix it in trunk. For example I modified the file1.php in trunk directory. I want to apply changes to the files named file1.php in all the branches.

I am little confused. In the Version Control with Subversion I have found the following explanation.

Subversion's repository has a special design. When you copy a directory, you don't need to worry about the repository growing huge—Subversion doesn't actually duplicate any data. Instead, it creates a new directory entry that points to an existing tree.

So I though that when I commit a change in the file trunk\file1.php it will be automaticaly aplied to the other file1.php files as I didn't make any changes to that files in branches directory.

How can I apply changes from trunk directory to all the branches? I was trying to use svn merge like this:

svn merge -r 31:32 http://mysvnserver.com/project/branches/branch_1

but I didn't do any changes (svn diff -r 31:32 returns all the changes I made.)

+4  A: 

If you want to apply a change from trunk to branch_1, the merge command needs to specify where to get the diff from, and then specify a target to apply the merge to:

cd branch_1
svn merge -r 31:32 http://mysvnserver.com/project/trunk .
svn diff   # confirm that the only diff is your change to file1.php
svn commit
Ether
Thank you. That is what I need.
Lukasz Lysik
A: 

Try:

svn merge -r 31:32 http://mysvnserver.com/project/trunk branch_1

where branch_1 is your local working directory of the branch. That is, first you have the source address, and then the destination, which must be local.

legoscia
+1  A: 
cd workingcopy
svn merge -r 31:32 http://mysvnserver.com/project/trunk branches/branch_1
svn merge -r 31:32 http://mysvnserver.com/project/trunk branches/branch_2
svn commit -m "Merged r32 into branches"
Michael Hackner