Skip to content

Commit

Permalink
Rename conflict revset to conflicts.
Browse files Browse the repository at this point in the history
See discussion thread in linked issue.

With this PR, all revset functions in [BUILTIN_FUNCTION_MAP](https://github.com/martinvonz/jj/blob/8d166c764251042287626ab37a1148386cef8371/lib/src/revset.rs#L570)
that return multiple values are either named in plural or named in a difficult-to-misused manner (e.g. `reachable`)

Fixes: #4122
  • Loading branch information
essiene committed Aug 24, 2024
1 parent 8d166c7 commit 43a0b8f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
commit to commit. It now either follows the flags `--edit|--no-edit` or it
gets the mode from `ui.movement.edit`.

* `conflict` revset has been renamed to `conflicts`. With this, all revsets that
could potentially return multiple results are named in the plural.

### Deprecations

### New features
Expand Down
2 changes: 1 addition & 1 deletion docs/revsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ given [string pattern](#string-patterns).
For example, `diff_contains("TODO", "src")` will search revisions where "TODO"
is added to or removed from files under "src".

* `conflict()`: Commits with conflicts.
* `conflicts()`: Commits with conflicts.

* `present(x)`: Same as `x`, but evaluated to `none()` if any of the commits
in `x` doesn't exist (e.g. is an unknown branch name.)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/revset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ static BUILTIN_FUNCTION_MAP: Lazy<HashMap<&'static str, RevsetFunction>> = Lazy:
RevsetFilterPredicate::DiffContains { text, files },
))
});
map.insert("conflict", |function, _context| {
map.insert("conflicts", |function, _context| {
function.expect_no_arguments()?;
Ok(RevsetExpression::filter(RevsetFilterPredicate::HasConflict))
});
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/test_revset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3439,7 +3439,7 @@ fn test_evaluate_expression_conflict() {

// Only commit4 has a conflict
assert_eq!(
resolve_commit_ids(mut_repo, "conflict()"),
resolve_commit_ids(mut_repo, "conflicts()"),
vec![commit4.id().clone()]
);
}
Expand Down

0 comments on commit 43a0b8f

Please sign in to comment.