[PATCH] contrib: add check for use of admonitions and its validity
Yuya Nishihara
yuya at tcha.org
Sat Aug 5 09:36:46 EDT 2017
On Sat, 05 Aug 2017 08:54:13 +0530, Rishabh Madan wrote:
> # HG changeset patch
> # User Rishabh Madan <rishabhmadan96 at gmail.com>
> # Date 1501903168 -19800
> # Sat Aug 05 08:49:28 2017 +0530
> # Node ID cc695f1458baf2c39ffdec4a1256a93fd659d62d
> # Parent 609606d217659e0a6c1cf6f907b6512be5340e57
> contrib: add check for use of admonitions and its validity
>
> While using releasenotes extension, we will be using admonitions in commit messages.
> This check will look for an admonition within the message. If it exists, it will
> verify if it is stated under default or custom admonition. The check fails if the
> admonition is not present in any of them.
>
> diff -r 609606d21765 -r cc695f1458ba contrib/check-commit
> --- a/contrib/check-commit Thu Jul 20 01:30:41 2017 -0700
> +++ b/contrib/check-commit Sat Aug 05 08:49:28 2017 +0530
> @@ -21,9 +21,16 @@
> import re
> import sys
>
> +from mercurial import (
> + config,
> + hg,
> + ui as uimod,
> +)
check-commit seems to try not depending on mercurial modules. Maybe it's easier
to implement the check function as a command of the releasenotes extension?
> if __name__ == "__main__":
> exitcode = 0
> node = os.environ.get("HG_NODE")
> -
> if node:
> commit = readcommit(node)
> - exitcode = checkcommit(commit)
> + exitcode = checkcommit(commit, node)
> elif sys.argv[1:]:
> for node in sys.argv[1:]:
> exitcode |= checkcommit(readcommit(node), node)
test-check-commit.t feeds patches to stdin, in which case, no node value
is available.
More information about the Mercurial-devel
mailing list