mercurial/help/patterns.txt
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 16 Oct 2019 17:49:30 +0200
changeset 43254 181d28ba05da
parent 41282 4fab8a7d2d72
permissions -rw-r--r--
copies: avoid instancing more changectx to access parent revisions We just need to know the revision numbers of the parents, creating full context is needlessly expensive. This provide a small, but noticeable performance boost. revision: large amount; added files: large amount; rename small amount; c3b14617fbd7 9ba6ab77fd29 before: ! wall 2.885636 comb 2.900000 user 2.870000 sys 0.030000 (median of 10) after: ! wall 2.702270 comb 2.710000 user 2.690000 sys 0.020000 (median of 10) revision: large amount; added files: small amount; rename small amount; c3b14617fbd7 f650a9b140d2 before: ! wall 4.298271 comb 4.290000 user 4.240000 sys 0.050000 (median of 10) after: ! wall 3.976610 comb 3.970000 user 3.920000 sys 0.050000 (median of 10) revision: large amount; added files: large amount; rename large amount; 08ea3258278e d9fa043f30c0 before: ! wall 0.773397 comb 0.770000 user 0.770000 sys 0.000000 (median of 11) after: ! wall 0.701634 comb 0.700000 user 0.700000 sys 0.000000 (median of 13) revision: small amount; added files: large amount; rename large amount; df6f7a526b60 a83dc6a2d56f before: ! wall 0.013585 comb 0.010000 user 0.010000 sys 0.000000 (median of 217) after: ! wall 0.013550 comb 0.010000 user 0.010000 sys 0.000000 (median of 218) revision: small amount; added files: large amount; rename small amount; 4aa4e1f8e19a 169138063d63 before: ! wall 0.003202 comb 0.000000 user 0.000000 sys 0.000000 (median of 929) after: ! wall 0.002993 comb 0.010000 user 0.010000 sys 0.000000 (median of 992) revision: small amount; added files: small amount; rename small amount; 4bc173b045a6 964879152e2e before: ! wall 0.000077 comb 0.000000 user 0.000000 sys 0.000000 (median of 12060) after: ! wall 0.000072 comb 0.000000 user 0.000000 sys 0.000000 (median of 12804) revision: medium amount; added files: large amount; rename medium amount; c95f1ced15f2 2c68e87c3efe before: ! wall 0.510614 comb 0.500000 user 0.500000 sys 0.000000 (median of 18) after: ! wall 0.473681 comb 0.470000 user 0.470000 sys 0.000000 (median of 20) revision: medium amount; added files: medium amount; rename small amount; d343da0c55a8 d7746d32bf9d before: ! wall 0.126552 comb 0.130000 user 0.130000 sys 0.000000 (median of 77) after: ! wall 0.115240 comb 0.110000 user 0.110000 sys 0.000000 (median of 85) Differential Revision: https://phab.mercurial-scm.org/D7122
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
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     4
By default, Mercurial treats filenames as shell-style extended glob
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     5
patterns.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     6
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     7
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
     8
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
     9
.. note::
20532
f1a3ae7c15df help: remove last occurrences of ".. note::" without two newlines
Simon Heimberg <simohe@besonet.ch>
parents: 20329
diff changeset
    10
18960
170fc0949fb6 check-code: check txt files for trailing whitespace
Mads Kiilerich <madski@unity3d.com>
parents: 16510
diff changeset
    11
  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
    12
  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
    13
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    14
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
    15
``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
    16
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
    17
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
    18
any files in subdirectories), ``rootfilesin:`` can be used, specifying an
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    19
absolute path (relative to the repository root).
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    20
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    21
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
    22
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
    23
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
    24
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
    25
repository.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    26
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    27
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
    28
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
    29
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
    30
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
    31
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
    32
13218
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    33
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
    34
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
    35
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
    36
pattern.
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    37
25284
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    38
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
    39
``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
    40
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
    41
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
    42
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
    43
20290
50db996bccaf doc: add description about pattern matching against directories
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18960
diff changeset
    44
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
    45
``-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
    46
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
    47
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
    48
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    49
Plain examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    50
31012
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    51
  path:foo/bar        a name bar in a directory named foo in the root
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    52
                      of the repository
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    53
  path:path:name      a file or directory named "path:name"
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    54
  rootfilesin:foo/bar the files in a directory called foo/bar, but not any files
88358446da16 match: adding support for matching files inside a directory
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents: 25284
diff changeset
    55
                      in its subdirectories and not 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
    56
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    57
Glob examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    58
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    59
  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
    60
  *.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
    61
  **.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
    62
                 current directory including itself.
32795
efebc9f52ecb help: correct description of "glob:foo/*" matching
Martin von Zweigbergk <martinvonz@google.com>
parents: 31012
diff changeset
    63
  foo/*          any file in directory foo
efebc9f52ecb help: correct description of "glob:foo/*" matching
Martin von Zweigbergk <martinvonz@google.com>
parents: 31012
diff changeset
    64
  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
    65
                 recursively
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    66
  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
    67
  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
    68
                 including itself.
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 32795
diff changeset
    69
  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
    70
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    71
Regexp examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    72
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    73
  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
    74
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    75
File examples::
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    76
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
    77
  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
    78
  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
    79
6ab8b17adc03 fileset: add a help topic
Matt Mackall <mpm@selenic.com>
parents: 13218
diff changeset
    80
See also :hg:`help filesets`.
25284
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    81
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    82
Include examples::
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    83
7072b91ccd20 help: add documentation on include: and subinclude:
Durham Goode <durham@fb.com>
parents: 20532
diff changeset
    84
  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
    85
  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
    86
                                   subdirectory