rust/hg-core/src/dirstate/parsers.rs
changeset 46601 755c31a1caf9
parent 46595 98a455a62699
child 46890 441024b279a6
--- a/rust/hg-core/src/dirstate/parsers.rs	Wed Feb 17 13:00:25 2021 +0100
+++ b/rust/hg-core/src/dirstate/parsers.rs	Tue Feb 16 13:08:37 2021 +0100
@@ -26,6 +26,14 @@
     Vec<(&'a HgPath, &'a HgPath)>,
 );
 
+pub fn parse_dirstate_parents(
+    contents: &[u8],
+) -> Result<&DirstateParents, HgError> {
+    let (parents, _rest) = DirstateParents::from_bytes(contents)
+        .map_err(|_| HgError::corrupted("Too little data for dirstate."))?;
+    Ok(parents)
+}
+
 #[timed]
 pub fn parse_dirstate(mut contents: &[u8]) -> Result<ParseResult, HgError> {
     let mut copies = Vec::new();