R3XMFPCYGXT5CNHYRNVZDGD2TDTCK6XGQ55SPJW56UEQQNV4R64AC
VK2ZYIOFG4GKELXWPKYWB33P3G6BEDP4CQAW6GY6YFIKTINVOSLAC
UFSP7C7B2ERFJ2XVVVNXGZRXUEMFSMRABC5YXXLK6ONMFG6QBNHAC
W7HZ5VFMEFVJIPYZJXOSMWTQ7DOZOOHT4QZTMDCT63AKIWB3TCZQC
TQBJZLD7Q223IFEBR7SU4FJWPWQWVBCSRPYYYEHXNSDM6DC7UWRAC
OZUZ5H6DJUXJ2MEHQK6FQ7LTSPUHHGZSFZ3SPBV26A2KBE4TQKQQC
FIIUZR4LJOB5DPB4CBMPJHMO7C5Q4ZINUVM52UK6SIM5WM7R7ZLAC
GKLDTVAKBFKWS3JZVTWJAWYUNPEIUMK6FW77IRD7J26NAVQ52CKQC
D467LQZ62MTKWYPTMRBYTTR63CZDCE5WGBIGLQMSWAQYPHC3XITAC
let files = sandbox.get_files().unwrap();
let parent = if i == 0 {
None
} else {
Some(changes[i - 1].state)
};
stream.write_commit(&changes[i], parent, &files);
if !stream.already_exported(&changes[i].state) {
let files = sandbox.get_files().unwrap();
let parent = if i == 0 {
None
} else {
Some(changes[i - 1].state)
};
stream.write_commit(&changes[i], parent, &files);
}
}
match matches.opt_str("m") {
Some(filename) => stream.save_marks(&filename).unwrap(),
None => (),
pub fn load_marks(&mut self, filename: &str) -> Result<(), Box<dyn Error>> {
self.mark_file = std::fs::read(filename)?;
let re = Regex::new(r"^:(\d+) (\w+)$")?;
let mark_file_content: &[u8] = &self.mark_file;
for line in BufReader::new(mark_file_content).lines() {
let line = line?.to_string();
match Self::parse_line(&re, &line) {
Some((mark, state)) => {
self.commit_marks.insert(state, mark);
if mark > self.max_commit_mark {
self.max_commit_mark = mark;
}
}
None => {
return Err(
SimpleError::new(format!("syntax error in mark file: {}", line)).into(),
)
}
}
}
return Ok(());
}
pub fn save_marks(&self, filename: &str) -> Result<(), Box<dyn Error>> {
std::fs::write(&filename, &self.mark_file)?;
Ok(())
}
pub fn already_exported(&self, state: &libpijul::Merkle) -> bool {
self.commit_marks.contains_key(state)
}
regex = "1.7.2"
simple-error = "0.1.9"