Summary:
This allows (actually forces) us to drop a bunch of `as_ref` calls. It also
makes upcoming diffs look cleaner.
Reviewed By: jsgf
Differential Revision: D6585202
fbshipit-source-id: a53902696cf12050a851c30b557aeefe09c41903
Summary:
Like the other BlobState components, Linknode was too generic -
reduce down to a practical set for live implementations.
Error handling is not great here or in Bookmarks, but I'm going to await the
decision on moving to Failure before I improve it.
Reviewed By: jsgf
Differential Revision: D6459012
fbshipit-source-id: 00314309f62ba070b5908a28f5174a31b6dd0d84
Summary:
Don't use failure's bail!() and ensure!() macros.
Instead, failure_ext provides:
- bail_err!(err) - Converts its single parameter to the expected error and returns; ie `return Err(From::from(err));`
- bail_msg!(fmt, ...) - takes format string parameters and returns a `failure::err_msg()` error
- ensure_err!(), ensure_msg!() - corresponding changes
Also:
- remove all stray references to error-chain
- remove direct references to failure_derive (it's reexported via failure and failure_ext)
- replace uses of `Err(foo)?;` with `bail_err!()` (since `bail_err` unconditionally returns, but `Err(x)?` does not in principle, which can affect type inference)
Reviewed By: kulshrax
Differential Revision: D6507717
fbshipit-source-id: 635fb6f8c96d185b195dff171ea9c8db9e83af10
Summary:
This diff upgrades the version of rustc in fbcode to version 1.22.1,
including the requisite third-party2 symlink updates for the `rust` and
`rust-crates-io` projects, config.py changes in the third-party2 and
third-party-buck directories, and code fixes for Rust targets in common/rust
and scm/mononoke.
Reviewed By: jsgf
Differential Revision: D6489808
fbshipit-source-id: 48377ea937916beb7dae7a3806de1fce1e29dd24
Summary:
Convert scm/mononoke to use failure, and update common/rust crates it depends on as well.
What it looks like is a lot of deleted code...
General strategy:
- common/rust/failure_ext adds some things that are in git failure that aren't yet in crates.io (`bail!` and `ensure!`, `Result<T, Error>`)
- everything returns `Result<T, failure::Error>`
- crates with real error get an error type, with a derived Fail implementation
- replicate error-chain by defining an `enum ErrorKind` where the fields match the declared errors in the error! macro
- crates with dummy error-chain (no local errors) lose it
- `.chain_err()` -> `.context()` or `.with_context()`
So far the only place I've needed to extract an error is in a unit test.
Having a single unified error type has simplified a lot of things, and removed a lot of error type parameters, error conversion, etc, etc.
Reviewed By: sid0
Differential Revision: D6446584
fbshipit-source-id: 744640ca2997d4a85513c4519017f2e2e78a73f5
Summary:
This makes it quite easy to write out linknodes.
Also regenerate linknodes for our test fixtures -- the next commit will bring
them in.
Reviewed By: jsgf
Differential Revision: D6214033
fbshipit-source-id: 3b930fe9eda45a1b7bc6f0b3f81dd8af102061fc
Summary: This will be used by generate_memblob_repo.py
Reviewed By: jsgf
Differential Revision: D6215395
fbshipit-source-id: d8dfb14514dad4396a1923b034500c1a67ac94dc
Summary:
This field is optional. We need to ensure in linknodes that the
version is always set to a fixed value so that linknode blobs written out to
disk are deterministic.
Reviewed By: jsgf
Differential Revision: D6214032
fbshipit-source-id: c1eea7bf28bb096c1d23165e1f50ff2dc6d21274
Summary:
We need ownership of the buffer in all of these cases, and
`AsRef<Path>` could potentially create unnecessary copies.
Reviewed By: jsgf
Differential Revision: D6214034
fbshipit-source-id: 806a87bfe3b125febaaaaf26c8b8dcac407de145
Summary: Colons are reserved on Windows
Reviewed By: farnz
Differential Revision: D6202655
fbshipit-source-id: 0918b43dd36aa3990064bf1c79893b20570ee82c
Summary: All implementations are expected to be, and this simplifies downstream code.
Reviewed By: farnz
Differential Revision: D6192078
fbshipit-source-id: bf63bbe84db7919e3c6fa808da1c5c25c25d2ec8
Summary:
RepoPath also captures whether this is a file or a directory (tree), which is
important for linknodes.
Also pass a `RepoPath` in, not just a `&RepoPath` -- the path is pretty much
always going to be cloned, so might as well.
Reviewed By: StanislavGlebik
Differential Revision: D6098520
fbshipit-source-id: c1a8d5defa841960b53fa919e6d8d59fb33d5c28
Summary: Upcoming work will want to use this.
Reviewed By: StanislavGlebik
Differential Revision: D6097836
fbshipit-source-id: 23532e3d1182179ea2e454df0329ba10f50d565f
Summary: We'll reuse these tests for a file-based implementaion as well.
Reviewed By: farnz
Differential Revision: D6059222
fbshipit-source-id: ff63e21badda455bc83c34da2acd08395e906826
Summary:
Some implementations like file-based linknodes won't have this data.
The wrapper struct is required so that `Display` can be implemented.
Reviewed By: farnz
Differential Revision: D6059220
fbshipit-source-id: 705e0152abcff59cf0584741430b20e34a2cd652