Commit Graph

55543 Commits

Author SHA1 Message Date
Durham Goode
14ec2d4b34 py3: enable more tests
Summary: These now pass

Reviewed By: farnz

Differential Revision: D19678869

fbshipit-source-id: 68601ff6a6d33b13947210eecfecd999aa2ddb1a
2020-02-01 10:39:39 -08:00
Adam Simpkins
df74c3e8fa py3: start adding type hints in mercurial/vfs.py
Summary:
Begin adding type hints to many of the vfs methods.

These type hints indicate that the vfs objects are always opened in binary
mode.  While it is possible to open a vfs in text mode if you explicitly
specify the argument `text=True`, this is very rare.  If we run into cases
in the future that do need type hints to indicate TextIO mode I think it would
be better to split those out into completely separate functions, rather than
having functions that sometimes return bytes and sometimes return str based on
the arguments used.

Reviewed By: markbt

Differential Revision: D19673538

fbshipit-source-id: 8683223f28964d4b43fe131d4f16f8877dcbe777
2020-02-01 10:32:51 -08:00
Adam Simpkins
3c8739e179 py3: add type hints for util.atomictempfile
Summary:
Make `atomictempfile` derive from `typing.BinaryIO` so that the type checker
understands it can be used like a file.

This required defining all `BinaryIO` methods on this class.  This does result
in a fair amount of additional boilerplate code, but seems like the easiest
approach for now.

Reviewed By: markbt

Differential Revision: D19673539

fbshipit-source-id: b5775ca79b3af456b45e4ef5480711d7095e7949
2020-02-01 10:32:51 -08:00
svcscm
4434ce9947 Updating submodules
Summary:
GitHub commits:

d8b4f2ff66
daa254211a
9c4684ff10
fdb82b21cb

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 4e74f7e888cc2004ba937d3bb253645fbd2388c5
2020-01-31 23:23:00 -08:00
Simon Farnsworth
eb5e4fb57e py3: fix share command
Summary: The share command was reaching into the filesystem directly - use the right utility functions instead

Reviewed By: quark-zju

Differential Revision: D19672980

fbshipit-source-id: a14323fd5419c3ea00d9c009b9a77f63862a7b2a
2020-01-31 22:13:04 -08:00
Mark Thomas
a6b159822f py3: fix escaping test-unified-test.t
Summary:
Python 3 is more strict about bad escape characters.  As far as I can tell,
this was always wrong, and when corrected, works both in Python 2 and Python 3.

Reviewed By: quark-zju

Differential Revision: D19673184

fbshipit-source-id: b8b358327db8ce2e51761f8f98784bdd4b396423
2020-01-31 22:00:59 -08:00
Mark Thomas
b36cdab6f9 py3: use new-style class for fd wrapper
Reviewed By: farnz

Differential Revision: D19672991

fbshipit-source-id: 06ce264f17b395c336c5bd936534e346d0b08a68
2020-01-31 21:28:47 -08:00
svcscm
9abe368e79 Updating submodules
Summary:
GitHub commits:

5adba3596a

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: b9cc4b37e86811582754f4c352ce9f178159a648
2020-01-31 20:49:18 -08:00
Adam Simpkins
7a61371a9d py3: move checkwinfilename() to a separate file and add type hints
Summary:
This moves `checkwinfilename()` from util.py to a new winutil.py module.
This allows the windows.py module to import winutil.py and re-expose
`checkwinfilename()` as `checkosfliename()`.  This makes pyre happier, since
all platform modules now contain a `checkosfilename` method.

This also adds type hints to `checkwinfilename()`, and updates several parts
of the code that were still incorrectly assuming the input was bytes in
Python 3.  However, note that I haven't done much testing of this on Windows.

Reviewed By: quark-zju

Differential Revision: D19672077

fbshipit-source-id: d78ed5b344a2e24c2a361b56465dedc516171d28
2020-01-31 20:18:21 -08:00
Durham Goode
3430fdd32f py3: treat sshserver wireprotocol commands and arguments as strings
Summary:
While the payload of wire commands are bytes, we should treat the
command and args as utf8.

Reviewed By: quark-zju

Differential Revision: D19675217

fbshipit-source-id: df64c842e0c099d77dec1313aa0639e46e539194
2020-01-31 18:39:42 -08:00
Durham Goode
10d673add5 py3: handle utf8 paths properly in remotefilelog
Summary: remotefilelog streaming clones need to handle paths as utf8 strings.

Reviewed By: quark-zju

Differential Revision: D19675219

fbshipit-source-id: dadf54fc67ecb6fbb23c1aeffd0c058ff5804bf5
2020-01-31 18:39:41 -08:00
Durham Goode
d37a246d60 py3: use bytes for stdin for hg serve
Summary: hg serve works strictly with bytes, so let's expose it for stdin.

Reviewed By: quark-zju

Differential Revision: D19672836

fbshipit-source-id: 6abc5385daea81c584a89f19a568e42e4afad48a
2020-01-31 18:39:41 -08:00
Durham Goode
d8fbaa7553 py3: fix sshserver to respond with bytes in most places
Summary: This moves streaming clones a bit further along.

Reviewed By: quark-zju

Differential Revision: D19672546

fbshipit-source-id: 054dd639a8067dce34a5bf667996cc5d30301190
2020-01-31 18:39:41 -08:00
Durham Goode
4e8759a594 py3: various fixes to batch and wireproto encoding
Summary:
We should generally be returning bytes on the wire. This fixes up a
number of places to do so, helping move streaming clone closer.

It also turns out that unescapearg is used in multiple situations.  Usually it's
used for strings, but for batches the actual payloads are also delimited by this
and they are bytes. So let's have a function for each case.

Reviewed By: quark-zju

Differential Revision: D19672545

fbshipit-source-id: 6386ae2f39660b042af1382a1d696903fa1de9ad
2020-01-31 18:39:40 -08:00
Durham Goode
3ce72efbc5 py3: misc fixes around streaming clones
Summary: A couple random stops that need correct encoding.

Reviewed By: quark-zju

Differential Revision: D19672547

fbshipit-source-id: edb0490f70cbf89885fe5fb0a1a8a2472d33e18d
2020-01-31 18:39:40 -08:00
Carolyn Busch
ba8ac287b8 py3 sshserver-test
Summary: Translate between bytes and unicode in sshserver to make test-sshserver pass.

Reviewed By: farnz

Differential Revision: D19672378

fbshipit-source-id: 7e1c0bc2d6fc03fac6ebcf54764862e3ed743f7e
2020-01-31 18:39:40 -08:00
svcscm
8770edae82 Updating submodules
Summary:
GitHub commits:

d7c8b6c894
8cc957eea3

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 20e4c373cba5ce7cab01e8fe07b5e53a303e20ed
2020-01-31 18:37:04 -08:00
Xavier Deguillard
ae089886fd setdiscovery: use the nodemap __contains__
Summary:
The changelog __contains__ expects rev numbers, not nodes, the nodemap should
be used instead.

Reviewed By: quark-zju

Differential Revision: D19674451

fbshipit-source-id: 8f0ddf3b9cebeea10f2fd639999f8c6c67a0e35d
2020-01-31 18:34:01 -08:00
Aida Getoeva
ad097305f5 hg-py3: make metaedit command work
Reviewed By: quark-zju

Differential Revision: D19666536

fbshipit-source-id: e8d02dd6ff6ab73efd94002b83319cbfe506c21f
2020-01-31 18:29:01 -08:00
Simon Farnsworth
d1268e8871 py3: ratchet up passing tests
Summary: These four tests pass on master. Let's enable them so that CI keeps us honest

Reviewed By: markbt

Differential Revision: D19672282

fbshipit-source-id: 2d45c3f9840c7323b7bfae8bbd89c4b7ec95f49d
2020-01-31 18:23:58 -08:00
Xavier Deguillard
db4849a0d6 tests: enable passing tests in python3
Summary: These are passing, let's enable them.

Reviewed By: quark-zju, singhsrb

Differential Revision: D19676094

fbshipit-source-id: bcb363382d48a93ac62dceab2dd6349b910bb51a
2020-01-31 18:12:14 -08:00
Xavier Deguillard
fd2c463b9a rebase: decode rebasestate before parsing it
Summary:
This file contains text data, let's decode it before doing anything else with
it.

Reviewed By: quark-zju

Differential Revision: D19675385

fbshipit-source-id: 8aae08c2400dd7d76c8678d5312bab060563e0ba
2020-01-31 18:12:14 -08:00
Xavier Deguillard
06fa75f637 tests: use vfs.writeutf8
Summary: This is the right method to write plain strings data to files.

Reviewed By: quark-zju

Differential Revision: D19675386

fbshipit-source-id: 1f939f79294cbc45f56944058649c384b674b880
2020-01-31 18:12:14 -08:00
Jun Wu
6462672163 pycompat: drop sysbytes, sysstr, strurl, bytesurl
Summary: There are no-ops.  This makes type checkers' life slightly easier.

Reviewed By: farnz

Differential Revision: D19673051

fbshipit-source-id: 363eb8a4e799113b16529825d45645807cafe2fc
2020-01-31 17:59:53 -08:00
svcscm
ee401776f8 Updating submodules
Summary:
GitHub commits:

e0fd90427f
c892e21dc6
3cdc99f2b2
800d24ddc5
74326cdb3c
e4af160c09
6c2fb05f6d
a0555ecf37
e4122f77fc

Reviewed By: 2d2d2d2d2d

fbshipit-source-id: 9e3e0a7231c3e5cc0167cd935541dd7a8a4ea84d
2020-01-31 17:54:43 -08:00
Saurabh Singh
185119e3c0 test-extension: fix the test
Summary: This is broken after D19672686.

Reviewed By: quark-zju

Differential Revision: D19674321

fbshipit-source-id: 7f225b7090ce9168e10e02b25ee17ae2b98cd86a
2020-01-31 17:37:43 -08:00
Saurabh Singh
1891591abc unicode: consistently use 'utf-8' everywhere
Summary:
We generally use 'utf-8' but are using 'utf8' at some places. This
diff changes to using 'utf-8' consistently everywhere.

Reviewed By: farnz

Differential Revision: D19674111

fbshipit-source-id: 3be42859a180ded1c234b805259f086f9531ba18
2020-01-31 17:34:53 -08:00
Xavier Deguillard
57d59e5499 remotenames: write bytes to the file
Summary: The write method requires bytes, let's encode what we're writing into it.

Reviewed By: quark-zju

Differential Revision: D19674450

fbshipit-source-id: 9eaa3393d3d0e6324be39f94d7f31f2228b14412
2020-01-31 17:31:24 -08:00
Xavier Deguillard
7182c8c2ca hgdemandimport: use a set for the ignored modules
Summary:
A set gives us constant time test, while list requires a linear search. This
may speedup the importer slightly.

Reviewed By: quark-zju

Differential Revision: D19674449

fbshipit-source-id: 994a5303114d54b9cd40469b7cfe4b35e2515729
2020-01-31 17:31:23 -08:00
Xavier Deguillard
6f3af2ab10 tests: remove iteritems
Summary: The method doesn't exist in python3, let's simply replace it with items.

Reviewed By: quark-zju

Differential Revision: D19673674

fbshipit-source-id: b17eef7d820ae38db3fea1d457b0b8bb409f1b86
2020-01-31 17:31:23 -08:00
Xavier Deguillard
bf3292412a patch: add a missing b""
Summary:
The headers are bytes, therefore startswith needs to be called with a bytes
argument.

Reviewed By: quark-zju

Differential Revision: D19673675

fbshipit-source-id: 9a978ad42bf94a55c984f2ae35c566a59bfd6180
2020-01-31 17:31:23 -08:00
Adam Simpkins
bcad94171a py3: add pycompat.ABC
Summary:
Assigning to `__metaclass__` only works in Python 2.  In Python 3 this
attribute is ignored, and you instead need to specify `metaclass=` in your
class signature.

This adds a new `pycompat.ABC` base class to make it easier to define abstract
classes that are compatible with both Python 2 and 3.

Reviewed By: sfilipco

Differential Revision: D19672078

fbshipit-source-id: c56eb6c7266f962ef9c13c742e6ac0651b9c19c9
2020-01-31 17:05:54 -08:00
Adam Simpkins
3abc65f90d py3: add type annotations to ui.write()
Summary:
Add type annotations to `ui.write()` and the helper functions it calls.
I also removed unused `**opts` arguments on a few of the helper functions that
it calls.

Reviewed By: markbt

Differential Revision: D19657806

fbshipit-source-id: d020396a51d9fc3b07542c65541fca6067addb23
2020-01-31 17:05:54 -08:00
Zeyi (Rice) Fan
fa54b36b93 fix Windows tests
Summary: This fixes the Windows build failure we are seeing. Apparently Python 2 on Windows does not like unicode type in `os.environ`

Reviewed By: markbt

Differential Revision: D19672308

fbshipit-source-id: b45c1ccf47bdd46dc31d6c980d0e70dd2e084c8f
2020-01-31 16:53:12 -08:00
Saurabh Singh
2f3657f342 test-unbundlereplay: fix the test
Reviewed By: farnz

Differential Revision: D19673662

fbshipit-source-id: e2b05e9efb449ffa1af24c5b221eca1e97873b13
2020-01-31 16:47:43 -08:00
Jun Wu
5d3db79c23 pycompat: drop strkwargs / byteskwargs
Summary: There are no-ops.  This makes type checkers' life slightly easier.

Reviewed By: markbt

Differential Revision: D19673053

fbshipit-source-id: 04f26cd3ca0dbfe579ef939fc39be00035e70cee
2020-01-31 16:38:03 -08:00
Jun Wu
ae22d7d613 pycompat: drop fsencode / fsdecode
Summary:
There are basically no-op (see D19613693).
This makes type checkers' life slightly easier.

Reviewed By: farnz

Differential Revision: D19672686

fbshipit-source-id: 27ca44dd53ec9788fdbb8f31235eae88d1853415
2020-01-31 16:38:03 -08:00
Jun Wu
30f2b80d9f pycompat: drop iterbytestr
Summary: This makes type checkers' life easier.

Reviewed By: markbt

Differential Revision: D19672687

fbshipit-source-id: 335c560289e29ac7c08e36501e9841ddc51232be
2020-01-31 16:38:03 -08:00
Jun Wu
ad0c50a5cb py3: fix some type issues detected by pyre with some type stubs
Summary:
The issues were found by pyre with some type stubs generated via pytype:

  python36 -m pytype edenscm --no-report-errors -j 30

I didn't include the pytype generated stubs because most of them are `Any`.
I'm trying to see if we can get something cleaner.

Reviewed By: markbt

Differential Revision: D19672435

fbshipit-source-id: c57f2ad3a981ddd4a3a267ff1c00e7bdb71e65ca
2020-01-31 16:38:02 -08:00
Simon Farnsworth
9266779248 py3: tools to quickly remove the py2 only marking from tests
Summary:
Simple tools, based on D19664298, that use the JSON report to enable py2 only tests for py3 testing, and revert the changes to those tests that fail.

update-successes.py is just xavierd's original code

Use as needed to enable tests on py3 after debugging, A recommended workflow is in the test plan

Reviewed By: singhsrb

Differential Revision: D19670838

fbshipit-source-id: fc525941cb010c9038c1f73d89913420e0c79981
2020-01-31 16:35:39 -08:00
Cheng Chang
0b03797541 Push compat down one level in gitimport
Summary: Created a new `async fn gitimport` outside of `main`, replaced all `block_on_std` in the new `gitimport` with `await`.

Reviewed By: farnz

Differential Revision: D19649025

fbshipit-source-id: 95493a36878d25de962cd6156c765b5343365cf9
2020-01-31 16:30:54 -08:00
Xavier Deguillard
fe3fc9712f pyrevisionstore: copyfrom should be PyPathBuf, not PyBytes
Summary: This was missed while converting pyrevisionstore to PyPathBuf.

Reviewed By: markbt

Differential Revision: D19672441

fbshipit-source-id: 466a66f2e00c7f73c11a8989c22508560f423e0e
2020-01-31 16:19:25 -08:00
Mark Thomas
df702d9cb6 py3: encode communication with the worker
Reviewed By: quark-zju

Differential Revision: D19665152

fbshipit-source-id: d4cda1e48bdf0fe64047e12d3011c81b501df113
2020-01-31 15:57:38 -08:00
Mateusz Kwapich
d5a207cf18 py3: fix more diff tests
Summary: This diff enables more test while hopefully not breaking anything

Reviewed By: markbt

Differential Revision: D19671316

fbshipit-source-id: 76ecd22a094c0a40b9724a3070a01e5d294888f3
2020-01-31 15:40:54 -08:00
Xavier Deguillard
179aa8ac28 tests: make test-dispatch.py python3 compatible
Summary: Writing to a file opened in "b" mode needs byte strings.

Reviewed By: sfilipco

Differential Revision: D19668666

fbshipit-source-id: 9e8670fa080cc2a7fc611083a4ee2305d8262a3a
2020-01-31 15:31:03 -08:00
Mark Thomas
4604332170 py3: cmdutil.export should encode its output when writing to a file
Reviewed By: quark-zju

Differential Revision: D19666638

fbshipit-source-id: 66cc3a9f6efbb421b31e18fb199e6478702eb950
2020-01-31 15:27:31 -08:00
Mark Thomas
ec02a1dc49 py3: decode undolog redonode
Reviewed By: quark-zju

Differential Revision: D19666639

fbshipit-source-id: e9f5760802750c06f965be0f370b9ed185abb79f
2020-01-31 15:27:31 -08:00
Mark Thomas
f00c23e42e py3: fix encoding in test-visibility.t
Summary: The test itself needs to ensure it decodes the visibleheads file.

Reviewed By: quark-zju

Differential Revision: D19666640

fbshipit-source-id: 999ab3396b0afc7bd86db9ae1ba126730ee3f02d
2020-01-31 15:27:31 -08:00
Xavier Deguillard
299212da50 checkmessagehook: make it python3 compatible
Summary:
The commit message should already be a utf8 string. Make sure that when it is
read from a file, we decode it properly.

Reviewed By: sfilipco

Differential Revision: D19666371

fbshipit-source-id: ee24fe33b5aaf1ede54286979c9523cedd901b3a
2020-01-31 15:21:55 -08:00
Stanislau Hlebik
27edd5b8db mononoke: bookmarks validator for megarepo
Summary:
We are going to enable megarepo setup soon, and we'd like to verify that
bookmarks are the same.

We do it by comparing the bookmarks between small and large repo, and if they are different then we check the history of this bookmark in the large repo. If it recently pointed to the equivalent commit from the small repo then we assume that validation was successful.

Reviewed By: krallin

Differential Revision: D19623843

fbshipit-source-id: 99e399e43341fe4bca563560b2523994dc19fc53
2020-01-31 15:21:44 -08:00