forked from mirrors/jj
rewrite: extract a function for updating heads
This commit is contained in:
parent
0f7a86d725
commit
9511de486e
1 changed files with 10 additions and 5 deletions
|
@ -522,11 +522,7 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rebase_all(&mut self) -> Result<(), TreeMergeError> {
|
fn update_heads(&mut self) {
|
||||||
while let Some(old_commit) = self.to_visit.pop() {
|
|
||||||
self.rebase_one(old_commit)?;
|
|
||||||
}
|
|
||||||
self.update_all_references()?;
|
|
||||||
let mut view = self.mut_repo.view().store_view().clone();
|
let mut view = self.mut_repo.view().store_view().clone();
|
||||||
for commit_id in &self.heads_to_remove {
|
for commit_id in &self.heads_to_remove {
|
||||||
view.head_ids.remove(commit_id);
|
view.head_ids.remove(commit_id);
|
||||||
|
@ -537,6 +533,15 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
|
||||||
self.heads_to_remove.clear();
|
self.heads_to_remove.clear();
|
||||||
self.heads_to_add.clear();
|
self.heads_to_add.clear();
|
||||||
self.mut_repo.set_view(view);
|
self.mut_repo.set_view(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn rebase_all(&mut self) -> Result<(), TreeMergeError> {
|
||||||
|
while let Some(old_commit) = self.to_visit.pop() {
|
||||||
|
self.rebase_one(old_commit)?;
|
||||||
|
}
|
||||||
|
self.update_all_references()?;
|
||||||
|
self.update_heads();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue