12

I have found that when I need to rename a Java class (and therefore the source file) or need to change the package name (and therefore move the source file[s]), I can either:

  1. Use the nice and useful Eclipse refactoring tools which is great since all the cascading tasks are done for me. However, I then have an uphill struggle with Subversion to replicate the changes back to the repo.
  2. I can issue the renames/moves in Subversion first, update my local and then the refactoring tools in Eclipse don't work.

Can anyone advise on a preferable procedure?

Nik Reiman
  • 39,067
  • 29
  • 104
  • 160
Nicholas
  • 15,916
  • 4
  • 42
  • 66

4 Answers4

10

Since the 1.4.x releases, Subclipse handles this pretty well. If you have bugs, please report them. In prior releases it handled some situations but not others. This was due to Subversion limitations that were fixed in SVN 1.5. For example, prior to SVN 1.5, if you renamed a folder, you could not also rename a file in the folder (until the folder was committed). These sorts of things were all very common refactorings and SVN would get in the way.

It all works pretty well now though.

Mark

Mark Phippard
  • 10,329
  • 2
  • 32
  • 42
4

I hate to walk in and say 'ur doin it rong', but since your subject line mention Subclipse - Subclipse integrates with Eclipse's refactoring tools. So does Subversive. When you rename a class, it executes the 'svn mv' for you underneath. You should never need to attempt to replicate those moves manually.

I wonder if for some reason Subclipse is not attaching to your project - if it doesn't know your project's a Subversion project. Then obviously it wouldn't do anything.

If you're not using Subclipse/Subversive... start. :)

John Stoneham
  • 2,485
  • 19
  • 10
  • I am using Subclipse, but for some reason, it does not issue any SVN commands when I refactor. Other "Team" operations show up in the console when they execute, but not for refactoring. Perhaps it is an older version, or it is somehow hosed. Thanks for the response. – Nicholas Feb 05 '09 at 21:03
3

Have you tried subversive ? Refactoring seems to work fine for me with it.

Actually, I've tried subclipse too, and it seems to handle it fine, at least with version 1.4.7. I just tried renaming a package and a class. Eclipse marks the old one as deleted and adds a new one, scheduled to be added to the repository.

Stephen
  • 4,176
  • 2
  • 24
  • 29
  • Hey thanks for that. I am using 1.2.something. I keep meaning to upgrade but for some reason, it is always a hassle. – Nicholas Feb 05 '09 at 20:55
0

Subclipse will take care of the svn moves/renames when you refactor in Eclipse.

m13r
  • 2,458
  • 2
  • 29
  • 39
Stefan
  • 43,293
  • 10
  • 75
  • 117