Patchwork [STABLE] hghave: fix possible int('') in has_clang_format()

login
register
mail settings
Submitter Yuya Nishihara
Date July 21, 2020, 12:44 p.m.
Message ID <31be0ead4581fab62490.1595335445@mimosa>
Download mbox | patch
Permalink /patch/46815/
State Accepted
Headers show

Comments

Yuya Nishihara - July 21, 2020, 12:44 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1595332145 -32400
#      Tue Jul 21 20:49:05 2020 +0900
# Branch stable
# Node ID 31be0ead4581fab624902b53b4a4d2c1d9a8c82a
# Parent  88f93fc8cb3263a3c10143557cb9626dfcf23f4c
hghave: fix possible int('') in has_clang_format()
Manuel Jacob - July 21, 2020, 12:56 p.m.
On 2020-07-21 14:44, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1595332145 -32400
> #      Tue Jul 21 20:49:05 2020 +0900
> # Branch stable
> # Node ID 31be0ead4581fab624902b53b4a4d2c1d9a8c82a
> # Parent  88f93fc8cb3263a3c10143557cb9626dfcf23f4c
> hghave: fix possible int('') in has_clang_format()
> 
> diff --git a/tests/hghave.py b/tests/hghave.py
> --- a/tests/hghave.py
> +++ b/tests/hghave.py
> @@ -591,7 +591,7 @@ def has_pylint():
> 
>  @check("clang-format", "clang-format C code formatter")
>  def has_clang_format():
> -    m = matchoutput('clang-format --version', br'clang-format version 
> (\d*)')
> +    m = matchoutput('clang-format --version', br'clang-format version 
> (\d+)')

LGTM

>      # style changed somewhere between 4.x and 6.x
>      return m and int(m.group(1)) >= 6
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Augie Fackler - July 21, 2020, 2:39 p.m.
queued for stable, thanks

> On Jul 21, 2020, at 08:56, Manuel Jacob <me@manueljacob.de> wrote:
> 
> On 2020-07-21 14:44, Yuya Nishihara wrote:
>> # HG changeset patch
>> # User Yuya Nishihara <yuya@tcha.org>
>> # Date 1595332145 -32400
>> #      Tue Jul 21 20:49:05 2020 +0900
>> # Branch stable
>> # Node ID 31be0ead4581fab624902b53b4a4d2c1d9a8c82a
>> # Parent  88f93fc8cb3263a3c10143557cb9626dfcf23f4c
>> hghave: fix possible int('') in has_clang_format()
>> diff --git a/tests/hghave.py b/tests/hghave.py
>> --- a/tests/hghave.py
>> +++ b/tests/hghave.py
>> @@ -591,7 +591,7 @@ def has_pylint():
>> @check("clang-format", "clang-format C code formatter")
>> def has_clang_format():
>> -    m = matchoutput('clang-format --version', br'clang-format version (\d*)')
>> +    m = matchoutput('clang-format --version', br'clang-format version (\d+)')
> 
> LGTM
> 
>>     # style changed somewhere between 4.x and 6.x
>>     return m and int(m.group(1)) >= 6
>> _______________________________________________
>> 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

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -591,7 +591,7 @@  def has_pylint():
 
 @check("clang-format", "clang-format C code formatter")
 def has_clang_format():
-    m = matchoutput('clang-format --version', br'clang-format version (\d*)')
+    m = matchoutput('clang-format --version', br'clang-format version (\d+)')
     # style changed somewhere between 4.x and 6.x
     return m and int(m.group(1)) >= 6