Skip to content

Commit

Permalink
get rid of ChangesetFetcher trait (6/N)
Browse files Browse the repository at this point in the history
Summary: ChangesetFetcher facet is deprecated and all usages should be moved to the CommitGraph facet.

Reviewed By: liubov-dmitrieva

Differential Revision: D55072634

fbshipit-source-id: 687bd390cff400137c705af7a12abee0c767f045
  • Loading branch information
YousefSalama authored and facebook-github-bot committed Mar 19, 2024
1 parent a746560 commit 1c0f541
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 27 deletions.
3 changes: 1 addition & 2 deletions eden/mononoke/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ bytes = { version = "1.1", features = ["serde"] }
bytesize = "1.1"
cacheblob = { version = "0.1.0", path = "blobstore/cacheblob" }
cached_config = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
changeset_fetcher = { version = "0.1.0", path = "blobrepo/changeset_fetcher" }
changesets = { version = "0.1.0", path = "changesets" }
check_git_wc = { version = "0.1.0", path = "git/check_git_wc" }
clap = { version = "4.5.2", features = ["derive", "env", "string", "unicode", "wrap_help"] }
clap-old = { package = "clap", version = "2.34.0" }
cloned = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
cmdlib = { version = "0.1.0", path = "cmdlib" }
cmdlib_logging = { version = "0.1.0", path = "cmdlib/log" }
commit_graph = { version = "0.1.0", path = "repo_attributes/commit_graph/commit_graph" }
context = { version = "0.1.0", path = "server/context" }
facet = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
failure_ext = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
Expand All @@ -85,7 +85,6 @@ repo_blobstore = { version = "0.1.0", path = "blobrepo/repo_blobstore" }
repo_derived_data = { version = "0.1.0", path = "repo_attributes/repo_derived_data" }
repo_identity = { version = "0.1.0", path = "repo_attributes/repo_identity" }
retry = { version = "0.1.0", path = "common/retry" }
revset = { version = "0.1.0", path = "revset" }
scuba_ext = { version = "0.1.0", path = "common/scuba_ext" }
segmented_changelog = { version = "0.1.0", path = "segmented_changelog" }
serde = { version = "1.0.185", features = ["derive", "rc"] }
Expand Down
5 changes: 1 addition & 4 deletions eden/mononoke/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ rust_binary(
"//common/rust/shed/fbinit:fbinit",
"//common/rust/shed/lock_ext:lock_ext",
"//eden/mononoke/blobrepo:blobrepo",
"//eden/mononoke/blobrepo:changeset_fetcher",
"//eden/mononoke/blobrepo:repo_blobstore",
"//eden/mononoke/blobrepo_utils:blobrepo_utils",
"//eden/mononoke/blobstore:blobstore",
Expand All @@ -68,7 +67,7 @@ rust_binary(
"//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
"//eden/mononoke/mercurial:mercurial_types",
"//eden/mononoke/mononoke_types:mononoke_types",
"//eden/mononoke/revset:revset",
"//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
"//eden/mononoke/server/context:context",
],
)
Expand Down Expand Up @@ -211,7 +210,6 @@ rust_binary(
"//common/rust/shed/sorted_vector_map:sorted_vector_map",
"//eden/mononoke/blobrepo:blobrepo",
"//eden/mononoke/blobrepo:blobrepo_hg",
"//eden/mononoke/blobrepo:changeset_fetcher",
"//eden/mononoke/blobrepo:repo_blobstore",
"//eden/mononoke/blobstore:blobstore",
"//eden/mononoke/blobstore:blobstore_factory",
Expand Down Expand Up @@ -245,7 +243,6 @@ rust_binary(
"//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
"//eden/mononoke/repo_attributes/repo_identity:repo_identity",
"//eden/mononoke/repo_factory:repo_factory",
"//eden/mononoke/revset:revset",
"//eden/mononoke/segmented_changelog:segmented_changelog",
"//eden/mononoke/server/context:context",
"//eden/scm/lib/clientinfo:clientinfo",
Expand Down
2 changes: 0 additions & 2 deletions eden/mononoke/admin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ bookmarks_movement = { version = "0.1.0", path = "../bookmarks/bookmarks_movemen
bounded_traversal = { version = "0.1.0", path = "../common/bounded_traversal" }
bytes = { version = "1.1", features = ["serde"] }
cached_config = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
changeset_fetcher = { version = "0.1.0", path = "../blobrepo/changeset_fetcher" }
clap-old = { package = "clap", version = "2.34.0" }
clientinfo = { version = "0.1.0", path = "../../scm/lib/clientinfo" }
cloned = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
Expand Down Expand Up @@ -59,7 +58,6 @@ regex = "1.9.2"
repo_blobstore = { version = "0.1.0", path = "../blobrepo/repo_blobstore" }
repo_factory = { version = "0.1.0", path = "../repo_factory" }
repo_identity = { version = "0.1.0", path = "../repo_attributes/repo_identity" }
revset = { version = "0.1.0", path = "../revset" }
segmented_changelog = { version = "0.1.0", path = "../segmented_changelog" }
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_derive = "1.0.185"
Expand Down
14 changes: 5 additions & 9 deletions eden/mononoke/cmds/admin/crossrepo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1549,13 +1549,11 @@ mod test {
use ascii::AsciiString;
use bookmarks::BookmarkKey;
use cacheblob::InProcessLease;
use changeset_fetcher::ChangesetFetcherArc;
use commit_graph::CommitGraphRef;
use cross_repo_sync::find_bookmark_diff;
use fixtures::set_bookmark;
use fixtures::Linear;
use fixtures::TestRepoFixture;
use futures::compat::Stream01CompatExt;
use futures::TryStreamExt;
use live_commit_sync_config::TestLiveCommitSyncConfig;
use maplit::hashmap;
use maplit::hashset;
Expand All @@ -1565,7 +1563,6 @@ mod test {
use metaconfig_types::SmallRepoCommitSyncConfig;
use metaconfig_types::SmallRepoPermanentConfig;
use mononoke_types::RepositoryId;
use revset::AncestorsNodeStream;
use sql_construct::SqlConstruct;
use synced_commit_mapping::SyncedCommitMappingEntry;
use synced_commit_mapping::SyncedCommitSourceRepo;
Expand Down Expand Up @@ -1701,11 +1698,10 @@ mod test {
let maybe_master_val = small_repo.bookmarks().get(ctx.clone(), &master).await?;

let master_val = maybe_master_val.ok_or_else(|| Error::msg("master not found"))?;
let changesets: Vec<_> =
AncestorsNodeStream::new(ctx.clone(), &small_repo.changeset_fetcher_arc(), master_val)
.compat()
.try_collect()
.await?;
let changesets = small_repo
.commit_graph()
.ancestors_difference(&ctx, vec![master_val], vec![])
.await?;

let current_version = CommitSyncConfigVersion("TEST_VERSION_NAME".to_string());

Expand Down
10 changes: 5 additions & 5 deletions eden/mononoke/cmds/admin/subcommand_deleted_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use anyhow::Error;
use blobrepo::BlobRepo;
use blobrepo_hg::BlobRepoHg;
use blobstore::Loadable;
use changeset_fetcher::ChangesetFetcherArc;
use clap_old::App;
use clap_old::Arg;
use clap_old::ArgMatches;
Expand All @@ -24,12 +23,12 @@ use cloned::cloned;
use cmdlib::args;
use cmdlib::args::MononokeMatches;
use cmdlib::helpers;
use commit_graph::CommitGraphRef;
use context::CoreContext;
use deleted_manifest::DeletedManifestOps;
use deleted_manifest::RootDeletedManifestV2Id;
use derived_data::BonsaiDerived;
use fbinit::FacebookInit;
use futures::compat::Stream01CompatExt;
use futures::future;
use futures::StreamExt;
use futures::TryStreamExt;
Expand All @@ -41,7 +40,6 @@ use mononoke_types::ChangesetId;
use mononoke_types::DeletedManifestV2Id;
use mononoke_types::NonRootMPath;
use repo_blobstore::RepoBlobstoreRef;
use revset::AncestorsNodeStream;
use slog::debug;
use slog::Logger;

Expand Down Expand Up @@ -176,8 +174,10 @@ async fn subcommand_verify(
cs_id: ChangesetId,
limit: u64,
) -> Result<(), Error> {
let mut csids = AncestorsNodeStream::new(ctx.clone(), &repo.changeset_fetcher_arc(), cs_id)
.compat()
let mut csids = repo
.commit_graph()
.ancestors_difference_stream(&ctx, vec![cs_id], vec![])
.await?
.take(limit as usize);
while let Some(cs_id) = csids.try_next().await? {
verify_single_commit(ctx.clone(), repo.clone(), cs_id).await?
Expand Down
9 changes: 4 additions & 5 deletions eden/mononoke/cmds/bonsai_verify/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ use blobrepo_utils::BonsaiMFVerify;
use blobrepo_utils::BonsaiMFVerifyResult;
use blobstore::Loadable;
use bonsai_hg_mapping::BonsaiHgMappingRef;
use changeset_fetcher::ChangesetFetcherArc;
use clap::Parser;
use clap::Subcommand;
use cloned::cloned;
use commit_graph::CommitGraphRef;
use context::CoreContext;
use failure_ext::DisplayChain;
use fbinit::FacebookInit;
use futures::compat::Future01CompatExt;
use futures::compat::Stream01CompatExt;
use futures::future;
use futures::future::TryFutureExt;
use futures::stream::StreamExt;
Expand All @@ -49,7 +48,6 @@ use mononoke_app::args::RepoArgs;
use mononoke_app::MononokeAppBuilder;
use repo_blobstore::RepoBlobstoreArc;
use repo_blobstore::RepoBlobstoreRef;
use revset::AncestorsNodeStream;
use slog::debug;
use slog::error;
use slog::info;
Expand Down Expand Up @@ -319,8 +317,9 @@ fn subcommmand_hg_manifest_verify(
.await?
.ok_or_else(|| format_err!("failed to fetch bonsai changeset"))?;

AncestorsNodeStream::new(ctx.clone(), &repo.changeset_fetcher_arc(), csid)
.compat()
repo.commit_graph()
.ancestors_difference_stream(ctx, vec![csid], vec![])
.await?
.take(count)
.map(|res| async move {
match res {
Expand Down

0 comments on commit 1c0f541

Please sign in to comment.