Skip to content

Commit

Permalink
merge main into feat/refactor-merkle-tree
Browse files Browse the repository at this point in the history
  • Loading branch information
gschoeni committed Aug 28, 2024
2 parents 244cba0 + 8631676 commit 7764ec5
Show file tree
Hide file tree
Showing 96 changed files with 2,651 additions and 1,251 deletions.
1,105 changes: 571 additions & 534 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async-tar = "0.4.2"
async-trait = "0.1.80"
arrow-json = "52.2.0"
bincode = "1.3.3"
blocking = "=1.3.1"
blocking = "1.6.1"
bytecount = "0.6.3"
bytes = "1.5.0"
bytesize = "1.3.0"
Expand Down
6 changes: 3 additions & 3 deletions docs/dev/IntegrateServer+CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ Assuming you have a server running on the default host and port, the test for li
#[test]
fn test_list_remote_branches() -> Result<(), OxenError> {
test::run_empty_remote_repo_test(|remote_repo| {
api::remote::branches::create(remote_repo, "branch-1", "main")?;
api::remote::branches::create(remote_repo, "branch-2", "main")?;
api::client::branches::create(remote_repo, "branch-1", "main")?;
api::client::branches::create(remote_repo, "branch-2", "main")?;

let branches = api::remote::branches::list(remote_repo)?;
let branches = api::client::branches::list(remote_repo)?;
assert_eq!(branches.len(), 3);

assert!(branches.iter().any(|b| b.name == "branch-1"));
Expand Down
1 change: 0 additions & 1 deletion src/cli/src/cmd/checkout.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use async_trait::async_trait;
use clap::{Arg, Command};
use liboxen::command;
use liboxen::error::OxenError;
use liboxen::model::LocalRepository;
use liboxen::repositories;
Expand Down
3 changes: 0 additions & 3 deletions src/cli/src/cmd/info.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use async_trait::async_trait;
use clap::{Arg, Command};
use liboxen::error;
use liboxen::error::OxenError;
use liboxen::model::LocalRepository;
use liboxen::util;
use std::env;
use std::path::PathBuf;

use liboxen::command;
Expand Down
4 changes: 3 additions & 1 deletion src/cli/src/cmd/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use liboxen::core::v0_19_0::index::merkle_tree::CommitMerkleTree;
use liboxen::error::OxenError;
use liboxen::model::{LocalRepository, MerkleHash};

use std::str::FromStr;

use crate::cmd::RunCmd;
pub const NAME: &str = "node";
pub struct NodeCmd;
Expand All @@ -26,7 +28,7 @@ impl RunCmd for NodeCmd {
let node_hash = args.get_one::<String>("node").expect("Must supply node");

let repository = LocalRepository::from_current_dir()?;
let node_hash = MerkleHash::from_str(&node_hash)?;
let node_hash = MerkleHash::from_str(node_hash)?;
let node = CommitMerkleTree::read_node(&repository, &node_hash, false)?;

println!("{:?}", node);
Expand Down
12 changes: 5 additions & 7 deletions src/cli/src/cmd/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ impl RunCmd for StatusCmd {
"On branch {} -> {}\n",
current_branch.name, current_branch.commit_id
);
} else {
if let Some(head) = repositories::commits::head_commit_maybe(&repository)? {
println!(
"You are in 'detached HEAD' state.\nHEAD is now at {} {}\n",
head.id, head.message
);
}
} else if let Some(head) = repositories::commits::head_commit_maybe(&repository)? {
println!(
"You are in 'detached HEAD' state.\nHEAD is now at {} {}\n",
head.id, head.message
);
}

repo_status.print_with_params(&opts);
Expand Down
4 changes: 3 additions & 1 deletion src/cli/src/cmd/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::time::Instant;

use std::str::FromStr;

use crate::cmd::RunCmd;
pub const NAME: &str = "tree";
pub struct TreeCmd;
Expand Down Expand Up @@ -106,7 +108,7 @@ impl RunCmd for TreeCmd {

impl TreeCmd {
fn print_node(&self, repo: &LocalRepository, node: &str, depth: i32) -> Result<(), OxenError> {
let node_hash = MerkleHash::from_str(&node)?;
let node_hash = MerkleHash::from_str(node)?;
let tree = CommitMerkleTree::read_node(repo, &node_hash, true)?.unwrap();
CommitMerkleTree::print_node_depth(&tree, depth);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async-std = { version = "1.12.0", features = ["unstable"] }
async-tar = "0.4.2"
arrow-json = "52.2.0"
bincode = "1.3.3"
blocking = "=1.3.1"
blocking = "1.6.1"
bytecount = "0.6.3"
bytes = "1.2.1"
bytesize = "1.1.0"
Expand Down
6 changes: 3 additions & 3 deletions src/lib/src/api/client/commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::core::v0_10_0::index::{
};
use crate::error::OxenError;
use crate::model::commit::CommitWithBranchName;
use crate::model::entries::unsynced_commit_entry::UnsyncedCommitEntries;
use crate::model::entry::unsynced_commit_entry::UnsyncedCommitEntries;
use crate::model::{Branch, Commit, LocalRepository, RemoteRepository};
use crate::opts::PaginateOpts;
use crate::util::fs::oxen_hidden_dir;
Expand Down Expand Up @@ -1204,8 +1204,8 @@ mod tests {
use crate::core::v0_10_0::index::CommitDBReader;
use crate::error::OxenError;

use crate::model::entries::commit_entry::Entry;
use crate::model::entries::unsynced_commit_entry::UnsyncedCommitEntries;
use crate::model::entry::commit_entry::Entry;
use crate::model::entry::unsynced_commit_entry::UnsyncedCommitEntries;
use crate::opts::PaginateOpts;
use crate::repositories;
use crate::test;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/api/client/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::core::v0_10_0::commits::merge_objects_dbs;
use crate::core::v0_10_0::index::{puller, CommitEntryReader, ObjectDBReader};
use crate::core::v0_19_0::structs::PullProgress;
use crate::error::OxenError;
use crate::model::entries::commit_entry::Entry;
use crate::model::entry::commit_entry::Entry;
use crate::model::{MetadataEntry, NewCommitBody, RemoteRepository};
use crate::opts::UploadOpts;
use crate::{api, constants};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/src/api/client/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub async fn create_node(
let buffer: Vec<u8> = tar.into_inner()?.finish()?;

// Upload the node
let uri = format!("/tree/nodes");
let uri = "/tree/nodes".to_string();
let url = api::endpoint::url_from_repo(remote_repo, &uri)?;
let client = client::builder_for_url(&url)?
.timeout(time::Duration::from_secs(120))
Expand Down
1 change: 1 addition & 0 deletions src/lib/src/api/client/workspaces/data_frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::path::Path;
use crate::model::RemoteRepository;
use crate::view::{JsonDataFrameViewResponse, JsonDataFrameViews, StatusMessage};

pub mod columns;
pub mod rows;

#[derive(Serialize, Deserialize)]
Expand Down
Loading

0 comments on commit 7764ec5

Please sign in to comment.