Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 9547:f57640bf10d4
cmdutil: changeset_printer: use methods of filectx/changectx.
This allows extensions that modify changeset metadata (e.g.
description) by overriding methods of changectx to get consistent
behavior from all log-like commands, regardless of whether templates
or styles are used. Without this, overriding changectx methods works
if you use styles or templates, but not with default log format.
This meant adding filectx.extra() for consistency with changectx.
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Mon, 05 Oct 2009 18:17:13 -0400 |
parents | f04d17912441 |
children | 64425c5a9257 2cb0cab10d2e |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Oct 07 22:50:20 2009 +0200 +++ b/mercurial/cmdutil.py Mon Oct 05 18:17:13 2009 -0400 @@ -652,9 +652,8 @@ return log = self.repo.changelog - changes = log.read(changenode) - date = util.datestr(changes[2]) - extra = changes[5] + date = util.datestr(ctx.date()) + extra = ctx.extra() branch = extra.get("branch") hexfunc = self.ui.debugflag and hex or short @@ -674,9 +673,10 @@ self.ui.write(_("parent: %d:%s\n") % parent) if self.ui.debugflag: + mnode = ctx.manifestnode() self.ui.write(_("manifest: %d:%s\n") % - (self.repo.manifest.rev(changes[0]), hex(changes[0]))) - self.ui.write(_("user: %s\n") % changes[1]) + (self.repo.manifest.rev(mnode), hex(mnode))) + self.ui.write(_("user: %s\n") % ctx.user()) self.ui.write(_("date: %s\n") % date) if self.ui.debugflag: @@ -685,8 +685,8 @@ files): if value: self.ui.write("%-12s %s\n" % (key, " ".join(value))) - elif changes[3] and self.ui.verbose: - self.ui.write(_("files: %s\n") % " ".join(changes[3])) + elif ctx.files() and self.ui.verbose: + self.ui.write(_("files: %s\n") % " ".join(ctx.files())) if copies and self.ui.verbose: copies = ['%s (%s)' % c for c in copies] self.ui.write(_("copies: %s\n") % ' '.join(copies)) @@ -696,7 +696,7 @@ self.ui.write(_("extra: %s=%s\n") % (key, value.encode('string_escape'))) - description = changes[4].strip() + description = ctx.description().strip() if description: if self.ui.verbose: self.ui.write(_("description:\n"))