##// END OF EJS Templates
help: properly document the default pattern...
Jordi Gutiérrez Hermoso -
r49352:823e906d default
parent child Browse files
Show More
@@ -1,86 +1,88 b''
1 Mercurial accepts several notations for identifying one or more files
1 Mercurial accepts several notations for identifying one or more files
2 at a time.
2 at a time.
3
3
4 By default, Mercurial treats filenames as shell-style extended glob
4 By default, Mercurial treats filenames verbatim without pattern
5 patterns.
5 matching, relative to the current working directory. Note that your
6 system shell might perform pattern matching of its own before passing
7 filenames into Mercurial.
6
8
7 Alternate pattern notations must be specified explicitly.
9 Alternate pattern notations must be specified explicitly.
8
10
9 .. note::
11 .. note::
10
12
11 Patterns specified in ``.hgignore`` are not rooted.
13 Patterns specified in ``.hgignore`` are not rooted.
12 Please see :hg:`help hgignore` for details.
14 Please see :hg:`help hgignore` for details.
13
15
14 To use a plain path name without any pattern matching, start it with
16 To use a plain path name without any pattern matching, start it with
15 ``path:``. These path names must completely match starting at the
17 ``path:``. These path names must completely match starting at the
16 current repository root, and when the path points to a directory, it is matched
18 current repository root, and when the path points to a directory, it is matched
17 recursively. To match all files in a directory non-recursively (not including
19 recursively. To match all files in a directory non-recursively (not including
18 any files in subdirectories), ``rootfilesin:`` can be used, specifying an
20 any files in subdirectories), ``rootfilesin:`` can be used, specifying an
19 absolute path (relative to the repository root).
21 absolute path (relative to the repository root).
20
22
21 To use an extended glob, start a name with ``glob:``. Globs are rooted
23 To use an extended glob, start a name with ``glob:``. Globs are rooted
22 at the current directory; a glob such as ``*.c`` will only match files
24 at the current directory; a glob such as ``*.c`` will only match files
23 in the current directory ending with ``.c``. ``rootglob:`` can be used
25 in the current directory ending with ``.c``. ``rootglob:`` can be used
24 instead of ``glob:`` for a glob that is rooted at the root of the
26 instead of ``glob:`` for a glob that is rooted at the root of the
25 repository.
27 repository.
26
28
27 The supported glob syntax extensions are ``**`` to match any string
29 The supported glob syntax extensions are ``**`` to match any string
28 across path separators and ``{a,b}`` to mean "a or b".
30 across path separators and ``{a,b}`` to mean "a or b".
29
31
30 To use a Perl/Python regular expression, start a name with ``re:``.
32 To use a Perl/Python regular expression, start a name with ``re:``.
31 Regexp pattern matching is anchored at the root of the repository.
33 Regexp pattern matching is anchored at the root of the repository.
32
34
33 To read name patterns from a file, use ``listfile:`` or ``listfile0:``.
35 To read name patterns from a file, use ``listfile:`` or ``listfile0:``.
34 The latter expects null delimited patterns while the former expects line
36 The latter expects null delimited patterns while the former expects line
35 feeds. Each string read from the file is itself treated as a file
37 feeds. Each string read from the file is itself treated as a file
36 pattern.
38 pattern.
37
39
38 To read a set of patterns from a file, use ``include:`` or ``subinclude:``.
40 To read a set of patterns from a file, use ``include:`` or ``subinclude:``.
39 ``include:`` will use all the patterns from the given file and treat them as if
41 ``include:`` will use all the patterns from the given file and treat them as if
40 they had been passed in manually. ``subinclude:`` will only apply the patterns
42 they had been passed in manually. ``subinclude:`` will only apply the patterns
41 against files that are under the subinclude file's directory. See :hg:`help
43 against files that are under the subinclude file's directory. See :hg:`help
42 hgignore` for details on the format of these files.
44 hgignore` for details on the format of these files.
43
45
44 All patterns, except for ``glob:`` specified in command line (not for
46 All patterns, except for ``glob:`` specified in command line (not for
45 ``-I`` or ``-X`` options), can match also against directories: files
47 ``-I`` or ``-X`` options), can match also against directories: files
46 under matched directories are treated as matched.
48 under matched directories are treated as matched.
47 For ``-I`` and ``-X`` options, ``glob:`` will match directories recursively.
49 For ``-I`` and ``-X`` options, ``glob:`` will match directories recursively.
48
50
49 Plain examples::
51 Plain examples::
50
52
51 path:foo/bar a name bar in a directory named foo in the root
53 path:foo/bar a name bar in a directory named foo in the root
52 of the repository
54 of the repository
53 path:path:name a file or directory named "path:name"
55 path:path:name a file or directory named "path:name"
54 rootfilesin:foo/bar the files in a directory called foo/bar, but not any files
56 rootfilesin:foo/bar the files in a directory called foo/bar, but not any files
55 in its subdirectories and not a file bar in directory foo
57 in its subdirectories and not a file bar in directory foo
56
58
57 Glob examples::
59 Glob examples::
58
60
59 glob:*.c any name ending in ".c" in the current directory
61 glob:*.c any name ending in ".c" in the current directory
60 *.c any name ending in ".c" in the current directory
62 *.c any name ending in ".c" in the current directory
61 **.c any name ending in ".c" in any subdirectory of the
63 **.c any name ending in ".c" in any subdirectory of the
62 current directory including itself.
64 current directory including itself.
63 foo/* any file in directory foo
65 foo/* any file in directory foo
64 foo/** any file in directory foo plus all its subdirectories,
66 foo/** any file in directory foo plus all its subdirectories,
65 recursively
67 recursively
66 foo/*.c any name ending in ".c" in the directory foo
68 foo/*.c any name ending in ".c" in the directory foo
67 foo/**.c any name ending in ".c" in any subdirectory of foo
69 foo/**.c any name ending in ".c" in any subdirectory of foo
68 including itself.
70 including itself.
69 rootglob:*.c any name ending in ".c" in the root of the repository
71 rootglob:*.c any name ending in ".c" in the root of the repository
70
72
71 Regexp examples::
73 Regexp examples::
72
74
73 re:.*\.c$ any name ending in ".c", anywhere in the repository
75 re:.*\.c$ any name ending in ".c", anywhere in the repository
74
76
75 File examples::
77 File examples::
76
78
77 listfile:list.txt read list from list.txt with one file pattern per line
79 listfile:list.txt read list from list.txt with one file pattern per line
78 listfile0:list.txt read list from list.txt with null byte delimiters
80 listfile0:list.txt read list from list.txt with null byte delimiters
79
81
80 See also :hg:`help filesets`.
82 See also :hg:`help filesets`.
81
83
82 Include examples::
84 Include examples::
83
85
84 include:path/to/mypatternfile reads patterns to be applied to all paths
86 include:path/to/mypatternfile reads patterns to be applied to all paths
85 subinclude:path/to/subignorefile reads patterns specifically for paths in the
87 subinclude:path/to/subignorefile reads patterns specifically for paths in the
86 subdirectory
88 subdirectory
General Comments 0
You need to be logged in to leave comments. Login now