##// END OF EJS Templates
diffordiffstat: avoid looking up contexts twice...
Martin von Zweigbergk -
r41761:d683aca7 default
parent child Browse files
Show More
@@ -58,6 +58,8 b' def diffordiffstat(ui, repo, diffopts, n'
58 changes=None, stat=False, fp=None, graphwidth=0,
58 changes=None, stat=False, fp=None, graphwidth=0,
59 prefix='', root='', listsubrepos=False, hunksfilterfn=None):
59 prefix='', root='', listsubrepos=False, hunksfilterfn=None):
60 '''show diff or diffstat.'''
60 '''show diff or diffstat.'''
61 ctx1 = repo[node1]
62 ctx2 = repo[node2]
61 if root:
63 if root:
62 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
64 relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
63 else:
65 else:
@@ -78,9 +80,8 b' def diffordiffstat(ui, repo, diffopts, n'
78 if not ui.plain():
80 if not ui.plain():
79 width = ui.termwidth() - graphwidth
81 width = ui.termwidth() - graphwidth
80
82
81 chunks = repo[node2].diff(repo[node1], match, changes, opts=diffopts,
83 chunks = ctx2.diff(ctx1, match, changes, opts=diffopts, prefix=prefix,
82 prefix=prefix, relroot=relroot,
84 relroot=relroot, hunksfilterfn=hunksfilterfn)
83 hunksfilterfn=hunksfilterfn)
84
85
85 if fp is not None or ui.canwritewithoutlabels():
86 if fp is not None or ui.canwritewithoutlabels():
86 out = fp or ui
87 out = fp or ui
@@ -105,8 +106,6 b' def diffordiffstat(ui, repo, diffopts, n'
105 ui.write(chunk, label=label)
106 ui.write(chunk, label=label)
106
107
107 if listsubrepos:
108 if listsubrepos:
108 ctx1 = repo[node1]
109 ctx2 = repo[node2]
110 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
109 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
111 tempnode2 = node2
110 tempnode2 = node2
112 try:
111 try:
General Comments 0
You need to be logged in to leave comments. Login now