Xcode中使用SVN(进行多人开发)需要注意的问题

来源:互联网 发布:java初级编程题 编辑:程序博客网 时间:2024/04/29 02:04

转载自:http://marshal.easymorse.com/archives/4030

Xcode的SVN功能,和Eclipse中的subclipse或者windows下的tortoiseSVN比较起来功能还差很多。

我是索性不用的,直接用命令行。我看有的朋友是用subclipse,其实也挺好,不过,为了使用SVN功能要单独开一个耗费资源的Eclipse。

但是,不论使用什么SVN工具,都会遇到Xcode固有的问题,即project.pbxproj文件的提交冲突问题。

project.pbxproj文件里面包含了构建过程所需的所有文件,如果你在项目目录下增加了新文件,比如没有通过Xcode,该文件就不在project.pbxproj文件中,就不会生成到app中。同理,如果你从SVN中更新到其他项目成员增加的文件,而没有更新project.pbxproj文件(或者该成员根本就没有提交这个文件),则也会出现相同的现象。

如果项目成员提交了新的project.pbxproj文件,你这边没有在项目中增加新的文件,直接svn update就可以了。我是用命令行做update的,即:

svn up

这时可能会出现系统提示,因为subversion发现了local work copy和repository上的不一致。需要svn用户自己裁决,可以直接输入tf,即使用repository上版本即可,因为你没有更改project文件。即:

Conflict discovered in ‘EuM1.xcodeproj/project.pbxproj’. 
Select: (p) postpone, (df) diff-full, (e) edit, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: s

  (e)  edit             – change merged file in an editor 
  (df) diff-full        – show all changes made to merged file 
  (r)  resolved         – accept merged version of file

  (dc) display-conflict – show all conflicts (ignoring merged version) 
  (mc) mine-conflict    – accept my version for all conflicts (same) 
  (tc) theirs-conflict  – accept their version for all conflicts (same)

  (mf) mine-full        – accept my version of entire file (even non-conflicts) 
  (tf) theirs-full      – accept their version of entire file (same)

  (p)  postpone         – mark the conflict to be resolved later 
  (l)  launch           – launch external tool to resolve conflict 
  (s)  show all         – show this list

Select: (p) postpone, (df) diff-full, (e) edit, 
        (mc) mine-conflict, (tc) theirs-conflict, 
        (s) show all options: tf

 

在这里,如果记不清楚各个选项的含义,可以输入s了解。另外,如果不确定自己是否更改了本地的project文件,可以输入dc了解本地代码和repository上的差异。

但是,如果你也为项目增加了新文件,这样你的本地project文件和repository上的project文件都有新的内容。我现在的做法是p,即手工解决冲突,然后再次提交,通知项目成员更新。详细介绍可参考:http://www.logicaltrinkets.com/wordpress/?p=178,写的挺清楚的,英文的。


原创粉丝点击