svn-经常遇到问题解答办法积累(一)

时间:2023-03-10 06:58:29
svn-经常遇到问题解答办法积累(一)

1.对于一个SVN使用新手,第一步,肯定是如何获取代码到本地指定的目录。

步骤:

(1)新建一个存放svn中某一个代码库的目录,加入该目录命名为:Proj1SVN

(2)右键鼠标,选择SVN CheckOut菜单项,弹出Checkout对话框,如图,

在“Url of Repository”的文本框中,填入源代码在SVN服务器的位置:例如http://192.168.1.100:8550/svn/Proj1SourceCodeSVN/

在Checkout Directoty文本框中,填入当前目录所在的磁盘目录路径:例如E:\Proj1Svn

,然后点击OK按钮即可,接下来就是等待获取代码完成。

2.设置忽略的目录及文件。

打开一个文件夹,鼠标右键,打开快捷菜单,选择TortoiseSVN->Setting,在打开的“Settings -TortoiseSVN”对话框中,默认的打开界面的右侧,有个分组Subversion,在Global ignore pattern:中输入:

*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__ *.rej *~ #*# .#* .*.swp .DS_Store [Tt]humbs.db bin obj *.scc *.log

说明:对于asp.net项目,需要忽略bin目录,obj目录等

3.svn: Item is out of date

请参见原文:http://chenjinbo1983.iteye.com/blog/1898078

一句话总结下,先还原,再更新,再修改提交,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错误。 解决办法,修改文件时候一定要首先保证和服务器一致,再做修改;而此时 需要先将本地文件还原(记着备份哦),再更新和服务器一致后再做修改。 http://*.com/questions/2805546/svn-item-folder-is-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.