transaction: move construction of MutableRepo out of Transaction::new()

I'm about to move `MutableRepo` to the `repo` module and it will make
more sense to have the construction of it there then.
This commit is contained in:
Martin von Zweigbergk 2021-01-31 18:07:37 -08:00
parent bf53c6c506
commit 2d03b514fc
2 changed files with 4 additions and 14 deletions

View File

@ -31,7 +31,7 @@ use crate::settings::{RepoSettings, UserSettings};
use crate::store;
use crate::store::{Store, StoreError};
use crate::store_wrapper::StoreWrapper;
use crate::transaction::Transaction;
use crate::transaction::{MutableRepo, Transaction};
use crate::view::{ReadonlyView, View};
use crate::working_copy::WorkingCopy;
@ -284,12 +284,8 @@ impl ReadonlyRepo {
}
pub fn start_transaction(&self, description: &str) -> Transaction {
Transaction::new(
&self,
&self.view,
&self.evolution.as_ref().unwrap(),
description,
)
let mut_repo = MutableRepo::new(self, &self.view, &self.evolution.as_ref().unwrap());
Transaction::new(mut_repo, description)
}
pub fn reload(&mut self) {

View File

@ -41,13 +41,7 @@ pub struct MutableRepo<'r> {
}
impl<'r> Transaction<'r> {
pub fn new(
repo: &'r ReadonlyRepo,
view: &ReadonlyView,
evolution: &ReadonlyEvolution<'r>,
description: &str,
) -> Transaction<'r> {
let mut_repo = MutableRepo::new(repo, view, evolution);
pub fn new(mut_repo: Arc<MutableRepo<'r>>, description: &str) -> Transaction<'r> {
Transaction {
repo: Some(mut_repo),
description: description.to_owned(),