comparison rust/hg-core/src/repo.rs @ 50974:1928b770e3e7

rust: use the new `UncheckedRevision` everywhere applicable This step converts all revisions that shouldn't be considered "valid" in any context to `UncheckedRevison`, allowing `Revision` to be changed for a stronger type in a later changeset. Note that the conversion from unchecked to checked is manual and requires at least some thought from the programmer, although directly using `Revision` is still possible. A later changeset will make this mistake harder to make.
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 10 Aug 2023 11:00:34 +0200
parents bf16ef96defe
children 532e74ad3ff6
comparison
equal deleted inserted replaced
50973:9929c8a73488 50974:1928b770e3e7
13 use crate::utils::debug::debug_wait_for_file_or_print; 13 use crate::utils::debug::debug_wait_for_file_or_print;
14 use crate::utils::files::get_path_from_bytes; 14 use crate::utils::files::get_path_from_bytes;
15 use crate::utils::hg_path::HgPath; 15 use crate::utils::hg_path::HgPath;
16 use crate::utils::SliceExt; 16 use crate::utils::SliceExt;
17 use crate::vfs::{is_dir, is_file, Vfs}; 17 use crate::vfs::{is_dir, is_file, Vfs};
18 use crate::{requirements, NodePrefix}; 18 use crate::DirstateError;
19 use crate::{DirstateError, Revision}; 19 use crate::{requirements, NodePrefix, UncheckedRevision};
20 use std::cell::{Ref, RefCell, RefMut}; 20 use std::cell::{Ref, RefCell, RefMut};
21 use std::collections::HashSet; 21 use std::collections::HashSet;
22 use std::io::Seek; 22 use std::io::Seek;
23 use std::io::SeekFrom; 23 use std::io::SeekFrom;
24 use std::io::Write as IoWrite; 24 use std::io::Write as IoWrite;
560 } 560 }
561 561
562 /// Returns the manifest of the *changeset* with the given revision number 562 /// Returns the manifest of the *changeset* with the given revision number
563 pub fn manifest_for_rev( 563 pub fn manifest_for_rev(
564 &self, 564 &self,
565 revision: Revision, 565 revision: UncheckedRevision,
566 ) -> Result<Manifest, RevlogError> { 566 ) -> Result<Manifest, RevlogError> {
567 self.manifestlog()?.data_for_node( 567 self.manifestlog()?.data_for_node(
568 self.changelog()? 568 self.changelog()?
569 .data_for_rev(revision)? 569 .data_for_rev(revision)?
570 .manifest_node()? 570 .manifest_node()?