feat: set message for multiple revsets
Allows to set the revision message of multiple revisions by passing them as arguments. This only supports simple revisions, such as `@`, `@-`, `xs`, and so on. Comple revisions such as `@..@-` are not supported. Fixes: #5
This commit is contained in:
39
src/error.rs
39
src/error.rs
@@ -1,3 +1,5 @@
|
||||
use jj_lib::revset::{RevsetEvaluationError, RevsetParseError, RevsetResolutionError};
|
||||
|
||||
use crate::commit::types::{CommitMessageError, DescriptionError, ScopeError};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
@@ -25,6 +27,10 @@ pub enum Error {
|
||||
Cancelled,
|
||||
#[error("Non-interactive terminal detected")]
|
||||
NonInteractive,
|
||||
#[error("Failed to resolve revision '{revset}': {context}")]
|
||||
RevsetResolutionError { revset: String, context: String },
|
||||
#[error("Revision set '{revset}' resolves to multiple commits; specify a single revision")]
|
||||
MultipleRevisions { revset: String },
|
||||
}
|
||||
|
||||
impl From<ScopeError> for Error {
|
||||
@@ -46,7 +52,38 @@ impl From<CommitMessageError> for Error {
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
fn from(_value: std::io::Error) -> Self {
|
||||
fn from(_: std::io::Error) -> Self {
|
||||
Self::FailedGettingCurrentDir
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<std::sync::PoisonError<T>> for Error {
|
||||
fn from(_: std::sync::PoisonError<T>) -> Self {
|
||||
Self::JjOperation {
|
||||
context: "internal lock poisoned".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error {
|
||||
pub fn from_revset_parse_error(revset: &str, error: RevsetParseError) -> Self {
|
||||
Self::RevsetResolutionError {
|
||||
revset: revset.to_string(),
|
||||
context: error.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_revset_resolution_error(revset: &str, error: RevsetResolutionError) -> Self {
|
||||
Self::RevsetResolutionError {
|
||||
revset: revset.to_string(),
|
||||
context: error.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_revset_evaluation_error(revset: &str, error: RevsetEvaluationError) -> Self {
|
||||
Self::RevsetResolutionError {
|
||||
revset: revset.to_string(),
|
||||
context: error.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user