ok/jj
1
0
Fork 0
forked from mirrors/jj

op_walk: extract function that resolves op expression with preloaded head op

I'm going to make "op abandon" not load the repo, and this function will
be used there instead of resolve_op_with_repo().
This commit is contained in:
Yuya Nishihara 2024-01-10 19:45:26 +09:00
parent 83ede241e3
commit 805046ceba

View file

@ -89,9 +89,17 @@ pub fn resolve_op_with_repo(
repo: &ReadonlyRepo,
op_str: &str,
) -> Result<Operation, OpsetEvaluationError> {
let op_store = repo.op_store();
let get_current_op = || Ok(repo.operation().clone());
let get_head_ops = || Ok(vec![repo.operation().clone()]);
resolve_op_at(repo.op_store(), repo.operation(), op_str)
}
/// Resolves operation set expression at the given head operation.
pub fn resolve_op_at(
op_store: &Arc<dyn OpStore>,
head_op: &Operation,
op_str: &str,
) -> Result<Operation, OpsetEvaluationError> {
let get_current_op = || Ok(head_op.clone());
let get_head_ops = || Ok(vec![head_op.clone()]);
resolve_single_op(op_store, get_current_op, get_head_ops, op_str)
}