Show More
@@ -5,10 +5,11 b' use crate::revlog::{Revlog, RevlogEntry,' | |||
|
5 | 5 | use crate::utils::hg_path::HgPath; |
|
6 | 6 | use crate::vfs::Vfs; |
|
7 | 7 | use crate::{Graph, GraphError, UncheckedRevision}; |
|
8 | use itertools::Itertools; | |
|
8 | use itertools::{Either, Itertools}; | |
|
9 | 9 | use std::ascii::escape_default; |
|
10 | 10 | use std::borrow::Cow; |
|
11 | 11 | use std::fmt::{Debug, Formatter}; |
|
12 | use std::iter; | |
|
12 | 13 | |
|
13 | 14 | /// A specialized `Revlog` to work with changelog data format. |
|
14 | 15 | pub struct Changelog { |
@@ -228,9 +229,15 b" impl<'changelog> ChangelogRevisionData<'" | |||
|
228 | 229 | |
|
229 | 230 | /// The files changed in this revision. |
|
230 | 231 | pub fn files(&self) -> impl Iterator<Item = &HgPath> { |
|
231 |
|
|
|
232 | .split(|b| b == &b'\n') | |
|
233 | .map(HgPath::new) | |
|
232 | if self.timestamp_end == self.files_end { | |
|
233 | Either::Left(iter::empty()) | |
|
234 | } else { | |
|
235 | Either::Right( | |
|
236 | self.bytes[self.timestamp_end + 1..self.files_end] | |
|
237 | .split(|b| b == &b'\n') | |
|
238 | .map(HgPath::new), | |
|
239 | ) | |
|
240 | } | |
|
234 | 241 | } |
|
235 | 242 | |
|
236 | 243 | /// The change description. |
@@ -356,4 +363,12 b' message",' | |||
|
356 | 363 | ); |
|
357 | 364 | Ok(()) |
|
358 | 365 | } |
|
366 | ||
|
367 | #[test] | |
|
368 | fn test_empty_files_list() { | |
|
369 | assert!(ChangelogRevisionData::null() | |
|
370 | .files() | |
|
371 | .collect_vec() | |
|
372 | .is_empty()); | |
|
373 | } | |
|
359 | 374 | } |
General Comments 0
You need to be logged in to leave comments.
Login now