mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-29 23:57:51 +00:00
working copy: make some reset errors less specific
Same reasoning as the previous commits.
This commit is contained in:
parent
645be615b4
commit
0e09d53ce6
1 changed files with 13 additions and 3 deletions
|
@ -395,8 +395,12 @@ pub enum ResetError {
|
||||||
},
|
},
|
||||||
#[error("Internal error: {0}")]
|
#[error("Internal error: {0}")]
|
||||||
InternalBackendError(#[from] BackendError),
|
InternalBackendError(#[from] BackendError),
|
||||||
#[error(transparent)]
|
#[error("{message}: {err:?}")]
|
||||||
TreeStateError(#[from] TreeStateError),
|
Other {
|
||||||
|
message: String,
|
||||||
|
#[source]
|
||||||
|
err: Box<dyn std::error::Error + Send + Sync>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DirectoryToVisit {
|
struct DirectoryToVisit {
|
||||||
|
@ -1635,7 +1639,13 @@ impl LockedLocalWorkingCopy<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset(&mut self, new_tree: &MergedTree) -> Result<(), ResetError> {
|
pub fn reset(&mut self, new_tree: &MergedTree) -> Result<(), ResetError> {
|
||||||
self.wc.tree_state_mut()?.reset(new_tree)?;
|
self.wc
|
||||||
|
.tree_state_mut()
|
||||||
|
.map_err(|err| ResetError::Other {
|
||||||
|
message: "Failed to read the working copy state".to_string(),
|
||||||
|
err: err.into(),
|
||||||
|
})?
|
||||||
|
.reset(new_tree)?;
|
||||||
self.tree_state_dirty = true;
|
self.tree_state_dirty = true;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue