absorb: move core functionality from cli to lib

This commit is contained in:
dploch 2024-12-17 13:03:34 -05:00 committed by Daniel Ploch
parent 2a563039a5
commit 396833f803
4 changed files with 1145 additions and 1084 deletions

View file

@ -21,6 +21,7 @@ use std::str;
use std::sync::Arc;
use itertools::Itertools as _;
use jj_lib::absorb::AbsorbError;
use jj_lib::backend::BackendError;
use jj_lib::config::ConfigFileSaveError;
use jj_lib::config::ConfigGetError;
@ -590,6 +591,15 @@ impl From<ParseBulkEditMessageError> for CommandError {
}
}
impl From<AbsorbError> for CommandError {
fn from(err: AbsorbError) -> Self {
match err {
AbsorbError::Backend(err) => err.into(),
AbsorbError::RevsetEvaluation(err) => err.into(),
}
}
}
fn find_source_parse_error_hint(err: &dyn error::Error) -> Option<String> {
let source = err.source()?;
if let Some(source) = source.downcast_ref() {

File diff suppressed because it is too large Load diff

1116
lib/src/absorb.rs Normal file

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,7 @@ extern crate self as jj_lib;
#[macro_use]
pub mod content_hash;
pub mod absorb;
pub mod annotate;
pub mod backend;
pub mod commit;