1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! 🐂 liboxen
//!
//! Fast unstructured data version control.
//!
//! # Examples
//!
//! Instantiating a new repo:
//!
//! ```
//! # #[tokio::main]
//! # async fn main() -> Result<(), liboxen::error::OxenError> {
//! use liboxen::{repositories, test, util};
//!
//! test::run_empty_dir_test_async(|dir| async move {
//! // Instantiate a new repo
//! let repo = repositories::init(&dir)?;
//! // Add a file to the repo
//! let file = dir.join("file.txt");
//! util::fs::write_to_path(&file, "Hello World")?;
//! repositories::add(&repo, &file).await?;
//! // Commit the file
//! repositories::commit(&repo, "Added file.txt")?;
//! Ok(())
//! })
//! .await?;
//! # Ok(())
//! # }
//! ```
//!
//! Push data from local repo to remote repo:
//!
//! Requires a reachable remote, so this example is compiled but not run.
//!
//! ```no_run
//! # #[tokio::main]
//! # async fn main() -> Result<(), liboxen::error::OxenError> {
//! use liboxen::command;
//! use liboxen::model::LocalRepository;
//! use liboxen::repositories;
//!
//! // Create LocalRepository from existing repo
//! let mut repo = LocalRepository::from_dir("test_repo")?;
//! // Add a file to the repo
//! repositories::add(&repo, "file.txt").await?;
//! // Commit the file
//! repositories::commit(&repo, "Added file.txt")?;
//! // Set remote
//! let remote_url = "http://0.0.0.0:3000/ox/test_repo";
//! let remote_name = "origin";
//! command::config::set_remote(&mut repo, remote_name, remote_url)?;
//! // Push to remote
//! repositories::push(&repo).await?;
//! # Ok(())
//! # }
//! ```
//!
//! Clone data from remote url
//!
//! Requires a reachable remote, so this example is compiled but not run.
//!
//! ```no_run
//! # #[tokio::main]
//! # async fn main() -> Result<(), liboxen::error::OxenError> {
//! use liboxen::opts::CloneOpts;
//! use liboxen::repositories;
//!
//! let url = "http://0.0.0.0:3000/ox/test_repo";
//! let repo_dir = "test_repo";
//! let opts = CloneOpts::new(url, &repo_dir);
//! let repo = repositories::clone::clone(&opts).await?;
//! # Ok(())
//! # }
//! ```
extern crate approx;
extern crate bytecount;
extern crate bytesize;
// extern crate ffmpeg_next as ffmpeg;
extern crate fs_extra;
extern crate lazy_static;