diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2465,16 +2465,6 @@ def debugcomplete(ui, cmd=b'', **opts): (b'', b'from', b'', _(b'revision to diff from'), _(b'REV1')), (b'', b'to', b'', _(b'revision to diff to'), _(b'REV2')), (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')), - ( - b'', - b'merge', - False, - _( - b'show difference between auto-merge and committed ' - b'merge for merge commits (EXPERIMENTAL)' - ), - _(b'REV'), - ), ] + diffopts + diffopts2 @@ -2555,7 +2545,7 @@ def diff(ui, repo, *pats, **opts): to_rev = opts.get(b'to') stat = opts.get(b'stat') reverse = opts.get(b'reverse') - diffmerge = opts.get(b'merge') + diffmerge = ui.configbool(b'diff', b'merge') cmdutil.check_incompatible_arguments(opts, b'from', [b'rev', b'change']) cmdutil.check_incompatible_arguments(opts, b'to', [b'rev', b'change']) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -754,6 +754,12 @@ coreconfigitem( ) _registerdiffopts(section=b'diff') coreconfigitem( + b'diff', + b'merge', + default=False, + experimental=True, +) +coreconfigitem( b'email', b'bcc', default=None, diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -546,7 +546,7 @@ def _imerge3(repo, mynode, orig, fcd, fc def _imerge3alwaysgood(*args, **kwargs): # Like merge3, but record conflicts as resolved with markers in place. # - # This is used for `hg diff --merge` to show the differences between + # This is used for `diff.merge` to show the differences between # the auto-merge state and the committed merge state. It may be # useful for other things. b1, junk, b2 = _imerge3(*args, **kwargs) diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -8,10 +8,10 @@ == New Experimental Features == - * `hg diff` now takes an experimental `--merge` flag which causes `hg - diff --change` to show the changes relative to an automerge for - merge changesets. This makes it easier to detect and review manual - changes performed in merge changesets. + * There's a new `diff.merge` config option to show the changes + relative to an automerge for merge changesets. This makes it + easier to detect and review manual changes performed in merge + changesets. It is only supported by `hg diff --change` so far. == Bug Fixes == diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -336,7 +336,7 @@ Show all commands + options debugwhyunstable: debugwireargs: three, four, five, ssh, remotecmd, insecure debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure - diff: rev, from, to, change, merge, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos + diff: rev, from, to, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: bookmark, output, switch-parent, rev, text, git, binary, nodates, template files: rev, print0, include, exclude, template, subrepos forget: interactive, include, exclude, dry-run diff --git a/tests/test-diff-change.t b/tests/test-diff-change.t --- a/tests/test-diff-change.t +++ b/tests/test-diff-change.t @@ -196,7 +196,7 @@ must be similar to 'hg diff --change 5': merge diff should show only manual edits to a merge: - $ hg diff --merge -c 6 + $ hg diff --config diff.merge=yes -c 6 (no diff output is expected here) Construct an "evil merge" that does something other than just the merge. @@ -226,7 +226,7 @@ Construct an "evil merge" that does some Contrast with the `hg diff -c 7` version above: only the manual edit shows up, making it easy to identify changes someone is otherwise trying to sneak into a merge. - $ hg diff --merge -c 7 + $ hg diff --config diff.merge=yes -c 7 diff -r 8ad85e839ba7 file.txt --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 @@ -266,15 +266,15 @@ Set up a conflict. $ hg resolve -ma (no more unresolved files) $ hg commit -m 'merge conflicted edit' -Without --merge, it's a diff against p1 - $ hg diff --no-merge -c 11 +Without diff.merge, it's a diff against p1 + $ hg diff --config diff.merge=no -c 11 diff -r fd1f17c90d7c -r 5010caab09f6 new-file-p2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/new-file-p2.txt Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +this file is new in p2 of the merge -With --merge, it's a diff against the conflicted content. - $ hg diff --merge -c 11 +With diff.merge, it's a diff against the conflicted content. + $ hg diff --config diff.merge=yes -c 11 diff -r 5010caab09f6 file.txt --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000