Skip to content

Commit 22d888a

Browse files
author
fossdd
committed
Update pijul
1 parent 2fee94f commit 22d888a

36 files changed

+5337
-1776
lines changed

Cargo.lock

Lines changed: 234 additions & 217 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libpijul/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libpijul"
33
description = "Core library of Pijul, a distributed version control system based on a sound theory of collaborative work."
4-
version = "1.0.0-alpha.48"
4+
version = "1.0.0-alpha.50"
55

66
repository = "https://nest.pijul.com/pijul/libpijul"
77
documentation = "https://docs.rs/libpijul"
@@ -30,6 +30,8 @@ include = [
3030
"src/change/change_file.rs",
3131
"src/change/text_changes.rs",
3232
"src/change/noenc.rs",
33+
"src/change/parse.rs",
34+
"src/change/printable.rs",
3335
"src/alive/tarjan.rs",
3436
"src/alive/debug.rs",
3537
"src/alive/retrieve.rs",
@@ -96,7 +98,7 @@ default = [ "ondisk-repos", "text-changes", "dump" ]
9698
tarball = [ "tar", "flate2" ]
9799

98100
[dependencies]
99-
sanakirja = { version = "1.2.9", features = [ "crc32" ] }
101+
sanakirja = { version = "1.2.13", features = [ "crc32" ] }
100102
byteorder = "1.3"
101103
log = "0.4"
102104
serde = "1.0"
@@ -115,6 +117,7 @@ lazy_static = "1.4"
115117
twox-hash = "1.6"
116118
crossbeam-deque = "0.8"
117119
crossbeam-utils = "0.8"
120+
nom = "7"
118121

119122
zstd-seekable = { version = "0.1.0", optional = true }
120123
cfg-if = "1.0"
@@ -150,3 +153,5 @@ anyhow = "1.0"
150153
detone = "1.0"
151154
rand = "0.7"
152155
rand_chacha = "0.2"
156+
quickcheck = "1"
157+
quickcheck_macros = "1"

libpijul/src/alive/dfs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ fn test4165() {
8686
index: 0,
8787
lowlink: 0,
8888
scc: 0,
89+
extra: Vec::new(),
8990
};
9091
13
9192
],

libpijul/src/change.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ use chrono::{DateTime, Utc};
88
#[cfg(feature = "zstd")]
99
use std::io::Write;
1010

11+
#[cfg(feature = "text-changes")]
12+
mod parse;
13+
#[cfg(feature = "text-changes")]
14+
mod printable;
1115
#[cfg(feature = "text-changes")]
1216
mod text_changes;
17+
pub use parse::*; // for testing
18+
pub use printable::*; // for testing
1319
pub use text_changes::{TextDeError, TextSerError, WriteChangeLine};
1420

1521
mod change_file;
@@ -558,6 +564,14 @@ impl EdgeMap<Option<Hash>> {
558564
impl<L: Clone> Hunk<Option<Hash>, L> {
559565
pub fn inverse(&self, hash: &Hash) -> Self {
560566
match self {
567+
Hunk::AddRoot { name, inode } => Hunk::DelRoot {
568+
name: name.inverse(hash),
569+
inode: inode.inverse(hash),
570+
},
571+
Hunk::DelRoot { name, inode } => Hunk::AddRoot {
572+
name: name.inverse(hash),
573+
inode: inode.inverse(hash),
574+
},
561575
Hunk::FileMove { del, add, path } => Hunk::FileMove {
562576
del: add.inverse(hash),
563577
add: del.inverse(hash),
@@ -747,6 +761,14 @@ pub enum BaseHunk<Atom, Local> {
747761
local: Local,
748762
encoding: Option<Encoding>,
749763
},
764+
AddRoot {
765+
name: Atom,
766+
inode: Atom,
767+
},
768+
DelRoot {
769+
name: Atom,
770+
inode: Atom,
771+
},
750772
}
751773

752774
#[doc(hidden)]
@@ -832,6 +854,10 @@ impl<Context, Local> Iterator for HunkIter<Hunk<Context, Local>, Atom<Context>>
832854
Hunk::SolveOrderConflict { change, .. } => Some(change),
833855
Hunk::UnsolveOrderConflict { change, .. } => Some(change),
834856
Hunk::ResurrectZombies { change, .. } => Some(change),
857+
Hunk::AddRoot { inode, name } | Hunk::DelRoot { inode, name } => {
858+
self.extra = Some(inode);
859+
Some(name)
860+
}
835861
}
836862
} else {
837863
None
@@ -894,6 +920,17 @@ impl<'a, Context, Local> Iterator for HunkIter<&'a Hunk<Context, Local>, &'a Ato
894920
Hunk::SolveOrderConflict { ref change, .. } => Some(change),
895921
Hunk::UnsolveOrderConflict { ref change, .. } => Some(change),
896922
Hunk::ResurrectZombies { ref change, .. } => Some(change),
923+
Hunk::AddRoot {
924+
ref inode,
925+
ref name,
926+
}
927+
| Hunk::DelRoot {
928+
ref inode,
929+
ref name,
930+
} => {
931+
self.extra = Some(inode);
932+
Some(name)
933+
}
897934
}
898935
} else {
899936
None
@@ -975,6 +1012,17 @@ impl<'a, Context, Local> Iterator for RevHunkIter<&'a Hunk<Context, Local>, &'a
9751012
Hunk::SolveOrderConflict { ref change, .. } => Some(change),
9761013
Hunk::UnsolveOrderConflict { ref change, .. } => Some(change),
9771014
Hunk::ResurrectZombies { ref change, .. } => Some(change),
1015+
Hunk::AddRoot {
1016+
ref name,
1017+
ref inode,
1018+
}
1019+
| Hunk::DelRoot {
1020+
ref name,
1021+
ref inode,
1022+
} => {
1023+
self.extra = Some(inode);
1024+
Some(name)
1025+
}
9781026
}
9791027
} else {
9801028
None
@@ -1093,6 +1141,7 @@ impl<H> Hunk<H, Local> {
10931141
| Hunk::SolveOrderConflict { ref local, .. }
10941142
| Hunk::UnsolveOrderConflict { ref local, .. }
10951143
| Hunk::ResurrectZombies { ref local, .. } => &local.path,
1144+
Hunk::AddRoot { .. } | Hunk::DelRoot { .. } => "/",
10961145
}
10971146
}
10981147

@@ -1205,6 +1254,14 @@ impl<A, Local> BaseHunk<A, Local> {
12051254
local: l(local),
12061255
encoding,
12071256
},
1257+
BaseHunk::AddRoot { name, inode } => BaseHunk::AddRoot {
1258+
name: f(name)?,
1259+
inode: f(inode)?,
1260+
},
1261+
BaseHunk::DelRoot { name, inode } => BaseHunk::DelRoot {
1262+
name: f(name)?,
1263+
inode: f(inode)?,
1264+
},
12081265
})
12091266
}
12101267
}

0 commit comments

Comments
 (0)