mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
mononoke: Remove failure_ext dependencies (4/N)
Reviewed By: jsgf Differential Revision: D18903400 fbshipit-source-id: 9543c5e831eba285ccffea44f30ec39802555a9a
This commit is contained in:
parent
ea4c5f87a0
commit
29617076d4
@ -6,7 +6,6 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use std::result::Result;
|
||||
use std::time::Instant;
|
||||
|
||||
use aclchecker::Identity;
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use anyhow::{bail, format_err, Error, Result};
|
||||
use benchmark_lib::{new_benchmark_repo, GenManifest};
|
||||
use blobrepo::BlobRepo;
|
||||
use clap::{App, Arg};
|
||||
use cmdlib::args;
|
||||
use context::CoreContext;
|
||||
use derived_data::BonsaiDerived;
|
||||
use failure_ext::{bail, format_err, Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::Future;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
|
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
//! Utilities to generate reasonably looking stack of changesets
|
||||
use anyhow::Error;
|
||||
use blobrepo::{save_bonsai_changesets, BlobRepo};
|
||||
use blobstore::Storable;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{future, stream, Future, Stream};
|
||||
use futures_ext::FutureExt;
|
||||
use mononoke_types::{
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
//! Main function is `new_benchmark_repo` which creates `BlobRepo` which delay applied
|
||||
//! to all underlying stores, but which all the caching enabled.
|
||||
use anyhow::{Error, Result};
|
||||
use blobrepo::BlobRepo;
|
||||
use blobstore::Blobstore;
|
||||
use bonsai_globalrev_mapping::SqlBonsaiGlobalrevMapping;
|
||||
@ -19,7 +20,6 @@ use cacheblob::{dummy::DummyLease, new_cachelib_blobstore};
|
||||
use changesets::{CachingChangesets, ChangesetEntry, ChangesetInsert, Changesets, SqlChangesets};
|
||||
use context::CoreContext;
|
||||
use dbbookmarks::SqlBookmarks;
|
||||
use failure_ext::{Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use filenodes::{CachingFilenodes, FilenodeInfo, Filenodes};
|
||||
use filestore::FilestoreConfig;
|
||||
|
@ -9,9 +9,9 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{format_err, Error};
|
||||
use ascii::AsciiString;
|
||||
use cloned::cloned;
|
||||
use failure_ext::{format_err, Error};
|
||||
use futures::{prelude::*, stream};
|
||||
use futures_ext::{try_boxfuture, BoxFuture, FutureExt};
|
||||
use slog::{info, Logger};
|
||||
|
@ -9,12 +9,11 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{bail, Context, Error};
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{
|
||||
bail, Compat, Error, FutureFailureErrorExt, FutureFailureExt, ResultExt, StreamFailureErrorExt,
|
||||
};
|
||||
use failure_ext::{Compat, FutureFailureErrorExt, FutureFailureExt, StreamFailureErrorExt};
|
||||
use futures::{
|
||||
future::{self, SharedItem},
|
||||
stream::{self, Stream},
|
||||
|
@ -6,7 +6,7 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::{format_err, Error, Result};
|
||||
use anyhow::{format_err, Error, Result};
|
||||
use futures::{
|
||||
sync::{mpsc, oneshot},
|
||||
Future, IntoFuture, Stream,
|
||||
|
@ -19,9 +19,9 @@ use std::ops::Deref;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Error;
|
||||
use ascii::AsciiString;
|
||||
use cloned::cloned;
|
||||
use failure_ext::Error;
|
||||
use futures::{future, Future, Stream};
|
||||
use futures_ext::{BoxFuture, FutureExt, StreamExt};
|
||||
use slog::{debug, error, info, Logger};
|
||||
|
@ -7,13 +7,12 @@
|
||||
*/
|
||||
|
||||
use crate::changeset::{visit_changesets, ChangesetVisitMeta, ChangesetVisitor};
|
||||
use crate::errors::*;
|
||||
use anyhow::{bail, Error};
|
||||
use blobrepo::derive_hg_manifest::derive_hg_manifest;
|
||||
use blobrepo::internal::IncompleteFilenodes;
|
||||
use blobrepo::BlobRepo;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::bail;
|
||||
use futures::{
|
||||
future::{self, Either},
|
||||
Future, Stream,
|
||||
|
@ -6,11 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use blobrepo::BlobRepo;
|
||||
use chashmap::CHashMap;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Result};
|
||||
use futures::{
|
||||
sync::mpsc::{self, Sender},
|
||||
Future, Stream,
|
||||
|
@ -6,7 +6,6 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Result, ResultExt};
|
||||
use mercurial_types::HgChangesetId;
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -18,9 +18,9 @@ pub use crate::bonsai::{BonsaiMFVerify, BonsaiMFVerifyDifference, BonsaiMFVerify
|
||||
pub use crate::changeset::{visit_changesets, ChangesetVisitor};
|
||||
pub use crate::errors::ErrorKind;
|
||||
|
||||
use anyhow::Error;
|
||||
use blobrepo::BlobRepo;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{future::ok, Future};
|
||||
use futures_ext::FutureExt;
|
||||
use manifest::BonsaiDiffFileChange;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::Error;
|
||||
use anyhow::{Error, Result};
|
||||
use futures::{Async, Future, Poll};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
|
||||
@ -20,8 +20,6 @@ use blobstore::Blobstore;
|
||||
use context::CoreContext;
|
||||
use mononoke_types::BlobstoreBytes;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Rocksblob {
|
||||
db: Db,
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use anyhow::{format_err, Error};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{format_err, Error};
|
||||
use futures::sync::{mpsc, oneshot};
|
||||
use futures::{future, Future, IntoFuture, Stream};
|
||||
use futures_ext::{try_boxfuture, BoxFuture, FutureExt, StreamExt};
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
use super::BonsaiGlobalrevMappingEntry;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
|
@ -12,9 +12,9 @@ use sql::Connection;
|
||||
pub use sql_ext::SqlConstructors;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use anyhow::Error;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::future::Future;
|
||||
use futures::{future, IntoFuture};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
@ -26,7 +26,7 @@ use std::sync::Arc;
|
||||
|
||||
mod errors;
|
||||
|
||||
pub use crate::errors::*;
|
||||
pub use crate::errors::ErrorKind;
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct BonsaiGlobalrevMappingEntry {
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
use super::{BonsaiHgMapping, BonsaiHgMappingEntry, BonsaiOrHgChangesetIds};
|
||||
use crate::errors::Error;
|
||||
use anyhow::Error;
|
||||
use bonsai_hg_mapping_entry_thrift as thrift;
|
||||
use bytes::Bytes;
|
||||
use cachelib::VolatileLruCachePool;
|
||||
@ -97,7 +97,7 @@ impl CachingBonsaiHgMapping {
|
||||
}
|
||||
}
|
||||
|
||||
fn memcache_deserialize(buf: IOBuf) -> ::std::result::Result<BonsaiHgMappingEntry, ()> {
|
||||
fn memcache_deserialize(buf: IOBuf) -> Result<BonsaiHgMappingEntry, ()> {
|
||||
let bytes: Bytes = buf.into();
|
||||
|
||||
let thrift_entry = compact_protocol::deserialize(bytes).map_err(|_| ());
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
use super::BonsaiHgMappingEntry;
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
|
@ -15,6 +15,7 @@ use sql::Connection;
|
||||
pub use sql_ext::SqlConstructors;
|
||||
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::{Error, Result};
|
||||
use cloned::cloned;
|
||||
use context::{CoreContext, PerfCounterType};
|
||||
use futures::{future, Future, IntoFuture};
|
||||
@ -30,7 +31,7 @@ mod errors;
|
||||
mod mem_writes;
|
||||
|
||||
pub use crate::caching::CachingBonsaiHgMapping;
|
||||
pub use crate::errors::*;
|
||||
pub use crate::errors::ErrorKind;
|
||||
pub use crate::mem_writes::MemWritesBonsaiHgMapping;
|
||||
|
||||
define_stats! {
|
||||
|
@ -6,6 +6,7 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Error;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use futures::{future::ok, Future};
|
||||
@ -15,10 +16,7 @@ use mononoke_types::{ChangesetId, RepositoryId};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use super::{
|
||||
errors::Error, filter_fetched_ids, BonsaiHgMapping, BonsaiHgMappingEntry,
|
||||
BonsaiOrHgChangesetIds,
|
||||
};
|
||||
use super::{filter_fetched_ids, BonsaiHgMapping, BonsaiHgMappingEntry, BonsaiOrHgChangesetIds};
|
||||
|
||||
/// A bonsai <-> hg mapping wrapper that reads from the underlying mapping but writes to memory.
|
||||
/// It can be used to prevent a piece of code to do writes to the db but at the same time give
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use failure_ext::Error;
|
||||
use anyhow::Error;
|
||||
use futures::Future;
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
|
@ -8,13 +8,13 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use anyhow::{bail, format_err, Error, Result};
|
||||
use bookmarks::{
|
||||
Bookmark, BookmarkHgKind, BookmarkName, BookmarkPrefix, BookmarkUpdateLogEntry,
|
||||
BookmarkUpdateReason, Bookmarks, BundleReplayData, Freshness, Transaction,
|
||||
};
|
||||
use cloned::cloned;
|
||||
use context::{CoreContext, PerfCounterType};
|
||||
use failure_ext::{bail, format_err, Error, Result};
|
||||
use futures::{
|
||||
future::{self, loop_fn, Loop},
|
||||
stream, Future, IntoFuture, Stream,
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use anyhow::Error;
|
||||
use bookmarks::{
|
||||
Bookmark, BookmarkHgKind, BookmarkName, BookmarkPrefix, BookmarkUpdateLogEntry,
|
||||
BookmarkUpdateReason, Bookmarks, BundleReplayData, Freshness,
|
||||
};
|
||||
use context::CoreContext;
|
||||
use dbbookmarks::{SqlBookmarks, SqlConstructors};
|
||||
use failure_ext::Error;
|
||||
use fbinit::FacebookInit;
|
||||
use futures::{Future, Stream};
|
||||
use maplit::hashmap;
|
||||
|
@ -10,8 +10,8 @@ use crate::{
|
||||
Bookmark, BookmarkHgKind, BookmarkName, BookmarkPrefix, BookmarkUpdateLogEntry,
|
||||
BookmarkUpdateReason, Bookmarks, Freshness, Transaction,
|
||||
};
|
||||
use anyhow::{Error, Result};
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Result};
|
||||
use futures::{future, stream, Future, Stream};
|
||||
use futures_ext::{BoxFuture, BoxStream, FutureExt, StreamExt};
|
||||
use mononoke_types::{ChangesetId, RepositoryId, Timestamp};
|
||||
|
@ -9,9 +9,9 @@
|
||||
#![deny(warnings)]
|
||||
#![feature(never_type)]
|
||||
|
||||
use anyhow::{bail, format_err, Error, Result};
|
||||
use ascii::{AsciiChar, AsciiString};
|
||||
use context::CoreContext;
|
||||
use failure_ext::{bail, format_err, Error, Result};
|
||||
use futures_ext::{BoxFuture, BoxStream};
|
||||
use mercurial_types::HgChangesetId;
|
||||
use mononoke_types::{ChangesetId, RawBundle2Id, RepositoryId, Timestamp};
|
||||
@ -107,7 +107,7 @@ impl Bookmark {
|
||||
}
|
||||
}
|
||||
|
||||
type FromValueResult<T> = ::std::result::Result<T, FromValueError>;
|
||||
type FromValueResult<T> = Result<T, FromValueError>;
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
|
||||
pub struct BookmarkName {
|
||||
|
@ -12,11 +12,11 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use anyhow::Error;
|
||||
use blobrepo::BlobRepo;
|
||||
use bookmarks::BookmarkName;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{future, stream, sync, Future, Stream};
|
||||
use futures_ext::{spawn_future, BoxFuture, FutureExt, StreamExt};
|
||||
use futures_stats::Timed;
|
||||
|
@ -6,11 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Error;
|
||||
use blobrepo::BlobRepo;
|
||||
use bookmarks::BookmarkName;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{future, Future, IntoFuture, Stream};
|
||||
use futures_ext::{spawn_future, FutureExt};
|
||||
use manifest::{Entry, ManifestOps};
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
use super::{ChangesetEntry, ChangesetInsert, Changesets};
|
||||
use anyhow::Error;
|
||||
use bytes::Bytes;
|
||||
#[cfg(test)]
|
||||
use caching_ext::MockStoreStats;
|
||||
@ -28,8 +29,6 @@ use std::collections::HashSet;
|
||||
use std::iter::FromIterator;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::errors::*;
|
||||
|
||||
define_stats! {
|
||||
prefix = "mononoke.changesets";
|
||||
memcache_hit: timeseries("memcache.hit"; RATE, SUM),
|
||||
@ -174,7 +173,7 @@ impl Changesets for CachingChangesets {
|
||||
}
|
||||
}
|
||||
|
||||
fn deserialize_changeset_entry(buf: IOBuf) -> ::std::result::Result<ChangesetEntry, ()> {
|
||||
fn deserialize_changeset_entry(buf: IOBuf) -> Result<ChangesetEntry, ()> {
|
||||
let bytes: Bytes = buf.into();
|
||||
|
||||
compact_protocol::deserialize(bytes)
|
||||
|
@ -6,7 +6,6 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
use mononoke_types::ChangesetId;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::{Error, Result};
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::{CoreContext, PerfCounterType};
|
||||
@ -30,7 +31,7 @@ mod test;
|
||||
mod wrappers;
|
||||
|
||||
pub use caching::{get_cache_key, CachingChangesets};
|
||||
pub use errors::*;
|
||||
pub use errors::ErrorKind;
|
||||
|
||||
define_stats! {
|
||||
prefix = "mononoke.changesets";
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Error;
|
||||
use context::CoreContext;
|
||||
use futures_ext::BoxFuture;
|
||||
use mononoke_types::{ChangesetId, RepositoryId};
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::{ChangesetEntry, ChangesetInsert, Changesets};
|
||||
|
||||
impl Changesets for Arc<dyn Changesets> {
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
use std::{collections::HashMap, path::Path, sync::Arc};
|
||||
|
||||
use anyhow::{bail, format_err, Error, Result};
|
||||
use clap::{App, Arg, ArgGroup, ArgMatches};
|
||||
use cloned::cloned;
|
||||
use failure_ext::{bail, format_err, Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::Future;
|
||||
use futures_ext::{try_boxfuture, BoxFuture, FutureExt};
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
use std::{cmp::min, fs, io, path::Path, str::FromStr, time::Duration};
|
||||
|
||||
use anyhow::{bail, format_err, Context, Error, Result};
|
||||
use cloned::cloned;
|
||||
use failure_ext::{bail, format_err, Error, Result, ResultExt};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::{Future, IntoFuture};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
use std::thread::{self};
|
||||
|
||||
use anyhow::{format_err, Error};
|
||||
use clap::ArgMatches;
|
||||
use failure_ext::{format_err, Error};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::Future;
|
||||
use services::{self, AliveService};
|
||||
|
@ -27,11 +27,7 @@ impl<D: Decorator> Drain for SimpleFormatWithError<D> {
|
||||
type Ok = ();
|
||||
type Err = io::Error;
|
||||
|
||||
fn log(
|
||||
&self,
|
||||
record: &Record,
|
||||
values: &OwnedKVList,
|
||||
) -> ::std::result::Result<Self::Ok, Self::Err> {
|
||||
fn log(&self, record: &Record, values: &OwnedKVList) -> Result<Self::Ok, Self::Err> {
|
||||
self.decorator.with_record(record, values, |decorator| {
|
||||
write!(decorator, "{}\n", record.msg())?;
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
use anyhow::Error;
|
||||
use blobrepo::BlobRepo;
|
||||
use context::CoreContext;
|
||||
use derived_data::BonsaiDerived;
|
||||
use failure_ext::Error;
|
||||
use futures::Future;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use mononoke_types::{ChangesetId, ContentId, FsnodeId};
|
||||
|
@ -367,7 +367,7 @@ mod tests {
|
||||
|
||||
let unode_id = runtime.block_on(f).unwrap();
|
||||
// Make sure it's saved in the blobstore
|
||||
let root_unode: ::std::result::Result<_, Error> =
|
||||
let root_unode: Result<_> =
|
||||
runtime.block_on(unode_id.load(ctx.clone(), repo.blobstore()).from_err());
|
||||
let root_unode = root_unode.unwrap();
|
||||
assert_eq!(root_unode.parents(), &vec![parent_unode_id]);
|
||||
@ -426,7 +426,7 @@ mod tests {
|
||||
);
|
||||
let unode_id = runtime.block_on(f).unwrap();
|
||||
|
||||
let unode_mf: ::std::result::Result<_, Error> =
|
||||
let unode_mf: Result<_> =
|
||||
runtime.block_on(unode_id.load(ctx.clone(), repo.blobstore()).from_err());
|
||||
let unode_mf = unode_mf.unwrap();
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Result};
|
||||
use mercurial_types::{HgFileNodeId, RepoPath};
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -11,9 +11,10 @@
|
||||
|
||||
mod errors;
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use cloned::cloned;
|
||||
use context::{CoreContext, PerfCounterType};
|
||||
use failure_ext::prelude::*;
|
||||
use failure_ext::chain::ChainExt;
|
||||
use futures::{future::join_all, Future, IntoFuture, Stream};
|
||||
use futures_ext::{BoxFuture, BoxStream, FutureExt};
|
||||
use sql::{rusqlite::Connection as SqliteConnection, Connection};
|
||||
|
@ -6,10 +6,10 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use cachelib::{get_cached_or_fill, VolatileLruCachePool};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use fbthrift::compact_protocol;
|
||||
use futures::{future, Future, IntoFuture};
|
||||
@ -249,7 +249,7 @@ fn get_single_filenode_from_memcache(
|
||||
.map_err(|()| ErrorKind::MemcacheInternal)
|
||||
.and_then(|maybe_serialized| maybe_serialized.ok_or(ErrorKind::Missing))
|
||||
.and_then(|serialized| {
|
||||
let thrift_entry: ::std::result::Result<thrift::FilenodeInfo, ErrorKind> =
|
||||
let thrift_entry: Result<thrift::FilenodeInfo, ErrorKind> =
|
||||
compact_protocol::deserialize(Vec::from(serialized))
|
||||
.map_err(|_| ErrorKind::Deserialization);
|
||||
|
||||
@ -284,9 +284,7 @@ fn get_all_filenodes_from_memcache(
|
||||
) -> impl Future<Item = Vec<FilenodeInfo>, Error = ()> {
|
||||
// helper function for deserializing list of thrift FilenodeInfo into rust structure with proper
|
||||
// error returned
|
||||
fn deserialize_list(
|
||||
list: Vec<thrift::FilenodeInfo>,
|
||||
) -> ::std::result::Result<Vec<FilenodeInfo>, ErrorKind> {
|
||||
fn deserialize_list(list: Vec<thrift::FilenodeInfo>) -> Result<Vec<FilenodeInfo>, ErrorKind> {
|
||||
let res: Result<Vec<_>> = list.into_iter().map(FilenodeInfo::from_thrift).collect();
|
||||
res.map_err(|_| ErrorKind::Deserialization)
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
pub use crate::caching::CachingFilenodes;
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::{Error, Result};
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Result};
|
||||
use futures_ext::{BoxFuture, BoxStream};
|
||||
use mercurial_types::{HgChangesetId, HgFileNodeId, HgNodeHash, RepoPath};
|
||||
use mononoke_types::{hash, RepoPathCached, RepositoryId};
|
||||
|
@ -6,8 +6,8 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use bytes::Bytes;
|
||||
use failure_ext::{Error, Result};
|
||||
use futures::{
|
||||
future::{lazy, IntoFuture},
|
||||
Future, Stream,
|
||||
|
@ -6,8 +6,8 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use failure_ext::{Error, Result};
|
||||
use futures::{
|
||||
stream::{AndThen, Concat2},
|
||||
try_ready, Async, Poll, Stream,
|
||||
|
@ -6,8 +6,8 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Result;
|
||||
use bytes::BytesMut;
|
||||
use failure_ext::Result;
|
||||
use std::convert::TryInto;
|
||||
|
||||
use crate::errors::ErrorKind;
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
use std::cmp::{max, min};
|
||||
|
||||
use anyhow::Error;
|
||||
use blobstore::{Blobstore, Loadable, LoadableError};
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{stream, Future, Stream};
|
||||
use futures_ext::{BufferedParams, FutureExt, StreamExt};
|
||||
use itertools::Either;
|
||||
|
@ -6,9 +6,9 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Error;
|
||||
use blobstore::{Blobstore, Loadable, LoadableError, Storable};
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{Future, IntoFuture};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use mononoke_types::{hash, ContentAlias, ContentId};
|
||||
|
@ -6,9 +6,9 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Error;
|
||||
use blobstore::{Blobstore, Storable};
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{Future, IntoFuture};
|
||||
use futures_ext::{try_left_future, FutureExt};
|
||||
use mononoke_types::{BlobstoreValue, ContentAlias, ContentMetadata};
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
use bytes::Bytes;
|
||||
|
||||
use anyhow::Error;
|
||||
use cloned::cloned;
|
||||
use failure_ext::Error;
|
||||
use futures::{Future, IntoFuture, Stream};
|
||||
use futures_ext::FutureExt;
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Error;
|
||||
use blobstore::{Blobstore, Loadable, LoadableError, Storable};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::{Future, IntoFuture};
|
||||
use futures_ext::FutureExt;
|
||||
use mononoke_types::{BlobstoreValue, ContentId, ContentMetadata, ContentMetadataId};
|
||||
|
@ -6,7 +6,7 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::{format_err, Error};
|
||||
use anyhow::{format_err, Error};
|
||||
use futures::{sync::mpsc, Future, Sink, Stream};
|
||||
use futures_ext::{self, BoxStream, FutureExt, StreamExt};
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use blobstore::Blobstore;
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Result};
|
||||
use futures::{
|
||||
future::{lazy, IntoFuture},
|
||||
Future, Stream,
|
||||
|
@ -6,7 +6,7 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::Error;
|
||||
use anyhow::Error;
|
||||
use futures::Future;
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -6,10 +6,9 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::{format_err, Error};
|
||||
use anyhow::{format_err, Error};
|
||||
use futures::{sync::oneshot, Future, IntoFuture};
|
||||
use futures_ext::FutureExt;
|
||||
use std::result::Result;
|
||||
|
||||
// Spawn provides a helper to dispatch futures to the Tokio executor yet retain a handle to their
|
||||
// results in the form of a Future. We also provide methods to cast SpawnError into an Error for
|
||||
|
@ -6,9 +6,9 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::Error;
|
||||
use blobstore::Blobstore;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Error;
|
||||
use futures::future::IntoFuture;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use mononoke_types::BlobstoreBytes;
|
||||
|
@ -11,10 +11,10 @@ use crate as filestore;
|
||||
use crate::{errors, Alias, FetchKey, FilestoreConfig, StoreRequest};
|
||||
|
||||
use super::failing_blobstore::{FailingBlobstore, FailingBlobstoreError};
|
||||
use anyhow::Result;
|
||||
use assert_matches::assert_matches;
|
||||
use bytes::Bytes;
|
||||
use context::CoreContext;
|
||||
use failure_ext::Result;
|
||||
use fbinit::FacebookInit;
|
||||
use futures::{
|
||||
future::Future,
|
||||
|
@ -6,10 +6,10 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{format_err, Error, Result};
|
||||
use blobstore::Blobstore;
|
||||
use bytes::Bytes;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{format_err, Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::{
|
||||
future::{self, Future},
|
||||
|
@ -10,16 +10,12 @@
|
||||
// TODO: (rain1) T21726029 tokio/futures deprecated a bunch of stuff, clean it all up
|
||||
#![allow(deprecated)]
|
||||
|
||||
use anyhow::Error;
|
||||
use clap::{App, Arg, SubCommand};
|
||||
use fbinit::FacebookInit;
|
||||
|
||||
mod serve;
|
||||
|
||||
pub mod errors {
|
||||
pub use failure_ext::{Error, Result};
|
||||
}
|
||||
use crate::errors::Error;
|
||||
|
||||
#[fbinit::main]
|
||||
fn main(fb: FacebookInit) {
|
||||
let matches = App::new("Mononoke CLI")
|
||||
|
@ -10,6 +10,7 @@ use std::env::var;
|
||||
use std::io as std_io;
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
|
||||
use anyhow::{bail, format_err, Error, Result};
|
||||
use bytes::Bytes;
|
||||
use context::generate_session_id;
|
||||
use fbinit::FacebookInit;
|
||||
@ -28,9 +29,7 @@ use tokio::net::TcpStream;
|
||||
|
||||
use clap::ArgMatches;
|
||||
|
||||
use crate::errors::*;
|
||||
|
||||
use failure_ext::{bail, err_downcast_ref, format_err, SlogKVError};
|
||||
use failure_ext::{err_downcast_ref, SlogKVError};
|
||||
use futures_ext::{try_boxfuture, BoxFuture, FutureExt, StreamExt};
|
||||
use futures_stats::Timed;
|
||||
use scuba_ext::{ScubaSampleBuilder, ScubaSampleBuilderExt};
|
||||
|
@ -11,9 +11,9 @@
|
||||
//! Based on the Mercurial wire protocol documentation. See
|
||||
//! https://www.mercurial-scm.org/repo/hg/file/@/mercurial/help/internals/wireprotocol.txt.
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use anyhow::{bail, Result};
|
||||
use bytes::Bytes;
|
||||
use failure_ext::bail;
|
||||
|
||||
/// Unescape a batch-escaped argument key or value.
|
||||
pub fn unescape(bs: &[u8]) -> Result<Vec<u8>> {
|
||||
|
@ -16,8 +16,9 @@ use std::mem;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use anyhow::{bail, Error, Result};
|
||||
use bytes::{Buf, Bytes, BytesMut};
|
||||
use failure_ext::{bail, Error, FutureFailureErrorExt, Result};
|
||||
use failure_ext::FutureFailureErrorExt;
|
||||
use futures::future::{self, err, ok, Either, Future};
|
||||
use futures::stream::{self, futures_ordered, once, Stream};
|
||||
use futures::sync::oneshot;
|
||||
@ -375,7 +376,7 @@ where
|
||||
// error is a Result. If this fake error is Ok(...) then no real error happened.
|
||||
// Note that fake error also contains input stream that will be send back to the future that
|
||||
// waits for it.
|
||||
let entry_stream: BoxStream<_, ::std::result::Result<BytesStream<S>, (_, BytesStream<S>)>> =
|
||||
let entry_stream: BoxStream<_, Result<BytesStream<S>, (_, BytesStream<S>)>> =
|
||||
stream::unfold(input, move |input| {
|
||||
let fut_decode = input.into_future_decode(create_decoder());
|
||||
let fut = fut_decode
|
||||
|
@ -205,8 +205,7 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::errors::*;
|
||||
use failure_ext::ensure;
|
||||
use anyhow::{ensure, Result};
|
||||
use quickcheck::{quickcheck, Arbitrary, Gen, TestResult};
|
||||
use std::io::Cursor;
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
@ -9,6 +9,7 @@
|
||||
use crate::commands::HgCommandHandler;
|
||||
use crate::errors::*;
|
||||
use crate::{HgCommands, Request, Response};
|
||||
use anyhow::Error;
|
||||
use bytes::Bytes;
|
||||
use failure_ext::FutureFailureErrorExt;
|
||||
use futures::future::{err, ok, Either};
|
||||
|
@ -244,5 +244,5 @@ impl SingleResponse {
|
||||
}
|
||||
|
||||
pub use commands::{HgCommandRes, HgCommands};
|
||||
pub use errors::{Error, ErrorKind, Result};
|
||||
pub use errors::ErrorKind;
|
||||
pub use handler::HgProtoHandler;
|
||||
|
@ -44,14 +44,13 @@
|
||||
//! convention the streaming responses are chunked. See `hgproto/dechunker.rs` for the format of
|
||||
//! chunking.
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use bytes::BytesMut;
|
||||
use tokio_io::codec::Decoder;
|
||||
|
||||
use crate::handler::{OutputStream, ResponseEncoder};
|
||||
use crate::{Request, Response};
|
||||
|
||||
use crate::errors::*;
|
||||
|
||||
pub mod request;
|
||||
pub mod response;
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
use crate::batch;
|
||||
use crate::errors::{self, *};
|
||||
use crate::errors;
|
||||
use crate::{GetbundleArgs, GettreepackArgs, Request, SingleRequest};
|
||||
use anyhow::{bail, Error, Result};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use failure_ext::bail;
|
||||
use hex::FromHex;
|
||||
use mercurial_types::{HgChangesetId, HgManifestId};
|
||||
use nom::{
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
pub mod tailer;
|
||||
|
||||
use anyhow::{format_err, Error, Result};
|
||||
use blobrepo_factory::open_blobrepo;
|
||||
use bookmarks::BookmarkName;
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use cloned::cloned;
|
||||
use cmdlib::helpers::create_runtime;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{format_err, Error, Result};
|
||||
use fbinit::FacebookInit;
|
||||
use futures::future::{err, ok, result, Future};
|
||||
use futures::stream::repeat;
|
||||
|
@ -9,11 +9,11 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
use super::HookResults;
|
||||
use anyhow::{format_err, Error, Result};
|
||||
use blobrepo::BlobRepo;
|
||||
use bookmarks::BookmarkName;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{format_err, Error, Result};
|
||||
use futures::{Future, Stream};
|
||||
use futures_ext::{spawn_future, BoxFuture, FutureExt};
|
||||
use hooks::{hook_loader::load_hooks, HookManager};
|
||||
|
@ -6,11 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use blobrepo::BlobRepo;
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, Result};
|
||||
use filestore::{self, Alias, FetchKey, StoreRequest};
|
||||
use futures::{
|
||||
future::{loop_fn, Loop},
|
||||
|
@ -15,7 +15,6 @@ use serde::{Deserialize, Serialize};
|
||||
use slog::{info, warn, Logger};
|
||||
use std::default::Default;
|
||||
use std::path::PathBuf;
|
||||
use std::result::Result;
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
|
@ -19,7 +19,6 @@ use scuba::{ScubaSampleBuilder, ScubaValue};
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::result::Result;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use time_ext::DurationExt;
|
||||
|
||||
|
@ -20,7 +20,6 @@ use hyper::{Body, Request};
|
||||
use serde::Deserialize;
|
||||
use stats::{define_stats, Histogram, Timeseries};
|
||||
use std::collections::HashMap;
|
||||
use std::result::Result;
|
||||
use std::str::FromStr;
|
||||
|
||||
use failure_ext::chain::ChainExt;
|
||||
|
@ -59,7 +59,7 @@ impl Decoder for CapabilitiesUnpacker {
|
||||
match kv.next() {
|
||||
None => Vec::new(),
|
||||
Some(values) => {
|
||||
let res: ::std::result::Result<Vec<_>, _> = values
|
||||
let res: Result<Vec<_>, _> = values
|
||||
.split(|b| b == &b',')
|
||||
.filter(|v| !v.is_empty())
|
||||
.map(|v| percent_decode(v).decode_utf8().map(Cow::into_owned))
|
||||
|
@ -146,14 +146,14 @@ impl<'de> serde::de::Visitor<'de> for StringVisitor {
|
||||
formatter.write_str("40 hex digits")
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, value: &str) -> ::std::result::Result<Self::Value, E>
|
||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(value.to_string())
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, value: String) -> ::std::result::Result<Self::Value, E>
|
||||
fn visit_string<E>(self, value: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
@ -162,7 +162,7 @@ impl<'de> serde::de::Visitor<'de> for StringVisitor {
|
||||
}
|
||||
|
||||
impl serde::ser::Serialize for HgNodeHash {
|
||||
fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error>
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
@ -171,7 +171,7 @@ impl serde::ser::Serialize for HgNodeHash {
|
||||
}
|
||||
|
||||
impl<'de> serde::de::Deserialize<'de> for HgNodeHash {
|
||||
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::de::Deserializer<'de>,
|
||||
{
|
||||
@ -290,7 +290,7 @@ impl Display for HgChangesetId {
|
||||
}
|
||||
|
||||
impl serde::ser::Serialize for HgChangesetId {
|
||||
fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error>
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
@ -299,7 +299,7 @@ impl serde::ser::Serialize for HgChangesetId {
|
||||
}
|
||||
|
||||
impl<'de> serde::de::Deserialize<'de> for HgChangesetId {
|
||||
fn deserialize<D>(deserializer: D) -> ::std::result::Result<HgChangesetId, D::Error>
|
||||
fn deserialize<D>(deserializer: D) -> Result<HgChangesetId, D::Error>
|
||||
where
|
||||
D: serde::de::Deserializer<'de>,
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ use sql::mysql_async::{
|
||||
|
||||
use crate::{Globalrev, HgChangesetId, HgFileNodeId, HgNodeHash};
|
||||
|
||||
type FromValueResult<T> = ::std::result::Result<T, FromValueError>;
|
||||
type FromValueResult<T> = Result<T, FromValueError>;
|
||||
|
||||
impl From<HgFileNodeId> for Value {
|
||||
fn from(id: HgFileNodeId) -> Self {
|
||||
|
@ -334,7 +334,7 @@ pub enum HookType {
|
||||
impl FromStr for HookType {
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(string: &str) -> std::result::Result<Self, Self::Err> {
|
||||
fn from_str(string: &str) -> Result<Self, Self::Err> {
|
||||
match string {
|
||||
"PerChangeset" => Ok(HookType::PerChangeset),
|
||||
"PerAddedOrModifiedFile" => Ok(HookType::PerAddedOrModifiedFile),
|
||||
@ -460,7 +460,7 @@ impl From<BlobstoreId> for Value {
|
||||
}
|
||||
|
||||
impl ConvIr<BlobstoreId> for BlobstoreId {
|
||||
fn new(v: Value) -> std::result::Result<Self, FromValueError> {
|
||||
fn new(v: Value) -> Result<Self, FromValueError> {
|
||||
Ok(BlobstoreId(from_value_opt(v)?))
|
||||
}
|
||||
fn commit(self) -> Self {
|
||||
|
@ -11,9 +11,9 @@ use crate::{
|
||||
typed_hash::{FileUnodeId, MononokeId},
|
||||
ChangesetId, MPath,
|
||||
};
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use blobstore::{Blobstore, BlobstoreBytes, Loadable, LoadableError};
|
||||
use context::CoreContext;
|
||||
use failure_ext::{bail, format_err, Error};
|
||||
use fbthrift::compact_protocol;
|
||||
use futures::Future;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
|
@ -8,15 +8,13 @@
|
||||
|
||||
//! Support for converting Mononoke data structures into in-memory blobs.
|
||||
|
||||
use anyhow::Result;
|
||||
use blobstore::BlobstoreBytes;
|
||||
use bytes::Bytes;
|
||||
|
||||
use crate::{
|
||||
errors::*,
|
||||
typed_hash::{
|
||||
ChangesetId, ContentChunkId, ContentId, ContentMetadataId, DeletedManifestId,
|
||||
FastlogBatchId, FileUnodeId, FsnodeId, ManifestUnodeId, RawBundle2Id,
|
||||
},
|
||||
use crate::typed_hash::{
|
||||
ChangesetId, ContentChunkId, ContentId, ContentMetadataId, DeletedManifestId, FastlogBatchId,
|
||||
FileUnodeId, FsnodeId, ManifestUnodeId, RawBundle2Id,
|
||||
};
|
||||
|
||||
/// A serialized blob in memory.
|
||||
|
@ -8,14 +8,15 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use failure_ext::{bail, chain::*, Error};
|
||||
use anyhow::{bail, Context, Error, Result};
|
||||
use failure_ext::chain::ChainExt;
|
||||
use fbthrift::compact_protocol;
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
use rand::Rng;
|
||||
|
||||
use crate::blob::{Blob, BlobstoreValue, ChangesetBlob};
|
||||
use crate::datetime::DateTime;
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::file_change::FileChange;
|
||||
use crate::path::{self, MPath};
|
||||
use crate::thrift;
|
||||
|
@ -9,14 +9,15 @@
|
||||
use std::convert::TryInto;
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use bytes::Bytes;
|
||||
use failure_ext::{bail, chain::*};
|
||||
use failure_ext::chain::ChainExt;
|
||||
use fbthrift::compact_protocol;
|
||||
use quickcheck::{single_shrinker, Arbitrary, Gen};
|
||||
|
||||
use crate::{
|
||||
blob::{Blob, BlobstoreValue, ContentChunkBlob},
|
||||
errors::*,
|
||||
errors::ErrorKind,
|
||||
file_contents::ContentChunkPointer,
|
||||
thrift,
|
||||
typed_hash::{ContentChunkId, ContentChunkIdContext},
|
||||
|
@ -8,15 +8,16 @@
|
||||
|
||||
use std::convert::TryInto;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use blobstore::BlobstoreBytes;
|
||||
use bytes::Bytes;
|
||||
use failure_ext::{bail, chain::*};
|
||||
use failure_ext::chain::ChainExt;
|
||||
use fbthrift::compact_protocol;
|
||||
use quickcheck::{Arbitrary, Gen};
|
||||
|
||||
use crate::{
|
||||
blob::{Blob, BlobstoreValue, ContentMetadataBlob},
|
||||
errors::*,
|
||||
errors::ErrorKind,
|
||||
hash, thrift, thrift_field,
|
||||
typed_hash::{ContentId, ContentMetadataId},
|
||||
};
|
||||
|
@ -8,15 +8,15 @@
|
||||
|
||||
use std::fmt::{self, Display};
|
||||
|
||||
use anyhow::{bail, Context, Result};
|
||||
use chrono::{
|
||||
DateTime as ChronoDateTime, FixedOffset, Local, LocalResult, NaiveDateTime, TimeZone,
|
||||
};
|
||||
use failure_ext::bail;
|
||||
use quickcheck::{empty_shrinker, Arbitrary, Gen};
|
||||
use rand::Rng;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::thrift;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, Serialize, PartialEq, PartialOrd)]
|
||||
|
@ -6,10 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::chain::*;
|
||||
use anyhow::Result;
|
||||
use failure_ext::chain::ChainExt;
|
||||
|
||||
use crate::blob::{Blob, BlobstoreValue, DeletedManifestBlob};
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::path::MPathElement;
|
||||
use crate::thrift;
|
||||
use crate::typed_hash::{ChangesetId, DeletedManifestContext, DeletedManifestId};
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
use crate::path::MPath;
|
||||
pub use failure_ext::{Error, ResultExt};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
@ -37,5 +36,3 @@ pub enum ErrorKind {
|
||||
#[error("Failed to parse RepositoryId from '{0}'")]
|
||||
FailedToParseRepositoryId(String),
|
||||
}
|
||||
|
||||
pub type Result<T> = ::std::result::Result<T, Error>;
|
||||
|
@ -8,16 +8,16 @@
|
||||
|
||||
use crate::{
|
||||
blob::{Blob, BlobstoreValue, FastlogBatchBlob},
|
||||
errors::*,
|
||||
errors::ErrorKind,
|
||||
thrift,
|
||||
typed_hash::{ChangesetId, FastlogBatchId, FastlogBatchIdContext},
|
||||
};
|
||||
use anyhow::{Error, Result};
|
||||
use blobstore::{Blobstore, Loadable, Storable};
|
||||
use bytes::Bytes;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::chain::ChainExt;
|
||||
use failure_ext::Error;
|
||||
use fbthrift::compact_protocol;
|
||||
use futures::{future, Future};
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
@ -142,9 +142,8 @@ impl FastlogBatch {
|
||||
}
|
||||
|
||||
pub fn from_bytes(serialized: &Bytes) -> Result<FastlogBatch> {
|
||||
let thrift_entry: ::std::result::Result<thrift::FastlogBatch, Error> =
|
||||
compact_protocol::deserialize(serialized)
|
||||
.map_err(|err| ErrorKind::BlobDeserializeError(format!("{}", err)).into());
|
||||
let thrift_entry: Result<thrift::FastlogBatch> = compact_protocol::deserialize(serialized)
|
||||
.map_err(|err| ErrorKind::BlobDeserializeError(format!("{}", err)).into());
|
||||
thrift_entry.and_then(Self::from_thrift)
|
||||
}
|
||||
|
||||
|
@ -8,13 +8,13 @@
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use failure_ext::bail;
|
||||
use anyhow::{bail, Context, Result};
|
||||
use heapsize_derive::HeapSizeOf;
|
||||
use quickcheck::{empty_shrinker, single_shrinker, Arbitrary, Gen};
|
||||
use rand::{seq::SliceRandom, Rng};
|
||||
use serde_derive::Serialize;
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::path::MPath;
|
||||
use crate::thrift;
|
||||
use crate::typed_hash::{ChangesetId, ContentId};
|
||||
|
@ -9,14 +9,15 @@
|
||||
use std::convert::TryInto;
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use bytes::Bytes;
|
||||
use failure_ext::{bail, chain::*};
|
||||
use failure_ext::chain::ChainExt;
|
||||
use fbthrift::compact_protocol;
|
||||
use quickcheck::{empty_shrinker, single_shrinker, Arbitrary, Gen};
|
||||
|
||||
use crate::{
|
||||
blob::{Blob, BlobstoreValue, ContentBlob},
|
||||
errors::*,
|
||||
errors::ErrorKind,
|
||||
thrift,
|
||||
typed_hash::{ContentChunkId, ContentId, ContentIdContext},
|
||||
};
|
||||
|
@ -6,10 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::{bail, chain::*};
|
||||
use anyhow::{bail, Result};
|
||||
use failure_ext::chain::ChainExt;
|
||||
|
||||
use crate::blob::{Blob, BlobstoreValue, FsnodeBlob};
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::file_change::FileType;
|
||||
use crate::hash::{Sha1, Sha256};
|
||||
use crate::path::MPathElement;
|
||||
|
@ -11,18 +11,18 @@ use std::io::Write;
|
||||
use std::str::FromStr;
|
||||
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::{bail, Error, Result};
|
||||
use ascii::{AsciiStr, AsciiString};
|
||||
use blake2::{
|
||||
digest::{Input, VariableOutput},
|
||||
VarBlake2b,
|
||||
};
|
||||
use failure_ext::bail;
|
||||
use faster_hex::{hex_decode, hex_encode};
|
||||
use heapsize_derive::HeapSizeOf;
|
||||
use quickcheck::{empty_shrinker, Arbitrary, Gen};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::thrift;
|
||||
|
||||
// There is no NULL_HASH for Blake2 hashes. Any places that need a null hash should use an
|
||||
|
@ -17,9 +17,10 @@ use std::mem;
|
||||
use std::slice::Iter;
|
||||
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::{bail, Error, Result};
|
||||
use asyncmemo::Weight;
|
||||
use bytes::Bytes;
|
||||
use failure_ext::{bail, chain::*};
|
||||
use failure_ext::chain::ChainExt;
|
||||
use heapsize::HeapSizeOf;
|
||||
use heapsize_derive::HeapSizeOf;
|
||||
use lazy_static::lazy_static;
|
||||
@ -28,7 +29,7 @@ use rand::{seq::SliceRandom, Rng};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::bonsai_changeset::BonsaiChangeset;
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::hash::{Blake2, Context};
|
||||
use crate::thrift;
|
||||
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use bytes::Bytes;
|
||||
use failure_ext::{bail, chain::*};
|
||||
use failure_ext::chain::ChainExt;
|
||||
use fbthrift::compact_protocol;
|
||||
use quickcheck::{single_shrinker, Arbitrary, Gen};
|
||||
|
||||
use crate::blob::{Blob, BlobstoreValue, RawBundle2Blob};
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::thrift;
|
||||
use crate::typed_hash::{RawBundle2Id, RawBundle2IdContext};
|
||||
|
||||
|
@ -7,13 +7,14 @@
|
||||
*/
|
||||
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::Error;
|
||||
use heapsize_derive::HeapSizeOf;
|
||||
use serde_derive::Serialize;
|
||||
use std::default::Default;
|
||||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::errors::{Error, ErrorKind};
|
||||
use crate::errors::ErrorKind;
|
||||
|
||||
/// Represents a repository. This ID is used throughout storage.
|
||||
#[derive(
|
||||
|
@ -16,7 +16,7 @@ use sql::mysql_async::{
|
||||
FromValueError, Value,
|
||||
};
|
||||
|
||||
type FromValueResult<T> = ::std::result::Result<T, FromValueError>;
|
||||
type FromValueResult<T> = Result<T, FromValueError>;
|
||||
|
||||
impl From<ChangesetId> for Value {
|
||||
fn from(id: ChangesetId) -> Self {
|
||||
|
@ -10,10 +10,10 @@ use std::fmt::{self, Display};
|
||||
use std::str::FromStr;
|
||||
|
||||
use abomonation_derive::Abomonation;
|
||||
use anyhow::{bail, Error, Result};
|
||||
use ascii::{AsciiStr, AsciiString};
|
||||
use blobstore::{Blobstore, Loadable, LoadableError, Storable};
|
||||
use context::CoreContext;
|
||||
use failure_ext::bail;
|
||||
use futures::Future;
|
||||
use futures_ext::{BoxFuture, FutureExt};
|
||||
use heapsize_derive::HeapSizeOf;
|
||||
@ -25,7 +25,7 @@ use crate::{
|
||||
content_chunk::ContentChunk,
|
||||
content_metadata::ContentMetadata,
|
||||
deleted_files_manifest::DeletedManifest,
|
||||
errors::*,
|
||||
errors::ErrorKind,
|
||||
fastlog_batch::FastlogBatch,
|
||||
file_contents::FileContents,
|
||||
fsnode::Fsnode,
|
||||
@ -203,7 +203,7 @@ macro_rules! impl_typed_hash_no_context {
|
||||
}
|
||||
|
||||
impl serde::Serialize for $typed {
|
||||
fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error>
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
|
@ -6,10 +6,11 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use failure_ext::{bail, chain::*};
|
||||
use anyhow::{bail, Result};
|
||||
use failure_ext::chain::ChainExt;
|
||||
|
||||
use crate::blob::{Blob, BlobstoreValue, FileUnodeBlob, ManifestUnodeBlob};
|
||||
use crate::errors::*;
|
||||
use crate::errors::ErrorKind;
|
||||
use crate::file_change::FileType;
|
||||
use crate::path::{MPathElement, MPathHash};
|
||||
use crate::thrift;
|
||||
|
@ -6,8 +6,8 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
use crate::errors::*;
|
||||
use crate::{Phase, Phases};
|
||||
use anyhow::Error;
|
||||
use blobrepo::BlobRepo;
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
|
@ -6,7 +6,6 @@
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
pub use failure_ext::{Error, Result};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Eq, Error, PartialEq)]
|
||||
|
@ -9,8 +9,9 @@
|
||||
mod caching;
|
||||
pub use caching::CachingPhases;
|
||||
mod errors;
|
||||
pub use errors::*;
|
||||
pub use errors::ErrorKind;
|
||||
|
||||
use anyhow::{Error, Result};
|
||||
use ascii::AsciiString;
|
||||
use blobrepo::BlobRepo;
|
||||
use cloned::cloned;
|
||||
@ -62,7 +63,7 @@ impl fmt::Display for Phase {
|
||||
impl TryFrom<iobuf::IOBuf> for Phase {
|
||||
type Error = ErrorKind;
|
||||
|
||||
fn try_from(buf: iobuf::IOBuf) -> ::std::result::Result<Self, Self::Error> {
|
||||
fn try_from(buf: iobuf::IOBuf) -> Result<Self, Self::Error> {
|
||||
let v: Vec<u8> = buf.into();
|
||||
match std::str::from_utf8(&v) {
|
||||
Ok("Draft") => Ok(Phase::Draft),
|
||||
@ -92,7 +93,7 @@ impl FromValue for Phase {
|
||||
}
|
||||
|
||||
impl ConvIr<Phase> for Phase {
|
||||
fn new(v: Value) -> ::std::result::Result<Self, FromValueError> {
|
||||
fn new(v: Value) -> Result<Self, FromValueError> {
|
||||
match v {
|
||||
Value::Bytes(bytes) => AsciiString::from_ascii(bytes)
|
||||
.map_err(|err| FromValueError(Value::Bytes(err.into_source())))
|
||||
|
@ -43,12 +43,13 @@
|
||||
///
|
||||
/// *rebased set* - subset of pushed set that will be rebased on top of onto bookmark
|
||||
/// Note: Usually rebased set == pushed set. However in case of merges it may differ
|
||||
use anyhow::{Error, Result};
|
||||
use blobrepo::{save_bonsai_changesets, BlobRepo};
|
||||
use blobrepo_utils::convert_diff_result_into_file_change_for_diamond_merge;
|
||||
use bookmarks::{BookmarkName, BookmarkUpdateReason, BundleReplayData};
|
||||
use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use failure_ext::{Error, FutureFailureErrorExt, Result};
|
||||
use failure_ext::FutureFailureErrorExt;
|
||||
use futures::future::{err, join_all, loop_fn, ok, Loop};
|
||||
use futures::{stream, Future, IntoFuture, Stream};
|
||||
use futures_ext::{try_boxfuture, BoxFuture, BoxStream, FutureExt, StreamExt};
|
||||
@ -552,7 +553,7 @@ fn fetch_bonsai_changesets(
|
||||
// There should only be one head in the pushed set
|
||||
fn find_only_head_or_fail(
|
||||
commits: &HashSet<BonsaiChangeset>,
|
||||
) -> ::std::result::Result<ChangesetId, PushrebaseError> {
|
||||
) -> Result<ChangesetId, PushrebaseError> {
|
||||
let mut commits_set: HashSet<_> =
|
||||
HashSet::from_iter(commits.iter().map(|commit| commit.get_changeset_id()));
|
||||
for commit in commits {
|
||||
@ -575,7 +576,7 @@ struct ChildIndex(usize);
|
||||
|
||||
fn find_roots(
|
||||
commits: &HashSet<BonsaiChangeset>,
|
||||
) -> ::std::result::Result<HashMap<ChangesetId, ChildIndex>, PushrebaseError> {
|
||||
) -> Result<HashMap<ChangesetId, ChildIndex>, PushrebaseError> {
|
||||
let commits_set: HashSet<_> =
|
||||
HashSet::from_iter(commits.iter().map(|commit| commit.get_changeset_id()));
|
||||
let mut roots = HashMap::new();
|
||||
@ -853,10 +854,7 @@ fn extract_conflict_files_from_bonsai_changeset(bcs: BonsaiChangeset) -> Vec<MPa
|
||||
|
||||
/// `left` and `right` are considerered to be conflit free, if none of the element from `left`
|
||||
/// is prefix of element from `right`, and vice versa.
|
||||
fn intersect_changed_files(
|
||||
left: Vec<MPath>,
|
||||
right: Vec<MPath>,
|
||||
) -> ::std::result::Result<(), PushrebaseError> {
|
||||
fn intersect_changed_files(left: Vec<MPath>, right: Vec<MPath>) -> Result<(), PushrebaseError> {
|
||||
let mut left = {
|
||||
let mut left = left;
|
||||
left.sort_unstable();
|
||||
@ -931,7 +929,7 @@ async fn create_rebased_changesets(
|
||||
root: ChangesetId,
|
||||
head: ChangesetId,
|
||||
onto: ChangesetId,
|
||||
) -> ::std::result::Result<(ChangesetId, RebasedChangesets), PushrebaseError> {
|
||||
) -> Result<(ChangesetId, RebasedChangesets), PushrebaseError> {
|
||||
let rebased_set = find_rebased_set(ctx.clone(), repo.clone(), root, head.clone())
|
||||
.compat()
|
||||
.await?;
|
||||
@ -1325,8 +1323,8 @@ fn create_bookmark_update_reason(
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use anyhow::format_err;
|
||||
use cmdlib::helpers::create_runtime;
|
||||
use failure_ext::format_err;
|
||||
use fbinit::FacebookInit;
|
||||
use fixtures::{linear, many_files_dirs, merge_even};
|
||||
use futures::future::join_all;
|
||||
@ -1357,7 +1355,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn make_paths(paths: &[&str]) -> Vec<MPath> {
|
||||
let paths: ::std::result::Result<_, _> = paths.into_iter().map(MPath::new).collect();
|
||||
let paths: Result<_, _> = paths.into_iter().map(MPath::new).collect();
|
||||
paths.unwrap()
|
||||
}
|
||||
|
||||
@ -2389,10 +2387,7 @@ mod tests {
|
||||
})
|
||||
}
|
||||
|
||||
fn run_future<F, I, E>(
|
||||
runtime: &mut tokio::runtime::Runtime,
|
||||
future: F,
|
||||
) -> std::result::Result<I, E>
|
||||
fn run_future<F, I, E>(runtime: &mut tokio::runtime::Runtime, future: F) -> Result<I, E>
|
||||
where
|
||||
F: Future<Item = I, Error = E> + Send + 'static,
|
||||
I: Send + 'static,
|
||||
@ -3300,7 +3295,7 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn should_have_conflicts(res: ::std::result::Result<PushrebaseSuccessResult, PushrebaseError>) {
|
||||
fn should_have_conflicts(res: Result<PushrebaseSuccessResult, PushrebaseError>) {
|
||||
match res {
|
||||
Err(err) => match err {
|
||||
PushrebaseError::Conflicts(_) => {}
|
||||
|
@ -26,7 +26,7 @@ use futures_ext::{
|
||||
};
|
||||
use futures_stats::{Timed, TimedStreamTrait};
|
||||
use getbundle_response::create_getbundle_response;
|
||||
use hgproto::{self, GetbundleArgs, GettreepackArgs, HgCommandRes, HgCommands};
|
||||
use hgproto::{GetbundleArgs, GettreepackArgs, HgCommandRes, HgCommands};
|
||||
use hooks::{HookExecution, HookManager};
|
||||
use itertools::Itertools;
|
||||
use lazy_static::lazy_static;
|
||||
@ -763,9 +763,9 @@ impl HgCommands for RepoClient {
|
||||
}
|
||||
}
|
||||
|
||||
impl Stream for ParentStream<BoxFuture<HgBlobChangeset, hgproto::Error>> {
|
||||
impl Stream for ParentStream<BoxFuture<HgBlobChangeset, Error>> {
|
||||
type Item = HgChangesetId;
|
||||
type Error = hgproto::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
|
||||
if self.n == self.bottom || self.n.into_nodehash() == NULL_HASH {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user