如何使用 Subversive 在 Eclipse 中正确重命名包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1310379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to rename a package in Eclipse with Subversive correctly?
提问by guerda
I recently found some problems when I tried to rename a package in a Java project with Eclipse. I use Subversive for SVN integration.
我最近在尝试使用 Eclipse 重命名 Java 项目中的包时发现了一些问题。我使用 Subversive 进行 SVN 集成。
If I rename a package via Refactor -> Rename, the commit fails.
如果我通过 Refactor -> Rename 重命名包,则提交失败。
I have to rename it in a somewhat strange way:
我必须以一种有点奇怪的方式重命名它:
- Create the new package as a new empty folder
- Select all classes to rename
- right click -> Team -> Switch
- Enter new path.
- 将新包创建为新的空文件夹
- 选择所有要重命名的类
- 右键单击-> 团队-> 切换
- 输入新路径。
After the commit, the rename is done, but very ugly.
提交后,重命名完成,但非常丑陋。
How to do this on a nicer way?
如何以更好的方式做到这一点?
采纳答案by VonC
When you read the Subversive documentation on Refactoring, you do have this warning:
当您阅读有关Refactoring的 Subversive 文档时,您确实收到了以下警告:
While refactoring, the structure of the versioned folder is changed, so if it's not up-to-date the conflict while committing is inevitable.
So the user must be sure, that he has updated the resource being refactored to the repository location revision.
Remember that the folder is considered to be not up-to-date even if only its revision number on the repository is changed.
在重构时,版本文件夹的结构发生了变化,所以如果它不是最新的,提交时的冲突是不可避免的。
因此用户必须确定,他已将正在重构的资源更新为存储库位置修订版。
请记住,即使仅更改了存储库上的修订号,该文件夹也被视为不是最新的。
It should work from Eclipse, but you need an up-to-date resource.
它应该可以在 Eclipse 中运行,但您需要一个最新的资源。
回答by nhunsaker
Niko's right. Here's what I do when I want to rename a file within a project in Subclipse (subversion for Eclipse):
尼科说得对。当我想在 Subclipse(Eclipse 的颠覆)中重命名项目中的文件时,我会这样做:
- go to SVN Repositories, and "Rename/Move" the resource.
- in the project perspective, right-click the recently renamed file and click "Team", "Update to Head". The previously name file will disappear from the view but don't worry.
- Right-click "Team", "Synchronize with Repository", and it will take you to the Synchronize perspective.
- Right-click the properly named resoure and select "Update". that's it
- 转到 SVN 存储库,然后“重命名/移动”资源。
- 在项目透视图中,右键单击最近重命名的文件,然后单击“团队”、“更新到主管”。以前的名称文件将从视图中消失,但不要担心。
- 右键单击“团队”、“与存储库同步”,它将带您进入同步透视图。
- 右键单击正确命名的资源并选择“更新”。就是这样
回答by Niko
you should rename/move the package first within svn (rightclick in svn explorer). then you update all the classes (you will get an error for each class that you can rightclick and solve)
您应该首先在 svn 中重命名/移动包(在 svn 资源管理器中右键单击)。然后你更新所有的类(你会得到一个错误,你可以右键单击并解决每个类)