简体   繁体   中英

What is the preferable workflow with svn(subversion) using xcode(objective-c)?

We have been using svn with xcode for 2 weeks and bumping into many awkward problems, which is probably from misuse and inexperience. Our ios team is a composed of junior team members, since all senior programmers can not write objective-c.

  1. Resource files are not included in the svn, every time the designers update a resource(images, sqlite), the developers must manually import the files into the project. The programmers explain that this is an inherited problem with xcode, which in detail, is that the resources are unzipped the first time the program is run, and to update resources, they need to directly copy the resources to the project and the simulator.
  2. The developers are always refactoring when they are merging. They explain that every time they merge, the project breaks unexplainably, and they have to restart from scratch, which is supposedly faster.
  3. The root directory is littered with version directories, which isn't quite right at all. I know that tags should be used instead, but not exactly knowing when or how.
  4. I've been tinkering with a CI, specifically Hudson, but running into errors with a slave builder(missing xcodeproject). Should I use bash scripts instead?

So what is the preferable workflow for version-control under the mac?

You've mentioned a number of problems, several of which IMO have little to do with Xcode or Subversion. Let's take your numbered items:

  1. Subversion can absolutely handle resource files, and you should use it to control those files. The designers can and should be taught to use svn to check files in and out at the command line, or should be given (and trained on) one of the GUI svn clients such as Versions .

  2. It sounds like your junior developers should also be trained on Subversion. It is true that merging can cause problems, but nothing that should ever cause you to start from scratch in any respect. Many shops have a set of simple rules like: a) The main development branch should always build without errors or warnings; b) If you break the main dev branch while merging (or doing anything else), it's up to you to fix it ASAP. Developers can merge their changes and fix whatever problems crop up before they commit to the main branch, so there's little excuse for the main branch to ever be broken.

  3. The conventional Subversion setup has trunk , branches , and tags directories. You don't have to do it this way, but people do because it works well. Please read (and have your team read) Version Control with Subversion for a thorough treatment of all these issues. Printed copies are available from O'Reilly -- buy several, at least. Exactly how you organize your repository isn't as important as getting the team to agree to (and stick to) some organization scheme.

  4. I don't have an opinion on Hudson or continuous integration generally. However, I doubt that implementing CI is going to help much until you get the other issues sorted.

Other thoughts:

  • It's time for your senior developers to learn some Objective-C. Get the junior developers to teach them -- both groups will learn a lot.
  • Xcode really shouldn't be much of a factor here. Sure, it has integrated support for Subversion, but it's still just a svn client, and the user still needs to know how to branch, how to merge, how to resolve conflicts, what the conventions are for creating branches and naming tags and such in your organization, etc.

To address your actual question, a typical work flow is something like this, depending on local convention:

  • Developer starts working on a task. Opens the task in the defect tracking system, enters analysis of the bug to be fixed or feature to be implemented, enters a plan or design for the code to be changed or added, enters a time estimate or level of difficulty or similar, possibly enters a test plan for the change.
  • Developer creates a new branch for the change, or brings their own branch up to date with the main branch.
  • Developer implements changes, committing to their development branch often to avoid losing work and so that they can easily go back to previously committed versions.
  • When ready, developer checks out main development branch to another directory on their machine. They can then merge changes to that directory to ensure that the project builds and nothing has been broken by their change.
  • Developer commits the changed main dev branch.
  • Developer updates task in defect tracking system.

There's usually some informal communication between developers so that two people don't end up making major conflicting changes to the same part of the code at the same time. Some of this can be handled by the person assigning the tasks, but developers who are working well as a team usually have some idea of who is working on what. If that's not the case, or even if it is, you might need to implement some practices to improve communication, like periodic code reviews, going to lunch together, etc.

In general, I would say the first step to have a good basic understanding of how to use svn in a command-line environment. There are some basic operations (tagging, setting the "ignore" property) that are difficult (impossible?) to do within XCode (at least in XCode 3). For a developer who's comfortable with how to use svn in a generic Unix/Linux environment, there's really not much they have to learn that's specific to XCode - just exclude the build directory and per-user XCode settings files (see below).

(1.) isn't correct. There's no reason your images etc. can't be included in svn. Normal XCode setup would be that your images (etc.) would be in a "Resources" folder in the source, and would get copied into the application image as part of the "Copy Bundle Resources" phase of the XCode build.

The entire XCode project folder should be included in svn, with the following exceptions:

  • the 'build' directory
  • per-user XCode settings/history in AppName.xcodeproj/*.pbxuser and AppName.xcodeproj/*.mode1v3

You likely want to tell svn to ignore these directories by doing something like:

 svn propedit svn:ignore .

(2.) There's no reason stuff should be happening "unexplainably". If nothing else, run a manual svn update in a terminal window, and it will tell you exactly what files it updated.

(3.) Standard practice is to have "trunk", "tags", and "branches" directories in the root. The trunk is what you're normally working with, so the first step a new developer would take is to check out the latest "trunk" version

svn co svn+ssh://host.com/repository/AppName/trunk AppName

After making some changes, save them to the repository with svn commit (or "Commit Changes..." within XCode's "SCM" menu). Pick up changes made by other developers with svn update (or "Update To" within XCode).

To tag a release, copy trunk to tagname :

svn cp svn+ssh://host.com/repository/AppName/trunk svn+ssh://host.com/repository/AppName/tags/version1

(4.) I don't have experience with Hudson, so I can't comment on that, although "missing xcodeproject" sounds like maybe the AppName.xcodeproj directory might be missing from svn.

I generally agree with David Gelhar's answer.

In addition to item 1, you can actually commit everything in your project's source, including the resources, but there are some things that is better to leave out, like your .pbxuser file. This blog post is a good resource for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM