Skip to content

Commit

Permalink
fix(plan): attribute touched commit lookup time to FilterCommits op…
Browse files Browse the repository at this point in the history
…eration

Previously, when progress bars couldn't be nested, we ended up creating two different progress operations of the same kind, and they were merged. After allowing the nesting of progress bars, these appeared as different-level operations, which is somewhat confusing to look at. This commit fixes it to only show one `FilterCommits` operation at once.
  • Loading branch information
arxanas committed Feb 9, 2022
1 parent 1602b13 commit 3c88340
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/core/rewrite/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,17 +737,7 @@ impl<'repo> RebasePlanBuilder<'repo> {
Some(merge_base_oid) => merge_base_oid,
};

let touched_commits = {
let (effects, _progress) = effects.start_operation(OperationType::ConstrainCommits);
let _effects = effects;
state
.constraints
.values()
.flatten()
.map(|oid| repo.find_commit(*oid))
.flatten_ok()
.try_collect()?
};
let touched_commit_oids = state.constraints.values().flatten().copied().collect();

let path = self
.dag
Expand All @@ -760,7 +750,7 @@ impl<'repo> RebasePlanBuilder<'repo> {
repo_pool,
repo,
path,
touched_commits,
touched_commit_oids,
)?
};

Expand Down Expand Up @@ -801,10 +791,15 @@ impl<'repo> RebasePlanBuilder<'repo> {
repo_pool: &RepoPool,
repo: &'repo Repo,
path: Vec<NonZeroOid>,
touched_commits: Vec<Commit>,
touched_commit_oids: Vec<NonZeroOid>,
) -> eyre::Result<Vec<Commit<'repo>>> {
let (effects, _progress) = effects.start_operation(OperationType::FilterCommits);

let touched_commits: Vec<Commit> = touched_commit_oids
.into_iter()
.map(|oid| repo.find_commit(oid))
.flatten_ok()
.try_collect()?;
let local_touched_paths: Vec<HashSet<PathBuf>> = touched_commits
.into_iter()
.map(|commit| repo.get_paths_touched_by_commit(&commit))
Expand Down

0 comments on commit 3c88340

Please sign in to comment.