开发者

SVN - how to apply change made in trunk to all branches

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 existi开发者_JAVA百科ng 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.)


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


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"


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜