equal
deleted
inserted
replaced
1 use crate::revlog::revlog::{Revlog, RevlogError}; |
1 use crate::revlog::revlog::{Revlog, RevlogError}; |
2 use crate::revlog::NodePrefixRef; |
2 use crate::revlog::NodePrefixRef; |
3 use crate::revlog::Revision; |
3 use crate::revlog::Revision; |
4 use std::path::PathBuf; |
4 use std::path::Path; |
5 |
5 |
6 /// A specialized `Revlog` to work with `changelog` data format. |
6 /// A specialized `Revlog` to work with `changelog` data format. |
7 pub struct Changelog { |
7 pub struct Changelog { |
8 /// The generic `revlog` format. |
8 /// The generic `revlog` format. |
9 revlog: Revlog, |
9 revlog: Revlog, |
10 } |
10 } |
11 |
11 |
12 impl Changelog { |
12 impl Changelog { |
13 /// Open the `changelog` of a repository given by its root. |
13 /// Open the `changelog` of a repository given by its root. |
14 pub fn open(root: &PathBuf) -> Result<Self, RevlogError> { |
14 pub fn open(root: &Path) -> Result<Self, RevlogError> { |
15 let index_file = root.join(".hg/store/00changelog.i"); |
15 let index_file = root.join(".hg/store/00changelog.i"); |
16 let revlog = Revlog::open(&index_file, None)?; |
16 let revlog = Revlog::open(&index_file, None)?; |
17 Ok(Self { revlog }) |
17 Ok(Self { revlog }) |
18 } |
18 } |
19 |
19 |