Commit Graph

51881 Commits

Author SHA1 Message Date
Carolyn Busch
d78a41fcfd add past.builtins import basestring
Summary:
Adds from past.builtins import basestring if there is a basestring

libfuturize.fixes.fix_basestring

Reviewed By: quark-zju

Differential Revision: D19588358

fbshipit-source-id: ed2a48372bda3768183e09cd0758ad12471b0cf7
2020-01-28 14:43:19 -08:00
Adam Simpkins
22c3c06c9e py3: some additional string encoding and type issues
Summary:
Deal with a few more minor string/bytes issues in Python 3, and also drop a
reference to the `long` type, which no longer exists in Python 3.

Reviewed By: xavierd

Differential Revision: D19596744

fbshipit-source-id: d7dca9306934aa6bf8c17bada6f6c1a40130027f
2020-01-28 14:32:31 -08:00
Adam Simpkins
68aa9c142e py3: update shellquote() to operate on strings
Summary: Update this function to work on `str` data types in both Python 2 and 3.

Reviewed By: xavierd

Differential Revision: D19596742

fbshipit-source-id: 6140d2a7644dbf60c9a22c4e482757466648d5a1
2020-01-28 14:32:30 -08:00
Adam Simpkins
353c3ae62a py3: drop the use of re.LOCALE for some regexes
Summary:
Drop the use of `re.LOCALE`.  In Python 3.6+ this flag can only be used with
bytes patterns.  None of these regexes actually use the \w, \W, \b, or \B
patterns that would be affected by this setting.

Reviewed By: xavierd

Differential Revision: D19596747

fbshipit-source-id: e26ed5ac6d0378e1830c67ae7c018ccb56b7609a
2020-01-28 14:32:30 -08:00
Genevieve Helsel
e0fac9b23c import print_function to use print as function in python2
Summary: in python3, print becomes a function, import print_fuction to use in python 2.(ran fix_print_with_import)

Reviewed By: lisroach, quark-zju, sfilipco

Differential Revision: D19588356

fbshipit-source-id: b7cf519058ae3909ba7813618719bbd09800e73a
2020-01-28 13:57:59 -08:00
Jun Wu
ed3a2b2247 cpython-ext: add missed types dep
Summary: This is incorrectly removed due to a bad rebase / merge.

Reviewed By: DurhamG

Differential Revision: D19607801

fbshipit-source-id: a6ee7a3f184ff1882eb1f1513f7fed74a7108727
2020-01-28 13:50:14 -08:00
Jun Wu
a6d94a7680 py3: i18n: prefer unicode on Python3
Summary:
See D17098991 for our encoding strategy.

This diff changes the i18n module to prefer unicode on Python 3.

Reviewed By: xavierd

Differential Revision: D19594826

fbshipit-source-id: 011110f3cad7aa89b729f5a86b66168fcd5a7e36
2020-01-28 13:42:22 -08:00
Jun Wu
8703970cea py3: update Cargo.toml to make py3 buildable
Summary:
This makes `make hg3` work. It requires cleaning up the `build` directory when
switching between py2 and py3 build, which will be fixed later.

Reviewed By: DurhamG

Differential Revision: D19604824

fbshipit-source-id: 060ff313420126a5dba935c4451b45dc9af45f13
2020-01-28 13:39:38 -08:00
svcscm
7a63483ce5 Updating submodules
Summary:
GitHub commits:

607fadcaea
36d628a127
10c73b2cb9
afe3f64fcd
a397ea5b6c
91171d9475
655fef6a95

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: abc896ecdd9e1f82298e79c6b24d2be867efb92c
2020-01-28 13:24:54 -08:00
Chad Austin
5acb860689 fix windows build
Reviewed By: pkaush

Differential Revision: D19606106

fbshipit-source-id: 559c539a804e2d2c6ca095604b9dd0864da98423
2020-01-28 13:21:10 -08:00
Xavier Deguillard
fcafda075f pyworkingcopy: use PyPath instead of PyByte
Reviewed By: DurhamG

Differential Revision: D19601926

fbshipit-source-id: 847e1762062c2b12627dd07a50a6d77ada282bdd
2020-01-28 12:40:49 -08:00
Xavier Deguillard
d087e39a34 pypathmatcher: use PyPath instead of PyByte
Reviewed By: DurhamG

Differential Revision: D19592136

fbshipit-source-id: 5db6ca629cd920d52ffbf7f10963c44c8f7b203d
2020-01-28 12:40:48 -08:00
Adam Simpkins
d71b2a2982 py3: drop an unnecessary encode() in ui.traceback()
Summary:
As of D17098991, all the data output data we write should be Unicode, so this
explicit call to `encode()` if we are running Python 3 should no longer be
used.

Reviewed By: xavierd

Differential Revision: D19596741

fbshipit-source-id: b05d94dcb9859c6ceff4bfae130550101ad3f47d
2020-01-28 12:28:41 -08:00
Chad Austin
be8c236889 mark SYNCHRONIZED macros deprecated
Summary: Produce a -Wdeprecated-declarations warning in code that uses the old SYNCHRONIZED macros.

Reviewed By: yfeldblum

Differential Revision: D19567088

fbshipit-source-id: b0637c06cbd125d09e1b39eec1e82a71ddca2324
2020-01-28 12:28:41 -08:00
Adam Simpkins
5ae8afd122 py3: update ui.setconfig() to work in Python 3
Summary:
The `ui.setconfig()` code attempts to escape lists, and checks for them by
looking if the config value has an `__iter__` attribute.  However, in Python 3
both `str` and `bytes` types have an `__iter__` method, so the setconfig
code incorrectly treated them as a list.

This re-orders the code so that `str` types are explicitly handled before the
check for iterable types.

Reviewed By: xavierd

Differential Revision: D19596740

fbshipit-source-id: 3c52d3e8d5b68fd2d561651bd1858889cdbe0ccb
2020-01-28 12:25:40 -08:00
Adam Simpkins
f0e087e898 py3: update pyconfigparser bindings to return results as Str
Summary:
Update the pyconfigparser library so that it returns config values as
`unicode` in Python 3.

Most of the Python code already accesses config items with `str` keys,
but a few `.pyx` files were explicitly using bytes and needed to be updated to
use string keys.

Reviewed By: xavierd

Differential Revision: D19596746

fbshipit-source-id: fbeb363639b2256c57311bea996c4b371e068ae8
2020-01-28 12:25:39 -08:00
Adam Simpkins
563ff09e85 py3: update configparser to return errors as Str
Summary:
Update the configparser APIs to return errors as a list of `Str` rather than
`Bytes`.  The Python code already expects the errors as `str`, so this makes
the code do the right thing with Python 3.

Reviewed By: xavierd

Differential Revision: D19596745

fbshipit-source-id: 027c33d76b3a3b800de34366232285591841a900
2020-01-28 12:25:39 -08:00
Adam Simpkins
beff6fdea7 py3: add additional from() conversion methods for Str
Summary: Add methods to convert to a `Str` object from `String` and from `Vec[u8]`

Reviewed By: xavierd

Differential Revision: D19596743

fbshipit-source-id: 6499f7f1b8329f4d14ce8179a41ed46982a85c8e
2020-01-28 12:25:39 -08:00
Zeyi (Rice) Fan
8eca037626 make test-commit-interactive.t py3 compatible
Summary: This test tests Mercurial printing the correct encoding when the system is set to Japanese locale (CP932). The escape.py used in this test isn't Python 3 compatible due to byte-related operations. This diff makes it Python 3 compatible.

Reviewed By: quark-zju

Differential Revision: D19592535

fbshipit-source-id: 114dfcb004805045163be4a636ac703b4d24ea32
2020-01-28 11:24:25 -08:00
Zeyi (Rice) Fan
26859e4907 make test-check-execute.t py3 compatible
Summary: Apparently we tried to open an image file directly with `open()`. This does not work in Python 3 as it tries to read the file as string instead of bytes.

Reviewed By: farnz

Differential Revision: D19589327

fbshipit-source-id: 9c6388b704860f1f5dec199562741ac6e191d928
2020-01-28 11:24:24 -08:00
Zeyi (Rice) Fan
9015eda650 make test-help.t py3 compatible
Reviewed By: quark-zju

Differential Revision: D19589104

fbshipit-source-id: 0db455b2939643c6aa2d7b1ba68ad4bae376bbf4
2020-01-28 11:24:24 -08:00
Zeyi (Rice) Fan
76e325e30d make f py3 compatible
Reviewed By: sfilipco

Differential Revision: D19588237

fbshipit-source-id: 12130d67e59d8d488afb244c89673bd6c0075181
2020-01-28 11:24:24 -08:00
Zeyi (Rice) Fan
c0772d015f make printenv.py py3 compatible
Reviewed By: sfilipco

Differential Revision: D19588063

fbshipit-source-id: 78f2b433bb6a065e63241912b4cc0cf78bcbdd13
2020-01-28 11:24:23 -08:00
Zeyi (Rice) Fan
a334e11c88 make test-clone.t py3 compatible
Reviewed By: sfilipco, singhsrb

Differential Revision: D19587714

fbshipit-source-id: 574e6b7236b0954b621a8e15a36f2f1e50243418
2020-01-28 11:24:23 -08:00
Zeyi (Rice) Fan
f2690f21eb make dummyssh py3 compatible
Summary: This makes the `dummyssh` script Python 3 compatible so we can run it with Python 3 in tests

Reviewed By: sfilipco

Differential Revision: D19587078

fbshipit-source-id: 134b01f4d5e968cd9600c9358c7230a56e11f163
2020-01-28 11:24:23 -08:00
Mark Thomas
4fe02f3607 bindings: update to rust-cpython 0.4
Summary: Update to the new version of rust-cpython.  This supports `list.append`, so make use of it.

Reviewed By: xavierd

Differential Revision: D19590905

fbshipit-source-id: 03609d4f698ae8e4380e82b8144caaa205b4c2d4
2020-01-28 10:46:33 -08:00
Mateusz Kwapich
455fdf8461 py3/cext: be PY_SSIZE_T_CLEAN
Summary:
This is optional for Python 3.6. But Python 3.8 shows a warning at runtime
without the fix.

Reviewed By: quark-zju

Differential Revision: D19581191

fbshipit-source-id: a47453f2fab92faeb6597900b9c38d1239d5ed79
2020-01-28 10:46:33 -08:00
Genevieve Helsel
f0a27646b5 change maxint -> maxsize
Summary: ran print_function, maxint -> maxsize (maxint depreciated)

Reviewed By: lisroach, quark-zju

Differential Revision: D19588359

fbshipit-source-id: fc66b388a1775553a4b8e30a56fd1483800693d6
2020-01-28 10:37:53 -08:00
Genevieve Helsel
514f13056d bool/nonzero aliasing
Summary: most instances of this `__non_zero__` ->` __bool__` were already aliased upstream, just updates some cases in which it was not.

Reviewed By: lisroach, quark-zju, sfilipco

Differential Revision: D19591210

fbshipit-source-id: 624fcfbb35b463f2660a47ca50d28d3dcd9e2cb0
2020-01-28 10:37:53 -08:00
Jun Wu
4561bd91ed py3/cext: pathencode: use unicode paths
Reviewed By: quark-zju

Differential Revision: D19581186

fbshipit-source-id: c0ff8405b73e6348852dc532058b604f04d19eec
2020-01-28 10:35:29 -08:00
Jun Wu
86a147145a py3/cext: osutil: use unicode for paths
Reviewed By: quark-zju

Differential Revision: D19581187

fbshipit-source-id: 00b05c06bc689aa62fed6ad639cf3b59be43d6ff
2020-01-28 10:35:29 -08:00
Jun Wu
d2557dcef3 py3/cext: lazymanifest: use unicode for paths and flags
Summary: Use UTF8 paths and flags. Node, and the manifest text remain bytes.

Reviewed By: xavierd

Differential Revision: D19581190

fbshipit-source-id: f6f3c561bc5d3663f20513654bea65066a669d34
2020-01-28 10:35:29 -08:00
Jun Wu
f3d0077921 py3/cext: revlog: use bytes
Summary:
`Py_BuildValue("s#")` returns str.  Revlog uses it for nodes, which must be
bytes.  Change "s#" to "y#" for bytes.

Reviewed By: xavierd

Differential Revision: D19581197

fbshipit-source-id: b925ea8f26abff49ec4feafe579f00f68cee330e
2020-01-28 10:35:28 -08:00
Jun Wu
2e7d124fd2 py3: setup3.py and make hg3
Summary:
Make `make hg3` run the python3 version of the build.  There are some
Cargo.toml thing to fix. But this is a start.

Reviewed By: xavierd

Differential Revision: D19581181

fbshipit-source-id: 711a02ec0c8384f2ca3e61ead66db1e89a30837c
2020-01-28 10:29:15 -08:00
Jun Wu
917605b7d8 py3: remove b prefix
Summary:
Remove "b" prefix so strings become unicode.

The drawdag module was not affected by the upstream source code transformer [1]
so they added the b prefix. But drawdag is high-level enough that bytes
shouldn't be used.

[1]: https://www.mercurial-scm.org/repo/hg/rev/1c22400db72d

Reviewed By: simpkins

Differential Revision: D19581175

fbshipit-source-id: 7ae5f37af1d5145d8bac4ea82ac5ad856d83ae19
2020-01-28 10:29:15 -08:00
Jun Wu
35250bd8fd py3: miscellaneous fixes
Summary: Some miscellaneous fixes, ex. `map(x)` -> `list(map(x))`.

Reviewed By: farnz

Differential Revision: D19581171

fbshipit-source-id: afbb3b8b798f7878fc3206586497ea771116066b
2020-01-28 10:29:14 -08:00
Jun Wu
811a922e2b py3: urllibcompat: prefer unicode on Python3
Summary:
See D17098991 for our encoding strategy.

This diff changes the urllibcompat module to prefer unicode on Python 3.

Reviewed By: farnz

Differential Revision: D19595738

fbshipit-source-id: 53ce76f8703fa0f4885f3042049d9c5fae4bc47c
2020-01-28 10:29:14 -08:00
Jun Wu
6a37eb5a22 py3: pycompat: prefer unicode on Python3
Summary:
See D17098991 for our encoding strategy.

This diff changes the pycompat module to prefer unicode on Python 3.

Reviewed By: farnz

Differential Revision: D19594828

fbshipit-source-id: 3e6db24a2ebaed69deb68908f19e9b462f62c350
2020-01-28 10:29:13 -08:00
Jun Wu
9db1ad4cf7 py3: encoding: prefer unicode on Python3
Summary:
See D17098991 for our encoding strategy. tl;dr, paths, argv, messages, terminal
(not pipes or files) stdout are utf-8. Non utf-8 paths are unsupported (as they
will have issues on Windows anyway).

This diff changes the encoding module to prefer unicode on Python 3.

Reviewed By: simpkins

Differential Revision: D19594827

fbshipit-source-id: c5c1319d840709bc752b96bed6ca80d10f49669e
2020-01-28 10:29:13 -08:00
Jun Wu
b9133c32f9 py3: node: prepare python3 unicode APIs
Summary:
In Python 3 we'd like hex to return unicode strings. Provide APIs for them.
The old bytes version remain as `bbin` and `bhex`.

Reviewed By: markbt

Differential Revision: D19592521

fbshipit-source-id: 1a06ac82e3061c631c0da5d5124610656bdecaee
2020-01-28 10:29:13 -08:00
Jun Wu
e70c21af9c py3: use pure util.dirs on Python 3
Summary:
The native implementation of "dirs" uses too much PyBytes internals that it's
not easy to migrate to unicode. For now let's disable the native path to
unblock Python 3 process.

Looking at the usage of dirs, it is unclear whether it is still a critical path
for performance, as scaning through all files in manifest even with the C dirs
is still too slow and we probably want time complexity fixes (ex. make it
lazy).

Reviewed By: markbt

Differential Revision: D19581192

fbshipit-source-id: 59bb2a187f675df01b4385bf4bce255f173a0aa3
2020-01-28 10:29:12 -08:00
Jun Wu
234cbf213a py3: disable statprof on Python 3
Summary:
It is optional and has many encoding issues. So let's disable it for now to
unblock progress.

Reviewed By: markbt

Differential Revision: D19581182

fbshipit-source-id: 820da07dfe214a3abcd7cbf819b73dbe493c3bcc
2020-01-28 10:29:12 -08:00
Jun Wu
b93ad9436d py3: use native selectors on Python 3
Summary:
This removes a warning:

	scm3/edenscm/mercurial/thirdparty/selectors2.py:39: DeprecationWarning: Using
	or importing the ABCs from 'collections' instead of from 'collections.abc' is
	deprecated since Python 3.3, and in 3.9 it will stop working

Reviewed By: markbt

Differential Revision: D19581179

fbshipit-source-id: d311b4df4cdb35527c8ab9d4a41ae306ddb2ab03
2020-01-28 10:29:12 -08:00
Stefan Filip
5720b9a2a1 py3/pymanifest: convert path types from PyBytes to PyPath
Reviewed By: xavierd

Differential Revision: D19594134

fbshipit-source-id: e8532a125aa2ed4b7740e669ad572fcbb327692f
2020-01-28 10:29:11 -08:00
Durham Goode
23562ea499 amend: backout transaction change
Summary:
D18213028 made amend and metaedit use a transaction around the
dirstate. This appears to have broken some auto-restack flows (T61073763). Let's
back it out for now then I'll debug later.

Reviewed By: quark-zju

Differential Revision: D19581912

fbshipit-source-id: cce32efdc91be9ca301da26a0e26b50aa6aa92d4
2020-01-28 10:22:25 -08:00
Xavier Deguillard
283b120bb6 pyconfigparser: use PyPath instead of PyByte
Summary:
Also, add a util::path::strip_unc function that is more clear than the
normalize_for_display

Reviewed By: DurhamG

Differential Revision: D19595961

fbshipit-source-id: 330bcb708bf64320a3562d79db685d6cb1e14f16
2020-01-28 10:14:14 -08:00
Xavier Deguillard
f3b73fe8bf pymetalog: remove unecessary encoding deps
Summary: The crate doesn't depend on it, let's remove the dependency

Reviewed By: quark-zju

Differential Revision: D19593138

fbshipit-source-id: ad1e9fc68f8d126b6402efd5b1be4633fc7e5887
2020-01-28 10:01:52 -08:00
Xavier Deguillard
b45d97f7df pybookmarkstore: use PyPath instead of PyByte
Reviewed By: DurhamG

Differential Revision: D19593033

fbshipit-source-id: 5e2d5b9e72c336e6290c8359071d086a15bd05f6
2020-01-28 10:01:52 -08:00
Xavier Deguillard
1ae9196972 pyblackbox: use PyPath instead of PyByte
Reviewed By: DurhamG

Differential Revision: D19592901

fbshipit-source-id: ff875ec30bee5ac160ac701091835adbf3013b90
2020-01-28 10:01:52 -08:00
Xavier Deguillard
2d2d63544d pymutationstore: use PyPath instead of PyByte
Reviewed By: DurhamG

Differential Revision: D19592467

fbshipit-source-id: 2d7df3457a9dd02e839cffb642401575712f0f2c
2020-01-28 10:01:51 -08:00