eclipse 如何使用 Subversive 取消删除文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/497423/
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 undelete a file with Subversive?
提问by Brian Laframboise
Please note: This is a question about the Eclipse plugin Subversive, and not about Subversion itself. Please do not change the title to be about 'Subversion'.
请注意:这是关于Eclipse 插件 Subversive 的问题,而不是关于 Subversion 本身的问题。请不要将标题更改为关于“Subversion”。
So I deleted a file that I really shouldn't have.
所以我删除了一个我真的不应该拥有的文件。
I've found various approaches to restoring the file outside of Eclipse/Subversive, but I was wondering if there was a best/easiest-to-use/history-restoring way to restore the file using the Subversive tool.
我找到了在 Eclipse/Subversive 之外恢复文件的各种方法,但我想知道是否有最好/最容易使用/历史恢复的方法来使用 Subversive 工具恢复文件。
采纳答案by Peter Hilton
- Select the folder in the project that contained the deleted files.
- Right click, select Team > Merge...
- On the URLtab, set the URLto the server URL for the same folder.
- In Revisions, select Revisionsand enter a range that includes the deletion, e.g. 1000-1001, or use the Browsebutton to select them.
- In Revisions, enable Reversed merge
- Click Previewand check that it shows an Addedentry for the files you plan to restore.
- Click OK- Eclipse switches to SVN Mergein the Synchronizeview.
- In the Synchronizeview, right click the files you want and select Accept
- In the Synchronizeview, use the Synchronize SVNicon to switch from SVN Mergeto SVN, where you can see the restored file as an outgoing change.
- 选择项目中包含已删除文件的文件夹。
- 右键单击,选择团队 > 合并...
- 在URL选项卡上,将URL设置为同一文件夹的服务器 URL。
- 在Revisions 中,选择Revisions并输入包含删除内容的范围,例如 1000-1001,或使用Browse按钮选择它们。
- 在Revisions 中,启用反向合并
- 单击预览并检查它是否显示了您计划恢复的文件的已添加条目。
- 单击OK- Eclipse 切换到Synchronize视图中的SVN Merge。
- 在同步视图中,右键单击所需的文件并选择接受
- 在Synchronize视图中,使用Synchronize SVN图标从SVN Merge切换到SVN,您可以在其中看到恢复的文件作为传出更改。
回答by Frank
If you have already submitted the remove then it's now time to roll back to the earlier version. In Subversion you do that with "svn merge", where you merge "backwards" from the current to the previous version.
如果您已经提交了删除,那么现在是回滚到早期版本的时候了。在 Subversion 中,您可以使用“svn merge”来做到这一点,您可以在其中“向后”合并从当前版本到先前版本。
Say you did this:
说你这样做了:
$ svn rm file.txt
$ svn ci -m "don't need that file"
Committed revision 1325.
Now you want to undo this and restore the old revision 1324, i.e. the state just before the remove (the dot is for 'current directory'):
现在您要撤消此操作并恢复旧版本 1324,即删除前的状态(点表示“当前目录”):
$ svn merge -r1325:1324 .
If you are unsure you can do a dry-run first, where svn will print the output of the command, but not actually do anything:
如果你不确定你可以先做一个试运行,svn 将打印命令的输出,但实际上不做任何事情:
$ svn --dry-run merge -r1325:1324 .
The result should indicate that the file is being added (again):
结果应该表明正在添加文件(再次):
A file.txt
回答by waney
you could switch to revision where this file was exist. Edit/copy this file and switch back to the head revison and commit it here.
您可以切换到此文件存在的修订版。编辑/复制此文件并切换回主要修订版并在此处提交。
Also you could merge changes beetween two revisons - head and last revision file was exist in repository and apply changes to your working copy.
您也可以合并两个修订版之间的更改 - 存储库中存在头文件和最后一个修订版文件并将更改应用于您的工作副本。
回答by marcel
Just "Show History" on the folder, file was existing in. Then click through the history and find the lost file.
只需在文件夹上“显示历史记录”,文件就存在于其中。然后单击历史记录并找到丢失的文件。
回答by brunobg
Easier: try to commit, Eclipse will show you the dialog with the changed files, click on the one you want to delete with the right button and pick "Revert".
更简单:尝试提交,Eclipse 将向您显示包含更改文件的对话框,使用右键单击要删除的文件并选择“还原”。
回答by fustaki
I had a similar issue, I deleted a set of files related to a feature that after a couple of months I want to recover.
我遇到了类似的问题,我删除了一组与某个功能相关的文件,几个月后我想恢复这些文件。
The most straightforward solution in my case was to check out in a separate directory the whole project as it was before the file were deleted.
就我而言,最直接的解决方案是在一个单独的目录中检出整个项目,就像文件被删除之前一样。
To do this from the Eclipse Repository View go to your project, right click "Check Out As...", in the modal window write the destination folder, select a suitable date of the past in which the deleted file existed (weird, my plugin does not give the possibility to choose a given revision..) and check out.
要从 Eclipse Repository View 转到您的项目,右键单击“Check Out As...”,在模式窗口中写入目标文件夹,选择已删除文件存在的合适日期(奇怪,我的插件不提供选择给定修订版的可能性..) 并签出。
Now you can easily search, find and copy-paste the files you want to recover.
现在,您可以轻松搜索、查找和复制粘贴要恢复的文件。
回答by dreeves
I guess you're hoping to not resort to the command line but in case it's useful as a last resort, see this question for how to do it from the command line: What's a simple way to undelete a file in subversion?
我猜你不希望使用命令行,但如果它作为最后的手段有用,请参阅此问题以了解如何从命令行执行此操作: 在 subversion 中取消删除文件的简单方法是什么?