如何使用Eclipse重构工具并通过Subclipse与SVN保持同步?

时间:2023-01-20 17:08:17

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:

我发现当我需要重命名Java类(因此需要更改源文件)或需要更改包名(因此移动源文件[s])时,我可以:

  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. 使用漂亮而有用的Eclipse重构工具,因为所有的级联任务都是为我完成的。但是,然后我与Subversion进行了艰难的斗争,将更改复制回了回购。

  3. I can issue the renames/moves in Subversion first, update my local and then the refactoring tools in Eclipse don't work.
  4. 我可以先在Subversion中发出重命名/移动,更新我的本地,然后Eclipse中的重构工具不起作用。

Can anyone advise on a preferable procedure?

有人可以建议一个更好的程序吗?

4 个解决方案

#1


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.

从1.4.x发布以来,Subclipse处理得非常好。如果您有错误,请报告。在之前的版本中,它处理了一些情况但不处理其这是由于SVN 1.5中修复的Subversion限制。例如,在SVN 1.5之前,如果重命名了文件夹,则无法重命名文件夹中的文件(直到提交文件夹为止)。这些事情都是非常常见的重构,SVN会阻碍它们。

It all works pretty well now though.

虽然这一切都很好。

Mark

#2


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.

我讨厌走进去说'你在做什么',但是因为你的主题提到Subclipse - Subclipse与Eclipse的重构工具集成在一起。颠覆也是如此。重命名一个类时,它会为你执行'svn mv'。您永远不需要尝试手动复制这些移动。

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.

我想知道是否由于某种原因Subclipse没有附加到你的项目 - 如果它不知道你的项目是一个Subversion项目。显然它不会做任何事情。

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

如果你没有使用Subclipse / Subversive ...开始。 :)

#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.

实际上,我也试过了subclipse,它似乎处理得很好,至少在版本1.4.7。我只是尝试重命名一个包和一个类。 Eclipse将旧标记标记为已删除,并添加一个新计划,计划添加到存储库。

#4


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

在Eclipse中重构时,Subclipse将处理svn移动/重命名。

#1


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.

从1.4.x发布以来,Subclipse处理得非常好。如果您有错误,请报告。在之前的版本中,它处理了一些情况但不处理其这是由于SVN 1.5中修复的Subversion限制。例如,在SVN 1.5之前,如果重命名了文件夹,则无法重命名文件夹中的文件(直到提交文件夹为止)。这些事情都是非常常见的重构,SVN会阻碍它们。

It all works pretty well now though.

虽然这一切都很好。

Mark

#2


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.

我讨厌走进去说'你在做什么',但是因为你的主题提到Subclipse - Subclipse与Eclipse的重构工具集成在一起。颠覆也是如此。重命名一个类时,它会为你执行'svn mv'。您永远不需要尝试手动复制这些移动。

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.

我想知道是否由于某种原因Subclipse没有附加到你的项目 - 如果它不知道你的项目是一个Subversion项目。显然它不会做任何事情。

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

如果你没有使用Subclipse / Subversive ...开始。 :)

#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.

实际上,我也试过了subclipse,它似乎处理得很好,至少在版本1.4.7。我只是尝试重命名一个包和一个类。 Eclipse将旧标记标记为已删除,并添加一个新计划,计划添加到存储库。

#4


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

在Eclipse中重构时,Subclipse将处理svn移动/重命名。