Commit Graph

24 Commits

Author SHA1 Message Date
Jeremy Fitzhardinge
c652f9a11f third-party/rust: update time to 0.2
Summary:
Time 0.2 is current, and 0.1 is long obsolete. Unfortunately there's a
large 0.1 -> 0.2 API change, so I preserved 0.1 and updated the targets of its
users. Also unfortunate that `chrono` has `oldtime` as a default feature, which
makes it use `time-0.1`'s `Duration` type. Excluding it from the features
doesn't help because every other user is specifying it by default.

Reviewed By: dtolnay

Differential Revision: D28854148

fbshipit-source-id: 0c41ac6b998dfbdcddc85a22178aadb05e2b2f2b
2021-06-03 13:52:54 -07:00
David Tolnay
d4f337c889 Resolve bare_trait_objects warnings in path components
Reviewed By: quark-zju

Differential Revision: D28558352

fbshipit-source-id: d4b85716096c43eed8e6172ade3dfe40e277e670
2021-05-19 22:03:56 -07:00
Lukas Piatkowski
ad106958f2 eden/scm/lib: autogenerate all Cargo.toml files with autocargo
Summary: This diff removes the split between manually managed and autocargo managed Cargo.toml files in `eden/scm/lib`, now all files are autogenerated.

Reviewed By: quark-zju

Differential Revision: D26830884

fbshipit-source-id: 3a5d8409a61347c7650cc7d8192fa426c03733dc
2021-03-05 04:29:49 -08:00
Jun Wu
e46d5c4295 clidispatch: drop unused mut from IO APIs
Summary: Now IO has internal locking, `mut` is no longer needed.

Reviewed By: sfilipco

Differential Revision: D26518025

fbshipit-source-id: d71e213f6fed24fdefb4c730d576f6cf2fb09d82
2021-02-23 15:09:14 -08:00
Jun Wu
f3b00a6c0d edenfs-client: print meaningful warnings for non-utf8 paths
Summary:
Make the status fast path print warnings about non-utf8 names and continue on
other valid utf-8 names. It matches the behavior of the Python status code
path.

Before this change, an invalid utf-8 name would just print:

  abort: invalid utf-8 sequence of 1 bytes from index 7

without telling which file it is.

Reviewed By: markbt

Differential Revision: D26553514

fbshipit-source-id: 6e26a2a8d738e9001d878a80c0dc82ae6d18a97c
2021-02-19 18:32:11 -08:00
Jun Wu
43bee8fbbc clidispatch: make IO fields private
Summary:
We're going to tweak the internals of IO. Making its fields private to allow
that.

Reviewed By: sfilipco

Differential Revision: D26518023

fbshipit-source-id: a1eed46f4f87a3b4b63e56be733102058b4d72d6
2021-02-19 15:22:05 -08:00
Saurabh Singh
384c4f61fa fix the Windows build
Reviewed By: sfilipco

Differential Revision: D23601358

fbshipit-source-id: c5a33286b7468882bbedb3e8fe85f66a8f9db0e2
2020-09-09 10:39:35 -07:00
Lukasz Piatkowski
379065faab eden/scm: remove leftover of tokio-core after tokio 0.2 migration (#52)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/52

Reviewed By: krallin

Differential Revision: D23594074

Pulled By: lukaspiatkowski

fbshipit-source-id: 776c02418f4951321887f566bac8b76c9da8bcc1
2020-09-09 02:32:49 -07:00
Zeyi (Rice) Fan
5e02a93e91 eden-client: move to use tokio 0.2 socket transport
Summary: No more tokio-core! More `async/await`.

Reviewed By: kulshrax

Differential Revision: D23586509

fbshipit-source-id: b2e766ddb7575bc96963432f0c8582b4370b19aa
2020-09-08 20:24:26 -07:00
Zeyi (Rice) Fan
a6a73ec6b6 switch to tokio 0.2 transport
Summary:
This diff adds a `SocketTransport` implementation that no longer uses legacy `tokio-core` based futures but `tokio-tower` and `tower-service` for processing Thrift requests.

The old implementation is renamed to `SocketTransportLegacy` for better transitioning.

Reviewed By: dtolnay

Differential Revision: D20019196

fbshipit-source-id: 3bee684e9254bf1a81669ef0d2c2262a55e75daa
2020-09-08 17:53:57 -07:00
David Tolnay
e62b176170 Prepare for rustfmt 2.0
Summary:
Generated by formatting with rustfmt 2.0.0-rc.2 and then a second time with fbsource's current rustfmt (1.4.14).

This results in formatting for which rustfmt 1.4 is idempotent but is closer to the style of rustfmt 2.0, reducing the amount of code that will need to change atomically in that upgrade.

 ---

*Why now?* **:** The 1.x branch is no longer being developed and fixes like https://github.com/rust-lang/rustfmt/issues/4159 (which we need in fbcode) only land to the 2.0 branch.

 ---

Reviewed By: zertosh

Differential Revision: D23568779

fbshipit-source-id: 477200f35b280a4f6471d8e574e37e5f57917baf
2020-09-07 20:47:59 -07:00
Durham Goode
201f63be32 build: rename third-party rust fbthrift crate
Summary:
Our internal build infra creates a workspace and workspaces don't like
it when two crates have the same name. Eden scm had third-party rust crates that
were simple redirects to the internal location, but had the same name. This
caused breakages once these crates became part of the edenfs open source build.
Let's rename them to avoid this issue.

Reviewed By: kulshrax

Differential Revision: D23252539

fbshipit-source-id: 9ff2fa160a19c6bc54e015c71f9da7044ce659a7
2020-08-26 12:26:21 -07:00
Lukas Piatkowski
505d2e8a63 eden/scm: move third-party facebook crates dependencies to a separate folder
Summary:
Having fbsource's thrid-party crates in a separate folder will make it easier to provide a different manifest for the third-party crates for OSS builds.

In order to not trigger any network calls during internal FB builds you cannot define dependencies with "git" urls. Even if they are being patched up in the same manifest Cargo will still make a call to github. That is why internall the Cargo.toml files in third-party folder will contain dependency definitions that will use "path" dependencies only.

In the next diff a separate set of Cargo.toml files will be provided inside `fbcode/eden/oss` that ShipIt will replace for GitHub with the proper "git" url dependencies.

Note: Why even bother with "git" and "patch" section and not use only "path" dependencies? In OSS eden builds depending on other project - like fbthrift or rust-shed. They use regular "git" dependencies. So if you try to compile Eden that uses "path" dependencies with fbthrift/rust-shed that uses "git" dependencies you will get errors from Cargo saying that e.g. rust-shed's fbthrift_ext depends on "fbthrift" (from git), but the structure X implements trait Y from "fbthrift" (from path) which is not the same as trait Y from "fbthrift" (from git).

Reviewed By: quark-zju

Differential Revision: D22335430

fbshipit-source-id: 9b73f4f0bc09fa79b02488dc9b4640b97f90683c
2020-07-02 03:35:02 -07:00
Lukas Piatkowski
b7b5c9e7cc shed/fbthrift_ext: move some useful fbthrift extensions to the shed
Reviewed By: farnz

Differential Revision: D22257111

fbshipit-source-id: b8f59cb0aa0d0e1100b5eb9c2a1f295ad6442650
2020-06-29 09:16:00 -07:00
Genevieve Helsel
a98dd1fa6b suggest graceful restart in hg status / old edenfs warnings
Summary: Since the old Edenfs warning is usually for simply picking up new eden releases, we can suggest the user runs a graceful restart instead of a normal restart to avoid them running into `Transport not connected` errors. This path is only hit in unix environments, so windows users will not see this (since graceful restart isn't supported there yet). Since this is a manual step as well, it will be easier for a user to see if they run into an issue here. This can also enable us to get more telemetry from users running graceful restarts.

Reviewed By: wez

Differential Revision: D20901597

fbshipit-source-id: 9e5c9a90313901be159f66afcbbadc5d7af4fe28
2020-04-13 16:25:58 -07:00
Adam Simpkins
b31c991c00 update the hg status fast-path to print errors reported by EdenFS
Summary:
Update `hg status` to print errors that were returned by EdenFS's
getScmStatusV2() call, and to exit unsuccessfully if there were any errors.

Previously errors were silently ignored.

Reviewed By: quark-zju

Differential Revision: D19958503

fbshipit-source-id: cb3109df40eb86a5bf7e3818ddfb8da74d670405
2020-03-30 19:24:22 -07:00
Adam Simpkins
ba42390257 fix hg status path relativization in tests on Windows
Summary:
Fix the `test_status()` function to properly canonicalize the input paths, so
that it works successfully on Windows.  Previously this function would fail on
Windows as some paths would end up as UNC-style paths and some would be plain
paths, causing the equality comparison to fail even though the paths were
equivalent.  This canonicalizes the repo path so that they both use the same
format.

Reviewed By: quark-zju

Differential Revision: D20662921

fbshipit-source-id: fdd36bac755f9694b4a482615d3dca43ff21e05e
2020-03-30 19:24:22 -07:00
Steven Troxler
3534ca3bb8 Deprecate rust-crypto in edenfs-client
Summary:
Switched out the `sha` package for the `rust-crypto` package. The
apis aren't an exact match, so I had to insert a clone in place of
a modification to a mutable reference.

Reviewed By: jsgf

Differential Revision: D20585336

fbshipit-source-id: 22245157aea1115ae6f225b17b0346f0696653f7
2020-03-23 11:04:36 -07:00
Kuba Zika
6a25dbee81 Simplify error pattern matching
Summary:
Instead of returning `anyhow::Error` wrapping an `ErrorKind` enum
from each Thrift client method, just return an error type specific
to that method. This will make error handling simpler and less
error-prone by removing the need to downcast the returned error.

This diff also removes the `ErrorKind` enums so that we can be sure
that there are no leftover places trying to downcast to them.

(Note: this ignores all push blocking failures!)

Reviewed By: dtolnay

Differential Revision: D20260398

fbshipit-source-id: f0dd96a7b83dd49f6b30948660456539012f82e6
2020-03-06 12:09:38 -08:00
Adam Simpkins
0ffcf3e450 update the Rust print_status() function to take an IO parameter
Summary:
Update the `print_status()` function to take a `clidispatch::io::IO` object as
a parameter, instead of a simple output object.  This will allow us to also
print error messages from this function in a future diff.

Reviewed By: quark-zju

Differential Revision: D19958504

fbshipit-source-id: bf482fdc4420e1350363a730c6a539cd760aef25
2020-02-26 14:54:40 -08:00
Adam Simpkins
b22fc79e4b clean up PathRelativizer API usage of Path vs PathBuf
Summary:
Fix the PathRelativizer APIs to accept `Path` and even `str` arguments instead
of just `PathBuf`.  The old code required a `PathBuf`, which often forced
callers to make a copy of the path data.

Reviewed By: quark-zju

Differential Revision: D19958505

fbshipit-source-id: 6fa40dd4b75df4e3faf9ad2ae4f0e4e6595669f6
2020-02-24 15:38:36 -08:00
Jun Wu
684351a6a9 edenfs-client: fix warnings
Summary:
Fix warnings about unused imports, and fix Cargo.toml to use well-defined
versions.

Reviewed By: singhsrb

Differential Revision: D19386232

fbshipit-source-id: 4eb7478dfb4f34e8338d5090b3ba7225bfcb008f
2020-01-13 18:14:46 -08:00
Jun Wu
3895af590a edenfs-client: use clidispatch IO and Error types
Summary:
This simplifies the error handling and makes it more compatible with things that
might capture the output, including the Python testing framework.

Reviewed By: DurhamG

Differential Revision: D19325642

fbshipit-source-id: 53de8b9a8294219e2b8e62831dce236841bd4cbb
2020-01-13 14:23:34 -08:00
Jun Wu
7e9aaf9da5 lib: add edenfs-client
Summary:
Add a crate aiming for talking to EdenFS via Thrift.

This is mostly ported from telemetry. There are lots of things that can be
cleaned up like moving the command portion to hgcommands, or using a better
abstracted rendering layer for outputting, etc. But for now, I just ported
the code as-is.

Reviewed By: DurhamG

Differential Revision: D19325639

fbshipit-source-id: ac70315ed166024857a90aab070e4d521f3e3b58
2020-01-13 14:23:33 -08:00