mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-26 14:00:51 +00:00
rewrite: exclude already rewritten commits from set to rebase
We currently include the commits in `parent_mapping` and `abandoned` in the set of commits to visit when rebasing descendants. The reason was that we used to update branches and working copies when we visited these commits. Since we started updating refs after rebasing all commits, there's no need to even visit these commits.
This commit is contained in:
parent
49ff818e97
commit
9c382fd8c6
1 changed files with 4 additions and 7 deletions
|
@ -301,7 +301,9 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
|
|||
RevsetExpression::commits(mut_repo.parent_mapping.keys().cloned().collect()).union(
|
||||
&RevsetExpression::commits(mut_repo.abandoned.iter().cloned().collect()),
|
||||
);
|
||||
let to_visit_expression = old_commits_expression.descendants();
|
||||
let to_visit_expression = old_commits_expression
|
||||
.descendants()
|
||||
.minus(&old_commits_expression);
|
||||
let to_visit_revset = to_visit_expression.evaluate_programmatic(mut_repo).unwrap();
|
||||
let to_visit: Vec<_> = to_visit_revset.iter().commits(store).try_collect().unwrap();
|
||||
drop(to_visit_revset);
|
||||
|
@ -439,12 +441,7 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
|
|||
|
||||
fn rebase_one(&mut self, old_commit: Commit) -> Result<(), TreeMergeError> {
|
||||
let old_commit_id = old_commit.id().clone();
|
||||
if self.mut_repo.parent_mapping.contains_key(&old_commit_id) {
|
||||
// This is a commit that had already been rebased before `self` was created
|
||||
// (i.e. it's part of the input for this rebase). We don't need
|
||||
// to rebase it.
|
||||
return Ok(());
|
||||
}
|
||||
assert!(!self.mut_repo.parent_mapping.contains_key(&old_commit_id));
|
||||
let old_parent_ids = old_commit.parent_ids();
|
||||
let new_parent_ids = self.mut_repo.new_parents(old_parent_ids);
|
||||
if new_parent_ids == old_parent_ids {
|
||||
|
|
Loading…
Reference in a new issue