Coder Social home page Coder Social logo

kintsugi's Introduction

Kintsugi Logo

Kintsugi Ruby Style Guide

What is this?

One of the frustrations of working with Xcode together with Git is resolving conflicts in Xcode project files, i.e. the project.pbxproj file.

Kintsugi sets out to solve this exact problem: Automatically resolving Git merge conflicts occurring in .pbxproj files.

The end goal is for the tool to succeed 99.9% of the time, and let you resolve the real conflicts in a convenient way the rest of the time.

Kintsugi (金継ぎ) is the art of repairing broken pottery by mending it with gold. Wikipedia

How?

Kintsugi understands the changes you've made to the .pbxproj file, so it simply resets the conflicts and re-applies those changes to it.

From a technical perspective, Kintsugi heavily relies on Xcodeproj. It uses its diff capability to extract the changes, and uses its project files editing capabilities to apply the changes.

Installing Kintsugi

$ gem install kintsugi

If you prefer to use bundler, add the following line to your Gemfile:

gem 'kintsugi', require: false

Usage

When there's a .pbxproj file with Git conflicts, and a 3-way merge is possible, run kintsugi <path_to_pbxproj_file>.

And see the magic happen! ✨

Interactive conflict resolution

In case Kintsugi cannot resolve a conflict on its own, it will display a helpful message describing the conflict and choices to resolve it:

Interactive conflict resolution

This feature can be disabled by passing the --interactive-resolution false flag.

Git merge driver

You can setup Kintsugi to automatically resolve conflicts that occur in pbxproj files when such conflicts occur.

Automatic install

Run kintsugi install-driver. This will install Kintsugi as a merge driver globally. Note that Kintsugi needs to be in your PATH.

  • Note: You can pass arguments to this command which will then be passed on to Kintsugi when it's executed as a merge driver. For example, you can pass --interactive-resolution false to disable interactive conflict resolution.

❗ Do not install with bundler because the installation might succeed even if Kintsugi is not in PATH.

Manual install

  • Add Kintsugi as driver to Git config file by running the following:
git config merge.kintsugi.name "Kintsugi driver" # Or any other name you prefer
git config merge.kintsugi.driver "<path_to_kintsugi> driver %O %A %B %P"

Run git config with --global to add this to the global config file.

  • Add the following line to the .gitattributes file at the root of the repository:

*.pbxproj merge=kintsugi

This will instruct Git to use Kintsugi as a merge driver for .pbxproj files.

See the official docs if you want to set this globally.

Contribution

See our Contribution guidelines.

Alternatives

All of the alternatives below allow you to generate your Xcode projects based on a spec or manifest. You commit these files to git, and can even remove the .xcodeproj files from git.

Copyright

Copyright (c) 2021 Lightricks. See LICENSE for details.

kintsugi's People

Contributors

alexandre-pod avatar ashdnazg avatar banjun avatar barakwei avatar barakyoresh avatar byohay avatar galberezansky avatar natanrolnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kintsugi's Issues

undefined method `to_tree_hash' for nil:NilClass (NoMethodError)

I got this error running 0.7.1 installed from brew

❯ kintsugi Sources/iOSSampleApp.xcodeproj/project.pbxproj
Traceback (most recent call last):
	16: from /Users/igorkulman/.rbenv/versions/2.7.7/bin/kintsugi:23:in `<main>'
	15: from /Users/igorkulman/.rbenv/versions/2.7.7/bin/kintsugi:23:in `load'
	14: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/kintsugi-0.7.1/bin/kintsugi:10:in `<top (required)>'
	13: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/kintsugi-0.7.1/lib/kintsugi.rb:26:in `run'
	12: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/kintsugi-0.7.1/lib/kintsugi/cli.rb:207:in `block in create_root_command'
	11: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/kintsugi-0.7.1/lib/kintsugi/merge.rb:39:in `resolve_conflicts'
	10: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/differ.rb:65:in `project_diff'
	 9: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project.rb:328:in `to_tree_hash'
	 8: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `to_tree_hash'
	 7: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `each'
	 6: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `block in to_tree_hash'
	 5: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `map'
	 4: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `to_tree_hash'
	 3: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `each'
	 2: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `block in to_tree_hash'
	 1: from /Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `map'
/Users/igorkulman/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object/target_dependency.rb:83:in `to_tree_hash': undefined method `to_tree_hash' for nil:NilClass (NoMethodError)

attaching the conflicted project file

project.pbxproj.zip

Add support (and/or instructions) on how to use this tool as a custom merge driver

Hey 👋 This tool looks promising! But sounds like we could improve the UX significantly by automatically resolving the conflicts (as the repo description says), instead of having to manually invoke a CLI command to solve conflicts when they happen. I'm referring to enabling (and/or documenting how to use) this tool as a custom merge driver. Was there any research done on this front?

Docs: https://git-scm.com/docs/gitattributes#_performing_a_three_way_merge
Stack Overflow question that might help: https://stackoverflow.com/questions/39208324/automatically-resolve-git-conflicts-in-binary-files-with-a-script

Looking forward to using this 💪

Better message for manual intervention

Trying to to solve merge conflicts today I got this

A merge conflict that needs manual intervention occurred: Trying to change value of attribute named 'version from '' to '3.4.0', but the existing value is ''. Choose one: (Press ↑/↓ arrow to move and Enter to select)
‣ Set to new value ''
  Keep existing value ''
  Abort

I think this is quite confusing, I do not really know what the version attribute is related to. Best guess is SPM but in the file there was no "3.4.0" string anywhere.

The options are also confusing, they look the same, keeping and empty string vs setting it to the same empty string?

I chose the first option and it resulted in duplicated SPM dependency, I had to fix it manually in Xcode.

I think this message and option require a better explanation to know what they are actually related to.

undefined method `to_tree_hash' for nil:NilClass (NoMethodError)

Hello, I am getting the following error when running kinstugi on macOS Ventura, trying to merge a project file with conflicts:

Any idea what is wrong?

/opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object/target_dependency.rb:83:in `to_tree_hash': undefined method `to_tree_hash' for nil:NilClass (NoMethodError)

          hash['targetProxy'] = target_proxy.to_tree_hash
                                            ^^^^^^^^^^^^^
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `map'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `block in to_tree_hash'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `each'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `to_tree_hash'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `map'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:454:in `block in to_tree_hash'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `each'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project/object.rb:452:in `to_tree_hash'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/project.rb:328:in `to_tree_hash'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/xcodeproj-1.22.0/lib/xcodeproj/differ.rb:65:in `project_diff'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/kintsugi-0.6.3/lib/kintsugi/merge.rb:39:in `resolve_conflicts'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/kintsugi-0.6.3/lib/kintsugi/cli.rb:203:in `block in create_root_command'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/kintsugi-0.6.3/lib/kintsugi.rb:26:in `run'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/kintsugi-0.6.3/bin/kintsugi:10:in `<top (required)>'
	from /opt/homebrew/lib/ruby/gems/3.1.0/bin/kintsugi:25:in `load'
	from /opt/homebrew/lib/ruby/gems/3.1.0/bin/kintsugi:25:in `<main>'

Command not found

Hi,

I follow the steps which you guys write in README file, I download Kintsugi successfully
Successfully installed kintsugi-0.5.0
Parsing documentation for kintsugi-0.5.0
Done installing documentation for kintsugi after 0 seconds
1 gem installed

after that I run this command kintsugi MyAppName.xcodeproj/project.pbxproj but failed.
Return this zsh: command not found: kintsugi
I refreshed terminal, restart terminal and pc but nothing change I don't know why,
Can you guys help me ? Did anything do wrong ?

Better support for real conflicts

By real conflicts I mean conflicts that occur when two commits touched the same actual objects in pbxproj file. For example: One commit removed a file that another commit changed, two commits added a file with the same name.
There are several ways to let the user control this:

  • A conflict-by-conflict basis.
  • A flag that tells Kintsugi how to behave when those conflicts occur.

Consider borrowing Git terms of "theirs", "ours", etc.

undefined method `configuration_list'

When running Kintsugi, I'm getting the following error:
/Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.3/lib/kintsugi/apply_change_to_project.rb:457:in child_component': undefined method configuration_list' for <PBXNativeTarget name=MyApp UUID=8B0F7A522A991C9A00233F44>:Xcodeproj::Project::Object::PBXNativeTarget (NoMethodError) Did you mean? configure_with_plist

Any ideas on how to resolve?

kintsugi asking me to resolve conflict manually

I ran this command to help me resolve the conflict I'm having

kintsugi Bamboo.xcodeproj/project.pbxproj

This was the response i got

Trying to remove value '2', but the existing value is '6'. This is considered a conflict that should be resolved manually.

undefined method `path' for nil:NilClass (NoMethodError)

I installed kintsugi via gem install kintsugi on a new machine, trying to merge a simple conflict I get this error

❯ kintsugi Redacted.xcodeproj/project.pbxproj
Traceback (most recent call last):
	30: from /Users/igorkulman/.rbenv/versions/2.7.6/bin/kintsugi:23:in `<main>'
	29: from /Users/igorkulman/.rbenv/versions/2.7.6/bin/kintsugi:23:in `load'
	28: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/bin/kintsugi:10:in `<top (required)>'
	27: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi.rb:26:in `run'
	26: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/cli.rb:203:in `block in create_root_command'
	25: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/merge.rb:45:in `resolve_conflicts'
	24: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/merge.rb:93:in `apply_change_and_copy_to_original_path'
	23: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:55:in `apply_change_to_project'
	22: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `apply_change_to_component'
	21: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `each'
	20: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:256:in `block in apply_change_to_component'
	19: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `apply_change_to_component'
	18: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `each'
	17: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:256:in `block in apply_change_to_component'
	16: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `apply_change_to_component'
	15: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `each'
	14: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:256:in `block in apply_change_to_component'
	13: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `apply_change_to_component'
	12: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `each'
	11: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:256:in `block in apply_change_to_component'
	10: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `apply_change_to_component'
	 9: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:249:in `each'
	 8: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:256:in `block in apply_change_to_component'
	 7: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:242:in `apply_change_to_component'
	 6: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:242:in `each'
	 5: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:243:in `block in apply_change_to_component'
	 4: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:522:in `add_child_to_component'
	 3: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:689:in `add_build_file'
	 2: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:689:in `find'
	 1: from /Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:689:in `each'
/Users/igorkulman/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/kintsugi-0.6.1/lib/kintsugi/apply_change_to_project.rb:690:in `block in add_build_file': undefined method `path' for nil:NilClass (NoMethodError)

I use ruby 2.7

❯ ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]

via rbenv

Invalid option error in install-driver when using driver-options

I can't seem to make install-driver work with driver-options, the command kintsugi install-driver --interactive-resolution false fails with the following error:

~ % kintsugi install-driver --interactive-resolution false
/Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.0/lib/kintsugi.rb:40:in `parse_options!': invalid option: --interactive-resolution (OptionParser::InvalidOption)
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.0/lib/kintsugi.rb:23:in `run'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.0/bin/kintsugi:10:in `<top (required)>'
        from /usr/local/bin/kintsugi:23:in `load'
        from /usr/local/bin/kintsugi:23:in `<main>'
~ % 

Am I using it wrong?

Support for ignoring duplicates

When two commits add a component with the same name, most of the time they refer to the same component. It would be nice if Kintsugi could detect such duplicates and treat them as the same entity.

Avoid duplicate references in same Xcode "Group" following conflict resolution

Hi,

The tool has been working great and is a massive time saver (why is this level of conflict resolution not part of Xcode when it knows it's file format better than anyone...) so kudos to all involved 👍

I notice occasionally following conflict resolution (usually new files added to a different branch I believe) that I end up with multiple references to the same file within the same Xcode group which I usually have to go clean up.

Maybe there's a technical reason why it ends up this way (perhaps different UUIDs to the same file or something), however it seems it could be something that could be filtered out during the resolution process (is there ever a reason to have multiple references to the same file at the same group level in Xcode? Perhaps there is for more complex or nuanced projects than mine so this idea is invalid).

image

image

Thanks!

undefined method `configuration_list' for #<Xcodeproj::Project::Object::PBXNativeTarget:0x0000000134c74c98> (NoMethodError)

I'm getting the following error:

/Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:457:in `child_component': undefined method `configuration_list' for #<Xcodeproj::Project::Object::PBXNativeTarget:0x0000000134c74c98> (NoMethodError)
Did you mean?  configure_with_plist
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:363:in `component_at_path'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:967:in `add_file_reference'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:654:in `add_child_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1036:in `block in add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1021:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1021:in `add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:815:in `add_build_configuration'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:666:in `add_child_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1039:in `block (2 levels) in add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1038:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1038:in `block in add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1021:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1021:in `add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:809:in `add_build_configuration_list'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:664:in `add_child_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1036:in `block in add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1021:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:1021:in `add_attributes_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:956:in `add_target'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:650:in `add_child_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:309:in `block in apply_change_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:308:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:308:in `apply_change_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:321:in `block in apply_change_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:315:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:315:in `apply_change_to_component'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/apply_change_to_project.rb:64:in `apply_change_to_project'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/merge.rb:96:in `apply_change_and_copy_to_original_path'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/merge.rb:45:in `resolve_conflicts'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi/cli.rb:207:in `block in create_root_command'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/lib/kintsugi.rb:26:in `run'
        from /Library/Ruby/Gems/2.6.0/gems/kintsugi-0.7.5/bin/kintsugi:10:in `<top (required)>'
        from /usr/local/bin/kintsugi:23:in `load'
        from /usr/local/bin/kintsugi:23:in `<main>'

Cannot merge conflicts anymore

The tool stopped working for me, if I point it to a project with conflicts I just get this, an error saying there is a conflict.

❯ kintsugi apps/macos/macOS.xcodeproj/project.pbxproj
Traceback (most recent call last):
	7: from /Users/igorkulman/.rbenv/versions/2.7.2/bin/kintsugi:23:in `<main>'
	6: from /Users/igorkulman/.rbenv/versions/2.7.2/bin/kintsugi:23:in `load'
	5: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.5.1/bin/kintsugi:34:in `<top (required)>'
	4: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.5.1/lib/kintsugi/cli.rb:195:in `block in create_root_command'
	3: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.5.1/lib/kintsugi.rb:35:in `resolve_conflicts'
	2: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:113:in `open'
	1: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:211:in `initialize_from_file'
/Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/xcodeproj-1.21.0/lib/xcodeproj/plist.rb:21:in `read_from_path': \e[31m[!] The file `apps/macos/macOS.xcodeproj/project.pbxproj` is in a merge conflict. (Xcodeproj::Informative)
\e[0m

Using 0.5.1.

Trying to add unsupported component type PBXAggregateTarget

I'm getting the following error:

.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/kintsugi-0.2.0/lib/kintsugi/apply_change_to_project.rb:302:in `add_child_to_component': Trying to add unsupported component type PBXAggregateTarget

Using Xcode Version 13.0 (13A233)

Note: This is the first time I've tried to use kintsugi so I've no idea what to expect at this stage :)

undefined method `children' for nil:NilClass (NoMethodError)

/Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:857:in find_file_in_group': undefined method children' for nil:NilClass (NoMethodError)
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:170:in apply_file_addition' from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:148:in block in apply_file_changes'
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:143:in each' from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:143:in apply_file_changes'
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:66:in apply_main_group_change' from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/apply_change_to_project.rb:46:in apply_change_to_project'
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/merge.rb:93:in apply_change_and_copy_to_original_path' from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/merge.rb:45:in resolve_conflicts'
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi/cli.rb:203:in block in create_root_command' from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/lib/kintsugi.rb:26:in run'
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/gems/kintsugi-0.6.2/bin/kintsugi:10:in <top (required)>' from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/bin/kintsugi:23:in load'
from /Users/alisandagdelen/.rvm/gems/ruby-3.0.0@latest/bin/kintsugi:23:in `

'

Installing merge driver fails

I have kintsugi 0.3.1 installed as a gem via rbenv, the rbenv shims folder is in my path.

❯ which kintsugi
/Users/igorkulman/.rbenv/shims/kintsugi

Trying to run

kintsugi install-driver

results in

Traceback (most recent call last):
	5: from /Users/igorkulman/.rbenv/versions/2.7.2/bin/kintsugi:23:in `<main>'
	4: from /Users/igorkulman/.rbenv/versions/2.7.2/bin/kintsugi:23:in `load'
	3: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.3.1/bin/kintsugi:31:in `<top (required)>'
	2: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.3.1/lib/kintsugi/cli.rb:94:in `block in create_root_command'
	1: from /Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.3.1/lib/kintsugi.rb:32:in `resolve_conflicts'
/Users/igorkulman/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/kintsugi-0.3.1/lib/kintsugi.rb:98:in `validate_project': File '/Users/igorkulman/install-driver' doesn't exist (ArgumentError)

Looks like the install-driver command is not recognized and kintsugi considers it a project file path.

Bundler could not find compatible versions for gem "xcodeproj"

Using the latest cocopods gem (1.11.2) causes a conflict in xcodeproj with kintsugi:

cocoapods (= 1.11.2) was resolved to 1.11.2, which depends on
      xcodeproj (>= 1.21.0, < 2.0)
kintsugi was resolved to 0.3.0, which depends on
      xcodeproj (= 1.19.0)

Bad handling of files with the same name in different targets

I've had this case happen twice in my project now. Basically when there are two files of the same name BUT compiled in two different targets, Kintsugi will put all targets in one file and leave none on the other.

So let's say that I have the following files:

  • SomeFolder/MySwiftFile.swift -> TargetA, TargetB
  • SomeOtherFolder/MySwiftFile.swift -> TargetC

When resolving merge conflicts, Kintsugi will change the targets to be the following:

  • SomeFolder/MySwiftFile.swift -> TargetA, TargetB, TargetC
  • SomeOtherFolder/MySwiftFile.swift -> No targets

Which wrecks havoc in the project.

I don't have a clear way to reproduce it but it happened to me twice already.

SPM changes

I was wondering whether the tool supports resolving a merge conflict containing Swift Package Manager (SPM) conflicts? In attempting to resolve one of my conflicts it output the following:

Trying to add unsupported component type XCSwiftPackageProductDependency. Full component change is: {"displayName"=>"SnapshotTesting", "isa"=>"XCSwiftPackageProductDependency", "productName"=>"SnapshotTesting", "package"=>{"displayName"=>"https://github.com/pointfreeco/swift-snapshot-testing", "isa"=>"XCRemoteSwiftPackageReference", "repositoryURL"=>"https://github.com/pointfreeco/swift-snapshot-testing", "requirement"=>{"kind"=>"upToNextMajorVersion", "minimumVersion"=>"1.0.0"}}}

I assume this is due to a new SPM dependency having been added in one of the branches.

Cheers
Peter

Error: `apply_removal_to_simple_attribute': undefined method `-' for "":String (NoMethodError)

Hi, I'm trying to resolve a complicated merge and I'm getting the following error:

/usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:189:in `apply_removal_to_simple_attribute': undefined method `-' for "":String (NoMethodError)
Did you mean?  -@
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:170:in `simple_attribute_value_with_change'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:180:in `block in simple_attribute_value_with_change'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:177:in `each'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:177:in `simple_attribute_value_with_change'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:162:in `apply_change_to_simple_attribute'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:53:in `apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:82:in `block in apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `each'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:82:in `block in apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `each'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:82:in `block in apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `each'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:82:in `block in apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `each'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:81:in `apply_change_to_component'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/apply_change_to_project.rb:40:in `apply_change_to_project'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi.rb:92:in `apply_change_and_copy_to_original_path'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi.rb:44:in `resolve_conflicts'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/lib/kintsugi/cli.rb:195:in `block in create_root_command'
	from /usr/local/lib/ruby/gems/3.0.0/gems/kintsugi-0.4.3/bin/kintsugi:34:in `<top (required)>'
	from /usr/local/lib/ruby/gems/3.0.0/bin/kintsugi:23:in `load'
	from /usr/local/lib/ruby/gems/3.0.0/bin/kintsugi:23:in `<main>'

Any idea why? Thanks

Runtime error

Hi!

when I try to resolve conflicts using Kintsugi I get this error:
.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/kintsugi-0.1.1/lib/kintsugi/apply_change_to_project.rb:201:in 'apply_removal_to_simple_attribute': Value changed from to Pods. (RuntimeError)

The Value changed from to Pods message changes based on the conflict, but the errors look all the same. I tried with two different projects without any luck.

Do you have any advice?

Thank you

Error when using `--changes-output-path`

Hi, I wanted to preview what changes will be made. I used --changes-output-path option. Unfortunately it finished with an error. Regular merge (without --changes-output-path) worked like a charm! This tool is a lifesaver, thanks for it! :D

Traceback (most recent call last):
	6: from /Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/bin/ruby_executable_hooks:22:in `<main>'
	5: from /Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/bin/ruby_executable_hooks:22:in `eval'
	4: from /Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/bin/kintsugi:23:in `<main>'
	3: from /Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/bin/kintsugi:23:in `load'
	2: from /Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/gems/kintsugi-0.2.0/bin/kintsugi:31:in `<top (required)>'
	1: from /Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/gems/kintsugi-0.2.0/lib/kintsugi/cli.rb:94:in `block in create_root_command'
/Users/oskar/.rvm/gems/ruby-2.7.1@iko3-ios/gems/kintsugi-0.2.0/lib/kintsugi.rb:39:in `resolve_conflicts': uninitialized constant #<Class:Kintsugi>::JSON (NameError)```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.