equal
deleted
inserted
replaced
348 // A proper new version should have had a repo/store |
348 // A proper new version should have had a repo/store |
349 // requirement. |
349 // requirement. |
350 return Err(HgError::corrupted("unsupported revlog version")); |
350 return Err(HgError::corrupted("unsupported revlog version")); |
351 } |
351 } |
352 |
352 |
353 // This is only correct because we know version is REVLOGV1. |
|
354 // In v2 we always use generaldelta, while in v0 we never use |
|
355 // generaldelta. Similar for [is_inline] (it's only used in v1). |
|
356 let uses_generaldelta = header.format_flags().uses_generaldelta(); |
353 let uses_generaldelta = header.format_flags().uses_generaldelta(); |
357 |
354 |
358 if header.format_flags().is_inline() { |
355 if header.format_flags().is_inline() { |
359 let mut offset: usize = 0; |
356 let mut offset: usize = 0; |
360 let mut offsets = Vec::new(); |
357 let mut offsets = Vec::new(); |
422 |
419 |
423 pub fn get_offsets(&self) -> RwLockReadGuard<Option<Vec<usize>>> { |
420 pub fn get_offsets(&self) -> RwLockReadGuard<Option<Vec<usize>>> { |
424 assert!(self.is_inline()); |
421 assert!(self.is_inline()); |
425 { |
422 { |
426 // Wrap in a block to drop the read guard |
423 // Wrap in a block to drop the read guard |
427 // TODO perf? |
|
428 let mut offsets = self.offsets.write().unwrap(); |
424 let mut offsets = self.offsets.write().unwrap(); |
429 if offsets.is_none() { |
425 if offsets.is_none() { |
430 offsets.replace(inline_scan(&self.bytes.bytes).1); |
426 offsets.replace(inline_scan(&self.bytes.bytes).1); |
431 } |
427 } |
432 } |
428 } |