rust/hg-core/src/revlog/changelog.rs
changeset 49123 5d205e476057
parent 49122 95da3e99cbd8
child 49142 bfc117647c71
equal deleted inserted replaced
49122:95da3e99cbd8 49123:5d205e476057
     1 use crate::errors::HgError;
     1 use crate::errors::HgError;
     2 use crate::repo::Repo;
     2 use crate::repo::Repo;
     3 use crate::revlog::revlog::{Revlog, RevlogError};
     3 use crate::revlog::revlog::{Revlog, RevlogEntry, RevlogError};
     4 use crate::revlog::Revision;
     4 use crate::revlog::Revision;
     5 use crate::revlog::{Node, NodePrefix};
     5 use crate::revlog::{Node, NodePrefix};
     6 use crate::utils::hg_path::HgPath;
     6 use crate::utils::hg_path::HgPath;
     7 use itertools::Itertools;
     7 use itertools::Itertools;
     8 use std::ascii::escape_default;
     8 use std::ascii::escape_default;
    26         &self,
    26         &self,
    27         node: NodePrefix,
    27         node: NodePrefix,
    28     ) -> Result<ChangelogRevisionData, RevlogError> {
    28     ) -> Result<ChangelogRevisionData, RevlogError> {
    29         let rev = self.revlog.rev_from_node(node)?;
    29         let rev = self.revlog.rev_from_node(node)?;
    30         self.data_for_rev(rev)
    30         self.data_for_rev(rev)
       
    31     }
       
    32 
       
    33     /// Return the `RevlogEntry` of the given revision number.
       
    34     pub fn entry_for_rev(
       
    35         &self,
       
    36         rev: Revision,
       
    37     ) -> Result<RevlogEntry, RevlogError> {
       
    38         self.revlog.get_entry(rev)
    31     }
    39     }
    32 
    40 
    33     /// Return the `ChangelogEntry` of the given revision number.
    41     /// Return the `ChangelogEntry` of the given revision number.
    34     pub fn data_for_rev(
    42     pub fn data_for_rev(
    35         &self,
    43         &self,
    48         }
    56         }
    49     }
    57     }
    50 
    58 
    51     pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> {
    59     pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> {
    52         self.revlog.node_from_rev(rev)
    60         self.revlog.node_from_rev(rev)
       
    61     }
       
    62 
       
    63     pub fn rev_from_node(
       
    64         &self,
       
    65         node: NodePrefix,
       
    66     ) -> Result<Revision, RevlogError> {
       
    67         self.revlog.rev_from_node(node)
    53     }
    68     }
    54 }
    69 }
    55 
    70 
    56 /// `Changelog` entry which knows how to interpret the `changelog` data bytes.
    71 /// `Changelog` entry which knows how to interpret the `changelog` data bytes.
    57 #[derive(PartialEq)]
    72 #[derive(PartialEq)]