diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 73618523e..54113b49d 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -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()) diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index 7f63d1dca..1aa063eb2 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -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) {