can't commit changes in xcode 4 - xcode

i set up a project to be on version control. I imported the project without problems to the server repository. Now, when i commit changes, they seem to be committed as i don't get any errors and it says "Committing" but when i go to check the changes in the repository, i noticed that the changes are not there, so there was no commit even if xcode said it committed. Has anyone had this issue? I don't know where to look to fix it.
Thanks in advance

Not sure if this is your problem, but I would check if Xcode is using your repository or one it set up itself. Look at Repositories in the Organizer window and see if there's anything there you don't want. If there is, you'll have to remove it from that list and delete the hidden .git folder in the project's directory.

Problem fixed! The solution was to erase the project from my hard drive and do a checkout from the repository. That way subversion would know which project was under version control.

Related

Xcode: changing SVN repo details

This is about outdated repo details inside XCode. The case is:
I'm reusing a supporting library from an old project in a new one.
I used "Add files to X project..." functionality to copy them to the new place.
"Automagically" the files were copied with a reference to an old SVN repo, that don't exit anymore.
So... Now I have a project with 2 repos visible, incl. one inactive. I can't commit changes to copied files, as the old repo is still linked.
Two question here:
Is there a way to edit old repo data?
Is there a way to move the copied files to the new repo, where the rest of the project is?
Ultimately I need to commit both parts ;)
Thank you.
OK. So resolving this issues required several steps to be performed. Not sure if all were required, but the eventually I got it right.
Commit all changes you can (in my case all but the folder that was linked with the old repo). Archive your projects.
Go to the root folder of your project and use svn switch --relocate command to merge repos. Details: how to change svn settings
Remove the project from XCode (via Organizer) delete the entire project folder
Remove repos in the Organizer
Fetch whatever was committed in the SVN again. Do that and create a new project. If you see any missing files highlighted in red, like my folder that couldn't be committed, delete it.
Manually add the missing files / folder that to the project, from a local copy.
Now you can commit to the repo!
Tiresome, like most things in XCode... ;)

New files appear in red when checkout to another branch in git

It's obvious behaviour, when adding new files in a branch, then checking out to another branch, those files appear in red. But I tried to remove them and they are definitely removed when gettig back to the original branch where they were created, so it seems it's not a good idea to remove them. So how to handle that since the Xcode is throwing that stupid compiling error. Thanx.
This is not the obvious or correct behavior. Your project file is not checked into your Git repository. Some people think this is a way to avoid conflicts but it's just a way to make your project not compile.
git ls-files *.xcodeproj
Will show you if your project.pbxproj managed by Git.
You fix this by manually fixing your build settings so every thing compiles and runs then checkin your project file. You will need to do this in each branch. Your project file will not only have files that have been removed but missing files that have been added.

Xcode doesn't forget deleted files after a Git checkout of an older commit

I've got Xcode (4.5) running a project stored in a git repository. In theory, I should be able to git checkout different versions of the code (from the command line) to see how things looked at various points in time.
In practice, Xcode doesn't handle the changes well. Files that are missing from older versions of the source are not forgotten by Xcode. They show up in red as if they're missing. Those files are not missing. They just didn't exist at the time the prior commit was done.
My guess is that this is happening because of something in the xcuserdata that isn't reset each time a new checkout happens. It's blocked by the .gitignore.
Any idea how I can fix this? Thanks.
Problem solved. The issue was not actually with Xcode, but with what was in the Git repository itself. Rookie mistake on my part.
For future reference, the project.pbxproj file inside of your .xcodeproj contains the list of what files are part of the project. That should be included in your Git repository to ensure that Xcode keeps up with what has changed in each revision.

How to configure an xcode project to work nicely with SVN?

I'm just getting started with xcode. I created a sample new project, and would like to import it into my svn repository. I configured xcode to be aware of my repository, and xcode claims the it has successfully authenticated the connection.
I cannot, however, seem to figure out how to get my actual xcode project to manage its source in the repository. I select Project Settings -> SCM Repository -> "myrepository". But that doesn't seem to have accomplished anything. When I try to "commit entire project", xcode tells me: "/Users/me/Documents/test1" is not a working copy.
Any ideas? I'm probably missing something obvious, right?
Did you check out your subversion repository folder for your project to your local directory first?
If not, it's not really a working copy at all. A "working copy" is a local checkout of a repository folder, tracked using hidden .svn folders.
If you haven't checked out a repository folder, all you have is a folder. Subversion won't be able to handle that at all.
I suggest you read the Subversion e-book, and specifically the part about working copies.

Xcode : Recover complete project from snapshot?

today I am playing a bit with the Xcode snapshot feature and I wonder if I could recreate a complete project from a snapshot if all code is lost.
It seems to me in the Snapshot-Manager I can only see snapshots of the current project, not of all projects. So if my projectfile is lost or damaged is there anyway to recover my files from a snapshot?
I also wonder were the snapshots are saved. Not in the project folder I found out already.
Go to the "Projects" tab in the Xcode Organizer and select your project. You should see all the snapshots that have been made. Select the snapshot you want to restore to and select "Export Snapshot" to save it somewhere to disk. What you export to disk is your "recovered" version of your project.
I agree systems such as SVN and Git are far superior to Xcode's snapshot mechanism for version control. However, the snapshot mechanism can be very useful. For example, I just made a change to a project. Before making the change, Xcode asked me if I'd like to take a snapshot. After the change it turned out that I didn't want to make that change and so I used this mechanism to restore the project to the prior state.
Before trusting Xcode snaphot feature too much, may I suggest you to consider source code management with CVS, SVN or Perforce (integrated in Xcode)?
For me, the main usage of snapshot is during a refactoring session: You create a snapshot before applying refactoring changes, so that you are able to revert your modifications.
Have a look in your home folder:
~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage
Within this you'll find the project snapshots.
But, you're better off using a proper source control system
Since there has been some remarks concerning version control systems. I would really advice to give git a chance. If you include the xcode specific files into the git repo, then you have the same effect as the snapshot mechanism.
So if you have a project that is not git controlled at the moment you can just use one of these howtos to create a git repo:
Using Git with an existing XCode project
And then don't forget to add the .xcodeproj directory and things should be a bit smoother.
I really dislike Linus Torwald at times, but git is just the best VCS I ever came across.
This document explains how snapshots are restored:
http://developer.apple.com/library/ios/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/SCM/SCM.html

Resources