[PATCH 1 of 3 py3] error: convert the error into strings to pass into ui.warn()

Yuya Nishihara yuya at tcha.org
Thu Mar 16 10:44:26 EDT 2017


On Thu, 16 Mar 2017 13:23:23 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1489638672 -19800
> #      Thu Mar 16 10:01:12 2017 +0530
> # Node ID 47dae3bbf8560824743293870aab601da2d1ed6c
> # Parent  63aeb39b5802644ae99eaa5cf0666f3bf5cc4e90
> error: convert the error into strings to pass into ui.warn()
> 
> diff -r 63aeb39b5802 -r 47dae3bbf856 mercurial/scmutil.py
> --- a/mercurial/scmutil.py	Thu Mar 16 09:13:13 2017 +0530
> +++ b/mercurial/scmutil.py	Thu Mar 16 10:01:12 2017 +0530
> @@ -168,7 +168,8 @@
>          if inst.hint:
>              ui.warn('(%s)\n' % inst.hint)
>      except error.RepoError as inst:
> -        ui.warn(_("abort: %s!\n") % inst)
> +        if inst.args:
> +            ui.warn(_("abort: %s!\n") % ''.join(inst.args))

Maybe we'll need to implement __bytes__() in our exception classes?


More information about the Mercurial-devel mailing list