Commit Graph

20 Commits

Author SHA1 Message Date
Thomas Orozco
8c83bd9a1c third-party/rust: update Tokio to 1.7.1
Summary: There is a regression in 1.7.0 (which we're on at the moment) so we might as well update.

Reviewed By: zertosh, farnz

Differential Revision: D29358047

fbshipit-source-id: 226393d79c165455d27f7a09b14b40c6a30d96d3
2021-06-25 06:17:41 -07:00
Davide Cavalca
b82c5672fc Update several rust crate versions
Summary: Update versions for several of the crates we depend on.

Reviewed By: danobi

Differential Revision: D29165283

fbshipit-source-id: baaa9fa106b7dad000f93d2eefa95867ac46e5a1
2021-06-17 16:38:19 -07:00
Stanislau Hlebik
eab97b6123 mononoke: sync changeset implementation for megarepo
Summary: First stab at implementing sync changeset functionality for megarepo.

Reviewed By: ikostia

Differential Revision: D28357210

fbshipit-source-id: 660e3f9914737929391ab1b29f891b3b5dd47638
2021-05-13 10:04:21 -07:00
Jun Wu
0361222149 progress/render: use Unicode chars friendly for Windows
Summary:
The previous choice of the upload / download arrows do not render in Windows
`cmd.exe` terminal using common fonts:
- Cascadia Code
- Cascadia Mono
- Consolas
- Courier New
- JetBrains Mono
- Lucida Console

Replace them with tri-angles that can be rendered using the above fonts.

Note: newer terminals like Microsoft Terminal and WezTerm can render the characters
just fine.

Reviewed By: andll, ikostia

Differential Revision: D27894085

fbshipit-source-id: c53d995355e66ba793d80afc1b36fc83853d07f8
2021-04-21 08:54:55 -07:00
Gus Wynn
fc46c24e8f update tokio to 1.4.0
Summary:
https://github.com/tokio-rs/tokio/releases/tag/tokio-1.4.0
I want the `biased;` option in `tokio::select!`

Reviewed By: ahornby

Differential Revision: D27435341

fbshipit-source-id: c29ca954c319327f62466131ae04483ad091bf49
2021-03-31 10:44:20 -07:00
Jun Wu
d76c91096a hgcommands: drop indicatif progress bar
Summary:
The Rust progress bars now integrates with hg-http and all requests get
progress bars for free. There is no need for a separate bar.

Reviewed By: andll

Differential Revision: D26970747

fbshipit-source-id: c5e59c745e75a93e5da0541baab21c3f23dc1322
2021-03-12 11:39:10 -08:00
Jun Wu
a7c3458c82 clidispatch: split dispatch() method
Summary:
Split `dispatch()` into 2 parts: config parsing and command execution.
This allows callsite to do extra work based on the config before running the
command.

Reviewed By: andll

Differential Revision: D26853749

fbshipit-source-id: 459918b43341f7e14df6958056b6e07453bb691b
2021-03-12 11:39:09 -08:00
Jun Wu
a310122ce2 progress: add a sub-crate for rendering progress
Summary: Add a simple way to render progress into a multi-line string.

Reviewed By: andll

Differential Revision: D26853751

fbshipit-source-id: 4f1de55e7bb03f607d683eff16e035aa5d1476c1
2021-03-11 17:19:14 -08:00
Jun Wu
309bcb5424 progress: add a registry
Summary:
Add a struct to "register" progress data for Rust to render them.
Note: The "registry" only tracks the data. Rendering will be
implemented separately.

Reviewed By: andll

Differential Revision: D26615606

fbshipit-source-id: affa663660bd52a2583d40e3b28f0b65480851a3
2021-03-11 17:19:13 -08:00
Jun Wu
6ffd0573ac progress: add model about progress bar
Summary: Add an API to render the time series samples into ASCII graph.

Reviewed By: andll

Differential Revision: D26836633

fbshipit-source-id: 9c7a757e46c28c810fb3e0671a775fde16318f54
2021-03-11 17:19:13 -08:00
Jun Wu
916f4c558f progress: add model about cache hit statistics
Summary: This could be used for showing overall statistics

Reviewed By: andll

Differential Revision: D26886280

fbshipit-source-id: a52f057dbbebb441d0eee14860275f2690c7a3a3
2021-03-11 17:19:13 -08:00
Jun Wu
1af1506ba7 progress: render time series into scaled values
Summary: Add an API to render the time series samples into an array that can be further turned into an ASCII graph.

Reviewed By: andll

Differential Revision: D26615170

fbshipit-source-id: 4a2f178869c235e7dda3edef7930a6e04bc4bda3
2021-03-11 17:19:13 -08:00
Jun Wu
216bb6d1f2 progress: add a time series type for keeping samples
Summary: Continue with last change. Add a time series type that keeps samples.

Reviewed By: andll

Differential Revision: D26615171

fbshipit-source-id: 5dcc775820d782ac502d84b6af5e270f2a9072ee
2021-03-11 17:19:12 -08:00
Jun Wu
2b3d131b9e progress: add a "Sample" type for measuring IO
Summary:
Going to add some kind of "time series" graph based on periodical sampling.
Add the sample structure for IO with some simple math helpers.

Reviewed By: kulshrax

Differential Revision: D26615173

fbshipit-source-id: 4d610f435a3c7913e8bb31a8de0738ffb3de1468
2021-03-11 17:19:12 -08:00
Jun Wu
0066271bb5 progress: add a model sub-crate
Summary:
Going to add some kind of data model definitions for pure Rust logic.

Use a dedicated crate so progress model and rendering are separate. If the
rendering logic becomes bloated somehow, it won't affect the data models.
The idea is that only application-level logic like `hgcommands` care about
rendering. Other use-cases only care about pure progress states.

Reviewed By: andll

Differential Revision: D26836634

fbshipit-source-id: 5222d2f9fb4894bd246c62ad48e1c5fc982e2fa6
2021-03-11 17:19:12 -08:00
Lukas Piatkowski
cd0b6d50e2 autocargo v1: changes to match autocargo v2 generation results.
Summary:
The changes (and fixes) needed were:
- Ignore rules that are not rust_library or thrift_library (previously only ignore rust_bindgen_library, so that binary and test dependencies were incorrectly added to Cargo.toml)
- Thrift package name to match escaping logic of `tools/build_defs/fbcode_macros/build_defs/lib/thrift/rust.bzl`
- Rearrange some attributes, like features, authors, edition etc.
- Authors to use " instead of '
- Features to be sorted
- Sort all dependencies as one instead of grouping third party and fbcode dependencies together
- Manually format certain entries from third-party/rust/Cargo.toml, since V2 formats third party dependency entries and V1 just takes them as is.

Reviewed By: zertosh

Differential Revision: D26544150

fbshipit-source-id: 19d98985bd6c3ac901ad40cff38ee1ced547e8eb
2021-02-19 11:03:55 -08:00
Lukas Piatkowski
87ddbe2f74 autocargo v1: update autocargo field format to allow transition to autocargo v2
Summary:
Autocargo V2 will use a more structured format for autocargo field
with the help of `cargo_toml` crate it will be easy to deserialize and handle
it.

Also the "include" field is apparently obsolete as it is used for cargo-publish (see https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields). From what I know this might be often wrong, especially if someone tries to publish a package from fbcode, then the private facebook folders might be shipped. Lets just not set it and in the new system one will be able to set it explicitly via autocargo parameter on a rule.

Reviewed By: ahornby

Differential Revision: D26339606

fbshipit-source-id: 510a01a4dd80b3efe58a14553b752009d516d651
2021-02-12 23:28:25 -08:00
Arun Kulshreshtha
720bad11ac progress: fix typo in comment
Reviewed By: singhsrb

Differential Revision: D24130363

fbshipit-source-id: 6505f51f892dffb90c89b3c18e981e55721b6106
2020-10-05 22:26:16 -07:00
Arun Kulshreshtha
b5a36de8cd progress: add null progress bar
Summary:
Add a null progress bar implementation that just keeps track of state, similar to the `progress.nullbar` in hg's Python code.

A benefit of this is that code that optionally shows progress can unconditionally update the progress bar rather than wrapping it in an `Option` and checking for presence each time.

Reviewed By: markbt

Differential Revision: D23982318

fbshipit-source-id: ffd762b59cc0c9bd2ad0c67c3ca785350db4850f
2020-09-30 13:01:15 -07:00
Arun Kulshreshtha
6dea84a3c9 progress: add Rust progress bar interface
Summary:
This diff introduces a new `progress` crate that provides an abstract interface for progress bars in Rust code:

- The `ProgressFactory` trait can be used to create new progress bars.
- The `ProgressBar` trait allows Rust code to interact with the progress bar.
- The `ProgressSpinner` trait is similar, but for spinner-type progress indicators.

These traits are intended to be used as trait objects, allowing pure Rust code to accept an opaque `ProgressFactory` and use it to report progress. This kind of abstraction, while not common in idiomatic Rust code, allows the progress implementation to be completed decoupled from the pure Rust code, which is important given that Mercurial's progress bars are currently implemented in Python.

Part of the goal of this crate is to allow a smooth transition to pure Rust progress bars (once we eventually implement them). As long as the Rust progress bars implement the above traits, the can be used as drop-in replacements for Python progress bars everywhere.

Reviewed By: markbt

Differential Revision: D23982319

fbshipit-source-id: 9ccf167f18d9518bb0ed66e1606a5b8188d98428
2020-09-30 11:20:31 -07:00