annotate mercurial/help/patterns.txt @ 23167:a3c2d9211294 stable

templater: don't overwrite the keyword mapping in runsymbol() (issue4362) This keyword remapping was introduced in e06e9fd2d99f as part of converting generator based iterators into list based iterators, mentioning "undesired behavior in template" when a generator is exhausted, but doesn't say what and introduces no tests. The problem with the remapping was that it corrupted the output for keywords like 'extras', 'file_copies' and 'file_copies_switch' in templates such as: $ hg log -r 142b5d5ec9cc --template "{file_copies % ' File: {file_copy}\n'}" File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) File: mercurial/changelog.py (mercurial/hg.py) What was happening was that in the first call to runtemplate() inside runmap(), 'lm' mapped the keyword (e.g. file_copies) to the appropriate showxxx() method. On each subsequent call to runtemplate() in that loop however, the keyword was mapped to a list of the first item's pieces, e.g.: 'file_copy': ['mercurial/changelog.py', ' (', 'mercurial/hg.py', ')'] Therefore, the dict for the second and any subsequent items were not processed through the corresponding showxxx() method, and the first item's data was reused. The 'extras' keyword regressed in de7e6c489412, and 'file_copies' regressed in 0b241d7a8c62 for other reasons. The common thread of things fixed by this seems to be when a list of dicts are passed to the templatekw._hybrid class.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 03 Nov 2014 12:08:03 -0500
parents f1a3ae7c15df
children 7072b91ccd20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
16 current repository root.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
17
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
18 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
19 at the current directory; a glob such as ``*.c`` will only match files
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
20 in the current directory ending with ``.c``.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
21
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
22 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
23 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
24
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9540
diff changeset
25 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
26 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
27
13218
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
28 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
29 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
30 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
31 pattern.
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
32
20290
50db996bccaf doc: add description about pattern matching against directories
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18960
diff changeset
33 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
34 ``-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
35 under matched directories are treated as matched.
20290
50db996bccaf doc: add description about pattern matching against directories
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 18960
diff changeset
36
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
37 Plain examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
38
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
39 path:foo/bar a name bar in a directory named foo in the root
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
40 of the repository
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
41 path:path:name a file or directory named "path:name"
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
42
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
43 Glob examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
44
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
45 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
46 *.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
47 **.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
48 current directory including itself.
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
49 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
50 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
51 including itself.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
52
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
53 Regexp examples::
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
54
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
55 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
56
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
57 File examples::
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
58
1f4721de2ca9 match: support reading pattern lists from files
Steve Borho <steve@borho.org>
parents: 9999
diff changeset
59 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
60 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
61
6ab8b17adc03 fileset: add a help topic
Matt Mackall <mpm@selenic.com>
parents: 13218
diff changeset
62 See also :hg:`help filesets`.