Summary:
dynamicconfig has logic to avoid loading remote configs during tests,
by checking the TESTTMP variable. Unfortunately, the tests currently run system
hg with that environment set, which causes it to generate incorrect
configuration for the real repository (i.e. fbsource).
Let's get rid of all test specific environment variables when running the system
hg. There's a comment in the code saying this breaks some tests (from 2017
03a31be593db), but as far as I can see they still work.
Reviewed By: quark-zju
Differential Revision: D26758364
fbshipit-source-id: 945cbd36f7eccc98149772a42421cbc51b157c5b
Summary:
The new test case failed on Mac because it didn't want to copy over a
symlink or something. Didn't dig too deep because 'rm -rf' works around it.
Reviewed By: sfilipco
Differential Revision: D26758985
fbshipit-source-id: 22ad7e23813bd6bfe86b91535d46c21ee59dfcd1
Summary:
`nonfilelogfctx` means the `fctx` does not have a backing filelog, is in-memory.
Previously, one of the `fctx` is assumed to be backed by a concrete filelog,
it will crash if that is no satisfied.
Reviewed By: DurhamG
Differential Revision: D26731810
fbshipit-source-id: f758f43dc140dbf6cc9b6234681c4830482e767a
Summary:
In a corner case, `mctx[f]` is `None`, and `f` does not exist in both parents.
The `f` should not appear in te `added` status list.
Fix it and remove a duplicated call to `managing`.
Reviewed By: DurhamG
Differential Revision: D26726482
fbshipit-source-id: f386ad9eb27bf053fb671e0f187aaada4699e84e
Summary:
This is used by next diffs.
Test code:
In [3]: v=repo[None]['.gitignore']
In [4]: v.cmp(v)
Before:
RuntimeError: maximum recursion depth exceeded
After:
Out[4]: False
Reviewed By: DurhamG
Differential Revision: D26726481
fbshipit-source-id: c27a8f414313f262d0f596b058df580f9216e8fc
Summary:
Not all context objects support the `__setitem__` API. Instead of adding supports
for all of them, let's add an API to create a `memctx` that mirrors the changes
from another `ctx` so one can them do mutations on the `memctx`. This will be
used by dirsync.
This might also be useful in other "amend" cases, because the `mirror` API takes
various kinds of context (workingctx, changectx, memctx), and is straihtforward
to use:
In [2]: v=m.context.memctx.mirror(repo['.'])
In [3]: v.commit()
Out[3]: 'b\xdeF\xbb\xbb&\xe5\xdbvJ\x16\xf2\xc3\x92\x96Mr\xb7\x85\xbb'
In [4]: repo['.'].node()
Out[4]: 'b\xdeF\xbb\xbb&\xe5\xdbvJ\x16\xf2\xc3\x92\x96Mr\xb7\x85\xbb'
In [5]: v['x']=v['.gitignore']
In [6]: v.commit()
Out[6]: 'b\xdeF\xbb\xbb&\xe5\xdbvJ\x16\xf2\xc3\x92\x96Mr\xb7\x85\xbb'
Reviewed By: DurhamG
Differential Revision: D26726480
fbshipit-source-id: 629cfc721f79d29ef395d4e1d6b3381f0095d573
Summary:
Add `memctx.__setitem__(path, fctx)` API to change a file in memctx. This will
be used in upcoming dirsync changes.
Regarding on `memctx` vs `overlayworkingctx`. Both need some changes to fit the
dirsync use-case (overlayworkingctx needs "amend", not "commit on top of",
memctx needs to be mutable).
The main difference is `overlayworkingctx` uses a concrete `cache` dict for
path, data, and metadata. `memctx` uses a concrete list of file paths, but file
data, metadata is abstracted - it uses a function that returns fctx. I would
like to preserve the laziness of reading files and metadata (especially for LFS),
so I picked the `memctx` instead of `overlayworkingctx` as the starting point.
Reviewed By: DurhamG
Differential Revision: D26726475
fbshipit-source-id: 7c16980ffa1c83fe0ff6d70c60b1daae5e266683
Summary: This simplifies the code a bit.
Reviewed By: kulshrax
Differential Revision: D26681779
fbshipit-source-id: 393565790ab711dd09ae6cfa6f9c4b19c930eb93
Summary:
Similar to D26670318, use the EventListeners APIs to implement the progress
callback. Now HandlerExt only has RequestContext related "as_ref" logic.
Reviewed By: kulshrax
Differential Revision: D26681778
fbshipit-source-id: b7f6e07ced43e0ae043e859337c06b69bd5dfc95
Summary: This makes it useful in non-mut callbacks.
Reviewed By: kulshrax
Differential Revision: D26681784
fbshipit-source-id: 97312df8bf3f900a36cbeb27206a2946bb6c702c
Summary: This makes ProgressUpdater Send + Sync so it can be used in the new callback APIs once `mut` gets dropped.
Reviewed By: kulshrax
Differential Revision: D26681781
fbshipit-source-id: 9c622b1d78b4091e3359c28972b6624f0b53734d
Summary:
This removes more mutable fields. Note the new code is more correct because
curl can call the `progress` callback periodically even if no progress is made.
According to https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html:
This function gets called by libcurl instead of its internal equivalent with
a frequent interval. While data is being transferred it will be called very
frequently, and during slow periods like when nothing is being transferred it
can slow down to about one call per second.
Reviewed By: kulshrax
Differential Revision: D26681780
fbshipit-source-id: 19aa4bcb4c56623e3f0408b06041b3a894f197e7
Summary:
This makes the `total_progress` field use lock-free interior mutability. The
goal is to eventually drop Rc and RefCell.
Reviewed By: kulshrax
Differential Revision: D26681782
fbshipit-source-id: ec0a6abbb2115c17c674db2255d196aaec847705
Summary: This removes the need for `mut` for this field.
Reviewed By: kulshrax
Differential Revision: D26681783
fbshipit-source-id: 10ed9adfb62081b0e6839abd9534db92d4e056c5
Summary:
The ProgressInner only exposes APIs for total (aggregated) progress. There is
no API to read individual progress. Make it only track the total progress. This
would make it easier to implement interior, lock-free mutability on ProgressInner.
The updater now needs `mut` temporarily, which will be dropped later (D26681784).
A test case is tweaked so progress does not go backwards.
Reviewed By: kulshrax
Differential Revision: D26681777
fbshipit-source-id: 4ad1b9173d5a2c2326e00c030d51f77e9b9458f3
Summary: Test both the HttpClient and Request events.
Reviewed By: kulshrax
Differential Revision: D26670325
fbshipit-source-id: ffbc4268f7de698830411434a769c8b1a4acd863
Summary:
This simplifies the code a bit and makes it look consistent with other event
listeners.
Reviewed By: kulshrax
Differential Revision: D26670318
fbshipit-source-id: f6eda9403bb6eb09a074544e672a45c84f38e2b1
Summary:
Add `RequestContext.event_listeners()` to register callbacks, and trigger the callbacks
when related events happen.
Reviewed By: kulshrax
Differential Revision: D26670323
fbshipit-source-id: 9b92b715444e83957c06b06f1ce696d4de3c0023
Summary:
This simplifies the logic a bit. There is no need for
`HandlerExt::with_payload` that is similar to `Request::body`.
Reviewed By: kulshrax
Differential Revision: D26670326
fbshipit-source-id: 9fe755821062ad6f2a74d6d5ba345620669f0f63
Summary:
This diff adds a gflag option to turn on `TreeOverlay`. As this diff, this
option only works on Windows.
Reviewed By: xavierd
Differential Revision: D25223471
fbshipit-source-id: ccab4c85cf4b08980e67814238457a8eb83af3dc
Summary:
This diff adds `TreeOverlay` that implements the `IOverlay` interface based on
`TreeOverlayStore`. At this point this class does not do much other than
forwarding calls to `TreeOverlayStore`. This layer will become necessary in the
future when we add file handling support to `TreeOverlay`.
Reviewed By: xavierd
Differential Revision: D25223473
fbshipit-source-id: 02d03081ba10c82123fe69c35dbc70f865c8370d
Summary:
This diff adds `TreeOverlayStore` that is used in following diffs to store tree
data in SQLite database. This class encapsulates the SQL statments needed for
storing trees.
Reviewed By: chadaustin
Differential Revision: D24083787
fbshipit-source-id: 61c08617fe50e7eac94c614948f5ba5355dba71a
Summary:
We don't need to care if a directory from overlay exists or just empty. This saves the overlay implementation from keeping track of what directories are stored and which are not.
This diff changes `Overlay::loadOverlayDir` to return `DirContents` instead of `std::optional`. The same method on `IOverlay` remain unchanged to give the backing overlay implementation the freedom to choose.
Reviewed By: chadaustin
Differential Revision: D25507406
fbshipit-source-id: f7edcc55485fabeedfe11e9f269eea15a3cc32ad
Summary:
This diff adds more logging to SQLite so we can see what statements are being
executed in logs. Setting `eden.fs.sqlite=DBG9` will show every SQL statement
being executed and bound values.
Reviewed By: chadaustin
Differential Revision: D25223472
fbshipit-source-id: ed089b7ec112c75d9f7bc63d9fe53f0ec2bd6420
Summary:
This diff introduces `transaction()` to `SqliteDatabase` to make managing SQLite transaction easier.
Usage:
```
db->transaction([](auto& txn) {
SqliteStatement(txn, "SELECT ...");
SqliteStatement(txn, "INSERT ...");
});
```
It will automatically roll back when exception happens, and commit when the closure finishes.
Reviewed By: chadaustin
Differential Revision: D25102179
fbshipit-source-id: 5a4ced8c6eb8016e15b8132be2b5abcc9760e2f9
Summary: This diff adds an alias `SqliteDatabase::Connection` to make it less mouthful when we want to reference the type of the SQLite connection we created
Reviewed By: xavierd
Differential Revision: D25386777
fbshipit-source-id: a6a58d522200fe0bf35ac52f6dad16063c0389d0
Summary:
To support the new _Relational Overlay_, we need to know what is actually being
modified by overlay. This diff adds two method `addChild` and `removeChild` to
IOverlay that supports passing such information to the actual implementation.
Reviewed By: chadaustin
Differential Revision: D24153544
fbshipit-source-id: 04e5f4c231ff9b5fe0ee5be082b1a75d78758bb4
Summary:
This is needed for the next diff in the stack to build on Windows. We never
build anything form `./inodes/overlay` on Windows.
Reviewed By: xavierd
Differential Revision: D24258241
fbshipit-source-id: e1c5234433a1ec92419dcb090c8949800efa605f
Summary:
This diff introduce `IOverlay` that provides a shared interface between
`FSOverlay` and `SqliteOverlay`. This allows us to share more code between
POSIX and Windows, and prepare for the new SQLite-backed Overlay
implementation.
Note as of this diff `IOverlay` is only at a very initial version. The
interface is far from complete and still need a few iteration to change.
Reviewed By: chadaustin
Differential Revision: D23941454
fbshipit-source-id: 69cce9d3852f21b2d19f528e7e05fb183538ace9
Summary:
This diff rollouts V2 of autocargo in an atomic way so there are quite a few things done here.
Arc lint support:
V1 used to be part of the default fbsource `arc lint` engine, but since V2 calls buck it must live in a separate lint engine. So this diff:
- Adds running `autocargo` as part of `arc lint-rust`
Mergedriver update:
- Mergedriver used in resolving conflicts on commits is now pointing to V2
- It handles files in `public_autocargo/` directories in addition to the ones containig generation preamble
Including regeneration results of running `common/rust/cargo_from_buck/bin/autocargo`. All the differences are accounted for:
- Some sections and attributes are removed as they can be autodiscovered by Cargo (like `lib.path = "src/lib.rs"` or empty [lib] section)
- "readme" attribute is properly defined as relative to Cargo.toml location rather than as hardcoded string
- "unittest = false" on a Buck rule propagates as "test = false; doctest = false" to Cargo
- "rusqlite" is not special-cased anymore, so the "budled" feature will have to be enabled using custom configuration if required by the project (for rust-shed in order to not break windows builds a default feature section was added)
- Files generated from thrift_library rules that do not support "rust" language are removed
- Custom .bzl rules that create rust artifacts (like `rust_python_extension`) are no longer ignored
Others:
- Changed `bin/cargo-autocargo` to be a wrapper for calling V2 via `cargo autocargo`
- Updated following files to use V2:
- `common/rust/tools/reindeer/version-bump`
- `remote_execution/rust/setup.sh`
- Removed few files from V1 that would otherwise interfere with V2 automatic regeneration/linting/testing
Reviewed By: zertosh
Differential Revision: D26728789
fbshipit-source-id: d1454e7ce658a2d3194704f8d77b12d688ec3e64
Summary:
Changes that could be done as a separate step from the rollout diff:
- Added README.md with documentation for developers
- Pointed `external_linter_tests/run_linter.sh` to MSDK/dotslash released autocargo
- Added `project_configs/ios_static_listing.toml` to reflect changes in `autocargo_projects.py` that were made in the meantime
- Added `scripts/run_tests` to run `arc external-linter-test` using cargo built autocargo binary
- Modified `third-party/rust/Cargo.toml` and run cargo-autocargo to match formatting of thirt party crates produced by V2
Reviewed By: ahornby
Differential Revision: D26728788
fbshipit-source-id: 361d9e2d41685f34eb4d20fc5ad9930f24b48f85
Summary:
Previously we were just logging whether derivation was successful or not.
Let's start logging the error as well.
Reviewed By: krallin
Differential Revision: D26750165
fbshipit-source-id: 03983cfa7bfbd5aeeed27ffac5a7df96c05e0967
Summary: Ordering is flaky, so sorting it.
Reviewed By: StanislavGlebik
Differential Revision: D26726727
fbshipit-source-id: dd60da022fe6fd2568be5b3108edc399c8db390c
Summary:
With the upcoming rollout of C++ Manifold client, it's useful to know which blobstores are which in our Scuba log, `mononoke_blobstore_trace`.
Pass a debug name down to help
Reviewed By: krallin
Differential Revision: D26673162
fbshipit-source-id: e7c16ad217d8daf21565939a45ac82204459055a
Summary:
Add a way to define event listeners. Define events on HttpClient and
Request(Info). They will be used by upcoming changes.
The idea is similar to GUI programming. A "control" has a list of "events" that
handlers can be defined on them.
This diff defines lists of events on the "client" and "request" types.
Areas this diff tries to improve:
- Make it easier to add new events (by using macro_rules).
- Make it easier to visually see all possible events.
Reviewed By: kulshrax
Differential Revision: D26670324
fbshipit-source-id: 92f74779f8e546491d0e922db27a4b87f527a5e9
Summary:
This makes it easier to access states defined in `RequestContext` from
`curl::Easy2<H>` types.
Reviewed By: kulshrax
Differential Revision: D26670317
fbshipit-source-id: 27eca9dcc11b14b5d41c8327448f7748ebc62e10
Summary:
Upcoming diffs extend the trait with new methods unrelated to configuration.
Rename to clarify.
Reviewed By: kulshrax
Differential Revision: D26670314
fbshipit-source-id: 7d33ebe22b26f1a286ae40c78f51f31a1a64957e
Summary:
Similar to the Streaming curl handler, add a RequestContext field to the Buffered
handler so the curl callbacks on the Handler can provide the Request
information like urls.
Reviewed By: kulshrax
Differential Revision: D26670321
fbshipit-source-id: de7abecf162c4aaed03d927c35516b6f8ac523ce
Summary:
Make `RequestContext` available in the streaming request. The `clone` will
be removed by a later change.
`dead_code` is temporarily allowed so the following won't be an error.
error: field is never read: `request_info`
--> src/handler/streaming.rs:24:5
|
24 | request_info: RequestContext,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
Reviewed By: kulshrax
Differential Revision: D26670319
fbshipit-source-id: 53a1deeece5a2059e7caa9d28ef00e083a27b722
Summary:
Add an "auto incremental" Id to uniquely identify requests. This allows external
logic to have a map from the Id to extra metadata not owned by this crate. Without
the Id, there is no way to tell if `RequestContext`s with a same url and method are
actually a same request or not.
Reviewed By: kulshrax
Differential Revision: D26670327
fbshipit-source-id: 60fa760432b23ab5334f22806e01304f9c160182
Summary:
The `RequestContext` is a subset of `Request` that are:
- Independent from curl types.
- Carry useful states, and make them available on Handler callbacks.
- For now, the "useful states" include url and method. They can be extended
later.
Reviewed By: kulshrax
Differential Revision: D26670320
fbshipit-source-id: 3d71d5fee8927dd57a52f51b212397710379e7fa
Summary: This was broken by D26702166 (373d9ade0a).
Reviewed By: sfilipco
Differential Revision: D26736392
fbshipit-source-id: 8bae1599922c05193eba529d7f74c585f20d6f91
Summary: This treats update_meta collection same way as update_content
Reviewed By: DurhamG
Differential Revision: D26694077
fbshipit-source-id: f2a7afb988eb99afa6e8f62ae6cda57a108a987d
Summary: This diff adds unit test for sparse checkout plan
Reviewed By: DurhamG
Differential Revision: D26673701
fbshipit-source-id: 8f810df317c3447f8445765e3a510559d4f1b378
Summary:
This diff integrates CheckoutPlan::with_sparse_profile_change into python code
It also updates test-update-over-sparse-profile-change.t to use native checkout, as this test now passes
Reviewed By: DurhamG
Differential Revision: D26670414
fbshipit-source-id: 73011217b4a0d80ef643b778cdaf75bbada5dcf2
Summary:
This method updates checkout plan to account for sparse profile change
The logic is somewhat similar to sparse.py, except it is smaller because it does not account for merges
Reviewed By: DurhamG
Differential Revision: D26670413
fbshipit-source-id: 54294ad7f1c61e39400450ff139f40ac8fffdd62
Summary:
This matcher combinator is useful when checking out across sparse profile change, since it allows to list files that has been affected by the sparse profile chane
Python has similar combinator xormatcher
Reviewed By: DurhamG
Differential Revision: D26670412
fbshipit-source-id: 0f84835aad16177e79e87d15b41b2caef4374605
Summary:
This diff introduces support for fixed sparse profile into native checkout.
Sparse profile change is not yet supported.
This also updates test-sparse.t to use native checkout
Reviewed By: DurhamG
Differential Revision: D26648490
fbshipit-source-id: 516308dba096189e4657715214ad2a5b61816c49
Summary:
As Rice is replacing the overlay, introduce some integration tests
around the subtler interactions of mode bits and status.
Reviewed By: genevievehelsel
Differential Revision: D26707622
fbshipit-source-id: 429ba404c1c0655f8fff393664bc5ba9e3b0301f
Summary:
There are some reports about truncated latest files on NFS hosts (where the
hgcache portion might be outside NFS).
Fsync files in hgcache too. With indexedlog the total number of files is
bounded so listing them is considered bounded time.
Reviewed By: kulshrax
Differential Revision: D26741889
fbshipit-source-id: a789396cc5802110eb55fa6b52b5124cd9a3dbf3
Summary: It seems there is no "tty" check. So let's disable colors for tests explicitly.
Reviewed By: DurhamG
Differential Revision: D26708620
fbshipit-source-id: 802537af0d3f580c39a746b6aa6a617c9fb4c9c1
Summary: A few new config options were added to `EdenApiBuilder` without corresponding setting methods, meaning that they could only be set via an hgrc config file. This diff adds the methods so that Rust code can manually configure these settings.
Differential Revision: D26709471
fbshipit-source-id: 6af645961ed50526ccc04990b82ee201211b6ad2
Summary: Add `Content-Length` to `ResponseMeta` struct. Will be used for logging purposes.
Differential Revision: D26709386
fbshipit-source-id: 4346627e3883d00350738cca1e71004f8d407c0d
Summary:
With Rust IO, `hg` is more willing to report "broken pipe" issues:
$ hg export 'desc(2)' | head -7 > ../a.patch
+ abort: The pipe is being closed. (os error 232)
$ hg export tip > out
Fix the test by using a temporary file.
Reviewed By: sfilipco
Differential Revision: D26730868
fbshipit-source-id: 8446528cad72713329b173eaa10ee109e8dfa956
Summary:
Te old _isstdout check is no longer effective with Rust IO. That breaks editors
like vim. Fix it by replacing the _isstdout check with istty check.
Reviewed By: sfilipco
Differential Revision: D26729684
fbshipit-source-id: fc79eda30c3a585ba6d5960e1f72bfc0fc9df254
Summary:
Currently running native checkout shows much higher sys time then regular checkout
One theory that this is due to high scheduler overhead due to large number small tasks spawned with spawn_blocking
This diff batches 100 operations before spawning blocking proc
Reviewed By: quark-zju
Differential Revision: D26620395
fbshipit-source-id: f5be84c3ee14ffc55e4332e714a48f55701d5f8f
Summary:
Better GitRepo name in gitimport logs.
When several git-repositories was handled by the same running instance, and all of them being called `.git`in the logs where not that useful.
Examples (when no name explicitly provided and git-import derives a name from the path to the git repository):
path: `/home/matshakanson/.cache/git_cache/aosp/device/generic/goldfish`
Note that the opened path is resolved to `/home/matshakanson/.cache/git_cache/aosp/device/generic/goldfish/.git` doe to not being a barren repository.
derived name previous revision: `.git`
derived name this revision: `/home/matshakanson/.cache/git_cache/aosp/device/generic/goldfish`
Now why not just remove the `.git` portion if present (to handle barren repositories)? Well we often have a big tree of git repositories we opreate on, and the final directory name in the tree is not unique. So instead using the full path to remove any ambiguity.
Note that this is just the default naming derived if the caller does not specify their own name .
Reviewed By: krallin
Differential Revision: D26697498
fbshipit-source-id: 3de893406525f88556f5bcd87abe238b7f2d8929
Summary: Since we don't have repo-lock db for backup repos. I'm making them readonly D26693725 and add bypass for sync job.
Reviewed By: krallin
Differential Revision: D26693675
fbshipit-source-id: 2eaa9419850c3e7a5df45871424283ee280f5ec1
Summary:
Recently there are reports about "remote/master" pointing to a non-existed
commit, missing tree data, and general hard-reboot issues. Attempt to reduce
the chance of losing data by adding the critical paths to the fsync list.
Reviewed By: kulshrax
Differential Revision: D26708225
fbshipit-source-id: ae52534fdbf8d9d35498d30c24bdce7f5d9a96a3
Summary: Currently HGPLAIN=1 will disable the -p flag, even though it's analogue, -n, works fine. This should allow either flag to work with or without HGPLAIN
Reviewed By: DurhamG
Differential Revision: D26440729
fbshipit-source-id: f7058a82c32229f5ff9867f299ed72fe167c7104
Summary:
`folly::format` is a problematic API because it returns a `Formatter` object that may store references to arguments as its comment warns:
```
* Formatter class.
*
* Note that this class is tricky, as it keeps *references* to its lvalue
* arguments (while it takes ownership of the temporaries), and it doesn't
* copy the passed-in format string. Thankfully, you can't use this
* directly, you have to use format(...) below.
```
This has negative safety and performance (encourages reuse of the same formatter) implications because contrary to what the comment says you can use the object directly since it's returned from `folly::format`. For example
```
auto f = folly::format(std::string("{}"), 42);
f.str();
```
is a UB with no compile-time diagnostic (only caught by ASAN).
It's also unnecessary because the `Formatter` object is usually converted to string straight away via `str()` or written to an output stream. Reusing the formatter doesn't make much sense either because the expensive part is formatting, not capturing arguments.
This diff deprecates `folly::format` suggesting `fmt::format` as a potential replacement. `fmt::format` doesn't have the above problem because arguments are always in scope. It also has the following advantages:
* Better compile times.
* Compile-time format string checks.
* Compatibility with C++20 `std::format`.
* Better performance, particularly with format string compilation which eliminates format string processing overhead altogether.
* Smaller binary footprint.
Also remove `folly::writeTo` which is no longer used and the `format_nested_fbstrings` benchmark which is identical to `format_nested_strings` since there is no `fbstr()` any more.
Reviewed By: yfeldblum
Differential Revision: D26391489
fbshipit-source-id: f0309e78db0eb6d8c22b426d4cc333a17c53f73e
Summary:
Although thrift compact_protocol had support for Bytes, the default deserializer entry point was forcing use of Cursor<&[u8]> which meant we weren't seeing the expected improvement in memory usage for code like Mononoke's packblob deserialization from Bytes.
This change updates compact_protocol::deserialize in terms of a new type DeserializeSource. DeserializeSource has conversions that it can take ownership of Bytes and items that are Into<Bytes>, whilst still being able to copy data from types that are AsRef<[u8]>.
Due to lack of negative bounds or specialization, this was a little verbose:
- Bytes is AsRef<&[u8]>, hence the need to define the ref type conversions in bufext explicitly with impl_deser_as_ref_u8!()
- From<&Bytes> is not defined upsteam, which results in needing to declare Into<Bytes> types individually with impl_deser_into_bytes so that From<&Bytes> can be handled ( otherwise one gets the "upstream crates may add a new impl of trait error" )
As the above was a bit fiddly I initially had a new compact_protocol::deserialize_from_bytes() entry point, but that meant callsites already passing Bytes, &Bytes or Vec<u8> needed updating to benefit from the copy removal, which seemed sub-optimal.
There are of course some callsites where they have a Vec<u8> and could pass ownership but don't. They will need updating to see a benefit. (e.g. compact_protocol::deserialize(&v) to compact_protocol::deserialize(v) ). That is not included in this change, I'll take a look at Mononoke's in a separate diff.
Reviewed By: markbt
Differential Revision: D26663804
fbshipit-source-id: 9a81f3c1dbef9d1b245492212afe7c2a4baff942
Summary:
Remove a bit of boilerplate in the definition of subcommands, and pave
the way for sub-sub commands.
Reviewed By: xavierd
Differential Revision: D26416574
fbshipit-source-id: 1477505cab6c3de2c7ac14fe862d366a707d155b
Summary: This should fix issues where master points to an unknown commit somehow.
Reviewed By: DurhamG
Differential Revision: D26648623
fbshipit-source-id: 63f7a4b834bf19a7849a1c3771921e6b1e5919d3
Summary:
This diff allows the user to specify a merge function in the shape of `merge(&mut T, T);` to customizing merging behavior.
This is used in the next diff to merge the `HashMap` that catches all unknown fields.
Reviewed By: xavierd
Differential Revision: D26415382
fbshipit-source-id: 10801ddc7d41b82d8d165a8b63466aa9b92baaab
Summary: With this diff we can start to handle concrete error types, return correct exit code for Thrift IO errors for example.
Reviewed By: xavierd
Differential Revision: D26412948
fbshipit-source-id: f598ed2d9187126509c149f9d6293025d0f39968
Summary:
hg status was throwing an error on Py3 OSX because a fallback path
returned bytes instead of string. This fixes that.
Reviewed By: sfilipco, singhsrb
Differential Revision: D26702166
fbshipit-source-id: fa32e5b312377a899b6af16f40bca051f44ed6c3
Summary:
Xavier reported seeing a pile of redundant checkout events in his
journal, which caused Watchman to issue a series of no-op, sequential hg
status calls, which caused Buck to time out waiting for Watchman.
We're not sure what paths cause Mercurial to issue no-op
checkOutRevision Thrift calls, but we can certainly filter them out
inside of the journal.
Reviewed By: fanzeyi
Differential Revision: D26699828
fbshipit-source-id: f738b53bbafa4027dd70322d64413246bb5bb828
Summary: This simply adds the types to implement the CREATE RPC call.
Reviewed By: kmancini
Differential Revision: D26654767
fbshipit-source-id: 5972102aebb3b06c6838a28f3a191304efc7c945
Summary:
The MKDIR RPC is the first RPC that modifies the working copy. It is only
partially implemented due to the parent directory attributes not being
collected just yet. Implementing these will be essential for good caching on
the client side. For simplicity reason, this isn't done just yet.
Reviewed By: kmancini
Differential Revision: D26644056
fbshipit-source-id: f99add63a2ce5789a9aa81cefe4d04c2f4a741ed
Summary: This adds all the types necessaryt to implement the MKDIR RPC.
Reviewed By: kmancini
Differential Revision: D26644057
fbshipit-source-id: cfbcf3f0a7212433eba67f2266d5f7bcc2906a88
Summary:
This is a fairly common pattern in the NFS code, and we can reduce code
duplication by automatically implementing the XdrTrait.
Reviewed By: kmancini
Differential Revision: D26639683
fbshipit-source-id: 6e9cb14ce1538834224017b8ef88955e563d6723
Summary: There are no correct uses of the catch-all overload of `folly::exceptionStr`. Every use is a bug of some kind, leading to the impression that this overload ought to be removed.
Differential Revision: D26539622
fbshipit-source-id: dc2ca0781ea02f1327a334bb1fe2e533fa46d1b3
Summary:
If multiple requests to fetch a tree come in at the same time fast enough (where the first request hasn't had the chance to retrieve the data from Mercurial and save it in the cache), we will request to download the tree multiple times. If the tree is not in the hgcache, this means we will make an extra round trip to the server. There is no limit to how many concurrent requests can be made, meaning we could make a large amount of round trips to the server for the same tree.
This adds a tracking mechanism in which we track in progress tree fetches, and if we get a request that is already in the queue or being processed, we just return a future that will be fulfilled by the first request, instead of placing this duplicate request in the queue as well.
This also makes sure if we get a duplicate request, but the duplicate request has a higher priority than the request already in the queue, we will update the priority of the request in the queue.
Reviewed By: chadaustin
Differential Revision: D26355499
fbshipit-source-id: 8d3192cf0f5628c650715f4597c92fc8c9238650
Summary: We have a number of sleeps in our integration tests. The two main reasons are configs & tunables that need reloading. Currently, we have no way of force-reloading those.
Reviewed By: krallin
Differential Revision: D26615732
fbshipit-source-id: 217c4ae039abd398972b4a9764d08e18d6182493
Summary:
This dag periodically reloads the dag from storage.
It currently loads a simple dag that has no update logic because that is what
the manager returs. It's not relevant for this code.
This is probably the last piece before we refactor construction to take a
SegmentedChangelogConfig. To be seen how much will be strict types and how much
will be Arc<dyn SegmentedChangelog>.
Reviewed By: krallin
Differential Revision: D26681458
fbshipit-source-id: 6056d00db6f25616e8158278702f9f4120b92121
Summary: There were no unit test for SegmentedChangelogManager so I added one.
Reviewed By: krallin
Differential Revision: D26681459
fbshipit-source-id: 40ceefe7b89043ae6d2c4d31a2adf504245161fb
Summary:
A placeholder for convenience functions.
Right not it has a proxy for the head of the dag.
Reviewed By: krallin
Differential Revision: D26681457
fbshipit-source-id: 6856abbf2685407f96701ea5a508342373503360
Summary:
This is a long standing bug whereby if you made the terminal too thin,
the formatting code would crash.
This fix just prevents underflow in the precision format string (and
alignment).
Reviewed By: fanzeyi
Differential Revision: D26673865
fbshipit-source-id: 945e6f227c19962ac0926e117600aa9d6a990305
Summary:
I accidentally broke this in D26544410 (097e4ad00c) when I updated it to use
schedule_stats_aggregation_preview (in Tokio 0.2 and up, you can't create
an interval stream off the runtime, but in Tokio 0.1 you could).
We only use this method in 2 places, so it probably makes sense to just get rid
of it anyway, which is what this diff does. The alternative is better as it
spawns this unconditionally, so if we get it wrong, it'll fail in tests,
even though our tests don't pass `--fb303-port`, whereas
`start_fb303_and_stats_agg` will only start stats aggregation if its passed.
Reviewed By: ahornby
Differential Revision: D26690223
fbshipit-source-id: 7d151a3c46fa428f00ac32601da161609fb498f7
Summary:
The NFS RPC description is filled with variant over nfsstat3 with only 2 cases:
NFS3_OK, and the default one. I was feeling bad having to write the same code
again and again for the deserialize part of the XdrTrait, and thus came up with
a template solution that enables us to remove all of the boilerplate code.
The only drawback is that this moves the variant one additional layer down, and
that means an extra layer of brace when initializing it. From what I know,
this is caused by the -Wmissing-braces warning, maybe we could remove that
warning?
Reviewed By: kmancini
Differential Revision: D26627163
fbshipit-source-id: ab56dee42273f180b2edf4f529221a15154ac2fb
Summary: This seems to have been reverted by accident in D26618363 (f317302b0f).
Differential Revision: D26689734
fbshipit-source-id: e86451716cab3cc62f517c3f5fca7898d1a25095