Mercurial > public > mercurial-scm > hg
diff rust/rhg/src/commands/status.rs @ 48542:35c47015b9b7
rhg: Expose FilelogEntry that wraps RevlogEntry
This can be later extended to access metadata such as `uncompressed_len` without
necessarily resolving deltas.
Differential Revision: https://phab.mercurial-scm.org/D11961
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 21 Dec 2021 18:50:44 +0100 |
parents | 20d0d896183e |
children | e91aa800ae5b |
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs Tue Dec 21 18:35:58 2021 +0100 +++ b/rust/rhg/src/commands/status.rs Tue Dec 21 18:50:44 2021 +0100 @@ -512,17 +512,18 @@ } let filelog = repo.filelog(hg_path)?; let fs_len = fs_metadata.len(); + let filelog_entry = + filelog.entry_for_node(entry.node_id()?).map_err(|_| { + HgError::corrupted("filelog missing node from manifest") + })?; // TODO: check `fs_len` here like below, but based on // `RevlogEntry::uncompressed_len` without decompressing the full filelog // contents where possible. This is only valid if the revlog data does not // contain metadata. See how Python’s `revlog.rawsize` calls // `storageutil.filerevisioncopied`. // (Maybe also check for content-modifying flags? See `revlog.size`.) - let filelog_entry = - filelog.data_for_node(entry.node_id()?).map_err(|_| { - HgError::corrupted("filelog missing node from manifest") - })?; - let contents_in_p1 = filelog_entry.file_data()?; + let filelog_data = filelog_entry.data()?; + let contents_in_p1 = filelog_data.file_data()?; if contents_in_p1.len() as u64 != fs_len { // No need to read the file contents: // it cannot be equal if it has a different length.