mercurial/helptext/patterns.txt
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 26 Apr 2024 19:10:35 +0100
changeset 51626 865efc020c33
parent 50695 1c31b343e514
permissions -rw-r--r--
dirstate: remove the python-side whitelist of allowed matchers This whitelist is too permissive because it allows matchers that contain disallowed ones deep inside, for example through `intersectionmatcher`. It is also too restrictive because it doesn't pass through some of the matchers we support, such as `patternmatcher`. It's also unnecessary because unsupported matchers raise `FallbackError` and we fall back anyway. Making this change makes more of the tests use rust code path, and therefore subtly change behavior. For example, rust status in largefiles repos seems to have strange behavior.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     1
Mercurial accepts several notations for identifying one or more files
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     2
at a time.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     3
48523
823e906d879d help: properly document the default pattern
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 43632
diff changeset
     4
By default, Mercurial treats filenames verbatim without pattern
823e906d879d help: properly document the default pattern
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 43632
diff changeset
     5
matching, relative to the current working directory. Note that your
823e906d879d help: properly document the default pattern
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 43632
diff changeset
     6
system shell might perform pattern matching of its own before passing
823e906d879d help: properly document the default pattern
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 43632
diff changeset
     7
filenames into Mercurial.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     8
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     9
Alternate pattern notations must be specified explicitly.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    10
16504
e3c7ca15cde2 doc: add note about pattern rooted/unrooted cases to "hgignore" and "patterns"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 14686
diff changeset
    11
.. note::
20532
f1a3ae7c15df help: remove last occurrences of ".. note::" without two newlines
Simon Heimberg <simohe@besonet.ch>
parents: 20329
diff changeset
    12
18960
170fc0949fb6 check-code: check txt files for trailing whitespace
Mads Kiilerich <madski@unity3d.com>
parents: 16510
diff changeset
    13
  Patterns specified in ``.hgignore`` are not rooted.
16510
c7c9473fcc46 docs: don't use :hg: at the beginning of lines in notes (issue3397)
Mads Kiilerich <mads@kiilerich.com>
parents: 16504
diff changeset
    14
  Please see :hg:`help hgignore` for details.
16504
e3c7ca15cde2 doc: add note about pattern rooted/unrooted cases to "hgignore" and "patterns"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 14686
diff changeset
    15
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    16
To use a plain path name without any pattern matching, start it with
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    17
``path:``. These path names must completely match starting at the
31012
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    18
current repository root, and when the path points to a directory, it is matched
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    19
recursively. To match all files in a directory non-recursively (not including
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    20
any files in subdirectories), ``rootfilesin:`` can be used, specifying an
50695
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    21
absolute path (relative to the repository root). To match a single file exactly,
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    22
relative to the repository root, you can use ``filepath:``.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    23
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    24
To use an extended glob, start a name with ``glob:``. Globs are rooted
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    25
at the current directory; a glob such as ``*.c`` will only match files
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 32795
diff changeset
    26
in the current directory ending with ``.c``. ``rootglob:`` can be used
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 32795
diff changeset
    27
instead of ``glob:`` for a glob that is rooted at the root of the
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 32795
diff changeset
    28
repository.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    29
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    30
The supported glob syntax extensions are ``**`` to match any string
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    31
across path separators and ``{a,b}`` to mean "a or b".
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    32
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    33
To use a Perl/Python regular expression, start a name with ``re:``.
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    34
Regexp pattern matching is anchored at the root of the repository.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    35
13218
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    36
To read name patterns from a file, use ``listfile:`` or ``listfile0:``.
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    37
The latter expects null delimited patterns while the former expects line
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    38
feeds. Each string read from the file is itself treated as a file
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    39
pattern.
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    40
25284
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    41
To read a set of patterns from a file, use ``include:`` or ``subinclude:``.
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    42
``include:`` will use all the patterns from the given file and treat them as if
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    43
they had been passed in manually.  ``subinclude:`` will only apply the patterns
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    44
against files that are under the subinclude file's directory. See :hg:`help
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    45
hgignore` for details on the format of these files.
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    46
20290
50db996bccaf doc: add description about pattern matching against directories
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18960
diff changeset
    47
All patterns, except for ``glob:`` specified in command line (not for
20329
45f23b1ff345 doc: fix mistake about matching against directories in "pattern.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20290
diff changeset
    48
``-I`` or ``-X`` options), can match also against directories: files
45f23b1ff345 doc: fix mistake about matching against directories in "pattern.txt"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20290
diff changeset
    49
under matched directories are treated as matched.
31012
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    50
For ``-I`` and ``-X`` options, ``glob:`` will match directories recursively.
20290
50db996bccaf doc: add description about pattern matching against directories
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18960
diff changeset
    51
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    52
Plain examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    53
50695
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    54
  path:foo/bar                  a name bar in a directory named foo in the root
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    55
                                of the repository
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    56
  path:some/path                a file or directory named "some/path"
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    57
  filepath:some/path/to/a/file  exactly a single file named
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    58
                                "some/path/to/a/file", relative to the root
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    59
                                of the repository
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    60
  rootfilesin:foo/bar           the files in a directory called foo/bar, but
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    61
                                not any files in its subdirectories and not
1c31b343e514 match: add `filepath:` pattern to match an exact filepath relative to the root
Raphaël Gomès <rgomes@octobus.net>
parents: 48523
diff changeset
    62
                                a file bar in directory foo
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    63
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    64
Glob examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    65
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    66
  glob:*.c       any name ending in ".c" in the current directory
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    67
  *.c            any name ending in ".c" in the current directory
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    68
  **.c           any name ending in ".c" in any subdirectory of the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    69
                 current directory including itself.
32795
efebc9f52ecb help: correct description of "glob:foo/*" matching
Martin von Zweigbergk <martinvonz@google.com>
parents: 31012
diff changeset
    70
  foo/*          any file in directory foo
efebc9f52ecb help: correct description of "glob:foo/*" matching
Martin von Zweigbergk <martinvonz@google.com>
parents: 31012
diff changeset
    71
  foo/**         any file in directory foo plus all its subdirectories,
31012
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    72
                 recursively
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    73
  foo/*.c        any name ending in ".c" in the directory foo
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    74
  foo/**.c       any name ending in ".c" in any subdirectory of foo
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    75
                 including itself.
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 32795
diff changeset
    76
  rootglob:*.c   any name ending in ".c" in the root of the repository
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    77
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    78
Regexp examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    79
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    80
  re:.*\.c$      any name ending in ".c", anywhere in the repository
13218
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    81
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    82
File examples::
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    83
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    84
  listfile:list.txt  read list from list.txt with one file pattern per line
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    85
  listfile0:list.txt read list from list.txt with null byte delimiters
14686
6ab8b17adc03 fileset: add a help topic
Matt Mackall <mpm@selenic.com>
parents: 13218
diff changeset
    86
6ab8b17adc03 fileset: add a help topic
Matt Mackall <mpm@selenic.com>
parents: 13218
diff changeset
    87
See also :hg:`help filesets`.
25284
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    88
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    89
Include examples::
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    90
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    91
  include:path/to/mypatternfile    reads patterns to be applied to all paths
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    92
  subinclude:path/to/subignorefile reads patterns specifically for paths in the
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    93
                                   subdirectory