Commit Graph

20 Commits

Author SHA1 Message Date
Puneet Kaushik
6e1ab237d4 Call WSAStartup and fix the type information for the socket APIs
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
2019-10-18 12:39:09 -07:00
Adam Simpkins
4e38a7c74f build edenfsctl with CMake
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
2019-09-11 13:20:43 -07:00
generatedunixname89002005289445
13e683608d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D17135557

fbshipit-source-id: 07afef940271a277c75834892733901d070bfa5f
2019-08-30 13:37:34 -07:00
generatedunixname89002005289445
01d06886cb Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D16863919

fbshipit-source-id: c76f41992b9a1a57080eed932724b65c1fd846f5
2019-08-16 14:44:25 -07:00
Puneet Kaushik
60dca8f396 Throw TTransportException in Edencli when the Edenfs not running
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
2019-08-02 17:49:16 -07:00
Chad Austin
fe64ec3874 use fb303 repo in open source build
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
2019-07-24 21:07:04 -07:00
Adam Simpkins
62a914c93d rename the eden thrift wrapper library to match the python namespace
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
2019-07-19 15:30:35 -07:00
Adam Simpkins
b46c3f4a6d rename the eden/dirstate.py module to match the python namespace
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
2019-07-19 15:30:34 -07:00
Adam Simpkins
9bfb48c921 update license headers in .py files
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
2019-06-19 17:02:46 -07:00
Wez Furlong
d3f71a14f3 eden: add a script to build the eden client executable for oss builds
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
2019-01-15 14:14:32 -08:00
Marco Leogrande
bdccac3ea2 Upgrade pyre version for eden
Reviewed By: shannonzhu

Differential Revision: D13502225

fbshipit-source-id: d21fb9da209e4f376a7fbe4f618954ef43d08fea
2018-12-18 11:15:40 -08:00
Matt Glazar
afde763cdb Improve typing of dirstate read and write functions
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
2018-10-08 15:14:44 -07:00
Matt Glazar
1314cc6be4 Add regression tests for dirstate serializer and deserializer
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
2018-10-08 13:49:53 -07:00
Chad Austin
d5575b3374 enable typechecking on Eden Python libraries
Summary: Fix a bunch of mypy errors in our Python.

Reviewed By: wez

Differential Revision: D9144139

fbshipit-source-id: d91a019f8580bc57fd510d307325089a7e8a6155
2018-08-03 15:07:00 -07:00
Wez Furlong
c83849e5af enable Black python formatting and apply to eden
Summary: No functional changes

Reviewed By: simpkins

Differential Revision: D7945989

fbshipit-source-id: e267e6134d87570427b3fdf5974006dce5774113
2018-05-09 21:37:07 -07:00
Adam Simpkins
954d8945b2 refactor CLI subcommand definitions
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
2018-04-19 17:59:51 -07:00
Adam Simpkins
21d2b6c46d Remove TARGETS files
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
2018-02-20 19:57:45 -08:00
Michael Bolin
b77b390c9f Remove support for old dirstate format.
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
2018-01-19 13:06:10 -08:00
Adam Simpkins
53ac2a3ebe support reading the old .hg/dirstate format
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
2017-11-07 14:17:37 -08:00
Michael Bolin
5d738193e5 Store Hg dirstate data in Hg instead of Eden.
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
2017-11-06 19:56:49 -08:00