mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-25 05:29:39 +00:00
revsets: change Git-like range operator ,,,
operator to ..
(#46)
This commit is contained in:
parent
98659a16e1
commit
35a712cc48
3 changed files with 16 additions and 12 deletions
|
@ -169,13 +169,13 @@ It's the root commit of every repo. The `root` symbol in the revset matches it.)
|
|||
|
||||
There are also operators for getting the parents (`foo~`), children (`foo+`),
|
||||
ancestors (`:foo`), descendants (`foo:`), DAG range (`foo:bar`, like
|
||||
`git log --ancestry-path`), range (`foo,,,bar`, like Git's `foo..bar`). There
|
||||
are also a few more functions, such as `heads(<set>)`, which filters out
|
||||
revisions in the input set if they're ancestors of other revisions in the set.
|
||||
Let's define an alias based on that by adding the following to `~/.jjconfig`:
|
||||
`git log --ancestry-path`), range (`foo..bar`, same as Git's). There are also a
|
||||
few more functions, such as `heads(<set>)`, which filters out revisions in the
|
||||
input set if they're ancestors of other revisions in the set. Let's define an
|
||||
alias based on that by adding the following to `~/.jjconfig`:
|
||||
```
|
||||
[alias]
|
||||
l = ["log", "-r", "(heads(remote_branches()),,,@):"]
|
||||
l = ["log", "-r", "(heads(remote_branches())..@):"]
|
||||
```
|
||||
|
||||
The alias lets us run `jj l` to see the commits we have created between public
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
identifier = @{ (ASCII_ALPHANUMERIC | "_" | "@" | "/" | ".")+ }
|
||||
non_period_identifier = @{ (ASCII_ALPHANUMERIC | "_" | "@" | "/")+ }
|
||||
identifier = @{
|
||||
(non_period_identifier+ ~ ".")+ ~ non_period_identifier+
|
||||
| non_period_identifier+
|
||||
}
|
||||
symbol = {
|
||||
identifier
|
||||
| literal_string
|
||||
|
@ -28,7 +32,7 @@ children_op = { "+" }
|
|||
ancestors_op = { ":" }
|
||||
descendants_op = { ":" }
|
||||
dag_range_op = { ":" }
|
||||
range_op = { ",,," }
|
||||
range_op = { ".." }
|
||||
|
||||
union_op = { "|" }
|
||||
intersection_op = { "&" }
|
||||
|
|
|
@ -651,7 +651,7 @@ fn test_evaluate_expression_range(use_git: bool) {
|
|||
// The range from the root to the root is empty (because the left side of the
|
||||
// range is exclusive)
|
||||
assert_eq!(
|
||||
resolve_commit_ids(mut_repo.as_repo_ref(), "root,,,root"),
|
||||
resolve_commit_ids(mut_repo.as_repo_ref(), "root..root"),
|
||||
vec![]
|
||||
);
|
||||
|
||||
|
@ -659,7 +659,7 @@ fn test_evaluate_expression_range(use_git: bool) {
|
|||
assert_eq!(
|
||||
resolve_commit_ids(
|
||||
mut_repo.as_repo_ref(),
|
||||
&format!("{},,,{}", commit1.id().hex(), commit3.id().hex())
|
||||
&format!("{}..{}", commit1.id().hex(), commit3.id().hex())
|
||||
),
|
||||
vec![commit3.id().clone(), commit2.id().clone()]
|
||||
);
|
||||
|
@ -668,7 +668,7 @@ fn test_evaluate_expression_range(use_git: bool) {
|
|||
assert_eq!(
|
||||
resolve_commit_ids(
|
||||
mut_repo.as_repo_ref(),
|
||||
&format!("{},,,{}", commit3.id().hex(), commit1.id().hex())
|
||||
&format!("{}..{}", commit3.id().hex(), commit1.id().hex())
|
||||
),
|
||||
vec![]
|
||||
);
|
||||
|
@ -677,7 +677,7 @@ fn test_evaluate_expression_range(use_git: bool) {
|
|||
assert_eq!(
|
||||
resolve_commit_ids(
|
||||
mut_repo.as_repo_ref(),
|
||||
&format!("{},,,{}", commit1.id().hex(), commit4.id().hex())
|
||||
&format!("{}..{}", commit1.id().hex(), commit4.id().hex())
|
||||
),
|
||||
vec![
|
||||
commit4.id().clone(),
|
||||
|
@ -690,7 +690,7 @@ fn test_evaluate_expression_range(use_git: bool) {
|
|||
assert_eq!(
|
||||
resolve_commit_ids(
|
||||
mut_repo.as_repo_ref(),
|
||||
&format!("{},,,{}", commit2.id().hex(), commit3.id().hex())
|
||||
&format!("{}..{}", commit2.id().hex(), commit3.id().hex())
|
||||
),
|
||||
vec![commit3.id().clone()]
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue