2011-10-21 71 views
2

我從我的環境中刪除了一堆文件,並提交了更改。 當然,我現在想讓他們中的一個回來。我犯了一個svn文件刪除,現在我想要它回來

將ONE文件退出修訂版本的最佳方法是什麼?

我已經從包上查看歷史記錄(這是一個Java文件),但沒有看到一種方式,使其複製和粘貼的方式。

的Eclipse 3.7.0,Subclipse的1.6

UPDATE

它看起來像安東尼奧·佩雷斯和qor72解決方案既實現目標。安東尼奧的日食可以完成,但回覆次數可能很大。還合併一個提交打開更改的請求。

我喜歡qor72的解決方案。在這種情況下訪問副本:

  1. 查看歷史記錄並查找刪除的文件。
  2. 右鍵單擊文件名並選擇複製。
  3. 選擇原始目錄。
  4. 好的。
+0

如果你只需要一個文件,這有什麼錯複製和粘貼? – JJJ

+1

在複製和粘貼的情況下,我假設svn會將它們視爲兩個不同的文件,而不是相同的文件。這可能會導致合併兩個分支的合併問題。我們所知道的是同一個文件,會導致合併中的樹衝突。 – Aaron

+0

@Aaron:如果按照我在答案中所說的那樣進行操作,這應該不成問題。 –

回答

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

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. 
相關問題