开发者

TortoiseSVN: How to merge branch back to trunk without switching working copy to trunk?

开发者 https://www.devze.com 2022-12-22 00:16 出处:网络
We are using TortoiseSVN in a team environment. When working on a bigger feature, I create a feature branch, work for a week there, merge changes from trunk to my branch every other day and when the f

We are using TortoiseSVN in a team environment. When working on a bigger feature, I create a feature branch, work for a week there, merge changes from trunk to my branch every other day and when the feature is complete, I merge it back to trunk.

When merging, I always do the following:

  1. commit everything to the branch
  2. switch the whole working copy to trunk, changing (mostly deleting) hundreds of fi开发者_StackOverflow社区les
  3. use "Reintegrate a branch" option, merging the changed/new files from branch that were already on the disk 30 seconds ago
  4. verify that the code compiles
  5. commit to trunk

This seems inefficient to me - I create a bunch of files, delete them when switching to trunk and then create them again when merging to the trunk.

Is there any other way to merge a branch to trunk using TortoiseSVN that would be more efficient, without having two separate working copies? (which is not actually very efficient in our scenario because some dependencies use absolute paths and I need to manually change them when I want to compile from another working copy)


You can't possibly merge and commit in SVN, without having a working copy of the trunk (i.e. the merge target). This isn't an action that can be done directly on the repository, since it is modifying files, and you will want to verify that they are merged correctly before committing.

So I guess you basically want a switch-and-merge action (or a switch-and-merge-reintegrate). As far as I know, this command is not provided by SVN or TortoiseSVN, so you are stuck doing it the way you described.


I keep a working copy of both of them at all times.

If you check out the root below the trunk and branch then you have both available, so there is no need to switch back and forth. Just move up and down the tree as you would a normal file structure.


I know I'm late for the party, but one idea would be to use the subst command to make a virtual drive point to the active working copy:

cd \myproject\trunk
subst z: .
... use the trunk ...
cd \myproject\branchxy
subst /d z:
subst z: .
... use the branch xy ...

This way, you would simply use the subst-created drive letter in your incoming external dependencies.


Here's an excerpt from the SVN book:

You'll need a working copy of /trunk. You can get one by doing an svn checkout, dredging up an old trunk working copy from somewhere on your disk, or using svn switch (see the section called “Traversing Branches”).

0

精彩评论

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

关注公众号