forked from mirrors/jj
revset: remove redundant candidates argument from merges()
Since 'merges()' just filters the candidates set per item, it doesn't need a candidates argument. Perhaps, 'merges(x)' could be a predicate to select merge commits within a subgraph 'x', but I don't know if that would be useful.
This commit is contained in:
parent
373c63b414
commit
59717aa187
4 changed files with 11 additions and 15 deletions
|
@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
|
|
||||||
* Dropped candidates set argument from `description(needle)`, `author(needle)`,
|
* 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
|
### New features
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,7 @@ revsets (expressions) as arguments.
|
||||||
If `x` was not specified, it selects all visible heads (as if you had said
|
If `x` was not specified, it selects all visible heads (as if you had said
|
||||||
`heads(all())`).
|
`heads(all())`).
|
||||||
* `roots(x)`: Commits in `x` that are not descendants of other commits in `x`.
|
* `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
|
* `merges()`: Merge commits.
|
||||||
all visible merge commits (as if you had said `merges(all())`).
|
|
||||||
* `description(needle)`: Commits with the given string in their
|
* `description(needle)`: Commits with the given string in their
|
||||||
description.
|
description.
|
||||||
* `author(needle)`: Commits with the given string in the author's name or
|
* `author(needle)`: Commits with the given string in the author's name or
|
||||||
|
|
|
@ -745,18 +745,14 @@ fn parse_function_expression(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"merges" => {
|
"merges" => {
|
||||||
if arg_count > 1 {
|
if arg_count == 0 {
|
||||||
return Err(RevsetParseError::InvalidFunctionArguments {
|
Ok(RevsetExpression::all().with_parent_count(2..u32::MAX))
|
||||||
name,
|
|
||||||
message: "Expected 0 or 1 arguments".to_string(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let candidates = if arg_count == 0 {
|
|
||||||
RevsetExpression::all()
|
|
||||||
} else {
|
} else {
|
||||||
parse_expression_rule(argument_pairs.next().unwrap().into_inner())?
|
Err(RevsetParseError::InvalidFunctionArguments {
|
||||||
};
|
name,
|
||||||
Ok(candidates.with_parent_count(2..u32::MAX))
|
message: "Expected 0 arguments".to_string(),
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"description" | "author" | "committer" | "file" => {
|
"description" | "author" | "committer" | "file" => {
|
||||||
if arg_count != 1 {
|
if arg_count != 1 {
|
||||||
|
|
|
@ -1388,7 +1388,7 @@ fn test_evaluate_expression_merges(use_git: bool) {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
resolve_commit_ids(
|
resolve_commit_ids(
|
||||||
mut_repo.as_repo_ref(),
|
mut_repo.as_repo_ref(),
|
||||||
&format!("merges(:{})", commit5.id().hex())
|
&format!(":{} & merges()", commit5.id().hex())
|
||||||
),
|
),
|
||||||
vec![commit5.id().clone()]
|
vec![commit5.id().clone()]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue