Skip to content

Commit

Permalink
transaction: move rebasing of descendants out of merge_operation() (#…
Browse files Browse the repository at this point in the history
…111)

I want to do the rebasing a bit later, so the CLI can do it and print
how many commits got rebased.
  • Loading branch information
martinvonz committed Mar 27, 2022
1 parent d3504f3 commit 750babe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ impl UnresolvedHeadRepo {
let base_repo = self.repo_loader.load_at(&self.op_heads[0]);
let mut tx = base_repo.start_transaction("resolve concurrent operations");
for other_op_head in self.op_heads.into_iter().skip(1) {
tx.merge_operation(user_settings, other_op_head);
tx.merge_operation(other_op_head);
tx.mut_repo().rebase_descendants(user_settings);
}
let merged_repo = tx.write().leave_unpublished();
self.locked_op_heads.finish(merged_repo.operation());
Expand Down
4 changes: 1 addition & 3 deletions lib/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::op_store;
use crate::op_store::OperationMetadata;
use crate::operation::Operation;
use crate::repo::{MutableRepo, ReadonlyRepo, RepoLoader};
use crate::settings::UserSettings;
use crate::view::View;

pub struct Transaction {
Expand Down Expand Up @@ -57,7 +56,7 @@ impl Transaction {
self.repo.as_mut().unwrap()
}

pub fn merge_operation(&mut self, user_settings: &UserSettings, other_op: Operation) {
pub fn merge_operation(&mut self, other_op: Operation) {
let ancestor_op = closest_common_node(
self.parent_ops.clone(),
vec![other_op.clone()],
Expand All @@ -71,7 +70,6 @@ impl Transaction {
self.parent_ops.push(other_op);
let merged_repo = self.mut_repo();
merged_repo.merge(&base_repo, &other_repo);
merged_repo.rebase_descendants(user_settings);
}

/// Writes the transaction to the operation store and publishes it.
Expand Down

0 comments on commit 750babe

Please sign in to comment.