On Fri, Dec 16, 2016 at 08:31:29PM +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.da...@ens-lyon.org>
> # Date 1481545965 -3600
> #      Mon Dec 12 13:32:45 2016 +0100
> # Node ID f3479f74af0d2b21c89e906c503f4cddf4b3c39b
> # Parent  182cacaa4c32330c0466b7111a75d060830783e8
> registrar: raise a programming error on duplicated registering

Queued, thanks

>
> Previous, registering different object with the same name would silently
> overwrite the first value with the second one. We now detect the situation and
> raise an error. No extension in test or core had the issues.
>
> diff --git a/mercurial/registrar.py b/mercurial/registrar.py
> --- a/mercurial/registrar.py
> +++ b/mercurial/registrar.py
> @@ -8,6 +8,7 @@
>  from __future__ import absolute_import
>
>  from . import (
> +    error,
>      pycompat,
>      util,
>  )
> @@ -55,6 +56,9 @@ class _funcregistrarbase(object):
>              func._origdoc = doc
>              func.__doc__ = self._formatdoc(decl, doc)
>
> +        if name in self._table:
> +            raise error.ProgrammingError('duplicate registration for name 
> %s',
> +                                         name)
>          self._table[name] = func
>          self._extrasetup(name, func, *args, **kwargs)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to