Commit error in Xcode4

Discussion in 'iOS Programming' started by mikezang, Jan 16, 2012.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    I added a folder to my project, then when I want to commit it, I got error as below, what can I do?
     

    Attached Files:

  2. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #2
    The error message says the folder you added to the project isn't under version control so Xcode can't perform the commit. You can verify this in Xcode's project navigator. The files in the folder should have a - icon next to them.

    The fix is to add the new folder to the repository. Open the Organizer and click the Repositories button at the top of the Organizer. You will see a list of repositories on the left side of the Organizer. Find your repository in the list. There should be several folders under the repository. If you don't see them, click the disclosure triangle next to the repository. Select the Trunk folder. Click the Import button at the bottom of the Organizer to add the folder to the repository.
     
  3. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    I tried to follow your advise, but it seems that I can finish it, I am not sure why.
     
  4. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
  5. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    Before I upgraded to Xcode4, that was good to control my source, now I got confuse!

    I am not sure why Apple change it...

    Even I import folder, I still got error message as picture...
     
  6. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #6
    What happened when you imported the folder? Are there any icons next to the folder and its files in the project navigator? If the files in the folder have a - icon, there could be a problem with the import.

    Can you commit the files from the command line? If you can, you know the problem's with Xcode and not your repository.

    Can you commit other files in your project from Xcode?

    I recommend filing a bug report with Apple. I have seen many complaints on Apple's paid developer forums about using Subversion with Xcode 4.

    If you want to use Xcode's version control features, consider switching to git. Git can convert existing Subversion repositories to git repositories.
     
  7. mikezang, Jan 18, 2012
    Last edited: Jan 18, 2012

    mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #7
    one has a - icon, and some have A letter, they all show the same error message if I import them.

    I am not so familiar with command line:(

    I can commit other files they added Subversion when I use Xcode3.

    How can I use git for a exists project, can you show me the simplest way? Can I transfer exists Subversion revision to Git?

    By the way, I am reading Pro Git...
     
  8. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #8
    Does the folder have an icon next to it in the project navigator? If it has a ? icon next to it, it's not part of the repository.

    Can you commit other files in this project from Xcode 4? If so, you know the newly added folder is the problem.

    The easiest way would be to run the git svn clone command from the command line. This command clones an existing Subversion repository into a git repository. A Google search for git-svn turns up many tutorials on running the git svn clone command.
     
  9. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #9
    I will try it tonight.
    One more detail question, my project is at /users/my user/my project/
    Where do I run git svn? In folder above, or another new folder?
    Though I know I can run git init in my project folder.
     
  10. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #10
    Run the git svn clone command from the folder where you want the git repository to reside. Your project folder would be fine. Supply the URL of the Subversion repository to the git svn clone command. There's an example in Section 8-1 of the Pro Git book you said you're reading.
     
  11. mikezang, Jan 19, 2012
    Last edited: Jan 19, 2012

    mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #11
    I am in folder /Users/mikezang/Documents/Projects/MyProject1/trunk/
    and run command git svn clone file:///Users/mikezang/Documents/Subversion --no-metadata -s MyProjects
    The result as below:
    Initialized empty Git repository in /Users/mikezang/Documents/Projects/MyProject1/trunk/MyProjects/.git/

    If I run git svn clone file:///Users/mikezang/Documents/Subversion --no-metadata
    The result as below:
    Checking out files: 100% (2732/2732), done.
    Checked out HEAD:
    file:///Users/mikezang/Documents/Subversion r516
    creating empty directory: MyProject1/branches
    creating empty directory: MyProject2/tags


    and there is new folder where I run command, do I have to use source in trunk as below?
    Subversion/
    .git/
    MyProject1/
    branches
    trunk
    tags

    I am not sure how to do next...
     
  12. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #12
    I don't have access to your computer so I can't tell you exactly what to do. What I can tell you is the .git folder contains the git repository. The trunk folder most likely has your source code files, assuming you follow Subversion conventions.

    A place to look for additional help is Stack Overflow. Look for the git-svn tag. There are over 700 questions with the git-svn tag, which means there's a good chance someone else had the same question you have and found an answer.
     

Share This Page