[PATCH 2 of 2] commitextras: make sure keys are non empty ASCII strings

Yuya Nishihara yuya at tcha.org
Tue Jul 18 09:32:17 EDT 2017


On Tue, 18 Jul 2017 17:48:11 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1500378367 -19800
> #      Tue Jul 18 17:16:07 2017 +0530
> # Node ID 6cd19a6fd50016034d2faf7462bafdba4b90659e
> # Parent  64137cfad7e30a459bc7fa5b6fc0e8757a6add8e
> # EXP-Topic fbext
> commitextras: make sure keys are non empty ASCII strings
> 
> diff --git a/hgext/commitextras.py b/hgext/commitextras.py
> --- a/hgext/commitextras.py
> +++ b/hgext/commitextras.py
> @@ -52,6 +52,11 @@
>                                  "KEY=VALUE format")
>                          raise error.Abort(msg % raw)
>                      k, v = raw.split('=', 1)
> +                    isascii = all(ord(c) < 128 for c in k)

Better to reject non-word characters. Perhaps ascii_letters + digits + '_-'
should be enough.

changelog uses ':' as a separator.

https://www.mercurial-scm.org/repo/hg/file/4.2.2/mercurial/changelog.py#l66


More information about the Mercurial-devel mailing list