[PATCH] contrib: fix check-commit to not reject commits from `hg sign` and `hg tag`
Martin von Zweigbergk
martinvonz at google.com
Thu Jan 19 00:35:48 EST 2017
On Wed, Jan 18, 2017 at 8:35 PM, Augie Fackler <raf at durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1484800475 18000
> # Wed Jan 18 23:34:35 2017 -0500
> # Branch stable
> # Node ID 416cd976ac56e2915e5ee7422d9b97f0d41b8e04
> # Parent 41d220e2bed95664c335f6a7ef70b8ce06dca86c
> contrib: fix check-commit to not reject commits from `hg sign` and `hg tag`
>
> I'm tired of having a spurious red build every time we do a
> release. Fix it once and for all.
>
> diff --git a/contrib/check-commit b/contrib/check-commit
> --- a/contrib/check-commit
> +++ b/contrib/check-commit
> @@ -59,6 +59,10 @@ def checkcommit(commit, node=None):
> exitcode = 0
> printed = node is None
> hits = []
> + signtag = (afterheader +
> + r'Added (tag [^ ]+|signature) for changeset [a-f0-9]{12}')
> + if re.search(signtag, commit):
> + return 0
> for exp, msg in errors:
> for m in re.finditer(exp, commit):
> end = m.end()
> diff --git a/tests/test-contrib-check-commit.t b/tests/test-contrib-check-commit.t
> --- a/tests/test-contrib-check-commit.t
> +++ b/tests/test-contrib-check-commit.t
> @@ -3,6 +3,29 @@ Test the 'check-commit' script
>
> A fine patch:
Queued, thanks. I reordered lines in flight so the above line still
refers to the patch with a long header that it used to (even though
it's technically correct that your patch is also a fine patch).
>
> + $ cat > creates-a-tag.diff << EOF
> + > # HG changeset patch
> + > # User Augie Fackler <raf at durin42.com>
> + > # Date 1484787778 18000
> + > # Wed Jan 18 20:02:58 2017 -0500
> + > # Branch stable
> + > # Node ID c177635e4acf52923bc3aa9f72a5b1ad1197b173
> + > # Parent a1dd2c0c479e0550040542e392e87bc91262517e
> + > Added tag 4.1-rc for changeset a1dd2c0c479e
> + >
> + > diff --git a/.hgtags b/.hgtags
> + > --- a/.hgtags
> + > +++ b/.hgtags
> + > @@ -150,3 +150,4 @@ 438173c415874f6ac653efc1099dec9c9150e90f
> + > eab27446995210c334c3d06f1a659e3b9b5da769 4.0
> + > b3b1ae98f6a0e14c1e1ba806a6c18e193b6dae5c 4.0.1
> + > e69874dc1f4e142746ff3df91e678a09c6fc208c 4.0.2
> + > +a1dd2c0c479e0550040542e392e87bc91262517e 4.1-rc
> + > EOF
> +This would normally be against the rules, but it's okay because that's
> +what tagging and signing looks like:
> + $ $TESTDIR/../contrib/check-commit < creates-a-tag.diff
> +
> $ cat > patch-with-long-header.diff << EOF
> > # HG changeset patch
> > # User timeless <timeless at mozdev.org>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list