Skip to content

Commit 6a13584

Browse files
mononoke: change how we generate filenodes for octopus merges
Summary: In the next diff I'm going to refactor BlobRepo::get_manifest_from_bonsai() function and remove IncompleteFilenodes structure. While doing so I noticed that the behaviour of get_manifest_from_bonsai() and FilenodesOnlyPublic is different with regards to generating hg filenodes for octopus merges. In particular, get_manifest_from_bonsai() at the moment doesn't generate filenodes for paths that came from stepparents, but FilenodesOnlyPublic does generate them. I'd say both of this approach are equally reasonable, however let's try to preserve the behaviour Reviewed By: krallin Differential Revision: D19856420 fbshipit-source-id: 9f8ae656205f39536c450b885fc4d8d6a2534456
1 parent c4a7ca6 commit 6a13584

File tree

1 file changed

+11
-8
lines changed
  • eden/mononoke/derived_data/filenodes

1 file changed

+11
-8
lines changed

eden/mononoke/derived_data/filenodes/lib.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn classify_filenode(filenode: FilenodeInfo) -> Either<RootFilenodeInfo, Filenod
174174
}
175175
}
176176

177-
async fn generate_all_filenodes(
177+
pub async fn generate_all_filenodes(
178178
ctx: &CoreContext,
179179
repo: &BlobRepo,
180180
cs_id: ChangesetId,
@@ -184,12 +184,12 @@ async fn generate_all_filenodes(
184184
.compat()
185185
.await?;
186186

187-
// Mercurial commits can have only 2 parents, however bonsai commits can have more
188-
// In that case p3, p4, ... are ignored (they are called step parents)
189-
let cs_parents: Vec<_> = parents.into_iter().take(2).collect();
190187
let root_mf = fetch_root_manifest_id(&ctx, &cs_id, &repo);
188+
// Bonsai might have > 2 parents, while mercurial supports at most 2.
189+
// That's fine for us - we just won't generate filenodes for paths that came from
190+
// stepparents. That means that linknode for these filenodes will point to a stepparent
191191
let parents = try_join_all(
192-
cs_parents
192+
parents
193193
.iter()
194194
.map(|p| fetch_root_manifest_id(&ctx, p, &repo)),
195195
);
@@ -410,6 +410,7 @@ mod tests {
410410
use super::*;
411411
use fbinit::FacebookInit;
412412
use mononoke_types::FileType;
413+
use slog::info;
413414
use tests_utils::CreateCommitContext;
414415

415416
async fn verify_filenodes(
@@ -540,16 +541,18 @@ mod tests {
540541
.commit()
541542
.await?;
542543

543-
// Root filenode was changed, and all files from p3 were added (because parents beyond
544-
// p1 an p2 are ignored when generating filenodes and hg changesets)
544+
info!(ctx.logger(), "checking filenodes for {}", p3);
545545
verify_filenodes(
546546
&ctx,
547547
&repo,
548-
merge,
548+
p3,
549549
vec![RepoPath::RootPath, RepoPath::file("path3")?],
550550
)
551551
.await?;
552552

553+
info!(ctx.logger(), "checking filenodes for {}", merge);
554+
verify_filenodes(&ctx, &repo, merge, vec![RepoPath::RootPath]).await?;
555+
553556
Ok(())
554557
}
555558

0 commit comments

Comments
 (0)