mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
deleted_files_manifest: switch to BonsaiDerived::derive03
Reviewed By: krallin Differential Revision: D24900116 fbshipit-source-id: 387e75a4f45a9c283ab73322154c19e314bf6a21
This commit is contained in:
parent
364f20adad
commit
89cfdeccb6
@ -12,7 +12,6 @@ use cloned::cloned;
|
||||
use context::CoreContext;
|
||||
use derived_data::BonsaiDerived;
|
||||
use futures::{
|
||||
compat::Future01CompatExt,
|
||||
future::{self, FutureExt as NewFutureExt, TryFutureExt as NewTryFutureExt},
|
||||
stream::TryStreamExt as NewTryStreamExt,
|
||||
};
|
||||
@ -184,8 +183,8 @@ pub(crate) enum PathChange {
|
||||
}
|
||||
|
||||
pub(crate) async fn get_changes(
|
||||
ctx: CoreContext,
|
||||
repo: BlobRepo,
|
||||
ctx: &CoreContext,
|
||||
repo: &BlobRepo,
|
||||
bonsai: BonsaiChangeset,
|
||||
) -> Result<PathTree<Option<PathChange>>, Error> {
|
||||
let blobstore = repo.get_blobstore();
|
||||
@ -197,19 +196,17 @@ pub(crate) async fn get_changes(
|
||||
// get parent unodes
|
||||
let parent_cs_ids: Vec<_> = bonsai.parents().collect();
|
||||
let parent_unodes = parent_cs_ids.into_iter().map({
|
||||
cloned!(ctx, repo);
|
||||
move |cs_id| {
|
||||
RootUnodeManifestId::derive(ctx.clone(), repo.clone(), cs_id)
|
||||
.from_err()
|
||||
.map(|root_mf_id| root_mf_id.manifest_unode_id().clone())
|
||||
move |cs_id| async move {
|
||||
let root_mf_id = RootUnodeManifestId::derive03(ctx, repo, cs_id).await?;
|
||||
Ok(root_mf_id.manifest_unode_id().clone())
|
||||
}
|
||||
});
|
||||
|
||||
let (root_unode_mf_id, parent_mf_ids) =
|
||||
RootUnodeManifestId::derive(ctx.clone(), repo.clone(), bcs_id)
|
||||
.join(old_future::join_all(parent_unodes))
|
||||
.compat()
|
||||
.await?;
|
||||
let (root_unode_mf_id, parent_mf_ids) = future::try_join(
|
||||
RootUnodeManifestId::derive03(ctx, repo, bcs_id),
|
||||
future::try_join_all(parent_unodes),
|
||||
)
|
||||
.await?;
|
||||
|
||||
// compute diff between changeset's and its parents' manifests
|
||||
let unode_mf_id = root_unode_mf_id.manifest_unode_id().clone();
|
||||
@ -225,7 +222,7 @@ pub(crate) async fn get_changes(
|
||||
.try_collect::<Vec<_>>()
|
||||
.await
|
||||
} else {
|
||||
diff_against_parents(&ctx, &repo, unode_mf_id, parent_mf_ids).await
|
||||
diff_against_parents(ctx, repo, unode_mf_id, parent_mf_ids).await
|
||||
}?;
|
||||
|
||||
Ok(PathTree::from_iter(
|
||||
@ -978,9 +975,7 @@ mod tests {
|
||||
repo: &BlobRepo,
|
||||
bonsai: ChangesetId,
|
||||
) -> Result<Vec<(Option<MPath>, Status)>, Error> {
|
||||
let manifest = RootDeletedManifestId::derive(ctx.clone(), repo.clone(), bonsai)
|
||||
.compat()
|
||||
.await?;
|
||||
let manifest = RootDeletedManifestId::derive03(ctx, repo, bonsai).await?;
|
||||
let mut deleted_nodes =
|
||||
iterate_all_entries(ctx.clone(), repo.clone(), *manifest.deleted_manifest_id())
|
||||
.compat()
|
||||
@ -1021,9 +1016,7 @@ mod tests {
|
||||
) -> (ChangesetId, DeletedManifestId, Vec<(Option<MPath>, Status)>) {
|
||||
let bcs_id = bcs.get_changeset_id();
|
||||
|
||||
let changes = runtime
|
||||
.block_on_std(get_changes(ctx.clone(), repo.clone(), bcs))
|
||||
.unwrap();
|
||||
let changes = runtime.block_on_std(get_changes(&ctx, &repo, bcs)).unwrap();
|
||||
let f = derive_deleted_files_manifest(
|
||||
ctx.clone(),
|
||||
repo.clone(),
|
||||
|
@ -73,7 +73,7 @@ impl BonsaiDerived for RootDeletedManifestId {
|
||||
parents: Vec<Self>,
|
||||
) -> Result<Self, Error> {
|
||||
let bcs_id = bonsai.get_changeset_id();
|
||||
let changes = get_changes(ctx.clone(), repo.clone(), bonsai).await?;
|
||||
let changes = get_changes(&ctx, &repo, bonsai).await?;
|
||||
derive_deleted_files_manifest(
|
||||
ctx,
|
||||
repo,
|
||||
|
@ -117,9 +117,7 @@ async fn resolve_path_state_unfold(
|
||||
// let's get deleted manifests for each changeset id
|
||||
// and try to find the given path
|
||||
if let Some(cs_id) = queue.pop_front() {
|
||||
let root_dfm_id = RootDeletedManifestId::derive(ctx.clone(), repo.clone(), cs_id.clone())
|
||||
.compat()
|
||||
.await?;
|
||||
let root_dfm_id = RootDeletedManifestId::derive03(&ctx, &repo, cs_id.clone()).await?;
|
||||
let dfm_id = root_dfm_id.deleted_manifest_id();
|
||||
let entry = find_entry(ctx.clone(), repo.get_blobstore(), *dfm_id, path.clone())
|
||||
.compat()
|
||||
@ -215,9 +213,7 @@ async fn derive_unode_entry(
|
||||
cs_id: ChangesetId,
|
||||
path: &Option<MPath>,
|
||||
) -> Result<Option<UnodeEntry>, Error> {
|
||||
let root_unode_mf_id = RootUnodeManifestId::derive(ctx.clone(), repo.clone(), cs_id)
|
||||
.compat()
|
||||
.await?;
|
||||
let root_unode_mf_id = RootUnodeManifestId::derive03(ctx, repo, cs_id).await?;
|
||||
root_unode_mf_id
|
||||
.manifest_unode_id()
|
||||
.find_entry(ctx.clone(), repo.get_blobstore(), path.clone())
|
||||
@ -586,9 +582,7 @@ mod tests {
|
||||
) -> DeletedManifestId {
|
||||
let bcs_id = bcs.get_changeset_id();
|
||||
|
||||
let changes = runtime
|
||||
.block_on_std(get_changes(ctx.clone(), repo.clone(), bcs))
|
||||
.unwrap();
|
||||
let changes = runtime.block_on_std(get_changes(&ctx, &repo, bcs)).unwrap();
|
||||
let f = derive_deleted_files_manifest(
|
||||
ctx.clone(),
|
||||
repo.clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user