diff --git a/CHANGELOG.md b/CHANGELOG.md index e05b74d90..a266abc8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking changes * Dropped candidates set argument from `description(needle)`, `author(needle)`, - `committer(needle)` revsets. Use `x & description(needle)` instead. + `committer(needle)`, `merges()` revsets. Use `x & description(needle)` + instead. ### New features diff --git a/docs/revsets.md b/docs/revsets.md index d8724cfdc..c97622630 100644 --- a/docs/revsets.md +++ b/docs/revsets.md @@ -101,8 +101,7 @@ revsets (expressions) as arguments. If `x` was not specified, it selects all visible heads (as if you had said `heads(all())`). * `roots(x)`: Commits in `x` that are not descendants of other commits in `x`. -* `merges([x])`: Merge commits within `x`. If `x` was not specified, it selects - all visible merge commits (as if you had said `merges(all())`). +* `merges()`: Merge commits. * `description(needle)`: Commits with the given string in their description. * `author(needle)`: Commits with the given string in the author's name or diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 482451fe0..9b7bb59db 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -745,18 +745,14 @@ fn parse_function_expression( } } "merges" => { - if arg_count > 1 { - return Err(RevsetParseError::InvalidFunctionArguments { - name, - message: "Expected 0 or 1 arguments".to_string(), - }); - } - let candidates = if arg_count == 0 { - RevsetExpression::all() + if arg_count == 0 { + Ok(RevsetExpression::all().with_parent_count(2..u32::MAX)) } else { - parse_expression_rule(argument_pairs.next().unwrap().into_inner())? - }; - Ok(candidates.with_parent_count(2..u32::MAX)) + Err(RevsetParseError::InvalidFunctionArguments { + name, + message: "Expected 0 arguments".to_string(), + }) + } } "description" | "author" | "committer" | "file" => { if arg_count != 1 { diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index 88b152d2f..af5a1f940 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -1388,7 +1388,7 @@ fn test_evaluate_expression_merges(use_git: bool) { assert_eq!( resolve_commit_ids( mut_repo.as_repo_ref(), - &format!("merges(:{})", commit5.id().hex()) + &format!(":{} & merges()", commit5.id().hex()) ), vec![commit5.id().clone()] );