repo: inline `merge_op_heads()`
The function is now pretty simple, and there's only one caller, so
let's inline it. It probably makes sense to move the code out of
`repo.rs` at some point.
@@ -36,7 +36,7 @@ use crate::rewrite::DescendantRebaser;
use crate::settings::{RepoSettings, UserSettings};
use crate::simple_op_store::SimpleOpStore;
use crate::store::Store;
-use crate::transaction::{Transaction, UnpublishedOperation};
+use crate::transaction::Transaction;
use crate::view::{RefName, View};
use crate::{backend, op_store};
@@ -310,10 +310,12 @@ pub struct UnresolvedHeadRepo {
impl UnresolvedHeadRepo {
pub fn resolve(self, user_settings: &UserSettings) -> Arc<ReadonlyRepo> {
- let merged_repo = self
- .repo_loader
- .merge_op_heads(user_settings, self.op_heads)
- .leave_unpublished();
+ 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);
+ }
+ let merged_repo = tx.write().leave_unpublished();
self.locked_op_heads.finish(merged_repo.operation());
merged_repo
}
@@ -384,19 +386,6 @@ impl RepoLoader {
}
}
- fn merge_op_heads(
- &self,
- user_settings: &UserSettings,
- op_heads: Vec<Operation>,
- ) -> UnpublishedOperation {
- let base_repo = self.load_at(&op_heads[0]);
- let mut tx = base_repo.start_transaction("resolve concurrent operations");
- for other_op_head in op_heads.into_iter().skip(1) {
- tx.merge_operation(user_settings, other_op_head);
- }
- tx.write()
- }
-
pub fn load_at(&self, op: &Operation) -> Arc<ReadonlyRepo> {
let view = View::new(op.view().take_store_view());
self._finish_load(op.clone(), view)
