[PATCH] merge: add resolve --prep, which outputs conflicted comparison files
Jun Wu
quark at fb.com
Mon Feb 27 19:58:03 EST 2017
Excerpts from Durham Goode's message of 2017-02-27 16:37:56 -0800:
> Do you mean outputting the actual file content in the json? I was
> thinking of having just the paths to the file contents be in the json.
> That way we don't have to json escape a bunch of binary data if we
> output conflicting binary files (which is an eventual use case).
Yes. Having the content available is better in my opinion:
1. No filesystem race condition
2. Stateless. No need to clean up files
For binary files, we can skip them in some way. That's also one reason why
the json schema is hard to define, and why I think Python merge functions is
a cleaner solution.
> For raw vs slice, I think having the four raw files (yours, mine, base,
> output file which starts with conflict markers in it) makes the most
> sense from the point of view of a merge tool consuming this data. I
> don't think we should require the consumer to parse the conflict marker
> file. I'm not even sure they could 100% correctly parse the file if the
> file contained text that looked like conflict markers but was actually
> part of the file.
So you are suggesting raw files without markers? That makes sense from a
cleaner API perspective. But it's less practical - it requires extra efforts
from the upper-layer application to figure out what could be cleanly merged
(other and local have the same change).
I never suggested put conflict markers into file contents. The "slices"
format is defined precisely by JSON - something similar to the output of
google's diff-match-patch library [1], but with 3 sides.
[1]: https://github.com/zchee/google-diff-match-patch/wiki/API#initialization
More information about the Mercurial-devel
mailing list