Comments
Patch
@@ -1296,26 +1296,27 @@ class changeset_printer(object):
self.ui.write("\n\n")
else:
# i18n: column positioning for "hg log"
self.ui.write(_("summary: %s\n") %
description.splitlines()[0],
label='log.summary')
self.ui.write("\n")
- self.showpatch(changenode, matchfn)
-
- def showpatch(self, node, matchfn):
+ self.showpatch(ctx, matchfn)
+
+ def showpatch(self, ctx, matchfn):
if not matchfn:
matchfn = self.matchfn
if matchfn:
stat = self.diffopts.get('stat')
diff = self.diffopts.get('patch')
diffopts = patch.diffallopts(self.ui, self.diffopts)
- prev = self.repo.changelog.parents(node)[0]
+ node = ctx.node()
+ prev = ctx.p1()
if stat:
diffordiffstat(self.ui, self.repo, diffopts, prev, node,
match=matchfn, stat=True)
if diff:
if stat:
self.ui.write("\n")
diffordiffstat(self.ui, self.repo, diffopts, prev, node,
match=matchfn, stat=False)
@@ -1487,17 +1488,17 @@ class changeset_templater(changeset_prin
else:
if self.lastheader != h:
self.lastheader = h
self.ui.write(h)
# write changeset metadata, then patch if requested
key = self._parts['changeset']
self.ui.write(templater.stringify(self.t(key, **props)))
- self.showpatch(ctx.node(), matchfn)
+ self.showpatch(ctx, matchfn)
if self._parts['footer']:
if not self.footer:
self.footer = templater.stringify(
self.t(self._parts['footer'], **props))
except KeyError as inst:
msg = _("%s: no key named '%s'")
raise error.Abort(msg % (self.t.mapfile, inst.args[0]))