Summary:
The connect() API was erroring out when running with Python2 code, which could be because of missing type information. In this diff, we have explicitly declared the APIs with their type information.
Plus also calling WSAStartup to initialize the socket library before using winsock.
Reviewed By: chadaustin
Differential Revision: D17883242
fbshipit-source-id: b83a3994efca61eed0f2e621f1848b0a9f27fecf
Summary:
Update the CMakeLists.txt to also build the Python-based `edenfsctl` command
line tool.
This requires switching most of the thrift rules to generate both C++ and
Python sources.
Note that one missing feature at this point is that this does not package
external dependencies into the binary. Currently `edenfsctl` depends on both
`six` and `toml` as external dependencies. For now these must be available in
your `PYTHONPATH` in order to run the generated `edenfsctl` binary.
Reviewed By: chadaustin
Differential Revision: D17127615
fbshipit-source-id: fc138ab39e75c6a5bbd39e3f527d4e9f7f420e46
Summary:
Edencli will throw and crash the cli when the edenfs is not running.
Before:
```
PS C:\open\fbsource\fbcode\eden\facebook\win> C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe status
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\__main__.py", line 3, in <module>
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\cli\main.py", line 1546, in main
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\cli\main.py", line 140, in run
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\cli\config.py", line 604, in check_health
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\cli\util.py", line 164, in check_health
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\thrift\client.py", line 74, in __enter__
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\thrift\client.py", line 86, in open
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\thrift\transport\THeaderTransport.py", line 247, in open
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\thrift\windows_thrift.py", line 109, in open
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\thrift\windows_thrift.py", line 66, in connect
File "C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe\eden\thrift\windows_thrift.py", line 45, in _checkReturnCode
eden.thrift.windows_thrift.WindowsSocketException: Windows Socket Error: 10061
```
After:
```
PS C:\open\fbsource\fbcode\eden\facebook\win> C:\open\fbsource\fbcode\eden\win\build\package\edencli\edenfsctl.exe status
ps: illegal option -- p
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
edenfs not healthy: edenfs not running
```
It internally uses a bash ps command to look for edenfs when the thrift connection fails. Still looking into good ways to fix that.
Reviewed By: strager
Differential Revision: D16565180
fbshipit-source-id: 3c12c538451293e20fabc51c2fe4f1a9bd5b84c0
Summary: Add a dependency from the eden open source build to the fb303 open source build and switch EdenServiceHandler to BaseService.
Reviewed By: simpkins
Differential Revision: D15528156
fbshipit-source-id: 2ca5c31dd9fcc9bac43fd399b27f33b6f2c5ebfc
Summary:
We install the python files under `eden/fs/service` in a package named
`eden/thrift` in the built python binaries that use these modules. This
moves the source files into an `eden/thrift` subdirectory so that the source
directory layout more closely matches the final binary layout.
This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation. This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.
Reviewed By: chadaustin
Differential Revision: D16354622
fbshipit-source-id: 4b58cc96451b1ee5441714aaf74f5e3b6ada9eaa
Summary:
We install `eden/py/dirstate.py` as `eden/dirstate.py` in built python
binaries that use this module. This moves the source file into an `eden/`
subdirectory so that the source directory layout more closely matches the
final binary layout.
This will make it easier to run several of Eden's Python-based tools directly
from the source tree, without having to do as much directory layout
transformation. This is particularly helpful on platforms like Windows, which
don't currently have an equivalent of "live PARs" which can be run from the
source tree without requiring a rebuild after each file edit.
Reviewed By: chadaustin
Differential Revision: D16354627
fbshipit-source-id: 578748e76b730db33cf3ea555df48aa94d15019f
Summary:
Update the copyright & license headers in Python files to reflect the
relicensing to GPLv2
Reviewed By: wez
Differential Revision: D15487088
fbshipit-source-id: 9f2138dff41048d2c35f15e09a04ae5a9c9c80dd
Summary:
The `make-client.py` script assembles an executable zip file
that holds all of the deps needed to run the `eden` cli on a posix
system.
Reviewed By: simpkins
Differential Revision: D13480144
fbshipit-source-id: de8cb093427c793a40e8bf81727f879216c9b41a
Summary:
* Add type annotations to struct.unpack results to prevent leaking Any.
* Make the type signature for read and write as similar as possible (without changing behavior). This will help a future diff (D10224078) which makes the signatures match exactly.
This diff should not change behavior.
Reviewed By: chadaustin
Differential Revision: D10224079
fbshipit-source-id: 5d43d6fbbc989f71dae006dc3d378600d49272d3
Summary: I want to make minor changes to eden.dirstate. Add some basic tests to increase code coverage from 0%.
Reviewed By: chadaustin
Differential Revision: D10223605
fbshipit-source-id: 09835d8052b1460915b4091488f525d4268b3e51
Summary:
Refactor the Eden CLI command so that all subcommands are implemented as
subclasses. This helps keep the command line argument definitions together
with the logic for the command.
This is primarily just a code refactoring change, but I did include a few minor
behavioral changes to the help output:
- The command list is now always sorted alphabetically in the help output.
- The "help" subcommand can now show help for more than just one subcommand
deep. (e.g., `eden help stats io` now works correctly)
- I made some minor improvements to a few of the help strings.
Reviewed By: chadaustin
Differential Revision: D7673021
fbshipit-source-id: dc4c6db20a0fe7452d38bdafc6273e234dba8e4e
Summary:
This removes the TARGETS files from the eden github repository. The
open source buck build has been failing for several months, since buck
removed support for the thrift_library() rule.
I will potentially take a stab at adding CMake build support for Eden
at some point in the future.
Reviewed By: chadaustin
Differential Revision: D6893233
fbshipit-source-id: e6023094a807cf481ac49998c6f21b213be6c288
Summary:
We've been using the new format for long enough that I don't think we need to
keep the old migration code around anymore. I didn't add support for it in
D6717211, so I think we're better off just killing it at this point.
Reviewed By: wez
Differential Revision: D6762271
fbshipit-source-id: d7590f3402f2ac23446aa1858ea58eeae676c153
Summary:
Update the eden.dirstate code to return parent information correctly even if
the .hg/dirstate file is still using the old format.
This does not return non-normal tuples correctly. If we really wanted to we
could add the hgdirstate.thrift file back so we could parse the old dirstate
file correctly, but it doesn't really seem worthwhile for now. Simply
returning the parents information will probably be good enough to help most of
our current users upgrade.
Reviewed By: bolinfest
Differential Revision: D6263602
fbshipit-source-id: 9b65335b0e98ba3fd79d2f220c82df18753ccfdc
Summary:
This is a major change to how we manage the dirstate in Eden's Hg extension.
Previously, the dirstate information was stored under `$EDEN_CONFIG_DIR`,
which is Eden's private storage. Any time the Mercurial extension wanted to
read or write the dirstate, it had to make a Thrift request to Eden to do so on
its behalf. The upside is that Eden could answer dirstate-related questions
independently of the Python code.
This was sufficiently different than how Mercurial's default dirstate worked
that our subclass, `eden_dirstate`, had to override quite a bit of behavior.
Failing to manage the `.hg/dirstate` file in a way similar to the way Mercurial
does has exposed some "unofficial contracts" that Mercurial has. For example,
tools like Nuclide rely on changes to the `.hg/dirstate` file as a heuristic to
determine when to invalidate its internal caches for Mercurial data.
Today, Mercurial has a well-factored `dirstatemap` abstraction that is primarily
responsible for the transactions with the dirstate's data. With this split, we can
focus on putting most of our customizations in our `eden_dirstate_map` subclass
while our `eden_dirstate` class has to override fewer methods. Because the
data is managed through the `.hg/dirstate` file, transaction logic in Mercurial that
relies on renaming/copying that file will work out-of-the-box. This change
also reduces the number of Thrift calls the Mercurial extension has to make
for operations like `hg status` or `hg add`.
In this revision, we introduce our own binary format for the `.hg/dirstate` file.
The logic to read and write this file is in `eden/py/dirstate.py`. After the first
40 bytes, which are used for the parent hashes, the next four bytes are
reserved for a version number for the file format so we can manage file format
changes going forward.
Admittedly one downside of this change is that it is a breaking change.
Ideally, users should commit all of their local changes in their existing mounts,
shutdown Eden, delete the old mounts, restart Eden, and re-clone.
In the end, this change deletes a number of Mercurial-specific code and Thrift
APIs from Eden. This is a better separation of concerns that makes Eden more
SCM-agnostic. For example, this change removes `Dirstate.cpp` and
`DirstatePersistance.cpp`, replacing them with the much simpler and more
general `Differ.cpp`. The Mercurial-specific logic from `Dirstate.cpp` that turned
a diff into an `hg status` now lives in the Mercurial extension in
`EdenThriftClient.getStatus()`, which is much more appropriate.
Note that this reverts the changes that were recently introduced in D6116105:
we now need to intercept `localrepo.localrepository.dirstate` once again.
Reviewed By: simpkins
Differential Revision: D6179950
fbshipit-source-id: 5b78904909b669c9cc606e2fe1fd118ef6eaab95