Yuya Nishihara <yuya@tcha.org> [Sat, 05 Oct 2019 15:47:38 -0400] rev 43098
templater: add public parseexpr() function to parse "-Tjson(...)"
Extracted _addparseerrorhint() to show nicer hint on error.
Denis Laxalde <denis@laxalde.org> [Sun, 06 Oct 2019 13:06:19 +0200] rev 43097
import: read X-Mercurial-Node email header to determine nodeid
This would be useful to import and obsolete patches sent using 'hg email
--plain', using evolve's --obsolete option of 'hg import'.
If email body contains Mercurial patch header ('# HG changeset patch'
block), nodeid parsed from X-Mercurial-Node header will still be
overridden by respective value found in body.
Yuya Nishihara <yuya@tcha.org> [Wed, 02 Oct 2019 07:35:22 +0900] rev 43096
patchbomb: use procutil.shellquote() instead of shlex to escape email address
This basically backs out
2cc453284d5c, and inserts procutil.shellquote()
instead. I don't care about Windows compatibility here, but shlex.quote()
can't handle byte strings on Python 3.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Oct 2019 11:52:58 -0400] rev 43095
formatting: introduce a `test-check-format-black.t` that enforce formatting
This should prevent use to drift away from the expect format.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Oct 2019 10:58:51 -0400] rev 43094
formatting: run black on all file again
Apparently, since the blackgnarok, we divergence from the expected formatting.
Formatted using::
grey.py -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/** - contrib/grey.py')
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Oct 2019 11:51:34 -0400] rev 43093
formatting: make black --quiet in the example `hg fix` config
I do like cake, but I cannot have so many of them.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 07 Oct 2019 11:48:34 -0400] rev 43092
formatting: remove the data-ogre from the config example
Without he final `-`, black ignore the stdin and just looks at file provided as
command line argument.
Since `hg fix` feeds the file content through stdin and does not pass file
argument, this meant black happily exited successful (all files passed as
argument were formatted) without any output. Fix picked this "no output" as the
new file content, deleting all previous content.
I appreciate the fact this effectively removed all buggy code in any files
processing that way, but this also ate all my data.
The example config is now fixed in that regards.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 17:27:51 -0400] rev 43091
py3: stop normalizing .encode()/.decode() arguments to unicode
Now that we don't byte transform string literals, we no longer need
this transform.
While we're here, we also drop some superfluous u'' prefix in existing
callers.
Differential Revision: https://phab.mercurial-scm.org/D7011
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 16:58:55 -0400] rev 43090
py3: manually import pycompat.delattr where it is needed
And with this change, we no longer need the auto-inserted import statement
in the source transformer, so it has been removed!
Differential Revision: https://phab.mercurial-scm.org/D7010
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 16:55:18 -0400] rev 43089
py3: manually import getattr where it is needed
The march continues.
Differential Revision: https://phab.mercurial-scm.org/D7009
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 16:39:13 -0400] rev 43088
py3: stop injecting pycompat.hasattr into modules
I only found a single user of this pattern, probably because we
use util.hasattr everywhere.
Differential Revision: https://phab.mercurial-scm.org/D7008
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 14:58:42 -0400] rev 43087
py3: manually import pycompat.setattr where it is needed
Continuing to eliminate the implicit import of symbols in the
Python 3 source transformer so we can eliminate it.
Differential Revision: https://phab.mercurial-scm.org/D7007
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 14:51:45 -0400] rev 43086
py3: stop implicitly importing unicode
We should be pycompat.unicode everywhere. It turns out we were doing this
everywhere except for one place in templatefilters!
Differential Revision: https://phab.mercurial-scm.org/D7006
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 13:28:56 -0400] rev 43085
py3: manually import pycompat.open into files that need it
We want to eliminate the source transformer. Currently it inserts
a `from mercurial.pycompat import ...` at the top of files to alias
some builtins.
This commit replaces the implicit import of `open` with an explicit
import on files that need it and changes the source transformer to
no longer import `open`.
As part of this, we needed to store an explicit local for `open` in
the Python 2 code path in `pycompat` so the import works. (Builtins
that are automatically in scope cannot be imported.)
Differential Revision: https://phab.mercurial-scm.org/D7005
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 06 Oct 2019 13:17:19 -0400] rev 43084
import-checker: allow symbol imports from mercurial.pycompat
Currently, the source transformer inserts
`from mercurial.pycompat import delattr, getattr, hasattr, setattr, open, unicode`
to the top of every file. As part of getting rid of the source transformer,
we'll need to have source code call these wrappers directly. Rather than
rewrite all call sites to call pycompat.*, I think it makes sense to import
needed symbols via explicit imports. That requires loosening the import checker
to allow this.
Differential Revision: https://phab.mercurial-scm.org/D7004
Augie Fackler <augie@google.com> [Sun, 06 Oct 2019 14:13:03 -0700] rev 43083
contrib: add a fork of black (as "grey") that includes my changes
This is black with https://github.com/psf/black/pull/826 applied as of
today. The current git hash of black master is
d9e71a75ccfefa3d9156a64c03313a0d4ad981e5, and the hash of my commit is
dc1add6e94e212eff37bb3619e1422fb3c6d8dc8. In order to use this, you
need to install `black` (from github master) and `typed-ast` using
pip, preferably into python3, and then you can run `grey.py` with that
Python and you'll have my patched version of black, which is how we've
been formatting the codebase.
Once my PR is merged, I'll follow up by removing this fork and
updating instructions in the example config.
# no-check-commit bad style
Differential Revision: https://phab.mercurial-scm.org/D7002