XCode中使用SVN 教程
修改subversion.config方法:
可以直接在终端上输入:vi ~/.subversion/config来编辑.
也可以通过Finder搜索.subversion,点击下边的+号,进入高级搜索界面,找到各类->其他-> 文件可见性 ,选择不可见文件即可搜索到.subversion文件夹.
隐藏文件文件名是 .subversion
mac下怎么保存终端下更改的项目(^O WriteOut)
As newly anointed Xcode developers, and now with the release of Xcode 4. We found our team working on trying to get connected to a new subversion (svn) server at the same time we were trying to discover some new features of Xcode 4.
about challenging.
Actually this was the first time with anything Apple we have not had a great experience. Loads of talk etc on the net about what a pain in the bum it all is.
For those who don’t know. Subversion is a code storage system that allows check in / check out of developer Xcode to a server. There are services online that you can pay monthly to for the use of a SVN server. We wanted to host it on one of our own servers.
The setup was not easy and required the setup of a new Linux server, then the setup of the SVN code to turn it into an SVN server.
What became confusing was when we needed to get Xcode to talk to the darn thing. Here is the important things you need to know.
First Contact
Just like the movie from when I was a kid, “First encounter” is a big deal! Big enough to heap your mashed potato into a big mountain!
1. Open Xcode and select Window / Organiser.
2. Select Repositories
3. Bottom left, click the +
4. Add the details of the SVN server. Like this: svn://www.servername.com/directory (this should be the details for your SVN Server).
5. Where asked for Trunk Branches and Tags (leave empty for now).
Now we nee to use the “Terminal” program to make a connection to SVN.
1. Create a test.txt file with some simple message in it. Save it in your documents folder on your mac.
2. Open Terminal
3. Type “svn import /Users/yourname/Documnets/test.txt svn://www.servername.com/directory -m“initial import” –username yourname
Note:
the path “/Users/yourname/Documnets/test.txt” should be a path to any single dummy test.txt file. The idea is that we are uploading a single file to establish a connection.
The: svn://www.servername.com/directory is the path to your SVN server
“initial import” is only a tag line. Not needed
–username yourname = This is your SVN user name. Ensure you use a double dash –username.
EG: our code looks like this:
svn import /Users/spascoe/Documents/Temp/test.txt svn://www.interactivewebs.com/interactivewebs -m “test import”
4. You will be prompted with your existing user for your user password. At this point, if your mac user name does not match the configured SVN user name. Just hit enter. It will then prompt of a user. Type the new SVN user name, then enter. Then the configured SVN pass and enter.
5. You will likely see something that says. “svn://www.servername.com/directory already exists” – Ignore that!
6. Close Xcode
7. Open Xcode again and return to the Optimizer / Repositories and with luck, your server will list on the left hand side, and show the ROOT and any folders on the SVN server.
8. Click back on the server name in the left hand column.
9. Type in the names of the Trunk Branches and Tags folders. We chose to use these names to make it easy. They need to be setup on the SVN server by the administrator. They ARE case sensitive.
10. The text.txt file can be deleted from the server through Xcode if desired.
11. Close the terminal session.
Thoughts
Sometimes not all views refresh correctly. We suggest closing Xcode and opening it again to get things visible that you know should be there.
If you need to change user names, and or passwords. Then you will need to enter the terminal again and upload something using the method above.
We don’t understand exactly why, but it appears that Xcode will remember the authentication of the terminal session, and caches the authentication properties some place. Without the terminal session upload, you will never get it working!
配置Xcode SVN从零开始
本节介绍一下从零配置Xcode SVN,Xcode 2.0 是开发人员建立 Mac OS X 应用程序的最快捷方式,也是利用新的苹果电脑公司技术的最简单的途径,而SVN是版本控制工具,那么Xcode SVN又是什么呢?如何配置Xcode SVN?本节就向大家一一讲解。
一、SVN干什么用的?
如果你重没接触过svn,也许这篇文章会对你有点帮助。一个大project总是很多人一起在开发,每个人都会更新这个project的sourcecode,svn就是为了方便大家一起维护管理sourcecode而诞生的。(svn真是不可多得的好东西!很奇怪LTE那么大的工程那么多人做,实验室怎么没人提倡用svn呢?)
我刚开始自学iphone的时候真的特别笨!代码需要一次又一次的修改,但有时修改后反而不能运行又找不出错在哪儿,“恢复”原来版本重新修改是一种好办法,可惜那时候我没听说过svn走了很多弯路,我人工的为每个project存储了很多版本,最后搞得自己也不知道哪个版本能用不能用了,实在费时费力又没效率!后来yile大大教我在Xcode上配置使用svn,生产力一下子从原始社会进入封建社会,省了不少事啊。
二、Xcode SVN配置方法
Mac自带svn,所以我们就不需要下载了,稍稍修改一下subversion配置就能使用。大大教了两种方法:方法一、适合团队合作的当然是把sourcecode放在服务器上,这样大家都可以下载、更新,不过通常这种服务器都是要收费滴(公司内网设个服务器是不是可用,这个我还没学);方法二、如果只是用于管理自己的程序,那么直接把本机当作服务器来配置就可以了~
配置Xcode SVN方法一:
Leopard中自带了SVN,但Xcode的项目文件中,并不是所有文件都适于加入SVN中进行管理,比如编译后的文件和编译过程中产生的文件,这些文件不属于源代码,应该告诉svn忽略掉,方法:
编辑~/.subversion/config文件
1.找到global-ignores一行,去掉注释,编辑成
global-ignores=build*~.nib*.so*.pbxuser*.mode*.perspective*.DS_Store
Xcode项目文件中有些文件是文本文件,需要告诉SVN,因为SVN能更好地管理文本文件
2.找到enable-auto-props=yes把注释去掉,在[auto-props]Section声明以下文本文件
*.mode*=svn:mime-type=text/X-xcode
*.pbxuser=svn:mime-type=text/X-xcode
*.perspective*=svn:mime-type=text/X-xcode
*.pbxproj=svn:mime-type=text/X-xcode
先去http://svn.w18.net/注册一个帐号,可以免费使用一个月练练手。登录后创建一个项目,打开Xcode->SCM->ConfigureSCMRepositories,填写信息如下图,然后我们就可以import、checkout操作了,这里解释一下库(repository)和服务器、本机之间的关系。库记录着所有版本的代码信息,无论你是从服务器下载更新代码(update)还是想将本地修改后的代码上传至服务器(commit)都要经过Repository;它就像一个仓库,从厂家运来的货物、卖出去的货物都记录得清清楚楚,随时查随时有。第一次使用时,服务器上没有sourcecode,需要将第一份源码import到库中,库就自动将sourcecode上传至服务器了。接下来,怎么更新、上传源码呢?通过checkout可以将服务器上代码下载至本机指定路径,那么每次修改代码后,commit操作即可更新本地代码至服务器,而update可将服务器上最新版本更新至本机,如果你想恢复以前某个版本也很简单,updateto某个revision版本即可(由于学校教育网,无法连接至服务器,具体操作在方法二中演示)。
XCode中使用SVN 教程是本文要介绍的内容,Xcode 是开发人员建立 Mac OS X 应用程序的最快捷方式,也是利用新的苹果电脑公司技术的最简单的途径,而SVN是版本控制工具,那么Xcode SVN又是什么呢?如何配置Xcode SVN?
Xcode SVN配置方法
Mac自带svn,所以我们就不需要下载了,稍稍修改一下subversion配置就能使用。大大教了两种方法:
第一步,配置 Subversion
Leopard中自带了SVN,但Xcode的项目文件中,并不是所有文件都适于加入SVN中进行管理,比如编译后的文件和编译过程中产生的文件,这些文件不属于源代码,应该告诉svn忽略掉,方法:
编辑 ~/.subversion/config 文件
注意:如果”.subversion”目录不存在,请运行”svn status”命令,虽然此命令会失败,但是会为你创建所需要的文件.
open ~/.subversion/config 打开文件
1. 找到 global-ignores 一行,去掉注释,编辑成
- global-ignores = build *~.nib *.so *.pbxuser *.mode *.perspective*
Xcode项目文件中有些文件是文本文件,需要告诉SVN,因为SVN能更好地管理文本文件(谁用谁知道)
2. 找到 enable-auto-props = yes 把注释去掉,在[auto-props] Section声明以下文本文件
- *.mode* = svn:mime-type=text/X-xcode*.pbxuser = svn:mime-type=text/X-xcode*.perspective*
- = svn:mime-type=text/X-xcode*.pbxproj = svn:mime-type=text/X-xcode
第二步,配置Xcode
我们熟悉的Version Control在Xcode中叫做SCM(Software Configuration Management,学习CMMI的时候整天看到,原来就是Version Control),
1. 在Xode的菜单中选择 SCM -> Configure Repositories,填写SVN服务器的信息
2. 然后选SCM -> Repositories 你就可以Import, Check Out你想要的内容了,SVN的日常管理也可以在这里做。
3. Checkout项目以后在你的项目的属性中设置项目的SCM
4. 设置好以后,你在你的项目视图中就可以看到新的一列,M表示该文件已经修改过,然后你已经可以通过SCM菜单,或者右键菜单直接进行SVN的操作, commit,update,revert,diff and log,任何你想要的。
SCM->Get SCM Info 可以看到任何文件的版本信息。
小结:XCode中使用SVN 教程的内容介绍完了,希望本文对你以后帮助!关于XCode的更多内容请参考编辑推荐。
【编辑推荐】
IOS开发系列之阿堂教程:构建IOS应用开发的 svn的服务端和客户端环境实践
(2012-03-24 20:39:21)