-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Improve conflict resolution #627
Conversation
Codecov Report
@@ Coverage Diff @@
## master #627 +/- ##
==========================================
- Coverage 96.39% 96.16% -0.24%
==========================================
Files 41 41
Lines 2722 2736 +14
==========================================
+ Hits 2624 2631 +7
- Misses 98 105 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Please can you add co-autorship info with the author of #407 to credit him?
rev: v4.0.1 | ||
hooks: | ||
- id: check-merge-conflict | ||
args: [--assume-in-merge] |
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.
These lines have wrong indentation and are not valid yaml. Can you fix that please?
Thank you so much for this PR. It's a nice enhancement and the
implementation looks much better!
Regarding backwards compatibility, it has been broken in so many ways now
that I don't really care that much 🤣
About overwrite... I think I somehow get the problem by looking at the
code, but I'd appreciate it if you could explain it and any solutions you
may have thought.
Finally, please remember to add a note in the changelog.
|
Co-authored-by: Oleh Prypin <oprypin@users.noreply.github.com>
BTW have you seen #562? It displays the diff interactively to accept or reject before continuing. |
Of course. It's done.
You're perfectly right, sorry for that. |
Indeed I missed that PR. |
# Remove the file if it was already removed in the project | ||
if not output and "modified" not in subfile_names: | ||
try: | ||
dest_path.unlink() |
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.
Are you fixing #461 too? 😍
I'll have to review more in depth, because the part you're modifying is one of the most important in copier. Just be patient please. |
@yajo Don't worry for the time, I understand perfectly :) And I have to find a way to fix windows problems first. |
Fixing mistake with python version
subfile_kind = os.devnull | ||
subfile_names.append(subfile_kind) | ||
|
||
with local.cwd(merge_dst_temp): |
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.
Maybe this is the perfect spot to check if the file has changed and show a brief diff to the user (difflib.unified_diff(old_upstream, new_upstream)
)
@yajo, @tguillemot: What's the status of this PR? If you don't have time to work on it, I can work on it. I personally prefer 3-way merge: That's the behavior that gives you conflict markers, right? E.g.
@yajo: You mentioned needing to review it carefully due to the risk of breaking copier. Should we consider making the behavior configurable?
|
Continuing in #807, which has no conflicts |
Fixes #613 Based on #627, but: * Supports both old (`.rej` files) and new (inline markers) conflict behavior * Update a test to test both rej and inline conflict resolution * Update some tests to explicitly specify "rej" conflict mode * Add documentation for the two conflict modes * keeping only 3-way merge Co-authored-by: Oleh Prypin <oprypin@users.noreply.github.com> Co-authored-by: Thierry Guillemot <tguillemot@users.noreply.github.com> Co-authored-by: Barry Hart <barry.hart@zoro.com> Co-authored-by: Jairo Llopis <yajo.sk8@gmail.com> Co-authored-by: Timothée Mazzucotelli <pawamoy@pm.me>
I propose this work to solve #613: it replaces the merging approach using the
rej
files during an update by a two-way merge.This PR is a based on the work of #407 with several differences:
check-merge-conflict
pre-commit hookWhy two-way instead of three : IMHO, I think the majority of the git users are used to the two-way merge instead of the three-way. I can be easily convince to change this behaviour. Maybe we can add an option to let the user choose what he wants.
I still have some remaining questions :
overwrite
option ?Thanks in advance for your help and time.