Mercurial > hg-stable
diff mercurial/commands.py @ 46549:4a012e531066
diff: extract function for getting possibly re-merged parent to diff against
We'll want to reuse the logic that `hg diff --change` with
`diff.merge` uses. At least `hg log -p` should reuse it. This patch
therefore extracts that code to a function.
Differential Revision: https://phab.mercurial-scm.org/D9957
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 04 Feb 2021 13:21:01 -0800 |
parents | d57e607d9e33 |
children | a4c19a162615 |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Feb 04 13:05:51 2021 -0800 +++ b/mercurial/commands.py Thu Feb 04 13:21:01 2021 -0800 @@ -29,7 +29,6 @@ bundlecaches, changegroup, cmdutil, - context as contextmod, copies, debugcommands as debugcommandsmod, destutil, @@ -2545,33 +2544,13 @@ to_rev = opts.get(b'to') stat = opts.get(b'stat') reverse = opts.get(b'reverse') - 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']) if change: repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn') ctx2 = scmutil.revsingle(repo, change, None) - if diffmerge and ctx2.p2().node() != nullid: - pctx1 = ctx2.p1() - pctx2 = ctx2.p2() - wctx = contextmod.overlayworkingctx(repo) - wctx.setbase(pctx1) - with ui.configoverride( - { - ( - b'ui', - b'forcemerge', - ): b'internal:merge3-lie-about-conflicts', - }, - b'diff --merge', - ): - repo.ui.pushbuffer() - mergemod.merge(pctx2, wc=wctx) - repo.ui.popbuffer() - ctx1 = wctx - else: - ctx1 = ctx2.p1() + ctx1 = logcmdutil.diff_parent(ctx2) elif from_rev or to_rev: repo = scmutil.unhidehashlikerevs( repo, [from_rev] + [to_rev], b'nowarn'