File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes SVN : Move existing project to 'trunk' folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "SVN : Move existing project to Watch "SVN : Move existing project to New topic

SVN : Move existing project to 'trunk' folder

Suzi Cooper
Ranch Hand

Joined: Jul 23, 2005
Posts: 45
Hi Folks,

I have an existing project in SVN created a few weeks ago. I now need to do 2 things:
a) Move the existing project into the trunk folder.
b) Create a branch from my working copy.

I use MyEclipse as IDE.I do have an idea about creating a branch but i am not sure how to move my exisitng project into the 'Trunk' folder.

Can some-one suggest a neat way to do this without messing my exisitng project?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Me too. And I'm supposed to know better by now. What's probably the easiest way is to do this:

0. copy your .project and .classpath files to a safe place. Remove all source and build folders from the project so that they won't be locked against moving
1. Export the project as a ZIP file or something.
2. Use Eclipse to create a trunk folder in the existing project
3. Add it to Subversion
4. Unzip the exported copy of the project into the trunk folder
5. Add the contents of trunk to Subversion
6. Subversion delete everything but the trunk, branches and tags folders from original project folder.
7. Fixup any absolute paths that got fouled up. This is the second hardest part. The original root project file is probably useless at this point, but you'll have to create a new project at the trunk level and delete the old project from your workspace before you can free it up for deletion.

The hardest part is that both Subversion and the subclipse plug-in have proven to be less robust than I like. The process will appear to "hang" for long periods of time, run CPU usage up to 100% and I end up killing Eclipse, which causes all sorts of damage to the process which I then have to manually repair. Including going to the backups to restore stuff that got lost in the process. On the whole, the move process is more trustworthy if you do it from the command line. At least you gain comfort from the rows and rows of dots marching across the screen, even though you'll have no clue as to what percentage of the operation is complete.

I'm fairly sure that unlike CVS, the subclipse plugin doesn't adjust the subversion contexts for folders moved in the Resource View and that can lead to major grief. On the whole, I'm not real happy with subversion right now.

An IDE is no substitute for an Intelligent Developer.
Suzi Cooper
Ranch Hand

Joined: Jul 23, 2005
Posts: 45
That does not sound easy.
Can you point to me if there is a major flaw with the following approach : 1) Through SVN Repository perspective, create a folder 'Trunk'
2)Right-Click and move all the folders/ files under this directory including .project file.
3) Create a new folder 'Branch'
4)From java perspective, (Team--> Branch/Tag) create a branch of the working copy.

Will this mess up any files?
Suzi Cooper
Ranch Hand

Joined: Jul 23, 2005
Posts: 45
Anyone any pointers?
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Using Subversive, for a) I would go to the SVN Repositories view and use Refactor/Move To...

For b), using the option from the team menu sounds fine. An alternative would be to use Refactor/Copy To... from the same view as above. (Remember that in SVN a branch/tag is just a copy, anyway.)

I assume that subclipse will provide similar functionality. Alternatively, TortoiseSvn would work, too.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Suzi Cooper
Ranch Hand

Joined: Jul 23, 2005
Posts: 45
Thanks. The suggested ways for both scenarios worked with no major issues.
I agree. Here's the link:
subject: SVN : Move existing project to 'trunk' folder
It's not a secret anymore!