Mercurial > hg-stable
changeset 47904:1ff06ceb070f stable
tests: allow Google's internal builds of clang-format to be used
These builds do not actually include any Google-specific formatting changes; the
only reason they don't include the LLVM version number is due to a decision to
elide the version number from *all* LLVM/clang projects.
For most builds of clang-format, even "unofficial" ones, the LLVM version will
be displayed; example:
```
clang-format version 14.0.0 (https://github.com/llvm/llvm-project.git 1830ec94ac022ae0b6d6876fc2251e6b91e5931e)
```
The Google-internal build looks like this:
```
clang-format version google3-trunk (1830ec94ac022ae0b6d6876fc2251e6b91e5931e)
```
Differential Revision: https://phab.mercurial-scm.org/D10538
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Fri, 30 Apr 2021 16:00:40 -0700 |
parents | 6ca72719b60b |
children | e2836d08c88c 809e780c72e5 |
files | tests/hghave.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Tue Oct 26 18:53:58 2021 +0530 +++ b/tests/hghave.py Fri Apr 30 16:00:40 2021 -0700 @@ -611,7 +611,14 @@ 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 + # Assist Googler contributors, they have a centrally-maintained version of + # clang-format that is generally very fresh, but unlike most builds (both + # official and unofficial), it does *not* include a version number. + return matchoutput( + 'clang-format --version', br'clang-format .*google3-trunk \([0-9a-f]+\)' + ) @check("jshint", "JSHint static code analysis tool")