- Oct 06, 2019
-
-
Gregory Szorc authored
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 authored
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 authored
The march continues. Differential Revision: https://phab.mercurial-scm.org/D7009
-
Gregory Szorc authored
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 authored
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 authored
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 authored
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 authored
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 authored
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
-
- Oct 05, 2019
-
-
Yuya Nishihara authored
Since we plan to upstream this feature, it's better to continue further refactoring under the same license as rust-cpython crate. According to the file history, copyright holders are: - Raphaël Gomès <rgomes@octobus.net> - Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> - Yuya Nishihara <yuya@tcha.org>
-
- Oct 06, 2019
-
-
Augie Fackler authored
Differential Revision: https://phab.mercurial-scm.org/D6997
-
Augie Fackler authored
These used to be marked with no-op parens, but black removes those now and this is more explicit. # skip-blame: fallout from mass reformatting Differential Revision: https://phab.mercurial-scm.org/D6996
-
Gregory Szorc authored
We currently use `write(('...'))` to suppress check-code warnings about not using translated strings. However, when we run black, it will strip the `((...))`. In order to placate black, we'll need to use a different mechanism to pass untranslatable strings. This commit introduces a `writenoi18n` alias (and friends) to `write` for that purpose. Differential Revision: https://phab.mercurial-scm.org/D6994
-
- May 04, 2019
-
-
Augie Fackler authored
We've rewritten everything, so we no longer require this step. Differential Revision: https://phab.mercurial-scm.org/D6973
-
- Oct 06, 2019
-
-
Augie Fackler authored
Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
-
Augie Fackler authored
This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
-
- Oct 05, 2019
-
-
Augie Fackler authored
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.) # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6342
-
- Oct 04, 2019
-
-
Gregory Szorc authored
It appears that the random.randint() behavior is different between Python 2 and Python 3. So make the test conditional on that. This makes the test pass on Python 3.7 (and presumably other Python 3 versions). Differential Revision: https://phab.mercurial-scm.org/D6964
-
- Oct 05, 2019
-
-
Gregory Szorc authored
This was added in 73e4a02e6d23 and 89822d7a9d5f as a preliminary way to better support Python 3. With the Python 3 port nearly done and better procedures in place, we shouldn't need it. Differential Revision: https://phab.mercurial-scm.org/D6991
-
- Oct 04, 2019
-
-
Gregory Szorc authored
This avoids a `TypeError: Can't mix strings and bytes in path components`. Differential Revision: https://phab.mercurial-scm.org/D6965
-
- Oct 05, 2019
-
-
Gregory Szorc authored
Python 3.8 changed the default tar file archive format: https://docs.python.org/3.8/whatsnew/3.8.html#tarfile. This commit teaches our tests about the new behavior. Differential Revision: https://phab.mercurial-scm.org/D6986
-
Gregory Szorc authored
It looks like Python 3.8 changed the pretty XML formatting slightly to strip some whitespace. Let's teach our tests about that. Differential Revision: https://phab.mercurial-scm.org/D6988
-
Gregory Szorc authored
reload() was nuked in Python 3. We need to use importlib.reload() instead. But pyflakes isn't smart enough to detect our conditional usage, so we allow this error. Differential Revision: https://phab.mercurial-scm.org/D6992
-
Gregory Szorc authored
The use of xrange in this file is acceptable. We need to make the output optional - and not conditional on the Python version - because `pyflakes` could be executed by any Python version and pyflakes behaves differently depending on the Python version. Differential Revision: https://phab.mercurial-scm.org/D6990
-
- Oct 06, 2019
-
-
Pierre-Yves David authored
We need to be gently with python3 for it to display this binary data. Differential Revision: https://phab.mercurial-scm.org/D6995
-
Denis Laxalde authored
-
Augie Fackler authored
It's commented out for now since my patch hasn't landed, but we can uncomment it when that lands. Differential Revision: https://phab.mercurial-scm.org/D6974
-
Augie Fackler authored
Differential Revision: https://phab.mercurial-scm.org/D6993
-
- Oct 05, 2019
-
-
Augie Fackler authored
This was conflicting with black, so dump it. Differential Revision: https://phab.mercurial-scm.org/D6979
-
Augie Fackler authored
Differential Revision: https://phab.mercurial-scm.org/D6978
-
Augie Fackler authored
black manages this for us, so we don't need to worry about this anymore. Differential Revision: https://phab.mercurial-scm.org/D6977
-
Augie Fackler authored
Both Python and C code are managed by formatters now, so relax this. Differential Revision: https://phab.mercurial-scm.org/D6976
-
- Sep 30, 2019
-
-
Pierre-Yves David authored
We are about to add more cases, in that context, it is simpler to avoid double negative. En addition, We document the situation for the next soul. Differential Revision: https://phab.mercurial-scm.org/D6938
-
- Oct 05, 2019
-
-
Danny Hooper authored
This allows distributing opt-in fixer tool configurations in .hgrc files. This may be useful for adding default configs in core, or for orgranizations that want to provide configs to their users. Tools are still enabled by default because it would be confusing to add a config and find that it has no effect until you add enabled=true. Differential Revision: https://phab.mercurial-scm.org/D6975
-
Gregory Szorc authored
The CI code for running the Try Server requires more thorough review. Let's add just the client-side bits for submitting to Try so others can start using it. Differential Revision: https://phab.mercurial-scm.org/D6983
-
Gregory Szorc authored
Differential Revision: https://phab.mercurial-scm.org/D6982
-
Gregory Szorc authored
This is where the AWS account I'm running lives. Differential Revision: https://phab.mercurial-scm.org/D6981
-
Gregory Szorc authored
Ran `pip-compile -U` to upgrade to latest versions. Differential Revision: https://phab.mercurial-scm.org/D6980
-
Augie Fackler authored
For some reason this wasn't flagged until I ran a reformatter on this file. I'm deeply confused by this, but since we don't execute this drop the support for it. Differential Revision: https://phab.mercurial-scm.org/D6985
-
Augie Fackler authored
For some reason this only showed up in check-code after running black. Puzzling. Differential Revision: https://phab.mercurial-scm.org/D6984
-