Upgrade Rust to 1.66
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
b32ae984ce
commit
f26674a5a9
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
toolchain: 1.65
|
toolchain: 1.66
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --verbose --all-features
|
run: cargo build --verbose --all-features
|
||||||
env:
|
env:
|
||||||
|
|
@ -43,7 +43,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
toolchain: 1.65
|
toolchain: 1.66
|
||||||
- name: Cache cargo registry
|
- name: Cache cargo registry
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -85,13 +85,13 @@ pub fn init(options: Options) -> anyhow::Result<()> {
|
||||||
|
|
||||||
term::success!(
|
term::success!(
|
||||||
"Profile {} created.",
|
"Profile {} created.",
|
||||||
term::format::highlight(&profile.id().to_string())
|
term::format::highlight(profile.id().to_string())
|
||||||
);
|
);
|
||||||
|
|
||||||
term::blank();
|
term::blank();
|
||||||
term::info!(
|
term::info!(
|
||||||
"Your radicle Node ID is {}. This identifies your device.",
|
"Your radicle Node ID is {}. This identifies your device.",
|
||||||
term::format::highlight(&profile.id().to_string())
|
term::format::highlight(profile.id().to_string())
|
||||||
);
|
);
|
||||||
|
|
||||||
term::blank();
|
term::blank();
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ pub fn setup_remotes(setup: project::SetupRemote, remotes: &[NodeId]) -> anyhow:
|
||||||
term::success!("Remote {} set", term::format::highlight(remote));
|
term::success!("Remote {} set", term::format::highlight(remote));
|
||||||
term::success!(
|
term::success!(
|
||||||
"Remote-tracking branch {} created for {}",
|
"Remote-tracking branch {} created for {}",
|
||||||
term::format::highlight(&branch),
|
term::format::highlight(branch),
|
||||||
term::format::tertiary(term::format::node(remote_id))
|
term::format::tertiary(term::format::node(remote_id))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
|
||||||
if path == cwd {
|
if path == cwd {
|
||||||
term::format::highlight(".")
|
term::format::highlight(".")
|
||||||
} else {
|
} else {
|
||||||
term::format::highlight(&path.display())
|
term::format::highlight(path.display())
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ pub fn setup_signing(
|
||||||
));
|
));
|
||||||
true
|
true
|
||||||
} else if interactive.yes() {
|
} else if interactive.yes() {
|
||||||
term::confirm(&format!(
|
term::confirm(format!(
|
||||||
"Configure 🌱 signing key {} in local checkout?",
|
"Configure 🌱 signing key {} in local checkout?",
|
||||||
term::format::tertiary(key),
|
term::format::tertiary(key),
|
||||||
))
|
))
|
||||||
|
|
@ -296,7 +296,7 @@ pub fn setup_signing(
|
||||||
|
|
||||||
if ssh_keys.contains(&ssh_key) {
|
if ssh_keys.contains(&ssh_key) {
|
||||||
term::success!("Signing key is already in {} file", gitsigners);
|
term::success!("Signing key is already in {} file", gitsigners);
|
||||||
} else if term::confirm(&format!("Add signing key to {}?", gitsigners)) {
|
} else if term::confirm(format!("Add signing key to {}?", gitsigners)) {
|
||||||
git::add_gitsigners(repo, [node_id])?;
|
git::add_gitsigners(repo, [node_id])?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let repo = storage.repository(id)?;
|
let repo = storage.repository(id)?;
|
||||||
let head = Doc::<Untrusted>::head(signer.public_key(), &repo)?;
|
let head = Doc::<Untrusted>::head(signer.public_key(), &repo)?;
|
||||||
let history = repo.revwalk(head)?.collect::<Vec<_>>();
|
let history = repo.revwalk(head)?.collect::<Vec<_>>();
|
||||||
let revision = history.len() as usize;
|
let revision = history.len();
|
||||||
|
|
||||||
for (counter, oid) in history.into_iter().rev().enumerate() {
|
for (counter, oid) in history.into_iter().rev().enumerate() {
|
||||||
let oid = oid?.into();
|
let oid = oid?.into();
|
||||||
|
|
|
||||||
|
|
@ -177,11 +177,11 @@ pub fn run(
|
||||||
term::info!(
|
term::info!(
|
||||||
"{}/{} ({}) <- {}/{} ({})",
|
"{}/{} ({}) <- {}/{} ({})",
|
||||||
term::format::dim(target_peer.id),
|
term::format::dim(target_peer.id),
|
||||||
term::format::highlight(&project.default_branch.to_string()),
|
term::format::highlight(project.default_branch.to_string()),
|
||||||
term::format::secondary(&term::format::oid(*target_oid)),
|
term::format::secondary(term::format::oid(*target_oid)),
|
||||||
term::format::dim(term::format::node(patches.public_key())),
|
term::format::dim(term::format::node(patches.public_key())),
|
||||||
term::format::highlight(&head_branch.to_string()),
|
term::format::highlight(head_branch.to_string()),
|
||||||
term::format::secondary(&term::format::oid(head_oid)),
|
term::format::secondary(term::format::oid(head_oid)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Test case where the target branch has been re-written passed the merge-base, since the fork was created
|
// TODO: Test case where the target branch has been re-written passed the merge-base, since the fork was created
|
||||||
|
|
@ -223,7 +223,7 @@ pub fn run(
|
||||||
}
|
}
|
||||||
|
|
||||||
term::blank();
|
term::blank();
|
||||||
term::print(&term::format::dim(format!(
|
term::print(term::format::dim(format!(
|
||||||
"╰{}",
|
"╰{}",
|
||||||
"─".repeat(term::text_width(title_pretty) - 1)
|
"─".repeat(term::text_width(title_pretty) - 1)
|
||||||
)));
|
)));
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ pub fn run(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
term::blank();
|
term::blank();
|
||||||
term::print(&term::format::badge_positive("YOU PROPOSED"));
|
term::print(term::format::badge_positive("YOU PROPOSED"));
|
||||||
|
|
||||||
if own.is_empty() {
|
if own.is_empty() {
|
||||||
term::blank();
|
term::blank();
|
||||||
term::print(&term::format::italic("Nothing to show."));
|
term::print(term::format::italic("Nothing to show."));
|
||||||
} else {
|
} else {
|
||||||
for (id, patch) in &mut own {
|
for (id, patch) in &mut own {
|
||||||
term::blank();
|
term::blank();
|
||||||
|
|
@ -52,11 +52,11 @@ pub fn run(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
term::blank();
|
term::blank();
|
||||||
term::print(&term::format::badge_secondary("OTHERS PROPOSED"));
|
term::print(term::format::badge_secondary("OTHERS PROPOSED"));
|
||||||
|
|
||||||
if other.is_empty() {
|
if other.is_empty() {
|
||||||
term::blank();
|
term::blank();
|
||||||
term::print(&term::format::italic("Nothing to show."));
|
term::print(term::format::italic("Nothing to show."));
|
||||||
} else {
|
} else {
|
||||||
for (id, patch) in &mut other {
|
for (id, patch) in &mut other {
|
||||||
term::blank();
|
term::blank();
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
args.push("rad"); // Push to "rad" remote.
|
args.push("rad"); // Push to "rad" remote.
|
||||||
|
|
||||||
term::subcommand(&format!("git {}", args.join(" ")));
|
term::subcommand(format!("git {}", args.join(" ")));
|
||||||
|
|
||||||
// Push to storage.
|
// Push to storage.
|
||||||
match git::run::<_, _, &str, &str>(&cwd, args, []) {
|
match git::run::<_, _, &str, &str>(cwd, args, []) {
|
||||||
Ok(output) => term::blob(output),
|
Ok(output) => term::blob(output),
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err.into()),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let id = options.id;
|
let id = options.id;
|
||||||
|
|
||||||
if let Ok(Some(_)) = storage.get(signer.public_key(), id.to_owned()) {
|
if let Ok(Some(_)) = storage.get(signer.public_key(), id.to_owned()) {
|
||||||
let namespace = profile.paths().storage().join(&id.to_human());
|
let namespace = profile.paths().storage().join(id.to_human());
|
||||||
|
|
||||||
if !options.confirm
|
if !options.confirm
|
||||||
|| term::confirm(format!(
|
|| term::confirm(format!(
|
||||||
|
|
|
||||||
|
|
@ -94,11 +94,11 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
let storage = &profile.storage;
|
let storage = &profile.storage;
|
||||||
let (_, rid) = radicle::rad::cwd().context("this command must be run within a project")?;
|
let (_, rid) = radicle::rad::cwd().context("this command must be run within a project")?;
|
||||||
let project = storage.repository(rid)?.project_of(profile.id())?;
|
let project = storage.repository(rid)?.project_of(profile.id())?;
|
||||||
let mut node = radicle::node::connect(&profile.node())?;
|
let mut node = radicle::node::connect(profile.node())?;
|
||||||
|
|
||||||
term::info!(
|
term::info!(
|
||||||
"Establishing 🌱 tracking relationship for {}",
|
"Establishing 🌱 tracking relationship for {}",
|
||||||
term::format::highlight(&project.name)
|
term::format::highlight(project.name)
|
||||||
);
|
);
|
||||||
term::blank();
|
term::blank();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ fn main() {
|
||||||
Ok(_) => process::exit(0),
|
Ok(_) => process::exit(0),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
if let Some(err) = err {
|
if let Some(err) = err {
|
||||||
term::error(&format!("Error: rad: {}", err));
|
term::error(format!("Error: rad: {}", err));
|
||||||
}
|
}
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,16 @@ pub struct Table<const W: usize> {
|
||||||
opts: TableOptions,
|
opts: TableOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const W: usize> Default for Table<W> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
rows: Vec::new(),
|
||||||
|
widths: [0; W],
|
||||||
|
opts: TableOptions::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<const W: usize> Table<W> {
|
impl<const W: usize> Table<W> {
|
||||||
pub fn new(opts: TableOptions) -> Self {
|
pub fn new(opts: TableOptions) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -23,14 +33,6 @@ impl<const W: usize> Table<W> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
rows: Vec::new(),
|
|
||||||
widths: [0; W],
|
|
||||||
opts: TableOptions::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn push(&mut self, row: [String; W]) {
|
pub fn push(&mut self, row: [String; W]) {
|
||||||
for (i, cell) in row.iter().enumerate() {
|
for (i, cell) in row.iter().enumerate() {
|
||||||
self.widths[i] = self.widths[i].max(console::measure_text_width(cell));
|
self.widths[i] = self.widths[i].max(console::measure_text_width(cell));
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,6 @@ impl Arbitrary for PublicKey {
|
||||||
impl Arbitrary for hash::Digest {
|
impl Arbitrary for hash::Digest {
|
||||||
fn arbitrary(g: &mut qcheck::Gen) -> Self {
|
fn arbitrary(g: &mut qcheck::Gen) -> Self {
|
||||||
let bytes: Vec<u8> = Arbitrary::arbitrary(g);
|
let bytes: Vec<u8> = Arbitrary::arbitrary(g);
|
||||||
hash::Digest::new(&bytes)
|
hash::Digest::new(bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ mod test {
|
||||||
fn test_empty() {
|
fn test_empty() {
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
let path = tmp.path().join("cache");
|
let path = tmp.path().join("cache");
|
||||||
let cache = Book::open(&path).unwrap();
|
let cache = Book::open(path).unwrap();
|
||||||
|
|
||||||
assert!(cache.is_empty().unwrap());
|
assert!(cache.is_empty().unwrap());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ impl Announcement {
|
||||||
/// Verify this announcement's signature.
|
/// Verify this announcement's signature.
|
||||||
pub fn verify(&self) -> bool {
|
pub fn verify(&self) -> bool {
|
||||||
let msg = wire::serialize(&self.message);
|
let msg = wire::serialize(&self.message);
|
||||||
self.node.verify(&msg, &self.signature).is_ok()
|
self.node.verify(msg, &self.signature).is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn matches(&self, filter: &Filter) -> bool {
|
pub fn matches(&self, filter: &Filter) -> bool {
|
||||||
|
|
|
||||||
|
|
@ -126,10 +126,7 @@ impl Encode for PublicKey {
|
||||||
|
|
||||||
impl<const T: usize> Encode for &[u8; T] {
|
impl<const T: usize> Encode for &[u8; T] {
|
||||||
fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
|
fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
|
||||||
// TODO: This can be removed when the clippy bugs are fixed
|
writer.write_all(&**self)?;
|
||||||
#[allow(clippy::explicit_auto_deref)]
|
|
||||||
writer.write_all(*self)?;
|
|
||||||
|
|
||||||
Ok(mem::size_of::<Self>())
|
Ok(mem::size_of::<Self>())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ pub fn run(profile: radicle::Profile) -> Result<(), Box<dyn std::error::Error +
|
||||||
// Connect to local node and announce refs to the network.
|
// Connect to local node and announce refs to the network.
|
||||||
// If our node is not running, we simply skip this step, as the
|
// If our node is not running, we simply skip this step, as the
|
||||||
// refs will be announced eventually, when the node restarts.
|
// refs will be announced eventually, when the node restarts.
|
||||||
if let Ok(mut conn) = radicle::node::connect(&profile.node()) {
|
if let Ok(mut conn) = radicle::node::connect(profile.node()) {
|
||||||
conn.announce_refs(url.repo)?;
|
conn.announce_refs(url.repo)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ fn main() -> anyhow::Result<()> {
|
||||||
let sigrefs = project.sign_refs(&signer)?;
|
let sigrefs = project.sign_refs(&signer)?;
|
||||||
let head = project.set_head()?;
|
let head = project.set_head()?;
|
||||||
|
|
||||||
radicle::node::connect(&profile.node())?.announce_refs(id)?;
|
radicle::node::connect(profile.node())?.announce_refs(id)?;
|
||||||
|
|
||||||
println!("head: {}", head);
|
println!("head: {}", head);
|
||||||
println!("ok: {}", sigrefs.signature);
|
println!("ok: {}", sigrefs.signature);
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ pub struct Profile {
|
||||||
impl Profile {
|
impl Profile {
|
||||||
pub fn init(home: impl AsRef<Path>, passphrase: &str) -> Result<Self, Error> {
|
pub fn init(home: impl AsRef<Path>, passphrase: &str) -> Result<Self, Error> {
|
||||||
let home = home.as_ref().to_path_buf();
|
let home = home.as_ref().to_path_buf();
|
||||||
let storage = Storage::open(&home.join("storage"))?;
|
let storage = Storage::open(home.join("storage"))?;
|
||||||
let keystore = Keystore::new(&home.join("keys"));
|
let keystore = Keystore::new(&home.join("keys"));
|
||||||
let public_key = keystore.init("radicle", passphrase)?;
|
let public_key = keystore.init("radicle", passphrase)?;
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ impl Profile {
|
||||||
|
|
||||||
pub fn load() -> Result<Self, Error> {
|
pub fn load() -> Result<Self, Error> {
|
||||||
let home = self::home()?;
|
let home = self::home()?;
|
||||||
let storage = Storage::open(&home.join("storage"))?;
|
let storage = Storage::open(home.join("storage"))?;
|
||||||
let keystore = Keystore::new(&home.join("keys"));
|
let keystore = Keystore::new(&home.join("keys"));
|
||||||
let public_key = keystore
|
let public_key = keystore
|
||||||
.public_key()?
|
.public_key()?
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ mod tests {
|
||||||
let (_, head) = project_repo.head().unwrap();
|
let (_, head) = project_repo.head().unwrap();
|
||||||
|
|
||||||
// Test canonical refs.
|
// Test canonical refs.
|
||||||
assert_eq!(refs.head(&component!("master")).unwrap(), head);
|
assert_eq!(refs.head(component!("master")).unwrap(), head);
|
||||||
assert_eq!(project_repo.raw().refname_to_id("HEAD").unwrap(), *head);
|
assert_eq!(project_repo.raw().refname_to_id("HEAD").unwrap(), *head);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
project_repo
|
project_repo
|
||||||
|
|
|
||||||
|
|
@ -1059,7 +1059,7 @@ mod tests {
|
||||||
let addr = socket.local_addr().unwrap();
|
let addr = socket.local_addr().unwrap();
|
||||||
let source_path = tmp.path().join("source");
|
let source_path = tmp.path().join("source");
|
||||||
let target_path = tmp.path().join("target");
|
let target_path = tmp.path().join("target");
|
||||||
let (source, _) = fixtures::repository(&source_path);
|
let (source, _) = fixtures::repository(source_path);
|
||||||
|
|
||||||
transport::local::register(storage.clone());
|
transport::local::register(storage.clone());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ impl Refs {
|
||||||
let refs = self;
|
let refs = self;
|
||||||
let msg = refs.canonical();
|
let msg = refs.canonical();
|
||||||
|
|
||||||
match signer.verify(&msg, &signature) {
|
match signer.verify(msg, &signature) {
|
||||||
Ok(()) => Ok(SignedRefs {
|
Ok(()) => Ok(SignedRefs {
|
||||||
refs,
|
refs,
|
||||||
signature,
|
signature,
|
||||||
|
|
@ -230,7 +230,7 @@ impl SignedRefs<Unverified> {
|
||||||
pub fn verify(&self, signer: &PublicKey) -> Result<(), crypto::Error> {
|
pub fn verify(&self, signer: &PublicKey) -> Result<(), crypto::Error> {
|
||||||
let canonical = self.refs.canonical();
|
let canonical = self.refs.canonical();
|
||||||
|
|
||||||
match signer.verify(&canonical, &self.signature) {
|
match signer.verify(canonical, &self.signature) {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
1.65
|
1.66
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue