Show More
@@ -51,17 +51,18 b' pub struct ChangelogRevisionData {' | |||
|
51 | 51 | impl ChangelogRevisionData { |
|
52 | 52 | /// Return an iterator over the lines of the entry. |
|
53 | 53 | pub fn lines(&self) -> impl Iterator<Item = &[u8]> { |
|
54 | self.bytes | |
|
55 | .split(|b| b == &b'\n') | |
|
56 | .filter(|line| !line.is_empty()) | |
|
54 | self.bytes.split(|b| b == &b'\n') | |
|
57 | 55 | } |
|
58 | 56 | |
|
59 | 57 | /// Return the node id of the `manifest` referenced by this `changelog` |
|
60 | 58 | /// entry. |
|
61 | 59 | pub fn manifest_node(&self) -> Result<Node, HgError> { |
|
62 | match self.lines().next() { | |
|
63 | None => Ok(NULL_NODE), | |
|
64 | Some(x) => Node::from_hex_for_repo(x), | |
|
60 | let manifest_node_hex = | |
|
61 | self.lines().next().expect("Empty iterator from split()?"); | |
|
62 | if manifest_node_hex.is_empty() { | |
|
63 | Ok(NULL_NODE) | |
|
64 | } else { | |
|
65 | Node::from_hex_for_repo(manifest_node_hex) | |
|
65 | 66 | } |
|
66 | 67 | } |
|
67 | 68 | } |
General Comments 0
You need to be logged in to leave comments.
Login now