This is an archive of the discontinued Mercurial Phabricator instance.

style: run a patched black on a subset of mercurial
ClosedPublic

Authored by durin42 on May 4 2019, 11:19 PM.

Details

Summary

This applied black to the 20 smallest files in mercurial/:

ls -S1 mercurial/*.py | tail -n20 | xargs black --skip-string-normalization

Note that a few files failed to format, presumably due to a bug in my
patch. The intent is to be able to compare results to D5064 with
https://github.com/python/black/pull/826 applied to black.

I skipped string normalization on this patch for clarity - in reality
I think we'd want one pass without string normalization, followed by
another to normalize strings (which is basically replacing ' with "
globally.)

  1. skip-blame mass-reformatting only

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.May 4 2019, 11:19 PM

I would be happy to have our code auto-formatted. I assume this patch is just to show what the result will be and it's not meant to be queued until that patch for black has been accepted.

mercurial/policy.py
34–38

As I said on the pull request for black, I don't like that these lines get split up.

Yes, the intent is to show what the result of the patch to black is,
and once that lands to try and get consensus that we've addressed the
major issue with black and can move on. I've tried adding b prefixes
everywhere without black, or by using a different formatter, and the
other formatters just aren't good enough at wrapping lines, so not
using black will probably imply some kind of pain. :(

durin42 updated this revision to Diff 15039.May 8 2019, 3:31 PM
durin42 edited the summary of this revision. (Show Details)May 8 2019, 3:34 PM
durin42 updated this revision to Diff 15040.
durin42 updated this revision to Diff 16812.Oct 5 2019, 9:44 AM
indygreg accepted this revision.Oct 5 2019, 10:25 AM
This revision is now accepted and ready to land.Oct 5 2019, 10:25 AM
indygreg requested changes to this revision.Oct 5 2019, 10:27 AM

Please add # skip-blame to the commit message. And split the addition of pyproject.toml into its own commit so we have annotate info.

This revision now requires changes to proceed.Oct 5 2019, 10:27 AM
durin42 edited the summary of this revision. (Show Details)
durin42 updated this revision to Diff 16829.
indygreg accepted this revision.Oct 5 2019, 1:20 PM

I'm going to split this on land so pyproject.toml appears in its own changeset.

This revision is now accepted and ready to land.Oct 5 2019, 1:20 PM
durin42 updated this revision to Diff 16881.Oct 6 2019, 10:56 AM
This revision was automatically updated to reflect the committed changes.