B:BD[
4.10703] → [
4.10703:11547]
B:BD[
4.11547] → [
2.3650:3695]
∅:D[
2.3695] → [
4.11678:12071]
B:BD[
4.11678] → [
4.11678:12071]
// Get the (Hash, Merkle) pairs for the portion of reverse_log
// that are between offset and limit.
let hs = self
.txn
.reverse_log(&*self.channel_ref.read(), None)?
.skip(self.offset)
.take(self.limit)
.map(|res| {
res.map(|(_, (ser_h, ser_m))| {
(libpijul::Hash::from(ser_h), libpijul::Merkle::from(ser_m))
})
});
for pr in hs {
let (h, mrk) = pr?;
if (self.cmd.filters.is_empty()) || requested_hashes.remove(&h) {
// If there were no path filters applied, OR is this was one of the hashes
// marked by the file filters that were applied
let entry = self.mk_log_entry(&mut authors, &mut id_path, h, Some(mrk))?;
f(entry).map_err(Error::E)?;
} else if requested_hashes.is_empty() {
// If the user applied path filters, but the relevant change hashes
// have been exhausted, we can break early.
break;
} else {
// The user applied path filters; this wasn't a hit, but
// there are still hits to be logged.
continue;
let inodes = get_inodes(&self.txn, &self.repo_path, &self.cmd.filters)?;
let mut offset = self.offset;
let mut limit = self.limit;
for pr in self.txn.reverse_log(&*self.channel_ref.read(), None)? {
let (_, (h, mrk)) = pr?;
let cid = self.txn.get_internal(h)?.unwrap();
let mut is_in_filters = inodes.is_empty();
for (_, position) in inodes.iter() {
if let Some(position) = position {
is_in_filters = self.txn.get_touched_files(position, Some(cid))?.is_some();
if is_in_filters {
break;
}
}
}
if is_in_filters {
if offset == 0 && limit > 0 {
// If there were no path filters applied, OR is this was one of the hashes
// marked by the file filters that were applied
let entry =
self.mk_log_entry(&mut authors, &mut id_path, h.into(), Some(mrk.into()))?;
f(entry).map_err(Error::E)?;
limit -= 1
} else if limit > 0 {
offset -= 1
} else {
break;
}