0

I have \trunk\root\ which contains folders ProjectA, ProjectB etc. I have creates branch of root -> \branches\task\root\

Now I've made considerable changes to the projects in task including ProjectB.

However \trunk\root\ProjectB has also moved on to a point that makes all the changes in task\Root\ProjectB redundant.

I would like to completely replace the content of \branches\task\root\ProjectB with the content of \trunk\root\ProjectB. No merging just make the task version ProjectB identical to the trunk version. Note when it comes to merging task back into trunk I don't want any weirdness happening in ProjectB, SVN should just see that its an old version of what is now in ProjectB and not change anything in it.

Can anyone guide an SVN know-nothing like me (who also happens to be a complete CLI whimp) through using TortoiseSVN to acheive this?

AnthonyWJones
  • 187,081
  • 35
  • 232
  • 306
  • Why can't you use a normal SVN Merge? Even if files have been changed or deleted, Tortoise will recognize them and merge accordingly. – hexium Nov 05 '09 at 13:09
  • Ah, I think I see what you mean now. You don't want to update the branch to the changes in the trunk before reintegrating the branch. You could try the "mark as merged" option to update the branch, this will not actually merge the file but 'trick' SVN into thinking it's been merged. Then do the normal reintegration. (Read TortoiseSVN Help file sections 4.20.2 and 4.20.4 thoroughly) – hexium Nov 05 '09 at 13:15
  • 1
    @hexium: so basically I need to thoroughly understand SVN then try something hoping I've understood it correctly (and perhaps dealing with the mess I've made of it). SVN fails on the "don't make me think" front. – AnthonyWJones Nov 05 '09 at 13:20

4 Answers4

3
  1. Delete the current ProjectB on the branch, do this on the svn repo
  2. Copy the trunk ProjectB onto that branch location again (where ProjectB used to be).
  3. Revert, or better still, recheckout ProjectB.

That is if you're okay with losing the history.

An alternative approach where the history will be kept - but this will use the Eclipse IDE

  1. Checkout ProjectB from trunk
  2. Checkout ProjectB from branch (to a different project in Eclipse)
  3. Compare the two versions of ProjectB and bring in all the changes from the Trunk Project B into branch ProjectB
  4. Checkin Branch Project B
Michael Wiles
  • 20,902
  • 18
  • 71
  • 101
3
  1. Switch working copy to /branches/task/root/ProjectB (or checkout a new WC from this URL)
  2. Right-click and select Merge
  3. Select Merge two different trees
    • From: /branches/task/root/ProjectB
    • To:     /trunk/root/ProjectB
  4. Leave the other options at the defaults and click Merge (or Test merge)
  5. Resolve any conflicts by choosing the trunk’s version of the file

This will bring in the necessary changes to make your branch the same as the trunk. Then you can commit.

Michael Hackner
  • 8,605
  • 2
  • 27
  • 29
0

In Tortoise You can right click and do the equivalent of an "svn delete", i.e Delete of the branch you want to kill.

Then you need to do a Tortoise copy to and put in the new path.

Stewart Robinson
  • 3,459
  • 4
  • 21
  • 27
0

Normally you should regularly re-integrate changes made in the trunk to the branch to avoid that kind of situation.

Why don't you keep your previous branch, and make a new one instead? It's quite common to use a version in the structure, as in:

branches/task/version1.0
branches/task/version2.0
tags/task/version1.0
tags/task/version2.0
trunk

To do that with TortoiseSVN, move your branch by:

  • opening the repo-browser (context menu, TortoiseSVN -> repo-browser)
  • creating a branches/task/version1.0 directory (Create folder on task)
  • renaming branches/task to branches/task/version1.0 (Rename on task)

Then you can proceed as normally:

  • (context menu on the checked-out trunk directory) TortoiseSVN -> Branch/Tag
  • specify the To URL of the new branch (branches/task/version2.0)
  • specify whether you want to make your new branch from the working copy or another place (I would strongly advise to commit first and branch from HEAD)

(alternatively you could use the repo-browser and do a Copy to from the trunk)

As the tools warns you, you still have to switch:

  • (context menu on the same directory) TortoiseSVN -> Switch
  • specify the To URL of the new branch (branches/task/version2.0)

You will have something much cleaner that way.

If you opt to delete the branch anyway, you'll avoid any confusion when merging back by specifying the revision range to merge (one of the fields to fill in with TortoiseSVN). Make sure to exclude anything related to the deleted branch. But honestly, I would avoid that.

RedGlyph
  • 11,309
  • 6
  • 37
  • 49
  • Way too complicated. I just want it to do exactly what it says on the tin. task\root\ProjectB is junk, I want it to become indentical to trunk\root\ProjectB with no merging weirdness to occur in the future. I don't need any versioning marlarky. – AnthonyWJones Nov 05 '09 at 14:10
  • Just read the last paragraph then, but I thought the original idea _was_ to avoid any future confusion. Once you start using branches and tags, you should keep in mind that versions can save you a lot of trouble, and avoid your repository getting messy. And that is coming from someone who had such experiences before ;-) – RedGlyph Nov 05 '09 at 14:46