Jason S
Jason S

Reputation: 189626

svn: copy branch to trunk

I have an SVN project with a branch I'm working on, and an empty trunk:

myproject/
  branches/
    mybranch/
      {there's stuff here}
  tags/
  trunk/

How can I copy the contents of mybranch into the trunk? TortoiseSVN complains that there's already a trunk directory. I could delete the (empty) trunk from the repository and then do a copy, but that seems wrong somehow...


clarification: I have a trunk which I intentionally left empty. My "mybranch" is all checked in. In the repo-browser, TortoiseSVN gives me a "copy" option but not a merge option.

If merging is the right thing to do, what do I do? Do I check out the empty trunk and then merge into that working copy, then check back in?


update: Merge won't work either; SVN complains the two "branches" (branches/mybranch and trunk) are not ancestrally related.

Upvotes: 5

Views: 11790

Answers (5)

Maheswaran
Maheswaran

Reputation: 19

I have just done it in my project. we can do a simple folder copy like operation:

  1. rename trunk to trunk_temp.
  2. copy tag to trunk

Both the operations could be done using eclipse plugin. Open svn repository perspective in eclipse. 4. Right click on trunk and choose Team >> Refactor >> Rename to >> type trunk_temp.
5. Right click on Tag >> Choose Refactor >> Copy To >> choose the project directory one level up to trunk. you will have option to provide name of the new directory and type in trunk. That's all.

Final result will be:

  1. existing trunk is renamed to trunk_temp. you can also create a branch.
  2. the tag is copied over to trunk
  3. delete the trunk_temp if you created a branch.

Upvotes: -1

gregwhitaker
gregwhitaker

Reputation: 13410

You can do an svn export to the trunk folder and then add and commit.

or... you can merge with the --ignore-ancestry flag

Upvotes: 2

Kirk Kelsey
Kirk Kelsey

Reputation: 4544

I'd do what you mentioned, delete the trunk and then copy the branch. It is a little wrong, but it's because you didn't copy to make the branch in the first place.

Upvotes: 3

Wrikken
Wrikken

Reputation: 70460

You're probably looking for svn merge: http://svnbook.red-bean.com/en/1.0/ch04s04.html

Upvotes: 1

Brian S
Brian S

Reputation: 5056

Generally, you merge a branch into the trunk. The branch usually represents a feature you've branched off for separate development, or because it could break your functionality if not finished. Move and copy are different operations from merge.

Upvotes: 1

Related Questions