1. 程式人生 > >svn: is out of date

svn: is out of date

一句話總結下,先還原,再更新,再修改提交,OK

svn: Item is out of date

    使用Svn提交時候遇到如下錯誤:

    Deleting       E:/bdf-d7/bdf-dorado7/src/com/bstek/bdf/d7/cms/dir
    Item is out of date
svn: Commit failed (details follow):
svn: Item '/trunk/bdf-dorado7/src/com/bstek/bdf/d7/cms/dir' is out of date

遇到這個錯誤原因是本地的資原始檔版本不是伺服器上面最新的版本,因此修改本地檔案再提交時候,就會報Out of date錯誤。

解決辦法,修改檔案時候一定要首先保證和伺服器一致,再做修改;而此時 需要先將本地檔案還原(記著備份哦),再更新和伺服器一致後再做修改。

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".

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