我提交了一个svn文件删除,现在我想要它

时间:2011-10-21 15:28:54

标签: eclipse svn subclipse

我从env中删除了一堆文件并提交了更改。 当然,我现在想要其中一个回来。

将ONE文件退回修订版的最佳方法是什么?

我已经从文件包中的View History中提取了文件(它是一个java文件),但是没有办法让它无法复制和粘贴。

Eclipse 3.7.0,subclipse 1.6

更新

看起来像AntonioPérez和qor72解决方案都实现了目标。安东尼奥可以在日食中完成,但恢复的数量可能很大。还合并一个提交打开更改的请求。

我喜欢qor72的解决方案。要在此方案中访问副本:

  1. 查看历史记录并找到已删除的文件。
  2. 右键单击文件名并选择复制。
  3. 选择原始目录。
  4. 行。

3 个答案:

答案 0 :(得分:1)

可能subclipse客户端允许一种简单的方法。但是,如果您想尝试命令行客户端。

$ cd <working_copy_path>
$ svn merge repo_url[@M] repo_url[@M-1]

M是您提交已删除文件的修订版。并且您应该将您删除的所有文件作为工作副本中的添加文件返回。然后

$ svn commit <your_file_to_be_recovered>
$ svn revert (to remove the rest of added file that you don't need back)

Further info on the svn merge command

答案 1 :(得分:1)

我过去所做的就是恢复文件per the SVN documentation,例如:

$ svn copy ^/calc/trunk/real.c@807 ./real.c

然后重新添加/提交,然后离开。

答案 2 :(得分:0)

您可以按照以下步骤将其取回

1. Identify the folder in the project which contained the deleted files.

2. Right click the folder, select Team  -> Merge 

Within Merge Pop up Window

3. On the URL tab, Browse and select the "repository resource to merge with" i.e the same folder in the repository.

4. Select Revisions radio button,

5. Click Browse button to select revisions.

6. Select the revisions which you want to be restored ( select the revision wherein you deleted the files / folders )

7. Enable Reversed merge.

8. Click Preview and check that it shows an entry for the file / folder which you plan to restore.

9. Click OK 

10. Eclipse now switches to SVN Merge and with the Synchronize view.

11. In the Synchronize view, right click the files you want and select Accept

12. In the Synchronize view, use the Synchronize SVN icon to switch from SVN Merge to SVN, where you can see the restored file as an outgoing change.

13. Right click the file  -> Team -> commit to check in the file again to the repository.