changeset 37255:4e573e7e512d

diff: simplify by converting contexts to nodeids a little later Differential Revision: https://phab.mercurial-scm.org/D3009
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 31 Mar 2018 23:49:44 -0700
parents ddf50e82e21a
children 3c7c13e75663
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Mar 31 23:25:02 2018 -0700
+++ b/mercurial/commands.py	Sat Mar 31 23:49:44 2018 -0700
@@ -1874,18 +1874,18 @@
         raise error.Abort(msg)
     elif change:
         repo = scmutil.unhidehashlikerevs(repo, [change], 'nowarn')
-        node2 = scmutil.revsingle(repo, change, None).node()
-        node1 = repo[node2].p1().node()
+        ctx2 = scmutil.revsingle(repo, change, None)
+        ctx1 = ctx2.p1()
     else:
         repo = scmutil.unhidehashlikerevs(repo, revs, 'nowarn')
         ctx1, ctx2 = scmutil.revpair(repo, revs)
-        node1, node2 = ctx1.node(), ctx2.node()
+    node1, node2 = ctx1.node(), ctx2.node()
 
     if reverse:
         node1, node2 = node2, node1
 
     diffopts = patch.diffallopts(ui, opts)
-    m = scmutil.match(repo[node2], pats, opts)
+    m = scmutil.match(ctx2, pats, opts)
     ui.pager('diff')
     logcmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
                               listsubrepos=opts.get('subrepos'),