mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-17 17:55:29 +00:00
repo: make all base_repo() functions return &Arc<ReadonlyRepo>
This is to prepare for a `Repo` trait implemented for `Arc<ReadonlyRepo>` (not for `ReadonlyRepo` itself).
This commit is contained in:
parent
8a067282c8
commit
b7dad291df
3 changed files with 7 additions and 7 deletions
|
@ -53,15 +53,15 @@ use crate::{backend, op_store};
|
|||
// RepoRef?
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum RepoRef<'a> {
|
||||
Readonly(&'a ReadonlyRepo),
|
||||
Readonly(&'a Arc<ReadonlyRepo>),
|
||||
Mutable(&'a MutableRepo),
|
||||
}
|
||||
|
||||
impl<'a> RepoRef<'a> {
|
||||
pub fn base_repo(&self) -> &ReadonlyRepo {
|
||||
pub fn base_repo(&self) -> &Arc<ReadonlyRepo> {
|
||||
match self {
|
||||
RepoRef::Readonly(repo) => repo,
|
||||
RepoRef::Mutable(repo) => repo.base_repo.as_ref(),
|
||||
RepoRef::Readonly(repo) => &repo,
|
||||
RepoRef::Mutable(repo) => &repo.base_repo,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ impl ReadonlyRepo {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn as_repo_ref(&self) -> RepoRef {
|
||||
pub fn as_repo_ref<'a>(self: &'a Arc<Self>) -> RepoRef<'a> {
|
||||
RepoRef::Readonly(self)
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ impl Transaction {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn base_repo(&self) -> &ReadonlyRepo {
|
||||
pub fn base_repo(&self) -> &Arc<ReadonlyRepo> {
|
||||
self.mut_repo.base_repo()
|
||||
}
|
||||
|
||||
|
|
|
@ -1017,7 +1017,7 @@ impl WorkspaceCommandTransaction<'_> {
|
|||
self.helper
|
||||
}
|
||||
|
||||
pub fn base_repo(&self) -> &ReadonlyRepo {
|
||||
pub fn base_repo(&self) -> &Arc<ReadonlyRepo> {
|
||||
self.tx.base_repo()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue