equal
deleted
inserted
replaced
127 |
127 |
128 Some(IndexEntry { |
128 Some(IndexEntry { |
129 bytes, |
129 bytes, |
130 offset_override, |
130 offset_override, |
131 }) |
131 }) |
|
132 } |
|
133 } |
|
134 |
|
135 impl super::RevlogIndex for Index { |
|
136 fn len(&self) -> usize { |
|
137 self.len() |
|
138 } |
|
139 |
|
140 fn node(&self, rev: Revision) -> Option<&Node> { |
|
141 self.get_entry(rev).map(|entry| entry.hash()) |
132 } |
142 } |
133 } |
143 } |
134 |
144 |
135 #[derive(Debug)] |
145 #[derive(Debug)] |
136 pub struct IndexEntry<'a> { |
146 pub struct IndexEntry<'a> { |
188 |
198 |
189 /// Return the hash of revision's full text. |
199 /// Return the hash of revision's full text. |
190 /// |
200 /// |
191 /// Currently, SHA-1 is used and only the first 20 bytes of this field |
201 /// Currently, SHA-1 is used and only the first 20 bytes of this field |
192 /// are used. |
202 /// are used. |
193 pub fn hash(&self) -> &Node { |
203 pub fn hash(&self) -> &'a Node { |
194 (&self.bytes[32..52]).try_into().unwrap() |
204 (&self.bytes[32..52]).try_into().unwrap() |
195 } |
205 } |
196 } |
206 } |
197 |
207 |
198 /// Value of the inline flag. |
208 /// Value of the inline flag. |