Page MenuHomePhabricator

style: run a patched black on a subset of mercurial
Needs ReviewPublic

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

Details

Reviewers
None
Group Reviewers
hg-reviewers
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.)

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

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
31–32

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.