[PATCH] verify: clean up weird error/warning lists

Yuya Nishihara yuya at tcha.org
Mon Dec 21 08:32:10 CST 2015


On Sun, 20 Dec 2015 17:04:55 -0600, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1450650824 21600
> #      Sun Dec 20 16:33:44 2015 -0600
> # Node ID 687b00ef22dd75f9539b13e2a6441135d4d34836
> # Parent  f4f2179077cbec6908e9f7afc72a947e769185ba
> verify: clean up weird error/warning lists
> 
> Nested functions in Python are not able to assign to variables in the
> outer scope without something like the list trick because assignments
> refer to the inner scope. So, we formerly used a list to give an
> object to assign into.
> 
> Now that error and warning are object members, the [0] hack is no
> longer needed.

> -        if warnings[0]:
> -            ui.warn(_("%d warnings encountered!\n") % warnings[0])
> +        if self.warnings:
> +            ui.warn(_("%d warnings encountered!\n") % warnings)
>          if self.fncachewarned:
>              ui.warn(_('hint: run "hg debugrebuildfncache" to recover from '
>                        'corrupt fncache\n'))
> -        if errors[0]:
> -            ui.warn(_("%d integrity errors encountered!\n") % errors[0])
> +        if self.errors:
> +            ui.warn(_("%d integrity errors encountered!\n") % errors)

Good catch. Fixed these undefined references and pushed to the clowncopter,
thanks. Hopes this won't heavily conflict with Durham's upcoming series.


More information about the Mercurial-devel mailing list