0

This question asks how to see which files have conflicts in a merge. I'd also like to be able to quickly see listings of the diffs for all of the conflicts (as opposed to the diffs in the merge that went through cleanly.)

For instance, this would make it possible to quickly dispense with some conflicts that are just "noise" by resolving those with --tool :other --tool :local or --tool :union without bringing up a merge editor.

I think answers (I'm formulating one right now) will be analogous with small differences for git and mercurial, so I'll risk leaving the question vc-agnostic.

Joshua Goldberg
  • 5,059
  • 2
  • 34
  • 39
  • As you noted in your own answer, you pretty much have to do the merge. At this point the not-yet-resolved / unmerged files, with their conflicts recorded in the work-tree, are in hg's `set:unresolved()` or git's `ls-files --unmerged` (the latter is more of a pain to use since it insists on long-form output, but there is also `git diff-files --name-only --diff-filter=U`). – torek Jul 23 '16 at 10:03

1 Answers1

0

In mercurial if you merge or resolve with the :merge3 tool, it will leave markers in the files for any conflicts. The fileset unresolved() contains only the files with conflicts. Using perl to print just the filenames and the unresolved sections (ignoring the cleanly merged sections):

hg merge --tool :merge3 <branchtomerge>
hg diff 'set:unresolved()' | perl -ne 'print if m|^\+\+\+ | or m|<<<+ local$| .. m|>>>+ other$|'
Joshua Goldberg
  • 5,059
  • 2
  • 34
  • 39
  • I just realized after posting though, that while this does what it says, I can't use it like I wanted to. If I see the conflict can be resolved simply, I can't just (e.g.) `resolve -t :other` because that would invalidate all of the merges that *didn't* have conflicts. – Joshua Goldberg Jul 21 '16 at 17:02