Re: releasenotes: use re.MULTILINE mode when checking admonitions

2022-10-12 Thread Augie Fackler
Thanks, queued. Note that your patch suffered pretty bad whitespace damage 
in-flight, as though you copied and pasted the patch into a standard mail 
client. https://www.mercurial-scm.org/wiki/ContributingChanges#Emailing_patches 
 is 
the golden path (specifically the patchbomb extension) to avoid that in the 
future if you want to use email (which I understand!), otherwise I recommend 
trying out heptapod.

Sorry for the slow review.

> On Sep 30, 2022, at 11:18, Craig Ozancin  wrote:
> 
> # HG changeset patch
> # User Craig Ozancin mailto:c.ozan...@gmail.com>>
> # Date 1664550348 21600
> #  Fri Sep 30 09:05:48 2022 -0600
> # Node ID 5083c4a03bad27c7d3353b491516bed93f359d2a
> # Parent  4f36738a869a91275c9a2b2f77219cc663199e13
> releasenotes: use re.MULTILINE mode when checking admonitions
> 
> Release note admonitions must start at the beginning of a line within
> the changeset description:
> 
> .. admonitions::
> 
> The checkadmonitions function search for and validates admonitions.
> 
> Unfortunately, since the ctx.description is multi-line, the regex search
> always fails unless the admonition is on the first line.
> 
> This changeset adds re.MULTILINE to the re.compile to make the re opbject
> multi-line.
> 
> diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
> --- a/hgext/releasenotes.py
> +++ b/hgext/releasenotes.py
> @@ -70,7 +70,7 @@ DEFAULT_SECTIONS = [
>  (b'api', _(b'API Changes')),
>  ]
>  
> -RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$')
> +RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$', 
> re.MULTILINE)
>  RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b'
>  
>  BULLET_SECTION = _(b'Other Changes')
> diff --git a/tests/test-releasenotes-formatting.t 
> b/tests/test-releasenotes-formatting.t
> --- a/tests/test-releasenotes-formatting.t
> +++ b/tests/test-releasenotes-formatting.t
> @@ -387,6 +387,8 @@ Testing output for the --check (-c) flag
>  
>$ touch a
>$ hg -q commit -A -l - << EOF
> +  > commit 2
> +  > 
>> .. asf::
>> 
>>First paragraph under this admonition.
> @@ -395,17 +397,19 @@ Testing output for the --check (-c) flag
>  Suggest similar admonition in place of the invalid one.
>  
>$ hg releasenotes -r . -c
> -  Invalid admonition 'asf' present in changeset 4026fe9e1c20
> +  Invalid admonition 'asf' present in changeset 99fa3c800c5e
>  
>$ touch b
>$ hg -q commit -A -l - << EOF
> -  > .. fixes::
> +  > commit 1
> +  > 
> +  > .. fixed::
>> 
>>First paragraph under this admonition.
>> EOF
>  
>$ hg releasenotes -r . -c
> -  Invalid admonition 'fixes' present in changeset 0e7130d2705c
> +  Invalid admonition 'fixed' present in changeset 2fbd922a34d6
>(did you mean fix?)
>  
>$ cd ..
> 
> ___
> Mercurial-devel mailing list
> Mercurial-devel@lists.mercurial-scm.org
> https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel

___
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: releasenotes: use re.MULTILINE mode when checking admonitions

2022-10-12 Thread Craig Ozancin
Thanks for letting me know.

It won't happen again.  I am now setup with mailbomb and waiting on
heptapod.

Craig

On Wed, Oct 12, 2022 at 9:19 AM Augie Fackler  wrote:

> Thanks, queued. Note that your patch suffered pretty bad whitespace damage
> in-flight, as though you copied and pasted the patch into a standard mail
> client.
> https://www.mercurial-scm.org/wiki/ContributingChanges#Emailing_patches is
> the golden path (specifically the patchbomb extension) to avoid that in the
> future if you want to use email (which I understand!), otherwise I
> recommend trying out heptapod.
>
> Sorry for the slow review.
>
> On Sep 30, 2022, at 11:18, Craig Ozancin  wrote:
>
> # HG changeset patch
> # User Craig Ozancin 
> # Date 1664550348 21600
> #  Fri Sep 30 09:05:48 2022 -0600
> # Node ID 5083c4a03bad27c7d3353b491516bed93f359d2a
> # Parent  4f36738a869a91275c9a2b2f77219cc663199e13
> releasenotes: use re.MULTILINE mode when checking admonitions
>
> Release note admonitions must start at the beginning of a line within
> the changeset description:
>
> .. admonitions::
>
> The checkadmonitions function search for and validates admonitions.
>
> Unfortunately, since the ctx.description is multi-line, the regex search
> always fails unless the admonition is on the first line.
>
> This changeset adds re.MULTILINE to the re.compile to make the re opbject
> multi-line.
>
> diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
> --- a/hgext/releasenotes.py
> +++ b/hgext/releasenotes.py
> @@ -70,7 +70,7 @@ DEFAULT_SECTIONS = [
>  (b'api', _(b'API Changes')),
>  ]
>
> -RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$')
> +RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$',
> re.MULTILINE)
>  RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b'
>
>  BULLET_SECTION = _(b'Other Changes')
> diff --git a/tests/test-releasenotes-formatting.t
> b/tests/test-releasenotes-formatting.t
> --- a/tests/test-releasenotes-formatting.t
> +++ b/tests/test-releasenotes-formatting.t
> @@ -387,6 +387,8 @@ Testing output for the --check (-c) flag
>
>$ touch a
>$ hg -q commit -A -l - << EOF
> +  > commit 2
> +  >
>> .. asf::
>>
>>First paragraph under this admonition.
> @@ -395,17 +397,19 @@ Testing output for the --check (-c) flag
>  Suggest similar admonition in place of the invalid one.
>
>$ hg releasenotes -r . -c
> -  Invalid admonition 'asf' present in changeset 4026fe9e1c20
> +  Invalid admonition 'asf' present in changeset 99fa3c800c5e
>
>$ touch b
>$ hg -q commit -A -l - << EOF
> -  > .. fixes::
> +  > commit 1
> +  >
> +  > .. fixed::
>>
>>First paragraph under this admonition.
>> EOF
>
>$ hg releasenotes -r . -c
> -  Invalid admonition 'fixes' present in changeset 0e7130d2705c
> +  Invalid admonition 'fixed' present in changeset 2fbd922a34d6
>(did you mean fix?)
>
>$ cd ..
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@lists.mercurial-scm.org
> https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
>
___
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: releasenotes: use re.MULTILINE mode when checking admonitions

2022-10-17 Thread Raphaël Gomès
Sorry, I seemed to have missed (or never received) the email for your 
member submission, I granted you access to Heptapod just now.

Thanks for contributing!
On 10/13/22 06:38, Craig Ozancin wrote:

Thanks for letting me know.

It won't happen again.  I am now setup with mailbomb and waiting on 
heptapod.


Craig

On Wed, Oct 12, 2022 at 9:19 AM Augie Fackler  wrote:

Thanks, queued. Note that your patch suffered pretty bad
whitespace damage in-flight, as though you copied and pasted the
patch into a standard mail client.
https://www.mercurial-scm.org/wiki/ContributingChanges#Emailing_patches is
the golden path (specifically the patchbomb extension) to avoid
that in the future if you want to use email (which I understand!),
otherwise I recommend trying out heptapod.

Sorry for the slow review.


On Sep 30, 2022, at 11:18, Craig Ozancin  wrote:

# HG changeset patch
# User Craig Ozancin 
# Date 1664550348 21600
#      Fri Sep 30 09:05:48 2022 -0600
# Node ID 5083c4a03bad27c7d3353b491516bed93f359d2a
# Parent  4f36738a869a91275c9a2b2f77219cc663199e13
releasenotes: use re.MULTILINE mode when checking admonitions

Release note admonitions must start at the beginning of a line within
the changeset description:

.. admonitions::

The checkadmonitions function search for and validates admonitions.

Unfortunately, since the ctx.description is multi-line, the regex
search
always fails unless the admonition is on the first line.

This changeset adds re.MULTILINE to the re.compile to make the re
opbject
multi-line.

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -70,7 +70,7 @@ DEFAULT_SECTIONS = [
     (b'api', _(b'API Changes')),
 ]

-RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$')
+RE_DIRECTIVE = re.compile(br'^\.\.
([a-zA-Z0-9_]+)::\s*([^$]+)?$', re.MULTILINE)
 RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b'

 BULLET_SECTION = _(b'Other Changes')
diff --git a/tests/test-releasenotes-formatting.t
b/tests/test-releasenotes-formatting.t
--- a/tests/test-releasenotes-formatting.t
+++ b/tests/test-releasenotes-formatting.t
@@ -387,6 +387,8 @@ Testing output for the --check (-c) flag

   $ touch a
   $ hg -q commit -A -l - << EOF
+  > commit 2
+  >
   > .. asf::
   >
   >    First paragraph under this admonition.
@@ -395,17 +397,19 @@ Testing output for the --check (-c) flag
 Suggest similar admonition in place of the invalid one.

   $ hg releasenotes -r . -c
-  Invalid admonition 'asf' present in changeset 4026fe9e1c20
+  Invalid admonition 'asf' present in changeset 99fa3c800c5e

   $ touch b
   $ hg -q commit -A -l - << EOF
-  > .. fixes::
+  > commit 1
+  >
+  > .. fixed::
   >
   >    First paragraph under this admonition.
   > EOF

   $ hg releasenotes -r . -c
-  Invalid admonition 'fixes' present in changeset 0e7130d2705c
+  Invalid admonition 'fixed' present in changeset 2fbd922a34d6
   (did you mean fix?)

   $ cd ..

___
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel



___
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel___
Mercurial-devel mailing list
Mercurial-devel@lists.mercurial-scm.org
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel