diff rust/hg-core/src/dirstate/parsers.rs @ 46601:755c31a1caf9

rhg: Add support for the blackbox extension Only `command` and `commandfinish` events are logged. The `dirty`, `logsource`, `track` and `ignore` configuration items are not supported yet. To indicate commands executed without Python, a `(rust) ` prefix is added in corresponding log messages. Differential Revision: https://phab.mercurial-scm.org/D10012
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 16 Feb 2021 13:08:37 +0100
parents 98a455a62699
children 441024b279a6
line wrap: on
line diff
--- 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();