SVN refactoring and other operations made simple (Eclipse and Subversive)

By neokrates, written on May 5, 2010


  • Join date: 11-30-99
  • Posts: 224
View Counter:
Rate it
  • What SVN client do you use?

    View Results

    Loading ... Loading ...
  • bodytext bodytext bodytext

Many things go easier with svn, if you use Subversive as refactoring tool. Here is how.

There are many ways to work with subversion in Eclipse. Some will cost you time and are more error prone. More operations you do, more dialogs you go through, more errors will occur.


✔ Eclipse Galileo

✔ Subversive (Svn Kit 1.6)

Should also work for:

✔ May work with other Subversive versions

✔ Most compatible Eclipse versions

Most operations on subversion server can be done in easy, elegant way…

  1. In this article, Eclipse SVN repositories view is used. So, most commands and paths are related to this view.
  2. You should always comment the changes you make. That will make it easier to understand what was moved, why, etc…


Create branches, tags. Client-side way

The easiest way to branch or tag with Subversive is to use team->branch and team->tag. Use it always if you can.

But there are often one of two problems with such easy way:

  • you project layout is different in the way which Subversive doesn’t understand;
  • you need to branch/tag many project at once, checkout may be slow or just one extra operation you don’t need.

In that case, here is another simple way.


Create branches, tags. Server-side way

You want to branch or tag svn://my.svn.sever/trunk/project.


Get repository source ready

Make sure all is checked in under svn://my.svn.sever/trunk/project.


No changes for 1 minute

If you have a group of developers, notify them that you branch or tag. Lock the path if you need to.


“Copy to”

  • Open svn://my.svn.sever/trunk/project in SVN repositories view.
  • Click on project with the right mouse button and choose “refactor->copy to”.
  • Open the target path (in my case I want to tag, so I open: svn://my.svn.sever/tags.
  • Add tag/branch name and project name. Normally there is a naming scheme to be followed. We use /branches/project_name/branch_name scheme.
So, I enter: project/MILESTONE_05052010 .
Important if path doesn’t exist, it will be automatically created.
  • Don’t forget a nice comment. ;-)



Communicate and unlock if you need to.


Create svn server-side directory tree

Maybe you want three paths under the trunk:

To do that, in SVN Repositories view click with right mouse button on trunk and then select new->folder.
Enter /trunk/serverside/tomcat.

Then repeat the process for /trunk/serverside/jetty and /trunk/serverside/glassfish


Move and reconnect

Maybe svn://my.svn.sever/trunk/project is just the wrong place for the project. There is some category you want your project to belong to. Say, it belongs to serverside/tomcat category.

What you want is to relocate it to svn://my.svn.sever/trunk/serverside/tomcat/project



In Navigator view use team->disconnect (Also delete svn information).


Move the project

In 1 and 2 use cases I have shown how to use copy to and new folder to create server-side svn tree. Here instead of copy to move to is used. Apart from that, 1 and 2 use cases apply.
Just use move to the way copy to is used.



By now you have the server side path svn://my.svn.sever/trunk/serverside/tomcat/project and project is there.

  • Copy the path to the clipboard (right mouse button on the project, copy url)
  • Now, in Navigator view, select the project and select team->share project.
  • Select the repository.
  • In the “select the project(s) location, paste the URL: from clipboard”
  • Finish, answer “Yes” to the “Do you wish to proceed?” question.
  • Now you might be presented with the window which allows you to synchronize. That doesn’t happen every time. You also can choose to cance i.e. do synchronization later.



Refresh subtree to see your changes

For sometime now, refresh was a bad feature to use. With Subversive (Svn Kit 1.6) it works great. So, after refactoring you can always select the root path (under which structure you changed something) click with right mouse button and select refresh.


Copy, cut and paste

You dropped your jetty project under /trunk/serverside/tomcat. Easy to fix it.

In SVN repositories view:

  1. select project->right mouse button->cut
  2. select path your want you project to be under (In our example /trunk/serverside/jetty)
  3. right mouse button->paste


Check out as instead of import

If you use Navigator Import command, you will go through many steps until you are done. Also, for the import of the second project, you will go the very same way once again. Shortcut would be nice!

In SVN repostories view:

  1. select project->right mouse button->check out


💡 Remark : Make sure there is no project with the same name in your workspace. Or subversive checkout will ask you for new name.
Alternatively, use Find/Check Out As


Mass checkout

Same as in use case 6. In SVN repostories view:

⭐ Just select all paths you want to checkout. Better would be they have no name conflicts with existing projects and with each other. That way, all projects will check out without complains.

Be Sociable, Share!

LEARN MORE (amazon bookstore)


Be Sociable, Share!

Leave a Reply