comparison rust/hg-core/src/revlog/index.rs @ 48575:e91aa800ae5b

rhg: desambiguate status without decompressing filelog if possible When status is unsure based on `stat()` and the dirstate if a file is clean or modified, we need to compare it against the filelog. This comparison can skip looking at contents if the lengths differ. This changeset optimize this further to deduce what we can about the length if the filelog without decompressing it or resolving deltas. Differential Revision: https://phab.mercurial-scm.org/D11965
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 07 Jan 2022 14:40:21 +0100
parents 0a4ac916673e
children d200ecb76c72
comparison
equal deleted inserted replaced
48574:5026a0d37526 48575:e91aa800ae5b
256 } else { 256 } else {
257 let mut bytes = [0; 8]; 257 let mut bytes = [0; 8];
258 bytes[2..8].copy_from_slice(&self.bytes[0..=5]); 258 bytes[2..8].copy_from_slice(&self.bytes[0..=5]);
259 BigEndian::read_u64(&bytes[..]) as usize 259 BigEndian::read_u64(&bytes[..]) as usize
260 } 260 }
261 }
262
263 pub fn flags(&self) -> u16 {
264 BigEndian::read_u16(&self.bytes[6..=7])
261 } 265 }
262 266
263 /// Return the compressed length of the data. 267 /// Return the compressed length of the data.
264 pub fn compressed_len(&self) -> u32 { 268 pub fn compressed_len(&self) -> u32 {
265 BigEndian::read_u32(&self.bytes[8..=11]) 269 BigEndian::read_u32(&self.bytes[8..=11])