Commit Graph

8 Commits

Author SHA1 Message Date
Adam Simpkins
0657c35391 py3: add more vfs-related type annotations
Summary:
Add more type annotations to vfs.py and some of the platform-specific
functions that it calls.

This did catch a couple of cases where string/bytes conversion were not being
done properly in Python 3.

Reviewed By: quark-zju

Differential Revision: D19678717

fbshipit-source-id: b3979cc5e0668ddbb93372dee25ef02ea1867d6f
2020-02-03 21:36:56 -08:00
Adam Simpkins
b6ce7a08a6 py3: make vfs.join() consistent across subclasses; add type hints
Summary:
Add type hints for `vfs.join()`.  Not all subclasses supported joining
multiple arguments, so fix them all to actually implement the full API.

Reviewed By: farnz

Differential Revision: D19678712

fbshipit-source-id: f7f77eee416cd5edda756a8423cbe3630e195d4a
2020-02-03 15:27:52 -08:00
Jun Wu
348ce20341 py3: add type annotations to i18n
Summary: This allows type checkers to understand the i18n._ calls.

Reviewed By: markbt

Differential Revision: D19673677

fbshipit-source-id: be2cc72f70e56925007485c786f0d72b5cd40a1a
2020-02-03 07:35:31 -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
Xavier Deguillard
20459835bb clindex: use str as input to vfs
Reviewed By: farnz

Differential Revision: D19624129

fbshipit-source-id: cbee989334d5cf114ef7b74c9143a992cee70370
2020-01-29 11:07:09 -08:00
Jun Wu
21b2a06c6f py3: vfs: add helper functions to get utf-8 content directly
Summary: Those will simplify some use-cases.

Reviewed By: farnz

Differential Revision: D19613121

fbshipit-source-id: 85ac4fa0c86afb84e0c9fb78950d3da2c93aa967
2020-01-29 07:45:10 -08:00
Xavier Deguillard
24d99a9178 util: remove os.stat_float_times(False)
Summary:
This is not available on Python3, instead stat.ST_MTIME and friends should be
used to get an integer time. This is achieved by wrapping the output of the
stat function and overriding the st_[acm]time properties.

Reviewed By: quark-zju

Differential Revision: D18819679

fbshipit-source-id: 2911f3d47506456e927872d57f69253d903618e2
2019-12-09 13:13:26 -08:00
Adam Simpkins
ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00