forked from mirrors/jj
Transaction: don't wrap MutableRepo in Arc
I think this was a vestige from the time when `MutableEvolution` had a back-reference into `MutableRepo` (at least I think it used to be that way).
This commit is contained in:
parent
3e938752d1
commit
736a0e7442
2 changed files with 7 additions and 7 deletions
|
@ -528,16 +528,16 @@ impl MutableRepo {
|
|||
index: Arc<ReadonlyIndex>,
|
||||
view: &View,
|
||||
evolution: Option<&Arc<ReadonlyEvolution>>,
|
||||
) -> Arc<MutableRepo> {
|
||||
) -> MutableRepo {
|
||||
let mut_view = view.start_modification();
|
||||
let mut_index = MutableIndex::incremental(index);
|
||||
let mut_evolution = evolution.map(|evolution| evolution.start_modification());
|
||||
Arc::new(MutableRepo {
|
||||
MutableRepo {
|
||||
base_repo,
|
||||
index: mut_index,
|
||||
view: mut_view,
|
||||
evolution: Mutex::new(mut_evolution),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_repo_ref(&self) -> RepoRef {
|
||||
|
|
|
@ -26,7 +26,7 @@ use crate::view::View;
|
|||
use crate::working_copy::WorkingCopy;
|
||||
|
||||
pub struct Transaction {
|
||||
repo: Option<Arc<MutableRepo>>,
|
||||
repo: Option<MutableRepo>,
|
||||
parents: Vec<OperationId>,
|
||||
description: String,
|
||||
start_time: Timestamp,
|
||||
|
@ -35,7 +35,7 @@ pub struct Transaction {
|
|||
}
|
||||
|
||||
impl Transaction {
|
||||
pub fn new(mut_repo: Arc<MutableRepo>, description: &str) -> Transaction {
|
||||
pub fn new(mut_repo: MutableRepo, description: &str) -> Transaction {
|
||||
let parents = vec![mut_repo.base_repo().op_id().clone()];
|
||||
Transaction {
|
||||
repo: Some(mut_repo),
|
||||
|
@ -60,7 +60,7 @@ impl Transaction {
|
|||
}
|
||||
|
||||
pub fn mut_repo(&mut self) -> &mut MutableRepo {
|
||||
Arc::get_mut(self.repo.as_mut().unwrap()).unwrap()
|
||||
self.repo.as_mut().unwrap()
|
||||
}
|
||||
|
||||
/// Writes the transaction to the operation store and publishes it.
|
||||
|
@ -72,7 +72,7 @@ impl Transaction {
|
|||
/// That means that a repo can be loaded at the operation, but the
|
||||
/// operation will not be seen when loading the repo at head.
|
||||
pub fn write(mut self) -> UnpublishedOperation {
|
||||
let mut_repo = Arc::try_unwrap(self.repo.take().unwrap()).ok().unwrap();
|
||||
let mut_repo = self.repo.take().unwrap();
|
||||
let base_repo = mut_repo.base_repo().clone();
|
||||
let (mut_index, view, maybe_mut_evolution) = mut_repo.consume();
|
||||
let maybe_evolution =
|
||||
|
|
Loading…
Reference in a new issue