TIPZ7UXNIZ3UMIXDUP2M33FUP7LY3XM2NX424ZE4EO5V7CZTOGXQC
I24UEJQLCH2SOXA4UHIYWTRDCHSOPU7AFTRUOTX7HZIAV4AZKYEQC
SXEYMYF7P4RZMZ46WPL4IZUTSQ2ATBWYZX7QNVMS3SGOYXYOHAGQC
3M7WBE24JTPTHWQOU5PO2ZJYKPKEH2F6R4M6RWIRFG334PQEA55QC
YN63NUZO4LVJ7XPMURDULTXBVJKW5MVCTZ24R7Z52QMHO3HPDUVQC
GHO6DWPILBBTL6CVZKERJBTFL3EY6ZT4YM4E5R4S6YPGVFKFHCVAC
I52XSRUH5RVHQBFWVMAQPTUSPAJ4KNVID2RMI3UGCVKFLYUO6WZAC
CCLLB7OIFNFYJZTG3UCI7536TOCWSCSXR67VELSB466R24WLJSDAC
IIV3EL2XYI2X7HZWKXEXQFAE3R3KC2Q7SGOT3Q332HSENMYVF32QC
SPA2OL5ITFMLB5P2WL342QAU2FXPKSFS4XHAMW6HYWOGSGLO2MJAC
3YDPHBANMNSK7Z5SCG745VLTP4BBQWIXCJTQOSDI6UJGYR6S45EQC
7UPL3Y2A5QOBU6VIUHNWEFGSGQ5CMWGDGOVLRZ53UARXG3TDGLMAC
NA5I4WYNE2O3LPSHXGWXW7XL4YNYFDREEGDOP6LJ5HJXTQDXM7BAC
BZSC7VMYSFRXDHDDAMCDR6X67FN5VWIBOSE76BQLX7OCVOJFUA3AC
Q45QHPO4HDTEZF2W4UDZSYYQ46BPEIWSW4GJILZR5HTJNLKXJABQC
let mut channel = txn.open_or_create_channel("main")?;
let _h0 = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let _h0 = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
let channel2 = txn.fork(&channel, "main2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h1)?;
let channel2 = (&mut *txn.write().unwrap()).fork(&channel, "main2")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h1)?;
debug_to_file(&txn, &channel.borrow(), "debug_un")?;
debug_to_file(&txn, &channel2.borrow(), "debug_un2")?;
txn.commit()?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug_un")?;
debug_to_file(&*txn.read().unwrap(), &channel2, "debug_un2")?;
commit(txn)?;
let mut channel = txn.open_or_create_channel("main")?;
let _h0 = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let channel = txn.write().unwrap().open_or_create_channel("main")?;
let _h0 = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
let channel2 = txn.fork(&channel, "main2")?;
debug_to_file(&txn, &channel.borrow(), "debug_un0")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h1)?;
debug_to_file(&txn, &channel.borrow(), "debug_un1")?;
let channel2 = txn.write().unwrap().fork(&channel, "main2")?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug_un0")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h1)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug_un1")?;
debug_to_file(&txn, &channel.borrow(), "debug_un")?;
debug_to_file(&txn, &channel2.borrow(), "debug_un2")?;
txn.commit()?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug_un")?;
debug_to_file(&*txn.read().unwrap(), &channel2, "debug_un2")?;
commit(txn)?;
let mut channel = txn.open_or_create_channel("main")?;
let _h0 = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let _h0 = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
let mut repo = working_copy::memory::Memory::new();
let mut repo2 = working_copy::memory::Memory::new();
let mut repo3 = working_copy::memory::Memory::new();
let repo = Arc::new(working_copy::memory::Memory::new());
let repo2 = Arc::new(working_copy::memory::Memory::new());
let repo3 = Arc::new(working_copy::memory::Memory::new());
let mut txn = env.mut_txn_begin().unwrap();
let mut txn2 = env2.mut_txn_begin().unwrap();
let mut txn3 = env3.mut_txn_begin().unwrap();
txn.add_file("file")?;
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let txn2 = Arc::new(RwLock::new(env2.mut_txn_begin().unwrap()));
let txn3 = Arc::new(RwLock::new(env3.mut_txn_begin().unwrap()));
txn.write().unwrap().add_file("file")?;
let mut channel = txn.open_or_create_channel("main")?;
let h0 = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let h0 = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
let mut channel2 = txn2.open_or_create_channel("main")?;
let mut channel3 = txn3.open_or_create_channel("main")?;
let channel2 = (&mut *txn2.write().unwrap()).open_or_create_channel("main")?;
let channel3 = (&mut *txn3.write().unwrap()).open_or_create_channel("main")?;
repo2.write_file::<_, std::io::Error, _>("file", |w| {
w.write_all(b"a\nb\nx\nc\nd\n")?;
Ok(())
})?;
let h2 = record_all(&mut repo2, &changes, &mut txn2, &mut channel2, "")?;
repo2.write_file("file")?.write_all(b"a\nb\nx\nc\nd\n")?;
let h2 = record_all(repo2.clone(), &changes, txn2.clone(), channel2.clone(), "")?;
repo2.write_file::<_, std::io::Error, _>("file", |w| {
w.write_all(b"a\nb\nx\nc\ny\nd\n")?;
Ok(())
})?;
let h3 = record_all(&mut repo2, &changes, &mut txn2, &mut channel2, "")?;
repo2.write_file("file")?.write_all(b"a\nb\nx\nc\ny\nd\n")?;
let h3 = record_all(repo2.clone(), &changes, txn2.clone(), channel2.clone(), "")?;
apply::apply_change(&changes, &mut txn, &mut channel, &h2)?;
apply::apply_change(&changes, &mut txn, &mut channel, &h3)?;
apply::apply_change(
&changes,
&mut *txn.write().unwrap(),
&mut *channel.write().unwrap(),
&h2,
)?;
apply::apply_change(
&changes,
&mut *txn.write().unwrap(),
&mut *channel.write().unwrap(),
&h3,
)?;
let mut txn = env.mut_txn_begin().unwrap();
let mut txn2 = env2.mut_txn_begin().unwrap();
txn.add_file("file")?;
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let txn2 = Arc::new(RwLock::new(env2.mut_txn_begin().unwrap()));
txn.write().unwrap().add_file("file")?;
let mut channel = txn.open_or_create_channel("main")?;
let h0 = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let mut channel2 = txn2.open_or_create_channel("main")?;
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let h0 = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
let channel2 = (&mut *txn2.write().unwrap()).open_or_create_channel("main")?;
let h1 = record_all_output(&mut repo, &changes, &mut txn, &mut channel, "")?;
debug_to_file(&txn, &channel.borrow(), "debug_a")?;
let h1 = record_all_output(
repo.clone(),
changes.clone(),
txn.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug_a")?;
repo2.write_file::<_, std::io::Error, _>("file", |w| {
w.write_all(b"a\nb\nx\nc\nd\n")?;
Ok(())
})?;
let h2 = record_all_output(&mut repo2, &changes, &mut txn2, &mut channel2, "")?;
debug_to_file(&txn2, &channel2.borrow(), "debug_b")?;
repo2.write_file("file")?.write_all(b"a\nb\nx\nc\nd\n")?;
let h2 = record_all_output(
repo2.clone(),
changes.clone(),
txn2.clone(),
channel2.clone(),
"",
)?;
debug_to_file(&*txn2.read().unwrap(), &channel2, "debug_b")?;
apply::apply_change(&changes, &mut txn2, &mut channel2, &h1)?;
debug_to_file(&txn2, &channel2.borrow(), "debug_un3")?;
apply::apply_change(
&changes,
&mut *txn2.write().unwrap(),
&mut *channel2.write().unwrap(),
&h1,
)?;
debug_to_file(&*txn2.read().unwrap(), &channel2, "debug_un3")?;
crate::unrecord::unrecord(&mut txn2, &mut channel2, &changes, &h1)?;
debug_to_file(&txn2, &channel2.borrow(), "debug_un4")?;
crate::unrecord::unrecord(&mut *txn2.write().unwrap(), &channel2, &changes, &h1)?;
debug_to_file(&*txn2.read().unwrap(), &channel2, "debug_un4")?;
let mut channel = txn.open_or_create_channel("main")?;
record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
debug_to_file(&txn, &channel.borrow(), "debug_un")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h1)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug_un")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h1)?;
let mut txn = env.mut_txn_begin().unwrap();
txn.add_file("dir/file")?;
debug_inodes(&txn);
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
txn.write().unwrap().add_file("dir/file")?;
debug_inodes(&*txn.read().unwrap());
let mut channel = txn.open_or_create_channel("main")?;
let h0 = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let h0 = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
debug_inodes(&txn);
let mut channel2 = txn.open_or_create_channel("main2")?;
match crate::unrecord::unrecord(&mut txn, &mut channel2, &changes, &h0) {
debug_inodes(&*txn.read().unwrap());
let channel2 = (&mut *txn.write().unwrap()).open_or_create_channel("main2")?;
match crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel2, &changes, &h0) {
debug_inodes(&txn);
debug_to_file(&txn, &channel.borrow(), "debug")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h1)?;
debug_inodes(&*txn.read().unwrap());
debug_to_file(&*txn.read().unwrap(), &channel, "debug")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h1)?;
debug_inodes(&txn);
debug_to_file(&txn, &channel.borrow(), "debug2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h0)?;
debug_to_file(&txn, &channel.borrow(), "debug3")?;
debug_inodes(&*txn.read().unwrap());
debug_to_file(&*txn.read().unwrap(), &channel, "debug2")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h0)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug3")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h)?;
debug_to_file(&txn, &channel.borrow(), "debug2")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h0)?;
debug_to_file(&txn, &channel.borrow(), "debug3")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h0)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug3")?;
repo.write_file::<_, std::io::Error, _>("file", |w| Ok(w.write_all(b"a\nx\nb\n")?))?;
record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
repo.write_file::<_, std::io::Error, _>("file", |w| Ok(w.write_all(b"a\ny\nb\n")?))?;
let b = record_all(&mut repo, &changes, &mut txn, &mut channel2, "")?;
repo.write_file("file")?.write_all(b"a\nx\nb\n")?;
record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
repo.write_file("file")?.write_all(b"a\ny\nb\n")?;
let b = record_all(repo.clone(), &changes, txn.clone(), channel2.clone(), "")?;
apply::apply_change(&changes, &mut txn, &mut channel, &b)?;
debug_to_file(&txn, &channel.borrow(), "debug")?;
apply::apply_change(
&changes,
&mut *txn.write().unwrap(),
&mut *channel.write().unwrap(),
&b,
)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug")?;
Ok(())
})?;
let c = record_all(&mut repo, &changes, &mut txn, &mut channel, "")?;
debug_to_file(&txn, &channel.borrow(), "debug2")?;
}
let c = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "")?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &c)?;
debug_to_file(&txn, &channel.borrow(), "debug3")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &mut channel, &changes, &c)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug3")?;
let mut txn = env.mut_txn_begin().unwrap();
let mut channel = txn.open_or_create_channel("main")?;
let mut channel2 = txn.open_or_create_channel("main2")?;
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let channel2 = (&mut *txn.write().unwrap()).open_or_create_channel("main2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h2)?;
debug_to_file(&txn, &channel.borrow(), "debug2")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h2)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug2")?;
let mut txn = env.mut_txn_begin().unwrap();
let mut channel = txn.open_or_create_channel("main")?;
let mut channel2 = txn.open_or_create_channel("main2")?;
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let mut channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let mut channel2 = (&mut *txn.write().unwrap()).open_or_create_channel("main2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h2)?;
debug_to_file(&txn, &channel.borrow(), "debug2")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &mut channel, &changes, &h2)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug2")?;
apply::apply_change(&changes, &mut txn, &mut channel2, &r).unwrap();
debug_to_file(&txn, &channel2.borrow(), format!("debug_{}", i))?;
apply::apply_change(
&changes,
&mut *txn.write().unwrap(),
&mut *channel2.write().unwrap(),
&r,
)
.unwrap();
debug_to_file(&*txn.read().unwrap(), &channel2, format!("debug_{}", i))?;
crate::unrecord::unrecord(&mut txn, &mut channel2, &changes, &h1)?;
debug_to_file(&txn, &channel2.borrow(), "debug_final")?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &mut channel2, &changes, &h1)?;
debug_to_file(&*txn.read().unwrap(), &channel2, "debug_final")?;
let mut txn = env.mut_txn_begin().unwrap();
let mut channel = txn.open_or_create_channel("main")?;
let mut channel2 = txn.open_or_create_channel("main2")?;
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
let channel2 = (&mut *txn.write().unwrap()).open_or_create_channel("main2")?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h1)?;
crate::unrecord::unrecord(&mut txn, &mut channel, &changes, &h2)?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h1)?;
crate::unrecord::unrecord(&mut *txn.write().unwrap(), &channel, &changes, &h2)?;
use super::*;
use crate::working_copy::WorkingCopy;
#[test]
fn add_non_utf8_file_test() -> Result<(), anyhow::Error> {
env_logger::try_init().unwrap_or(());
let mut buf = Vec::new();
use std::io::Read;
let mut fh = std::fs::File::open("src/tests/data/1252.1")?;
fh.read_to_end(&mut buf)?;
let mut repo = working_copy::memory::Memory::new();
repo.add_file("file", buf);
let env = pristine::sanakirja::Pristine::new_anon()?;
let mut txn = env.mut_txn_begin();
let mut channel = txn.open_or_create_channel("main")?;
txn.add_file("file")?;
let store = changestore::memory::Memory::new();
let (h, change) = record_all_change(&mut repo, &store, &mut txn, &mut channel, "")?;
let mut v = Vec::new();
change
.write(
&store,
Some(h),
|l, _p| format!("{}:{}", l.path, l.line),
true,
&mut v,
)
.unwrap();
let lines: Vec<&str> = std::str::from_utf8(&v)
.unwrap()
.lines()
.filter(|l| l.starts_with("+"))
.collect();
assert_eq!(
vec!["+ French / Français (Windows CP 1252)", "+ €‚ƒ„…†‡, Salut"],
lines
);
Ok(())
}
/// Change a non-utf-8 text file.
#[test]
fn change_non_utf8_file_test() -> Result<(), anyhow::Error> {
env_logger::try_init().unwrap_or(());
let mut buf = Vec::new();
use std::io::Read;
let mut fh = std::fs::File::open("src/tests/data/8859-1.1")?;
fh.read_to_end(&mut buf)?;
let mut repo = working_copy::memory::Memory::new();
repo.add_file("file", buf);
let env = pristine::sanakirja::Pristine::new_anon()?;
let mut txn = env.mut_txn_begin();
let mut channel = txn.open_or_create_channel("main")?;
txn.add_file("file")?;
let store = changestore::memory::Memory::new();
record_all(&mut repo, &store, &mut txn, &mut channel, "")?;
let mut buf = Vec::new();
{
use std::io::Read;
let mut fh = std::fs::File::open("src/tests/data/8859-1.2")?;
fh.read_to_end(&mut buf)?;
}
repo.write_file::<_, std::io::Error, _>("file", |w| {
w.write_all(&buf).unwrap();
Ok(())
})?;
let (h1, change1) = record_all_change(&mut repo, &store, &mut txn, &mut channel, "")?;
// only one line was changed
let mut v = Vec::new();
change1
.write(
&store,
Some(h1),
|l, _p| format!("{}:{}", l.path, l.line),
true,
&mut v,
)
.unwrap();
let lines: Vec<&str> = std::str::from_utf8(&v)
.unwrap()
.lines()
.filter(|l| l.starts_with(|c| c == '-' || c == '+'))
.collect();
assert_eq!(
vec![
"- French / Français (ISO Latin-1 / ISO 8859-1)",
"+ Français / French (ISO Latin-1 / ISO 8859-1)"
],
lines
);
Ok(())
}
fn record_all<T: MutTxnT, R: WorkingCopy, P: ChangeStore>(
repo: &R,
fn record_all<
T: MutTxnT + Send + Sync + 'static,
R: WorkingCopy + Send + Sync + 'static,
P: ChangeStore + Clone + Send + Sync + 'static,
>(
repo: Arc<R>,
let hash = record_all(
repo.as_ref(),
changes.as_ref(),
&mut *txn.write().unwrap(),
channel,
prefix,
)?;
output::output_repository_no_pending(repo, changes, txn, channel.clone(), "", true, None, 1)
.unwrap();
let hash = record_all(repo.clone(), &changes, txn.clone(), channel.clone(), prefix)?;
output::output_repository_no_pending(
repo.clone(),
&changes,
txn,
channel.clone(),
"",
true,
None,
1,
)
.unwrap();
let mut txn = env.mut_txn_begin().unwrap();
txn.add_file("dir/file").unwrap();
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
txn.write().unwrap().add_file("dir/file").unwrap();
let mut channel = txn.open_or_create_channel("main").unwrap();
record_all(&mut repo, &changes, &mut txn, &mut channel, "").unwrap();
let channel = txn.write().unwrap().open_or_create_channel("main").unwrap();
record_all(repo, &changes, txn.clone(), channel.clone(), "").unwrap();
assert!(txn.add_file("dir/file").is_err());
debug_to_file(&txn, &channel, "debug").unwrap();
txn.commit().unwrap();
assert!(txn.write().unwrap().add_file("dir/file").is_err());
debug_to_file(&*txn.read().unwrap(), &channel, "debug").unwrap();
commit(txn).unwrap()
let mut repo = Arc::new(working_copy::memory::Memory::new());
let changes = Arc::new(changestore::memory::Memory::new());
let repo = Arc::new(working_copy::memory::Memory::new());
let changes = changestore::memory::Memory::new();
let mut repo = Arc::new(working_copy::memory::Memory::new());
let changes = Arc::new(changestore::memory::Memory::new());
let repo = Arc::new(working_copy::memory::Memory::new());
let changes = changestore::memory::Memory::new();
let mut repo = Arc::new(working_copy::memory::Memory::new());
let changes = Arc::new(changestore::memory::Memory::new());
let repo = Arc::new(working_copy::memory::Memory::new());
let changes = changestore::memory::Memory::new();
repo.write_file::<_, std::io::Error, _>("dir/file", |w| {
w.write_all(b"a\nb\nc\ne\nf\n")?;
Ok(())
})?;
record_all_output(&mut repo, &changes, &mut txn, &mut channel, "")?;
repo.write_file::<_, std::io::Error, _>("dir/file", |w| {
w.write_all(b"a\nb\nc\nf\n")?;
Ok(())
})?;
debug_to_file(&txn, &channel.borrow(), "debug0").unwrap();
record_all_output(&mut repo, &changes, &mut txn, &mut channel, "")?;
debug_to_file(&txn, &channel.borrow(), "debug1").unwrap();
repo.write_file::<_, std::io::Error, _>("dir/file", |w| {
w.write_all(b"a\nb\nc\n")?;
Ok(())
})?;
record_all_output(&mut repo, &changes, &mut txn, &mut channel, "")?;
repo.write_file("dir/file")?.write_all(b"a\nb\nc\ne\nf\n")?;
record_all_output(
repo.clone(),
changes.clone(),
txn.clone(),
channel.clone(),
"",
)?;
repo.write_file("dir/file")?.write_all(b"a\nb\nc\nf\n")?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug0").unwrap();
record_all_output(
repo.clone(),
changes.clone(),
txn.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug1").unwrap();
repo.write_file("dir/file")?.write_all(b"a\nb\nc\n")?;
record_all_output(
repo.clone(),
changes.clone(),
txn.clone(),
channel.clone(),
"",
)?;
let mut txn_alice = env_alice.mut_txn_begin().unwrap();
txn_alice.add_file("file")?;
let txn_alice = Arc::new(RwLock::new(env_alice.mut_txn_begin().unwrap()));
txn_alice.write().unwrap().add_file("file")?;
let mut channel = txn_alice.open_or_create_channel("main")?;
let alice0 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_to_file(&txn_alice, &channel.borrow(), "debug0").unwrap();
let channel = (&mut *txn_alice.write().unwrap()).open_or_create_channel("main")?;
let alice0 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug0").unwrap();
let alice1 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_to_file(&txn_alice, &channel.borrow(), "debug1").unwrap();
let alice1 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug1").unwrap();
let mut txn_bob = env_bob.mut_txn_begin().unwrap();
let mut channel = txn_bob.open_or_create_channel("main")?;
apply::apply_change(&changes, &mut txn_bob, &mut channel, &alice0)?;
let txn_bob = Arc::new(RwLock::new(env_bob.mut_txn_begin().unwrap()));
let channel = (&mut *txn_bob.write().unwrap()).open_or_create_channel("main")?;
apply::apply_change(
&changes,
&mut *txn_bob.write().unwrap(),
&mut *channel.write().unwrap(),
&alice0,
)?;
let mut txn_alice = env_alice.mut_txn_begin().unwrap();
txn_alice.add_file("file")?;
let txn_alice = Arc::new(RwLock::new(env_alice.mut_txn_begin().unwrap()));
txn_alice.write().unwrap().add_file("file")?;
let mut channel = txn_alice.open_or_create_channel("main")?;
let alice0 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
let channel = (&mut *txn_alice.write().unwrap()).open_or_create_channel("main")?;
let alice0 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&txn_alice, &channel.borrow(), "debug0").unwrap();
txn_alice.add_dir("dir")?;
txn_alice.move_file("file", "dir/file2")?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug0").unwrap();
txn_alice.write().unwrap().add_dir("dir")?;
txn_alice.write().unwrap().move_file("file", "dir/file2")?;
debug_tree(&txn_alice, "debug_tree")?;
let alice1 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_tree(&*txn_alice.read().unwrap(), "debug_tree")?;
let alice1 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&txn_alice, &channel.borrow(), "debug1").unwrap();
debug_tree(&txn_alice, "debug_tree")?;
debug_inodes(&txn_alice);
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug1").unwrap();
debug_tree(&*txn_alice.read().unwrap(), "debug_tree")?;
debug_inodes(&*txn_alice.read().unwrap());
let alice2 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_to_file(&txn_alice, &channel.borrow(), "debug2").unwrap();
txn_alice.commit()?;
let alice2 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug2").unwrap();
commit(txn_alice).unwrap();
let mut txn_bob = env_bob.mut_txn_begin().unwrap();
let mut channel = txn_bob.open_or_create_channel("main")?;
apply::apply_change(&changes, &mut txn_bob, &mut channel, &alice0)?;
let txn_bob = Arc::new(RwLock::new(env_bob.mut_txn_begin().unwrap()));
let channel = (&mut *txn_bob.write().unwrap()).open_or_create_channel("main")?;
apply::apply_change(
&changes,
&mut *txn_bob.write().unwrap(),
&mut *channel.write().unwrap(),
&alice0,
)?;
let mut txn_alice = env_alice.mut_txn_begin().unwrap();
txn_alice.add_file("file")?;
txn_alice.add_file("file2")?;
let txn_alice = Arc::new(RwLock::new(env_alice.mut_txn_begin().unwrap()));
txn_alice.write().unwrap().add_file("file")?;
txn_alice.write().unwrap().add_file("file2")?;
let mut channel = txn_alice.open_or_create_channel("main")?;
record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
txn_alice.move_file("file", "file2")?;
let channel = (&mut *txn_alice.write().unwrap()).open_or_create_channel("main")?;
record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
txn_alice.write().unwrap().move_file("file", "file2")?;
record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_to_file(&txn_alice, &channel.borrow(), "debug1").unwrap();
record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug1").unwrap();
let mut txn_alice = env_alice.mut_txn_begin().unwrap();
txn_alice.add_file("a")?;
let txn_alice = Arc::new(RwLock::new(env_alice.mut_txn_begin().unwrap()));
txn_alice.write().unwrap().add_file("a")?;
let mut channel = txn_alice.open_or_create_channel("main")?;
let alice1 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
let channel = txn_alice.write().unwrap().open_or_create_channel("main")?;
let alice1 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
let alice2 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_to_file(&txn_alice, &channel.borrow(), "debug1").unwrap();
let alice2 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug1").unwrap();
let alice3 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
debug_to_file(&txn_alice, &channel.borrow(), "debug2").unwrap();
let alice3 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
debug_to_file(&*txn_alice.read().unwrap(), &channel, "debug2").unwrap();
let mut txn_bob = env_bob.mut_txn_begin().unwrap();
let mut channel_bob = txn_bob.open_or_create_channel("main")?;
let txn_bob = Arc::new(RwLock::new(env_bob.mut_txn_begin().unwrap()));
let channel_bob = (&mut *txn_bob.write().unwrap()).open_or_create_channel("main")?;
let bob1 = record_all(&mut repo_bob, &changes, &mut txn_bob, &mut channel_bob, "")?;
debug_to_file(&txn_bob, &channel_bob.borrow(), "debug_bob1").unwrap();
txn_bob
.apply_change(&changes, &mut channel_bob, &alice2)
let bob1 = record_all(
repo_bob.clone(),
&changes,
txn_bob.clone(),
channel_bob.clone(),
"",
)?;
debug_to_file(&*txn_bob.read().unwrap(), &channel_bob, "debug_bob1").unwrap();
(&mut *txn_bob.write().unwrap())
.apply_change(&changes, &mut *channel_bob.write().unwrap(), &alice2)
let bob2 = record_all(&mut repo_bob, &changes, &mut txn_bob, &mut channel_bob, "")?;
debug_to_file(&txn_bob, &channel_bob.borrow(), "debug_bob4").unwrap();
let bob2 = record_all(
repo_bob.clone(),
&changes,
txn_bob.clone(),
channel_bob.clone(),
"",
)?;
debug_to_file(&*txn_bob.read().unwrap(), &channel_bob, "debug_bob4").unwrap();
let mut txn_alice = env_alice.mut_txn_begin().unwrap();
txn_alice.add_file("dir/file")?;
txn_alice.add_file("dir/file2")?;
let txn_alice = Arc::new(RwLock::new(env_alice.mut_txn_begin().unwrap()));
txn_alice.write().unwrap().add_file("dir/file")?;
txn_alice.write().unwrap().add_file("dir/file2")?;
let mut channel = txn_alice.open_or_create_channel("main")?;
let alice0 = record_all(&mut repo_alice, &changes, &mut txn_alice, &mut channel, "")?;
let channel = (&mut *txn_alice.write().unwrap()).open_or_create_channel("main")?;
let alice0 = record_all(
repo_alice.clone(),
&changes,
txn_alice.clone(),
channel.clone(),
"",
)?;
txn_alice.move_file("dir2/file", "dir/file").unwrap_or(());
txn_alice.move_file("dir2/file2", "dir/file2").unwrap_or(());
txn_alice
.write()
.unwrap()
.move_file("dir2/file", "dir/file")
.unwrap_or(());
txn_alice
.write()
.unwrap()
.move_file("dir2/file2", "dir/file2")
.unwrap_or(());
let mut channel = txn.write().unwrap().open_or_create_channel("main").unwrap();
record_all(&mut repo, &changes, &mut txn, &mut channel, "").unwrap();
let channel = (&mut *txn.write().unwrap())
.open_or_create_channel("main")
.unwrap();
record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "").unwrap();
record_all(&mut repo, &changes, &mut txn, &mut channel, "").unwrap();
debug_to_file(&txn, &channel.borrow(), "debug").unwrap();
record_all(repo.clone(), &changes, txn.clone(), channel.clone(), "").unwrap();
debug_to_file(&*txn.read().unwrap(), &channel, "debug").unwrap();
let mut channel = txn.write().unwrap().open_or_create_channel("main")?;
record_all_output(&mut repo, &changes, &mut txn, &mut channel, "")?;
debug_to_file(&txn, &channel.borrow(), "debug").unwrap();
let files: Vec<_> = crate::fs::iter_working_copy(&txn, Inode::ROOT)
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
record_all_output(repo, changes.clone(), txn.clone(), channel.clone(), "")?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug").unwrap();
let files: Vec<_> = crate::fs::iter_working_copy(&*txn.read().unwrap(), Inode::ROOT)
let mut txn = env.mut_txn_begin().unwrap();
let mut channel = txn.write().unwrap().open_or_create_channel("main")?;
record_all_output(&mut repo, &changes, &mut txn, &mut channel, "")?;
debug_to_file(&txn, &channel.borrow(), "debug").unwrap();
let files: Vec<_> = crate::fs::iter_working_copy(&txn, Inode::ROOT)
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let channel = txn.write().unwrap().open_or_create_channel("main")?;
record_all_output(repo.clone(), changes, txn.clone(), channel.clone(), "")?;
debug_to_file(&*txn.read().unwrap(), &channel, "debug").unwrap();
let files: Vec<_> = crate::fs::iter_working_copy(&*txn.read().unwrap(), Inode::ROOT)
let mut txn = env.mut_txn_begin().unwrap();
let mut channel = txn.write().unwrap().open_or_create_channel("main")?;
assert!(record_all_output(&mut repo, &changes, &mut txn, &mut channel, "dir").is_err());
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;
assert!(record_all_output(repo, changes, txn, channel, "dir").is_err());
let mut txn = env.mut_txn_begin().unwrap();
let mut channel = txn.write().unwrap().open_or_create_channel("main")?;
let txn = Arc::new(RwLock::new(env.mut_txn_begin().unwrap()));
let channel = (&mut *txn.write().unwrap()).open_or_create_channel("main")?;