diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2492,7 +2492,11 @@ node1, node2 = ctx1.node(), ctx2.node() if reverse: - node1, node2 = node2, node1 + ctxleft = ctx2 + ctxright = ctx1 + else: + ctxleft = ctx1 + ctxright = ctx2 diffopts = patch.diffallopts(ui, opts) m = scmutil.match(ctx2, pats, opts) @@ -2502,8 +2506,8 @@ ui, repo, diffopts, - repo[node1], - repo[node2], + ctxleft, + ctxright, m, stat=stat, listsubrepos=opts.get(b'subrepos'),