Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.py @ 33154:4ecc6047d45f
log: add an extension hook-point in changeset_printer
Extensions sometimes wants to add other information in the default log output
format (when no templating is used).
Add an empty function named '_exthook' for easing the extension life.
Extensions will be able to wrap this function and collaborate to display
additional information.
Exthook is called after displaying troubles and just before displaying the
files, extra and description.
Add a new test file to test it and not pollute other test files.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 26 Jun 2017 15:46:24 +0200 |
parents | 1b6946f87c50 |
children | 20f533a92eda |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Jun 27 00:01:17 2017 -0700 +++ b/mercurial/cmdutil.py Mon Jun 26 15:46:24 2017 +0200 @@ -1411,6 +1411,8 @@ self.ui.write(_("trouble: %s\n") % ', '.join(ctx.troubles()), label='log.trouble') + self._exthook(ctx) + if self.ui.debugflag: files = ctx.p1().status(ctx)[:3] for key, value in zip([# i18n: column positioning for "hg log" @@ -1457,6 +1459,11 @@ self.showpatch(ctx, matchfn) + def _exthook(self, ctx): + '''empty method used by extension as a hook point + ''' + pass + def showpatch(self, ctx, matchfn): if not matchfn: matchfn = self.matchfn