##// END OF EJS Templates
doc: add description about pattern matching against directories...
FUJIWARA Katsunori -
r20290:50db996b default
parent child Browse files
Show More
@@ -1,57 +1,62
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 as shell-style extended glob
5 patterns.
5 patterns.
6
6
7 Alternate pattern notations must be specified explicitly.
7 Alternate pattern notations must be specified explicitly.
8
8
9 .. note::
9 .. note::
10 Patterns specified in ``.hgignore`` are not rooted.
10 Patterns specified in ``.hgignore`` are not rooted.
11 Please see :hg:`help hgignore` for details.
11 Please see :hg:`help hgignore` for details.
12
12
13 To use a plain path name without any pattern matching, start it with
13 To use a plain path name without any pattern matching, start it with
14 ``path:``. These path names must completely match starting at the
14 ``path:``. These path names must completely match starting at the
15 current repository root.
15 current repository root.
16
16
17 To use an extended glob, start a name with ``glob:``. Globs are rooted
17 To use an extended glob, start a name with ``glob:``. Globs are rooted
18 at the current directory; a glob such as ``*.c`` will only match files
18 at the current directory; a glob such as ``*.c`` will only match files
19 in the current directory ending with ``.c``.
19 in the current directory ending with ``.c``.
20
20
21 The supported glob syntax extensions are ``**`` to match any string
21 The supported glob syntax extensions are ``**`` to match any string
22 across path separators and ``{a,b}`` to mean "a or b".
22 across path separators and ``{a,b}`` to mean "a or b".
23
23
24 To use a Perl/Python regular expression, start a name with ``re:``.
24 To use a Perl/Python regular expression, start a name with ``re:``.
25 Regexp pattern matching is anchored at the root of the repository.
25 Regexp pattern matching is anchored at the root of the repository.
26
26
27 To read name patterns from a file, use ``listfile:`` or ``listfile0:``.
27 To read name patterns from a file, use ``listfile:`` or ``listfile0:``.
28 The latter expects null delimited patterns while the former expects line
28 The latter expects null delimited patterns while the former expects line
29 feeds. Each string read from the file is itself treated as a file
29 feeds. Each string read from the file is itself treated as a file
30 pattern.
30 pattern.
31
31
32 All patterns, except for ``glob:`` specified in command line (not for
33 ``-I`` or ``-X`` options) or ``.hgignore`` file, can match also
34 against directories: files under matched directories are treated as
35 matched.
36
32 Plain examples::
37 Plain examples::
33
38
34 path:foo/bar a name bar in a directory named foo in the root
39 path:foo/bar a name bar in a directory named foo in the root
35 of the repository
40 of the repository
36 path:path:name a file or directory named "path:name"
41 path:path:name a file or directory named "path:name"
37
42
38 Glob examples::
43 Glob examples::
39
44
40 glob:*.c any name ending in ".c" in the current directory
45 glob:*.c any name ending in ".c" in the current directory
41 *.c any name ending in ".c" in the current directory
46 *.c any name ending in ".c" in the current directory
42 **.c any name ending in ".c" in any subdirectory of the
47 **.c any name ending in ".c" in any subdirectory of the
43 current directory including itself.
48 current directory including itself.
44 foo/*.c any name ending in ".c" in the directory foo
49 foo/*.c any name ending in ".c" in the directory foo
45 foo/**.c any name ending in ".c" in any subdirectory of foo
50 foo/**.c any name ending in ".c" in any subdirectory of foo
46 including itself.
51 including itself.
47
52
48 Regexp examples::
53 Regexp examples::
49
54
50 re:.*\.c$ any name ending in ".c", anywhere in the repository
55 re:.*\.c$ any name ending in ".c", anywhere in the repository
51
56
52 File examples::
57 File examples::
53
58
54 listfile:list.txt read list from list.txt with one file pattern per line
59 listfile:list.txt read list from list.txt with one file pattern per line
55 listfile0:list.txt read list from list.txt with null byte delimiters
60 listfile0:list.txt read list from list.txt with null byte delimiters
56
61
57 See also :hg:`help filesets`.
62 See also :hg:`help filesets`.
General Comments 0
You need to be logged in to leave comments. Login now