simonwagner / mergepbx

script for merging XCode project files in git
GNU General Public License v3.0
1.04k stars 46 forks source link

Merging fails #6

Closed matt-oakes closed 9 years ago

matt-oakes commented 10 years ago

I've just upgraded to Xcode 6 and when attempting to rebase mergepbx fails with this error:

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
  File "/Users/apple/bin/mergepbx/mergepbx.py", line 67, in main
  File "/Users/apple/bin/mergepbx/plist/antlr/runtime/antlr3/exceptions.py", line 317, in __str__
  File "/Users/apple/bin/mergepbx/plist/antlr/runtime/antlr3/exceptions.py", line 184, in getUnexpectedType
AttributeError: 'NoneType' object has no attribute 'type'

I'm not certain that Xcode 6 is the problem, but it's the only thing I can think of that has changed.

Thanks for making such a useful tool. I'm lost without it!

simonwagner commented 10 years ago

Hm, that seems like the plist parser can't read your project file.

Could you paste your project file on http://pastebin.com/ and post the link to it here (if it is not confidential)? You will find the project file under ${PROJECTNAME}.xcode/project.pbxproj (In Finder use right click on ${PROJECTNAME}.xcode and click on "Show Content" to get inside, or just open it from the Terminal).

matt-oakes commented 10 years ago

It's for another company so I can't share the file publicly. Would I be able to email it to you?

simonwagner commented 10 years ago

Yes, you can send it to 4vNyr448EhPs@meltmail.com (this is a temporary e-mail address valid for 24h, so I won't get spammed by bots)

simonwagner commented 10 years ago

Hm, seems like meltmail.com does no longer work. Just send it to redacted - I will remove the address when I have received your mail.

matt-oakes commented 10 years ago

It's been sent! Let me know if you need any more details about it.

simonwagner commented 10 years ago

Hm, the one file that you send me just parsed fine.

Can you send me the version from the branch that you tried to merge and also the base version? You can find the base commit with git merge-base $THEIRS $YOURS

simonwagner commented 10 years ago

I have made some adjustment to mergepbx, it should give you now a more informative error message. Would you like to try again and post the output? It should give you the line number and the name of the failed file.

simonwagner commented 10 years ago

You can also use python -m tools.plist $PROJECTFILE from the root of the mergepbx source code to test if a file does parse. (But remember to pull before, because there was an error in the script that prevented it from running)

matt-oakes commented 10 years ago

The output is now:

merging failed: Parsing failure at line 1:1

They both seems to parse fine with the tool you mentioned.

Looking at the diff of the two files it looks like the issue could be that in the master branch there was a new file in the models group, while in the feature branch there was a different new file in the same group. That could be causing the merge tool to think that there is a conflict where there actually isn't on I suppose.

I've emailed the two files to the same email as above. If it's just an issue which comes up when files are added to the same group then let me know :-)

simonwagner commented 9 years ago

Hm, I am not sure what is wrong here...

The error comes definitely from the parser, but the files you send me parsed just fine... So maybe we didn't get the right files?

I did add a --dump $FILE option to mergepbx, so if you add this option to mergepbx in the ~/.gitconfig file, you can create a zip file that contains the exact files that are used during the merge operation. Try that and send me the generated ZIP file, maybe then I can find what is wrong with the project files.

matt-oakes commented 9 years ago

Apologies for the delay. I've sent you the zip file now.

simonwagner commented 9 years ago

Okay, mystery solved: The XCode project files are actually plists. Plists can be stored in different formats, there is binary, Nextstep and XML. So far all the project files I have seen, were in Nextstep format. The base version in your case is in the XML format. That is strange, I have never seen this before, any idea why?

The solution is pretty simple, I will simply also include a reader for the XML format. The output will still be in the Nextstep format, as the XCode 6 files I have seen still use that format, so I assume for some reason, your project file is just an outlier.

matt-oakes commented 9 years ago

I have no idea why it would be anything other than the normal one. It appeared when I did a normal rebase on our master branch from a feature branch... Very strange...

Thanks for looking into it!

simonwagner commented 9 years ago

XML Plist reading is now implemented. Try it again, it should work now.

matt-oakes commented 9 years ago

Perfect! This fixes it perfectly! :+1:

I still have no idea how it became an XML plist, but thanks for implementing it :)