##// END OF EJS Templates
black: add a pyproject.toml that contains our black settings...
Augie Fackler -
r43334:929678eb default
parent child Browse files
Show More
@@ -0,0 +1,3 b''
1 [tool.black]
2 line-length = 80
3 exclude = 'build/|wheelhouse/|dist/|packages/|\.hg/|\.mypy_cache/|\.venv/|mercurial/thirdparty/|hgext/fsmonitor/pywatchman/|contrib/python-zstandard/'
@@ -1,85 +1,86 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 > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
14 > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
15 Skipping contrib/automation/hgautomation/__init__.py it has no-che?k-code (glob)
15 Skipping contrib/automation/hgautomation/__init__.py it has no-che?k-code (glob)
16 Skipping contrib/automation/hgautomation/aws.py it has no-che?k-code (glob)
16 Skipping contrib/automation/hgautomation/aws.py it has no-che?k-code (glob)
17 Skipping contrib/automation/hgautomation/cli.py it has no-che?k-code (glob)
17 Skipping contrib/automation/hgautomation/cli.py it has no-che?k-code (glob)
18 Skipping contrib/automation/hgautomation/linux.py it has no-che?k-code (glob)
18 Skipping contrib/automation/hgautomation/linux.py it has no-che?k-code (glob)
19 Skipping contrib/automation/hgautomation/pypi.py it has no-che?k-code (glob)
19 Skipping contrib/automation/hgautomation/pypi.py it has no-che?k-code (glob)
20 Skipping contrib/automation/hgautomation/ssh.py it has no-che?k-code (glob)
20 Skipping contrib/automation/hgautomation/ssh.py it has no-che?k-code (glob)
21 Skipping contrib/automation/hgautomation/try_server.py it has no-che?k-code (glob)
21 Skipping contrib/automation/hgautomation/try_server.py it has no-che?k-code (glob)
22 Skipping contrib/automation/hgautomation/windows.py it has no-che?k-code (glob)
22 Skipping contrib/automation/hgautomation/windows.py it has no-che?k-code (glob)
23 Skipping contrib/automation/hgautomation/winrm.py it has no-che?k-code (glob)
23 Skipping contrib/automation/hgautomation/winrm.py it has no-che?k-code (glob)
24 Skipping contrib/packaging/hgpackaging/downloads.py it has no-che?k-code (glob)
24 Skipping contrib/packaging/hgpackaging/downloads.py it has no-che?k-code (glob)
25 Skipping contrib/packaging/hgpackaging/inno.py it has no-che?k-code (glob)
25 Skipping contrib/packaging/hgpackaging/inno.py it has no-che?k-code (glob)
26 Skipping contrib/packaging/hgpackaging/py2exe.py it has no-che?k-code (glob)
26 Skipping contrib/packaging/hgpackaging/py2exe.py it has no-che?k-code (glob)
27 Skipping contrib/packaging/hgpackaging/util.py it has no-che?k-code (glob)
27 Skipping contrib/packaging/hgpackaging/util.py it has no-che?k-code (glob)
28 Skipping contrib/packaging/hgpackaging/wix.py it has no-che?k-code (glob)
28 Skipping contrib/packaging/hgpackaging/wix.py it has no-che?k-code (glob)
29 Skipping contrib/packaging/inno/build.py it has no-che?k-code (glob)
29 Skipping contrib/packaging/inno/build.py it has no-che?k-code (glob)
30 Skipping contrib/packaging/wix/build.py it has no-che?k-code (glob)
30 Skipping contrib/packaging/wix/build.py it has no-che?k-code (glob)
31 Skipping i18n/polib.py it has no-che?k-code (glob)
31 Skipping i18n/polib.py it has no-che?k-code (glob)
32 Skipping mercurial/statprof.py it has no-che?k-code (glob)
32 Skipping mercurial/statprof.py it has no-che?k-code (glob)
33 Skipping tests/badserverext.py it has no-che?k-code (glob)
33 Skipping tests/badserverext.py it has no-che?k-code (glob)
34
34
35 @commands in debugcommands.py should be in alphabetical order.
35 @commands in debugcommands.py should be in alphabetical order.
36
36
37 >>> import re
37 >>> import re
38 >>> commands = []
38 >>> commands = []
39 >>> with open('mercurial/debugcommands.py', 'rb') as fh:
39 >>> with open('mercurial/debugcommands.py', 'rb') as fh:
40 ... for line in fh:
40 ... for line in fh:
41 ... m = re.match(br"^@command\('([a-z]+)", line)
41 ... m = re.match(br"^@command\('([a-z]+)", line)
42 ... if m:
42 ... if m:
43 ... commands.append(m.group(1))
43 ... commands.append(m.group(1))
44 >>> scommands = list(sorted(commands))
44 >>> scommands = list(sorted(commands))
45 >>> for i, command in enumerate(scommands):
45 >>> for i, command in enumerate(scommands):
46 ... if command != commands[i]:
46 ... if command != commands[i]:
47 ... print('commands in debugcommands.py not sorted; first differing '
47 ... print('commands in debugcommands.py not sorted; first differing '
48 ... 'command is %s; expected %s' % (commands[i], command))
48 ... 'command is %s; expected %s' % (commands[i], command))
49 ... break
49 ... break
50
50
51 Prevent adding new files in the root directory accidentally.
51 Prevent adding new files in the root directory accidentally.
52
52
53 $ testrepohg files 'glob:*'
53 $ testrepohg files 'glob:*'
54 .arcconfig
54 .arcconfig
55 .clang-format
55 .clang-format
56 .editorconfig
56 .editorconfig
57 .hgignore
57 .hgignore
58 .hgsigs
58 .hgsigs
59 .hgtags
59 .hgtags
60 .jshintrc
60 .jshintrc
61 CONTRIBUTING
61 CONTRIBUTING
62 CONTRIBUTORS
62 CONTRIBUTORS
63 COPYING
63 COPYING
64 Makefile
64 Makefile
65 README.rst
65 README.rst
66 hg
66 hg
67 hgeditor
67 hgeditor
68 hgweb.cgi
68 hgweb.cgi
69 pyproject.toml
69 setup.py
70 setup.py
70
71
71 Prevent adding modules which could be shadowed by ancient .so/.dylib.
72 Prevent adding modules which could be shadowed by ancient .so/.dylib.
72
73
73 $ testrepohg files \
74 $ testrepohg files \
74 > mercurial/base85.py \
75 > mercurial/base85.py \
75 > mercurial/bdiff.py \
76 > mercurial/bdiff.py \
76 > mercurial/diffhelpers.py \
77 > mercurial/diffhelpers.py \
77 > mercurial/mpatch.py \
78 > mercurial/mpatch.py \
78 > mercurial/osutil.py \
79 > mercurial/osutil.py \
79 > mercurial/parsers.py \
80 > mercurial/parsers.py \
80 > mercurial/zstd.py
81 > mercurial/zstd.py
81 [1]
82 [1]
82
83
83 Keep python3 tests sorted:
84 Keep python3 tests sorted:
84 $ sort < contrib/python3-whitelist > $TESTTMP/py3sorted
85 $ sort < contrib/python3-whitelist > $TESTTMP/py3sorted
85 $ cmp contrib/python3-whitelist $TESTTMP/py3sorted || echo 'Please sort passing tests!'
86 $ cmp contrib/python3-whitelist $TESTTMP/py3sorted || echo 'Please sort passing tests!'
General Comments 0
You need to be logged in to leave comments. Login now