sapling/mercurial/help
FUJIWARA Katsunori fa0f66b4fb revset: introduce new operator "##" to concatenate strings/symbols at runtime
Before this patch, there is no way to concatenate strings at runtime.

For example, to search for the issue ID "1234" in descriptions against
all of "issue 1234", "issue:1234", issue1234" and "bug(1234)"
patterns, the revset below should be written fully from scratch for
each issue ID.

    grep(r"\bissue[ :]?1234\b|\bbug\(1234\)")

This patch introduces new infix operator "##" to concatenate
strings/symbols at runtime. Operator symbol "##" comes from the same
one of C pre-processor. This concatenation allows parametrizing a part
of strings in revset queries.

In the case of example above, the definition of the revset alias using
operator "##" below can search issue ID "1234" in complicated patterns
by "issue(1234)" simply:

    issue($1) = grep(r"\bissue[ :]?" ## $1 ## r"\b|\bbug\(" ## $1 ## r"\)")

"##" operator does:

  - concatenate not only strings but also symbols into the string

    Exact distinction between strings and symbols seems not to be
    convenience, because it is tiresome for users (and
    "revset.getstring" treats both similarly)

    For example of revset alias "issue()", "issue(1234)" is easier
    than "issue('1234')".

  - have higher priority than any other prefix, infix and postfix
    operators (like as "##" of C pre-processor)

    This patch (re-)assigns the priority 20 to "##", and 21 to "(",
    because priority 19 is already assigned to "-" as prefix "negate".
2015-01-06 23:46:18 +09:00
..
common.txt doc: make man and html from translated documents 2013-07-03 21:49:43 +09:00
config.txt ignore: resolve ignore files relative to repo root (issue4473) (BC) 2014-12-16 14:34:53 -08:00
dates.txt doc: fix internal date sample (issue4072) 2013-10-29 21:54:49 +02:00
diffs.txt help: refer to user configuration file more consistently 2010-08-27 22:36:35 -04:00
environment.txt HGPLAIN: allow exceptions to plain mode, like i18n, via HGPLAINEXCEPT 2011-01-05 00:18:36 +11:00
extensions.txt doc: make it easier to read how to enable extensions 2013-06-06 14:05:03 -04:00
filesets.txt help: use "hg files" instead of "hg locate" in "hg help filesets" 2014-11-01 02:43:08 +09:00
glossary.txt glossary: add deprecated and experimental 2014-10-17 12:34:27 -05:00
hg.1.txt doc: bump copyright year 2014-01-10 16:26:11 -06:00
hgignore.5.txt doc: bump copyright year 2014-01-10 16:26:11 -06:00
hgignore.txt help: remove last occurrences of ".. note::" without two newlines 2014-02-19 13:25:28 +01:00
hgrc.5.txt doc: bump copyright year 2014-01-10 16:26:11 -06:00
hgweb.txt fix trivial spelling errors 2012-08-15 22:38:42 +02:00
merge-tools.txt filemerge: switch the default name for internal tools from internal:x to :x 2014-09-28 17:15:28 +02:00
multirevs.txt setup: install translation files as package data 2009-12-01 16:06:10 +01:00
patterns.txt help: remove last occurrences of ".. note::" without two newlines 2014-02-19 13:25:28 +01:00
phases.txt help: remove last occurrences of ".. note::" without two newlines 2014-02-19 13:25:28 +01:00
revisions.txt help: branch names primarily denote the tipmost unclosed branch head 2013-11-21 15:17:18 -05:00
revsets.txt revset: introduce new operator "##" to concatenate strings/symbols at runtime 2015-01-06 23:46:18 +09:00
subrepos.txt addremove: add support for the -S flag 2014-11-24 23:51:26 -05:00
templates.txt templater: add "diff" template function 2014-08-28 22:45:36 +09:00
urls.txt help: stop documentation markup appearing in generated help 2013-05-15 22:19:12 +01:00