From d37a5b1b74db3641da755dc8d5be4e95fa461bdb Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 17 Feb 2025 11:42:37 +0900 Subject: [PATCH] fileset, revset: settle on optionally-quoted pattern syntax Suppose revsets and filesets are primarily used in command shell, it would be annoying if quoting is required in addition to the shell quoting. We might also want to relax the revset parser to allow bare * in glob string. Closes #2101 --- docs/revsets.md | 6 +++--- lib/src/fileset.pest | 1 - lib/src/revset.pest | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/revsets.md b/docs/revsets.md index 609ef808c..2240f6aea 100644 --- a/docs/revsets.md +++ b/docs/revsets.md @@ -407,10 +407,10 @@ revsets (expressions) as arguments. ## String patterns -Functions that perform string matching support the following pattern syntax: +Functions that perform string matching support the following pattern syntax (the +quotes are optional): -* `"string"`, or `string` (the quotes are optional), or `substring:"string"`: - Matches strings that contain `string`. +* `"string"` or `substring:"string"`: Matches strings that contain `string`. * `exact:"string"`: Matches strings exactly equal to `string`. * `glob:"pattern"`: Matches strings with Unix-style shell [wildcard `pattern`](https://docs.rs/glob/latest/glob/struct.Pattern.html). diff --git a/lib/src/fileset.pest b/lib/src/fileset.pest index 534198631..c252e51b7 100644 --- a/lib/src/fileset.pest +++ b/lib/src/fileset.pest @@ -61,7 +61,6 @@ function_arguments = { | "" } -// TODO: change rhs to string_literal to require quoting? #2101 string_pattern = { strict_identifier ~ pattern_kind_op diff --git a/lib/src/revset.pest b/lib/src/revset.pest index 26c7a2f49..54b0d93b0 100644 --- a/lib/src/revset.pest +++ b/lib/src/revset.pest @@ -88,7 +88,6 @@ formal_parameters = { | "" } -// TODO: change rhs to string_literal to require quoting? #2101 string_pattern = { strict_identifier ~ pattern_kind_op ~ symbol } primary = {