mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 14:46:47 +03:00
help: eliminate duplicate text for revset string patterns
There's no reason to duplicate this so many times, and it's likely an instance will be missed if support for a new pattern is added and documented. The stringmatcher is mostly used by revsets, though it is also used for the 'tag' related templates, and namespace filtering in the journal extension. So maybe there's a better place to document it. `hg help patterns` seems inappropriate, because that is all file pattern matching. While here, indicate how to perform case insensitive regex searches.
This commit is contained in:
parent
e0b76f5323
commit
d3bfb5a06a
@ -119,6 +119,23 @@ There is a single postfix operator:
|
||||
``x^``
|
||||
Equivalent to ``x^1``, the first parent of each changeset in x.
|
||||
|
||||
Patterns
|
||||
========
|
||||
|
||||
Where noted, predicates that perform string matching can accept a pattern
|
||||
string. The pattern may be either a literal, or a regular expression. If the
|
||||
pattern starts with ``re:``, the remainder of the pattern is treated as a
|
||||
regular expression. Otherwise, it is treated as a literal. To match a pattern
|
||||
that actually starts with ``re:``, use the prefix ``literal:``.
|
||||
|
||||
Matching is case-sensitive, unless otherwise noted. To perform a case-
|
||||
insensitive match on a case-sensitive predicate, use a regular expression,
|
||||
prefixed with ``(?i)``.
|
||||
|
||||
For example::
|
||||
|
||||
``tag(r're:(?i)release')`` matches "release" or "RELEASE" or "Release", etc
|
||||
|
||||
Predicates
|
||||
==========
|
||||
|
||||
|
@ -588,9 +588,7 @@ def bisected(repo, subset, x):
|
||||
def bookmark(repo, subset, x):
|
||||
"""The named bookmark or all bookmarks.
|
||||
|
||||
If `name` starts with `re:`, the remainder of the name is treated as
|
||||
a regular expression. To match a bookmark that actually starts with `re:`,
|
||||
use the prefix `literal:`.
|
||||
Pattern matching is supported for `name`. See ``hg help revsets.patterns``.
|
||||
"""
|
||||
# i18n: "bookmark" is a keyword
|
||||
args = getargs(x, 0, 1, _('bookmark takes one or no arguments'))
|
||||
@ -628,9 +626,8 @@ def branch(repo, subset, x):
|
||||
All changesets belonging to the given branch or the branches of the given
|
||||
changesets.
|
||||
|
||||
If `string` starts with `re:`, the remainder of the name is treated as
|
||||
a regular expression. To match a branch that actually starts with `re:`,
|
||||
use the prefix `literal:`.
|
||||
Pattern matching is supported for `string`. See
|
||||
``hg help revsets.patterns``.
|
||||
"""
|
||||
getbi = repo.revbranchcache().branchinfo
|
||||
|
||||
@ -815,9 +812,8 @@ def date(repo, subset, x):
|
||||
def desc(repo, subset, x):
|
||||
"""Search commit message for string. The match is case-insensitive.
|
||||
|
||||
If `string` starts with `re:`, the remainder of the string is treated as
|
||||
a regular expression. To match a substring that actually starts with `re:`,
|
||||
use the prefix `literal:`.
|
||||
Pattern matching is supported for `string`. See
|
||||
``hg help revsets.patterns``.
|
||||
"""
|
||||
# i18n: "desc" is a keyword
|
||||
ds = getstring(x, _("desc requires a string"))
|
||||
@ -927,9 +923,8 @@ def extra(repo, subset, x):
|
||||
"""Changesets with the given label in the extra metadata, with the given
|
||||
optional value.
|
||||
|
||||
If `value` starts with `re:`, the remainder of the value is treated as
|
||||
a regular expression. To match a value that actually starts with `re:`,
|
||||
use the prefix `literal:`.
|
||||
Pattern matching is supported for `value`. See
|
||||
``hg help revsets.patterns``.
|
||||
"""
|
||||
args = getargsdict(x, 'extra', 'label value')
|
||||
if 'label' not in args:
|
||||
@ -1409,9 +1404,8 @@ def modifies(repo, subset, x):
|
||||
def named(repo, subset, x):
|
||||
"""The changesets in a given namespace.
|
||||
|
||||
If `namespace` starts with `re:`, the remainder of the string is treated as
|
||||
a regular expression. To match a namespace that actually starts with `re:`,
|
||||
use the prefix `literal:`.
|
||||
Pattern matching is supported for `namespace`. See
|
||||
``hg help revsets.patterns``.
|
||||
"""
|
||||
# i18n: "named" is a keyword
|
||||
args = getargs(x, 1, 1, _('named requires a namespace argument'))
|
||||
@ -2267,9 +2261,8 @@ def _substringmatcher(pattern, casesensitive=True):
|
||||
def tag(repo, subset, x):
|
||||
"""The specified tag by name, or all tagged revisions if no name is given.
|
||||
|
||||
If `name` starts with `re:`, the remainder of the name is treated as
|
||||
a regular expression. To match a tag that actually starts with `re:`,
|
||||
use the prefix `literal:`.
|
||||
Pattern matching is supported for `name`. See
|
||||
``hg help revsets.patterns``.
|
||||
"""
|
||||
# i18n: "tag" is a keyword
|
||||
args = getargs(x, 0, 1, _("tag takes one or no arguments"))
|
||||
@ -2310,9 +2303,8 @@ def unstable(repo, subset, x):
|
||||
def user(repo, subset, x):
|
||||
"""User name contains string. The match is case-insensitive.
|
||||
|
||||
If `string` starts with `re:`, the remainder of the string is treated as
|
||||
a regular expression. To match a user that actually contains `re:`, use
|
||||
the prefix `literal:`.
|
||||
Pattern matching is supported for `string`. See
|
||||
``hg help revsets.patterns``.
|
||||
"""
|
||||
return author(repo, subset, x)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user