1. 程式人生 > >解決Subclipse進行commit的時候出現 file out of date和remains in tree-conflict的方法

解決Subclipse進行commit的時候出現 file out of date和remains in tree-conflict的方法

今天commit最新修改好的指令碼到Google code的時候,由於網速問題中斷了,再次提交的時候,Subclipse提示某某文件"file out of date".

於是一頓神搜,在官方網站的FAQ裡找到一段解釋:

I am trying to commit some changes and I am getting an error message about the transaction being "out of date". What does this mean and what should I do?

Whenever you see "out of date" in an error message it means that the revision of the item in the repository is newer than the copy in your local working copy. The solution is always going to be to run an update, so that your working copy is up to date with the repository, and then do the commit again (assuming that the update did not generate any conflicts). For files, this is usually pretty easy to understand how and why this happens. However, Subversion also versions folders, and it is usually with folders that this problem most often happens. Subversion does not allow you to delete/rename a folder OR change its versioned properties, UNLESS the local copy of the folder is at the HEAD revision of the folder in the repository.

Your next question might be: "OK, I can maybe understand that, but why is my folder out of date? I am the only person working in this repository." That is a valid question, the answer lies in the way that Subversion works. When you commit a change to a file, the revision of the file in your working copy is updated to that new revision when the commit completes, however the version of the parent folder(s) of that file is not updated. This is because there may have been adds/deletes to other files in that folder and until you have run an update, the folder is not really at that new revision. This is called "mixed revision working copies" and is probably explained better in the Subversion book.

In summary, the answer is always to do an update so that the folder or file is updated to its HEAD revision.

看了上面的解釋我才知道是這個錯誤時由於我的working copy刪除移動了某個目錄引起,開始我還以為是因為第一次commit中斷引起的呢.

解決方法就是將working copy 進行"Update to HEAD"的操作. 這時Subclipse提示我有一個我已經刪除的目錄有衝突,我沒理它,直接commit,結果出現某某目錄"remains in tree-conflict".

根據這篇文章提供的方法:

右擊你要刪除的目錄–>team–>Show Tree Conflict–>在Eclpise中會出現一個Tab檢視顯示Tree Conflict的內容,一個一個選擇列表中的衝突右擊將其標誌為已解決,然後回到專案再提交更改就可以了。

最後,我終於能夠正常commit了~~~