Summary:
In regular xcode this was warning and being ignores. Not the working is handled as an error.
This diff is only a workaround so we wont get those errors .
```
eden/scm/edenscm/mercurial/cext/osutil.c:745:49: error: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
ret = _listdir_batch(path, pathlen, keepstat, skip, &fallback);
^~~~
eden/scm/edenscm/mercurial/cext/osutil.c:586:11: note: passing argument to parameter 'skip' here
char* skip,
```
Reviewed By: mzlee
Differential Revision: D27136440
fbshipit-source-id: 00d61fd00e3ed8e23643ea69b5a82dbeb5e742ce
Summary: When building against Python 3.8 the MSVC compiler complains about how this macro splits inside parentheses. Not sure what changed, but looks easy enough to fix.
Reviewed By: quark-zju
Differential Revision: D26434060
fbshipit-source-id: b46059a6e676a52c99f8923b6739cffe578cc6f7
Summary:
In Python 3 the strings are no longer bytes, so we need to convert them before calling Windows native APIs.
I originally attempted to make all C APIs use the W() Windows APIs. This sorta worked and enabled some unicode support for Windows in Python 2, like hg status, but it meant that utf-8 path encodings were being returned and eventually passed to python functions like os.lstat() which weren't expecting utf8 encoding. I gave up and just left the Python 2 C code as is, and made a copy that uses W() APIs for Python 3. This enables unicode support on Windows where it didn't work before (at least in my testing).
Reviewed By: quark-zju
Differential Revision: D26381053
fbshipit-source-id: 69d4e18ba9fb0f3d17bad58fbcc5d0e6e61d4252
Summary: This is defined else where in Python 3, so let's get rid of it here.
Reviewed By: quark-zju
Differential Revision: D26381054
fbshipit-source-id: 9746d2c53f83209d9c795ffdd5841d58ef1153ef
Summary: It's used for malloc / realloc which take size_t instead of unsigned int.
Reviewed By: StanislavGlebik, xavierd
Differential Revision: D25890562
fbshipit-source-id: e2787786e9b995431c50b411d77cbce438a82c98
Summary:
Fixes a few issues with Mononoke tests in Python 3.
1. We need to use different APIs to account for the unicode vs bytes difference
for path hash encoding.
2. We need to set the language environment for tests that create utf8 file
paths.
3. We need the redaction message and marker to be bytes. Oddly this test still
fails with jq CLI errors, but it makes it past the original error.
Reviewed By: quark-zju
Differential Revision: D23582976
fbshipit-source-id: 44959903aedc5dc9c492ec09a17b9c8e3bdf9457
Summary:
Pyre now has improved support for decorators and descriptors, which makes it
possible for us to add type annotations to `dirstate.py` without needing lots
of `pyre-ignore` comments everywhere. (Previously Pyre could not handle the
`propertycache` decorator, causing it to be confused about the type of
various dirstate members, like `_map`).
Reviewed By: mrkmndz
Differential Revision: D22969757
fbshipit-source-id: 1b54f1edfb56c20c237a34f14a47404d10605240
Summary:
Renamed xdiff functions to avoid linking issues when using both libgit2-sys and xdiff.
When using repo_import tool (https://fburl.com/diffusion/8p6fhjt2) we have libgit2-sys dependency for importing git repos. However, when we derive blame data types, we need to use xdiff functionalities (from_no_parents: https://fburl.com/diffusion/pitukmyo -> diff_hunks: https://fburl.com/diffusion/9f8caan9 -> xdl_diff: https://fburl.com/diffusion/260x66hf). Both libgit2 and eden/scm have vendored versions of xdiff library. Therefore, libgit2-sys and eden/scm share functions with the same signatures, but have different behaviours and when we tried to derive blame, it used libgit2-sys's xdl_diff instead of eden's. This resulted in getting segfaults (https://fburl.com/paste/04gwalpo).
Note: repo_import is the first tool that has tried to import both and the first to run into this issue.
Reviewed By: StanislavGlebik
Differential Revision: D22432330
fbshipit-source-id: f2b965f3926a2dc45de1bf20e41dad70ca09cdfd
Summary:
Drop other diffhelpers implementations.
The Rust implementation does a better job on type checks and won't segfault.
Reviewed By: xavierd
Differential Revision: D20935367
fbshipit-source-id: f59240f3a661efe1ca6e451922bcb3ca6ee6ae22
Summary: Remove the old Python, C implementation of getfstype.
Reviewed By: xavierd
Differential Revision: D20313385
fbshipit-source-id: 475c73343aae2fa2f5ad898c7b0879bfa2c80e93
Summary:
Add type annotations for the `edenscmnative.parsers` methods that handle
serializing and deserializing the dirstate data.
Reviewed By: quark-zju
Differential Revision: D19958218
fbshipit-source-id: 6e20efbc1b0a6ba15b297e47a1e6eec8ed47ee52
Summary:
The state entry of a dirstate tuple is a single character. In python 3
it's a unicode string. To parse it, previously we used 'C' which takes a single
character unicode string and (little did I know) returns an int. We were storing
this in a char, which causes corruption.
Let's switch to reading the string, and just grabbing the first byte.
Reviewed By: xavierd
Differential Revision: D20143094
fbshipit-source-id: d9946c0cefdafe0941f4bdac070659fac27f30e3
Summary: Updates the C code to support unicode filenames and states.
Reviewed By: simpkins
Differential Revision: D19786275
fbshipit-source-id: e7aeb029b792818b1b1a9c5d3028640b56522235
Summary:
Add *.pyi type stub files for most of the native C extensions.
This allows Pyre to type check functions that use these extensions.
These type annotations likely aren't complete, but contain enough information
to allow Pyre to pass cleanly on the existing type-checked locations in the
code using these modules.
Reviewed By: xavierd
Differential Revision: D19958220
fbshipit-source-id: 85dc39a16e595595a174a8e59e419c418d3531be
Summary:
This moves the build rules for the extensions in mercurial/cext into a TARGETS
file in this directory.
This will allow us to start writing `*.pyi` files that contain type
information for these modules, and store them alongside the corresponding `.c`
files. By having the build rules in the top-level `eden/scm` directory we
would have needed to keep the `.pyi` files for these modules directly in the
`eden/scm` directory instead, as the namespace for the `pyi` files is assumed
to be the basemodule plus their path relative to the TARGETS file.
Reviewed By: xavierd
Differential Revision: D19958222
fbshipit-source-id: fdc26ead16663036ffa2562a96eb1649f91cba81
Summary:
Update includes to the third-party xdiff.h file to use absolute includes
from the repository root. This allows many parts of our internal build
tooling to work better, including automatic dependency processing.
Reviewed By: xavierd
Differential Revision: D19958228
fbshipit-source-id: 341dd8c94f1138cf4a387b92e1817b2a286d6aa1
Summary:
Update the C files under edenscm/mercurial/cext to use absolute includes from
the repository root. Also update a few of the libraries in edenscm/mercurial
that the cext code depends on.
This makes these files easier to build with Buck in fbsource, and reduces the
number of places where we have to use deprecated Buck functionality to help
find these headers. This also allows autodeps to work with the build targets
for these rules.
Reviewed By: xavierd
Differential Revision: D19958221
fbshipit-source-id: e6e471583a795ba5773bae5f16ed582c9c5fd57e
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
Summary: Use UTF8 paths and flags. Node, and the manifest text remain bytes.
Reviewed By: xavierd
Differential Revision: D19581190
fbshipit-source-id: f6f3c561bc5d3663f20513654bea65066a669d34
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
Summary:
We recently saw a high rate of build failures on MacOS.
They all fail with compiler errors like:
In file included from edenscm/mercurial/cext/osutil.c:1326:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:29:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/Security.h:38:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/SecProtocolOptions.h:28:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h:158:19: error: missing ',' between enumerators
kTLSProtocol12 CF_ENUM_DEPRECATED(10_2, 10_15, 5_0, 13_0) = 8,
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h:158:20: error: redefinition of enumerator '__AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_15'
kTLSProtocol12 CF_ENUM_DEPRECATED(10_2, 10_15, 5_0, 13_0) = 8,
^
It's unclear whether this is a compiler configuration issue, or the Apple SDK
being buggy.
The only user of ApplicationServices is `isgui()` when `$SSH_CONNECTION` is not
set on MacOS.
It seems to me that if we just replace `isgui()` to `True`, very few if nobody
will notice the difference. Therefore let's remove the problematic
ApplicationServices as an attempt to stabilize the build.
FWIW Git does not seem to have any sort of GUI detection. It seems to solely
rely on (static) user configuration.
This reverts part of https://www.mercurial-scm.org/repo/hg/rev/16118b4859a1.
Reviewed By: singhsrb
Differential Revision: D19441351
fbshipit-source-id: f1bfbaf0d015e8d577a83112b5ea0a4be6367156
Summary: This is needed in Python3, export it.
Reviewed By: quark-zju
Differential Revision: D19379402
fbshipit-source-id: e5d095005f20c8a940b31e0296293aa8a85c4e98
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.