如何使用 Eclipse 重构工具并通过 Subclipse 与 SVN 保持同步?
我发现,当我需要重命名 Java 类(以及源文件)或需要更改包名称(因此移动源文件)时,我可以:
- 使用漂亮且有用的 Eclipse 重构工具这很棒,因为所有级联任务都为我完成了。 然而,我随后与 Subversion 进行了艰苦的斗争,以将更改复制回存储库。
- 我可以先在 Subversion 中发出重命名/移动,然后更新本地,然后 Eclipse 中的重构工具就不起作用了。
谁能建议一个更好的程序?
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:
- 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.
- 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
自 1.4.x 版本以来,Subclipse 很好地处理了这个问题。 如果您有错误,请报告它们。 在之前的版本中,它可以处理某些情况,但不能处理其他情况。 这是由于 SVN 1.5 中修复的 Subversion 限制造成的。 例如,在 SVN 1.5 之前,如果重命名文件夹,则无法同时重命名该文件夹中的文件(直到提交该文件夹)。 这些都是非常常见的重构,而 SVN 会妨碍它们。
不过现在一切都运转良好。
标记
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
我讨厌走进去说“你做得不对”,但由于你的主题行提到了 Subclipse - Subclipse 与 Eclipse 的重构工具集成了。 颠覆也是如此。 当您重命名一个类时,它会在下面为您执行“svn mv”。 您永远不需要尝试手动复制这些动作。
我想知道是否由于某种原因 Subclipse 没有附加到您的项目 - 如果它不知道您的项目是 Subversion 项目。 那么显然它不会做任何事情。
如果您不使用 Subclipse/Subversive... 开始。 :)
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. :)
你尝试过颠覆吗? 重构似乎对我来说效果很好。
实际上,我也尝试过 subclipse,它似乎处理得很好,至少在 1.4.7 版本中是这样。 我只是尝试重命名一个包和一个类。 Eclipse 将旧的标记为已删除,并添加一个新的,计划将其添加到存储库中。
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.
当您在 Eclipse 中重构时,Subclipse 将处理 svn 移动/重命名。
Subclipse will take care of the svn moves/renames when you refactor in Eclipse.