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

发布于 2024-07-12 12:29:07 字数 252 浏览 8 评论 0原文

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

  1. 使用漂亮且有用的 Eclipse 重构工具这很棒,因为所有级联任务都为我完成了。 然而,我随后与 Subversion 进行了艰苦的斗争,以将更改复制回存储库。
  2. 我可以先在 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:

  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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

拥抱影子 2024-07-19 12:29:07

自 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

花间憩 2024-07-19 12:29:07

我讨厌走进去说“你做得不对”,但由于你的主题行提到了 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. :)

浅浅 2024-07-19 12:29:07

你尝试过颠覆吗? 重构似乎对我来说效果很好。

实际上,我也尝试过 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.

笑着哭最痛 2024-07-19 12:29:07

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文