Patchwork D10538: tests: allow trunk versions of clang-format to be used

login
register
mail settings
Submitter phabricator
Date April 30, 2021, 11:20 p.m.
Message ID <differential-rev-PHID-DREV-h25cszdwt2vfctfprowg-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48856/
State New
Headers show

Comments

phabricator - April 30, 2021, 11:20 p.m.
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10538

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -613,7 +613,13 @@ 
 def has_clang_format():
     m = matchoutput('clang-format --version', br'clang-format version (\d+)')
     # style changed somewhere between 10.x and 11.x
-    return m and int(m.group(1)) >= 11
+    if m:
+        return int(m.group(1)) >= 11
+    # Allow users to have a trunk version installed; this assumes that they keep
+    # it up to date, unfortunately checking for that is difficult/impossible?
+    return matchoutput(
+        'clang-format --version', br'clang-format .*trunk \([0-9a-f]+\)'
+    )
 
 
 @check("jshint", "JSHint static code analysis tool")