Make ReadStorage more usable

Previously, we were not able to access a `ReadRepository` instance
through `ReadStorage`. With this change, we are able to.
This commit is contained in:
Alexis Sellier
2023-02-15 22:08:20 +01:00
parent 89fcc6de1c
commit 950fae209d
31 changed files with 134 additions and 71 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let signer = term::signer(&profile)?;
let storage = &profile.storage;
let (_, id) = radicle::rad::cwd()?;
let repo = storage.repository(id)?;
let repo = storage.repository_mut(id)?;
let mut issues = issue::Issues::open(*signer.public_key(), &repo)?;
let mut issue = issues.get_mut(&options.id).map_err(|err| match err {
-1
View File
@@ -7,7 +7,6 @@ use anyhow::Context as _;
use radicle::prelude::*;
use radicle::storage::git::transport;
use radicle::storage::RemoteId;
use radicle::storage::WriteStorage;
use crate::project;
use crate::terminal as term;
-1
View File
@@ -15,7 +15,6 @@ use radicle::prelude::*;
use radicle::rad;
use radicle::storage;
use radicle::storage::git::{ProjectError, Storage};
use radicle::storage::WriteStorage;
use crate::commands::rad_checkout as checkout;
use crate::project;
-1
View File
@@ -10,7 +10,6 @@ use radicle::cob::store;
use radicle::cob::thread;
use radicle::prelude::*;
use radicle::storage;
use radicle::storage::WriteStorage;
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
+1 -1
View File
@@ -19,7 +19,7 @@ where
.get(&profile.public_key, id)?
.context("No project with such ID exists")?;
let repo = storage.repository(id)?;
let repo = storage.repository_mut(id)?;
if !project.is_delegate(me) {
return Err(anyhow::anyhow!(
+1 -1
View File
@@ -19,7 +19,7 @@ where
.get(&profile.public_key, id)?
.context("No project with such ID exists")?;
let repo = storage.repository(id)?;
let repo = storage.repository_mut(id)?;
if !project.is_delegate(me) {
return Err(anyhow::anyhow!(
+1 -1
View File
@@ -4,7 +4,7 @@ use std::str::FromStr;
use anyhow::{anyhow, Context as _};
use radicle::identity::Id;
use radicle::storage::{ReadStorage, WriteRepository, WriteStorage};
use radicle::storage::{ReadStorage, WriteRepository};
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
+1 -1
View File
@@ -5,7 +5,7 @@ use radicle::cob::identity::{self, Proposal, ProposalId, Proposals, Revision, Re
use radicle::git::Oid;
use radicle::identity::Identity;
use radicle::prelude::Doc;
use radicle::storage::WriteStorage as _;
use radicle::storage::ReadStorage as _;
use radicle_crypto::{PublicKey, Verified};
use crate::terminal::args::{Args, Error, Help};
+1 -1
View File
@@ -11,7 +11,7 @@ use json_color::{Color, Colorizer};
use radicle::crypto::Unverified;
use radicle::identity::Untrusted;
use radicle::identity::{Doc, Id};
use radicle::storage::{ReadRepository, ReadStorage, WriteStorage};
use radicle::storage::{ReadRepository, ReadStorage};
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
+1 -1
View File
@@ -198,7 +198,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let signer = term::signer(&profile)?;
let storage = &profile.storage;
let (_, id) = radicle::rad::cwd()?;
let repo = storage.repository(id)?;
let repo = storage.repository_mut(id)?;
let mut issues = Issues::open(*signer.public_key(), &repo)?;
match options.op {
+1 -1
View File
@@ -3,7 +3,7 @@ use std::ffi::OsString;
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
use radicle::storage::{ReadRepository, WriteStorage};
use radicle::storage::{ReadRepository, ReadStorage};
pub const HELP: Help = Help {
name: "ls",
+1 -1
View File
@@ -4,7 +4,7 @@ use std::str::FromStr;
use anyhow::{anyhow, Context as _};
use radicle::node::{Handle, NodeId};
use radicle::storage::WriteStorage;
use radicle::storage::ReadStorage;
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
+1 -1
View File
@@ -83,7 +83,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let signer = term::signer(&profile)?;
let storage = &profile.storage;
let (_, id) = radicle::rad::cwd()?;
let repo = storage.repository(id)?;
let repo = storage.repository_mut(id)?;
let mut issues = issue::Issues::open(*signer.public_key(), &repo)?;
let mut issue = issues.get_mut(&options.id).map_err(|err| match err {
+1 -1
View File
@@ -5,7 +5,7 @@ use anyhow::{anyhow, Context as _};
use radicle::identity::Id;
use radicle::node::Handle;
use radicle::prelude::*;
use radicle::storage::WriteStorage;
use radicle::storage::ReadStorage;
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};