Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
http: Update radicle crate to v0.13.0
Sebastian Martinez committed 1 year ago
commit 139bab580965cb6ab5e86ec4b744b226884bc8b8
parent a34056b
5 files changed +40 -45
modified radicle-httpd/Cargo.lock
@@ -854,9 +854,9 @@ dependencies = [

[[package]]
name = "git2"
-
version = "0.18.3"
+
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70"
+
checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
dependencies = [
 "bitflags 2.5.0",
 "libc",
@@ -1129,9 +1129,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"

[[package]]
name = "libgit2-sys"
-
version = "0.16.2+1.7.2"
+
version = "0.17.0+1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8"
+
checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
dependencies = [
 "cc",
 "libc",
@@ -1614,9 +1614,9 @@ dependencies = [

[[package]]
name = "radicle"
-
version = "0.12.0"
+
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "e8dd9d6612b6248f99f98c9e20e84649982e08bb9c35b0fff5aa521dd8f2970a"
+
checksum = "4a818569c11f1bac56f38b002d778ce8ec92e312024b9aebcd68bad5dee6a465"
dependencies = [
 "amplify",
 "base64 0.21.7",
@@ -1645,9 +1645,9 @@ dependencies = [

[[package]]
name = "radicle-cob"
-
version = "0.11.0"
+
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "36d8268661b22cec768bdf687aa9d98db2dcd9c8f974e8208f8658244074b539"
+
checksum = "d4fac94999d8ffb6e88674bee487b080b69bbc9fb1b439ebfa51481ede1a17b3"
dependencies = [
 "fastrand",
 "git2",
@@ -1664,9 +1664,9 @@ dependencies = [

[[package]]
name = "radicle-crypto"
-
version = "0.10.0"
+
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "fb86116dc5d9daa0d0b8e07fb71c9887d537b3fecebffc0cde6624b07176c711"
+
checksum = "d1d6a67969719841ad06049597006368eb4238ca63a02d20207654dfd1d2d6ad"
dependencies = [
 "amplify",
 "cyphernet",
@@ -1694,9 +1694,9 @@ dependencies = [

[[package]]
name = "radicle-git-ext"
-
version = "0.7.0"
+
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "7ba40f0288f73b9464c0f52c09261593777ed6f195ef3be6a12d8f8e920d7885"
+
checksum = "16d2e8a6292811e44388e6068fcaf1040401e1f6a7a58cf48cc121cf7453c19d"
dependencies = [
 "git-ref-format",
 "git2",
@@ -1771,9 +1771,9 @@ checksum = "db20136bbc9ae63f3fec8e5a6c369f4902fac2244501b5dfc6d668e43475aaa4"

[[package]]
name = "radicle-surf"
-
version = "0.21.0"
+
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "5fae23233ff8be809a822d923e93e56e5282179039b19f345f39f592c1ca0765"
+
checksum = "fb308c3989087f71e43d8c7a2737273fdc7fbcd3e6628af81a42f601ae64f314"
dependencies = [
 "anyhow",
 "base64 0.13.1",
@@ -1798,7 +1798,6 @@ dependencies = [
 "anstyle-query",
 "anyhow",
 "crossbeam-channel",
-
 "git2",
 "inquire",
 "libc",
 "once_cell",
modified radicle-httpd/Cargo.toml
@@ -24,7 +24,7 @@ path = "src/main.rs"
anyhow = { version = "1" }
axum = { version = "0.7.2", default-features = false, features = ["json", "query", "tokio", "http1"] }
axum-server = { version = "0.6.0", default-features = false }
-
base64 = "0.21.3"
+
base64 = { version = "0.21.3" }
chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
fastrand = { version = "2.0.0" }
flate2 = { version = "1" }
@@ -32,7 +32,8 @@ hyper = { version = "1.0.1", default-features = false }
lexopt = { version = "0.3.0" }
lru = { version = "0.12.0" }
nonempty = { version = "0.9.0", features = ["serialize"] }
-
radicle-surf = { version = "0.21.0", default-features = false, features = ["serde"] }
+
radicle-surf = { version = "0.22.0", default-features = false, features = ["serde"] }
+
radicle-term = { version = "0.10.0", default-features = false }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
thiserror = { version = "1" }
@@ -46,14 +47,11 @@ ureq = { version = "2.9", default-features = false, features = ["json"] }
url = { version = "2.5.0" }

[dependencies.radicle]
-
version = "0.12.0"
-

-
[dependencies.radicle-term]
-
version = "0.10.0"
+
version = "0.13.0"

[dev-dependencies]
hyper = { version = "1.0.1", default-features = false, features = ["client"] }
pretty_assertions = { version = "1.3.0" }
-
radicle-crypto = { version = "0.10.0", features = ["test"] }
+
radicle-crypto = { version = "0.11.0", features = ["test"] }
tempfile = { version = "3.3.0" }
tower = { version = "0.4", features = ["util"] }
modified radicle-httpd/src/api/json.rs
@@ -5,14 +5,12 @@ use std::path::Path;
use std::str;

use base64::prelude::{Engine, BASE64_STANDARD};
-
use radicle::cob::{CodeLocation, Reaction};
-
use radicle::patch::ReviewId;
use serde_json::{json, Value};

use radicle::cob::issue::{Issue, IssueId};
use radicle::cob::patch::{Merge, Patch, PatchId, Review};
use radicle::cob::thread::{Comment, CommentId, Edit};
-
use radicle::cob::{ActorId, Author};
+
use radicle::cob::{ActorId, Author, CodeLocation, Reaction};
use radicle::git::RefString;
use radicle::node::{Alias, AliasStore};
use radicle::prelude::NodeId;
@@ -139,8 +137,8 @@ pub(crate) fn patch(
                    patch_comment(id, c, aliases)
                }).collect::<Vec<_>>(),
                "timestamp": rev.timestamp().as_secs(),
-
                "reviews": patch.reviews_of(id).map(move |(id, r)| {
-
                    review(id, r, aliases)
+
                "reviews": rev.reviews().into_iter().map(move |(_, r)| {
+
                    review(r, aliases)
                }).collect::<Vec<_>>(),
            })
        }).collect::<Vec<_>>(),
@@ -191,10 +189,10 @@ fn merge(nid: &NodeId, merge: &Merge, aliases: &impl AliasStore) -> Value {
}

/// Returns JSON for a patch `Review` and fills in `alias` when present.
-
fn review(id: &ReviewId, review: &Review, aliases: &impl AliasStore) -> Value {
+
fn review(review: &Review, aliases: &impl AliasStore) -> Value {
    let a = review.author();
    json!({
-
        "id": id,
+
        "id": review.id(),
        "author": author(a, aliases.alias(a.id())),
        "verdict": review.verdict(),
        "summary": review.summary(),
modified radicle-httpd/src/api/v1/repos.rs
@@ -1087,7 +1087,7 @@ mod routes {
              "diff": {
                "files": [
                  {
-
                    "state": "deleted",
+
                    "status": "deleted",
                    "path": "CONTRIBUTING",
                    "diff": {
                      "type": "plain",
@@ -1123,7 +1123,7 @@ mod routes {
                    },
                  },
                  {
-
                    "state": "added",
+
                    "status": "added",
                    "path": "README",
                    "diff": {
                      "type": "plain",
@@ -1159,7 +1159,7 @@ mod routes {
                    },
                  },
                  {
-
                    "state": "added",
+
                    "status": "added",
                    "path": "dir1/README",
                    "diff": {
                      "type": "plain",
@@ -1202,6 +1202,11 @@ mod routes {
                }
              },
              "files": {
+
                "1dd5654ca2d2cf9f33b14c92b5ca9e1d21a91ae1": {
+
                  "id": "1dd5654ca2d2cf9f33b14c92b5ca9e1d21a91ae1",
+
                  "binary": false,
+
                  "content": "Hello World from dir1!\n",
+
                },
                "82eb77880c693655bce074e3dbbd9fa711dc018b": {
                  "id": "82eb77880c693655bce074e3dbbd9fa711dc018b",
                  "binary": false,
@@ -1212,11 +1217,6 @@ mod routes {
                  "binary": false,
                  "content": "Hello World!\n",
                },
-
                "1dd5654ca2d2cf9f33b14c92b5ca9e1d21a91ae1": {
-
                  "id": "1dd5654ca2d2cf9f33b14c92b5ca9e1d21a91ae1",
-
                  "binary": false,
-
                  "content": "Hello World from dir1!\n",
-
                },
              },
              "branches": [
                "refs/heads/master"
@@ -1504,7 +1504,7 @@ mod routes {
                "diff": {
                  "files": [
                    {
-
                      "state": "added",
+
                      "status": "added",
                      "path": "dir1/README",
                      "diff": {
                        "type": "plain",
modified radicle-httpd/src/test.rs
@@ -15,7 +15,7 @@ use radicle::cob::patch::MergeTarget;
use radicle::crypto::ssh::Keystore;
use radicle::crypto::{KeyPair, Seed, Signer};
use radicle::git::{raw as git2, RefString};
-
use radicle::identity::Visibility;
+
use radicle::identity::{project, Visibility};
use radicle::profile::{env, Home};
use radicle::storage::ReadStorage;
use radicle::{node, profile};
@@ -118,7 +118,7 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G

    // rad init
    let repo = git2::Repository::open(&workdir).unwrap();
-
    let name = "hello-world-private".to_string();
+
    let name = project::ProjectName::from_str("hello-world-private").unwrap();
    let description = "Private Rad repository for tests".to_string();
    let branch = RefString::try_from(DEFAULT_BRANCH).unwrap();
    let visibility = Visibility::Private {
@@ -126,7 +126,7 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G
    };
    let (rid, _, _) = radicle::rad::init(
        &repo,
-
        &name,
+
        name,
        &description,
        branch,
        visibility,
@@ -214,13 +214,13 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G

    // rad init
    let repo = git2::Repository::open(&workdir).unwrap();
-
    let name = "hello-world".to_string();
+
    let name = project::ProjectName::from_str("hello-world").unwrap();
    let description = "Rad repository for tests".to_string();
    let branch = RefString::try_from(DEFAULT_BRANCH).unwrap();
    let visibility = Visibility::default();
    let (rid, _, _) = radicle::rad::init(
        &repo,
-
        &name,
+
        name,
        &description,
        branch,
        visibility,
@@ -294,13 +294,13 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G

    // rad init
    let repo = git2::Repository::open(&workdir).unwrap();
-
    let name = "again-hello-world".to_string();
+
    let name = project::ProjectName::from_str("again-hello-world").unwrap();
    let description = "Rad repository for sorting".to_string();
    let branch = RefString::try_from(DEFAULT_BRANCH).unwrap();
    let visibility = Visibility::default();
    let (rid, _, _) = radicle::rad::init(
        &repo,
-
        &name,
+
        name,
        &description,
        branch,
        visibility,