forked from mirrors/jj
revset: add none() function
This commit is contained in:
parent
8fef1c2068
commit
5874d5abfb
2 changed files with 20 additions and 0 deletions
|
@ -552,6 +552,16 @@ fn parse_function_expression(
|
|||
})
|
||||
}
|
||||
}
|
||||
"none" => {
|
||||
if arg_count == 0 {
|
||||
Ok(RevsetExpression::none())
|
||||
} else {
|
||||
Err(RevsetParseError::InvalidFunctionArguments {
|
||||
name,
|
||||
message: "Expected 0 arguments".to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
"heads" => {
|
||||
if arg_count == 0 {
|
||||
Ok(RevsetExpression::heads())
|
||||
|
|
|
@ -765,6 +765,16 @@ fn test_evaluate_expression_descendants(use_git: bool) {
|
|||
tx.discard();
|
||||
}
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
fn test_evaluate_expression_none(use_git: bool) {
|
||||
let settings = testutils::user_settings();
|
||||
let (_temp_dir, repo) = testutils::init_repo(&settings, use_git);
|
||||
|
||||
// none() is empty (doesn't include the checkout, for example)
|
||||
assert_eq!(resolve_commit_ids(repo.as_repo_ref(), "none()"), vec![]);
|
||||
}
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
fn test_evaluate_expression_heads(use_git: bool) {
|
||||
|
|
Loading…
Reference in a new issue