D1133: test-clang-format: new test to verify that files stay clang-formatted
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2e8477059d4f: test-clang-format: new test to verify that files stay clang-formatted (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1133?vs=2916=2948 REVISION DETAIL https://phab.mercurial-scm.org/D1133 AFFECTED FILES contrib/clang-format-blacklist tests/test-check-clang-format.t CHANGE DETAILS diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t new file mode 100644 --- /dev/null +++ b/tests/test-check-clang-format.t @@ -0,0 +1,10 @@ +#require clang-format test-repo + + $ . "$TESTDIR/helpers-testrepo.sh" + + $ cd "$TESTDIR"/.. + $ for f in `testrepohg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do + > clang-format --style file $f > $f.formatted + > cmp $f $f.formatted || diff -u $f $f.formatted + > rm $f.formatted + > done diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist new file mode 100644 --- /dev/null +++ b/contrib/clang-format-blacklist @@ -0,0 +1,70 @@ +# Files that just need to be migrated to the formatter. +# Do not add new files here! +contrib/chg/chg.c +contrib/chg/hgclient.c +contrib/chg/hgclient.h +contrib/chg/procutil.c +contrib/chg/procutil.h +contrib/chg/util.c +contrib/chg/util.h +contrib/hgsh/hgsh.c +mercurial/cext/base85.c +mercurial/cext/bdiff.c +mercurial/cext/charencode.c +mercurial/cext/charencode.h +mercurial/cext/diffhelpers.c +mercurial/cext/dirs.c +mercurial/cext/manifest.c +mercurial/cext/mpatch.c +mercurial/cext/osutil.c +mercurial/cext/parsers.c +mercurial/cext/pathencode.c +mercurial/cext/revlog.c +# Vendored code that we should never format: +contrib/python-zstandard/c-ext/bufferutil.c +contrib/python-zstandard/c-ext/compressiondict.c +contrib/python-zstandard/c-ext/compressionparams.c +contrib/python-zstandard/c-ext/compressionwriter.c +contrib/python-zstandard/c-ext/compressobj.c +contrib/python-zstandard/c-ext/compressor.c +contrib/python-zstandard/c-ext/compressoriterator.c +contrib/python-zstandard/c-ext/constants.c +contrib/python-zstandard/c-ext/decompressionwriter.c +contrib/python-zstandard/c-ext/decompressobj.c +contrib/python-zstandard/c-ext/decompressor.c +contrib/python-zstandard/c-ext/decompressoriterator.c +contrib/python-zstandard/c-ext/frameparams.c +contrib/python-zstandard/c-ext/python-zstandard.h +contrib/python-zstandard/zstd.c +contrib/python-zstandard/zstd/common/bitstream.h +contrib/python-zstandard/zstd/common/entropy_common.c +contrib/python-zstandard/zstd/common/error_private.c +contrib/python-zstandard/zstd/common/error_private.h +contrib/python-zstandard/zstd/common/fse.h +contrib/python-zstandard/zstd/common/fse_decompress.c +contrib/python-zstandard/zstd/common/huf.h +contrib/python-zstandard/zstd/common/mem.h +contrib/python-zstandard/zstd/common/pool.c +contrib/python-zstandard/zstd/common/pool.h +contrib/python-zstandard/zstd/common/threading.c +contrib/python-zstandard/zstd/common/threading.h +contrib/python-zstandard/zstd/common/xxhash.c +contrib/python-zstandard/zstd/common/xxhash.h +contrib/python-zstandard/zstd/common/zstd_common.c +contrib/python-zstandard/zstd/common/zstd_errors.h +contrib/python-zstandard/zstd/common/zstd_internal.h +contrib/python-zstandard/zstd/compress/fse_compress.c +contrib/python-zstandard/zstd/compress/huf_compress.c +contrib/python-zstandard/zstd/compress/zstd_compress.c +contrib/python-zstandard/zstd/compress/zstd_opt.h +contrib/python-zstandard/zstd/compress/zstdmt_compress.c +contrib/python-zstandard/zstd/compress/zstdmt_compress.h +contrib/python-zstandard/zstd/decompress/huf_decompress.c +contrib/python-zstandard/zstd/decompress/zstd_decompress.c +contrib/python-zstandard/zstd/dictBuilder/cover.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.h +contrib/python-zstandard/zstd/dictBuilder/zdict.c +contrib/python-zstandard/zstd/dictBuilder/zdict.h +contrib/python-zstandard/zstd/zstd.h +hgext/fsmonitor/pywatchman/bser.c To: durin42, #hg-reviewers, ryanmce Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
ryanmce accepted this revision. ryanmce added a comment. This revision is now accepted and ready to land. Yeah, I was running the wrong run-tests.py. Thanks for the help @durin42. queued REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
quark added a comment. In https://phab.mercurial-scm.org/D1133#19539, @ryanmce wrote: > I get `skipped: unknown feature: clang-format` when running `test-check-clang-format.t` now. What am I doing wrong? Are you using `run-tests.py` from this repo and running it in the `tests/` directory from this repo? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: quark, ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
ryanmce added a comment. I get `skipped: unknown feature: clang-format` when running `test-check-clang-format.t` now. What am I doing wrong? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
durin42 updated this revision to Diff 2916. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1133?vs=2883=2916 REVISION DETAIL https://phab.mercurial-scm.org/D1133 AFFECTED FILES contrib/clang-format-blacklist tests/test-check-clang-format.t CHANGE DETAILS diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t new file mode 100644 --- /dev/null +++ b/tests/test-check-clang-format.t @@ -0,0 +1,10 @@ +#require clang-format test-repo + + $ . "$TESTDIR/helpers-testrepo.sh" + + $ cd "$TESTDIR"/.. + $ for f in `testrepohg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do + > clang-format --style file $f > $f.formatted + > cmp $f $f.formatted || diff -u $f $f.formatted + > rm $f.formatted + > done diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist new file mode 100644 --- /dev/null +++ b/contrib/clang-format-blacklist @@ -0,0 +1,70 @@ +# Files that just need to be migrated to the formatter. +# Do not add new files here! +contrib/chg/chg.c +contrib/chg/hgclient.c +contrib/chg/hgclient.h +contrib/chg/procutil.c +contrib/chg/procutil.h +contrib/chg/util.c +contrib/chg/util.h +contrib/hgsh/hgsh.c +mercurial/cext/base85.c +mercurial/cext/bdiff.c +mercurial/cext/charencode.c +mercurial/cext/charencode.h +mercurial/cext/diffhelpers.c +mercurial/cext/dirs.c +mercurial/cext/manifest.c +mercurial/cext/mpatch.c +mercurial/cext/osutil.c +mercurial/cext/parsers.c +mercurial/cext/pathencode.c +mercurial/cext/revlog.c +# Vendored code that we should never format: +contrib/python-zstandard/c-ext/bufferutil.c +contrib/python-zstandard/c-ext/compressiondict.c +contrib/python-zstandard/c-ext/compressionparams.c +contrib/python-zstandard/c-ext/compressionwriter.c +contrib/python-zstandard/c-ext/compressobj.c +contrib/python-zstandard/c-ext/compressor.c +contrib/python-zstandard/c-ext/compressoriterator.c +contrib/python-zstandard/c-ext/constants.c +contrib/python-zstandard/c-ext/decompressionwriter.c +contrib/python-zstandard/c-ext/decompressobj.c +contrib/python-zstandard/c-ext/decompressor.c +contrib/python-zstandard/c-ext/decompressoriterator.c +contrib/python-zstandard/c-ext/frameparams.c +contrib/python-zstandard/c-ext/python-zstandard.h +contrib/python-zstandard/zstd.c +contrib/python-zstandard/zstd/common/bitstream.h +contrib/python-zstandard/zstd/common/entropy_common.c +contrib/python-zstandard/zstd/common/error_private.c +contrib/python-zstandard/zstd/common/error_private.h +contrib/python-zstandard/zstd/common/fse.h +contrib/python-zstandard/zstd/common/fse_decompress.c +contrib/python-zstandard/zstd/common/huf.h +contrib/python-zstandard/zstd/common/mem.h +contrib/python-zstandard/zstd/common/pool.c +contrib/python-zstandard/zstd/common/pool.h +contrib/python-zstandard/zstd/common/threading.c +contrib/python-zstandard/zstd/common/threading.h +contrib/python-zstandard/zstd/common/xxhash.c +contrib/python-zstandard/zstd/common/xxhash.h +contrib/python-zstandard/zstd/common/zstd_common.c +contrib/python-zstandard/zstd/common/zstd_errors.h +contrib/python-zstandard/zstd/common/zstd_internal.h +contrib/python-zstandard/zstd/compress/fse_compress.c +contrib/python-zstandard/zstd/compress/huf_compress.c +contrib/python-zstandard/zstd/compress/zstd_compress.c +contrib/python-zstandard/zstd/compress/zstd_opt.h +contrib/python-zstandard/zstd/compress/zstdmt_compress.c +contrib/python-zstandard/zstd/compress/zstdmt_compress.h +contrib/python-zstandard/zstd/decompress/huf_decompress.c +contrib/python-zstandard/zstd/decompress/zstd_decompress.c +contrib/python-zstandard/zstd/dictBuilder/cover.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.h +contrib/python-zstandard/zstd/dictBuilder/zdict.c +contrib/python-zstandard/zstd/dictBuilder/zdict.h +contrib/python-zstandard/zstd/zstd.h +hgext/fsmonitor/pywatchman/bser.c To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
durin42 added inline comments. INLINE COMMENTS > ryanmce wrote in test-check-clang-format.t:1 > This test fails for me with errors about lz4revlog. > > It feels like what we need here is a change similar to > https://phab.mercurial-scm.org/rHG6c113a7dec52be38927b16962282ea660de0b03c, > where we use the system hg to examine the local repository. Please reuse the > `syshg` function here. Derp, this is done. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
ryanmce requested changes to this revision. ryanmce added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > test-check-clang-format.t:1 > +#require clang-format test-repo > + $ cd "$TESTDIR"/.. This test fails for me with errors about lz4revlog. It feels like what we need here is a change similar to https://phab.mercurial-scm.org/rHG6c113a7dec52be38927b16962282ea660de0b03c, where we use the system hg to examine the local repository. Please reuse the `syshg` function here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 To: durin42, #hg-reviewers, ryanmce Cc: ryanmce, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1133: test-clang-format: new test to verify that files stay clang-formatted
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY For now all .c and .h files are blacklisted. As they become clang-formatted, we'll remove them from the blacklist,and then this test will produce output if there are diffs. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1133 AFFECTED FILES contrib/clang-format-blacklist tests/test-check-clang-format.t CHANGE DETAILS diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t new file mode 100644 --- /dev/null +++ b/tests/test-check-clang-format.t @@ -0,0 +1,7 @@ +#require clang-format test-repo + $ cd "$TESTDIR"/.. + $ for f in `hg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do + > clang-format --style file $f > $f.formatted + > cmp $f $f.formatted || diff -u $f $f.formatted + > rm $f.formatted + > done diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist new file mode 100644 --- /dev/null +++ b/contrib/clang-format-blacklist @@ -0,0 +1,70 @@ +# Files that just need to be migrated to the formatter. +# Do not add new files here! +contrib/chg/chg.c +contrib/chg/hgclient.c +contrib/chg/hgclient.h +contrib/chg/procutil.c +contrib/chg/procutil.h +contrib/chg/util.c +contrib/chg/util.h +contrib/hgsh/hgsh.c +mercurial/cext/base85.c +mercurial/cext/bdiff.c +mercurial/cext/charencode.c +mercurial/cext/charencode.h +mercurial/cext/diffhelpers.c +mercurial/cext/dirs.c +mercurial/cext/manifest.c +mercurial/cext/mpatch.c +mercurial/cext/osutil.c +mercurial/cext/parsers.c +mercurial/cext/pathencode.c +mercurial/cext/revlog.c +# Vendored code that we should never format: +contrib/python-zstandard/c-ext/bufferutil.c +contrib/python-zstandard/c-ext/compressiondict.c +contrib/python-zstandard/c-ext/compressionparams.c +contrib/python-zstandard/c-ext/compressionwriter.c +contrib/python-zstandard/c-ext/compressobj.c +contrib/python-zstandard/c-ext/compressor.c +contrib/python-zstandard/c-ext/compressoriterator.c +contrib/python-zstandard/c-ext/constants.c +contrib/python-zstandard/c-ext/decompressionwriter.c +contrib/python-zstandard/c-ext/decompressobj.c +contrib/python-zstandard/c-ext/decompressor.c +contrib/python-zstandard/c-ext/decompressoriterator.c +contrib/python-zstandard/c-ext/frameparams.c +contrib/python-zstandard/c-ext/python-zstandard.h +contrib/python-zstandard/zstd.c +contrib/python-zstandard/zstd/common/bitstream.h +contrib/python-zstandard/zstd/common/entropy_common.c +contrib/python-zstandard/zstd/common/error_private.c +contrib/python-zstandard/zstd/common/error_private.h +contrib/python-zstandard/zstd/common/fse.h +contrib/python-zstandard/zstd/common/fse_decompress.c +contrib/python-zstandard/zstd/common/huf.h +contrib/python-zstandard/zstd/common/mem.h +contrib/python-zstandard/zstd/common/pool.c +contrib/python-zstandard/zstd/common/pool.h +contrib/python-zstandard/zstd/common/threading.c +contrib/python-zstandard/zstd/common/threading.h +contrib/python-zstandard/zstd/common/xxhash.c +contrib/python-zstandard/zstd/common/xxhash.h +contrib/python-zstandard/zstd/common/zstd_common.c +contrib/python-zstandard/zstd/common/zstd_errors.h +contrib/python-zstandard/zstd/common/zstd_internal.h +contrib/python-zstandard/zstd/compress/fse_compress.c +contrib/python-zstandard/zstd/compress/huf_compress.c +contrib/python-zstandard/zstd/compress/zstd_compress.c +contrib/python-zstandard/zstd/compress/zstd_opt.h +contrib/python-zstandard/zstd/compress/zstdmt_compress.c +contrib/python-zstandard/zstd/compress/zstdmt_compress.h +contrib/python-zstandard/zstd/decompress/huf_decompress.c +contrib/python-zstandard/zstd/decompress/zstd_decompress.c +contrib/python-zstandard/zstd/dictBuilder/cover.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.c +contrib/python-zstandard/zstd/dictBuilder/divsufsort.h +contrib/python-zstandard/zstd/dictBuilder/zdict.c +contrib/python-zstandard/zstd/dictBuilder/zdict.h +contrib/python-zstandard/zstd/zstd.h +hgext/fsmonitor/pywatchman/bser.c To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel