##// END OF EJS Templates
black: merge config into main pyproject.toml now that we have it...
Augie Fackler -
r47484:d4c8b4b9 default
parent child Browse files
Show More
@@ -1,14 +1,14 b''
1 [fix]
1 [fix]
2 clang-format:command = clang-format --style file
2 clang-format:command = clang-format --style file
3 clang-format:pattern = set:(**.c or **.cc or **.h) and not "include:contrib/clang-format-ignorelist"
3 clang-format:pattern = set:(**.c or **.cc or **.h) and not "include:contrib/clang-format-ignorelist"
4
4
5 rustfmt:command = rustfmt +nightly
5 rustfmt:command = rustfmt +nightly
6 rustfmt:pattern = set:"**.rs" - "mercurial/thirdparty/**"
6 rustfmt:pattern = set:"**.rs" - "mercurial/thirdparty/**"
7
7
8 black:command = black --config=black.toml -
8 black:command = black
9 black:pattern = set:**.py - mercurial/thirdparty/**
9 black:pattern = set:**.py - mercurial/thirdparty/**
10
10
11 # Mercurial doesn't have any Go code, but if we did this is how we
11 # Mercurial doesn't have any Go code, but if we did this is how we
12 # would configure `hg fix` for Go:
12 # would configure `hg fix` for Go:
13 go:command = gofmt
13 go:command = gofmt
14 go:pattern = set:**.go
14 go:pattern = set:**.go
@@ -1,3 +1,18 b''
1 [build-system]
1 [build-system]
2 requires = ["setuptools", "wheel"]
2 requires = ["setuptools", "wheel"]
3 build-backend = "setuptools.build_meta"
3 build-backend = "setuptools.build_meta"
4
5 [tool.black]
6 line-length = 80
7 exclude = '''
8 build/
9 | wheelhouse/
10 | dist/
11 | packages/
12 | \.hg/
13 | \.mypy_cache/
14 | \.venv/
15 | mercurial/thirdparty/
16 '''
17 skip-string-normalization = true
18 quiet = true
@@ -1,97 +1,96 b''
1 #require test-repo
1 #require test-repo
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ check_code="$TESTDIR"/../contrib/check-code.py
4 $ check_code="$TESTDIR"/../contrib/check-code.py
5 $ cd "$TESTDIR"/..
5 $ cd "$TESTDIR"/..
6
6
7 New errors are not allowed. Warnings are strongly discouraged.
7 New errors are not allowed. Warnings are strongly discouraged.
8 (The writing "no-che?k-code" is for not skipping this file when checking.)
8 (The writing "no-che?k-code" is for not skipping this file when checking.)
9
9
10 $ testrepohg locate \
10 $ testrepohg locate \
11 > -X contrib/python-zstandard \
11 > -X contrib/python-zstandard \
12 > -X hgext/fsmonitor/pywatchman \
12 > -X hgext/fsmonitor/pywatchman \
13 > -X mercurial/thirdparty \
13 > -X mercurial/thirdparty \
14 > -X mercurial/pythoncapi_compat.h \
14 > -X mercurial/pythoncapi_compat.h \
15 > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
15 > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
16 Skipping contrib/automation/hgautomation/__init__.py it has no-che?k-code (glob)
16 Skipping contrib/automation/hgautomation/__init__.py it has no-che?k-code (glob)
17 Skipping contrib/automation/hgautomation/aws.py it has no-che?k-code (glob)
17 Skipping contrib/automation/hgautomation/aws.py it has no-che?k-code (glob)
18 Skipping contrib/automation/hgautomation/cli.py it has no-che?k-code (glob)
18 Skipping contrib/automation/hgautomation/cli.py it has no-che?k-code (glob)
19 Skipping contrib/automation/hgautomation/linux.py it has no-che?k-code (glob)
19 Skipping contrib/automation/hgautomation/linux.py it has no-che?k-code (glob)
20 Skipping contrib/automation/hgautomation/pypi.py it has no-che?k-code (glob)
20 Skipping contrib/automation/hgautomation/pypi.py it has no-che?k-code (glob)
21 Skipping contrib/automation/hgautomation/ssh.py it has no-che?k-code (glob)
21 Skipping contrib/automation/hgautomation/ssh.py it has no-che?k-code (glob)
22 Skipping contrib/automation/hgautomation/try_server.py it has no-che?k-code (glob)
22 Skipping contrib/automation/hgautomation/try_server.py it has no-che?k-code (glob)
23 Skipping contrib/automation/hgautomation/windows.py it has no-che?k-code (glob)
23 Skipping contrib/automation/hgautomation/windows.py it has no-che?k-code (glob)
24 Skipping contrib/automation/hgautomation/winrm.py it has no-che?k-code (glob)
24 Skipping contrib/automation/hgautomation/winrm.py it has no-che?k-code (glob)
25 Skipping contrib/fuzz/FuzzedDataProvider.h it has no-che?k-code (glob)
25 Skipping contrib/fuzz/FuzzedDataProvider.h it has no-che?k-code (glob)
26 Skipping contrib/fuzz/standalone_fuzz_target_runner.cc it has no-che?k-code (glob)
26 Skipping contrib/fuzz/standalone_fuzz_target_runner.cc it has no-che?k-code (glob)
27 Skipping contrib/packaging/hgpackaging/cli.py it has no-che?k-code (glob)
27 Skipping contrib/packaging/hgpackaging/cli.py it has no-che?k-code (glob)
28 Skipping contrib/packaging/hgpackaging/downloads.py it has no-che?k-code (glob)
28 Skipping contrib/packaging/hgpackaging/downloads.py it has no-che?k-code (glob)
29 Skipping contrib/packaging/hgpackaging/inno.py it has no-che?k-code (glob)
29 Skipping contrib/packaging/hgpackaging/inno.py it has no-che?k-code (glob)
30 Skipping contrib/packaging/hgpackaging/py2exe.py it has no-che?k-code (glob)
30 Skipping contrib/packaging/hgpackaging/py2exe.py it has no-che?k-code (glob)
31 Skipping contrib/packaging/hgpackaging/pyoxidizer.py it has no-che?k-code (glob)
31 Skipping contrib/packaging/hgpackaging/pyoxidizer.py it has no-che?k-code (glob)
32 Skipping contrib/packaging/hgpackaging/util.py it has no-che?k-code (glob)
32 Skipping contrib/packaging/hgpackaging/util.py it has no-che?k-code (glob)
33 Skipping contrib/packaging/hgpackaging/wix.py it has no-che?k-code (glob)
33 Skipping contrib/packaging/hgpackaging/wix.py it has no-che?k-code (glob)
34 Skipping i18n/polib.py it has no-che?k-code (glob)
34 Skipping i18n/polib.py it has no-che?k-code (glob)
35 Skipping mercurial/statprof.py it has no-che?k-code (glob)
35 Skipping mercurial/statprof.py it has no-che?k-code (glob)
36 Skipping tests/badserverext.py it has no-che?k-code (glob)
36 Skipping tests/badserverext.py it has no-che?k-code (glob)
37
37
38 @commands in debugcommands.py should be in alphabetical order.
38 @commands in debugcommands.py should be in alphabetical order.
39
39
40 >>> import re
40 >>> import re
41 >>> commands = []
41 >>> commands = []
42 >>> with open('mercurial/debugcommands.py', 'rb') as fh:
42 >>> with open('mercurial/debugcommands.py', 'rb') as fh:
43 ... for line in fh:
43 ... for line in fh:
44 ... m = re.match(br"^@command\('([a-z]+)", line)
44 ... m = re.match(br"^@command\('([a-z]+)", line)
45 ... if m:
45 ... if m:
46 ... commands.append(m.group(1))
46 ... commands.append(m.group(1))
47 >>> scommands = list(sorted(commands))
47 >>> scommands = list(sorted(commands))
48 >>> for i, command in enumerate(scommands):
48 >>> for i, command in enumerate(scommands):
49 ... if command != commands[i]:
49 ... if command != commands[i]:
50 ... print('commands in debugcommands.py not sorted; first differing '
50 ... print('commands in debugcommands.py not sorted; first differing '
51 ... 'command is %s; expected %s' % (commands[i], command))
51 ... 'command is %s; expected %s' % (commands[i], command))
52 ... break
52 ... break
53
53
54 Prevent adding new files in the root directory accidentally.
54 Prevent adding new files in the root directory accidentally.
55
55
56 $ testrepohg files 'glob:*'
56 $ testrepohg files 'glob:*'
57 .arcconfig
57 .arcconfig
58 .clang-format
58 .clang-format
59 .editorconfig
59 .editorconfig
60 .hgignore
60 .hgignore
61 .hgsigs
61 .hgsigs
62 .hgtags
62 .hgtags
63 .jshintrc
63 .jshintrc
64 CONTRIBUTING
64 CONTRIBUTING
65 CONTRIBUTORS
65 CONTRIBUTORS
66 COPYING
66 COPYING
67 Makefile
67 Makefile
68 README.rst
68 README.rst
69 black.toml
70 hg
69 hg
71 hgeditor
70 hgeditor
72 hgweb.cgi
71 hgweb.cgi
73 pyproject.toml
72 pyproject.toml
74 rustfmt.toml
73 rustfmt.toml
75 setup.py
74 setup.py
76
75
77 Prevent adding modules which could be shadowed by ancient .so/.dylib.
76 Prevent adding modules which could be shadowed by ancient .so/.dylib.
78
77
79 $ testrepohg files \
78 $ testrepohg files \
80 > mercurial/base85.py \
79 > mercurial/base85.py \
81 > mercurial/bdiff.py \
80 > mercurial/bdiff.py \
82 > mercurial/diffhelpers.py \
81 > mercurial/diffhelpers.py \
83 > mercurial/mpatch.py \
82 > mercurial/mpatch.py \
84 > mercurial/osutil.py \
83 > mercurial/osutil.py \
85 > mercurial/parsers.py \
84 > mercurial/parsers.py \
86 > mercurial/zstd.py
85 > mercurial/zstd.py
87 [1]
86 [1]
88
87
89 Keep python3 tests sorted:
88 Keep python3 tests sorted:
90 $ sort < contrib/python3-whitelist > $TESTTMP/py3sorted
89 $ sort < contrib/python3-whitelist > $TESTTMP/py3sorted
91 $ cmp contrib/python3-whitelist $TESTTMP/py3sorted || echo 'Please sort passing tests!'
90 $ cmp contrib/python3-whitelist $TESTTMP/py3sorted || echo 'Please sort passing tests!'
92
91
93 Keep Windows line endings in check
92 Keep Windows line endings in check
94
93
95 $ testrepohg files 'set:eol(dos)'
94 $ testrepohg files 'set:eol(dos)'
96 contrib/win32/hg.bat
95 contrib/win32/hg.bat
97 contrib/win32/mercurial.ini
96 contrib/win32/mercurial.ini
@@ -1,5 +1,5 b''
1 #require black test-repo
1 #require black test-repo
2
2
3 $ cd $RUNTESTDIR/..
3 $ cd $RUNTESTDIR/..
4 $ black --config=black.toml --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'`
4 $ black --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'`
5
5
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now