Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/repo.rs @ 47991:001d747c2baf
rust: Return HgError instead of RevlogError in revlog constructors
This leaves fewer cases for callers to handle, as RevlogError is more general
Differential Revision: https://phab.mercurial-scm.org/D11410
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 13 Sep 2021 18:02:45 +0200 |
parents | 4d2a5ca060e3 |
children | 796206e74b10 |
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs Mon Sep 13 17:23:42 2021 +0200 +++ b/rust/hg-core/src/repo.rs Mon Sep 13 18:02:45 2021 +0200 @@ -29,8 +29,8 @@ // None means not known/initialized yet dirstate_parents: Cell<Option<DirstateParents>>, dirstate_map: LazyCell<OwningDirstateMap, DirstateError>, - changelog: LazyCell<Changelog, RevlogError>, - manifestlog: LazyCell<Manifestlog, RevlogError>, + changelog: LazyCell<Changelog, HgError>, + manifestlog: LazyCell<Manifestlog, HgError>, } #[derive(Debug, derive_more::From)] @@ -320,19 +320,19 @@ self.dirstate_map.get_mut_or_init(self) } - pub fn changelog(&self) -> Result<Ref<Changelog>, RevlogError> { + pub fn changelog(&self) -> Result<Ref<Changelog>, HgError> { self.changelog.get_or_init(self) } - pub fn changelog_mut(&self) -> Result<RefMut<Changelog>, RevlogError> { + pub fn changelog_mut(&self) -> Result<RefMut<Changelog>, HgError> { self.changelog.get_mut_or_init(self) } - pub fn manifestlog(&self) -> Result<Ref<Manifestlog>, RevlogError> { + pub fn manifestlog(&self) -> Result<Ref<Manifestlog>, HgError> { self.manifestlog.get_or_init(self) } - pub fn manifestlog_mut(&self) -> Result<RefMut<Manifestlog>, RevlogError> { + pub fn manifestlog_mut(&self) -> Result<RefMut<Manifestlog>, HgError> { self.manifestlog.get_mut_or_init(self) } @@ -349,7 +349,7 @@ manifest.get_node(manifest_node.into()) } - pub fn filelog(&self, path: &HgPath) -> Result<Filelog, RevlogError> { + pub fn filelog(&self, path: &HgPath) -> Result<Filelog, HgError> { Filelog::open(self, path) } }