Patchwork D10185: black: merge config into main pyproject.toml now that we have it

login
register
mail settings
Submitter phabricator
Date March 12, 2021, 6:20 p.m.
Message ID <differential-rev-PHID-DREV-t2md4cb3zkskjlx7erna-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48500/
State Superseded
Headers show

Comments

phabricator - March 12, 2021, 6:20 p.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This means that naive contributors who just run `black` on a source file
  will get reasonable behavior as long as they have a recent black. Yay!
  
  This was previously D9834 <https://phab.mercurial-scm.org/D9834> but was rolled back due to test
  failures. nbjoerg thinks it's time to try again, so let's give it a
  shot.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10185

AFFECTED FILES
  black.toml
  contrib/examples/fix.hgrc
  pyproject.toml
  tests/test-check-code.t
  tests/test-check-format.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-check-format.t b/tests/test-check-format.t
--- a/tests/test-check-format.t
+++ b/tests/test-check-format.t
@@ -1,5 +1,5 @@ 
 #require black test-repo
 
   $ cd $RUNTESTDIR/..
-  $ black --config=black.toml --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'`
+  $ black --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'`
 
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -66,7 +66,6 @@ 
   COPYING
   Makefile
   README.rst
-  black.toml
   hg
   hgeditor
   hgweb.cgi
diff --git a/pyproject.toml b/pyproject.toml
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,18 @@ 
 [build-system]
 requires = ["setuptools", "wheel"]
 build-backend = "setuptools.build_meta"
+
+[tool.black]
+line-length = 80
+exclude = '''
+build/
+| wheelhouse/
+| dist/
+| packages/
+| \.hg/
+| \.mypy_cache/
+| \.venv/
+| mercurial/thirdparty/
+'''
+skip-string-normalization = true
+quiet = true
diff --git a/contrib/examples/fix.hgrc b/contrib/examples/fix.hgrc
--- a/contrib/examples/fix.hgrc
+++ b/contrib/examples/fix.hgrc
@@ -5,7 +5,7 @@ 
 rustfmt:command = rustfmt +nightly
 rustfmt:pattern = set:"**.rs" - "mercurial/thirdparty/**"
 
-black:command = black --config=black.toml -
+black:command = black
 black:pattern = set:**.py - mercurial/thirdparty/**
 
 # Mercurial doesn't have any Go code, but if we did this is how we
diff --git a/black.toml b/black.toml
deleted file mode 100644
--- a/black.toml
+++ /dev/null
@@ -1,14 +0,0 @@ 
-[tool.black]
-line-length = 80
-exclude = '''
-build/
-| wheelhouse/
-| dist/
-| packages/
-| \.hg/
-| \.mypy_cache/
-| \.venv/
-| mercurial/thirdparty/
-'''
-skip-string-normalization = true
-quiet = true