##// END OF EJS Templates
rust-changelog: don't skip empty lines when iterating over changeset lines...
Martin von Zweigbergk -
r49936:fb82b5cb default
parent child Browse files
Show More
@@ -51,17 +51,18 b' pub struct ChangelogRevisionData {'
51 impl ChangelogRevisionData {
51 impl ChangelogRevisionData {
52 /// Return an iterator over the lines of the entry.
52 /// Return an iterator over the lines of the entry.
53 pub fn lines(&self) -> impl Iterator<Item = &[u8]> {
53 pub fn lines(&self) -> impl Iterator<Item = &[u8]> {
54 self.bytes
54 self.bytes.split(|b| b == &b'\n')
55 .split(|b| b == &b'\n')
56 .filter(|line| !line.is_empty())
57 }
55 }
58
56
59 /// Return the node id of the `manifest` referenced by this `changelog`
57 /// Return the node id of the `manifest` referenced by this `changelog`
60 /// entry.
58 /// entry.
61 pub fn manifest_node(&self) -> Result<Node, HgError> {
59 pub fn manifest_node(&self) -> Result<Node, HgError> {
62 match self.lines().next() {
60 let manifest_node_hex =
63 None => Ok(NULL_NODE),
61 self.lines().next().expect("Empty iterator from split()?");
64 Some(x) => Node::from_hex_for_repo(x),
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