move scm/hg/.clang-format to scm/hg/mercurial/

Summary:
The clang-format file in scm/hg basically only applies to things in the
scm/hg/mercurial directory.

There are 180 C and C++ files under scm/hg, and the vast majority of them do
not follow the style specified in this clang-format file.  All but 11 of these
files were present in scm/hg/contrib/clang-format-blacklist.

Of the 11 files that do follow this style, 10 are in the scm/hg/mercurial/
directory.  (10 of the 21 files in this directory use this style.)  The 1
other file is in scm/hg/contrib/xdiff.

The majority of the C/C++ files in scm/hg/hgext/extlib and scm/hg/lib/ follow
a style closer to Facebook and Google's C++ style guidelines.

Therefore this moves the .clang-format file to scm/hg/mercurial, and lets the
main fbsource clang-format file apply to the other files under scm/hg

Reviewed By: quark-zju

Differential Revision: D8131512

fbshipit-source-id: 622a33abc39eb240eff4ca27f69a675a7ed54a89
This commit is contained in:
Adam Simpkins 2018-05-25 14:33:27 -07:00 committed by Facebook Github Bot
parent 6e33b70c43
commit 5682d5e0db
6 changed files with 11 additions and 156 deletions

View File

@ -8,6 +8,6 @@ indent_style = space
trim_trailing_whitespace = true
[*.{c,h}]
indent_size = 8
indent_style = tab
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

View File

@ -1,13 +1,5 @@
# 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
@ -19,147 +11,3 @@ mercurial/cext/mpatch.c
mercurial/cext/osutil.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/extlib/cfastmanifest.c
hgext/extlib/cfastmanifest/bsearch.c
hgext/extlib/cfastmanifest/bsearch.h
hgext/extlib/cfastmanifest/bsearch_test.c
hgext/extlib/cfastmanifest/checksum.c
hgext/extlib/cfastmanifest/checksum.h
hgext/extlib/cfastmanifest/checksum_test.c
hgext/extlib/cfastmanifest/internal_result.h
hgext/extlib/cfastmanifest/node.c
hgext/extlib/cfastmanifest/node.h
hgext/extlib/cfastmanifest/node_test.c
hgext/extlib/cfastmanifest/path_buffer.h
hgext/extlib/cfastmanifest/result.h
hgext/extlib/cfastmanifest/tests.c
hgext/extlib/cfastmanifest/tests.h
hgext/extlib/cfastmanifest/tree.c
hgext/extlib/cfastmanifest/tree.h
hgext/extlib/cfastmanifest/tree_arena.c
hgext/extlib/cfastmanifest/tree_arena.h
hgext/extlib/cfastmanifest/tree_convert.c
hgext/extlib/cfastmanifest/tree_convert_rt.c
hgext/extlib/cfastmanifest/tree_convert_test.c
hgext/extlib/cfastmanifest/tree_copy.c
hgext/extlib/cfastmanifest/tree_copy_test.c
hgext/extlib/cfastmanifest/tree_diff.c
hgext/extlib/cfastmanifest/tree_diff_test.c
hgext/extlib/cfastmanifest/tree_disk.c
hgext/extlib/cfastmanifest/tree_disk_test.c
hgext/extlib/cfastmanifest/tree_dump.c
hgext/extlib/cfastmanifest/tree_iterate_rt.c
hgext/extlib/cfastmanifest/tree_iterator.c
hgext/extlib/cfastmanifest/tree_iterator.h
hgext/extlib/cfastmanifest/tree_iterator_test.c
hgext/extlib/cfastmanifest/tree_path.c
hgext/extlib/cfastmanifest/tree_path.h
hgext/extlib/cfastmanifest/tree_test.c
hgext/extlib/cstore/datapackstore.h
hgext/extlib/cstore/datastore.h
hgext/extlib/cstore/deltachain.h
hgext/extlib/cstore/key.h
hgext/extlib/cstore/match.h
hgext/extlib/cstore/py-cdatapack.h
hgext/extlib/cstore/py-datapackstore.h
hgext/extlib/cstore/py-structs.h
hgext/extlib/cstore/py-treemanifest.h
hgext/extlib/cstore/pythondatastore.h
hgext/extlib/cstore/pythonkeyiterator.h
hgext/extlib/cstore/pythonutil.h
hgext/extlib/cstore/store.h
hgext/extlib/cstore/uniondatapackstore.h
hgext/extlib/ctreemanifest/manifest.h
hgext/extlib/ctreemanifest/manifest_entry.h
hgext/extlib/ctreemanifest/manifest_fetcher.h
hgext/extlib/ctreemanifest/manifest_ptr.h
hgext/extlib/ctreemanifest/treemanifest.h
hgext/extlib/pywatchman/bser.c
lib/cdatapack/cdatapack.c
lib/cdatapack/cdatapack.h
lib/cdatapack/cdatapack_dump.c
lib/cdatapack/cdatapack_get.c
lib/clib/buffer.c
lib/clib/buffer.h
lib/clib/convert.h
lib/clib/null_test.c
lib/clib/portability/inet.h
lib/clib/portability/portability.h
lib/clib/portability/unistd.h
lib/clib/sha1.h
lib/third-party/mman-win32/mman.c
lib/third-party/mman-win32/mman.h
lib/third-party/mman-win32/test.c
lib/third-party/sha1dc/sha1.c
lib/third-party/sha1dc/sha1.h
lib/third-party/sha1dc/ubc_check.c
lib/third-party/sha1dc/ubc_check.h
lib/third-party/xdiff/xdiff.h
lib/third-party/xdiff/xdiffi.c
lib/third-party/xdiff/xdiffi.h
lib/third-party/xdiff/xemit.c
lib/third-party/xdiff/xemit.h
lib/third-party/xdiff/xhistogram.c
lib/third-party/xdiff/xinclude.h
lib/third-party/xdiff/xmacros.h
lib/third-party/xdiff/xmerge.c
lib/third-party/xdiff/xpatience.c
lib/third-party/xdiff/xprepare.c
lib/third-party/xdiff/xprepare.h
lib/third-party/xdiff/xtypes.h
lib/third-party/xdiff/xutils.c
lib/third-party/xdiff/xutils.h
# Temporary hack before we figure out how to fix it. See T24862348
fb-hgext/linelog/linelog.c
fb-hgext/linelog/linelog.h
fb-hgext/linelog/linelogcli.c
fb-hgext/prebuilt/cython/clindex.c
fb-hgext/prebuilt/cython/linelog.c
fb-hgext/prebuilt/cython/patchrmdir.c

8
mercurial/.clang-format Normal file
View File

@ -0,0 +1,8 @@
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: ForIndentation
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false

View File

@ -3,7 +3,7 @@
$ . "$TESTDIR/helpers-testrepo.sh"
$ cd "$TESTDIR"/..
$ for f in `testrepohg files 'set:(**.c or **.h) and not "listfile:contrib/clang-format-blacklist"'` ; do
$ for f in `testrepohg files 'set:(mercurial/**.c or mercurial/**.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

View File

@ -204,7 +204,6 @@ New errors are not allowed. Warnings are strongly discouraged.
Prevent adding new files in the root directory accidentally.
$ testrepohg files 'glob:*'
.clang-format
.editorconfig
.flake8
.gitignore