views:

1694

answers:

6

There are 2 members in our team. We use Xcode's SCM (use SVN) to manger our source code files. We all add files to our Xcode project. He has commited to svn server. When I update, Xcode find there has conflicts in project.pbxproj file.Then I select quit Xcode and manual merge the conflicts. Then I start to edit my project.pbxproj, merge our changes. Actually I don't konw how Xcode manage files, I just add some text that my project.pbxproj file did't had. When I finish it, my project can't open. I guess that because the project.pbxproj file can't be edit by manual.

So, I want to know, when you find this problem, the project.pbxproj file have conflicts, how to solve it?

Thank you!

+1  A: 

Unfortunately, there's not much you can do except to make the changes manually in one check out and then check-in the newly "merged" project.

Barry Wark
+3  A: 

The best thing to do might be to simply accept either your version or his version in its entirety, without trying to combine the two. Also, consider whether the file in question is something that should be in the repository at all; it may be more appropriate to let each person have their own version of it.

Check out the documentation on how to resolve conflicts.

Michael Hackner
This. The .pbxproj files are fairly simple (if verbose) files, and the usual merging technique generally works just fine, as long as you're patient.
Stephen Canon
`project.pbxproj` is an important file to put in your repository, since it tells Xcode how to build the project. Not checking it in is equivalent to not checking in `Makefile`.
Steve Madsen
A: 

@Barry Wark,@Michael Hackner and @Stephen Cannon, Thanks for your answers, you are all right, but use different ways. Now my way is: my team friend commit his source code files, then i'm to update them except the .pbxproj file, and then I add his new files in my Xcode project. In this way, I avoid to manual edit the .pbxproj file, and I can keep our project the same.Is that stupid?

@Stephen Cannon, I don't know how to edit the .pbxproj file, everytime I edit it, especially add some file's items, I find Xcode can't work, I can't understand the rules that how .pbxproj manage the project's files. Is there some documents or same information about it?

vcLwei
Perhaps because project.pbxproj is a binary file, and when you edit it, your editor probably saves it as a text file.
MattDiPasquale
`project.pbxproj` is an XML file, since at least Xcode 3.1-ish. It's more likely that the manual merge broke the format of the file, and Xcode can't recover while parsing it.
Steve Madsen
+4  A: 

I use git but we see the same issue - if two people add files there's a merge conflict.

Usually the editing is very easy though. Simply go into the project.pbxproj file with a text editor, and look for the merge conflict section - usually this is marked by something like :

>>>>>>>
Stuff 1
======
Stuff 2
<<<<<<<<

In 99% of XCode project merge conflict cases, you simply want to accept both sides of the merge (because two people added different files) - so you would simply delete the merge markers, in the above case that would end up like:

Stuff 1
Stuff 2

Like I said, this works great in MOST cases. If XCode will not read the project file when you are done, just take the most recent un-merged version and manually add your files again.

Kendall Helmstetter Gelner
A: 

There needs to be a solution other then the ones mentioned above. All of this seems to be a step back then a step ahead. I cannot believe that a company like Apple is so short minded. How do you work in big projects with multiple developers in XCode? Does anyone figured this out? We cannot afford risking the project file or even wasting our time on this matter. We handled big flash projects with the complexity of binary flash files before with locking mechanisms in place. Xcode does not even support locking... One un-mergeable central project file seems to be the end of the story?! Is there a way to avoid the central project file or should we setup a central computer station just for the xcode projects and developer can only use the one station for creating and adding files to not have conflicts with the project file?

benvoss
A: 

@benvoss the locking function isn't manage by Apple though. When u try to commit files into a server, your database is responsible to lock or unlock it. Nothing to do with Apple's SVN client.

MaXi32