1. 按 http://blog.csdn.net/totogogo/article/details/7871388 在server side安装subversion edge
2. create a repository "testproject" with standard trunk/branches/tags structure in svn, let's say the repository url is http://XXX.XXX/svn/testproject
3. in Xcode, open organizer window, select "Repositories", and then click "+" in the left button corner, select "add repository.."
4. set name as "testproject", set location as "http://XXX.XXX/svn/testproject", set type as "subversion", click next. Input svn username and password.
5. confirm "Trunk" field value is "trunk", "Branches" field value is "branches" and "Tags" field value is "tags", click "add" button.
这时organizer window的左边list会添加一个"testproject" repository with standard folder structure. 假设我们现在要把an existing iOS project "MobileApp1"添加到该repository.
6. select "Trunk" node under repository node, click "Import" button, and then select "MobileApp1" folder, click "Import" button. input commit message, and then click "Import" button.
这时你已经把MobileApp1 commit to svn repository "trunk" folder
7. Quit Xcode! and then delete existing MobileApp1 project, because it is not linked to svn. We must checkout the project from svn repository with following steps.
8. In organizer window, select "Trunk" node under "testproject" repository, and then select "MobileApp1" folder, click "Checkout" button. 然后选择用来存放该project的path, click "Checkout" button. a window popup to ask you if open the project, click "Open" button to open this project. select menu "file > source control > refresh status" to check svn status
这时就会把MobileApp1 checkout到local,你会看到在testproject repository node下多了一个folder "MobileApp1"
9. select this "MobileApp1" node, double click the .xcodeprj to open project
这时你就可以在xcode里进行开发,修改了的file会有"M"标志,添加的file会有"A"标志。当你要commit to svn时
10. select menu "File > Source control > commit". (如何不行,则重启Xcode,如果还不行,就open organizer window, select the "MobileApp1" folder node mentioned in step 9, and then click "Commit" button)
当你想download the latest svn时
11. select menu "File > Source control > update". (如何不行,则重启Xcode,如果还不行,就open organizer window, select the "MobileApp1" folder node mentioned in step 9, and then click "Update" button)
这时svn里的file和local的有冲突,就会出现标志。会出现一个window列出所有修改,添加的file list,但那个"update" button是灰化的,在file list里right click任何一个file,select "check all",奇怪,update button enable了,click it! done!
有时对于 出现"M"标志的files,需要select menu "File > source control > discard change…"来update!
如果你想revert to old version in svn, sorry,Xcode不提供这个feature。Xcode can commit, switch branches, branch/merge, diff previous versions, update to HEAD, but you can't revert.
ref link: http://stackoverflow.com/questions/5417687/where-is-the-revert-option-in-xcode-4s-source-control
如果其他developer要从svn加载project,则可以重复上述的steps,除了step 1, 2 and 7!