-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apply_change_to_project: Resolve some merge errors interactively. #96
apply_change_to_project: Resolve some merge errors interactively. #96
Conversation
120f497
to
27e5002
Compare
0b782da
to
809e236
Compare
d9f34c1
to
c43ff80
Compare
8ab4dfc
to
754f6e2
Compare
The function can continue executing after the component is added.
754f6e2
to
4e1d3ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F&S
component = project.group_or_file_at_path(path) | ||
|
||
change.each do |subchange_name, subchange| | ||
next if subchange_name == "children" | ||
|
||
if component.nil? | ||
unless ConflictResolver.changing_nonexistent_component(path) | ||
@ignored_components_group_paths.append(path) | ||
break | ||
end | ||
|
||
@created_components_group_paths.append(path) | ||
component = create_nonexistent_groupable_component(project, path) | ||
end | ||
|
||
apply_change_to_component(component, subchange_name, subchange, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component = project.group_or_file_at_path(path) | |
change.each do |subchange_name, subchange| | |
next if subchange_name == "children" | |
if component.nil? | |
unless ConflictResolver.changing_nonexistent_component(path) | |
@ignored_components_group_paths.append(path) | |
break | |
end | |
@created_components_group_paths.append(path) | |
component = create_nonexistent_groupable_component(project, path) | |
end | |
apply_change_to_component(component, subchange_name, subchange, path) | |
component = project.group_or_file_at_path(path) | |
if component.nil? && !change.keys.to_set.subset?(["children"].to_set) | |
unless ConflictResolver.changing_nonexistent_component(path) | |
@ignored_components_group_paths.append(path) | |
next | |
end | |
@created_components_group_paths.append(path) | |
component = create_nonexistent_groupable_component(project, path) | |
end | |
change.each do |subchange_name, subchange| | |
next if subchange_name == "children" | |
apply_change_to_component(component, subchange_name, subchange, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that the break
needs to be next
- the tests passed with break
so maybe add a test for that if you're bored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you use !change.keys.to_set.subset?(["children"].to_set)
to account for the case where keys
is empty? Is this a possible scenario?
Anyway if that's the only reason I prefer !change.keys.empty? && change.keys != ["children"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's possible - I tried to keep the logic identical to the previous situation.
Your proposal is fine by me
unless options[:"interactive-resolution"].nil? | ||
Settings.interactive_resolution = options[:"interactive-resolution"] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be according to whether a tty is available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled in Kintsugi::Settings
.
require "tty-prompt" | ||
|
||
module Kintsugi | ||
class ConflictResolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit hard to know what these functions return - some are bool (maybe suffix them with ?
), some are all kind of overrides that maybe should be reflected in the name.
In any case, these functions should be doc'd
4e1d3ed
to
2b7b7c7
Compare
The default display name is just a generic name for all `PBXContainerItemProxy`. Many functions rely on `display_name` to identify objects and making it identifiable is easier to program.
e6a5ca1
to
24c6aa5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F&S&M
8de713b
to
f41d9fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F&S&M
lib/kintsugi/cli.rb
Outdated
@@ -183,7 +193,10 @@ def create_root_command | |||
exit | |||
end | |||
|
|||
opts.on("--allow-duplicates", "Allow to add duplicates of the same entity") | |||
opts.on("--allow-duplicates-FLAG", "Allow to add duplicates of the same entity") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be on purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
f41d9fa
to
b00d28b
Compare
In order to resolve some of the merge errors, `theirs` project is added a parameter to `apply_change_to_project` to compensate for lost information about components that were removed from `project`. Some refactorings: - When checking if something is a PBXGroup using `is_a`, there's no need to check if it's a PBXVariantGroup because it inherits from PBXGroup.
b00d28b
to
c51435d
Compare
With this feature, Kintsugi will ask for a guide whenever a conflict that it cannot solve on its own has happend. For example: