329 impl<'a> RevlogEntry<'a> { |
329 impl<'a> RevlogEntry<'a> { |
330 pub fn revision(&self) -> Revision { |
330 pub fn revision(&self) -> Revision { |
331 self.rev |
331 self.rev |
332 } |
332 } |
333 |
333 |
|
334 pub fn node(&self) -> &Node { |
|
335 &self.hash |
|
336 } |
|
337 |
334 pub fn uncompressed_len(&self) -> Option<u32> { |
338 pub fn uncompressed_len(&self) -> Option<u32> { |
335 u32::try_from(self.uncompressed_len).ok() |
339 u32::try_from(self.uncompressed_len).ok() |
336 } |
340 } |
337 |
341 |
338 pub fn has_p1(&self) -> bool { |
342 pub fn has_p1(&self) -> bool { |
339 self.p1 != NULL_REVISION |
343 self.p1 != NULL_REVISION |
|
344 } |
|
345 |
|
346 pub fn p1_entry(&self) -> Result<Option<RevlogEntry>, RevlogError> { |
|
347 if self.p1 == NULL_REVISION { |
|
348 Ok(None) |
|
349 } else { |
|
350 Ok(Some(self.revlog.get_entry(self.p1)?)) |
|
351 } |
|
352 } |
|
353 |
|
354 pub fn p2_entry(&self) -> Result<Option<RevlogEntry>, RevlogError> { |
|
355 if self.p2 == NULL_REVISION { |
|
356 Ok(None) |
|
357 } else { |
|
358 Ok(Some(self.revlog.get_entry(self.p2)?)) |
|
359 } |
|
360 } |
|
361 |
|
362 pub fn p1(&self) -> Option<Revision> { |
|
363 if self.p1 == NULL_REVISION { |
|
364 None |
|
365 } else { |
|
366 Some(self.p1) |
|
367 } |
|
368 } |
|
369 |
|
370 pub fn p2(&self) -> Option<Revision> { |
|
371 if self.p2 == NULL_REVISION { |
|
372 None |
|
373 } else { |
|
374 Some(self.p2) |
|
375 } |
340 } |
376 } |
341 |
377 |
342 pub fn is_cencored(&self) -> bool { |
378 pub fn is_cencored(&self) -> bool { |
343 (self.flags & REVISION_FLAG_CENSORED) != 0 |
379 (self.flags & REVISION_FLAG_CENSORED) != 0 |
344 } |
380 } |