Commit Graph

52083 Commits

Author SHA1 Message Date
Durham Goode
419858ad5c py3: fix journal writing
Summary:
Writing to the file should happen in bytes, so let's make the
journalentry serializer/deserializer convert from strings to bytes for us.

Reviewed By: xavierd

Differential Revision: D19650468

fbshipit-source-id: 3c13aff032ace1a15611c2370fc7d6ed44a6df34
2020-01-30 15:22:25 -08:00
Durham Goode
c1672ad848 py3: fix treemanifest fetching
Summary:
bundle2 parameter values are bytes, so when we compare the treemanifest
category with the bundle2 part category we need to encode the bundle2 part one.

Also fix wirepack to read utf8 paths.

Reviewed By: xavierd

Differential Revision: D19650197

fbshipit-source-id: 67da3bd8244f7953ec608019844988b20ad1929f
2020-01-30 15:22:25 -08:00
Durham Goode
b567c16b60 py3: make mutation markers 'user' utf8
Summary: Username as utf8, so let's make mutationmarker treat them as such.

Reviewed By: xavierd

Differential Revision: D19649887

fbshipit-source-id: 3f8b2db434a57ee8ee3017de8d925c19a2002b20
2020-01-30 15:22:24 -08:00
Xavier Deguillard
c1652cad03 drawdag: the commit data should be bytes
Summary:
The commit context requires commit data to be bytes, but drawdag was using str
for it, breaking tests.

Reviewed By: DurhamG

Differential Revision: D19650219

fbshipit-source-id: 1409ce9a277c1c410ede8109989e07595378ff3e
2020-01-30 14:55:55 -08:00
Xavier Deguillard
cb64df7197 tests: @command expects str command names
Summary: This change all the tests to use strings as the command names.

Reviewed By: simpkins

Differential Revision: D19649479

fbshipit-source-id: 4b2cb9b3af73a7508ef359ee3c407d04a39c7893
2020-01-30 14:55:55 -08:00
Xavier Deguillard
96f5dc6652 localrepo: wwread returns bytes
Summary:
This is directly used in fctx.data() which expects bytes to be returned, encode
the return value of vfs.symlink.

Reviewed By: quark-zju

Differential Revision: D19647846

fbshipit-source-id: 966a5e79db6843c4bc6b802aeb90364e983cd834
2020-01-30 14:55:55 -08:00
Xavier Deguillard
b863a561a4 pytreestate: use PyPath where necessary
Summary:
A previous diff missed these PyPath. As a bonus, replace most of the PyObject
into proper Rust types.

Reviewed By: quark-zju

Differential Revision: D19646139

fbshipit-source-id: a3b55e5a802d8bbef86e9a9431f605bb4e284b32
2020-01-30 14:55:54 -08:00
Durham Goode
ca48fc2665 py3: fix resolving unknown binary nodes in changectx
Summary:
changectx takes an arbitrary identifier and tries to resolve it. If it
takes a binary node and the node is not known, the fallback looksup don't accept
bytes and throw an exception. Let's stop early and raise the RepoLookupError.

Reviewed By: quark-zju

Differential Revision: D19643834

fbshipit-source-id: cfee39e0487f908ebd4ff628b847e53dec13c66e
2020-01-30 14:39:41 -08:00
Durham Goode
cfdf7814f4 py3: fix pipe reads in sshpeer
Summary:
In Python 3, subprocess creates FileIO type pipes, which do one syscall
and are not guaranteed to return 'size' bytes. In Python 2 they're 'file' types
which are guaranteed to return 'size' bytes (via multiple syscalls).

So let's handle that case.

Reviewed By: quark-zju, xavierd

Differential Revision: D19648035

fbshipit-source-id: 7d04a67acc569a55d3a855fc8521f1b8261f4636
2020-01-30 13:55:21 -08:00
Durham Goode
22b2f5becc py3: fix encoding of remotenames at write time
Summary:
remotenames are stored as unicode in memory and bytes on disk. We need
to convert before we write in this case.

Reviewed By: quark-zju

Differential Revision: D19648032

fbshipit-source-id: 4b96cf05eefd66ca031436d9979b94da8e28b8dd
2020-01-30 13:55:20 -08:00
Durham Goode
5311ab2fbb py3: fix encoding of pushkeys
Summary: Let's decode pushkeys into utf8.

Reviewed By: quark-zju

Differential Revision: D19648033

fbshipit-source-id: 9deeeecd53e065df9b344f8edd0183dc7c1511c5
2020-01-30 13:55:20 -08:00
svcscm
ef089fa255 Updating submodules
Summary:
GitHub commits:

199e5f16a2
3f2622e669

Reviewed By: wittgenst

fbshipit-source-id: 17f5024fa3b463538644bb56626bcdbd489a408c
2020-01-30 13:05:40 -08:00
Stefan Filip
843f8a7f50 py3/cython: set the language_level to 3str
Summary:
Follow up to the previous diff setting language_level to 3str for
`edenscmnative/clindex.pyx`. Consistent behavior for all files.

Reviewed By: quark-zju

Differential Revision: D19634907

fbshipit-source-id: 779d6090b5660e109a37f9740299fb9623d8f34d
2020-01-30 12:52:06 -08:00
Mark Thomas
13b7a759a2 cpython-ext: add PyNone, a marker struct for functions that can only return None
Summary: Add `PyNone`.  This is a marker struct that indicates that a python function can only return `PyNone`.

Reviewed By: xavierd

Differential Revision: D19644338

fbshipit-source-id: f846b146237ebf7de996177494934fec662cde0f
2020-01-30 12:28:38 -08:00
svcscm
2a1d781f1f Updating submodules
Summary:
GitHub commits:

b1cb5e37f0
0b9ddbb4dc
90c71aa5d9
71db4e4023
2056a44d0d

Reviewed By: wittgenst

fbshipit-source-id: 77120ea8a69d2254b178bb0e86852f05950859aa
2020-01-30 12:10:06 -08:00
Adam Simpkins
4bd038dd5c fix eden doctor's check for commit validity to handle corrupt checkouts
Summary:
When checking if a commit is valid explicitly check against the backing
repository rather than the Eden checkout.  This makes the commit work
correctly if the Eden checkout's `.hg` directory has been corrupted but the
backing repository is still fine.

Reviewed By: genevievehelsel

Differential Revision: D19629959

fbshipit-source-id: 57992260332cbc1d6868813263fb3768b50db07e
2020-01-30 11:15:37 -08:00
Carolyn Busch
6b24e9a69e py3: commandserver write and read bytes
Summary: Make the command server write and read bytes. Add type annotations.

Reviewed By: quark-zju

Differential Revision: D19642862

fbshipit-source-id: 2dfcd8f0c2e6124cc6afe1e85c0f5275e7fe5b1f
2020-01-30 11:12:10 -08:00
Mark Thomas
6b8042662a cpython_ext: rename PyPath to PyPathBuf
Summary:
`PyPath` is the type that owns the data.  Rename it to `PyPathBuf` for analogy
with `PathBuf` and `RepoPathBuf`, and to allow us to introduce a reference type
named `PyPath`.

Reviewed By: xavierd

Differential Revision: D19643797

fbshipit-source-id: 56d80fea5677f7223e967b0723039d1763b26f68
2020-01-30 11:06:24 -08:00
Durham Goode
f170b964be py3: fix known wireproto command
Summary:
It was iterating over what it thought was a string, but in python3 it's
a byte string, which results in iterating over integers. So known always claimed
the server knew every commit.

Reviewed By: quark-zju

Differential Revision: D19644837

fbshipit-source-id: 4e84a33b4d3e436006f93a5d8e1bdabf12e7d120
2020-01-30 10:59:01 -08:00
Xavier Deguillard
f83e1d76b0 pypathmatcher: use PyPath when calling into Python
Summary: The Python code expect paths to be unicode in Python3, not bytes.

Reviewed By: markbt

Differential Revision: D19643701

fbshipit-source-id: fa98da2daccccf70ac047a69b2e2359270f7e3d0
2020-01-30 10:55:34 -08:00
Stefan Filip
45fa522e1c py3/fsmonitor: use next(iter) instead of iter.next()
Summary: iter.next() is gone in Python 3. next(iter) is the Python2 compatible version.

Reviewed By: quark-zju

Differential Revision: D19630455

fbshipit-source-id: e5d4f0a6cc0c6b0489916ca6d177a6831bd7d277
2020-01-30 10:28:02 -08:00
Adam Simpkins
dbaac4f0e7 py3: fix some Python 3 compatibility issues in sshpeer
Summary:
Fix `threadedstderr` to stop directly deriving from `threading.Thread`.
Deriving directly from `threading.Thread` is somewhat tricky.  Classes that
derive from `Thread` are only allowed to implement `__init__()` and `run()`.
This class also defined `close()`, which violates the `Thread` docs.  Changing
this to no longer derive from `Thread` fixes exceptions being thrown when
trying to read from the SSH stderr pipe in this thread.

This also updates `_writessherror()` to decode the stderr data before writing
it to the `ui` object.

Reviewed By: quark-zju

Differential Revision: D19634265

fbshipit-source-id: bddd120c7995f49d3bbebbb171384d5b15b779e9
2020-01-30 10:22:30 -08:00
Durham Goode
3ed7b6e3f2 py3: fix journal to work with utf8
Summary: Various fixes to make it stop crashing

Reviewed By: quark-zju

Differential Revision: D19643879

fbshipit-source-id: 9dd0bcef5369b769a8c968ea86de0e8aaf640650
2020-01-30 09:58:26 -08:00
Durham Goode
9aa1e8d7a3 py3: fix sparse utf8 logging
Summary:
Sparse logs the profile to scuba, but our logging data must be utf8.
Let's encode it first. We probably want to make this "replace" instead of
"strict" for the conversion once D19634265  lands.

Reviewed By: quark-zju

Differential Revision: D19643832

fbshipit-source-id: 550c67f194171ccdbd244bc79edfa1b999467824
2020-01-30 09:58:26 -08:00
Durham Goode
e3992926b7 py3: utf8 fixes for pull and wireproto
Summary: Moves pull closer to working by appropriately encoding and decoding.

Reviewed By: quark-zju

Differential Revision: D19643833

fbshipit-source-id: d311fb897d15594f2cb644b15038866ce506e011
2020-01-30 09:58:26 -08:00
Durham Goode
484a088417 py3: support caching in python3
Summary:
Revlog did a type check against str. In python 3 it accepts bytes
instead, so we need to support that.

Reviewed By: xavierd

Differential Revision: D19634882

fbshipit-source-id: 04ae908b4bfe8ed5de7a6d41cbe748dcb34b2540
2020-01-30 09:12:30 -08:00
Durham Goode
8b942a7166 remotenames: fix broken changelog contains check
Summary:
cl.__contains__ does a "0 < rev <= len(repo)" check, so passing nodes
will always fail. In python 3 this causes a type error, so let's fix this.

Reviewed By: quark-zju

Differential Revision: D19634880

fbshipit-source-id: 011ab2f0c07a16fa45734d360ac952273c4fefc2
2020-01-30 09:12:30 -08:00
Genevieve Helsel
247f686447 izip_longest to zip_longest
Summary:
izip_longest depreciated in python3 in favor of zip_longest, use zip_longest from future

source: https://python-future.org/compatible_idioms.html#itertools-filterfalse-zip-longest

Reviewed By: xavierd

Differential Revision: D19632101

fbshipit-source-id: 2eb3c125d2beaf66045dad304b900fe7928f2066
2020-01-30 08:50:41 -08:00
Xavier Deguillard
a14897afc8 clindex: remove one b
Summary: In `hg sl`, this raises an exception.

Reviewed By: singhsrb

Differential Revision: D19635386

fbshipit-source-id: 28482941bd61b5526993d6d16b2886c7edbe763f
2020-01-30 08:31:23 -08:00
Jun Wu
097503d073 py3: treestate: use IntoAnyhowResult
Summary: This preserves the Python errors across language boundaries.

Reviewed By: xavierd

Differential Revision: D19635355

fbshipit-source-id: 14ab8af38362182ca43951d4c560fa405687bf6e
2020-01-30 08:27:34 -08:00
Jun Wu
002d32e878 py3: treestate: use PyPath
Summary: Use PyPath for input/output and Python callbacks.

Reviewed By: xavierd

Differential Revision: D19635356

fbshipit-source-id: c2d8898ef903fda436277997a842bc837bb1bf2f
2020-01-30 08:27:33 -08:00
Jun Wu
c5dd6829c7 cpython-ext: add more utilities for PyPath
Summary:
Make the type easier to use. Namely, the treestate bindings want PyPath <->
bytes since treestate internally uses bytes.

Reviewed By: xavierd

Differential Revision: D19635357

fbshipit-source-id: 37d1889b5da1d7f3869bb7820de0219b87b71a8b
2020-01-30 08:27:33 -08:00
Jun Wu
cd04a56178 repo: avoid metalog when migrating files from sharedvfs to storevfs
Summary: Otherwise it can trigger metalog ProgrammingErrors.

Reviewed By: markbt

Differential Revision: D19624779

fbshipit-source-id: ba56a9aefa28d56a38ea8d966115647975613c91
2020-01-30 07:25:31 -08:00
svcscm
ef54b7d826 Updating submodules
Summary:
GitHub commits:

5c87948eb8

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 364614719fd99fc023ceb265204a042293a3da1d
2020-01-30 07:25:31 -08:00
svcscm
91f04167c8 Updating submodules
Summary:
GitHub commits:

c593f8cc05
3ca284a942
9ffda0d29c
275edda5be

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: d2a99f12ca277101671a2c8c11a5b48f8fb20c39
2020-01-29 18:50:15 -08:00
Mateusz Kwapich
e4ee93b38b py: fixes for cloud sync
Summary: "hg cloud sync" succeeds when there's nothing to do

Reviewed By: quark-zju

Differential Revision: D19630431

fbshipit-source-id: e2c9859c7660e6283e6d319c634f1cd9053f8b3f
2020-01-29 18:25:41 -08:00
Mateusz Kwapich
892dcb3189 py3: make "hg cloud sl" work in py3
Summary: Some strings had to stay as unicode

Reviewed By: quark-zju

Differential Revision: D19628661

fbshipit-source-id: 6ea191c60a4ef2ed98b2e2d3ab90c875e6eea248
2020-01-29 18:25:41 -08:00
Adam Simpkins
b9790d38d6 py3: explicitly set the language_level to 3str
Summary:
This causes the code to always treat unprefixed string literals as the `str`:
i.e., bytes in Python 2 and Unicode in Python 3.  Without this setting our
unprefixed string literals were always being treated as unicode.

Reviewed By: lisroach

Differential Revision: D19634266

fbshipit-source-id: 770d7d03a96aa92a4e183819d34c72281c6c794b
2020-01-29 17:46:30 -08:00
svcscm
1da454af80 Updating submodules
Summary:
GitHub commits:

84bdd4a023
ce3b76724a
4e500a8508
4273a65c34
a72ca3216c
a65b08ff49
9e3ace42a4
5fe2fdd625
3d50460170
591f27c6f1

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 7a721a1bafa7d9d8e630e42cf507ee7bed282c86
2020-01-29 17:42:55 -08:00
Adam Simpkins
b0340dce4e hide duplicate hg error messages in eden doctor output
Summary:
If the hg data in a checkout is corrupt running `hg` commands may cause
Mercurial to crash and print backtrace information.  Hide this error output
when performing our `check_filesystems` checks.

The `check_hg` logic will already detect and handle corrupt repositories.  If
the hg error messages are displayed directly to stderr when running the
`check_filesystems` checks earlier this just makes the output more confusing
to the user.

Reviewed By: genevievehelsel

Differential Revision: D19629960

fbshipit-source-id: 774287f37b216216be3eda2247307416d7ae4034
2020-01-29 17:39:48 -08:00
Zeyi (Rice) Fan
b58fe35549 make run-tests.py py3 compatible
Summary: This diff makes `run-test.py` compatible with Python 3, so we can run this tests both in Python 3 and 2.

Differential Revision: D19611680

fbshipit-source-id: 97571cca7e1310e482ac8c03af73eb345ab825c1
2020-01-29 17:07:33 -08:00
Zeyi (Rice) Fan
e214ad8df9 testing utilities py3 compatibility
Summary:
We temporarily pin these test tools to run with Python 2 so the tests can pass no matter if it is run with 3 or 2.

This diff also makes the fake biggrep client to be Python 3 compatible.

Reviewed By: farnz

Differential Revision: D19611681

fbshipit-source-id: 0c980165934899902b152e27a0a444d6a6c9eb2f
2020-01-29 17:07:32 -08:00
Zeyi (Rice) Fan
05d306bfc3 make test-extension.t py3 compatible
Summary: because of the test `type(b"") != type("")` we actually have different behavior in Python 3 and Python 2. So we remove this test temporarily and we can add it back later.

Reviewed By: sfilipco

Differential Revision: D19611682

fbshipit-source-id: 7bca979f8ef871672ac9666286c8d5e54747e8b3
2020-01-29 17:07:32 -08:00
Zeyi (Rice) Fan
f0e50448b4 make the rest of the tests py3 compatible
Summary: This diff converts the rest of our tests to be compatible with Python 3. There are still a few tests are not fully compatible with Python 3 yet and I'll address these individually as they require major modifications.

Reviewed By: markbt

Differential Revision: D19608299

fbshipit-source-id: 3779dd0d4641ce8470598fa4909306317cf777d8
2020-01-29 17:07:32 -08:00
Stefan Filip
56c0adbc46 py3/match: convert filter result to list
Summary:
In Python3 the result of filter is a class that does not have len
implemented. In Python2 the result of filter is a list.

Reviewed By: quark-zju

Differential Revision: D19629139

fbshipit-source-id: a7a1d9d831d72b2aab8b7a920bf82295c4673603
2020-01-29 17:03:05 -08:00
Stefan Filip
49e90ce242 py3/pypathmatcher: return Str instead of Bytes
Summary:
Globs and patterns generally speaking. They should be typed as Str in
Python3 following how paths are typed.

Reviewed By: quark-zju

Differential Revision: D19628654

fbshipit-source-id: eeaede72f41258d6fe0f3cde26c434fe0b908b8b
2020-01-29 17:03:04 -08:00
Stefan Filip
f80b7bd6c4 py3/sparse: decode sparse profile as utf-8
Summary: File contents are read as bytes but content should be interpreted as utf-8.

Reviewed By: quark-zju

Differential Revision: D19628315

fbshipit-source-id: 523a201ddf57a2aabcd135156e71034c52b59adb
2020-01-29 17:03:04 -08:00
Stefan Filip
ac4aaab5a2 py3/util: treat authentication url as str
Summary: Python3 socke address is str.

Reviewed By: quark-zju

Differential Revision: D19628130

fbshipit-source-id: d6ce93d28588a9ab8829f5b95db30ecee040a160
2020-01-29 17:03:04 -08:00
Mateusz Kwapich
3cfb8a6a7c py3: node: get rid of extra encoding
Summary:
The extra call to encode makes everything a big slower, fortunately python
standard library provides functions that do the right thing.

Reviewed By: xavierd

Differential Revision: D19634034

fbshipit-source-id: 6bb0de26300c41667824422c016e8d4f0aee70d3
2020-01-29 16:48:41 -08:00
Xavier Deguillard
467b3095c1 eden_dirstate_map: encode the path
Summary: This enables `hg add` on EdenFS

Reviewed By: quark-zju

Differential Revision: D19631538

fbshipit-source-id: 1621ab77fef977c9364052bc522df18729face48
2020-01-29 16:45:46 -08:00