[PATCH] log: add an extension hook-point in changeset_printer

Yuya Nishihara yuya at tcha.org
Thu Jun 29 10:05:13 EDT 2017


On Wed, 28 Jun 2017 16:02:29 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1498484784 -7200
> #      Mon Jun 26 15:46:24 2017 +0200
> # Node ID 51dd67d33413b1219a9dccf87bf8a0306cc9fb5d
> # Parent  247bae545061374a683d8d9369a4869aa6ae4537
> # EXP-Topic changesetprinterhook
> log: add an extension hook-point in changeset_printer

Seems fine. Can you add a test?

> diff -r 247bae545061 -r 51dd67d33413 mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py	Tue Jun 27 23:50:22 2017 +0900
> +++ b/mercurial/cmdutil.py	Mon Jun 26 15:46:24 2017 +0200
> @@ -1381,6 +1381,7 @@
>              for name in ns.names(self.repo, changenode):
>                  self.ui.write(ns.logfmt % name,
>                                label='log.%s' % ns.colorname)
> +
>          if self.ui.debugflag:
>              # i18n: column positioning for "hg log"
>              self.ui.write(_("phase:       %s\n") % ctx.phasestr(),
> @@ -1411,6 +1412,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 +1460,11 @@
>  
>          self.showpatch(ctx, matchfn)
>  
> +    def exthook(self, ctx):
> +        '''empty method used by extension as a hook point
> +        '''
> +        pass

I slightly prefer "_exthook" as this isn't a public function of
changeset_printer.


More information about the Mercurial-devel mailing list