##// END OF EJS Templates
templater: load and expand aliases by template engine (API) (issue4842)...
Yuya Nishihara -
r28957:d813132e default
parent child Browse files
Show More
@@ -1,221 +1,222 b''
1 # formatter.py - generic output formatting for mercurial
1 # formatter.py - generic output formatting for mercurial
2 #
2 #
3 # Copyright 2012 Matt Mackall <mpm@selenic.com>
3 # Copyright 2012 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import cPickle
10 import cPickle
11 import os
11 import os
12
12
13 from .i18n import _
13 from .i18n import _
14 from .node import (
14 from .node import (
15 hex,
15 hex,
16 short,
16 short,
17 )
17 )
18
18
19 from . import (
19 from . import (
20 encoding,
20 encoding,
21 error,
21 error,
22 templater,
22 templater,
23 )
23 )
24
24
25 class baseformatter(object):
25 class baseformatter(object):
26 def __init__(self, ui, topic, opts):
26 def __init__(self, ui, topic, opts):
27 self._ui = ui
27 self._ui = ui
28 self._topic = topic
28 self._topic = topic
29 self._style = opts.get("style")
29 self._style = opts.get("style")
30 self._template = opts.get("template")
30 self._template = opts.get("template")
31 self._item = None
31 self._item = None
32 # function to convert node to string suitable for this output
32 # function to convert node to string suitable for this output
33 self.hexfunc = hex
33 self.hexfunc = hex
34 def __nonzero__(self):
34 def __nonzero__(self):
35 '''return False if we're not doing real templating so we can
35 '''return False if we're not doing real templating so we can
36 skip extra work'''
36 skip extra work'''
37 return True
37 return True
38 def _showitem(self):
38 def _showitem(self):
39 '''show a formatted item once all data is collected'''
39 '''show a formatted item once all data is collected'''
40 pass
40 pass
41 def startitem(self):
41 def startitem(self):
42 '''begin an item in the format list'''
42 '''begin an item in the format list'''
43 if self._item is not None:
43 if self._item is not None:
44 self._showitem()
44 self._showitem()
45 self._item = {}
45 self._item = {}
46 def data(self, **data):
46 def data(self, **data):
47 '''insert data into item that's not shown in default output'''
47 '''insert data into item that's not shown in default output'''
48 self._item.update(data)
48 self._item.update(data)
49 def write(self, fields, deftext, *fielddata, **opts):
49 def write(self, fields, deftext, *fielddata, **opts):
50 '''do default text output while assigning data to item'''
50 '''do default text output while assigning data to item'''
51 fieldkeys = fields.split()
51 fieldkeys = fields.split()
52 assert len(fieldkeys) == len(fielddata)
52 assert len(fieldkeys) == len(fielddata)
53 self._item.update(zip(fieldkeys, fielddata))
53 self._item.update(zip(fieldkeys, fielddata))
54 def condwrite(self, cond, fields, deftext, *fielddata, **opts):
54 def condwrite(self, cond, fields, deftext, *fielddata, **opts):
55 '''do conditional write (primarily for plain formatter)'''
55 '''do conditional write (primarily for plain formatter)'''
56 fieldkeys = fields.split()
56 fieldkeys = fields.split()
57 assert len(fieldkeys) == len(fielddata)
57 assert len(fieldkeys) == len(fielddata)
58 self._item.update(zip(fieldkeys, fielddata))
58 self._item.update(zip(fieldkeys, fielddata))
59 def plain(self, text, **opts):
59 def plain(self, text, **opts):
60 '''show raw text for non-templated mode'''
60 '''show raw text for non-templated mode'''
61 pass
61 pass
62 def end(self):
62 def end(self):
63 '''end output for the formatter'''
63 '''end output for the formatter'''
64 if self._item is not None:
64 if self._item is not None:
65 self._showitem()
65 self._showitem()
66
66
67 class plainformatter(baseformatter):
67 class plainformatter(baseformatter):
68 '''the default text output scheme'''
68 '''the default text output scheme'''
69 def __init__(self, ui, topic, opts):
69 def __init__(self, ui, topic, opts):
70 baseformatter.__init__(self, ui, topic, opts)
70 baseformatter.__init__(self, ui, topic, opts)
71 if ui.debugflag:
71 if ui.debugflag:
72 self.hexfunc = hex
72 self.hexfunc = hex
73 else:
73 else:
74 self.hexfunc = short
74 self.hexfunc = short
75 def __nonzero__(self):
75 def __nonzero__(self):
76 return False
76 return False
77 def startitem(self):
77 def startitem(self):
78 pass
78 pass
79 def data(self, **data):
79 def data(self, **data):
80 pass
80 pass
81 def write(self, fields, deftext, *fielddata, **opts):
81 def write(self, fields, deftext, *fielddata, **opts):
82 self._ui.write(deftext % fielddata, **opts)
82 self._ui.write(deftext % fielddata, **opts)
83 def condwrite(self, cond, fields, deftext, *fielddata, **opts):
83 def condwrite(self, cond, fields, deftext, *fielddata, **opts):
84 '''do conditional write'''
84 '''do conditional write'''
85 if cond:
85 if cond:
86 self._ui.write(deftext % fielddata, **opts)
86 self._ui.write(deftext % fielddata, **opts)
87 def plain(self, text, **opts):
87 def plain(self, text, **opts):
88 self._ui.write(text, **opts)
88 self._ui.write(text, **opts)
89 def end(self):
89 def end(self):
90 pass
90 pass
91
91
92 class debugformatter(baseformatter):
92 class debugformatter(baseformatter):
93 def __init__(self, ui, topic, opts):
93 def __init__(self, ui, topic, opts):
94 baseformatter.__init__(self, ui, topic, opts)
94 baseformatter.__init__(self, ui, topic, opts)
95 self._ui.write("%s = [\n" % self._topic)
95 self._ui.write("%s = [\n" % self._topic)
96 def _showitem(self):
96 def _showitem(self):
97 self._ui.write(" " + repr(self._item) + ",\n")
97 self._ui.write(" " + repr(self._item) + ",\n")
98 def end(self):
98 def end(self):
99 baseformatter.end(self)
99 baseformatter.end(self)
100 self._ui.write("]\n")
100 self._ui.write("]\n")
101
101
102 class pickleformatter(baseformatter):
102 class pickleformatter(baseformatter):
103 def __init__(self, ui, topic, opts):
103 def __init__(self, ui, topic, opts):
104 baseformatter.__init__(self, ui, topic, opts)
104 baseformatter.__init__(self, ui, topic, opts)
105 self._data = []
105 self._data = []
106 def _showitem(self):
106 def _showitem(self):
107 self._data.append(self._item)
107 self._data.append(self._item)
108 def end(self):
108 def end(self):
109 baseformatter.end(self)
109 baseformatter.end(self)
110 self._ui.write(cPickle.dumps(self._data))
110 self._ui.write(cPickle.dumps(self._data))
111
111
112 def _jsonifyobj(v):
112 def _jsonifyobj(v):
113 if isinstance(v, tuple):
113 if isinstance(v, tuple):
114 return '[' + ', '.join(_jsonifyobj(e) for e in v) + ']'
114 return '[' + ', '.join(_jsonifyobj(e) for e in v) + ']'
115 elif v is None:
115 elif v is None:
116 return 'null'
116 return 'null'
117 elif v is True:
117 elif v is True:
118 return 'true'
118 return 'true'
119 elif v is False:
119 elif v is False:
120 return 'false'
120 return 'false'
121 elif isinstance(v, (int, float)):
121 elif isinstance(v, (int, float)):
122 return str(v)
122 return str(v)
123 else:
123 else:
124 return '"%s"' % encoding.jsonescape(v)
124 return '"%s"' % encoding.jsonescape(v)
125
125
126 class jsonformatter(baseformatter):
126 class jsonformatter(baseformatter):
127 def __init__(self, ui, topic, opts):
127 def __init__(self, ui, topic, opts):
128 baseformatter.__init__(self, ui, topic, opts)
128 baseformatter.__init__(self, ui, topic, opts)
129 self._ui.write("[")
129 self._ui.write("[")
130 self._ui._first = True
130 self._ui._first = True
131 def _showitem(self):
131 def _showitem(self):
132 if self._ui._first:
132 if self._ui._first:
133 self._ui._first = False
133 self._ui._first = False
134 else:
134 else:
135 self._ui.write(",")
135 self._ui.write(",")
136
136
137 self._ui.write("\n {\n")
137 self._ui.write("\n {\n")
138 first = True
138 first = True
139 for k, v in sorted(self._item.items()):
139 for k, v in sorted(self._item.items()):
140 if first:
140 if first:
141 first = False
141 first = False
142 else:
142 else:
143 self._ui.write(",\n")
143 self._ui.write(",\n")
144 self._ui.write(' "%s": %s' % (k, _jsonifyobj(v)))
144 self._ui.write(' "%s": %s' % (k, _jsonifyobj(v)))
145 self._ui.write("\n }")
145 self._ui.write("\n }")
146 def end(self):
146 def end(self):
147 baseformatter.end(self)
147 baseformatter.end(self)
148 self._ui.write("\n]\n")
148 self._ui.write("\n]\n")
149
149
150 class templateformatter(baseformatter):
150 class templateformatter(baseformatter):
151 def __init__(self, ui, topic, opts):
151 def __init__(self, ui, topic, opts):
152 baseformatter.__init__(self, ui, topic, opts)
152 baseformatter.__init__(self, ui, topic, opts)
153 self._topic = topic
153 self._topic = topic
154 self._t = gettemplater(ui, topic, opts.get('template', ''))
154 self._t = gettemplater(ui, topic, opts.get('template', ''))
155 def _showitem(self):
155 def _showitem(self):
156 g = self._t(self._topic, ui=self._ui, **self._item)
156 g = self._t(self._topic, ui=self._ui, **self._item)
157 self._ui.write(templater.stringify(g))
157 self._ui.write(templater.stringify(g))
158
158
159 def lookuptemplate(ui, topic, tmpl):
159 def lookuptemplate(ui, topic, tmpl):
160 # looks like a literal template?
160 # looks like a literal template?
161 if '{' in tmpl:
161 if '{' in tmpl:
162 return tmpl, None
162 return tmpl, None
163
163
164 # perhaps a stock style?
164 # perhaps a stock style?
165 if not os.path.split(tmpl)[0]:
165 if not os.path.split(tmpl)[0]:
166 mapname = (templater.templatepath('map-cmdline.' + tmpl)
166 mapname = (templater.templatepath('map-cmdline.' + tmpl)
167 or templater.templatepath(tmpl))
167 or templater.templatepath(tmpl))
168 if mapname and os.path.isfile(mapname):
168 if mapname and os.path.isfile(mapname):
169 return None, mapname
169 return None, mapname
170
170
171 # perhaps it's a reference to [templates]
171 # perhaps it's a reference to [templates]
172 t = ui.config('templates', tmpl)
172 t = ui.config('templates', tmpl)
173 if t:
173 if t:
174 return templater.unquotestring(t), None
174 return templater.unquotestring(t), None
175
175
176 if tmpl == 'list':
176 if tmpl == 'list':
177 ui.write(_("available styles: %s\n") % templater.stylelist())
177 ui.write(_("available styles: %s\n") % templater.stylelist())
178 raise error.Abort(_("specify a template"))
178 raise error.Abort(_("specify a template"))
179
179
180 # perhaps it's a path to a map or a template
180 # perhaps it's a path to a map or a template
181 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl):
181 if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl):
182 # is it a mapfile for a style?
182 # is it a mapfile for a style?
183 if os.path.basename(tmpl).startswith("map-"):
183 if os.path.basename(tmpl).startswith("map-"):
184 return None, os.path.realpath(tmpl)
184 return None, os.path.realpath(tmpl)
185 tmpl = open(tmpl).read()
185 tmpl = open(tmpl).read()
186 return tmpl, None
186 return tmpl, None
187
187
188 # constant string?
188 # constant string?
189 return tmpl, None
189 return tmpl, None
190
190
191 def gettemplater(ui, topic, spec):
191 def gettemplater(ui, topic, spec):
192 tmpl, mapfile = lookuptemplate(ui, topic, spec)
192 tmpl, mapfile = lookuptemplate(ui, topic, spec)
193 assert not (tmpl and mapfile)
193 assert not (tmpl and mapfile)
194 if mapfile:
194 if mapfile:
195 return templater.templater.frommapfile(mapfile)
195 return templater.templater.frommapfile(mapfile)
196 return maketemplater(ui, topic, tmpl)
196 return maketemplater(ui, topic, tmpl)
197
197
198 def maketemplater(ui, topic, tmpl, filters=None, cache=None):
198 def maketemplater(ui, topic, tmpl, filters=None, cache=None):
199 """Create a templater from a string template 'tmpl'"""
199 """Create a templater from a string template 'tmpl'"""
200 t = templater.templater(filters=filters, cache=cache)
200 aliases = ui.configitems('templatealias')
201 t = templater.templater(filters=filters, cache=cache, aliases=aliases)
201 if tmpl:
202 if tmpl:
202 t.cache[topic] = tmpl
203 t.cache[topic] = tmpl
203 return t
204 return t
204
205
205 def formatter(ui, topic, opts):
206 def formatter(ui, topic, opts):
206 template = opts.get("template", "")
207 template = opts.get("template", "")
207 if template == "json":
208 if template == "json":
208 return jsonformatter(ui, topic, opts)
209 return jsonformatter(ui, topic, opts)
209 elif template == "pickle":
210 elif template == "pickle":
210 return pickleformatter(ui, topic, opts)
211 return pickleformatter(ui, topic, opts)
211 elif template == "debug":
212 elif template == "debug":
212 return debugformatter(ui, topic, opts)
213 return debugformatter(ui, topic, opts)
213 elif template != "":
214 elif template != "":
214 return templateformatter(ui, topic, opts)
215 return templateformatter(ui, topic, opts)
215 # developer config: ui.formatdebug
216 # developer config: ui.formatdebug
216 elif ui.configbool('ui', 'formatdebug'):
217 elif ui.configbool('ui', 'formatdebug'):
217 return debugformatter(ui, topic, opts)
218 return debugformatter(ui, topic, opts)
218 # deprecated config: ui.formatjson
219 # deprecated config: ui.formatjson
219 elif ui.configbool('ui', 'formatjson'):
220 elif ui.configbool('ui', 'formatjson'):
220 return jsonformatter(ui, topic, opts)
221 return jsonformatter(ui, topic, opts)
221 return plainformatter(ui, topic, opts)
222 return plainformatter(ui, topic, opts)
@@ -1,2071 +1,2076 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
59 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``/etc/mercurial/hgrc`` (per-system)
61 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
62 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``<internal>/default.d/*.rc`` (defaults)
63 - ``<internal>/default.d/*.rc`` (defaults)
64
64
65 .. container:: verbose.windows
65 .. container:: verbose.windows
66
66
67 On Windows, the following files are consulted:
67 On Windows, the following files are consulted:
68
68
69 - ``<repo>/.hg/hgrc`` (per-repository)
69 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``%USERPROFILE%\.hgrc`` (per-user)
70 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
71 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%HOME%\.hgrc`` (per-user)
72 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\Mercurial.ini`` (per-user)
73 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
74 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
75 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\Mercurial.ini`` (per-installation)
76 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<internal>/default.d/*.rc`` (defaults)
77 - ``<internal>/default.d/*.rc`` (defaults)
78
78
79 .. note::
79 .. note::
80
80
81 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
81 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 is used when running 32-bit Python on 64-bit Windows.
82 is used when running 32-bit Python on 64-bit Windows.
83
83
84 .. container:: windows
84 .. container:: windows
85
85
86 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
86 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87
87
88 .. container:: verbose.plan9
88 .. container:: verbose.plan9
89
89
90 On Plan9, the following files are consulted:
90 On Plan9, the following files are consulted:
91
91
92 - ``<repo>/.hg/hgrc`` (per-repository)
92 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``$home/lib/hgrc`` (per-user)
93 - ``$home/lib/hgrc`` (per-user)
94 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
94 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``/lib/mercurial/hgrc`` (per-system)
96 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
97 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``<internal>/default.d/*.rc`` (defaults)
98 - ``<internal>/default.d/*.rc`` (defaults)
99
99
100 Per-repository configuration options only apply in a
100 Per-repository configuration options only apply in a
101 particular repository. This file is not version-controlled, and
101 particular repository. This file is not version-controlled, and
102 will not get transferred during a "clone" operation. Options in
102 will not get transferred during a "clone" operation. Options in
103 this file override options in all other configuration files.
103 this file override options in all other configuration files.
104
104
105 .. container:: unix.plan9
105 .. container:: unix.plan9
106
106
107 On Plan 9 and Unix, most of this file will be ignored if it doesn't
107 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 belong to a trusted user or to a trusted group. See
108 belong to a trusted user or to a trusted group. See
109 :hg:`help config.trusted` for more details.
109 :hg:`help config.trusted` for more details.
110
110
111 Per-user configuration file(s) are for the user running Mercurial. Options
111 Per-user configuration file(s) are for the user running Mercurial. Options
112 in these files apply to all Mercurial commands executed by this user in any
112 in these files apply to all Mercurial commands executed by this user in any
113 directory. Options in these files override per-system and per-installation
113 directory. Options in these files override per-system and per-installation
114 options.
114 options.
115
115
116 Per-installation configuration files are searched for in the
116 Per-installation configuration files are searched for in the
117 directory where Mercurial is installed. ``<install-root>`` is the
117 directory where Mercurial is installed. ``<install-root>`` is the
118 parent directory of the **hg** executable (or symlink) being run.
118 parent directory of the **hg** executable (or symlink) being run.
119
119
120 .. container:: unix.plan9
120 .. container:: unix.plan9
121
121
122 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
122 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
123 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 files apply to all Mercurial commands executed by any user in any
124 files apply to all Mercurial commands executed by any user in any
125 directory.
125 directory.
126
126
127 Per-installation configuration files are for the system on
127 Per-installation configuration files are for the system on
128 which Mercurial is running. Options in these files apply to all
128 which Mercurial is running. Options in these files apply to all
129 Mercurial commands executed by any user in any directory. Registry
129 Mercurial commands executed by any user in any directory. Registry
130 keys contain PATH-like strings, every part of which must reference
130 keys contain PATH-like strings, every part of which must reference
131 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
131 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 be read. Mercurial checks each of these locations in the specified
132 be read. Mercurial checks each of these locations in the specified
133 order until one or more configuration files are detected.
133 order until one or more configuration files are detected.
134
134
135 Per-system configuration files are for the system on which Mercurial
135 Per-system configuration files are for the system on which Mercurial
136 is running. Options in these files apply to all Mercurial commands
136 is running. Options in these files apply to all Mercurial commands
137 executed by any user in any directory. Options in these files
137 executed by any user in any directory. Options in these files
138 override per-installation options.
138 override per-installation options.
139
139
140 Mercurial comes with some default configuration. The default configuration
140 Mercurial comes with some default configuration. The default configuration
141 files are installed with Mercurial and will be overwritten on upgrades. Default
141 files are installed with Mercurial and will be overwritten on upgrades. Default
142 configuration files should never be edited by users or administrators but can
142 configuration files should never be edited by users or administrators but can
143 be overridden in other configuration files. So far the directory only contains
143 be overridden in other configuration files. So far the directory only contains
144 merge tool configuration but packagers can also put other default configuration
144 merge tool configuration but packagers can also put other default configuration
145 there.
145 there.
146
146
147 Syntax
147 Syntax
148 ======
148 ======
149
149
150 A configuration file consists of sections, led by a ``[section]`` header
150 A configuration file consists of sections, led by a ``[section]`` header
151 and followed by ``name = value`` entries (sometimes called
151 and followed by ``name = value`` entries (sometimes called
152 ``configuration keys``)::
152 ``configuration keys``)::
153
153
154 [spam]
154 [spam]
155 eggs=ham
155 eggs=ham
156 green=
156 green=
157 eggs
157 eggs
158
158
159 Each line contains one entry. If the lines that follow are indented,
159 Each line contains one entry. If the lines that follow are indented,
160 they are treated as continuations of that entry. Leading whitespace is
160 they are treated as continuations of that entry. Leading whitespace is
161 removed from values. Empty lines are skipped. Lines beginning with
161 removed from values. Empty lines are skipped. Lines beginning with
162 ``#`` or ``;`` are ignored and may be used to provide comments.
162 ``#`` or ``;`` are ignored and may be used to provide comments.
163
163
164 Configuration keys can be set multiple times, in which case Mercurial
164 Configuration keys can be set multiple times, in which case Mercurial
165 will use the value that was configured last. As an example::
165 will use the value that was configured last. As an example::
166
166
167 [spam]
167 [spam]
168 eggs=large
168 eggs=large
169 ham=serrano
169 ham=serrano
170 eggs=small
170 eggs=small
171
171
172 This would set the configuration key named ``eggs`` to ``small``.
172 This would set the configuration key named ``eggs`` to ``small``.
173
173
174 It is also possible to define a section multiple times. A section can
174 It is also possible to define a section multiple times. A section can
175 be redefined on the same and/or on different configuration files. For
175 be redefined on the same and/or on different configuration files. For
176 example::
176 example::
177
177
178 [foo]
178 [foo]
179 eggs=large
179 eggs=large
180 ham=serrano
180 ham=serrano
181 eggs=small
181 eggs=small
182
182
183 [bar]
183 [bar]
184 eggs=ham
184 eggs=ham
185 green=
185 green=
186 eggs
186 eggs
187
187
188 [foo]
188 [foo]
189 ham=prosciutto
189 ham=prosciutto
190 eggs=medium
190 eggs=medium
191 bread=toasted
191 bread=toasted
192
192
193 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
193 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
194 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 respectively. As you can see there only thing that matters is the last
195 respectively. As you can see there only thing that matters is the last
196 value that was set for each of the configuration keys.
196 value that was set for each of the configuration keys.
197
197
198 If a configuration key is set multiple times in different
198 If a configuration key is set multiple times in different
199 configuration files the final value will depend on the order in which
199 configuration files the final value will depend on the order in which
200 the different configuration files are read, with settings from earlier
200 the different configuration files are read, with settings from earlier
201 paths overriding later ones as described on the ``Files`` section
201 paths overriding later ones as described on the ``Files`` section
202 above.
202 above.
203
203
204 A line of the form ``%include file`` will include ``file`` into the
204 A line of the form ``%include file`` will include ``file`` into the
205 current configuration file. The inclusion is recursive, which means
205 current configuration file. The inclusion is recursive, which means
206 that included files can include other files. Filenames are relative to
206 that included files can include other files. Filenames are relative to
207 the configuration file in which the ``%include`` directive is found.
207 the configuration file in which the ``%include`` directive is found.
208 Environment variables and ``~user`` constructs are expanded in
208 Environment variables and ``~user`` constructs are expanded in
209 ``file``. This lets you do something like::
209 ``file``. This lets you do something like::
210
210
211 %include ~/.hgrc.d/$HOST.rc
211 %include ~/.hgrc.d/$HOST.rc
212
212
213 to include a different configuration file on each computer you use.
213 to include a different configuration file on each computer you use.
214
214
215 A line with ``%unset name`` will remove ``name`` from the current
215 A line with ``%unset name`` will remove ``name`` from the current
216 section, if it has been set previously.
216 section, if it has been set previously.
217
217
218 The values are either free-form text strings, lists of text strings,
218 The values are either free-form text strings, lists of text strings,
219 or Boolean values. Boolean values can be set to true using any of "1",
219 or Boolean values. Boolean values can be set to true using any of "1",
220 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
220 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 (all case insensitive).
221 (all case insensitive).
222
222
223 List values are separated by whitespace or comma, except when values are
223 List values are separated by whitespace or comma, except when values are
224 placed in double quotation marks::
224 placed in double quotation marks::
225
225
226 allow_read = "John Doe, PhD", brian, betty
226 allow_read = "John Doe, PhD", brian, betty
227
227
228 Quotation marks can be escaped by prefixing them with a backslash. Only
228 Quotation marks can be escaped by prefixing them with a backslash. Only
229 quotation marks at the beginning of a word is counted as a quotation
229 quotation marks at the beginning of a word is counted as a quotation
230 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
230 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231
231
232 Sections
232 Sections
233 ========
233 ========
234
234
235 This section describes the different sections that may appear in a
235 This section describes the different sections that may appear in a
236 Mercurial configuration file, the purpose of each section, its possible
236 Mercurial configuration file, the purpose of each section, its possible
237 keys, and their possible values.
237 keys, and their possible values.
238
238
239 ``alias``
239 ``alias``
240 ---------
240 ---------
241
241
242 Defines command aliases.
242 Defines command aliases.
243
243
244 Aliases allow you to define your own commands in terms of other
244 Aliases allow you to define your own commands in terms of other
245 commands (or aliases), optionally including arguments. Positional
245 commands (or aliases), optionally including arguments. Positional
246 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
246 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 are expanded by Mercurial before execution. Positional arguments not
247 are expanded by Mercurial before execution. Positional arguments not
248 already used by ``$N`` in the definition are put at the end of the
248 already used by ``$N`` in the definition are put at the end of the
249 command to be executed.
249 command to be executed.
250
250
251 Alias definitions consist of lines of the form::
251 Alias definitions consist of lines of the form::
252
252
253 <alias> = <command> [<argument>]...
253 <alias> = <command> [<argument>]...
254
254
255 For example, this definition::
255 For example, this definition::
256
256
257 latest = log --limit 5
257 latest = log --limit 5
258
258
259 creates a new command ``latest`` that shows only the five most recent
259 creates a new command ``latest`` that shows only the five most recent
260 changesets. You can define subsequent aliases using earlier ones::
260 changesets. You can define subsequent aliases using earlier ones::
261
261
262 stable5 = latest -b stable
262 stable5 = latest -b stable
263
263
264 .. note::
264 .. note::
265
265
266 It is possible to create aliases with the same names as
266 It is possible to create aliases with the same names as
267 existing commands, which will then override the original
267 existing commands, which will then override the original
268 definitions. This is almost always a bad idea!
268 definitions. This is almost always a bad idea!
269
269
270 An alias can start with an exclamation point (``!``) to make it a
270 An alias can start with an exclamation point (``!``) to make it a
271 shell alias. A shell alias is executed with the shell and will let you
271 shell alias. A shell alias is executed with the shell and will let you
272 run arbitrary commands. As an example, ::
272 run arbitrary commands. As an example, ::
273
273
274 echo = !echo $@
274 echo = !echo $@
275
275
276 will let you do ``hg echo foo`` to have ``foo`` printed in your
276 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 terminal. A better example might be::
277 terminal. A better example might be::
278
278
279 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm
279 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm
280
280
281 which will make ``hg purge`` delete all unknown files in the
281 which will make ``hg purge`` delete all unknown files in the
282 repository in the same manner as the purge extension.
282 repository in the same manner as the purge extension.
283
283
284 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
284 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 expand to the command arguments. Unmatched arguments are
285 expand to the command arguments. Unmatched arguments are
286 removed. ``$0`` expands to the alias name and ``$@`` expands to all
286 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 arguments separated by a space. ``"$@"`` (with quotes) expands to all
287 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments quoted individually and separated by a space. These expansions
288 arguments quoted individually and separated by a space. These expansions
289 happen before the command is passed to the shell.
289 happen before the command is passed to the shell.
290
290
291 Shell aliases are executed in an environment where ``$HG`` expands to
291 Shell aliases are executed in an environment where ``$HG`` expands to
292 the path of the Mercurial that was used to execute the alias. This is
292 the path of the Mercurial that was used to execute the alias. This is
293 useful when you want to call further Mercurial commands in a shell
293 useful when you want to call further Mercurial commands in a shell
294 alias, as was done above for the purge alias. In addition,
294 alias, as was done above for the purge alias. In addition,
295 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
295 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
296 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297
297
298 .. note::
298 .. note::
299
299
300 Some global configuration options such as ``-R`` are
300 Some global configuration options such as ``-R`` are
301 processed before shell aliases and will thus not be passed to
301 processed before shell aliases and will thus not be passed to
302 aliases.
302 aliases.
303
303
304
304
305 ``annotate``
305 ``annotate``
306 ------------
306 ------------
307
307
308 Settings used when displaying file annotations. All values are
308 Settings used when displaying file annotations. All values are
309 Booleans and default to False. See :hg:`help config.diff` for
309 Booleans and default to False. See :hg:`help config.diff` for
310 related options for the diff command.
310 related options for the diff command.
311
311
312 ``ignorews``
312 ``ignorews``
313 Ignore white space when comparing lines.
313 Ignore white space when comparing lines.
314
314
315 ``ignorewsamount``
315 ``ignorewsamount``
316 Ignore changes in the amount of white space.
316 Ignore changes in the amount of white space.
317
317
318 ``ignoreblanklines``
318 ``ignoreblanklines``
319 Ignore changes whose lines are all blank.
319 Ignore changes whose lines are all blank.
320
320
321
321
322 ``auth``
322 ``auth``
323 --------
323 --------
324
324
325 Authentication credentials for HTTP authentication. This section
325 Authentication credentials for HTTP authentication. This section
326 allows you to store usernames and passwords for use when logging
326 allows you to store usernames and passwords for use when logging
327 *into* HTTP servers. See :hg:`help config.web` if
327 *into* HTTP servers. See :hg:`help config.web` if
328 you want to configure *who* can login to your HTTP server.
328 you want to configure *who* can login to your HTTP server.
329
329
330 Each line has the following format::
330 Each line has the following format::
331
331
332 <name>.<argument> = <value>
332 <name>.<argument> = <value>
333
333
334 where ``<name>`` is used to group arguments into authentication
334 where ``<name>`` is used to group arguments into authentication
335 entries. Example::
335 entries. Example::
336
336
337 foo.prefix = hg.intevation.de/mercurial
337 foo.prefix = hg.intevation.de/mercurial
338 foo.username = foo
338 foo.username = foo
339 foo.password = bar
339 foo.password = bar
340 foo.schemes = http https
340 foo.schemes = http https
341
341
342 bar.prefix = secure.example.org
342 bar.prefix = secure.example.org
343 bar.key = path/to/file.key
343 bar.key = path/to/file.key
344 bar.cert = path/to/file.cert
344 bar.cert = path/to/file.cert
345 bar.schemes = https
345 bar.schemes = https
346
346
347 Supported arguments:
347 Supported arguments:
348
348
349 ``prefix``
349 ``prefix``
350 Either ``*`` or a URI prefix with or without the scheme part.
350 Either ``*`` or a URI prefix with or without the scheme part.
351 The authentication entry with the longest matching prefix is used
351 The authentication entry with the longest matching prefix is used
352 (where ``*`` matches everything and counts as a match of length
352 (where ``*`` matches everything and counts as a match of length
353 1). If the prefix doesn't include a scheme, the match is performed
353 1). If the prefix doesn't include a scheme, the match is performed
354 against the URI with its scheme stripped as well, and the schemes
354 against the URI with its scheme stripped as well, and the schemes
355 argument, q.v., is then subsequently consulted.
355 argument, q.v., is then subsequently consulted.
356
356
357 ``username``
357 ``username``
358 Optional. Username to authenticate with. If not given, and the
358 Optional. Username to authenticate with. If not given, and the
359 remote site requires basic or digest authentication, the user will
359 remote site requires basic or digest authentication, the user will
360 be prompted for it. Environment variables are expanded in the
360 be prompted for it. Environment variables are expanded in the
361 username letting you do ``foo.username = $USER``. If the URI
361 username letting you do ``foo.username = $USER``. If the URI
362 includes a username, only ``[auth]`` entries with a matching
362 includes a username, only ``[auth]`` entries with a matching
363 username or without a username will be considered.
363 username or without a username will be considered.
364
364
365 ``password``
365 ``password``
366 Optional. Password to authenticate with. If not given, and the
366 Optional. Password to authenticate with. If not given, and the
367 remote site requires basic or digest authentication, the user
367 remote site requires basic or digest authentication, the user
368 will be prompted for it.
368 will be prompted for it.
369
369
370 ``key``
370 ``key``
371 Optional. PEM encoded client certificate key file. Environment
371 Optional. PEM encoded client certificate key file. Environment
372 variables are expanded in the filename.
372 variables are expanded in the filename.
373
373
374 ``cert``
374 ``cert``
375 Optional. PEM encoded client certificate chain file. Environment
375 Optional. PEM encoded client certificate chain file. Environment
376 variables are expanded in the filename.
376 variables are expanded in the filename.
377
377
378 ``schemes``
378 ``schemes``
379 Optional. Space separated list of URI schemes to use this
379 Optional. Space separated list of URI schemes to use this
380 authentication entry with. Only used if the prefix doesn't include
380 authentication entry with. Only used if the prefix doesn't include
381 a scheme. Supported schemes are http and https. They will match
381 a scheme. Supported schemes are http and https. They will match
382 static-http and static-https respectively, as well.
382 static-http and static-https respectively, as well.
383 (default: https)
383 (default: https)
384
384
385 If no suitable authentication entry is found, the user is prompted
385 If no suitable authentication entry is found, the user is prompted
386 for credentials as usual if required by the remote.
386 for credentials as usual if required by the remote.
387
387
388
388
389 ``committemplate``
389 ``committemplate``
390 ------------------
390 ------------------
391
391
392 ``changeset``
392 ``changeset``
393 String: configuration in this section is used as the template to
393 String: configuration in this section is used as the template to
394 customize the text shown in the editor when committing.
394 customize the text shown in the editor when committing.
395
395
396 In addition to pre-defined template keywords, commit log specific one
396 In addition to pre-defined template keywords, commit log specific one
397 below can be used for customization:
397 below can be used for customization:
398
398
399 ``extramsg``
399 ``extramsg``
400 String: Extra message (typically 'Leave message empty to abort
400 String: Extra message (typically 'Leave message empty to abort
401 commit.'). This may be changed by some commands or extensions.
401 commit.'). This may be changed by some commands or extensions.
402
402
403 For example, the template configuration below shows as same text as
403 For example, the template configuration below shows as same text as
404 one shown by default::
404 one shown by default::
405
405
406 [committemplate]
406 [committemplate]
407 changeset = {desc}\n\n
407 changeset = {desc}\n\n
408 HG: Enter commit message. Lines beginning with 'HG:' are removed.
408 HG: Enter commit message. Lines beginning with 'HG:' are removed.
409 HG: {extramsg}
409 HG: {extramsg}
410 HG: --
410 HG: --
411 HG: user: {author}\n{ifeq(p2rev, "-1", "",
411 HG: user: {author}\n{ifeq(p2rev, "-1", "",
412 "HG: branch merge\n")
412 "HG: branch merge\n")
413 }HG: branch '{branch}'\n{if(activebookmark,
413 }HG: branch '{branch}'\n{if(activebookmark,
414 "HG: bookmark '{activebookmark}'\n") }{subrepos %
414 "HG: bookmark '{activebookmark}'\n") }{subrepos %
415 "HG: subrepo {subrepo}\n" }{file_adds %
415 "HG: subrepo {subrepo}\n" }{file_adds %
416 "HG: added {file}\n" }{file_mods %
416 "HG: added {file}\n" }{file_mods %
417 "HG: changed {file}\n" }{file_dels %
417 "HG: changed {file}\n" }{file_dels %
418 "HG: removed {file}\n" }{if(files, "",
418 "HG: removed {file}\n" }{if(files, "",
419 "HG: no files changed\n")}
419 "HG: no files changed\n")}
420
420
421 .. note::
421 .. note::
422
422
423 For some problematic encodings (see :hg:`help win32mbcs` for
423 For some problematic encodings (see :hg:`help win32mbcs` for
424 detail), this customization should be configured carefully, to
424 detail), this customization should be configured carefully, to
425 avoid showing broken characters.
425 avoid showing broken characters.
426
426
427 For example, if a multibyte character ending with backslash (0x5c) is
427 For example, if a multibyte character ending with backslash (0x5c) is
428 followed by the ASCII character 'n' in the customized template,
428 followed by the ASCII character 'n' in the customized template,
429 the sequence of backslash and 'n' is treated as line-feed unexpectedly
429 the sequence of backslash and 'n' is treated as line-feed unexpectedly
430 (and the multibyte character is broken, too).
430 (and the multibyte character is broken, too).
431
431
432 Customized template is used for commands below (``--edit`` may be
432 Customized template is used for commands below (``--edit`` may be
433 required):
433 required):
434
434
435 - :hg:`backout`
435 - :hg:`backout`
436 - :hg:`commit`
436 - :hg:`commit`
437 - :hg:`fetch` (for merge commit only)
437 - :hg:`fetch` (for merge commit only)
438 - :hg:`graft`
438 - :hg:`graft`
439 - :hg:`histedit`
439 - :hg:`histedit`
440 - :hg:`import`
440 - :hg:`import`
441 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
441 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
442 - :hg:`rebase`
442 - :hg:`rebase`
443 - :hg:`shelve`
443 - :hg:`shelve`
444 - :hg:`sign`
444 - :hg:`sign`
445 - :hg:`tag`
445 - :hg:`tag`
446 - :hg:`transplant`
446 - :hg:`transplant`
447
447
448 Configuring items below instead of ``changeset`` allows showing
448 Configuring items below instead of ``changeset`` allows showing
449 customized message only for specific actions, or showing different
449 customized message only for specific actions, or showing different
450 messages for each action.
450 messages for each action.
451
451
452 - ``changeset.backout`` for :hg:`backout`
452 - ``changeset.backout`` for :hg:`backout`
453 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
453 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
454 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
454 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
455 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
455 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
456 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
456 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
457 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
457 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
458 - ``changeset.gpg.sign`` for :hg:`sign`
458 - ``changeset.gpg.sign`` for :hg:`sign`
459 - ``changeset.graft`` for :hg:`graft`
459 - ``changeset.graft`` for :hg:`graft`
460 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
460 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
461 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
461 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
462 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
462 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
463 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
463 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
464 - ``changeset.import.bypass`` for :hg:`import --bypass`
464 - ``changeset.import.bypass`` for :hg:`import --bypass`
465 - ``changeset.import.normal.merge`` for :hg:`import` on merges
465 - ``changeset.import.normal.merge`` for :hg:`import` on merges
466 - ``changeset.import.normal.normal`` for :hg:`import` on other
466 - ``changeset.import.normal.normal`` for :hg:`import` on other
467 - ``changeset.mq.qnew`` for :hg:`qnew`
467 - ``changeset.mq.qnew`` for :hg:`qnew`
468 - ``changeset.mq.qfold`` for :hg:`qfold`
468 - ``changeset.mq.qfold`` for :hg:`qfold`
469 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
469 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
470 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
470 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
471 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
471 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
472 - ``changeset.rebase.normal`` for :hg:`rebase` on other
472 - ``changeset.rebase.normal`` for :hg:`rebase` on other
473 - ``changeset.shelve.shelve`` for :hg:`shelve`
473 - ``changeset.shelve.shelve`` for :hg:`shelve`
474 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
474 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
475 - ``changeset.tag.remove`` for :hg:`tag --remove`
475 - ``changeset.tag.remove`` for :hg:`tag --remove`
476 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
476 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
477 - ``changeset.transplant.normal`` for :hg:`transplant` on other
477 - ``changeset.transplant.normal`` for :hg:`transplant` on other
478
478
479 These dot-separated lists of names are treated as hierarchical ones.
479 These dot-separated lists of names are treated as hierarchical ones.
480 For example, ``changeset.tag.remove`` customizes the commit message
480 For example, ``changeset.tag.remove`` customizes the commit message
481 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
481 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
482 commit message for :hg:`tag` regardless of ``--remove`` option.
482 commit message for :hg:`tag` regardless of ``--remove`` option.
483
483
484 When the external editor is invoked for a commit, the corresponding
484 When the external editor is invoked for a commit, the corresponding
485 dot-separated list of names without the ``changeset.`` prefix
485 dot-separated list of names without the ``changeset.`` prefix
486 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
486 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
487 variable.
487 variable.
488
488
489 In this section, items other than ``changeset`` can be referred from
489 In this section, items other than ``changeset`` can be referred from
490 others. For example, the configuration to list committed files up
490 others. For example, the configuration to list committed files up
491 below can be referred as ``{listupfiles}``::
491 below can be referred as ``{listupfiles}``::
492
492
493 [committemplate]
493 [committemplate]
494 listupfiles = {file_adds %
494 listupfiles = {file_adds %
495 "HG: added {file}\n" }{file_mods %
495 "HG: added {file}\n" }{file_mods %
496 "HG: changed {file}\n" }{file_dels %
496 "HG: changed {file}\n" }{file_dels %
497 "HG: removed {file}\n" }{if(files, "",
497 "HG: removed {file}\n" }{if(files, "",
498 "HG: no files changed\n")}
498 "HG: no files changed\n")}
499
499
500 ``decode/encode``
500 ``decode/encode``
501 -----------------
501 -----------------
502
502
503 Filters for transforming files on checkout/checkin. This would
503 Filters for transforming files on checkout/checkin. This would
504 typically be used for newline processing or other
504 typically be used for newline processing or other
505 localization/canonicalization of files.
505 localization/canonicalization of files.
506
506
507 Filters consist of a filter pattern followed by a filter command.
507 Filters consist of a filter pattern followed by a filter command.
508 Filter patterns are globs by default, rooted at the repository root.
508 Filter patterns are globs by default, rooted at the repository root.
509 For example, to match any file ending in ``.txt`` in the root
509 For example, to match any file ending in ``.txt`` in the root
510 directory only, use the pattern ``*.txt``. To match any file ending
510 directory only, use the pattern ``*.txt``. To match any file ending
511 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
511 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
512 For each file only the first matching filter applies.
512 For each file only the first matching filter applies.
513
513
514 The filter command can start with a specifier, either ``pipe:`` or
514 The filter command can start with a specifier, either ``pipe:`` or
515 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
515 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
516
516
517 A ``pipe:`` command must accept data on stdin and return the transformed
517 A ``pipe:`` command must accept data on stdin and return the transformed
518 data on stdout.
518 data on stdout.
519
519
520 Pipe example::
520 Pipe example::
521
521
522 [encode]
522 [encode]
523 # uncompress gzip files on checkin to improve delta compression
523 # uncompress gzip files on checkin to improve delta compression
524 # note: not necessarily a good idea, just an example
524 # note: not necessarily a good idea, just an example
525 *.gz = pipe: gunzip
525 *.gz = pipe: gunzip
526
526
527 [decode]
527 [decode]
528 # recompress gzip files when writing them to the working dir (we
528 # recompress gzip files when writing them to the working dir (we
529 # can safely omit "pipe:", because it's the default)
529 # can safely omit "pipe:", because it's the default)
530 *.gz = gzip
530 *.gz = gzip
531
531
532 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
532 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
533 with the name of a temporary file that contains the data to be
533 with the name of a temporary file that contains the data to be
534 filtered by the command. The string ``OUTFILE`` is replaced with the name
534 filtered by the command. The string ``OUTFILE`` is replaced with the name
535 of an empty temporary file, where the filtered data must be written by
535 of an empty temporary file, where the filtered data must be written by
536 the command.
536 the command.
537
537
538 .. container:: windows
538 .. container:: windows
539
539
540 .. note::
540 .. note::
541
541
542 The tempfile mechanism is recommended for Windows systems,
542 The tempfile mechanism is recommended for Windows systems,
543 where the standard shell I/O redirection operators often have
543 where the standard shell I/O redirection operators often have
544 strange effects and may corrupt the contents of your files.
544 strange effects and may corrupt the contents of your files.
545
545
546 This filter mechanism is used internally by the ``eol`` extension to
546 This filter mechanism is used internally by the ``eol`` extension to
547 translate line ending characters between Windows (CRLF) and Unix (LF)
547 translate line ending characters between Windows (CRLF) and Unix (LF)
548 format. We suggest you use the ``eol`` extension for convenience.
548 format. We suggest you use the ``eol`` extension for convenience.
549
549
550
550
551 ``defaults``
551 ``defaults``
552 ------------
552 ------------
553
553
554 (defaults are deprecated. Don't use them. Use aliases instead.)
554 (defaults are deprecated. Don't use them. Use aliases instead.)
555
555
556 Use the ``[defaults]`` section to define command defaults, i.e. the
556 Use the ``[defaults]`` section to define command defaults, i.e. the
557 default options/arguments to pass to the specified commands.
557 default options/arguments to pass to the specified commands.
558
558
559 The following example makes :hg:`log` run in verbose mode, and
559 The following example makes :hg:`log` run in verbose mode, and
560 :hg:`status` show only the modified files, by default::
560 :hg:`status` show only the modified files, by default::
561
561
562 [defaults]
562 [defaults]
563 log = -v
563 log = -v
564 status = -m
564 status = -m
565
565
566 The actual commands, instead of their aliases, must be used when
566 The actual commands, instead of their aliases, must be used when
567 defining command defaults. The command defaults will also be applied
567 defining command defaults. The command defaults will also be applied
568 to the aliases of the commands defined.
568 to the aliases of the commands defined.
569
569
570
570
571 ``diff``
571 ``diff``
572 --------
572 --------
573
573
574 Settings used when displaying diffs. Everything except for ``unified``
574 Settings used when displaying diffs. Everything except for ``unified``
575 is a Boolean and defaults to False. See :hg:`help config.annotate`
575 is a Boolean and defaults to False. See :hg:`help config.annotate`
576 for related options for the annotate command.
576 for related options for the annotate command.
577
577
578 ``git``
578 ``git``
579 Use git extended diff format.
579 Use git extended diff format.
580
580
581 ``nobinary``
581 ``nobinary``
582 Omit git binary patches.
582 Omit git binary patches.
583
583
584 ``nodates``
584 ``nodates``
585 Don't include dates in diff headers.
585 Don't include dates in diff headers.
586
586
587 ``noprefix``
587 ``noprefix``
588 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
588 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
589
589
590 ``showfunc``
590 ``showfunc``
591 Show which function each change is in.
591 Show which function each change is in.
592
592
593 ``ignorews``
593 ``ignorews``
594 Ignore white space when comparing lines.
594 Ignore white space when comparing lines.
595
595
596 ``ignorewsamount``
596 ``ignorewsamount``
597 Ignore changes in the amount of white space.
597 Ignore changes in the amount of white space.
598
598
599 ``ignoreblanklines``
599 ``ignoreblanklines``
600 Ignore changes whose lines are all blank.
600 Ignore changes whose lines are all blank.
601
601
602 ``unified``
602 ``unified``
603 Number of lines of context to show.
603 Number of lines of context to show.
604
604
605 ``email``
605 ``email``
606 ---------
606 ---------
607
607
608 Settings for extensions that send email messages.
608 Settings for extensions that send email messages.
609
609
610 ``from``
610 ``from``
611 Optional. Email address to use in "From" header and SMTP envelope
611 Optional. Email address to use in "From" header and SMTP envelope
612 of outgoing messages.
612 of outgoing messages.
613
613
614 ``to``
614 ``to``
615 Optional. Comma-separated list of recipients' email addresses.
615 Optional. Comma-separated list of recipients' email addresses.
616
616
617 ``cc``
617 ``cc``
618 Optional. Comma-separated list of carbon copy recipients'
618 Optional. Comma-separated list of carbon copy recipients'
619 email addresses.
619 email addresses.
620
620
621 ``bcc``
621 ``bcc``
622 Optional. Comma-separated list of blind carbon copy recipients'
622 Optional. Comma-separated list of blind carbon copy recipients'
623 email addresses.
623 email addresses.
624
624
625 ``method``
625 ``method``
626 Optional. Method to use to send email messages. If value is ``smtp``
626 Optional. Method to use to send email messages. If value is ``smtp``
627 (default), use SMTP (see the ``[smtp]`` section for configuration).
627 (default), use SMTP (see the ``[smtp]`` section for configuration).
628 Otherwise, use as name of program to run that acts like sendmail
628 Otherwise, use as name of program to run that acts like sendmail
629 (takes ``-f`` option for sender, list of recipients on command line,
629 (takes ``-f`` option for sender, list of recipients on command line,
630 message on stdin). Normally, setting this to ``sendmail`` or
630 message on stdin). Normally, setting this to ``sendmail`` or
631 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
631 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
632
632
633 ``charsets``
633 ``charsets``
634 Optional. Comma-separated list of character sets considered
634 Optional. Comma-separated list of character sets considered
635 convenient for recipients. Addresses, headers, and parts not
635 convenient for recipients. Addresses, headers, and parts not
636 containing patches of outgoing messages will be encoded in the
636 containing patches of outgoing messages will be encoded in the
637 first character set to which conversion from local encoding
637 first character set to which conversion from local encoding
638 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
638 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
639 conversion fails, the text in question is sent as is.
639 conversion fails, the text in question is sent as is.
640 (default: '')
640 (default: '')
641
641
642 Order of outgoing email character sets:
642 Order of outgoing email character sets:
643
643
644 1. ``us-ascii``: always first, regardless of settings
644 1. ``us-ascii``: always first, regardless of settings
645 2. ``email.charsets``: in order given by user
645 2. ``email.charsets``: in order given by user
646 3. ``ui.fallbackencoding``: if not in email.charsets
646 3. ``ui.fallbackencoding``: if not in email.charsets
647 4. ``$HGENCODING``: if not in email.charsets
647 4. ``$HGENCODING``: if not in email.charsets
648 5. ``utf-8``: always last, regardless of settings
648 5. ``utf-8``: always last, regardless of settings
649
649
650 Email example::
650 Email example::
651
651
652 [email]
652 [email]
653 from = Joseph User <joe.user@example.com>
653 from = Joseph User <joe.user@example.com>
654 method = /usr/sbin/sendmail
654 method = /usr/sbin/sendmail
655 # charsets for western Europeans
655 # charsets for western Europeans
656 # us-ascii, utf-8 omitted, as they are tried first and last
656 # us-ascii, utf-8 omitted, as they are tried first and last
657 charsets = iso-8859-1, iso-8859-15, windows-1252
657 charsets = iso-8859-1, iso-8859-15, windows-1252
658
658
659
659
660 ``extensions``
660 ``extensions``
661 --------------
661 --------------
662
662
663 Mercurial has an extension mechanism for adding new features. To
663 Mercurial has an extension mechanism for adding new features. To
664 enable an extension, create an entry for it in this section.
664 enable an extension, create an entry for it in this section.
665
665
666 If you know that the extension is already in Python's search path,
666 If you know that the extension is already in Python's search path,
667 you can give the name of the module, followed by ``=``, with nothing
667 you can give the name of the module, followed by ``=``, with nothing
668 after the ``=``.
668 after the ``=``.
669
669
670 Otherwise, give a name that you choose, followed by ``=``, followed by
670 Otherwise, give a name that you choose, followed by ``=``, followed by
671 the path to the ``.py`` file (including the file name extension) that
671 the path to the ``.py`` file (including the file name extension) that
672 defines the extension.
672 defines the extension.
673
673
674 To explicitly disable an extension that is enabled in an hgrc of
674 To explicitly disable an extension that is enabled in an hgrc of
675 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
675 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
676 or ``foo = !`` when path is not supplied.
676 or ``foo = !`` when path is not supplied.
677
677
678 Example for ``~/.hgrc``::
678 Example for ``~/.hgrc``::
679
679
680 [extensions]
680 [extensions]
681 # (the color extension will get loaded from Mercurial's path)
681 # (the color extension will get loaded from Mercurial's path)
682 color =
682 color =
683 # (this extension will get loaded from the file specified)
683 # (this extension will get loaded from the file specified)
684 myfeature = ~/.hgext/myfeature.py
684 myfeature = ~/.hgext/myfeature.py
685
685
686
686
687 ``format``
687 ``format``
688 ----------
688 ----------
689
689
690 ``usegeneraldelta``
690 ``usegeneraldelta``
691 Enable or disable the "generaldelta" repository format which improves
691 Enable or disable the "generaldelta" repository format which improves
692 repository compression by allowing "revlog" to store delta against arbitrary
692 repository compression by allowing "revlog" to store delta against arbitrary
693 revision instead of the previous stored one. This provides significant
693 revision instead of the previous stored one. This provides significant
694 improvement for repositories with branches.
694 improvement for repositories with branches.
695
695
696 Repositories with this on-disk format require Mercurial version 1.9.
696 Repositories with this on-disk format require Mercurial version 1.9.
697
697
698 Enabled by default.
698 Enabled by default.
699
699
700 ``dotencode``
700 ``dotencode``
701 Enable or disable the "dotencode" repository format which enhances
701 Enable or disable the "dotencode" repository format which enhances
702 the "fncache" repository format (which has to be enabled to use
702 the "fncache" repository format (which has to be enabled to use
703 dotencode) to avoid issues with filenames starting with ._ on
703 dotencode) to avoid issues with filenames starting with ._ on
704 Mac OS X and spaces on Windows.
704 Mac OS X and spaces on Windows.
705
705
706 Repositories with this on-disk format require Mercurial version 1.7.
706 Repositories with this on-disk format require Mercurial version 1.7.
707
707
708 Enabled by default.
708 Enabled by default.
709
709
710 ``usefncache``
710 ``usefncache``
711 Enable or disable the "fncache" repository format which enhances
711 Enable or disable the "fncache" repository format which enhances
712 the "store" repository format (which has to be enabled to use
712 the "store" repository format (which has to be enabled to use
713 fncache) to allow longer filenames and avoids using Windows
713 fncache) to allow longer filenames and avoids using Windows
714 reserved names, e.g. "nul".
714 reserved names, e.g. "nul".
715
715
716 Repositories with this on-disk format require Mercurial version 1.1.
716 Repositories with this on-disk format require Mercurial version 1.1.
717
717
718 Enabled by default.
718 Enabled by default.
719
719
720 ``usestore``
720 ``usestore``
721 Enable or disable the "store" repository format which improves
721 Enable or disable the "store" repository format which improves
722 compatibility with systems that fold case or otherwise mangle
722 compatibility with systems that fold case or otherwise mangle
723 filenames. Disabling this option will allow you to store longer filenames
723 filenames. Disabling this option will allow you to store longer filenames
724 in some situations at the expense of compatibility.
724 in some situations at the expense of compatibility.
725
725
726 Repositories with this on-disk format require Mercurial version 0.9.4.
726 Repositories with this on-disk format require Mercurial version 0.9.4.
727
727
728 Enabled by default.
728 Enabled by default.
729
729
730 ``graph``
730 ``graph``
731 ---------
731 ---------
732
732
733 Web graph view configuration. This section let you change graph
733 Web graph view configuration. This section let you change graph
734 elements display properties by branches, for instance to make the
734 elements display properties by branches, for instance to make the
735 ``default`` branch stand out.
735 ``default`` branch stand out.
736
736
737 Each line has the following format::
737 Each line has the following format::
738
738
739 <branch>.<argument> = <value>
739 <branch>.<argument> = <value>
740
740
741 where ``<branch>`` is the name of the branch being
741 where ``<branch>`` is the name of the branch being
742 customized. Example::
742 customized. Example::
743
743
744 [graph]
744 [graph]
745 # 2px width
745 # 2px width
746 default.width = 2
746 default.width = 2
747 # red color
747 # red color
748 default.color = FF0000
748 default.color = FF0000
749
749
750 Supported arguments:
750 Supported arguments:
751
751
752 ``width``
752 ``width``
753 Set branch edges width in pixels.
753 Set branch edges width in pixels.
754
754
755 ``color``
755 ``color``
756 Set branch edges color in hexadecimal RGB notation.
756 Set branch edges color in hexadecimal RGB notation.
757
757
758 ``hooks``
758 ``hooks``
759 ---------
759 ---------
760
760
761 Commands or Python functions that get automatically executed by
761 Commands or Python functions that get automatically executed by
762 various actions such as starting or finishing a commit. Multiple
762 various actions such as starting or finishing a commit. Multiple
763 hooks can be run for the same action by appending a suffix to the
763 hooks can be run for the same action by appending a suffix to the
764 action. Overriding a site-wide hook can be done by changing its
764 action. Overriding a site-wide hook can be done by changing its
765 value or setting it to an empty string. Hooks can be prioritized
765 value or setting it to an empty string. Hooks can be prioritized
766 by adding a prefix of ``priority.`` to the hook name on a new line
766 by adding a prefix of ``priority.`` to the hook name on a new line
767 and setting the priority. The default priority is 0.
767 and setting the priority. The default priority is 0.
768
768
769 Example ``.hg/hgrc``::
769 Example ``.hg/hgrc``::
770
770
771 [hooks]
771 [hooks]
772 # update working directory after adding changesets
772 # update working directory after adding changesets
773 changegroup.update = hg update
773 changegroup.update = hg update
774 # do not use the site-wide hook
774 # do not use the site-wide hook
775 incoming =
775 incoming =
776 incoming.email = /my/email/hook
776 incoming.email = /my/email/hook
777 incoming.autobuild = /my/build/hook
777 incoming.autobuild = /my/build/hook
778 # force autobuild hook to run before other incoming hooks
778 # force autobuild hook to run before other incoming hooks
779 priority.incoming.autobuild = 1
779 priority.incoming.autobuild = 1
780
780
781 Most hooks are run with environment variables set that give useful
781 Most hooks are run with environment variables set that give useful
782 additional information. For each hook below, the environment
782 additional information. For each hook below, the environment
783 variables it is passed are listed with names of the form ``$HG_foo``.
783 variables it is passed are listed with names of the form ``$HG_foo``.
784
784
785 ``changegroup``
785 ``changegroup``
786 Run after a changegroup has been added via push, pull or unbundle. ID of the
786 Run after a changegroup has been added via push, pull or unbundle. ID of the
787 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
787 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
788 from which changes came is in ``$HG_URL``.
788 from which changes came is in ``$HG_URL``.
789
789
790 ``commit``
790 ``commit``
791 Run after a changeset has been created in the local repository. ID
791 Run after a changeset has been created in the local repository. ID
792 of the newly created changeset is in ``$HG_NODE``. Parent changeset
792 of the newly created changeset is in ``$HG_NODE``. Parent changeset
793 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
793 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
794
794
795 ``incoming``
795 ``incoming``
796 Run after a changeset has been pulled, pushed, or unbundled into
796 Run after a changeset has been pulled, pushed, or unbundled into
797 the local repository. The ID of the newly arrived changeset is in
797 the local repository. The ID of the newly arrived changeset is in
798 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
798 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
799
799
800 ``outgoing``
800 ``outgoing``
801 Run after sending changes from local repository to another. ID of
801 Run after sending changes from local repository to another. ID of
802 first changeset sent is in ``$HG_NODE``. Source of operation is in
802 first changeset sent is in ``$HG_NODE``. Source of operation is in
803 ``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook.
803 ``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook.
804
804
805 ``post-<command>``
805 ``post-<command>``
806 Run after successful invocations of the associated command. The
806 Run after successful invocations of the associated command. The
807 contents of the command line are passed as ``$HG_ARGS`` and the result
807 contents of the command line are passed as ``$HG_ARGS`` and the result
808 code in ``$HG_RESULT``. Parsed command line arguments are passed as
808 code in ``$HG_RESULT``. Parsed command line arguments are passed as
809 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
809 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
810 the python data internally passed to <command>. ``$HG_OPTS`` is a
810 the python data internally passed to <command>. ``$HG_OPTS`` is a
811 dictionary of options (with unspecified options set to their defaults).
811 dictionary of options (with unspecified options set to their defaults).
812 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
812 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
813
813
814 ``pre-<command>``
814 ``pre-<command>``
815 Run before executing the associated command. The contents of the
815 Run before executing the associated command. The contents of the
816 command line are passed as ``$HG_ARGS``. Parsed command line arguments
816 command line are passed as ``$HG_ARGS``. Parsed command line arguments
817 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
817 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
818 representations of the data internally passed to <command>. ``$HG_OPTS``
818 representations of the data internally passed to <command>. ``$HG_OPTS``
819 is a dictionary of options (with unspecified options set to their
819 is a dictionary of options (with unspecified options set to their
820 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
820 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
821 failure, the command doesn't execute and Mercurial returns the failure
821 failure, the command doesn't execute and Mercurial returns the failure
822 code.
822 code.
823
823
824 ``prechangegroup``
824 ``prechangegroup``
825 Run before a changegroup is added via push, pull or unbundle. Exit
825 Run before a changegroup is added via push, pull or unbundle. Exit
826 status 0 allows the changegroup to proceed. Non-zero status will
826 status 0 allows the changegroup to proceed. Non-zero status will
827 cause the push, pull or unbundle to fail. URL from which changes
827 cause the push, pull or unbundle to fail. URL from which changes
828 will come is in ``$HG_URL``.
828 will come is in ``$HG_URL``.
829
829
830 ``precommit``
830 ``precommit``
831 Run before starting a local commit. Exit status 0 allows the
831 Run before starting a local commit. Exit status 0 allows the
832 commit to proceed. Non-zero status will cause the commit to fail.
832 commit to proceed. Non-zero status will cause the commit to fail.
833 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
833 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
834
834
835 ``prelistkeys``
835 ``prelistkeys``
836 Run before listing pushkeys (like bookmarks) in the
836 Run before listing pushkeys (like bookmarks) in the
837 repository. Non-zero status will cause failure. The key namespace is
837 repository. Non-zero status will cause failure. The key namespace is
838 in ``$HG_NAMESPACE``.
838 in ``$HG_NAMESPACE``.
839
839
840 ``preoutgoing``
840 ``preoutgoing``
841 Run before collecting changes to send from the local repository to
841 Run before collecting changes to send from the local repository to
842 another. Non-zero status will cause failure. This lets you prevent
842 another. Non-zero status will cause failure. This lets you prevent
843 pull over HTTP or SSH. Also prevents against local pull, push
843 pull over HTTP or SSH. Also prevents against local pull, push
844 (outbound) or bundle commands, but not effective, since you can
844 (outbound) or bundle commands, but not effective, since you can
845 just copy files instead then. Source of operation is in
845 just copy files instead then. Source of operation is in
846 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
846 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
847 SSH or HTTP repository. If "push", "pull" or "bundle", operation
847 SSH or HTTP repository. If "push", "pull" or "bundle", operation
848 is happening on behalf of repository on same system.
848 is happening on behalf of repository on same system.
849
849
850 ``prepushkey``
850 ``prepushkey``
851 Run before a pushkey (like a bookmark) is added to the
851 Run before a pushkey (like a bookmark) is added to the
852 repository. Non-zero status will cause the key to be rejected. The
852 repository. Non-zero status will cause the key to be rejected. The
853 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
853 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
854 the old value (if any) is in ``$HG_OLD``, and the new value is in
854 the old value (if any) is in ``$HG_OLD``, and the new value is in
855 ``$HG_NEW``.
855 ``$HG_NEW``.
856
856
857 ``pretag``
857 ``pretag``
858 Run before creating a tag. Exit status 0 allows the tag to be
858 Run before creating a tag. Exit status 0 allows the tag to be
859 created. Non-zero status will cause the tag to fail. ID of
859 created. Non-zero status will cause the tag to fail. ID of
860 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
860 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
861 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
861 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
862
862
863 ``pretxnopen``
863 ``pretxnopen``
864 Run before any new repository transaction is open. The reason for the
864 Run before any new repository transaction is open. The reason for the
865 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
865 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
866 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
866 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
867 transaction from being opened.
867 transaction from being opened.
868
868
869 ``pretxnclose``
869 ``pretxnclose``
870 Run right before the transaction is actually finalized. Any repository change
870 Run right before the transaction is actually finalized. Any repository change
871 will be visible to the hook program. This lets you validate the transaction
871 will be visible to the hook program. This lets you validate the transaction
872 content or change it. Exit status 0 allows the commit to proceed. Non-zero
872 content or change it. Exit status 0 allows the commit to proceed. Non-zero
873 status will cause the transaction to be rolled back. The reason for the
873 status will cause the transaction to be rolled back. The reason for the
874 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
874 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
875 the transaction will be in ``HG_TXNID``. The rest of the available data will
875 the transaction will be in ``HG_TXNID``. The rest of the available data will
876 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
876 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
877 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
877 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
878 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
878 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
879 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
879 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
880
880
881 ``txnclose``
881 ``txnclose``
882 Run after any repository transaction has been committed. At this
882 Run after any repository transaction has been committed. At this
883 point, the transaction can no longer be rolled back. The hook will run
883 point, the transaction can no longer be rolled back. The hook will run
884 after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for
884 after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for
885 details about available variables.
885 details about available variables.
886
886
887 ``txnabort``
887 ``txnabort``
888 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
888 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
889 docs for details about available variables.
889 docs for details about available variables.
890
890
891 ``pretxnchangegroup``
891 ``pretxnchangegroup``
892 Run after a changegroup has been added via push, pull or unbundle, but before
892 Run after a changegroup has been added via push, pull or unbundle, but before
893 the transaction has been committed. Changegroup is visible to hook program.
893 the transaction has been committed. Changegroup is visible to hook program.
894 This lets you validate incoming changes before accepting them. Passed the ID
894 This lets you validate incoming changes before accepting them. Passed the ID
895 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
895 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
896 Exit status 0 allows the transaction to commit. Non-zero status will cause
896 Exit status 0 allows the transaction to commit. Non-zero status will cause
897 the transaction to be rolled back and the push, pull or unbundle will fail.
897 the transaction to be rolled back and the push, pull or unbundle will fail.
898 URL that was source of changes is in ``$HG_URL``.
898 URL that was source of changes is in ``$HG_URL``.
899
899
900 ``pretxncommit``
900 ``pretxncommit``
901 Run after a changeset has been created but the transaction not yet
901 Run after a changeset has been created but the transaction not yet
902 committed. Changeset is visible to hook program. This lets you
902 committed. Changeset is visible to hook program. This lets you
903 validate commit message and changes. Exit status 0 allows the
903 validate commit message and changes. Exit status 0 allows the
904 commit to proceed. Non-zero status will cause the transaction to
904 commit to proceed. Non-zero status will cause the transaction to
905 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
905 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
906 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
906 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
907
907
908 ``preupdate``
908 ``preupdate``
909 Run before updating the working directory. Exit status 0 allows
909 Run before updating the working directory. Exit status 0 allows
910 the update to proceed. Non-zero status will prevent the update.
910 the update to proceed. Non-zero status will prevent the update.
911 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
911 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
912 of second new parent is in ``$HG_PARENT2``.
912 of second new parent is in ``$HG_PARENT2``.
913
913
914 ``listkeys``
914 ``listkeys``
915 Run after listing pushkeys (like bookmarks) in the repository. The
915 Run after listing pushkeys (like bookmarks) in the repository. The
916 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
916 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
917 dictionary containing the keys and values.
917 dictionary containing the keys and values.
918
918
919 ``pushkey``
919 ``pushkey``
920 Run after a pushkey (like a bookmark) is added to the
920 Run after a pushkey (like a bookmark) is added to the
921 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
921 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
922 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
922 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
923 value is in ``$HG_NEW``.
923 value is in ``$HG_NEW``.
924
924
925 ``tag``
925 ``tag``
926 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
926 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
927 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
927 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
928 repository if ``$HG_LOCAL=0``.
928 repository if ``$HG_LOCAL=0``.
929
929
930 ``update``
930 ``update``
931 Run after updating the working directory. Changeset ID of first
931 Run after updating the working directory. Changeset ID of first
932 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
932 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
933 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
933 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
934 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
934 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
935
935
936 .. note::
936 .. note::
937
937
938 It is generally better to use standard hooks rather than the
938 It is generally better to use standard hooks rather than the
939 generic pre- and post- command hooks as they are guaranteed to be
939 generic pre- and post- command hooks as they are guaranteed to be
940 called in the appropriate contexts for influencing transactions.
940 called in the appropriate contexts for influencing transactions.
941 Also, hooks like "commit" will be called in all contexts that
941 Also, hooks like "commit" will be called in all contexts that
942 generate a commit (e.g. tag) and not just the commit command.
942 generate a commit (e.g. tag) and not just the commit command.
943
943
944 .. note::
944 .. note::
945
945
946 Environment variables with empty values may not be passed to
946 Environment variables with empty values may not be passed to
947 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
947 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
948 will have an empty value under Unix-like platforms for non-merge
948 will have an empty value under Unix-like platforms for non-merge
949 changesets, while it will not be available at all under Windows.
949 changesets, while it will not be available at all under Windows.
950
950
951 The syntax for Python hooks is as follows::
951 The syntax for Python hooks is as follows::
952
952
953 hookname = python:modulename.submodule.callable
953 hookname = python:modulename.submodule.callable
954 hookname = python:/path/to/python/module.py:callable
954 hookname = python:/path/to/python/module.py:callable
955
955
956 Python hooks are run within the Mercurial process. Each hook is
956 Python hooks are run within the Mercurial process. Each hook is
957 called with at least three keyword arguments: a ui object (keyword
957 called with at least three keyword arguments: a ui object (keyword
958 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
958 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
959 keyword that tells what kind of hook is used. Arguments listed as
959 keyword that tells what kind of hook is used. Arguments listed as
960 environment variables above are passed as keyword arguments, with no
960 environment variables above are passed as keyword arguments, with no
961 ``HG_`` prefix, and names in lower case.
961 ``HG_`` prefix, and names in lower case.
962
962
963 If a Python hook returns a "true" value or raises an exception, this
963 If a Python hook returns a "true" value or raises an exception, this
964 is treated as a failure.
964 is treated as a failure.
965
965
966
966
967 ``hostfingerprints``
967 ``hostfingerprints``
968 --------------------
968 --------------------
969
969
970 Fingerprints of the certificates of known HTTPS servers.
970 Fingerprints of the certificates of known HTTPS servers.
971
971
972 A HTTPS connection to a server with a fingerprint configured here will
972 A HTTPS connection to a server with a fingerprint configured here will
973 only succeed if the servers certificate matches the fingerprint.
973 only succeed if the servers certificate matches the fingerprint.
974 This is very similar to how ssh known hosts works.
974 This is very similar to how ssh known hosts works.
975
975
976 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
976 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
977 Multiple values can be specified (separated by spaces or commas). This can
977 Multiple values can be specified (separated by spaces or commas). This can
978 be used to define both old and new fingerprints while a host transitions
978 be used to define both old and new fingerprints while a host transitions
979 to a new certificate.
979 to a new certificate.
980
980
981 The CA chain and web.cacerts is not used for servers with a fingerprint.
981 The CA chain and web.cacerts is not used for servers with a fingerprint.
982
982
983 For example::
983 For example::
984
984
985 [hostfingerprints]
985 [hostfingerprints]
986 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
986 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
987 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
987 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
988
988
989 ``http_proxy``
989 ``http_proxy``
990 --------------
990 --------------
991
991
992 Used to access web-based Mercurial repositories through a HTTP
992 Used to access web-based Mercurial repositories through a HTTP
993 proxy.
993 proxy.
994
994
995 ``host``
995 ``host``
996 Host name and (optional) port of the proxy server, for example
996 Host name and (optional) port of the proxy server, for example
997 "myproxy:8000".
997 "myproxy:8000".
998
998
999 ``no``
999 ``no``
1000 Optional. Comma-separated list of host names that should bypass
1000 Optional. Comma-separated list of host names that should bypass
1001 the proxy.
1001 the proxy.
1002
1002
1003 ``passwd``
1003 ``passwd``
1004 Optional. Password to authenticate with at the proxy server.
1004 Optional. Password to authenticate with at the proxy server.
1005
1005
1006 ``user``
1006 ``user``
1007 Optional. User name to authenticate with at the proxy server.
1007 Optional. User name to authenticate with at the proxy server.
1008
1008
1009 ``always``
1009 ``always``
1010 Optional. Always use the proxy, even for localhost and any entries
1010 Optional. Always use the proxy, even for localhost and any entries
1011 in ``http_proxy.no``. (default: False)
1011 in ``http_proxy.no``. (default: False)
1012
1012
1013 ``merge``
1013 ``merge``
1014 ---------
1014 ---------
1015
1015
1016 This section specifies behavior during merges and updates.
1016 This section specifies behavior during merges and updates.
1017
1017
1018 ``checkignored``
1018 ``checkignored``
1019 Controls behavior when an ignored file on disk has the same name as a tracked
1019 Controls behavior when an ignored file on disk has the same name as a tracked
1020 file in the changeset being merged or updated to, and has different
1020 file in the changeset being merged or updated to, and has different
1021 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1021 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1022 abort on such files. With ``warn``, warn on such files and back them up as
1022 abort on such files. With ``warn``, warn on such files and back them up as
1023 .orig. With ``ignore``, don't print a warning and back them up as
1023 .orig. With ``ignore``, don't print a warning and back them up as
1024 .orig. (default: ``abort``)
1024 .orig. (default: ``abort``)
1025
1025
1026 ``checkunknown``
1026 ``checkunknown``
1027 Controls behavior when an unknown file that isn't ignored has the same name
1027 Controls behavior when an unknown file that isn't ignored has the same name
1028 as a tracked file in the changeset being merged or updated to, and has
1028 as a tracked file in the changeset being merged or updated to, and has
1029 different contents. Similar to ``merge.checkignored``, except for files that
1029 different contents. Similar to ``merge.checkignored``, except for files that
1030 are not ignored. (default: ``abort``)
1030 are not ignored. (default: ``abort``)
1031
1031
1032 ``merge-patterns``
1032 ``merge-patterns``
1033 ------------------
1033 ------------------
1034
1034
1035 This section specifies merge tools to associate with particular file
1035 This section specifies merge tools to associate with particular file
1036 patterns. Tools matched here will take precedence over the default
1036 patterns. Tools matched here will take precedence over the default
1037 merge tool. Patterns are globs by default, rooted at the repository
1037 merge tool. Patterns are globs by default, rooted at the repository
1038 root.
1038 root.
1039
1039
1040 Example::
1040 Example::
1041
1041
1042 [merge-patterns]
1042 [merge-patterns]
1043 **.c = kdiff3
1043 **.c = kdiff3
1044 **.jpg = myimgmerge
1044 **.jpg = myimgmerge
1045
1045
1046 ``merge-tools``
1046 ``merge-tools``
1047 ---------------
1047 ---------------
1048
1048
1049 This section configures external merge tools to use for file-level
1049 This section configures external merge tools to use for file-level
1050 merges. This section has likely been preconfigured at install time.
1050 merges. This section has likely been preconfigured at install time.
1051 Use :hg:`config merge-tools` to check the existing configuration.
1051 Use :hg:`config merge-tools` to check the existing configuration.
1052 Also see :hg:`help merge-tools` for more details.
1052 Also see :hg:`help merge-tools` for more details.
1053
1053
1054 Example ``~/.hgrc``::
1054 Example ``~/.hgrc``::
1055
1055
1056 [merge-tools]
1056 [merge-tools]
1057 # Override stock tool location
1057 # Override stock tool location
1058 kdiff3.executable = ~/bin/kdiff3
1058 kdiff3.executable = ~/bin/kdiff3
1059 # Specify command line
1059 # Specify command line
1060 kdiff3.args = $base $local $other -o $output
1060 kdiff3.args = $base $local $other -o $output
1061 # Give higher priority
1061 # Give higher priority
1062 kdiff3.priority = 1
1062 kdiff3.priority = 1
1063
1063
1064 # Changing the priority of preconfigured tool
1064 # Changing the priority of preconfigured tool
1065 meld.priority = 0
1065 meld.priority = 0
1066
1066
1067 # Disable a preconfigured tool
1067 # Disable a preconfigured tool
1068 vimdiff.disabled = yes
1068 vimdiff.disabled = yes
1069
1069
1070 # Define new tool
1070 # Define new tool
1071 myHtmlTool.args = -m $local $other $base $output
1071 myHtmlTool.args = -m $local $other $base $output
1072 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1072 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1073 myHtmlTool.priority = 1
1073 myHtmlTool.priority = 1
1074
1074
1075 Supported arguments:
1075 Supported arguments:
1076
1076
1077 ``priority``
1077 ``priority``
1078 The priority in which to evaluate this tool.
1078 The priority in which to evaluate this tool.
1079 (default: 0)
1079 (default: 0)
1080
1080
1081 ``executable``
1081 ``executable``
1082 Either just the name of the executable or its pathname.
1082 Either just the name of the executable or its pathname.
1083
1083
1084 .. container:: windows
1084 .. container:: windows
1085
1085
1086 On Windows, the path can use environment variables with ${ProgramFiles}
1086 On Windows, the path can use environment variables with ${ProgramFiles}
1087 syntax.
1087 syntax.
1088
1088
1089 (default: the tool name)
1089 (default: the tool name)
1090
1090
1091 ``args``
1091 ``args``
1092 The arguments to pass to the tool executable. You can refer to the
1092 The arguments to pass to the tool executable. You can refer to the
1093 files being merged as well as the output file through these
1093 files being merged as well as the output file through these
1094 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1094 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1095 of ``$local`` and ``$other`` can vary depending on which action is being
1095 of ``$local`` and ``$other`` can vary depending on which action is being
1096 performed. During and update or merge, ``$local`` represents the original
1096 performed. During and update or merge, ``$local`` represents the original
1097 state of the file, while ``$other`` represents the commit you are updating
1097 state of the file, while ``$other`` represents the commit you are updating
1098 to or the commit you are merging with. During a rebase ``$local``
1098 to or the commit you are merging with. During a rebase ``$local``
1099 represents the destination of the rebase, and ``$other`` represents the
1099 represents the destination of the rebase, and ``$other`` represents the
1100 commit being rebased.
1100 commit being rebased.
1101 (default: ``$local $base $other``)
1101 (default: ``$local $base $other``)
1102
1102
1103 ``premerge``
1103 ``premerge``
1104 Attempt to run internal non-interactive 3-way merge tool before
1104 Attempt to run internal non-interactive 3-way merge tool before
1105 launching external tool. Options are ``true``, ``false``, ``keep`` or
1105 launching external tool. Options are ``true``, ``false``, ``keep`` or
1106 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1106 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1107 premerge fails. The ``keep-merge3`` will do the same but include information
1107 premerge fails. The ``keep-merge3`` will do the same but include information
1108 about the base of the merge in the marker (see internal :merge3 in
1108 about the base of the merge in the marker (see internal :merge3 in
1109 :hg:`help merge-tools`).
1109 :hg:`help merge-tools`).
1110 (default: True)
1110 (default: True)
1111
1111
1112 ``binary``
1112 ``binary``
1113 This tool can merge binary files. (default: False, unless tool
1113 This tool can merge binary files. (default: False, unless tool
1114 was selected by file pattern match)
1114 was selected by file pattern match)
1115
1115
1116 ``symlink``
1116 ``symlink``
1117 This tool can merge symlinks. (default: False)
1117 This tool can merge symlinks. (default: False)
1118
1118
1119 ``check``
1119 ``check``
1120 A list of merge success-checking options:
1120 A list of merge success-checking options:
1121
1121
1122 ``changed``
1122 ``changed``
1123 Ask whether merge was successful when the merged file shows no changes.
1123 Ask whether merge was successful when the merged file shows no changes.
1124 ``conflicts``
1124 ``conflicts``
1125 Check whether there are conflicts even though the tool reported success.
1125 Check whether there are conflicts even though the tool reported success.
1126 ``prompt``
1126 ``prompt``
1127 Always prompt for merge success, regardless of success reported by tool.
1127 Always prompt for merge success, regardless of success reported by tool.
1128
1128
1129 ``fixeol``
1129 ``fixeol``
1130 Attempt to fix up EOL changes caused by the merge tool.
1130 Attempt to fix up EOL changes caused by the merge tool.
1131 (default: False)
1131 (default: False)
1132
1132
1133 ``gui``
1133 ``gui``
1134 This tool requires a graphical interface to run. (default: False)
1134 This tool requires a graphical interface to run. (default: False)
1135
1135
1136 .. container:: windows
1136 .. container:: windows
1137
1137
1138 ``regkey``
1138 ``regkey``
1139 Windows registry key which describes install location of this
1139 Windows registry key which describes install location of this
1140 tool. Mercurial will search for this key first under
1140 tool. Mercurial will search for this key first under
1141 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1141 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1142 (default: None)
1142 (default: None)
1143
1143
1144 ``regkeyalt``
1144 ``regkeyalt``
1145 An alternate Windows registry key to try if the first key is not
1145 An alternate Windows registry key to try if the first key is not
1146 found. The alternate key uses the same ``regname`` and ``regappend``
1146 found. The alternate key uses the same ``regname`` and ``regappend``
1147 semantics of the primary key. The most common use for this key
1147 semantics of the primary key. The most common use for this key
1148 is to search for 32bit applications on 64bit operating systems.
1148 is to search for 32bit applications on 64bit operating systems.
1149 (default: None)
1149 (default: None)
1150
1150
1151 ``regname``
1151 ``regname``
1152 Name of value to read from specified registry key.
1152 Name of value to read from specified registry key.
1153 (default: the unnamed (default) value)
1153 (default: the unnamed (default) value)
1154
1154
1155 ``regappend``
1155 ``regappend``
1156 String to append to the value read from the registry, typically
1156 String to append to the value read from the registry, typically
1157 the executable name of the tool.
1157 the executable name of the tool.
1158 (default: None)
1158 (default: None)
1159
1159
1160
1160
1161 ``patch``
1161 ``patch``
1162 ---------
1162 ---------
1163
1163
1164 Settings used when applying patches, for instance through the 'import'
1164 Settings used when applying patches, for instance through the 'import'
1165 command or with Mercurial Queues extension.
1165 command or with Mercurial Queues extension.
1166
1166
1167 ``eol``
1167 ``eol``
1168 When set to 'strict' patch content and patched files end of lines
1168 When set to 'strict' patch content and patched files end of lines
1169 are preserved. When set to ``lf`` or ``crlf``, both files end of
1169 are preserved. When set to ``lf`` or ``crlf``, both files end of
1170 lines are ignored when patching and the result line endings are
1170 lines are ignored when patching and the result line endings are
1171 normalized to either LF (Unix) or CRLF (Windows). When set to
1171 normalized to either LF (Unix) or CRLF (Windows). When set to
1172 ``auto``, end of lines are again ignored while patching but line
1172 ``auto``, end of lines are again ignored while patching but line
1173 endings in patched files are normalized to their original setting
1173 endings in patched files are normalized to their original setting
1174 on a per-file basis. If target file does not exist or has no end
1174 on a per-file basis. If target file does not exist or has no end
1175 of line, patch line endings are preserved.
1175 of line, patch line endings are preserved.
1176 (default: strict)
1176 (default: strict)
1177
1177
1178 ``fuzz``
1178 ``fuzz``
1179 The number of lines of 'fuzz' to allow when applying patches. This
1179 The number of lines of 'fuzz' to allow when applying patches. This
1180 controls how much context the patcher is allowed to ignore when
1180 controls how much context the patcher is allowed to ignore when
1181 trying to apply a patch.
1181 trying to apply a patch.
1182 (default: 2)
1182 (default: 2)
1183
1183
1184 ``paths``
1184 ``paths``
1185 ---------
1185 ---------
1186
1186
1187 Assigns symbolic names and behavior to repositories.
1187 Assigns symbolic names and behavior to repositories.
1188
1188
1189 Options are symbolic names defining the URL or directory that is the
1189 Options are symbolic names defining the URL or directory that is the
1190 location of the repository. Example::
1190 location of the repository. Example::
1191
1191
1192 [paths]
1192 [paths]
1193 my_server = https://example.com/my_repo
1193 my_server = https://example.com/my_repo
1194 local_path = /home/me/repo
1194 local_path = /home/me/repo
1195
1195
1196 These symbolic names can be used from the command line. To pull
1196 These symbolic names can be used from the command line. To pull
1197 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1197 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1198 :hg:`push local_path`.
1198 :hg:`push local_path`.
1199
1199
1200 Options containing colons (``:``) denote sub-options that can influence
1200 Options containing colons (``:``) denote sub-options that can influence
1201 behavior for that specific path. Example::
1201 behavior for that specific path. Example::
1202
1202
1203 [paths]
1203 [paths]
1204 my_server = https://example.com/my_path
1204 my_server = https://example.com/my_path
1205 my_server:pushurl = ssh://example.com/my_path
1205 my_server:pushurl = ssh://example.com/my_path
1206
1206
1207 The following sub-options can be defined:
1207 The following sub-options can be defined:
1208
1208
1209 ``pushurl``
1209 ``pushurl``
1210 The URL to use for push operations. If not defined, the location
1210 The URL to use for push operations. If not defined, the location
1211 defined by the path's main entry is used.
1211 defined by the path's main entry is used.
1212
1212
1213 The following special named paths exist:
1213 The following special named paths exist:
1214
1214
1215 ``default``
1215 ``default``
1216 The URL or directory to use when no source or remote is specified.
1216 The URL or directory to use when no source or remote is specified.
1217
1217
1218 :hg:`clone` will automatically define this path to the location the
1218 :hg:`clone` will automatically define this path to the location the
1219 repository was cloned from.
1219 repository was cloned from.
1220
1220
1221 ``default-push``
1221 ``default-push``
1222 (deprecated) The URL or directory for the default :hg:`push` location.
1222 (deprecated) The URL or directory for the default :hg:`push` location.
1223 ``default:pushurl`` should be used instead.
1223 ``default:pushurl`` should be used instead.
1224
1224
1225 ``phases``
1225 ``phases``
1226 ----------
1226 ----------
1227
1227
1228 Specifies default handling of phases. See :hg:`help phases` for more
1228 Specifies default handling of phases. See :hg:`help phases` for more
1229 information about working with phases.
1229 information about working with phases.
1230
1230
1231 ``publish``
1231 ``publish``
1232 Controls draft phase behavior when working as a server. When true,
1232 Controls draft phase behavior when working as a server. When true,
1233 pushed changesets are set to public in both client and server and
1233 pushed changesets are set to public in both client and server and
1234 pulled or cloned changesets are set to public in the client.
1234 pulled or cloned changesets are set to public in the client.
1235 (default: True)
1235 (default: True)
1236
1236
1237 ``new-commit``
1237 ``new-commit``
1238 Phase of newly-created commits.
1238 Phase of newly-created commits.
1239 (default: draft)
1239 (default: draft)
1240
1240
1241 ``checksubrepos``
1241 ``checksubrepos``
1242 Check the phase of the current revision of each subrepository. Allowed
1242 Check the phase of the current revision of each subrepository. Allowed
1243 values are "ignore", "follow" and "abort". For settings other than
1243 values are "ignore", "follow" and "abort". For settings other than
1244 "ignore", the phase of the current revision of each subrepository is
1244 "ignore", the phase of the current revision of each subrepository is
1245 checked before committing the parent repository. If any of those phases is
1245 checked before committing the parent repository. If any of those phases is
1246 greater than the phase of the parent repository (e.g. if a subrepo is in a
1246 greater than the phase of the parent repository (e.g. if a subrepo is in a
1247 "secret" phase while the parent repo is in "draft" phase), the commit is
1247 "secret" phase while the parent repo is in "draft" phase), the commit is
1248 either aborted (if checksubrepos is set to "abort") or the higher phase is
1248 either aborted (if checksubrepos is set to "abort") or the higher phase is
1249 used for the parent repository commit (if set to "follow").
1249 used for the parent repository commit (if set to "follow").
1250 (default: follow)
1250 (default: follow)
1251
1251
1252
1252
1253 ``profiling``
1253 ``profiling``
1254 -------------
1254 -------------
1255
1255
1256 Specifies profiling type, format, and file output. Two profilers are
1256 Specifies profiling type, format, and file output. Two profilers are
1257 supported: an instrumenting profiler (named ``ls``), and a sampling
1257 supported: an instrumenting profiler (named ``ls``), and a sampling
1258 profiler (named ``stat``).
1258 profiler (named ``stat``).
1259
1259
1260 In this section description, 'profiling data' stands for the raw data
1260 In this section description, 'profiling data' stands for the raw data
1261 collected during profiling, while 'profiling report' stands for a
1261 collected during profiling, while 'profiling report' stands for a
1262 statistical text report generated from the profiling data. The
1262 statistical text report generated from the profiling data. The
1263 profiling is done using lsprof.
1263 profiling is done using lsprof.
1264
1264
1265 ``type``
1265 ``type``
1266 The type of profiler to use.
1266 The type of profiler to use.
1267 (default: ls)
1267 (default: ls)
1268
1268
1269 ``ls``
1269 ``ls``
1270 Use Python's built-in instrumenting profiler. This profiler
1270 Use Python's built-in instrumenting profiler. This profiler
1271 works on all platforms, but each line number it reports is the
1271 works on all platforms, but each line number it reports is the
1272 first line of a function. This restriction makes it difficult to
1272 first line of a function. This restriction makes it difficult to
1273 identify the expensive parts of a non-trivial function.
1273 identify the expensive parts of a non-trivial function.
1274 ``stat``
1274 ``stat``
1275 Use a third-party statistical profiler, statprof. This profiler
1275 Use a third-party statistical profiler, statprof. This profiler
1276 currently runs only on Unix systems, and is most useful for
1276 currently runs only on Unix systems, and is most useful for
1277 profiling commands that run for longer than about 0.1 seconds.
1277 profiling commands that run for longer than about 0.1 seconds.
1278
1278
1279 ``format``
1279 ``format``
1280 Profiling format. Specific to the ``ls`` instrumenting profiler.
1280 Profiling format. Specific to the ``ls`` instrumenting profiler.
1281 (default: text)
1281 (default: text)
1282
1282
1283 ``text``
1283 ``text``
1284 Generate a profiling report. When saving to a file, it should be
1284 Generate a profiling report. When saving to a file, it should be
1285 noted that only the report is saved, and the profiling data is
1285 noted that only the report is saved, and the profiling data is
1286 not kept.
1286 not kept.
1287 ``kcachegrind``
1287 ``kcachegrind``
1288 Format profiling data for kcachegrind use: when saving to a
1288 Format profiling data for kcachegrind use: when saving to a
1289 file, the generated file can directly be loaded into
1289 file, the generated file can directly be loaded into
1290 kcachegrind.
1290 kcachegrind.
1291
1291
1292 ``frequency``
1292 ``frequency``
1293 Sampling frequency. Specific to the ``stat`` sampling profiler.
1293 Sampling frequency. Specific to the ``stat`` sampling profiler.
1294 (default: 1000)
1294 (default: 1000)
1295
1295
1296 ``output``
1296 ``output``
1297 File path where profiling data or report should be saved. If the
1297 File path where profiling data or report should be saved. If the
1298 file exists, it is replaced. (default: None, data is printed on
1298 file exists, it is replaced. (default: None, data is printed on
1299 stderr)
1299 stderr)
1300
1300
1301 ``sort``
1301 ``sort``
1302 Sort field. Specific to the ``ls`` instrumenting profiler.
1302 Sort field. Specific to the ``ls`` instrumenting profiler.
1303 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1303 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1304 ``inlinetime``.
1304 ``inlinetime``.
1305 (default: inlinetime)
1305 (default: inlinetime)
1306
1306
1307 ``limit``
1307 ``limit``
1308 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1308 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1309 (default: 30)
1309 (default: 30)
1310
1310
1311 ``nested``
1311 ``nested``
1312 Show at most this number of lines of drill-down info after each main entry.
1312 Show at most this number of lines of drill-down info after each main entry.
1313 This can help explain the difference between Total and Inline.
1313 This can help explain the difference between Total and Inline.
1314 Specific to the ``ls`` instrumenting profiler.
1314 Specific to the ``ls`` instrumenting profiler.
1315 (default: 5)
1315 (default: 5)
1316
1316
1317 ``progress``
1317 ``progress``
1318 ------------
1318 ------------
1319
1319
1320 Mercurial commands can draw progress bars that are as informative as
1320 Mercurial commands can draw progress bars that are as informative as
1321 possible. Some progress bars only offer indeterminate information, while others
1321 possible. Some progress bars only offer indeterminate information, while others
1322 have a definite end point.
1322 have a definite end point.
1323
1323
1324 ``delay``
1324 ``delay``
1325 Number of seconds (float) before showing the progress bar. (default: 3)
1325 Number of seconds (float) before showing the progress bar. (default: 3)
1326
1326
1327 ``changedelay``
1327 ``changedelay``
1328 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1328 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1329 that value will be used instead. (default: 1)
1329 that value will be used instead. (default: 1)
1330
1330
1331 ``refresh``
1331 ``refresh``
1332 Time in seconds between refreshes of the progress bar. (default: 0.1)
1332 Time in seconds between refreshes of the progress bar. (default: 0.1)
1333
1333
1334 ``format``
1334 ``format``
1335 Format of the progress bar.
1335 Format of the progress bar.
1336
1336
1337 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1337 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1338 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1338 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1339 last 20 characters of the item, but this can be changed by adding either
1339 last 20 characters of the item, but this can be changed by adding either
1340 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1340 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1341 first num characters.
1341 first num characters.
1342
1342
1343 (default: topic bar number estimate)
1343 (default: topic bar number estimate)
1344
1344
1345 ``width``
1345 ``width``
1346 If set, the maximum width of the progress information (that is, min(width,
1346 If set, the maximum width of the progress information (that is, min(width,
1347 term width) will be used).
1347 term width) will be used).
1348
1348
1349 ``clear-complete``
1349 ``clear-complete``
1350 Clear the progress bar after it's done. (default: True)
1350 Clear the progress bar after it's done. (default: True)
1351
1351
1352 ``disable``
1352 ``disable``
1353 If true, don't show a progress bar.
1353 If true, don't show a progress bar.
1354
1354
1355 ``assume-tty``
1355 ``assume-tty``
1356 If true, ALWAYS show a progress bar, unless disable is given.
1356 If true, ALWAYS show a progress bar, unless disable is given.
1357
1357
1358 ``rebase``
1358 ``rebase``
1359 ----------
1359 ----------
1360
1360
1361 ``allowdivergence``
1361 ``allowdivergence``
1362 Default to False, when True allow creating divergence when performing
1362 Default to False, when True allow creating divergence when performing
1363 rebase of obsolete changesets.
1363 rebase of obsolete changesets.
1364
1364
1365 ``revsetalias``
1365 ``revsetalias``
1366 ---------------
1366 ---------------
1367
1367
1368 Alias definitions for revsets. See :hg:`help revsets` for details.
1368 Alias definitions for revsets. See :hg:`help revsets` for details.
1369
1369
1370 ``server``
1370 ``server``
1371 ----------
1371 ----------
1372
1372
1373 Controls generic server settings.
1373 Controls generic server settings.
1374
1374
1375 ``uncompressed``
1375 ``uncompressed``
1376 Whether to allow clients to clone a repository using the
1376 Whether to allow clients to clone a repository using the
1377 uncompressed streaming protocol. This transfers about 40% more
1377 uncompressed streaming protocol. This transfers about 40% more
1378 data than a regular clone, but uses less memory and CPU on both
1378 data than a regular clone, but uses less memory and CPU on both
1379 server and client. Over a LAN (100 Mbps or better) or a very fast
1379 server and client. Over a LAN (100 Mbps or better) or a very fast
1380 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1380 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1381 regular clone. Over most WAN connections (anything slower than
1381 regular clone. Over most WAN connections (anything slower than
1382 about 6 Mbps), uncompressed streaming is slower, because of the
1382 about 6 Mbps), uncompressed streaming is slower, because of the
1383 extra data transfer overhead. This mode will also temporarily hold
1383 extra data transfer overhead. This mode will also temporarily hold
1384 the write lock while determining what data to transfer.
1384 the write lock while determining what data to transfer.
1385 (default: True)
1385 (default: True)
1386
1386
1387 ``preferuncompressed``
1387 ``preferuncompressed``
1388 When set, clients will try to use the uncompressed streaming
1388 When set, clients will try to use the uncompressed streaming
1389 protocol. (default: False)
1389 protocol. (default: False)
1390
1390
1391 ``validate``
1391 ``validate``
1392 Whether to validate the completeness of pushed changesets by
1392 Whether to validate the completeness of pushed changesets by
1393 checking that all new file revisions specified in manifests are
1393 checking that all new file revisions specified in manifests are
1394 present. (default: False)
1394 present. (default: False)
1395
1395
1396 ``maxhttpheaderlen``
1396 ``maxhttpheaderlen``
1397 Instruct HTTP clients not to send request headers longer than this
1397 Instruct HTTP clients not to send request headers longer than this
1398 many bytes. (default: 1024)
1398 many bytes. (default: 1024)
1399
1399
1400 ``bundle1``
1400 ``bundle1``
1401 Whether to allow clients to push and pull using the legacy bundle1
1401 Whether to allow clients to push and pull using the legacy bundle1
1402 exchange format. (default: True)
1402 exchange format. (default: True)
1403
1403
1404 ``bundle1gd``
1404 ``bundle1gd``
1405 Like ``bundle1`` but only used if the repository is using the
1405 Like ``bundle1`` but only used if the repository is using the
1406 *generaldelta* storage format. (default: True)
1406 *generaldelta* storage format. (default: True)
1407
1407
1408 ``bundle1.push``
1408 ``bundle1.push``
1409 Whether to allow clients to push using the legacy bundle1 exchange
1409 Whether to allow clients to push using the legacy bundle1 exchange
1410 format. (default: True)
1410 format. (default: True)
1411
1411
1412 ``bundle1gd.push``
1412 ``bundle1gd.push``
1413 Like ``bundle1.push`` but only used if the repository is using the
1413 Like ``bundle1.push`` but only used if the repository is using the
1414 *generaldelta* storage format. (default: True)
1414 *generaldelta* storage format. (default: True)
1415
1415
1416 ``bundle1.pull``
1416 ``bundle1.pull``
1417 Whether to allow clients to pull using the legacy bundle1 exchange
1417 Whether to allow clients to pull using the legacy bundle1 exchange
1418 format. (default: True)
1418 format. (default: True)
1419
1419
1420 ``bundle1gd.pull``
1420 ``bundle1gd.pull``
1421 Like ``bundle1.pull`` but only used if the repository is using the
1421 Like ``bundle1.pull`` but only used if the repository is using the
1422 *generaldelta* storage format. (default: True)
1422 *generaldelta* storage format. (default: True)
1423
1423
1424 Large repositories using the *generaldelta* storage format should
1424 Large repositories using the *generaldelta* storage format should
1425 consider setting this option because converting *generaldelta*
1425 consider setting this option because converting *generaldelta*
1426 repositories to the exchange format required by the bundle1 data
1426 repositories to the exchange format required by the bundle1 data
1427 format can consume a lot of CPU.
1427 format can consume a lot of CPU.
1428
1428
1429 ``smtp``
1429 ``smtp``
1430 --------
1430 --------
1431
1431
1432 Configuration for extensions that need to send email messages.
1432 Configuration for extensions that need to send email messages.
1433
1433
1434 ``host``
1434 ``host``
1435 Host name of mail server, e.g. "mail.example.com".
1435 Host name of mail server, e.g. "mail.example.com".
1436
1436
1437 ``port``
1437 ``port``
1438 Optional. Port to connect to on mail server. (default: 465 if
1438 Optional. Port to connect to on mail server. (default: 465 if
1439 ``tls`` is smtps; 25 otherwise)
1439 ``tls`` is smtps; 25 otherwise)
1440
1440
1441 ``tls``
1441 ``tls``
1442 Optional. Method to enable TLS when connecting to mail server: starttls,
1442 Optional. Method to enable TLS when connecting to mail server: starttls,
1443 smtps or none. (default: none)
1443 smtps or none. (default: none)
1444
1444
1445 ``verifycert``
1445 ``verifycert``
1446 Optional. Verification for the certificate of mail server, when
1446 Optional. Verification for the certificate of mail server, when
1447 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1447 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1448 "strict" or "loose", the certificate is verified as same as the
1448 "strict" or "loose", the certificate is verified as same as the
1449 verification for HTTPS connections (see ``[hostfingerprints]`` and
1449 verification for HTTPS connections (see ``[hostfingerprints]`` and
1450 ``[web] cacerts`` also). For "strict", sending email is also
1450 ``[web] cacerts`` also). For "strict", sending email is also
1451 aborted, if there is no configuration for mail server in
1451 aborted, if there is no configuration for mail server in
1452 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1452 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1453 :hg:`email` overwrites this as "loose". (default: strict)
1453 :hg:`email` overwrites this as "loose". (default: strict)
1454
1454
1455 ``username``
1455 ``username``
1456 Optional. User name for authenticating with the SMTP server.
1456 Optional. User name for authenticating with the SMTP server.
1457 (default: None)
1457 (default: None)
1458
1458
1459 ``password``
1459 ``password``
1460 Optional. Password for authenticating with the SMTP server. If not
1460 Optional. Password for authenticating with the SMTP server. If not
1461 specified, interactive sessions will prompt the user for a
1461 specified, interactive sessions will prompt the user for a
1462 password; non-interactive sessions will fail. (default: None)
1462 password; non-interactive sessions will fail. (default: None)
1463
1463
1464 ``local_hostname``
1464 ``local_hostname``
1465 Optional. The hostname that the sender can use to identify
1465 Optional. The hostname that the sender can use to identify
1466 itself to the MTA.
1466 itself to the MTA.
1467
1467
1468
1468
1469 ``subpaths``
1469 ``subpaths``
1470 ------------
1470 ------------
1471
1471
1472 Subrepository source URLs can go stale if a remote server changes name
1472 Subrepository source URLs can go stale if a remote server changes name
1473 or becomes temporarily unavailable. This section lets you define
1473 or becomes temporarily unavailable. This section lets you define
1474 rewrite rules of the form::
1474 rewrite rules of the form::
1475
1475
1476 <pattern> = <replacement>
1476 <pattern> = <replacement>
1477
1477
1478 where ``pattern`` is a regular expression matching a subrepository
1478 where ``pattern`` is a regular expression matching a subrepository
1479 source URL and ``replacement`` is the replacement string used to
1479 source URL and ``replacement`` is the replacement string used to
1480 rewrite it. Groups can be matched in ``pattern`` and referenced in
1480 rewrite it. Groups can be matched in ``pattern`` and referenced in
1481 ``replacements``. For instance::
1481 ``replacements``. For instance::
1482
1482
1483 http://server/(.*)-hg/ = http://hg.server/\1/
1483 http://server/(.*)-hg/ = http://hg.server/\1/
1484
1484
1485 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1485 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1486
1486
1487 Relative subrepository paths are first made absolute, and the
1487 Relative subrepository paths are first made absolute, and the
1488 rewrite rules are then applied on the full (absolute) path. The rules
1488 rewrite rules are then applied on the full (absolute) path. The rules
1489 are applied in definition order.
1489 are applied in definition order.
1490
1490
1491 ``templatealias``
1492 -----------------
1493
1494 Alias definitions for templates. See :hg:`help templates` for details.
1495
1491 ``trusted``
1496 ``trusted``
1492 -----------
1497 -----------
1493
1498
1494 Mercurial will not use the settings in the
1499 Mercurial will not use the settings in the
1495 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1500 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1496 user or to a trusted group, as various hgrc features allow arbitrary
1501 user or to a trusted group, as various hgrc features allow arbitrary
1497 commands to be run. This issue is often encountered when configuring
1502 commands to be run. This issue is often encountered when configuring
1498 hooks or extensions for shared repositories or servers. However,
1503 hooks or extensions for shared repositories or servers. However,
1499 the web interface will use some safe settings from the ``[web]``
1504 the web interface will use some safe settings from the ``[web]``
1500 section.
1505 section.
1501
1506
1502 This section specifies what users and groups are trusted. The
1507 This section specifies what users and groups are trusted. The
1503 current user is always trusted. To trust everybody, list a user or a
1508 current user is always trusted. To trust everybody, list a user or a
1504 group with name ``*``. These settings must be placed in an
1509 group with name ``*``. These settings must be placed in an
1505 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1510 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1506 user or service running Mercurial.
1511 user or service running Mercurial.
1507
1512
1508 ``users``
1513 ``users``
1509 Comma-separated list of trusted users.
1514 Comma-separated list of trusted users.
1510
1515
1511 ``groups``
1516 ``groups``
1512 Comma-separated list of trusted groups.
1517 Comma-separated list of trusted groups.
1513
1518
1514
1519
1515 ``ui``
1520 ``ui``
1516 ------
1521 ------
1517
1522
1518 User interface controls.
1523 User interface controls.
1519
1524
1520 ``archivemeta``
1525 ``archivemeta``
1521 Whether to include the .hg_archival.txt file containing meta data
1526 Whether to include the .hg_archival.txt file containing meta data
1522 (hashes for the repository base and for tip) in archives created
1527 (hashes for the repository base and for tip) in archives created
1523 by the :hg:`archive` command or downloaded via hgweb.
1528 by the :hg:`archive` command or downloaded via hgweb.
1524 (default: True)
1529 (default: True)
1525
1530
1526 ``askusername``
1531 ``askusername``
1527 Whether to prompt for a username when committing. If True, and
1532 Whether to prompt for a username when committing. If True, and
1528 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1533 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1529 be prompted to enter a username. If no username is entered, the
1534 be prompted to enter a username. If no username is entered, the
1530 default ``USER@HOST`` is used instead.
1535 default ``USER@HOST`` is used instead.
1531 (default: False)
1536 (default: False)
1532
1537
1533 ``clonebundles``
1538 ``clonebundles``
1534 Whether the "clone bundles" feature is enabled.
1539 Whether the "clone bundles" feature is enabled.
1535
1540
1536 When enabled, :hg:`clone` may download and apply a server-advertised
1541 When enabled, :hg:`clone` may download and apply a server-advertised
1537 bundle file from a URL instead of using the normal exchange mechanism.
1542 bundle file from a URL instead of using the normal exchange mechanism.
1538
1543
1539 This can likely result in faster and more reliable clones.
1544 This can likely result in faster and more reliable clones.
1540
1545
1541 (default: True)
1546 (default: True)
1542
1547
1543 ``clonebundlefallback``
1548 ``clonebundlefallback``
1544 Whether failure to apply an advertised "clone bundle" from a server
1549 Whether failure to apply an advertised "clone bundle" from a server
1545 should result in fallback to a regular clone.
1550 should result in fallback to a regular clone.
1546
1551
1547 This is disabled by default because servers advertising "clone
1552 This is disabled by default because servers advertising "clone
1548 bundles" often do so to reduce server load. If advertised bundles
1553 bundles" often do so to reduce server load. If advertised bundles
1549 start mass failing and clients automatically fall back to a regular
1554 start mass failing and clients automatically fall back to a regular
1550 clone, this would add significant and unexpected load to the server
1555 clone, this would add significant and unexpected load to the server
1551 since the server is expecting clone operations to be offloaded to
1556 since the server is expecting clone operations to be offloaded to
1552 pre-generated bundles. Failing fast (the default behavior) ensures
1557 pre-generated bundles. Failing fast (the default behavior) ensures
1553 clients don't overwhelm the server when "clone bundle" application
1558 clients don't overwhelm the server when "clone bundle" application
1554 fails.
1559 fails.
1555
1560
1556 (default: False)
1561 (default: False)
1557
1562
1558 ``clonebundleprefers``
1563 ``clonebundleprefers``
1559 Defines preferences for which "clone bundles" to use.
1564 Defines preferences for which "clone bundles" to use.
1560
1565
1561 Servers advertising "clone bundles" may advertise multiple available
1566 Servers advertising "clone bundles" may advertise multiple available
1562 bundles. Each bundle may have different attributes, such as the bundle
1567 bundles. Each bundle may have different attributes, such as the bundle
1563 type and compression format. This option is used to prefer a particular
1568 type and compression format. This option is used to prefer a particular
1564 bundle over another.
1569 bundle over another.
1565
1570
1566 The following keys are defined by Mercurial:
1571 The following keys are defined by Mercurial:
1567
1572
1568 BUNDLESPEC
1573 BUNDLESPEC
1569 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1574 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1570 e.g. ``gzip-v2`` or ``bzip2-v1``.
1575 e.g. ``gzip-v2`` or ``bzip2-v1``.
1571
1576
1572 COMPRESSION
1577 COMPRESSION
1573 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1578 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1574
1579
1575 Server operators may define custom keys.
1580 Server operators may define custom keys.
1576
1581
1577 Example values: ``COMPRESSION=bzip2``,
1582 Example values: ``COMPRESSION=bzip2``,
1578 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1583 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1579
1584
1580 By default, the first bundle advertised by the server is used.
1585 By default, the first bundle advertised by the server is used.
1581
1586
1582 ``commitsubrepos``
1587 ``commitsubrepos``
1583 Whether to commit modified subrepositories when committing the
1588 Whether to commit modified subrepositories when committing the
1584 parent repository. If False and one subrepository has uncommitted
1589 parent repository. If False and one subrepository has uncommitted
1585 changes, abort the commit.
1590 changes, abort the commit.
1586 (default: False)
1591 (default: False)
1587
1592
1588 ``debug``
1593 ``debug``
1589 Print debugging information. (default: False)
1594 Print debugging information. (default: False)
1590
1595
1591 ``editor``
1596 ``editor``
1592 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1597 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1593
1598
1594 ``fallbackencoding``
1599 ``fallbackencoding``
1595 Encoding to try if it's not possible to decode the changelog using
1600 Encoding to try if it's not possible to decode the changelog using
1596 UTF-8. (default: ISO-8859-1)
1601 UTF-8. (default: ISO-8859-1)
1597
1602
1598 ``graphnodetemplate``
1603 ``graphnodetemplate``
1599 The template used to print changeset nodes in an ASCII revision graph.
1604 The template used to print changeset nodes in an ASCII revision graph.
1600 (default: ``{graphnode}``)
1605 (default: ``{graphnode}``)
1601
1606
1602 ``ignore``
1607 ``ignore``
1603 A file to read per-user ignore patterns from. This file should be
1608 A file to read per-user ignore patterns from. This file should be
1604 in the same format as a repository-wide .hgignore file. Filenames
1609 in the same format as a repository-wide .hgignore file. Filenames
1605 are relative to the repository root. This option supports hook syntax,
1610 are relative to the repository root. This option supports hook syntax,
1606 so if you want to specify multiple ignore files, you can do so by
1611 so if you want to specify multiple ignore files, you can do so by
1607 setting something like ``ignore.other = ~/.hgignore2``. For details
1612 setting something like ``ignore.other = ~/.hgignore2``. For details
1608 of the ignore file format, see the ``hgignore(5)`` man page.
1613 of the ignore file format, see the ``hgignore(5)`` man page.
1609
1614
1610 ``interactive``
1615 ``interactive``
1611 Allow to prompt the user. (default: True)
1616 Allow to prompt the user. (default: True)
1612
1617
1613 ``interface``
1618 ``interface``
1614 Select the default interface for interactive features (default: text).
1619 Select the default interface for interactive features (default: text).
1615 Possible values are 'text' and 'curses'.
1620 Possible values are 'text' and 'curses'.
1616
1621
1617 ``interface.chunkselector``
1622 ``interface.chunkselector``
1618 Select the interface for change recording (e.g. :hg:`commit` -i).
1623 Select the interface for change recording (e.g. :hg:`commit` -i).
1619 Possible values are 'text' and 'curses'.
1624 Possible values are 'text' and 'curses'.
1620 This config overrides the interface specified by ui.interface.
1625 This config overrides the interface specified by ui.interface.
1621
1626
1622 ``logtemplate``
1627 ``logtemplate``
1623 Template string for commands that print changesets.
1628 Template string for commands that print changesets.
1624
1629
1625 ``merge``
1630 ``merge``
1626 The conflict resolution program to use during a manual merge.
1631 The conflict resolution program to use during a manual merge.
1627 For more information on merge tools see :hg:`help merge-tools`.
1632 For more information on merge tools see :hg:`help merge-tools`.
1628 For configuring merge tools see the ``[merge-tools]`` section.
1633 For configuring merge tools see the ``[merge-tools]`` section.
1629
1634
1630 ``mergemarkers``
1635 ``mergemarkers``
1631 Sets the merge conflict marker label styling. The ``detailed``
1636 Sets the merge conflict marker label styling. The ``detailed``
1632 style uses the ``mergemarkertemplate`` setting to style the labels.
1637 style uses the ``mergemarkertemplate`` setting to style the labels.
1633 The ``basic`` style just uses 'local' and 'other' as the marker label.
1638 The ``basic`` style just uses 'local' and 'other' as the marker label.
1634 One of ``basic`` or ``detailed``.
1639 One of ``basic`` or ``detailed``.
1635 (default: ``basic``)
1640 (default: ``basic``)
1636
1641
1637 ``mergemarkertemplate``
1642 ``mergemarkertemplate``
1638 The template used to print the commit description next to each conflict
1643 The template used to print the commit description next to each conflict
1639 marker during merge conflicts. See :hg:`help templates` for the template
1644 marker during merge conflicts. See :hg:`help templates` for the template
1640 format.
1645 format.
1641
1646
1642 Defaults to showing the hash, tags, branches, bookmarks, author, and
1647 Defaults to showing the hash, tags, branches, bookmarks, author, and
1643 the first line of the commit description.
1648 the first line of the commit description.
1644
1649
1645 If you use non-ASCII characters in names for tags, branches, bookmarks,
1650 If you use non-ASCII characters in names for tags, branches, bookmarks,
1646 authors, and/or commit descriptions, you must pay attention to encodings of
1651 authors, and/or commit descriptions, you must pay attention to encodings of
1647 managed files. At template expansion, non-ASCII characters use the encoding
1652 managed files. At template expansion, non-ASCII characters use the encoding
1648 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1653 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1649 environment variables that govern your locale. If the encoding of the merge
1654 environment variables that govern your locale. If the encoding of the merge
1650 markers is different from the encoding of the merged files,
1655 markers is different from the encoding of the merged files,
1651 serious problems may occur.
1656 serious problems may occur.
1652
1657
1653 ``origbackuppath``
1658 ``origbackuppath``
1654 The path to a directory used to store generated .orig files. If the path is
1659 The path to a directory used to store generated .orig files. If the path is
1655 not a directory, one will be created.
1660 not a directory, one will be created.
1656
1661
1657 ``patch``
1662 ``patch``
1658 An optional external tool that ``hg import`` and some extensions
1663 An optional external tool that ``hg import`` and some extensions
1659 will use for applying patches. By default Mercurial uses an
1664 will use for applying patches. By default Mercurial uses an
1660 internal patch utility. The external tool must work as the common
1665 internal patch utility. The external tool must work as the common
1661 Unix ``patch`` program. In particular, it must accept a ``-p``
1666 Unix ``patch`` program. In particular, it must accept a ``-p``
1662 argument to strip patch headers, a ``-d`` argument to specify the
1667 argument to strip patch headers, a ``-d`` argument to specify the
1663 current directory, a file name to patch, and a patch file to take
1668 current directory, a file name to patch, and a patch file to take
1664 from stdin.
1669 from stdin.
1665
1670
1666 It is possible to specify a patch tool together with extra
1671 It is possible to specify a patch tool together with extra
1667 arguments. For example, setting this option to ``patch --merge``
1672 arguments. For example, setting this option to ``patch --merge``
1668 will use the ``patch`` program with its 2-way merge option.
1673 will use the ``patch`` program with its 2-way merge option.
1669
1674
1670 ``portablefilenames``
1675 ``portablefilenames``
1671 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1676 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1672 (default: ``warn``)
1677 (default: ``warn``)
1673
1678
1674 ``warn``
1679 ``warn``
1675 Print a warning message on POSIX platforms, if a file with a non-portable
1680 Print a warning message on POSIX platforms, if a file with a non-portable
1676 filename is added (e.g. a file with a name that can't be created on
1681 filename is added (e.g. a file with a name that can't be created on
1677 Windows because it contains reserved parts like ``AUX``, reserved
1682 Windows because it contains reserved parts like ``AUX``, reserved
1678 characters like ``:``, or would cause a case collision with an existing
1683 characters like ``:``, or would cause a case collision with an existing
1679 file).
1684 file).
1680
1685
1681 ``ignore``
1686 ``ignore``
1682 Don't print a warning.
1687 Don't print a warning.
1683
1688
1684 ``abort``
1689 ``abort``
1685 The command is aborted.
1690 The command is aborted.
1686
1691
1687 ``true``
1692 ``true``
1688 Alias for ``warn``.
1693 Alias for ``warn``.
1689
1694
1690 ``false``
1695 ``false``
1691 Alias for ``ignore``.
1696 Alias for ``ignore``.
1692
1697
1693 .. container:: windows
1698 .. container:: windows
1694
1699
1695 On Windows, this configuration option is ignored and the command aborted.
1700 On Windows, this configuration option is ignored and the command aborted.
1696
1701
1697 ``quiet``
1702 ``quiet``
1698 Reduce the amount of output printed.
1703 Reduce the amount of output printed.
1699 (default: False)
1704 (default: False)
1700
1705
1701 ``remotecmd``
1706 ``remotecmd``
1702 Remote command to use for clone/push/pull operations.
1707 Remote command to use for clone/push/pull operations.
1703 (default: ``hg``)
1708 (default: ``hg``)
1704
1709
1705 ``report_untrusted``
1710 ``report_untrusted``
1706 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1711 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1707 trusted user or group.
1712 trusted user or group.
1708 (default: True)
1713 (default: True)
1709
1714
1710 ``slash``
1715 ``slash``
1711 Display paths using a slash (``/``) as the path separator. This
1716 Display paths using a slash (``/``) as the path separator. This
1712 only makes a difference on systems where the default path
1717 only makes a difference on systems where the default path
1713 separator is not the slash character (e.g. Windows uses the
1718 separator is not the slash character (e.g. Windows uses the
1714 backslash character (``\``)).
1719 backslash character (``\``)).
1715 (default: False)
1720 (default: False)
1716
1721
1717 ``statuscopies``
1722 ``statuscopies``
1718 Display copies in the status command.
1723 Display copies in the status command.
1719
1724
1720 ``ssh``
1725 ``ssh``
1721 Command to use for SSH connections. (default: ``ssh``)
1726 Command to use for SSH connections. (default: ``ssh``)
1722
1727
1723 ``strict``
1728 ``strict``
1724 Require exact command names, instead of allowing unambiguous
1729 Require exact command names, instead of allowing unambiguous
1725 abbreviations. (default: False)
1730 abbreviations. (default: False)
1726
1731
1727 ``style``
1732 ``style``
1728 Name of style to use for command output.
1733 Name of style to use for command output.
1729
1734
1730 ``supportcontact``
1735 ``supportcontact``
1731 A URL where users should report a Mercurial traceback. Use this if you are a
1736 A URL where users should report a Mercurial traceback. Use this if you are a
1732 large organisation with its own Mercurial deployment process and crash
1737 large organisation with its own Mercurial deployment process and crash
1733 reports should be addressed to your internal support.
1738 reports should be addressed to your internal support.
1734
1739
1735 ``timeout``
1740 ``timeout``
1736 The timeout used when a lock is held (in seconds), a negative value
1741 The timeout used when a lock is held (in seconds), a negative value
1737 means no timeout. (default: 600)
1742 means no timeout. (default: 600)
1738
1743
1739 ``traceback``
1744 ``traceback``
1740 Mercurial always prints a traceback when an unknown exception
1745 Mercurial always prints a traceback when an unknown exception
1741 occurs. Setting this to True will make Mercurial print a traceback
1746 occurs. Setting this to True will make Mercurial print a traceback
1742 on all exceptions, even those recognized by Mercurial (such as
1747 on all exceptions, even those recognized by Mercurial (such as
1743 IOError or MemoryError). (default: False)
1748 IOError or MemoryError). (default: False)
1744
1749
1745 ``username``
1750 ``username``
1746 The committer of a changeset created when running "commit".
1751 The committer of a changeset created when running "commit".
1747 Typically a person's name and email address, e.g. ``Fred Widget
1752 Typically a person's name and email address, e.g. ``Fred Widget
1748 <fred@example.com>``. Environment variables in the
1753 <fred@example.com>``. Environment variables in the
1749 username are expanded.
1754 username are expanded.
1750
1755
1751 (default: ``$EMAIL`` or ``username@hostname``. If the username in
1756 (default: ``$EMAIL`` or ``username@hostname``. If the username in
1752 hgrc is empty, e.g. if the system admin set ``username =`` in the
1757 hgrc is empty, e.g. if the system admin set ``username =`` in the
1753 system hgrc, it has to be specified manually or in a different
1758 system hgrc, it has to be specified manually or in a different
1754 hgrc file)
1759 hgrc file)
1755
1760
1756 ``verbose``
1761 ``verbose``
1757 Increase the amount of output printed. (default: False)
1762 Increase the amount of output printed. (default: False)
1758
1763
1759
1764
1760 ``web``
1765 ``web``
1761 -------
1766 -------
1762
1767
1763 Web interface configuration. The settings in this section apply to
1768 Web interface configuration. The settings in this section apply to
1764 both the builtin webserver (started by :hg:`serve`) and the script you
1769 both the builtin webserver (started by :hg:`serve`) and the script you
1765 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1770 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1766 and WSGI).
1771 and WSGI).
1767
1772
1768 The Mercurial webserver does no authentication (it does not prompt for
1773 The Mercurial webserver does no authentication (it does not prompt for
1769 usernames and passwords to validate *who* users are), but it does do
1774 usernames and passwords to validate *who* users are), but it does do
1770 authorization (it grants or denies access for *authenticated users*
1775 authorization (it grants or denies access for *authenticated users*
1771 based on settings in this section). You must either configure your
1776 based on settings in this section). You must either configure your
1772 webserver to do authentication for you, or disable the authorization
1777 webserver to do authentication for you, or disable the authorization
1773 checks.
1778 checks.
1774
1779
1775 For a quick setup in a trusted environment, e.g., a private LAN, where
1780 For a quick setup in a trusted environment, e.g., a private LAN, where
1776 you want it to accept pushes from anybody, you can use the following
1781 you want it to accept pushes from anybody, you can use the following
1777 command line::
1782 command line::
1778
1783
1779 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1784 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1780
1785
1781 Note that this will allow anybody to push anything to the server and
1786 Note that this will allow anybody to push anything to the server and
1782 that this should not be used for public servers.
1787 that this should not be used for public servers.
1783
1788
1784 The full set of options is:
1789 The full set of options is:
1785
1790
1786 ``accesslog``
1791 ``accesslog``
1787 Where to output the access log. (default: stdout)
1792 Where to output the access log. (default: stdout)
1788
1793
1789 ``address``
1794 ``address``
1790 Interface address to bind to. (default: all)
1795 Interface address to bind to. (default: all)
1791
1796
1792 ``allow_archive``
1797 ``allow_archive``
1793 List of archive format (bz2, gz, zip) allowed for downloading.
1798 List of archive format (bz2, gz, zip) allowed for downloading.
1794 (default: empty)
1799 (default: empty)
1795
1800
1796 ``allowbz2``
1801 ``allowbz2``
1797 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1802 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1798 revisions.
1803 revisions.
1799 (default: False)
1804 (default: False)
1800
1805
1801 ``allowgz``
1806 ``allowgz``
1802 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1807 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1803 revisions.
1808 revisions.
1804 (default: False)
1809 (default: False)
1805
1810
1806 ``allowpull``
1811 ``allowpull``
1807 Whether to allow pulling from the repository. (default: True)
1812 Whether to allow pulling from the repository. (default: True)
1808
1813
1809 ``allow_push``
1814 ``allow_push``
1810 Whether to allow pushing to the repository. If empty or not set,
1815 Whether to allow pushing to the repository. If empty or not set,
1811 pushing is not allowed. If the special value ``*``, any remote
1816 pushing is not allowed. If the special value ``*``, any remote
1812 user can push, including unauthenticated users. Otherwise, the
1817 user can push, including unauthenticated users. Otherwise, the
1813 remote user must have been authenticated, and the authenticated
1818 remote user must have been authenticated, and the authenticated
1814 user name must be present in this list. The contents of the
1819 user name must be present in this list. The contents of the
1815 allow_push list are examined after the deny_push list.
1820 allow_push list are examined after the deny_push list.
1816
1821
1817 ``allow_read``
1822 ``allow_read``
1818 If the user has not already been denied repository access due to
1823 If the user has not already been denied repository access due to
1819 the contents of deny_read, this list determines whether to grant
1824 the contents of deny_read, this list determines whether to grant
1820 repository access to the user. If this list is not empty, and the
1825 repository access to the user. If this list is not empty, and the
1821 user is unauthenticated or not present in the list, then access is
1826 user is unauthenticated or not present in the list, then access is
1822 denied for the user. If the list is empty or not set, then access
1827 denied for the user. If the list is empty or not set, then access
1823 is permitted to all users by default. Setting allow_read to the
1828 is permitted to all users by default. Setting allow_read to the
1824 special value ``*`` is equivalent to it not being set (i.e. access
1829 special value ``*`` is equivalent to it not being set (i.e. access
1825 is permitted to all users). The contents of the allow_read list are
1830 is permitted to all users). The contents of the allow_read list are
1826 examined after the deny_read list.
1831 examined after the deny_read list.
1827
1832
1828 ``allowzip``
1833 ``allowzip``
1829 (DEPRECATED) Whether to allow .zip downloading of repository
1834 (DEPRECATED) Whether to allow .zip downloading of repository
1830 revisions. This feature creates temporary files.
1835 revisions. This feature creates temporary files.
1831 (default: False)
1836 (default: False)
1832
1837
1833 ``archivesubrepos``
1838 ``archivesubrepos``
1834 Whether to recurse into subrepositories when archiving.
1839 Whether to recurse into subrepositories when archiving.
1835 (default: False)
1840 (default: False)
1836
1841
1837 ``baseurl``
1842 ``baseurl``
1838 Base URL to use when publishing URLs in other locations, so
1843 Base URL to use when publishing URLs in other locations, so
1839 third-party tools like email notification hooks can construct
1844 third-party tools like email notification hooks can construct
1840 URLs. Example: ``http://hgserver/repos/``.
1845 URLs. Example: ``http://hgserver/repos/``.
1841
1846
1842 ``cacerts``
1847 ``cacerts``
1843 Path to file containing a list of PEM encoded certificate
1848 Path to file containing a list of PEM encoded certificate
1844 authority certificates. Environment variables and ``~user``
1849 authority certificates. Environment variables and ``~user``
1845 constructs are expanded in the filename. If specified on the
1850 constructs are expanded in the filename. If specified on the
1846 client, then it will verify the identity of remote HTTPS servers
1851 client, then it will verify the identity of remote HTTPS servers
1847 with these certificates.
1852 with these certificates.
1848
1853
1849 To disable SSL verification temporarily, specify ``--insecure`` from
1854 To disable SSL verification temporarily, specify ``--insecure`` from
1850 command line.
1855 command line.
1851
1856
1852 You can use OpenSSL's CA certificate file if your platform has
1857 You can use OpenSSL's CA certificate file if your platform has
1853 one. On most Linux systems this will be
1858 one. On most Linux systems this will be
1854 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1859 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1855 generate this file manually. The form must be as follows::
1860 generate this file manually. The form must be as follows::
1856
1861
1857 -----BEGIN CERTIFICATE-----
1862 -----BEGIN CERTIFICATE-----
1858 ... (certificate in base64 PEM encoding) ...
1863 ... (certificate in base64 PEM encoding) ...
1859 -----END CERTIFICATE-----
1864 -----END CERTIFICATE-----
1860 -----BEGIN CERTIFICATE-----
1865 -----BEGIN CERTIFICATE-----
1861 ... (certificate in base64 PEM encoding) ...
1866 ... (certificate in base64 PEM encoding) ...
1862 -----END CERTIFICATE-----
1867 -----END CERTIFICATE-----
1863
1868
1864 ``cache``
1869 ``cache``
1865 Whether to support caching in hgweb. (default: True)
1870 Whether to support caching in hgweb. (default: True)
1866
1871
1867 ``certificate``
1872 ``certificate``
1868 Certificate to use when running :hg:`serve`.
1873 Certificate to use when running :hg:`serve`.
1869
1874
1870 ``collapse``
1875 ``collapse``
1871 With ``descend`` enabled, repositories in subdirectories are shown at
1876 With ``descend`` enabled, repositories in subdirectories are shown at
1872 a single level alongside repositories in the current path. With
1877 a single level alongside repositories in the current path. With
1873 ``collapse`` also enabled, repositories residing at a deeper level than
1878 ``collapse`` also enabled, repositories residing at a deeper level than
1874 the current path are grouped behind navigable directory entries that
1879 the current path are grouped behind navigable directory entries that
1875 lead to the locations of these repositories. In effect, this setting
1880 lead to the locations of these repositories. In effect, this setting
1876 collapses each collection of repositories found within a subdirectory
1881 collapses each collection of repositories found within a subdirectory
1877 into a single entry for that subdirectory. (default: False)
1882 into a single entry for that subdirectory. (default: False)
1878
1883
1879 ``comparisoncontext``
1884 ``comparisoncontext``
1880 Number of lines of context to show in side-by-side file comparison. If
1885 Number of lines of context to show in side-by-side file comparison. If
1881 negative or the value ``full``, whole files are shown. (default: 5)
1886 negative or the value ``full``, whole files are shown. (default: 5)
1882
1887
1883 This setting can be overridden by a ``context`` request parameter to the
1888 This setting can be overridden by a ``context`` request parameter to the
1884 ``comparison`` command, taking the same values.
1889 ``comparison`` command, taking the same values.
1885
1890
1886 ``contact``
1891 ``contact``
1887 Name or email address of the person in charge of the repository.
1892 Name or email address of the person in charge of the repository.
1888 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
1893 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
1889
1894
1890 ``deny_push``
1895 ``deny_push``
1891 Whether to deny pushing to the repository. If empty or not set,
1896 Whether to deny pushing to the repository. If empty or not set,
1892 push is not denied. If the special value ``*``, all remote users are
1897 push is not denied. If the special value ``*``, all remote users are
1893 denied push. Otherwise, unauthenticated users are all denied, and
1898 denied push. Otherwise, unauthenticated users are all denied, and
1894 any authenticated user name present in this list is also denied. The
1899 any authenticated user name present in this list is also denied. The
1895 contents of the deny_push list are examined before the allow_push list.
1900 contents of the deny_push list are examined before the allow_push list.
1896
1901
1897 ``deny_read``
1902 ``deny_read``
1898 Whether to deny reading/viewing of the repository. If this list is
1903 Whether to deny reading/viewing of the repository. If this list is
1899 not empty, unauthenticated users are all denied, and any
1904 not empty, unauthenticated users are all denied, and any
1900 authenticated user name present in this list is also denied access to
1905 authenticated user name present in this list is also denied access to
1901 the repository. If set to the special value ``*``, all remote users
1906 the repository. If set to the special value ``*``, all remote users
1902 are denied access (rarely needed ;). If deny_read is empty or not set,
1907 are denied access (rarely needed ;). If deny_read is empty or not set,
1903 the determination of repository access depends on the presence and
1908 the determination of repository access depends on the presence and
1904 content of the allow_read list (see description). If both
1909 content of the allow_read list (see description). If both
1905 deny_read and allow_read are empty or not set, then access is
1910 deny_read and allow_read are empty or not set, then access is
1906 permitted to all users by default. If the repository is being
1911 permitted to all users by default. If the repository is being
1907 served via hgwebdir, denied users will not be able to see it in
1912 served via hgwebdir, denied users will not be able to see it in
1908 the list of repositories. The contents of the deny_read list have
1913 the list of repositories. The contents of the deny_read list have
1909 priority over (are examined before) the contents of the allow_read
1914 priority over (are examined before) the contents of the allow_read
1910 list.
1915 list.
1911
1916
1912 ``descend``
1917 ``descend``
1913 hgwebdir indexes will not descend into subdirectories. Only repositories
1918 hgwebdir indexes will not descend into subdirectories. Only repositories
1914 directly in the current path will be shown (other repositories are still
1919 directly in the current path will be shown (other repositories are still
1915 available from the index corresponding to their containing path).
1920 available from the index corresponding to their containing path).
1916
1921
1917 ``description``
1922 ``description``
1918 Textual description of the repository's purpose or contents.
1923 Textual description of the repository's purpose or contents.
1919 (default: "unknown")
1924 (default: "unknown")
1920
1925
1921 ``encoding``
1926 ``encoding``
1922 Character encoding name. (default: the current locale charset)
1927 Character encoding name. (default: the current locale charset)
1923 Example: "UTF-8".
1928 Example: "UTF-8".
1924
1929
1925 ``errorlog``
1930 ``errorlog``
1926 Where to output the error log. (default: stderr)
1931 Where to output the error log. (default: stderr)
1927
1932
1928 ``guessmime``
1933 ``guessmime``
1929 Control MIME types for raw download of file content.
1934 Control MIME types for raw download of file content.
1930 Set to True to let hgweb guess the content type from the file
1935 Set to True to let hgweb guess the content type from the file
1931 extension. This will serve HTML files as ``text/html`` and might
1936 extension. This will serve HTML files as ``text/html`` and might
1932 allow cross-site scripting attacks when serving untrusted
1937 allow cross-site scripting attacks when serving untrusted
1933 repositories. (default: False)
1938 repositories. (default: False)
1934
1939
1935 ``hidden``
1940 ``hidden``
1936 Whether to hide the repository in the hgwebdir index.
1941 Whether to hide the repository in the hgwebdir index.
1937 (default: False)
1942 (default: False)
1938
1943
1939 ``ipv6``
1944 ``ipv6``
1940 Whether to use IPv6. (default: False)
1945 Whether to use IPv6. (default: False)
1941
1946
1942 ``logoimg``
1947 ``logoimg``
1943 File name of the logo image that some templates display on each page.
1948 File name of the logo image that some templates display on each page.
1944 The file name is relative to ``staticurl``. That is, the full path to
1949 The file name is relative to ``staticurl``. That is, the full path to
1945 the logo image is "staticurl/logoimg".
1950 the logo image is "staticurl/logoimg".
1946 If unset, ``hglogo.png`` will be used.
1951 If unset, ``hglogo.png`` will be used.
1947
1952
1948 ``logourl``
1953 ``logourl``
1949 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
1954 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
1950 will be used.
1955 will be used.
1951
1956
1952 ``maxchanges``
1957 ``maxchanges``
1953 Maximum number of changes to list on the changelog. (default: 10)
1958 Maximum number of changes to list on the changelog. (default: 10)
1954
1959
1955 ``maxfiles``
1960 ``maxfiles``
1956 Maximum number of files to list per changeset. (default: 10)
1961 Maximum number of files to list per changeset. (default: 10)
1957
1962
1958 ``maxshortchanges``
1963 ``maxshortchanges``
1959 Maximum number of changes to list on the shortlog, graph or filelog
1964 Maximum number of changes to list on the shortlog, graph or filelog
1960 pages. (default: 60)
1965 pages. (default: 60)
1961
1966
1962 ``name``
1967 ``name``
1963 Repository name to use in the web interface.
1968 Repository name to use in the web interface.
1964 (default: current working directory)
1969 (default: current working directory)
1965
1970
1966 ``port``
1971 ``port``
1967 Port to listen on. (default: 8000)
1972 Port to listen on. (default: 8000)
1968
1973
1969 ``prefix``
1974 ``prefix``
1970 Prefix path to serve from. (default: '' (server root))
1975 Prefix path to serve from. (default: '' (server root))
1971
1976
1972 ``push_ssl``
1977 ``push_ssl``
1973 Whether to require that inbound pushes be transported over SSL to
1978 Whether to require that inbound pushes be transported over SSL to
1974 prevent password sniffing. (default: True)
1979 prevent password sniffing. (default: True)
1975
1980
1976 ``refreshinterval``
1981 ``refreshinterval``
1977 How frequently directory listings re-scan the filesystem for new
1982 How frequently directory listings re-scan the filesystem for new
1978 repositories, in seconds. This is relevant when wildcards are used
1983 repositories, in seconds. This is relevant when wildcards are used
1979 to define paths. Depending on how much filesystem traversal is
1984 to define paths. Depending on how much filesystem traversal is
1980 required, refreshing may negatively impact performance.
1985 required, refreshing may negatively impact performance.
1981
1986
1982 Values less than or equal to 0 always refresh.
1987 Values less than or equal to 0 always refresh.
1983 (default: 20)
1988 (default: 20)
1984
1989
1985 ``staticurl``
1990 ``staticurl``
1986 Base URL to use for static files. If unset, static files (e.g. the
1991 Base URL to use for static files. If unset, static files (e.g. the
1987 hgicon.png favicon) will be served by the CGI script itself. Use
1992 hgicon.png favicon) will be served by the CGI script itself. Use
1988 this setting to serve them directly with the HTTP server.
1993 this setting to serve them directly with the HTTP server.
1989 Example: ``http://hgserver/static/``.
1994 Example: ``http://hgserver/static/``.
1990
1995
1991 ``stripes``
1996 ``stripes``
1992 How many lines a "zebra stripe" should span in multi-line output.
1997 How many lines a "zebra stripe" should span in multi-line output.
1993 Set to 0 to disable. (default: 1)
1998 Set to 0 to disable. (default: 1)
1994
1999
1995 ``style``
2000 ``style``
1996 Which template map style to use. The available options are the names of
2001 Which template map style to use. The available options are the names of
1997 subdirectories in the HTML templates path. (default: ``paper``)
2002 subdirectories in the HTML templates path. (default: ``paper``)
1998 Example: ``monoblue``.
2003 Example: ``monoblue``.
1999
2004
2000 ``templates``
2005 ``templates``
2001 Where to find the HTML templates. The default path to the HTML templates
2006 Where to find the HTML templates. The default path to the HTML templates
2002 can be obtained from ``hg debuginstall``.
2007 can be obtained from ``hg debuginstall``.
2003
2008
2004 ``websub``
2009 ``websub``
2005 ----------
2010 ----------
2006
2011
2007 Web substitution filter definition. You can use this section to
2012 Web substitution filter definition. You can use this section to
2008 define a set of regular expression substitution patterns which
2013 define a set of regular expression substitution patterns which
2009 let you automatically modify the hgweb server output.
2014 let you automatically modify the hgweb server output.
2010
2015
2011 The default hgweb templates only apply these substitution patterns
2016 The default hgweb templates only apply these substitution patterns
2012 on the revision description fields. You can apply them anywhere
2017 on the revision description fields. You can apply them anywhere
2013 you want when you create your own templates by adding calls to the
2018 you want when you create your own templates by adding calls to the
2014 "websub" filter (usually after calling the "escape" filter).
2019 "websub" filter (usually after calling the "escape" filter).
2015
2020
2016 This can be used, for example, to convert issue references to links
2021 This can be used, for example, to convert issue references to links
2017 to your issue tracker, or to convert "markdown-like" syntax into
2022 to your issue tracker, or to convert "markdown-like" syntax into
2018 HTML (see the examples below).
2023 HTML (see the examples below).
2019
2024
2020 Each entry in this section names a substitution filter.
2025 Each entry in this section names a substitution filter.
2021 The value of each entry defines the substitution expression itself.
2026 The value of each entry defines the substitution expression itself.
2022 The websub expressions follow the old interhg extension syntax,
2027 The websub expressions follow the old interhg extension syntax,
2023 which in turn imitates the Unix sed replacement syntax::
2028 which in turn imitates the Unix sed replacement syntax::
2024
2029
2025 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2030 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2026
2031
2027 You can use any separator other than "/". The final "i" is optional
2032 You can use any separator other than "/". The final "i" is optional
2028 and indicates that the search must be case insensitive.
2033 and indicates that the search must be case insensitive.
2029
2034
2030 Examples::
2035 Examples::
2031
2036
2032 [websub]
2037 [websub]
2033 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2038 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2034 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2039 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2035 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2040 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2036
2041
2037 ``worker``
2042 ``worker``
2038 ----------
2043 ----------
2039
2044
2040 Parallel master/worker configuration. We currently perform working
2045 Parallel master/worker configuration. We currently perform working
2041 directory updates in parallel on Unix-like systems, which greatly
2046 directory updates in parallel on Unix-like systems, which greatly
2042 helps performance.
2047 helps performance.
2043
2048
2044 ``numcpus``
2049 ``numcpus``
2045 Number of CPUs to use for parallel operations. A zero or
2050 Number of CPUs to use for parallel operations. A zero or
2046 negative value is treated as ``use the default``.
2051 negative value is treated as ``use the default``.
2047 (default: 4 or the number of CPUs on the system, whichever is larger)
2052 (default: 4 or the number of CPUs on the system, whichever is larger)
2048
2053
2049 ``backgroundclose``
2054 ``backgroundclose``
2050 Whether to enable closing file handles on background threads during certain
2055 Whether to enable closing file handles on background threads during certain
2051 operations. Some platforms aren't very efficient at closing file
2056 operations. Some platforms aren't very efficient at closing file
2052 handles that have been written or appended to. By performing file closing
2057 handles that have been written or appended to. By performing file closing
2053 on background threads, file write rate can increase substantially.
2058 on background threads, file write rate can increase substantially.
2054 (default: true on Windows, false elsewhere)
2059 (default: true on Windows, false elsewhere)
2055
2060
2056 ``backgroundcloseminfilecount``
2061 ``backgroundcloseminfilecount``
2057 Minimum number of files required to trigger background file closing.
2062 Minimum number of files required to trigger background file closing.
2058 Operations not writing this many files won't start background close
2063 Operations not writing this many files won't start background close
2059 threads.
2064 threads.
2060 (default: 2048)
2065 (default: 2048)
2061
2066
2062 ``backgroundclosemaxqueue``
2067 ``backgroundclosemaxqueue``
2063 The maximum number of opened file handles waiting to be closed in the
2068 The maximum number of opened file handles waiting to be closed in the
2064 background. This option only has an effect if ``backgroundclose`` is
2069 background. This option only has an effect if ``backgroundclose`` is
2065 enabled.
2070 enabled.
2066 (default: 384)
2071 (default: 384)
2067
2072
2068 ``backgroundclosethreadcount``
2073 ``backgroundclosethreadcount``
2069 Number of threads to process background file closes. Only relevant if
2074 Number of threads to process background file closes. Only relevant if
2070 ``backgroundclose`` is enabled.
2075 ``backgroundclose`` is enabled.
2071 (default: 4)
2076 (default: 4)
@@ -1,123 +1,143 b''
1 Mercurial allows you to customize output of commands through
1 Mercurial allows you to customize output of commands through
2 templates. You can either pass in a template or select an existing
2 templates. You can either pass in a template or select an existing
3 template-style from the command line, via the --template option.
3 template-style from the command line, via the --template option.
4
4
5 You can customize output for any "log-like" command: log,
5 You can customize output for any "log-like" command: log,
6 outgoing, incoming, tip, parents, and heads.
6 outgoing, incoming, tip, parents, and heads.
7
7
8 Some built-in styles are packaged with Mercurial. These can be listed
8 Some built-in styles are packaged with Mercurial. These can be listed
9 with :hg:`log --template list`. Example usage::
9 with :hg:`log --template list`. Example usage::
10
10
11 $ hg log -r1.0::1.1 --template changelog
11 $ hg log -r1.0::1.1 --template changelog
12
12
13 A template is a piece of text, with markup to invoke variable
13 A template is a piece of text, with markup to invoke variable
14 expansion::
14 expansion::
15
15
16 $ hg log -r1 --template "{node}\n"
16 $ hg log -r1 --template "{node}\n"
17 b56ce7b07c52de7d5fd79fb89701ea538af65746
17 b56ce7b07c52de7d5fd79fb89701ea538af65746
18
18
19 Strings in curly braces are called keywords. The availability of
19 Strings in curly braces are called keywords. The availability of
20 keywords depends on the exact context of the templater. These
20 keywords depends on the exact context of the templater. These
21 keywords are usually available for templating a log-like command:
21 keywords are usually available for templating a log-like command:
22
22
23 .. keywordsmarker
23 .. keywordsmarker
24
24
25 The "date" keyword does not produce human-readable output. If you
25 The "date" keyword does not produce human-readable output. If you
26 want to use a date in your output, you can use a filter to process
26 want to use a date in your output, you can use a filter to process
27 it. Filters are functions which return a string based on the input
27 it. Filters are functions which return a string based on the input
28 variable. Be sure to use the stringify filter first when you're
28 variable. Be sure to use the stringify filter first when you're
29 applying a string-input filter to a list-like input variable.
29 applying a string-input filter to a list-like input variable.
30 You can also use a chain of filters to get the desired output::
30 You can also use a chain of filters to get the desired output::
31
31
32 $ hg tip --template "{date|isodate}\n"
32 $ hg tip --template "{date|isodate}\n"
33 2008-08-21 18:22 +0000
33 2008-08-21 18:22 +0000
34
34
35 List of filters:
35 List of filters:
36
36
37 .. filtersmarker
37 .. filtersmarker
38
38
39 Note that a filter is nothing more than a function call, i.e.
39 Note that a filter is nothing more than a function call, i.e.
40 ``expr|filter`` is equivalent to ``filter(expr)``.
40 ``expr|filter`` is equivalent to ``filter(expr)``.
41
41
42 In addition to filters, there are some basic built-in functions:
42 In addition to filters, there are some basic built-in functions:
43
43
44 .. functionsmarker
44 .. functionsmarker
45
45
46 Also, for any expression that returns a list, there is a list operator::
46 Also, for any expression that returns a list, there is a list operator::
47
47
48 expr % "{template}"
48 expr % "{template}"
49
49
50 As seen in the above example, ``{template}`` is interpreted as a template.
50 As seen in the above example, ``{template}`` is interpreted as a template.
51 To prevent it from being interpreted, you can use an escape character ``\{``
51 To prevent it from being interpreted, you can use an escape character ``\{``
52 or a raw string prefix, ``r'...'``.
52 or a raw string prefix, ``r'...'``.
53
53
54 New keywords and functions can be defined in the ``templatealias`` section of
55 a Mercurial configuration file::
56
57 <alias> = <definition>
58
59 Arguments of the form `a1`, `a2`, etc. are substituted from the alias into
60 the definition.
61
62 For example,
63
64 ::
65
66 [templatealias]
67 r = rev
68 rn = "{r}:{node|short}"
69 leftpad(s, w) = pad(s, w, ' ', True)
70
71 defines two symbol aliases, ``r`` and ``rn``, and a function alias
72 ``leftpad()``.
73
54 Some sample command line templates:
74 Some sample command line templates:
55
75
56 - Format lists, e.g. files::
76 - Format lists, e.g. files::
57
77
58 $ hg log -r 0 --template "files:\n{files % ' {file}\n'}"
78 $ hg log -r 0 --template "files:\n{files % ' {file}\n'}"
59
79
60 - Join the list of files with a ", "::
80 - Join the list of files with a ", "::
61
81
62 $ hg log -r 0 --template "files: {join(files, ', ')}\n"
82 $ hg log -r 0 --template "files: {join(files, ', ')}\n"
63
83
64 - Modify each line of a commit description::
84 - Modify each line of a commit description::
65
85
66 $ hg log --template "{splitlines(desc) % '**** {line}\n'}"
86 $ hg log --template "{splitlines(desc) % '**** {line}\n'}"
67
87
68 - Format date::
88 - Format date::
69
89
70 $ hg log -r 0 --template "{date(date, '%Y')}\n"
90 $ hg log -r 0 --template "{date(date, '%Y')}\n"
71
91
72 - Display date in UTC::
92 - Display date in UTC::
73
93
74 $ hg log -r 0 --template "{localdate(date, 'UTC')|date}\n"
94 $ hg log -r 0 --template "{localdate(date, 'UTC')|date}\n"
75
95
76 - Output the description set to a fill-width of 30::
96 - Output the description set to a fill-width of 30::
77
97
78 $ hg log -r 0 --template "{fill(desc, 30)}"
98 $ hg log -r 0 --template "{fill(desc, 30)}"
79
99
80 - Use a conditional to test for the default branch::
100 - Use a conditional to test for the default branch::
81
101
82 $ hg log -r 0 --template "{ifeq(branch, 'default', 'on the main branch',
102 $ hg log -r 0 --template "{ifeq(branch, 'default', 'on the main branch',
83 'on branch {branch}')}\n"
103 'on branch {branch}')}\n"
84
104
85 - Append a newline if not empty::
105 - Append a newline if not empty::
86
106
87 $ hg tip --template "{if(author, '{author}\n')}"
107 $ hg tip --template "{if(author, '{author}\n')}"
88
108
89 - Label the output for use with the color extension::
109 - Label the output for use with the color extension::
90
110
91 $ hg log -r 0 --template "{label('changeset.{phase}', node|short)}\n"
111 $ hg log -r 0 --template "{label('changeset.{phase}', node|short)}\n"
92
112
93 - Invert the firstline filter, i.e. everything but the first line::
113 - Invert the firstline filter, i.e. everything but the first line::
94
114
95 $ hg log -r 0 --template "{sub(r'^.*\n?\n?', '', desc)}\n"
115 $ hg log -r 0 --template "{sub(r'^.*\n?\n?', '', desc)}\n"
96
116
97 - Display the contents of the 'extra' field, one per line::
117 - Display the contents of the 'extra' field, one per line::
98
118
99 $ hg log -r 0 --template "{join(extras, '\n')}\n"
119 $ hg log -r 0 --template "{join(extras, '\n')}\n"
100
120
101 - Mark the active bookmark with '*'::
121 - Mark the active bookmark with '*'::
102
122
103 $ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, active, '*')} '}\n"
123 $ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, active, '*')} '}\n"
104
124
105 - Find the previous release candidate tag, the distance and changes since the tag::
125 - Find the previous release candidate tag, the distance and changes since the tag::
106
126
107 $ hg log -r . --template "{latesttag('re:^.*-rc$') % '{tag}, {changes}, {distance}'}\n"
127 $ hg log -r . --template "{latesttag('re:^.*-rc$') % '{tag}, {changes}, {distance}'}\n"
108
128
109 - Mark the working copy parent with '@'::
129 - Mark the working copy parent with '@'::
110
130
111 $ hg log --template "{ifcontains(rev, revset('.'), '@')}\n"
131 $ hg log --template "{ifcontains(rev, revset('.'), '@')}\n"
112
132
113 - Show details of parent revisions::
133 - Show details of parent revisions::
114
134
115 $ hg log --template "{revset('parents(%d)', rev) % '{desc|firstline}\n'}"
135 $ hg log --template "{revset('parents(%d)', rev) % '{desc|firstline}\n'}"
116
136
117 - Show only commit descriptions that start with "template"::
137 - Show only commit descriptions that start with "template"::
118
138
119 $ hg log --template "{startswith('template', firstline(desc))}\n"
139 $ hg log --template "{startswith('template', firstline(desc))}\n"
120
140
121 - Print the first word of each line of a commit message::
141 - Print the first word of each line of a commit message::
122
142
123 $ hg log --template "{word(0, desc)}\n"
143 $ hg log --template "{word(0, desc)}\n"
@@ -1,1135 +1,1142 b''
1 # templater.py - template expansion for output
1 # templater.py - template expansion for output
2 #
2 #
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import os
10 import os
11 import re
11 import re
12 import types
12 import types
13
13
14 from .i18n import _
14 from .i18n import _
15 from . import (
15 from . import (
16 config,
16 config,
17 error,
17 error,
18 minirst,
18 minirst,
19 parser,
19 parser,
20 registrar,
20 registrar,
21 revset as revsetmod,
21 revset as revsetmod,
22 templatefilters,
22 templatefilters,
23 templatekw,
23 templatekw,
24 util,
24 util,
25 )
25 )
26
26
27 # template parsing
27 # template parsing
28
28
29 elements = {
29 elements = {
30 # token-type: binding-strength, primary, prefix, infix, suffix
30 # token-type: binding-strength, primary, prefix, infix, suffix
31 "(": (20, None, ("group", 1, ")"), ("func", 1, ")"), None),
31 "(": (20, None, ("group", 1, ")"), ("func", 1, ")"), None),
32 ",": (2, None, None, ("list", 2), None),
32 ",": (2, None, None, ("list", 2), None),
33 "|": (5, None, None, ("|", 5), None),
33 "|": (5, None, None, ("|", 5), None),
34 "%": (6, None, None, ("%", 6), None),
34 "%": (6, None, None, ("%", 6), None),
35 ")": (0, None, None, None, None),
35 ")": (0, None, None, None, None),
36 "integer": (0, "integer", None, None, None),
36 "integer": (0, "integer", None, None, None),
37 "symbol": (0, "symbol", None, None, None),
37 "symbol": (0, "symbol", None, None, None),
38 "string": (0, "string", None, None, None),
38 "string": (0, "string", None, None, None),
39 "template": (0, "template", None, None, None),
39 "template": (0, "template", None, None, None),
40 "end": (0, None, None, None, None),
40 "end": (0, None, None, None, None),
41 }
41 }
42
42
43 def tokenize(program, start, end, term=None):
43 def tokenize(program, start, end, term=None):
44 """Parse a template expression into a stream of tokens, which must end
44 """Parse a template expression into a stream of tokens, which must end
45 with term if specified"""
45 with term if specified"""
46 pos = start
46 pos = start
47 while pos < end:
47 while pos < end:
48 c = program[pos]
48 c = program[pos]
49 if c.isspace(): # skip inter-token whitespace
49 if c.isspace(): # skip inter-token whitespace
50 pass
50 pass
51 elif c in "(,)%|": # handle simple operators
51 elif c in "(,)%|": # handle simple operators
52 yield (c, None, pos)
52 yield (c, None, pos)
53 elif c in '"\'': # handle quoted templates
53 elif c in '"\'': # handle quoted templates
54 s = pos + 1
54 s = pos + 1
55 data, pos = _parsetemplate(program, s, end, c)
55 data, pos = _parsetemplate(program, s, end, c)
56 yield ('template', data, s)
56 yield ('template', data, s)
57 pos -= 1
57 pos -= 1
58 elif c == 'r' and program[pos:pos + 2] in ("r'", 'r"'):
58 elif c == 'r' and program[pos:pos + 2] in ("r'", 'r"'):
59 # handle quoted strings
59 # handle quoted strings
60 c = program[pos + 1]
60 c = program[pos + 1]
61 s = pos = pos + 2
61 s = pos = pos + 2
62 while pos < end: # find closing quote
62 while pos < end: # find closing quote
63 d = program[pos]
63 d = program[pos]
64 if d == '\\': # skip over escaped characters
64 if d == '\\': # skip over escaped characters
65 pos += 2
65 pos += 2
66 continue
66 continue
67 if d == c:
67 if d == c:
68 yield ('string', program[s:pos], s)
68 yield ('string', program[s:pos], s)
69 break
69 break
70 pos += 1
70 pos += 1
71 else:
71 else:
72 raise error.ParseError(_("unterminated string"), s)
72 raise error.ParseError(_("unterminated string"), s)
73 elif c.isdigit() or c == '-':
73 elif c.isdigit() or c == '-':
74 s = pos
74 s = pos
75 if c == '-': # simply take negate operator as part of integer
75 if c == '-': # simply take negate operator as part of integer
76 pos += 1
76 pos += 1
77 if pos >= end or not program[pos].isdigit():
77 if pos >= end or not program[pos].isdigit():
78 raise error.ParseError(_("integer literal without digits"), s)
78 raise error.ParseError(_("integer literal without digits"), s)
79 pos += 1
79 pos += 1
80 while pos < end:
80 while pos < end:
81 d = program[pos]
81 d = program[pos]
82 if not d.isdigit():
82 if not d.isdigit():
83 break
83 break
84 pos += 1
84 pos += 1
85 yield ('integer', program[s:pos], s)
85 yield ('integer', program[s:pos], s)
86 pos -= 1
86 pos -= 1
87 elif (c == '\\' and program[pos:pos + 2] in (r"\'", r'\"')
87 elif (c == '\\' and program[pos:pos + 2] in (r"\'", r'\"')
88 or c == 'r' and program[pos:pos + 3] in (r"r\'", r'r\"')):
88 or c == 'r' and program[pos:pos + 3] in (r"r\'", r'r\"')):
89 # handle escaped quoted strings for compatibility with 2.9.2-3.4,
89 # handle escaped quoted strings for compatibility with 2.9.2-3.4,
90 # where some of nested templates were preprocessed as strings and
90 # where some of nested templates were preprocessed as strings and
91 # then compiled. therefore, \"...\" was allowed. (issue4733)
91 # then compiled. therefore, \"...\" was allowed. (issue4733)
92 #
92 #
93 # processing flow of _evalifliteral() at 5ab28a2e9962:
93 # processing flow of _evalifliteral() at 5ab28a2e9962:
94 # outer template string -> stringify() -> compiletemplate()
94 # outer template string -> stringify() -> compiletemplate()
95 # ------------------------ ------------ ------------------
95 # ------------------------ ------------ ------------------
96 # {f("\\\\ {g(\"\\\"\")}"} \\ {g("\"")} [r'\\', {g("\"")}]
96 # {f("\\\\ {g(\"\\\"\")}"} \\ {g("\"")} [r'\\', {g("\"")}]
97 # ~~~~~~~~
97 # ~~~~~~~~
98 # escaped quoted string
98 # escaped quoted string
99 if c == 'r':
99 if c == 'r':
100 pos += 1
100 pos += 1
101 token = 'string'
101 token = 'string'
102 else:
102 else:
103 token = 'template'
103 token = 'template'
104 quote = program[pos:pos + 2]
104 quote = program[pos:pos + 2]
105 s = pos = pos + 2
105 s = pos = pos + 2
106 while pos < end: # find closing escaped quote
106 while pos < end: # find closing escaped quote
107 if program.startswith('\\\\\\', pos, end):
107 if program.startswith('\\\\\\', pos, end):
108 pos += 4 # skip over double escaped characters
108 pos += 4 # skip over double escaped characters
109 continue
109 continue
110 if program.startswith(quote, pos, end):
110 if program.startswith(quote, pos, end):
111 # interpret as if it were a part of an outer string
111 # interpret as if it were a part of an outer string
112 data = parser.unescapestr(program[s:pos])
112 data = parser.unescapestr(program[s:pos])
113 if token == 'template':
113 if token == 'template':
114 data = _parsetemplate(data, 0, len(data))[0]
114 data = _parsetemplate(data, 0, len(data))[0]
115 yield (token, data, s)
115 yield (token, data, s)
116 pos += 1
116 pos += 1
117 break
117 break
118 pos += 1
118 pos += 1
119 else:
119 else:
120 raise error.ParseError(_("unterminated string"), s)
120 raise error.ParseError(_("unterminated string"), s)
121 elif c.isalnum() or c in '_':
121 elif c.isalnum() or c in '_':
122 s = pos
122 s = pos
123 pos += 1
123 pos += 1
124 while pos < end: # find end of symbol
124 while pos < end: # find end of symbol
125 d = program[pos]
125 d = program[pos]
126 if not (d.isalnum() or d == "_"):
126 if not (d.isalnum() or d == "_"):
127 break
127 break
128 pos += 1
128 pos += 1
129 sym = program[s:pos]
129 sym = program[s:pos]
130 yield ('symbol', sym, s)
130 yield ('symbol', sym, s)
131 pos -= 1
131 pos -= 1
132 elif c == term:
132 elif c == term:
133 yield ('end', None, pos + 1)
133 yield ('end', None, pos + 1)
134 return
134 return
135 else:
135 else:
136 raise error.ParseError(_("syntax error"), pos)
136 raise error.ParseError(_("syntax error"), pos)
137 pos += 1
137 pos += 1
138 if term:
138 if term:
139 raise error.ParseError(_("unterminated template expansion"), start)
139 raise error.ParseError(_("unterminated template expansion"), start)
140 yield ('end', None, pos)
140 yield ('end', None, pos)
141
141
142 def _parsetemplate(tmpl, start, stop, quote=''):
142 def _parsetemplate(tmpl, start, stop, quote=''):
143 r"""
143 r"""
144 >>> _parsetemplate('foo{bar}"baz', 0, 12)
144 >>> _parsetemplate('foo{bar}"baz', 0, 12)
145 ([('string', 'foo'), ('symbol', 'bar'), ('string', '"baz')], 12)
145 ([('string', 'foo'), ('symbol', 'bar'), ('string', '"baz')], 12)
146 >>> _parsetemplate('foo{bar}"baz', 0, 12, quote='"')
146 >>> _parsetemplate('foo{bar}"baz', 0, 12, quote='"')
147 ([('string', 'foo'), ('symbol', 'bar')], 9)
147 ([('string', 'foo'), ('symbol', 'bar')], 9)
148 >>> _parsetemplate('foo"{bar}', 0, 9, quote='"')
148 >>> _parsetemplate('foo"{bar}', 0, 9, quote='"')
149 ([('string', 'foo')], 4)
149 ([('string', 'foo')], 4)
150 >>> _parsetemplate(r'foo\"bar"baz', 0, 12, quote='"')
150 >>> _parsetemplate(r'foo\"bar"baz', 0, 12, quote='"')
151 ([('string', 'foo"'), ('string', 'bar')], 9)
151 ([('string', 'foo"'), ('string', 'bar')], 9)
152 >>> _parsetemplate(r'foo\\"bar', 0, 10, quote='"')
152 >>> _parsetemplate(r'foo\\"bar', 0, 10, quote='"')
153 ([('string', 'foo\\')], 6)
153 ([('string', 'foo\\')], 6)
154 """
154 """
155 parsed = []
155 parsed = []
156 sepchars = '{' + quote
156 sepchars = '{' + quote
157 pos = start
157 pos = start
158 p = parser.parser(elements)
158 p = parser.parser(elements)
159 while pos < stop:
159 while pos < stop:
160 n = min((tmpl.find(c, pos, stop) for c in sepchars),
160 n = min((tmpl.find(c, pos, stop) for c in sepchars),
161 key=lambda n: (n < 0, n))
161 key=lambda n: (n < 0, n))
162 if n < 0:
162 if n < 0:
163 parsed.append(('string', parser.unescapestr(tmpl[pos:stop])))
163 parsed.append(('string', parser.unescapestr(tmpl[pos:stop])))
164 pos = stop
164 pos = stop
165 break
165 break
166 c = tmpl[n]
166 c = tmpl[n]
167 bs = (n - pos) - len(tmpl[pos:n].rstrip('\\'))
167 bs = (n - pos) - len(tmpl[pos:n].rstrip('\\'))
168 if bs % 2 == 1:
168 if bs % 2 == 1:
169 # escaped (e.g. '\{', '\\\{', but not '\\{')
169 # escaped (e.g. '\{', '\\\{', but not '\\{')
170 parsed.append(('string', parser.unescapestr(tmpl[pos:n - 1]) + c))
170 parsed.append(('string', parser.unescapestr(tmpl[pos:n - 1]) + c))
171 pos = n + 1
171 pos = n + 1
172 continue
172 continue
173 if n > pos:
173 if n > pos:
174 parsed.append(('string', parser.unescapestr(tmpl[pos:n])))
174 parsed.append(('string', parser.unescapestr(tmpl[pos:n])))
175 if c == quote:
175 if c == quote:
176 return parsed, n + 1
176 return parsed, n + 1
177
177
178 parseres, pos = p.parse(tokenize(tmpl, n + 1, stop, '}'))
178 parseres, pos = p.parse(tokenize(tmpl, n + 1, stop, '}'))
179 parsed.append(parseres)
179 parsed.append(parseres)
180
180
181 if quote:
181 if quote:
182 raise error.ParseError(_("unterminated string"), start)
182 raise error.ParseError(_("unterminated string"), start)
183 return parsed, pos
183 return parsed, pos
184
184
185 def _unnesttemplatelist(tree):
185 def _unnesttemplatelist(tree):
186 """Expand list of templates to node tuple
186 """Expand list of templates to node tuple
187
187
188 >>> def f(tree):
188 >>> def f(tree):
189 ... print prettyformat(_unnesttemplatelist(tree))
189 ... print prettyformat(_unnesttemplatelist(tree))
190 >>> f(('template', []))
190 >>> f(('template', []))
191 ('string', '')
191 ('string', '')
192 >>> f(('template', [('string', 'foo')]))
192 >>> f(('template', [('string', 'foo')]))
193 ('string', 'foo')
193 ('string', 'foo')
194 >>> f(('template', [('string', 'foo'), ('symbol', 'rev')]))
194 >>> f(('template', [('string', 'foo'), ('symbol', 'rev')]))
195 (template
195 (template
196 ('string', 'foo')
196 ('string', 'foo')
197 ('symbol', 'rev'))
197 ('symbol', 'rev'))
198 >>> f(('template', [('symbol', 'rev')])) # template(rev) -> str
198 >>> f(('template', [('symbol', 'rev')])) # template(rev) -> str
199 (template
199 (template
200 ('symbol', 'rev'))
200 ('symbol', 'rev'))
201 >>> f(('template', [('template', [('string', 'foo')])]))
201 >>> f(('template', [('template', [('string', 'foo')])]))
202 ('string', 'foo')
202 ('string', 'foo')
203 """
203 """
204 if not isinstance(tree, tuple):
204 if not isinstance(tree, tuple):
205 return tree
205 return tree
206 op = tree[0]
206 op = tree[0]
207 if op != 'template':
207 if op != 'template':
208 return (op,) + tuple(_unnesttemplatelist(x) for x in tree[1:])
208 return (op,) + tuple(_unnesttemplatelist(x) for x in tree[1:])
209
209
210 assert len(tree) == 2
210 assert len(tree) == 2
211 xs = tuple(_unnesttemplatelist(x) for x in tree[1])
211 xs = tuple(_unnesttemplatelist(x) for x in tree[1])
212 if not xs:
212 if not xs:
213 return ('string', '') # empty template ""
213 return ('string', '') # empty template ""
214 elif len(xs) == 1 and xs[0][0] == 'string':
214 elif len(xs) == 1 and xs[0][0] == 'string':
215 return xs[0] # fast path for string with no template fragment "x"
215 return xs[0] # fast path for string with no template fragment "x"
216 else:
216 else:
217 return (op,) + xs
217 return (op,) + xs
218
218
219 def parse(tmpl):
219 def parse(tmpl):
220 """Parse template string into tree"""
220 """Parse template string into tree"""
221 parsed, pos = _parsetemplate(tmpl, 0, len(tmpl))
221 parsed, pos = _parsetemplate(tmpl, 0, len(tmpl))
222 assert pos == len(tmpl), 'unquoted template should be consumed'
222 assert pos == len(tmpl), 'unquoted template should be consumed'
223 return _unnesttemplatelist(('template', parsed))
223 return _unnesttemplatelist(('template', parsed))
224
224
225 def _parseexpr(expr):
225 def _parseexpr(expr):
226 """Parse a template expression into tree
226 """Parse a template expression into tree
227
227
228 >>> _parseexpr('"foo"')
228 >>> _parseexpr('"foo"')
229 ('string', 'foo')
229 ('string', 'foo')
230 >>> _parseexpr('foo(bar)')
230 >>> _parseexpr('foo(bar)')
231 ('func', ('symbol', 'foo'), ('symbol', 'bar'))
231 ('func', ('symbol', 'foo'), ('symbol', 'bar'))
232 >>> _parseexpr('foo(')
232 >>> _parseexpr('foo(')
233 Traceback (most recent call last):
233 Traceback (most recent call last):
234 ...
234 ...
235 ParseError: ('not a prefix: end', 4)
235 ParseError: ('not a prefix: end', 4)
236 >>> _parseexpr('"foo" "bar"')
236 >>> _parseexpr('"foo" "bar"')
237 Traceback (most recent call last):
237 Traceback (most recent call last):
238 ...
238 ...
239 ParseError: ('invalid token', 7)
239 ParseError: ('invalid token', 7)
240 """
240 """
241 p = parser.parser(elements)
241 p = parser.parser(elements)
242 tree, pos = p.parse(tokenize(expr, 0, len(expr)))
242 tree, pos = p.parse(tokenize(expr, 0, len(expr)))
243 if pos != len(expr):
243 if pos != len(expr):
244 raise error.ParseError(_('invalid token'), pos)
244 raise error.ParseError(_('invalid token'), pos)
245 return _unnesttemplatelist(tree)
245 return _unnesttemplatelist(tree)
246
246
247 def prettyformat(tree):
247 def prettyformat(tree):
248 return parser.prettyformat(tree, ('integer', 'string', 'symbol'))
248 return parser.prettyformat(tree, ('integer', 'string', 'symbol'))
249
249
250 def compileexp(exp, context, curmethods):
250 def compileexp(exp, context, curmethods):
251 """Compile parsed template tree to (func, data) pair"""
251 """Compile parsed template tree to (func, data) pair"""
252 t = exp[0]
252 t = exp[0]
253 if t in curmethods:
253 if t in curmethods:
254 return curmethods[t](exp, context)
254 return curmethods[t](exp, context)
255 raise error.ParseError(_("unknown method '%s'") % t)
255 raise error.ParseError(_("unknown method '%s'") % t)
256
256
257 # template evaluation
257 # template evaluation
258
258
259 def getsymbol(exp):
259 def getsymbol(exp):
260 if exp[0] == 'symbol':
260 if exp[0] == 'symbol':
261 return exp[1]
261 return exp[1]
262 raise error.ParseError(_("expected a symbol, got '%s'") % exp[0])
262 raise error.ParseError(_("expected a symbol, got '%s'") % exp[0])
263
263
264 def getlist(x):
264 def getlist(x):
265 if not x:
265 if not x:
266 return []
266 return []
267 if x[0] == 'list':
267 if x[0] == 'list':
268 return getlist(x[1]) + [x[2]]
268 return getlist(x[1]) + [x[2]]
269 return [x]
269 return [x]
270
270
271 def gettemplate(exp, context):
271 def gettemplate(exp, context):
272 """Compile given template tree or load named template from map file;
272 """Compile given template tree or load named template from map file;
273 returns (func, data) pair"""
273 returns (func, data) pair"""
274 if exp[0] in ('template', 'string'):
274 if exp[0] in ('template', 'string'):
275 return compileexp(exp, context, methods)
275 return compileexp(exp, context, methods)
276 if exp[0] == 'symbol':
276 if exp[0] == 'symbol':
277 # unlike runsymbol(), here 'symbol' is always taken as template name
277 # unlike runsymbol(), here 'symbol' is always taken as template name
278 # even if it exists in mapping. this allows us to override mapping
278 # even if it exists in mapping. this allows us to override mapping
279 # by web templates, e.g. 'changelogtag' is redefined in map file.
279 # by web templates, e.g. 'changelogtag' is redefined in map file.
280 return context._load(exp[1])
280 return context._load(exp[1])
281 raise error.ParseError(_("expected template specifier"))
281 raise error.ParseError(_("expected template specifier"))
282
282
283 def evalfuncarg(context, mapping, arg):
283 def evalfuncarg(context, mapping, arg):
284 func, data = arg
284 func, data = arg
285 # func() may return string, generator of strings or arbitrary object such
285 # func() may return string, generator of strings or arbitrary object such
286 # as date tuple, but filter does not want generator.
286 # as date tuple, but filter does not want generator.
287 thing = func(context, mapping, data)
287 thing = func(context, mapping, data)
288 if isinstance(thing, types.GeneratorType):
288 if isinstance(thing, types.GeneratorType):
289 thing = stringify(thing)
289 thing = stringify(thing)
290 return thing
290 return thing
291
291
292 def evalinteger(context, mapping, arg, err):
292 def evalinteger(context, mapping, arg, err):
293 v = evalfuncarg(context, mapping, arg)
293 v = evalfuncarg(context, mapping, arg)
294 try:
294 try:
295 return int(v)
295 return int(v)
296 except (TypeError, ValueError):
296 except (TypeError, ValueError):
297 raise error.ParseError(err)
297 raise error.ParseError(err)
298
298
299 def evalstring(context, mapping, arg):
299 def evalstring(context, mapping, arg):
300 func, data = arg
300 func, data = arg
301 return stringify(func(context, mapping, data))
301 return stringify(func(context, mapping, data))
302
302
303 def evalstringliteral(context, mapping, arg):
303 def evalstringliteral(context, mapping, arg):
304 """Evaluate given argument as string template, but returns symbol name
304 """Evaluate given argument as string template, but returns symbol name
305 if it is unknown"""
305 if it is unknown"""
306 func, data = arg
306 func, data = arg
307 if func is runsymbol:
307 if func is runsymbol:
308 thing = func(context, mapping, data, default=data)
308 thing = func(context, mapping, data, default=data)
309 else:
309 else:
310 thing = func(context, mapping, data)
310 thing = func(context, mapping, data)
311 return stringify(thing)
311 return stringify(thing)
312
312
313 def runinteger(context, mapping, data):
313 def runinteger(context, mapping, data):
314 return int(data)
314 return int(data)
315
315
316 def runstring(context, mapping, data):
316 def runstring(context, mapping, data):
317 return data
317 return data
318
318
319 def _recursivesymbolblocker(key):
319 def _recursivesymbolblocker(key):
320 def showrecursion(**args):
320 def showrecursion(**args):
321 raise error.Abort(_("recursive reference '%s' in template") % key)
321 raise error.Abort(_("recursive reference '%s' in template") % key)
322 return showrecursion
322 return showrecursion
323
323
324 def _runrecursivesymbol(context, mapping, key):
324 def _runrecursivesymbol(context, mapping, key):
325 raise error.Abort(_("recursive reference '%s' in template") % key)
325 raise error.Abort(_("recursive reference '%s' in template") % key)
326
326
327 def runsymbol(context, mapping, key, default=''):
327 def runsymbol(context, mapping, key, default=''):
328 v = mapping.get(key)
328 v = mapping.get(key)
329 if v is None:
329 if v is None:
330 v = context._defaults.get(key)
330 v = context._defaults.get(key)
331 if v is None:
331 if v is None:
332 # put poison to cut recursion. we can't move this to parsing phase
332 # put poison to cut recursion. we can't move this to parsing phase
333 # because "x = {x}" is allowed if "x" is a keyword. (issue4758)
333 # because "x = {x}" is allowed if "x" is a keyword. (issue4758)
334 safemapping = mapping.copy()
334 safemapping = mapping.copy()
335 safemapping[key] = _recursivesymbolblocker(key)
335 safemapping[key] = _recursivesymbolblocker(key)
336 try:
336 try:
337 v = context.process(key, safemapping)
337 v = context.process(key, safemapping)
338 except TemplateNotFound:
338 except TemplateNotFound:
339 v = default
339 v = default
340 if callable(v):
340 if callable(v):
341 return v(**mapping)
341 return v(**mapping)
342 return v
342 return v
343
343
344 def buildtemplate(exp, context):
344 def buildtemplate(exp, context):
345 ctmpl = [compileexp(e, context, methods) for e in exp[1:]]
345 ctmpl = [compileexp(e, context, methods) for e in exp[1:]]
346 return (runtemplate, ctmpl)
346 return (runtemplate, ctmpl)
347
347
348 def runtemplate(context, mapping, template):
348 def runtemplate(context, mapping, template):
349 for func, data in template:
349 for func, data in template:
350 yield func(context, mapping, data)
350 yield func(context, mapping, data)
351
351
352 def buildfilter(exp, context):
352 def buildfilter(exp, context):
353 arg = compileexp(exp[1], context, methods)
353 arg = compileexp(exp[1], context, methods)
354 n = getsymbol(exp[2])
354 n = getsymbol(exp[2])
355 if n in context._filters:
355 if n in context._filters:
356 filt = context._filters[n]
356 filt = context._filters[n]
357 return (runfilter, (arg, filt))
357 return (runfilter, (arg, filt))
358 if n in funcs:
358 if n in funcs:
359 f = funcs[n]
359 f = funcs[n]
360 return (f, [arg])
360 return (f, [arg])
361 raise error.ParseError(_("unknown function '%s'") % n)
361 raise error.ParseError(_("unknown function '%s'") % n)
362
362
363 def runfilter(context, mapping, data):
363 def runfilter(context, mapping, data):
364 arg, filt = data
364 arg, filt = data
365 thing = evalfuncarg(context, mapping, arg)
365 thing = evalfuncarg(context, mapping, arg)
366 try:
366 try:
367 return filt(thing)
367 return filt(thing)
368 except (ValueError, AttributeError, TypeError):
368 except (ValueError, AttributeError, TypeError):
369 if isinstance(arg[1], tuple):
369 if isinstance(arg[1], tuple):
370 dt = arg[1][1]
370 dt = arg[1][1]
371 else:
371 else:
372 dt = arg[1]
372 dt = arg[1]
373 raise error.Abort(_("template filter '%s' is not compatible with "
373 raise error.Abort(_("template filter '%s' is not compatible with "
374 "keyword '%s'") % (filt.func_name, dt))
374 "keyword '%s'") % (filt.func_name, dt))
375
375
376 def buildmap(exp, context):
376 def buildmap(exp, context):
377 func, data = compileexp(exp[1], context, methods)
377 func, data = compileexp(exp[1], context, methods)
378 tfunc, tdata = gettemplate(exp[2], context)
378 tfunc, tdata = gettemplate(exp[2], context)
379 return (runmap, (func, data, tfunc, tdata))
379 return (runmap, (func, data, tfunc, tdata))
380
380
381 def runmap(context, mapping, data):
381 def runmap(context, mapping, data):
382 func, data, tfunc, tdata = data
382 func, data, tfunc, tdata = data
383 d = func(context, mapping, data)
383 d = func(context, mapping, data)
384 if util.safehasattr(d, 'itermaps'):
384 if util.safehasattr(d, 'itermaps'):
385 diter = d.itermaps()
385 diter = d.itermaps()
386 else:
386 else:
387 try:
387 try:
388 diter = iter(d)
388 diter = iter(d)
389 except TypeError:
389 except TypeError:
390 if func is runsymbol:
390 if func is runsymbol:
391 raise error.ParseError(_("keyword '%s' is not iterable") % data)
391 raise error.ParseError(_("keyword '%s' is not iterable") % data)
392 else:
392 else:
393 raise error.ParseError(_("%r is not iterable") % d)
393 raise error.ParseError(_("%r is not iterable") % d)
394
394
395 for i in diter:
395 for i in diter:
396 lm = mapping.copy()
396 lm = mapping.copy()
397 if isinstance(i, dict):
397 if isinstance(i, dict):
398 lm.update(i)
398 lm.update(i)
399 lm['originalnode'] = mapping.get('node')
399 lm['originalnode'] = mapping.get('node')
400 yield tfunc(context, lm, tdata)
400 yield tfunc(context, lm, tdata)
401 else:
401 else:
402 # v is not an iterable of dicts, this happen when 'key'
402 # v is not an iterable of dicts, this happen when 'key'
403 # has been fully expanded already and format is useless.
403 # has been fully expanded already and format is useless.
404 # If so, return the expanded value.
404 # If so, return the expanded value.
405 yield i
405 yield i
406
406
407 def buildfunc(exp, context):
407 def buildfunc(exp, context):
408 n = getsymbol(exp[1])
408 n = getsymbol(exp[1])
409 args = [compileexp(x, context, exprmethods) for x in getlist(exp[2])]
409 args = [compileexp(x, context, exprmethods) for x in getlist(exp[2])]
410 if n in funcs:
410 if n in funcs:
411 f = funcs[n]
411 f = funcs[n]
412 return (f, args)
412 return (f, args)
413 if n in context._filters:
413 if n in context._filters:
414 if len(args) != 1:
414 if len(args) != 1:
415 raise error.ParseError(_("filter %s expects one argument") % n)
415 raise error.ParseError(_("filter %s expects one argument") % n)
416 f = context._filters[n]
416 f = context._filters[n]
417 return (runfilter, (args[0], f))
417 return (runfilter, (args[0], f))
418 raise error.ParseError(_("unknown function '%s'") % n)
418 raise error.ParseError(_("unknown function '%s'") % n)
419
419
420 # dict of template built-in functions
420 # dict of template built-in functions
421 funcs = {}
421 funcs = {}
422
422
423 templatefunc = registrar.templatefunc(funcs)
423 templatefunc = registrar.templatefunc(funcs)
424
424
425 @templatefunc('date(date[, fmt])')
425 @templatefunc('date(date[, fmt])')
426 def date(context, mapping, args):
426 def date(context, mapping, args):
427 """Format a date. See :hg:`help dates` for formatting
427 """Format a date. See :hg:`help dates` for formatting
428 strings. The default is a Unix date format, including the timezone:
428 strings. The default is a Unix date format, including the timezone:
429 "Mon Sep 04 15:13:13 2006 0700"."""
429 "Mon Sep 04 15:13:13 2006 0700"."""
430 if not (1 <= len(args) <= 2):
430 if not (1 <= len(args) <= 2):
431 # i18n: "date" is a keyword
431 # i18n: "date" is a keyword
432 raise error.ParseError(_("date expects one or two arguments"))
432 raise error.ParseError(_("date expects one or two arguments"))
433
433
434 date = evalfuncarg(context, mapping, args[0])
434 date = evalfuncarg(context, mapping, args[0])
435 fmt = None
435 fmt = None
436 if len(args) == 2:
436 if len(args) == 2:
437 fmt = evalstring(context, mapping, args[1])
437 fmt = evalstring(context, mapping, args[1])
438 try:
438 try:
439 if fmt is None:
439 if fmt is None:
440 return util.datestr(date)
440 return util.datestr(date)
441 else:
441 else:
442 return util.datestr(date, fmt)
442 return util.datestr(date, fmt)
443 except (TypeError, ValueError):
443 except (TypeError, ValueError):
444 # i18n: "date" is a keyword
444 # i18n: "date" is a keyword
445 raise error.ParseError(_("date expects a date information"))
445 raise error.ParseError(_("date expects a date information"))
446
446
447 @templatefunc('diff([includepattern [, excludepattern]])')
447 @templatefunc('diff([includepattern [, excludepattern]])')
448 def diff(context, mapping, args):
448 def diff(context, mapping, args):
449 """Show a diff, optionally
449 """Show a diff, optionally
450 specifying files to include or exclude."""
450 specifying files to include or exclude."""
451 if len(args) > 2:
451 if len(args) > 2:
452 # i18n: "diff" is a keyword
452 # i18n: "diff" is a keyword
453 raise error.ParseError(_("diff expects zero, one, or two arguments"))
453 raise error.ParseError(_("diff expects zero, one, or two arguments"))
454
454
455 def getpatterns(i):
455 def getpatterns(i):
456 if i < len(args):
456 if i < len(args):
457 s = evalstring(context, mapping, args[i]).strip()
457 s = evalstring(context, mapping, args[i]).strip()
458 if s:
458 if s:
459 return [s]
459 return [s]
460 return []
460 return []
461
461
462 ctx = mapping['ctx']
462 ctx = mapping['ctx']
463 chunks = ctx.diff(match=ctx.match([], getpatterns(0), getpatterns(1)))
463 chunks = ctx.diff(match=ctx.match([], getpatterns(0), getpatterns(1)))
464
464
465 return ''.join(chunks)
465 return ''.join(chunks)
466
466
467 @templatefunc('fill(text[, width[, initialident[, hangindent]]])')
467 @templatefunc('fill(text[, width[, initialident[, hangindent]]])')
468 def fill(context, mapping, args):
468 def fill(context, mapping, args):
469 """Fill many
469 """Fill many
470 paragraphs with optional indentation. See the "fill" filter."""
470 paragraphs with optional indentation. See the "fill" filter."""
471 if not (1 <= len(args) <= 4):
471 if not (1 <= len(args) <= 4):
472 # i18n: "fill" is a keyword
472 # i18n: "fill" is a keyword
473 raise error.ParseError(_("fill expects one to four arguments"))
473 raise error.ParseError(_("fill expects one to four arguments"))
474
474
475 text = evalstring(context, mapping, args[0])
475 text = evalstring(context, mapping, args[0])
476 width = 76
476 width = 76
477 initindent = ''
477 initindent = ''
478 hangindent = ''
478 hangindent = ''
479 if 2 <= len(args) <= 4:
479 if 2 <= len(args) <= 4:
480 width = evalinteger(context, mapping, args[1],
480 width = evalinteger(context, mapping, args[1],
481 # i18n: "fill" is a keyword
481 # i18n: "fill" is a keyword
482 _("fill expects an integer width"))
482 _("fill expects an integer width"))
483 try:
483 try:
484 initindent = evalstring(context, mapping, args[2])
484 initindent = evalstring(context, mapping, args[2])
485 hangindent = evalstring(context, mapping, args[3])
485 hangindent = evalstring(context, mapping, args[3])
486 except IndexError:
486 except IndexError:
487 pass
487 pass
488
488
489 return templatefilters.fill(text, width, initindent, hangindent)
489 return templatefilters.fill(text, width, initindent, hangindent)
490
490
491 @templatefunc('pad(text, width[, fillchar=\' \'[, right=False]])')
491 @templatefunc('pad(text, width[, fillchar=\' \'[, right=False]])')
492 def pad(context, mapping, args):
492 def pad(context, mapping, args):
493 """Pad text with a
493 """Pad text with a
494 fill character."""
494 fill character."""
495 if not (2 <= len(args) <= 4):
495 if not (2 <= len(args) <= 4):
496 # i18n: "pad" is a keyword
496 # i18n: "pad" is a keyword
497 raise error.ParseError(_("pad() expects two to four arguments"))
497 raise error.ParseError(_("pad() expects two to four arguments"))
498
498
499 width = evalinteger(context, mapping, args[1],
499 width = evalinteger(context, mapping, args[1],
500 # i18n: "pad" is a keyword
500 # i18n: "pad" is a keyword
501 _("pad() expects an integer width"))
501 _("pad() expects an integer width"))
502
502
503 text = evalstring(context, mapping, args[0])
503 text = evalstring(context, mapping, args[0])
504
504
505 right = False
505 right = False
506 fillchar = ' '
506 fillchar = ' '
507 if len(args) > 2:
507 if len(args) > 2:
508 fillchar = evalstring(context, mapping, args[2])
508 fillchar = evalstring(context, mapping, args[2])
509 if len(args) > 3:
509 if len(args) > 3:
510 right = util.parsebool(args[3][1])
510 right = util.parsebool(args[3][1])
511
511
512 if right:
512 if right:
513 return text.rjust(width, fillchar)
513 return text.rjust(width, fillchar)
514 else:
514 else:
515 return text.ljust(width, fillchar)
515 return text.ljust(width, fillchar)
516
516
517 @templatefunc('indent(text, indentchars[, firstline])')
517 @templatefunc('indent(text, indentchars[, firstline])')
518 def indent(context, mapping, args):
518 def indent(context, mapping, args):
519 """Indents all non-empty lines
519 """Indents all non-empty lines
520 with the characters given in the indentchars string. An optional
520 with the characters given in the indentchars string. An optional
521 third parameter will override the indent for the first line only
521 third parameter will override the indent for the first line only
522 if present."""
522 if present."""
523 if not (2 <= len(args) <= 3):
523 if not (2 <= len(args) <= 3):
524 # i18n: "indent" is a keyword
524 # i18n: "indent" is a keyword
525 raise error.ParseError(_("indent() expects two or three arguments"))
525 raise error.ParseError(_("indent() expects two or three arguments"))
526
526
527 text = evalstring(context, mapping, args[0])
527 text = evalstring(context, mapping, args[0])
528 indent = evalstring(context, mapping, args[1])
528 indent = evalstring(context, mapping, args[1])
529
529
530 if len(args) == 3:
530 if len(args) == 3:
531 firstline = evalstring(context, mapping, args[2])
531 firstline = evalstring(context, mapping, args[2])
532 else:
532 else:
533 firstline = indent
533 firstline = indent
534
534
535 # the indent function doesn't indent the first line, so we do it here
535 # the indent function doesn't indent the first line, so we do it here
536 return templatefilters.indent(firstline + text, indent)
536 return templatefilters.indent(firstline + text, indent)
537
537
538 @templatefunc('get(dict, key)')
538 @templatefunc('get(dict, key)')
539 def get(context, mapping, args):
539 def get(context, mapping, args):
540 """Get an attribute/key from an object. Some keywords
540 """Get an attribute/key from an object. Some keywords
541 are complex types. This function allows you to obtain the value of an
541 are complex types. This function allows you to obtain the value of an
542 attribute on these types."""
542 attribute on these types."""
543 if len(args) != 2:
543 if len(args) != 2:
544 # i18n: "get" is a keyword
544 # i18n: "get" is a keyword
545 raise error.ParseError(_("get() expects two arguments"))
545 raise error.ParseError(_("get() expects two arguments"))
546
546
547 dictarg = evalfuncarg(context, mapping, args[0])
547 dictarg = evalfuncarg(context, mapping, args[0])
548 if not util.safehasattr(dictarg, 'get'):
548 if not util.safehasattr(dictarg, 'get'):
549 # i18n: "get" is a keyword
549 # i18n: "get" is a keyword
550 raise error.ParseError(_("get() expects a dict as first argument"))
550 raise error.ParseError(_("get() expects a dict as first argument"))
551
551
552 key = evalfuncarg(context, mapping, args[1])
552 key = evalfuncarg(context, mapping, args[1])
553 return dictarg.get(key)
553 return dictarg.get(key)
554
554
555 @templatefunc('if(expr, then[, else])')
555 @templatefunc('if(expr, then[, else])')
556 def if_(context, mapping, args):
556 def if_(context, mapping, args):
557 """Conditionally execute based on the result of
557 """Conditionally execute based on the result of
558 an expression."""
558 an expression."""
559 if not (2 <= len(args) <= 3):
559 if not (2 <= len(args) <= 3):
560 # i18n: "if" is a keyword
560 # i18n: "if" is a keyword
561 raise error.ParseError(_("if expects two or three arguments"))
561 raise error.ParseError(_("if expects two or three arguments"))
562
562
563 test = evalstring(context, mapping, args[0])
563 test = evalstring(context, mapping, args[0])
564 if test:
564 if test:
565 yield args[1][0](context, mapping, args[1][1])
565 yield args[1][0](context, mapping, args[1][1])
566 elif len(args) == 3:
566 elif len(args) == 3:
567 yield args[2][0](context, mapping, args[2][1])
567 yield args[2][0](context, mapping, args[2][1])
568
568
569 @templatefunc('ifcontains(search, thing, then[, else])')
569 @templatefunc('ifcontains(search, thing, then[, else])')
570 def ifcontains(context, mapping, args):
570 def ifcontains(context, mapping, args):
571 """Conditionally execute based
571 """Conditionally execute based
572 on whether the item "search" is in "thing"."""
572 on whether the item "search" is in "thing"."""
573 if not (3 <= len(args) <= 4):
573 if not (3 <= len(args) <= 4):
574 # i18n: "ifcontains" is a keyword
574 # i18n: "ifcontains" is a keyword
575 raise error.ParseError(_("ifcontains expects three or four arguments"))
575 raise error.ParseError(_("ifcontains expects three or four arguments"))
576
576
577 item = evalstring(context, mapping, args[0])
577 item = evalstring(context, mapping, args[0])
578 items = evalfuncarg(context, mapping, args[1])
578 items = evalfuncarg(context, mapping, args[1])
579
579
580 if item in items:
580 if item in items:
581 yield args[2][0](context, mapping, args[2][1])
581 yield args[2][0](context, mapping, args[2][1])
582 elif len(args) == 4:
582 elif len(args) == 4:
583 yield args[3][0](context, mapping, args[3][1])
583 yield args[3][0](context, mapping, args[3][1])
584
584
585 @templatefunc('ifeq(expr1, expr2, then[, else])')
585 @templatefunc('ifeq(expr1, expr2, then[, else])')
586 def ifeq(context, mapping, args):
586 def ifeq(context, mapping, args):
587 """Conditionally execute based on
587 """Conditionally execute based on
588 whether 2 items are equivalent."""
588 whether 2 items are equivalent."""
589 if not (3 <= len(args) <= 4):
589 if not (3 <= len(args) <= 4):
590 # i18n: "ifeq" is a keyword
590 # i18n: "ifeq" is a keyword
591 raise error.ParseError(_("ifeq expects three or four arguments"))
591 raise error.ParseError(_("ifeq expects three or four arguments"))
592
592
593 test = evalstring(context, mapping, args[0])
593 test = evalstring(context, mapping, args[0])
594 match = evalstring(context, mapping, args[1])
594 match = evalstring(context, mapping, args[1])
595 if test == match:
595 if test == match:
596 yield args[2][0](context, mapping, args[2][1])
596 yield args[2][0](context, mapping, args[2][1])
597 elif len(args) == 4:
597 elif len(args) == 4:
598 yield args[3][0](context, mapping, args[3][1])
598 yield args[3][0](context, mapping, args[3][1])
599
599
600 @templatefunc('join(list, sep)')
600 @templatefunc('join(list, sep)')
601 def join(context, mapping, args):
601 def join(context, mapping, args):
602 """Join items in a list with a delimiter."""
602 """Join items in a list with a delimiter."""
603 if not (1 <= len(args) <= 2):
603 if not (1 <= len(args) <= 2):
604 # i18n: "join" is a keyword
604 # i18n: "join" is a keyword
605 raise error.ParseError(_("join expects one or two arguments"))
605 raise error.ParseError(_("join expects one or two arguments"))
606
606
607 joinset = args[0][0](context, mapping, args[0][1])
607 joinset = args[0][0](context, mapping, args[0][1])
608 if util.safehasattr(joinset, 'itermaps'):
608 if util.safehasattr(joinset, 'itermaps'):
609 jf = joinset.joinfmt
609 jf = joinset.joinfmt
610 joinset = [jf(x) for x in joinset.itermaps()]
610 joinset = [jf(x) for x in joinset.itermaps()]
611
611
612 joiner = " "
612 joiner = " "
613 if len(args) > 1:
613 if len(args) > 1:
614 joiner = evalstring(context, mapping, args[1])
614 joiner = evalstring(context, mapping, args[1])
615
615
616 first = True
616 first = True
617 for x in joinset:
617 for x in joinset:
618 if first:
618 if first:
619 first = False
619 first = False
620 else:
620 else:
621 yield joiner
621 yield joiner
622 yield x
622 yield x
623
623
624 @templatefunc('label(label, expr)')
624 @templatefunc('label(label, expr)')
625 def label(context, mapping, args):
625 def label(context, mapping, args):
626 """Apply a label to generated content. Content with
626 """Apply a label to generated content. Content with
627 a label applied can result in additional post-processing, such as
627 a label applied can result in additional post-processing, such as
628 automatic colorization."""
628 automatic colorization."""
629 if len(args) != 2:
629 if len(args) != 2:
630 # i18n: "label" is a keyword
630 # i18n: "label" is a keyword
631 raise error.ParseError(_("label expects two arguments"))
631 raise error.ParseError(_("label expects two arguments"))
632
632
633 ui = mapping['ui']
633 ui = mapping['ui']
634 thing = evalstring(context, mapping, args[1])
634 thing = evalstring(context, mapping, args[1])
635 # preserve unknown symbol as literal so effects like 'red', 'bold',
635 # preserve unknown symbol as literal so effects like 'red', 'bold',
636 # etc. don't need to be quoted
636 # etc. don't need to be quoted
637 label = evalstringliteral(context, mapping, args[0])
637 label = evalstringliteral(context, mapping, args[0])
638
638
639 return ui.label(thing, label)
639 return ui.label(thing, label)
640
640
641 @templatefunc('latesttag([pattern])')
641 @templatefunc('latesttag([pattern])')
642 def latesttag(context, mapping, args):
642 def latesttag(context, mapping, args):
643 """The global tags matching the given pattern on the
643 """The global tags matching the given pattern on the
644 most recent globally tagged ancestor of this changeset."""
644 most recent globally tagged ancestor of this changeset."""
645 if len(args) > 1:
645 if len(args) > 1:
646 # i18n: "latesttag" is a keyword
646 # i18n: "latesttag" is a keyword
647 raise error.ParseError(_("latesttag expects at most one argument"))
647 raise error.ParseError(_("latesttag expects at most one argument"))
648
648
649 pattern = None
649 pattern = None
650 if len(args) == 1:
650 if len(args) == 1:
651 pattern = evalstring(context, mapping, args[0])
651 pattern = evalstring(context, mapping, args[0])
652
652
653 return templatekw.showlatesttags(pattern, **mapping)
653 return templatekw.showlatesttags(pattern, **mapping)
654
654
655 @templatefunc('localdate(date[, tz])')
655 @templatefunc('localdate(date[, tz])')
656 def localdate(context, mapping, args):
656 def localdate(context, mapping, args):
657 """Converts a date to the specified timezone.
657 """Converts a date to the specified timezone.
658 The default is local date."""
658 The default is local date."""
659 if not (1 <= len(args) <= 2):
659 if not (1 <= len(args) <= 2):
660 # i18n: "localdate" is a keyword
660 # i18n: "localdate" is a keyword
661 raise error.ParseError(_("localdate expects one or two arguments"))
661 raise error.ParseError(_("localdate expects one or two arguments"))
662
662
663 date = evalfuncarg(context, mapping, args[0])
663 date = evalfuncarg(context, mapping, args[0])
664 try:
664 try:
665 date = util.parsedate(date)
665 date = util.parsedate(date)
666 except AttributeError: # not str nor date tuple
666 except AttributeError: # not str nor date tuple
667 # i18n: "localdate" is a keyword
667 # i18n: "localdate" is a keyword
668 raise error.ParseError(_("localdate expects a date information"))
668 raise error.ParseError(_("localdate expects a date information"))
669 if len(args) >= 2:
669 if len(args) >= 2:
670 tzoffset = None
670 tzoffset = None
671 tz = evalfuncarg(context, mapping, args[1])
671 tz = evalfuncarg(context, mapping, args[1])
672 if isinstance(tz, str):
672 if isinstance(tz, str):
673 tzoffset = util.parsetimezone(tz)
673 tzoffset = util.parsetimezone(tz)
674 if tzoffset is None:
674 if tzoffset is None:
675 try:
675 try:
676 tzoffset = int(tz)
676 tzoffset = int(tz)
677 except (TypeError, ValueError):
677 except (TypeError, ValueError):
678 # i18n: "localdate" is a keyword
678 # i18n: "localdate" is a keyword
679 raise error.ParseError(_("localdate expects a timezone"))
679 raise error.ParseError(_("localdate expects a timezone"))
680 else:
680 else:
681 tzoffset = util.makedate()[1]
681 tzoffset = util.makedate()[1]
682 return (date[0], tzoffset)
682 return (date[0], tzoffset)
683
683
684 @templatefunc('revset(query[, formatargs...])')
684 @templatefunc('revset(query[, formatargs...])')
685 def revset(context, mapping, args):
685 def revset(context, mapping, args):
686 """Execute a revision set query. See
686 """Execute a revision set query. See
687 :hg:`help revset`."""
687 :hg:`help revset`."""
688 if not len(args) > 0:
688 if not len(args) > 0:
689 # i18n: "revset" is a keyword
689 # i18n: "revset" is a keyword
690 raise error.ParseError(_("revset expects one or more arguments"))
690 raise error.ParseError(_("revset expects one or more arguments"))
691
691
692 raw = evalstring(context, mapping, args[0])
692 raw = evalstring(context, mapping, args[0])
693 ctx = mapping['ctx']
693 ctx = mapping['ctx']
694 repo = ctx.repo()
694 repo = ctx.repo()
695
695
696 def query(expr):
696 def query(expr):
697 m = revsetmod.match(repo.ui, expr)
697 m = revsetmod.match(repo.ui, expr)
698 return m(repo)
698 return m(repo)
699
699
700 if len(args) > 1:
700 if len(args) > 1:
701 formatargs = [evalfuncarg(context, mapping, a) for a in args[1:]]
701 formatargs = [evalfuncarg(context, mapping, a) for a in args[1:]]
702 revs = query(revsetmod.formatspec(raw, *formatargs))
702 revs = query(revsetmod.formatspec(raw, *formatargs))
703 revs = list(revs)
703 revs = list(revs)
704 else:
704 else:
705 revsetcache = mapping['cache'].setdefault("revsetcache", {})
705 revsetcache = mapping['cache'].setdefault("revsetcache", {})
706 if raw in revsetcache:
706 if raw in revsetcache:
707 revs = revsetcache[raw]
707 revs = revsetcache[raw]
708 else:
708 else:
709 revs = query(raw)
709 revs = query(raw)
710 revs = list(revs)
710 revs = list(revs)
711 revsetcache[raw] = revs
711 revsetcache[raw] = revs
712
712
713 return templatekw.showrevslist("revision", revs, **mapping)
713 return templatekw.showrevslist("revision", revs, **mapping)
714
714
715 @templatefunc('rstdoc(text, style)')
715 @templatefunc('rstdoc(text, style)')
716 def rstdoc(context, mapping, args):
716 def rstdoc(context, mapping, args):
717 """Format ReStructuredText."""
717 """Format ReStructuredText."""
718 if len(args) != 2:
718 if len(args) != 2:
719 # i18n: "rstdoc" is a keyword
719 # i18n: "rstdoc" is a keyword
720 raise error.ParseError(_("rstdoc expects two arguments"))
720 raise error.ParseError(_("rstdoc expects two arguments"))
721
721
722 text = evalstring(context, mapping, args[0])
722 text = evalstring(context, mapping, args[0])
723 style = evalstring(context, mapping, args[1])
723 style = evalstring(context, mapping, args[1])
724
724
725 return minirst.format(text, style=style, keep=['verbose'])
725 return minirst.format(text, style=style, keep=['verbose'])
726
726
727 @templatefunc('shortest(node, minlength=4)')
727 @templatefunc('shortest(node, minlength=4)')
728 def shortest(context, mapping, args):
728 def shortest(context, mapping, args):
729 """Obtain the shortest representation of
729 """Obtain the shortest representation of
730 a node."""
730 a node."""
731 if not (1 <= len(args) <= 2):
731 if not (1 <= len(args) <= 2):
732 # i18n: "shortest" is a keyword
732 # i18n: "shortest" is a keyword
733 raise error.ParseError(_("shortest() expects one or two arguments"))
733 raise error.ParseError(_("shortest() expects one or two arguments"))
734
734
735 node = evalstring(context, mapping, args[0])
735 node = evalstring(context, mapping, args[0])
736
736
737 minlength = 4
737 minlength = 4
738 if len(args) > 1:
738 if len(args) > 1:
739 minlength = evalinteger(context, mapping, args[1],
739 minlength = evalinteger(context, mapping, args[1],
740 # i18n: "shortest" is a keyword
740 # i18n: "shortest" is a keyword
741 _("shortest() expects an integer minlength"))
741 _("shortest() expects an integer minlength"))
742
742
743 cl = mapping['ctx']._repo.changelog
743 cl = mapping['ctx']._repo.changelog
744 def isvalid(test):
744 def isvalid(test):
745 try:
745 try:
746 try:
746 try:
747 cl.index.partialmatch(test)
747 cl.index.partialmatch(test)
748 except AttributeError:
748 except AttributeError:
749 # Pure mercurial doesn't support partialmatch on the index.
749 # Pure mercurial doesn't support partialmatch on the index.
750 # Fallback to the slow way.
750 # Fallback to the slow way.
751 if cl._partialmatch(test) is None:
751 if cl._partialmatch(test) is None:
752 return False
752 return False
753
753
754 try:
754 try:
755 i = int(test)
755 i = int(test)
756 # if we are a pure int, then starting with zero will not be
756 # if we are a pure int, then starting with zero will not be
757 # confused as a rev; or, obviously, if the int is larger than
757 # confused as a rev; or, obviously, if the int is larger than
758 # the value of the tip rev
758 # the value of the tip rev
759 if test[0] == '0' or i > len(cl):
759 if test[0] == '0' or i > len(cl):
760 return True
760 return True
761 return False
761 return False
762 except ValueError:
762 except ValueError:
763 return True
763 return True
764 except error.RevlogError:
764 except error.RevlogError:
765 return False
765 return False
766
766
767 shortest = node
767 shortest = node
768 startlength = max(6, minlength)
768 startlength = max(6, minlength)
769 length = startlength
769 length = startlength
770 while True:
770 while True:
771 test = node[:length]
771 test = node[:length]
772 if isvalid(test):
772 if isvalid(test):
773 shortest = test
773 shortest = test
774 if length == minlength or length > startlength:
774 if length == minlength or length > startlength:
775 return shortest
775 return shortest
776 length -= 1
776 length -= 1
777 else:
777 else:
778 length += 1
778 length += 1
779 if len(shortest) <= length:
779 if len(shortest) <= length:
780 return shortest
780 return shortest
781
781
782 @templatefunc('strip(text[, chars])')
782 @templatefunc('strip(text[, chars])')
783 def strip(context, mapping, args):
783 def strip(context, mapping, args):
784 """Strip characters from a string. By default,
784 """Strip characters from a string. By default,
785 strips all leading and trailing whitespace."""
785 strips all leading and trailing whitespace."""
786 if not (1 <= len(args) <= 2):
786 if not (1 <= len(args) <= 2):
787 # i18n: "strip" is a keyword
787 # i18n: "strip" is a keyword
788 raise error.ParseError(_("strip expects one or two arguments"))
788 raise error.ParseError(_("strip expects one or two arguments"))
789
789
790 text = evalstring(context, mapping, args[0])
790 text = evalstring(context, mapping, args[0])
791 if len(args) == 2:
791 if len(args) == 2:
792 chars = evalstring(context, mapping, args[1])
792 chars = evalstring(context, mapping, args[1])
793 return text.strip(chars)
793 return text.strip(chars)
794 return text.strip()
794 return text.strip()
795
795
796 @templatefunc('sub(pattern, replacement, expression)')
796 @templatefunc('sub(pattern, replacement, expression)')
797 def sub(context, mapping, args):
797 def sub(context, mapping, args):
798 """Perform text substitution
798 """Perform text substitution
799 using regular expressions."""
799 using regular expressions."""
800 if len(args) != 3:
800 if len(args) != 3:
801 # i18n: "sub" is a keyword
801 # i18n: "sub" is a keyword
802 raise error.ParseError(_("sub expects three arguments"))
802 raise error.ParseError(_("sub expects three arguments"))
803
803
804 pat = evalstring(context, mapping, args[0])
804 pat = evalstring(context, mapping, args[0])
805 rpl = evalstring(context, mapping, args[1])
805 rpl = evalstring(context, mapping, args[1])
806 src = evalstring(context, mapping, args[2])
806 src = evalstring(context, mapping, args[2])
807 try:
807 try:
808 patre = re.compile(pat)
808 patre = re.compile(pat)
809 except re.error:
809 except re.error:
810 # i18n: "sub" is a keyword
810 # i18n: "sub" is a keyword
811 raise error.ParseError(_("sub got an invalid pattern: %s") % pat)
811 raise error.ParseError(_("sub got an invalid pattern: %s") % pat)
812 try:
812 try:
813 yield patre.sub(rpl, src)
813 yield patre.sub(rpl, src)
814 except re.error:
814 except re.error:
815 # i18n: "sub" is a keyword
815 # i18n: "sub" is a keyword
816 raise error.ParseError(_("sub got an invalid replacement: %s") % rpl)
816 raise error.ParseError(_("sub got an invalid replacement: %s") % rpl)
817
817
818 @templatefunc('startswith(pattern, text)')
818 @templatefunc('startswith(pattern, text)')
819 def startswith(context, mapping, args):
819 def startswith(context, mapping, args):
820 """Returns the value from the "text" argument
820 """Returns the value from the "text" argument
821 if it begins with the content from the "pattern" argument."""
821 if it begins with the content from the "pattern" argument."""
822 if len(args) != 2:
822 if len(args) != 2:
823 # i18n: "startswith" is a keyword
823 # i18n: "startswith" is a keyword
824 raise error.ParseError(_("startswith expects two arguments"))
824 raise error.ParseError(_("startswith expects two arguments"))
825
825
826 patn = evalstring(context, mapping, args[0])
826 patn = evalstring(context, mapping, args[0])
827 text = evalstring(context, mapping, args[1])
827 text = evalstring(context, mapping, args[1])
828 if text.startswith(patn):
828 if text.startswith(patn):
829 return text
829 return text
830 return ''
830 return ''
831
831
832 @templatefunc('word(number, text[, separator])')
832 @templatefunc('word(number, text[, separator])')
833 def word(context, mapping, args):
833 def word(context, mapping, args):
834 """Return the nth word from a string."""
834 """Return the nth word from a string."""
835 if not (2 <= len(args) <= 3):
835 if not (2 <= len(args) <= 3):
836 # i18n: "word" is a keyword
836 # i18n: "word" is a keyword
837 raise error.ParseError(_("word expects two or three arguments, got %d")
837 raise error.ParseError(_("word expects two or three arguments, got %d")
838 % len(args))
838 % len(args))
839
839
840 num = evalinteger(context, mapping, args[0],
840 num = evalinteger(context, mapping, args[0],
841 # i18n: "word" is a keyword
841 # i18n: "word" is a keyword
842 _("word expects an integer index"))
842 _("word expects an integer index"))
843 text = evalstring(context, mapping, args[1])
843 text = evalstring(context, mapping, args[1])
844 if len(args) == 3:
844 if len(args) == 3:
845 splitter = evalstring(context, mapping, args[2])
845 splitter = evalstring(context, mapping, args[2])
846 else:
846 else:
847 splitter = None
847 splitter = None
848
848
849 tokens = text.split(splitter)
849 tokens = text.split(splitter)
850 if num >= len(tokens) or num < -len(tokens):
850 if num >= len(tokens) or num < -len(tokens):
851 return ''
851 return ''
852 else:
852 else:
853 return tokens[num]
853 return tokens[num]
854
854
855 # methods to interpret function arguments or inner expressions (e.g. {_(x)})
855 # methods to interpret function arguments or inner expressions (e.g. {_(x)})
856 exprmethods = {
856 exprmethods = {
857 "integer": lambda e, c: (runinteger, e[1]),
857 "integer": lambda e, c: (runinteger, e[1]),
858 "string": lambda e, c: (runstring, e[1]),
858 "string": lambda e, c: (runstring, e[1]),
859 "symbol": lambda e, c: (runsymbol, e[1]),
859 "symbol": lambda e, c: (runsymbol, e[1]),
860 "template": buildtemplate,
860 "template": buildtemplate,
861 "group": lambda e, c: compileexp(e[1], c, exprmethods),
861 "group": lambda e, c: compileexp(e[1], c, exprmethods),
862 # ".": buildmember,
862 # ".": buildmember,
863 "|": buildfilter,
863 "|": buildfilter,
864 "%": buildmap,
864 "%": buildmap,
865 "func": buildfunc,
865 "func": buildfunc,
866 }
866 }
867
867
868 # methods to interpret top-level template (e.g. {x}, {x|_}, {x % "y"})
868 # methods to interpret top-level template (e.g. {x}, {x|_}, {x % "y"})
869 methods = exprmethods.copy()
869 methods = exprmethods.copy()
870 methods["integer"] = exprmethods["symbol"] # '{1}' as variable
870 methods["integer"] = exprmethods["symbol"] # '{1}' as variable
871
871
872 class _aliasrules(parser.basealiasrules):
872 class _aliasrules(parser.basealiasrules):
873 """Parsing and expansion rule set of template aliases"""
873 """Parsing and expansion rule set of template aliases"""
874 _section = _('template alias')
874 _section = _('template alias')
875 _parse = staticmethod(_parseexpr)
875 _parse = staticmethod(_parseexpr)
876
876
877 @staticmethod
877 @staticmethod
878 def _trygetfunc(tree):
878 def _trygetfunc(tree):
879 """Return (name, args) if tree is func(...) or ...|filter; otherwise
879 """Return (name, args) if tree is func(...) or ...|filter; otherwise
880 None"""
880 None"""
881 if tree[0] == 'func' and tree[1][0] == 'symbol':
881 if tree[0] == 'func' and tree[1][0] == 'symbol':
882 return tree[1][1], getlist(tree[2])
882 return tree[1][1], getlist(tree[2])
883 if tree[0] == '|' and tree[2][0] == 'symbol':
883 if tree[0] == '|' and tree[2][0] == 'symbol':
884 return tree[2][1], [tree[1]]
884 return tree[2][1], [tree[1]]
885
885
886 def expandaliases(tree, aliases):
886 def expandaliases(tree, aliases):
887 """Return new tree of aliases are expanded"""
887 """Return new tree of aliases are expanded"""
888 aliasmap = _aliasrules.buildmap(aliases)
888 aliasmap = _aliasrules.buildmap(aliases)
889 return _aliasrules.expand(aliasmap, tree)
889 return _aliasrules.expand(aliasmap, tree)
890
890
891 # template engine
891 # template engine
892
892
893 stringify = templatefilters.stringify
893 stringify = templatefilters.stringify
894
894
895 def _flatten(thing):
895 def _flatten(thing):
896 '''yield a single stream from a possibly nested set of iterators'''
896 '''yield a single stream from a possibly nested set of iterators'''
897 if isinstance(thing, str):
897 if isinstance(thing, str):
898 yield thing
898 yield thing
899 elif not util.safehasattr(thing, '__iter__'):
899 elif not util.safehasattr(thing, '__iter__'):
900 if thing is not None:
900 if thing is not None:
901 yield str(thing)
901 yield str(thing)
902 else:
902 else:
903 for i in thing:
903 for i in thing:
904 if isinstance(i, str):
904 if isinstance(i, str):
905 yield i
905 yield i
906 elif not util.safehasattr(i, '__iter__'):
906 elif not util.safehasattr(i, '__iter__'):
907 if i is not None:
907 if i is not None:
908 yield str(i)
908 yield str(i)
909 elif i is not None:
909 elif i is not None:
910 for j in _flatten(i):
910 for j in _flatten(i):
911 yield j
911 yield j
912
912
913 def unquotestring(s):
913 def unquotestring(s):
914 '''unwrap quotes if any; otherwise returns unmodified string'''
914 '''unwrap quotes if any; otherwise returns unmodified string'''
915 if len(s) < 2 or s[0] not in "'\"" or s[0] != s[-1]:
915 if len(s) < 2 or s[0] not in "'\"" or s[0] != s[-1]:
916 return s
916 return s
917 return s[1:-1]
917 return s[1:-1]
918
918
919 class engine(object):
919 class engine(object):
920 '''template expansion engine.
920 '''template expansion engine.
921
921
922 template expansion works like this. a map file contains key=value
922 template expansion works like this. a map file contains key=value
923 pairs. if value is quoted, it is treated as string. otherwise, it
923 pairs. if value is quoted, it is treated as string. otherwise, it
924 is treated as name of template file.
924 is treated as name of template file.
925
925
926 templater is asked to expand a key in map. it looks up key, and
926 templater is asked to expand a key in map. it looks up key, and
927 looks for strings like this: {foo}. it expands {foo} by looking up
927 looks for strings like this: {foo}. it expands {foo} by looking up
928 foo in map, and substituting it. expansion is recursive: it stops
928 foo in map, and substituting it. expansion is recursive: it stops
929 when there is no more {foo} to replace.
929 when there is no more {foo} to replace.
930
930
931 expansion also allows formatting and filtering.
931 expansion also allows formatting and filtering.
932
932
933 format uses key to expand each item in list. syntax is
933 format uses key to expand each item in list. syntax is
934 {key%format}.
934 {key%format}.
935
935
936 filter uses function to transform value. syntax is
936 filter uses function to transform value. syntax is
937 {key|filter1|filter2|...}.'''
937 {key|filter1|filter2|...}.'''
938
938
939 def __init__(self, loader, filters=None, defaults=None):
939 def __init__(self, loader, filters=None, defaults=None, aliases=()):
940 self._loader = loader
940 self._loader = loader
941 if filters is None:
941 if filters is None:
942 filters = {}
942 filters = {}
943 self._filters = filters
943 self._filters = filters
944 if defaults is None:
944 if defaults is None:
945 defaults = {}
945 defaults = {}
946 self._defaults = defaults
946 self._defaults = defaults
947 self._aliasmap = _aliasrules.buildmap(aliases)
947 self._cache = {} # key: (func, data)
948 self._cache = {} # key: (func, data)
948
949
949 def _load(self, t):
950 def _load(self, t):
950 '''load, parse, and cache a template'''
951 '''load, parse, and cache a template'''
951 if t not in self._cache:
952 if t not in self._cache:
952 # put poison to cut recursion while compiling 't'
953 # put poison to cut recursion while compiling 't'
953 self._cache[t] = (_runrecursivesymbol, t)
954 self._cache[t] = (_runrecursivesymbol, t)
954 try:
955 try:
955 x = parse(self._loader(t))
956 x = parse(self._loader(t))
957 if self._aliasmap:
958 x = _aliasrules.expand(self._aliasmap, x)
956 self._cache[t] = compileexp(x, self, methods)
959 self._cache[t] = compileexp(x, self, methods)
957 except: # re-raises
960 except: # re-raises
958 del self._cache[t]
961 del self._cache[t]
959 raise
962 raise
960 return self._cache[t]
963 return self._cache[t]
961
964
962 def process(self, t, mapping):
965 def process(self, t, mapping):
963 '''Perform expansion. t is name of map element to expand.
966 '''Perform expansion. t is name of map element to expand.
964 mapping contains added elements for use during expansion. Is a
967 mapping contains added elements for use during expansion. Is a
965 generator.'''
968 generator.'''
966 func, data = self._load(t)
969 func, data = self._load(t)
967 return _flatten(func(self, mapping, data))
970 return _flatten(func(self, mapping, data))
968
971
969 engines = {'default': engine}
972 engines = {'default': engine}
970
973
971 def stylelist():
974 def stylelist():
972 paths = templatepaths()
975 paths = templatepaths()
973 if not paths:
976 if not paths:
974 return _('no templates found, try `hg debuginstall` for more info')
977 return _('no templates found, try `hg debuginstall` for more info')
975 dirlist = os.listdir(paths[0])
978 dirlist = os.listdir(paths[0])
976 stylelist = []
979 stylelist = []
977 for file in dirlist:
980 for file in dirlist:
978 split = file.split(".")
981 split = file.split(".")
979 if split[-1] in ('orig', 'rej'):
982 if split[-1] in ('orig', 'rej'):
980 continue
983 continue
981 if split[0] == "map-cmdline":
984 if split[0] == "map-cmdline":
982 stylelist.append(split[1])
985 stylelist.append(split[1])
983 return ", ".join(sorted(stylelist))
986 return ", ".join(sorted(stylelist))
984
987
985 def _readmapfile(mapfile):
988 def _readmapfile(mapfile):
986 """Load template elements from the given map file"""
989 """Load template elements from the given map file"""
987 if not os.path.exists(mapfile):
990 if not os.path.exists(mapfile):
988 raise error.Abort(_("style '%s' not found") % mapfile,
991 raise error.Abort(_("style '%s' not found") % mapfile,
989 hint=_("available styles: %s") % stylelist())
992 hint=_("available styles: %s") % stylelist())
990
993
991 base = os.path.dirname(mapfile)
994 base = os.path.dirname(mapfile)
992 conf = config.config(includepaths=templatepaths())
995 conf = config.config(includepaths=templatepaths())
993 conf.read(mapfile)
996 conf.read(mapfile)
994
997
995 cache = {}
998 cache = {}
996 tmap = {}
999 tmap = {}
997 for key, val in conf[''].items():
1000 for key, val in conf[''].items():
998 if not val:
1001 if not val:
999 raise error.ParseError(_('missing value'), conf.source('', key))
1002 raise error.ParseError(_('missing value'), conf.source('', key))
1000 if val[0] in "'\"":
1003 if val[0] in "'\"":
1001 if val[0] != val[-1]:
1004 if val[0] != val[-1]:
1002 raise error.ParseError(_('unmatched quotes'),
1005 raise error.ParseError(_('unmatched quotes'),
1003 conf.source('', key))
1006 conf.source('', key))
1004 cache[key] = unquotestring(val)
1007 cache[key] = unquotestring(val)
1005 else:
1008 else:
1006 val = 'default', val
1009 val = 'default', val
1007 if ':' in val[1]:
1010 if ':' in val[1]:
1008 val = val[1].split(':', 1)
1011 val = val[1].split(':', 1)
1009 tmap[key] = val[0], os.path.join(base, val[1])
1012 tmap[key] = val[0], os.path.join(base, val[1])
1010 return cache, tmap
1013 return cache, tmap
1011
1014
1012 class TemplateNotFound(error.Abort):
1015 class TemplateNotFound(error.Abort):
1013 pass
1016 pass
1014
1017
1015 class templater(object):
1018 class templater(object):
1016
1019
1017 def __init__(self, filters=None, defaults=None, cache=None,
1020 def __init__(self, filters=None, defaults=None, cache=None, aliases=(),
1018 minchunk=1024, maxchunk=65536):
1021 minchunk=1024, maxchunk=65536):
1019 '''set up template engine.
1022 '''set up template engine.
1020 filters is dict of functions. each transforms a value into another.
1023 filters is dict of functions. each transforms a value into another.
1021 defaults is dict of default map definitions.'''
1024 defaults is dict of default map definitions.
1025 aliases is list of alias (name, replacement) pairs.
1026 '''
1022 if filters is None:
1027 if filters is None:
1023 filters = {}
1028 filters = {}
1024 if defaults is None:
1029 if defaults is None:
1025 defaults = {}
1030 defaults = {}
1026 if cache is None:
1031 if cache is None:
1027 cache = {}
1032 cache = {}
1028 self.cache = cache.copy()
1033 self.cache = cache.copy()
1029 self.map = {}
1034 self.map = {}
1030 self.filters = templatefilters.filters.copy()
1035 self.filters = templatefilters.filters.copy()
1031 self.filters.update(filters)
1036 self.filters.update(filters)
1032 self.defaults = defaults
1037 self.defaults = defaults
1038 self._aliases = aliases
1033 self.minchunk, self.maxchunk = minchunk, maxchunk
1039 self.minchunk, self.maxchunk = minchunk, maxchunk
1034 self.ecache = {}
1040 self.ecache = {}
1035
1041
1036 @classmethod
1042 @classmethod
1037 def frommapfile(cls, mapfile, filters=None, defaults=None, cache=None,
1043 def frommapfile(cls, mapfile, filters=None, defaults=None, cache=None,
1038 minchunk=1024, maxchunk=65536):
1044 minchunk=1024, maxchunk=65536):
1039 """Create templater from the specified map file"""
1045 """Create templater from the specified map file"""
1040 t = cls(filters, defaults, cache, minchunk, maxchunk)
1046 t = cls(filters, defaults, cache, [], minchunk, maxchunk)
1041 cache, tmap = _readmapfile(mapfile)
1047 cache, tmap = _readmapfile(mapfile)
1042 t.cache.update(cache)
1048 t.cache.update(cache)
1043 t.map = tmap
1049 t.map = tmap
1044 return t
1050 return t
1045
1051
1046 def __contains__(self, key):
1052 def __contains__(self, key):
1047 return key in self.cache or key in self.map
1053 return key in self.cache or key in self.map
1048
1054
1049 def load(self, t):
1055 def load(self, t):
1050 '''Get the template for the given template name. Use a local cache.'''
1056 '''Get the template for the given template name. Use a local cache.'''
1051 if t not in self.cache:
1057 if t not in self.cache:
1052 try:
1058 try:
1053 self.cache[t] = util.readfile(self.map[t][1])
1059 self.cache[t] = util.readfile(self.map[t][1])
1054 except KeyError as inst:
1060 except KeyError as inst:
1055 raise TemplateNotFound(_('"%s" not in template map') %
1061 raise TemplateNotFound(_('"%s" not in template map') %
1056 inst.args[0])
1062 inst.args[0])
1057 except IOError as inst:
1063 except IOError as inst:
1058 raise IOError(inst.args[0], _('template file %s: %s') %
1064 raise IOError(inst.args[0], _('template file %s: %s') %
1059 (self.map[t][1], inst.args[1]))
1065 (self.map[t][1], inst.args[1]))
1060 return self.cache[t]
1066 return self.cache[t]
1061
1067
1062 def __call__(self, t, **mapping):
1068 def __call__(self, t, **mapping):
1063 ttype = t in self.map and self.map[t][0] or 'default'
1069 ttype = t in self.map and self.map[t][0] or 'default'
1064 if ttype not in self.ecache:
1070 if ttype not in self.ecache:
1065 try:
1071 try:
1066 ecls = engines[ttype]
1072 ecls = engines[ttype]
1067 except KeyError:
1073 except KeyError:
1068 raise error.Abort(_('invalid template engine: %s') % ttype)
1074 raise error.Abort(_('invalid template engine: %s') % ttype)
1069 self.ecache[ttype] = ecls(self.load, self.filters, self.defaults)
1075 self.ecache[ttype] = ecls(self.load, self.filters, self.defaults,
1076 self._aliases)
1070 proc = self.ecache[ttype]
1077 proc = self.ecache[ttype]
1071
1078
1072 stream = proc.process(t, mapping)
1079 stream = proc.process(t, mapping)
1073 if self.minchunk:
1080 if self.minchunk:
1074 stream = util.increasingchunks(stream, min=self.minchunk,
1081 stream = util.increasingchunks(stream, min=self.minchunk,
1075 max=self.maxchunk)
1082 max=self.maxchunk)
1076 return stream
1083 return stream
1077
1084
1078 def templatepaths():
1085 def templatepaths():
1079 '''return locations used for template files.'''
1086 '''return locations used for template files.'''
1080 pathsrel = ['templates']
1087 pathsrel = ['templates']
1081 paths = [os.path.normpath(os.path.join(util.datapath, f))
1088 paths = [os.path.normpath(os.path.join(util.datapath, f))
1082 for f in pathsrel]
1089 for f in pathsrel]
1083 return [p for p in paths if os.path.isdir(p)]
1090 return [p for p in paths if os.path.isdir(p)]
1084
1091
1085 def templatepath(name):
1092 def templatepath(name):
1086 '''return location of template file. returns None if not found.'''
1093 '''return location of template file. returns None if not found.'''
1087 for p in templatepaths():
1094 for p in templatepaths():
1088 f = os.path.join(p, name)
1095 f = os.path.join(p, name)
1089 if os.path.exists(f):
1096 if os.path.exists(f):
1090 return f
1097 return f
1091 return None
1098 return None
1092
1099
1093 def stylemap(styles, paths=None):
1100 def stylemap(styles, paths=None):
1094 """Return path to mapfile for a given style.
1101 """Return path to mapfile for a given style.
1095
1102
1096 Searches mapfile in the following locations:
1103 Searches mapfile in the following locations:
1097 1. templatepath/style/map
1104 1. templatepath/style/map
1098 2. templatepath/map-style
1105 2. templatepath/map-style
1099 3. templatepath/map
1106 3. templatepath/map
1100 """
1107 """
1101
1108
1102 if paths is None:
1109 if paths is None:
1103 paths = templatepaths()
1110 paths = templatepaths()
1104 elif isinstance(paths, str):
1111 elif isinstance(paths, str):
1105 paths = [paths]
1112 paths = [paths]
1106
1113
1107 if isinstance(styles, str):
1114 if isinstance(styles, str):
1108 styles = [styles]
1115 styles = [styles]
1109
1116
1110 for style in styles:
1117 for style in styles:
1111 # only plain name is allowed to honor template paths
1118 # only plain name is allowed to honor template paths
1112 if (not style
1119 if (not style
1113 or style in (os.curdir, os.pardir)
1120 or style in (os.curdir, os.pardir)
1114 or os.sep in style
1121 or os.sep in style
1115 or os.altsep and os.altsep in style):
1122 or os.altsep and os.altsep in style):
1116 continue
1123 continue
1117 locations = [os.path.join(style, 'map'), 'map-' + style]
1124 locations = [os.path.join(style, 'map'), 'map-' + style]
1118 locations.append('map')
1125 locations.append('map')
1119
1126
1120 for path in paths:
1127 for path in paths:
1121 for location in locations:
1128 for location in locations:
1122 mapfile = os.path.join(path, location)
1129 mapfile = os.path.join(path, location)
1123 if os.path.isfile(mapfile):
1130 if os.path.isfile(mapfile):
1124 return style, mapfile
1131 return style, mapfile
1125
1132
1126 raise RuntimeError("No hgweb templates found in %r" % paths)
1133 raise RuntimeError("No hgweb templates found in %r" % paths)
1127
1134
1128 def loadfunction(ui, extname, registrarobj):
1135 def loadfunction(ui, extname, registrarobj):
1129 """Load template function from specified registrarobj
1136 """Load template function from specified registrarobj
1130 """
1137 """
1131 for name, func in registrarobj._table.iteritems():
1138 for name, func in registrarobj._table.iteritems():
1132 funcs[name] = func
1139 funcs[name] = func
1133
1140
1134 # tell hggettext to extract docstrings from these functions:
1141 # tell hggettext to extract docstrings from these functions:
1135 i18nfunctions = funcs.values()
1142 i18nfunctions = funcs.values()
@@ -1,3812 +1,3833 b''
1 $ hg init a
1 $ hg init a
2 $ cd a
2 $ cd a
3 $ echo a > a
3 $ echo a > a
4 $ hg add a
4 $ hg add a
5 $ echo line 1 > b
5 $ echo line 1 > b
6 $ echo line 2 >> b
6 $ echo line 2 >> b
7 $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
7 $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
8
8
9 $ hg add b
9 $ hg add b
10 $ echo other 1 > c
10 $ echo other 1 > c
11 $ echo other 2 >> c
11 $ echo other 2 >> c
12 $ echo >> c
12 $ echo >> c
13 $ echo other 3 >> c
13 $ echo other 3 >> c
14 $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
14 $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
15
15
16 $ hg add c
16 $ hg add c
17 $ hg commit -m 'no person' -d '1200000 0' -u 'other@place'
17 $ hg commit -m 'no person' -d '1200000 0' -u 'other@place'
18 $ echo c >> c
18 $ echo c >> c
19 $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
19 $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
20
20
21 $ echo foo > .hg/branch
21 $ echo foo > .hg/branch
22 $ hg commit -m 'new branch' -d '1400000 0' -u 'person'
22 $ hg commit -m 'new branch' -d '1400000 0' -u 'person'
23
23
24 $ hg co -q 3
24 $ hg co -q 3
25 $ echo other 4 >> d
25 $ echo other 4 >> d
26 $ hg add d
26 $ hg add d
27 $ hg commit -m 'new head' -d '1500000 0' -u 'person'
27 $ hg commit -m 'new head' -d '1500000 0' -u 'person'
28
28
29 $ hg merge -q foo
29 $ hg merge -q foo
30 $ hg commit -m 'merge' -d '1500001 0' -u 'person'
30 $ hg commit -m 'merge' -d '1500001 0' -u 'person'
31
31
32 Second branch starting at nullrev:
32 Second branch starting at nullrev:
33
33
34 $ hg update null
34 $ hg update null
35 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
35 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
36 $ echo second > second
36 $ echo second > second
37 $ hg add second
37 $ hg add second
38 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
38 $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
39 created new head
39 created new head
40
40
41 $ echo third > third
41 $ echo third > third
42 $ hg add third
42 $ hg add third
43 $ hg mv second fourth
43 $ hg mv second fourth
44 $ hg commit -m third -d "2020-01-01 10:01"
44 $ hg commit -m third -d "2020-01-01 10:01"
45
45
46 $ hg log --template '{join(file_copies, ",\n")}\n' -r .
46 $ hg log --template '{join(file_copies, ",\n")}\n' -r .
47 fourth (second)
47 fourth (second)
48 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r .
48 $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r .
49 second -> fourth
49 second -> fourth
50 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7
50 $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7
51 8 t
51 8 t
52 7 f
52 7 f
53
53
54 Working-directory revision has special identifiers, though they are still
54 Working-directory revision has special identifiers, though they are still
55 experimental:
55 experimental:
56
56
57 $ hg log -r 'wdir()' -T '{rev}:{node}\n'
57 $ hg log -r 'wdir()' -T '{rev}:{node}\n'
58 2147483647:ffffffffffffffffffffffffffffffffffffffff
58 2147483647:ffffffffffffffffffffffffffffffffffffffff
59
59
60 Some keywords are invalid for working-directory revision, but they should
60 Some keywords are invalid for working-directory revision, but they should
61 never cause crash:
61 never cause crash:
62
62
63 $ hg log -r 'wdir()' -T '{manifest}\n'
63 $ hg log -r 'wdir()' -T '{manifest}\n'
64
64
65
65
66 Quoting for ui.logtemplate
66 Quoting for ui.logtemplate
67
67
68 $ hg tip --config "ui.logtemplate={rev}\n"
68 $ hg tip --config "ui.logtemplate={rev}\n"
69 8
69 8
70 $ hg tip --config "ui.logtemplate='{rev}\n'"
70 $ hg tip --config "ui.logtemplate='{rev}\n'"
71 8
71 8
72 $ hg tip --config 'ui.logtemplate="{rev}\n"'
72 $ hg tip --config 'ui.logtemplate="{rev}\n"'
73 8
73 8
74 $ hg tip --config 'ui.logtemplate=n{rev}\n'
74 $ hg tip --config 'ui.logtemplate=n{rev}\n'
75 n8
75 n8
76
76
77 Make sure user/global hgrc does not affect tests
77 Make sure user/global hgrc does not affect tests
78
78
79 $ echo '[ui]' > .hg/hgrc
79 $ echo '[ui]' > .hg/hgrc
80 $ echo 'logtemplate =' >> .hg/hgrc
80 $ echo 'logtemplate =' >> .hg/hgrc
81 $ echo 'style =' >> .hg/hgrc
81 $ echo 'style =' >> .hg/hgrc
82
82
83 Add some simple styles to settings
83 Add some simple styles to settings
84
84
85 $ echo '[templates]' >> .hg/hgrc
85 $ echo '[templates]' >> .hg/hgrc
86 $ printf 'simple = "{rev}\\n"\n' >> .hg/hgrc
86 $ printf 'simple = "{rev}\\n"\n' >> .hg/hgrc
87 $ printf 'simple2 = {rev}\\n\n' >> .hg/hgrc
87 $ printf 'simple2 = {rev}\\n\n' >> .hg/hgrc
88
88
89 $ hg log -l1 -Tsimple
89 $ hg log -l1 -Tsimple
90 8
90 8
91 $ hg log -l1 -Tsimple2
91 $ hg log -l1 -Tsimple2
92 8
92 8
93
93
94 Test templates and style maps in files:
94 Test templates and style maps in files:
95
95
96 $ echo "{rev}" > tmpl
96 $ echo "{rev}" > tmpl
97 $ hg log -l1 -T./tmpl
97 $ hg log -l1 -T./tmpl
98 8
98 8
99 $ hg log -l1 -Tblah/blah
99 $ hg log -l1 -Tblah/blah
100 blah/blah (no-eol)
100 blah/blah (no-eol)
101
101
102 $ printf 'changeset = "{rev}\\n"\n' > map-simple
102 $ printf 'changeset = "{rev}\\n"\n' > map-simple
103 $ hg log -l1 -T./map-simple
103 $ hg log -l1 -T./map-simple
104 8
104 8
105
105
106 Template should precede style option
106 Template should precede style option
107
107
108 $ hg log -l1 --style default -T '{rev}\n'
108 $ hg log -l1 --style default -T '{rev}\n'
109 8
109 8
110
110
111 Add a commit with empty description, to ensure that the templates
111 Add a commit with empty description, to ensure that the templates
112 below will omit the description line.
112 below will omit the description line.
113
113
114 $ echo c >> c
114 $ echo c >> c
115 $ hg add c
115 $ hg add c
116 $ hg commit -qm ' '
116 $ hg commit -qm ' '
117
117
118 Default style is like normal output. Phases style should be the same
118 Default style is like normal output. Phases style should be the same
119 as default style, except for extra phase lines.
119 as default style, except for extra phase lines.
120
120
121 $ hg log > log.out
121 $ hg log > log.out
122 $ hg log --style default > style.out
122 $ hg log --style default > style.out
123 $ cmp log.out style.out || diff -u log.out style.out
123 $ cmp log.out style.out || diff -u log.out style.out
124 $ hg log -T phases > phases.out
124 $ hg log -T phases > phases.out
125 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
125 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
126 +phase: draft
126 +phase: draft
127 +phase: draft
127 +phase: draft
128 +phase: draft
128 +phase: draft
129 +phase: draft
129 +phase: draft
130 +phase: draft
130 +phase: draft
131 +phase: draft
131 +phase: draft
132 +phase: draft
132 +phase: draft
133 +phase: draft
133 +phase: draft
134 +phase: draft
134 +phase: draft
135 +phase: draft
135 +phase: draft
136
136
137 $ hg log -v > log.out
137 $ hg log -v > log.out
138 $ hg log -v --style default > style.out
138 $ hg log -v --style default > style.out
139 $ cmp log.out style.out || diff -u log.out style.out
139 $ cmp log.out style.out || diff -u log.out style.out
140 $ hg log -v -T phases > phases.out
140 $ hg log -v -T phases > phases.out
141 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
141 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
142 +phase: draft
142 +phase: draft
143 +phase: draft
143 +phase: draft
144 +phase: draft
144 +phase: draft
145 +phase: draft
145 +phase: draft
146 +phase: draft
146 +phase: draft
147 +phase: draft
147 +phase: draft
148 +phase: draft
148 +phase: draft
149 +phase: draft
149 +phase: draft
150 +phase: draft
150 +phase: draft
151 +phase: draft
151 +phase: draft
152
152
153 $ hg log -q > log.out
153 $ hg log -q > log.out
154 $ hg log -q --style default > style.out
154 $ hg log -q --style default > style.out
155 $ cmp log.out style.out || diff -u log.out style.out
155 $ cmp log.out style.out || diff -u log.out style.out
156 $ hg log -q -T phases > phases.out
156 $ hg log -q -T phases > phases.out
157 $ cmp log.out phases.out || diff -u log.out phases.out
157 $ cmp log.out phases.out || diff -u log.out phases.out
158
158
159 $ hg log --debug > log.out
159 $ hg log --debug > log.out
160 $ hg log --debug --style default > style.out
160 $ hg log --debug --style default > style.out
161 $ cmp log.out style.out || diff -u log.out style.out
161 $ cmp log.out style.out || diff -u log.out style.out
162 $ hg log --debug -T phases > phases.out
162 $ hg log --debug -T phases > phases.out
163 $ cmp log.out phases.out || diff -u log.out phases.out
163 $ cmp log.out phases.out || diff -u log.out phases.out
164
164
165 Default style of working-directory revision should also be the same (but
165 Default style of working-directory revision should also be the same (but
166 date may change while running tests):
166 date may change while running tests):
167
167
168 $ hg log -r 'wdir()' | sed 's|^date:.*|date:|' > log.out
168 $ hg log -r 'wdir()' | sed 's|^date:.*|date:|' > log.out
169 $ hg log -r 'wdir()' --style default | sed 's|^date:.*|date:|' > style.out
169 $ hg log -r 'wdir()' --style default | sed 's|^date:.*|date:|' > style.out
170 $ cmp log.out style.out || diff -u log.out style.out
170 $ cmp log.out style.out || diff -u log.out style.out
171
171
172 $ hg log -r 'wdir()' -v | sed 's|^date:.*|date:|' > log.out
172 $ hg log -r 'wdir()' -v | sed 's|^date:.*|date:|' > log.out
173 $ hg log -r 'wdir()' -v --style default | sed 's|^date:.*|date:|' > style.out
173 $ hg log -r 'wdir()' -v --style default | sed 's|^date:.*|date:|' > style.out
174 $ cmp log.out style.out || diff -u log.out style.out
174 $ cmp log.out style.out || diff -u log.out style.out
175
175
176 $ hg log -r 'wdir()' -q > log.out
176 $ hg log -r 'wdir()' -q > log.out
177 $ hg log -r 'wdir()' -q --style default > style.out
177 $ hg log -r 'wdir()' -q --style default > style.out
178 $ cmp log.out style.out || diff -u log.out style.out
178 $ cmp log.out style.out || diff -u log.out style.out
179
179
180 $ hg log -r 'wdir()' --debug | sed 's|^date:.*|date:|' > log.out
180 $ hg log -r 'wdir()' --debug | sed 's|^date:.*|date:|' > log.out
181 $ hg log -r 'wdir()' --debug --style default \
181 $ hg log -r 'wdir()' --debug --style default \
182 > | sed 's|^date:.*|date:|' > style.out
182 > | sed 's|^date:.*|date:|' > style.out
183 $ cmp log.out style.out || diff -u log.out style.out
183 $ cmp log.out style.out || diff -u log.out style.out
184
184
185 Default style should also preserve color information (issue2866):
185 Default style should also preserve color information (issue2866):
186
186
187 $ cp $HGRCPATH $HGRCPATH-bak
187 $ cp $HGRCPATH $HGRCPATH-bak
188 $ cat <<EOF >> $HGRCPATH
188 $ cat <<EOF >> $HGRCPATH
189 > [extensions]
189 > [extensions]
190 > color=
190 > color=
191 > EOF
191 > EOF
192
192
193 $ hg --color=debug log > log.out
193 $ hg --color=debug log > log.out
194 $ hg --color=debug log --style default > style.out
194 $ hg --color=debug log --style default > style.out
195 $ cmp log.out style.out || diff -u log.out style.out
195 $ cmp log.out style.out || diff -u log.out style.out
196 $ hg --color=debug log -T phases > phases.out
196 $ hg --color=debug log -T phases > phases.out
197 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
197 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
198 +[log.phase|phase: draft]
198 +[log.phase|phase: draft]
199 +[log.phase|phase: draft]
199 +[log.phase|phase: draft]
200 +[log.phase|phase: draft]
200 +[log.phase|phase: draft]
201 +[log.phase|phase: draft]
201 +[log.phase|phase: draft]
202 +[log.phase|phase: draft]
202 +[log.phase|phase: draft]
203 +[log.phase|phase: draft]
203 +[log.phase|phase: draft]
204 +[log.phase|phase: draft]
204 +[log.phase|phase: draft]
205 +[log.phase|phase: draft]
205 +[log.phase|phase: draft]
206 +[log.phase|phase: draft]
206 +[log.phase|phase: draft]
207 +[log.phase|phase: draft]
207 +[log.phase|phase: draft]
208
208
209 $ hg --color=debug -v log > log.out
209 $ hg --color=debug -v log > log.out
210 $ hg --color=debug -v log --style default > style.out
210 $ hg --color=debug -v log --style default > style.out
211 $ cmp log.out style.out || diff -u log.out style.out
211 $ cmp log.out style.out || diff -u log.out style.out
212 $ hg --color=debug -v log -T phases > phases.out
212 $ hg --color=debug -v log -T phases > phases.out
213 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
213 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
214 +[log.phase|phase: draft]
214 +[log.phase|phase: draft]
215 +[log.phase|phase: draft]
215 +[log.phase|phase: draft]
216 +[log.phase|phase: draft]
216 +[log.phase|phase: draft]
217 +[log.phase|phase: draft]
217 +[log.phase|phase: draft]
218 +[log.phase|phase: draft]
218 +[log.phase|phase: draft]
219 +[log.phase|phase: draft]
219 +[log.phase|phase: draft]
220 +[log.phase|phase: draft]
220 +[log.phase|phase: draft]
221 +[log.phase|phase: draft]
221 +[log.phase|phase: draft]
222 +[log.phase|phase: draft]
222 +[log.phase|phase: draft]
223 +[log.phase|phase: draft]
223 +[log.phase|phase: draft]
224
224
225 $ hg --color=debug -q log > log.out
225 $ hg --color=debug -q log > log.out
226 $ hg --color=debug -q log --style default > style.out
226 $ hg --color=debug -q log --style default > style.out
227 $ cmp log.out style.out || diff -u log.out style.out
227 $ cmp log.out style.out || diff -u log.out style.out
228 $ hg --color=debug -q log -T phases > phases.out
228 $ hg --color=debug -q log -T phases > phases.out
229 $ cmp log.out phases.out || diff -u log.out phases.out
229 $ cmp log.out phases.out || diff -u log.out phases.out
230
230
231 $ hg --color=debug --debug log > log.out
231 $ hg --color=debug --debug log > log.out
232 $ hg --color=debug --debug log --style default > style.out
232 $ hg --color=debug --debug log --style default > style.out
233 $ cmp log.out style.out || diff -u log.out style.out
233 $ cmp log.out style.out || diff -u log.out style.out
234 $ hg --color=debug --debug log -T phases > phases.out
234 $ hg --color=debug --debug log -T phases > phases.out
235 $ cmp log.out phases.out || diff -u log.out phases.out
235 $ cmp log.out phases.out || diff -u log.out phases.out
236
236
237 $ mv $HGRCPATH-bak $HGRCPATH
237 $ mv $HGRCPATH-bak $HGRCPATH
238
238
239 Remove commit with empty commit message, so as to not pollute further
239 Remove commit with empty commit message, so as to not pollute further
240 tests.
240 tests.
241
241
242 $ hg --config extensions.strip= strip -q .
242 $ hg --config extensions.strip= strip -q .
243
243
244 Revision with no copies (used to print a traceback):
244 Revision with no copies (used to print a traceback):
245
245
246 $ hg tip -v --template '\n'
246 $ hg tip -v --template '\n'
247
247
248
248
249 Compact style works:
249 Compact style works:
250
250
251 $ hg log -Tcompact
251 $ hg log -Tcompact
252 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
252 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
253 third
253 third
254
254
255 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
255 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
256 second
256 second
257
257
258 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
258 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
259 merge
259 merge
260
260
261 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
261 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
262 new head
262 new head
263
263
264 4 bbe44766e73d 1970-01-17 04:53 +0000 person
264 4 bbe44766e73d 1970-01-17 04:53 +0000 person
265 new branch
265 new branch
266
266
267 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
267 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
268 no user, no domain
268 no user, no domain
269
269
270 2 97054abb4ab8 1970-01-14 21:20 +0000 other
270 2 97054abb4ab8 1970-01-14 21:20 +0000 other
271 no person
271 no person
272
272
273 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
273 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
274 other 1
274 other 1
275
275
276 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
276 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
277 line 1
277 line 1
278
278
279
279
280 $ hg log -v --style compact
280 $ hg log -v --style compact
281 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
281 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
282 third
282 third
283
283
284 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
284 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
285 second
285 second
286
286
287 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
287 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
288 merge
288 merge
289
289
290 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
290 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
291 new head
291 new head
292
292
293 4 bbe44766e73d 1970-01-17 04:53 +0000 person
293 4 bbe44766e73d 1970-01-17 04:53 +0000 person
294 new branch
294 new branch
295
295
296 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
296 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
297 no user, no domain
297 no user, no domain
298
298
299 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
299 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
300 no person
300 no person
301
301
302 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
302 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
303 other 1
303 other 1
304 other 2
304 other 2
305
305
306 other 3
306 other 3
307
307
308 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
308 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
309 line 1
309 line 1
310 line 2
310 line 2
311
311
312
312
313 $ hg log --debug --style compact
313 $ hg log --debug --style compact
314 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
314 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
315 third
315 third
316
316
317 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
317 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
318 second
318 second
319
319
320 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
320 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
321 merge
321 merge
322
322
323 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
323 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
324 new head
324 new head
325
325
326 4:3,-1 bbe44766e73d 1970-01-17 04:53 +0000 person
326 4:3,-1 bbe44766e73d 1970-01-17 04:53 +0000 person
327 new branch
327 new branch
328
328
329 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
329 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
330 no user, no domain
330 no user, no domain
331
331
332 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
332 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
333 no person
333 no person
334
334
335 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
335 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
336 other 1
336 other 1
337 other 2
337 other 2
338
338
339 other 3
339 other 3
340
340
341 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
341 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
342 line 1
342 line 1
343 line 2
343 line 2
344
344
345
345
346 Test xml styles:
346 Test xml styles:
347
347
348 $ hg log --style xml -r 'not all()'
348 $ hg log --style xml -r 'not all()'
349 <?xml version="1.0"?>
349 <?xml version="1.0"?>
350 <log>
350 <log>
351 </log>
351 </log>
352
352
353 $ hg log --style xml
353 $ hg log --style xml
354 <?xml version="1.0"?>
354 <?xml version="1.0"?>
355 <log>
355 <log>
356 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
356 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
357 <tag>tip</tag>
357 <tag>tip</tag>
358 <author email="test">test</author>
358 <author email="test">test</author>
359 <date>2020-01-01T10:01:00+00:00</date>
359 <date>2020-01-01T10:01:00+00:00</date>
360 <msg xml:space="preserve">third</msg>
360 <msg xml:space="preserve">third</msg>
361 </logentry>
361 </logentry>
362 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
362 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
363 <parent revision="-1" node="0000000000000000000000000000000000000000" />
363 <parent revision="-1" node="0000000000000000000000000000000000000000" />
364 <author email="user@hostname">User Name</author>
364 <author email="user@hostname">User Name</author>
365 <date>1970-01-12T13:46:40+00:00</date>
365 <date>1970-01-12T13:46:40+00:00</date>
366 <msg xml:space="preserve">second</msg>
366 <msg xml:space="preserve">second</msg>
367 </logentry>
367 </logentry>
368 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
368 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
369 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
369 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
370 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
370 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
371 <author email="person">person</author>
371 <author email="person">person</author>
372 <date>1970-01-18T08:40:01+00:00</date>
372 <date>1970-01-18T08:40:01+00:00</date>
373 <msg xml:space="preserve">merge</msg>
373 <msg xml:space="preserve">merge</msg>
374 </logentry>
374 </logentry>
375 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
375 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
376 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
376 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
377 <author email="person">person</author>
377 <author email="person">person</author>
378 <date>1970-01-18T08:40:00+00:00</date>
378 <date>1970-01-18T08:40:00+00:00</date>
379 <msg xml:space="preserve">new head</msg>
379 <msg xml:space="preserve">new head</msg>
380 </logentry>
380 </logentry>
381 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
381 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
382 <branch>foo</branch>
382 <branch>foo</branch>
383 <author email="person">person</author>
383 <author email="person">person</author>
384 <date>1970-01-17T04:53:20+00:00</date>
384 <date>1970-01-17T04:53:20+00:00</date>
385 <msg xml:space="preserve">new branch</msg>
385 <msg xml:space="preserve">new branch</msg>
386 </logentry>
386 </logentry>
387 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
387 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
388 <author email="person">person</author>
388 <author email="person">person</author>
389 <date>1970-01-16T01:06:40+00:00</date>
389 <date>1970-01-16T01:06:40+00:00</date>
390 <msg xml:space="preserve">no user, no domain</msg>
390 <msg xml:space="preserve">no user, no domain</msg>
391 </logentry>
391 </logentry>
392 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
392 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
393 <author email="other@place">other</author>
393 <author email="other@place">other</author>
394 <date>1970-01-14T21:20:00+00:00</date>
394 <date>1970-01-14T21:20:00+00:00</date>
395 <msg xml:space="preserve">no person</msg>
395 <msg xml:space="preserve">no person</msg>
396 </logentry>
396 </logentry>
397 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
397 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
398 <author email="other@place">A. N. Other</author>
398 <author email="other@place">A. N. Other</author>
399 <date>1970-01-13T17:33:20+00:00</date>
399 <date>1970-01-13T17:33:20+00:00</date>
400 <msg xml:space="preserve">other 1
400 <msg xml:space="preserve">other 1
401 other 2
401 other 2
402
402
403 other 3</msg>
403 other 3</msg>
404 </logentry>
404 </logentry>
405 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
405 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
406 <author email="user@hostname">User Name</author>
406 <author email="user@hostname">User Name</author>
407 <date>1970-01-12T13:46:40+00:00</date>
407 <date>1970-01-12T13:46:40+00:00</date>
408 <msg xml:space="preserve">line 1
408 <msg xml:space="preserve">line 1
409 line 2</msg>
409 line 2</msg>
410 </logentry>
410 </logentry>
411 </log>
411 </log>
412
412
413 $ hg log -v --style xml
413 $ hg log -v --style xml
414 <?xml version="1.0"?>
414 <?xml version="1.0"?>
415 <log>
415 <log>
416 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
416 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
417 <tag>tip</tag>
417 <tag>tip</tag>
418 <author email="test">test</author>
418 <author email="test">test</author>
419 <date>2020-01-01T10:01:00+00:00</date>
419 <date>2020-01-01T10:01:00+00:00</date>
420 <msg xml:space="preserve">third</msg>
420 <msg xml:space="preserve">third</msg>
421 <paths>
421 <paths>
422 <path action="A">fourth</path>
422 <path action="A">fourth</path>
423 <path action="A">third</path>
423 <path action="A">third</path>
424 <path action="R">second</path>
424 <path action="R">second</path>
425 </paths>
425 </paths>
426 <copies>
426 <copies>
427 <copy source="second">fourth</copy>
427 <copy source="second">fourth</copy>
428 </copies>
428 </copies>
429 </logentry>
429 </logentry>
430 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
430 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
431 <parent revision="-1" node="0000000000000000000000000000000000000000" />
431 <parent revision="-1" node="0000000000000000000000000000000000000000" />
432 <author email="user@hostname">User Name</author>
432 <author email="user@hostname">User Name</author>
433 <date>1970-01-12T13:46:40+00:00</date>
433 <date>1970-01-12T13:46:40+00:00</date>
434 <msg xml:space="preserve">second</msg>
434 <msg xml:space="preserve">second</msg>
435 <paths>
435 <paths>
436 <path action="A">second</path>
436 <path action="A">second</path>
437 </paths>
437 </paths>
438 </logentry>
438 </logentry>
439 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
439 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
440 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
440 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
441 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
441 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
442 <author email="person">person</author>
442 <author email="person">person</author>
443 <date>1970-01-18T08:40:01+00:00</date>
443 <date>1970-01-18T08:40:01+00:00</date>
444 <msg xml:space="preserve">merge</msg>
444 <msg xml:space="preserve">merge</msg>
445 <paths>
445 <paths>
446 </paths>
446 </paths>
447 </logentry>
447 </logentry>
448 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
448 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
449 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
449 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
450 <author email="person">person</author>
450 <author email="person">person</author>
451 <date>1970-01-18T08:40:00+00:00</date>
451 <date>1970-01-18T08:40:00+00:00</date>
452 <msg xml:space="preserve">new head</msg>
452 <msg xml:space="preserve">new head</msg>
453 <paths>
453 <paths>
454 <path action="A">d</path>
454 <path action="A">d</path>
455 </paths>
455 </paths>
456 </logentry>
456 </logentry>
457 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
457 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
458 <branch>foo</branch>
458 <branch>foo</branch>
459 <author email="person">person</author>
459 <author email="person">person</author>
460 <date>1970-01-17T04:53:20+00:00</date>
460 <date>1970-01-17T04:53:20+00:00</date>
461 <msg xml:space="preserve">new branch</msg>
461 <msg xml:space="preserve">new branch</msg>
462 <paths>
462 <paths>
463 </paths>
463 </paths>
464 </logentry>
464 </logentry>
465 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
465 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
466 <author email="person">person</author>
466 <author email="person">person</author>
467 <date>1970-01-16T01:06:40+00:00</date>
467 <date>1970-01-16T01:06:40+00:00</date>
468 <msg xml:space="preserve">no user, no domain</msg>
468 <msg xml:space="preserve">no user, no domain</msg>
469 <paths>
469 <paths>
470 <path action="M">c</path>
470 <path action="M">c</path>
471 </paths>
471 </paths>
472 </logentry>
472 </logentry>
473 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
473 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
474 <author email="other@place">other</author>
474 <author email="other@place">other</author>
475 <date>1970-01-14T21:20:00+00:00</date>
475 <date>1970-01-14T21:20:00+00:00</date>
476 <msg xml:space="preserve">no person</msg>
476 <msg xml:space="preserve">no person</msg>
477 <paths>
477 <paths>
478 <path action="A">c</path>
478 <path action="A">c</path>
479 </paths>
479 </paths>
480 </logentry>
480 </logentry>
481 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
481 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
482 <author email="other@place">A. N. Other</author>
482 <author email="other@place">A. N. Other</author>
483 <date>1970-01-13T17:33:20+00:00</date>
483 <date>1970-01-13T17:33:20+00:00</date>
484 <msg xml:space="preserve">other 1
484 <msg xml:space="preserve">other 1
485 other 2
485 other 2
486
486
487 other 3</msg>
487 other 3</msg>
488 <paths>
488 <paths>
489 <path action="A">b</path>
489 <path action="A">b</path>
490 </paths>
490 </paths>
491 </logentry>
491 </logentry>
492 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
492 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
493 <author email="user@hostname">User Name</author>
493 <author email="user@hostname">User Name</author>
494 <date>1970-01-12T13:46:40+00:00</date>
494 <date>1970-01-12T13:46:40+00:00</date>
495 <msg xml:space="preserve">line 1
495 <msg xml:space="preserve">line 1
496 line 2</msg>
496 line 2</msg>
497 <paths>
497 <paths>
498 <path action="A">a</path>
498 <path action="A">a</path>
499 </paths>
499 </paths>
500 </logentry>
500 </logentry>
501 </log>
501 </log>
502
502
503 $ hg log --debug --style xml
503 $ hg log --debug --style xml
504 <?xml version="1.0"?>
504 <?xml version="1.0"?>
505 <log>
505 <log>
506 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
506 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
507 <tag>tip</tag>
507 <tag>tip</tag>
508 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
508 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
509 <parent revision="-1" node="0000000000000000000000000000000000000000" />
509 <parent revision="-1" node="0000000000000000000000000000000000000000" />
510 <author email="test">test</author>
510 <author email="test">test</author>
511 <date>2020-01-01T10:01:00+00:00</date>
511 <date>2020-01-01T10:01:00+00:00</date>
512 <msg xml:space="preserve">third</msg>
512 <msg xml:space="preserve">third</msg>
513 <paths>
513 <paths>
514 <path action="A">fourth</path>
514 <path action="A">fourth</path>
515 <path action="A">third</path>
515 <path action="A">third</path>
516 <path action="R">second</path>
516 <path action="R">second</path>
517 </paths>
517 </paths>
518 <copies>
518 <copies>
519 <copy source="second">fourth</copy>
519 <copy source="second">fourth</copy>
520 </copies>
520 </copies>
521 <extra key="branch">default</extra>
521 <extra key="branch">default</extra>
522 </logentry>
522 </logentry>
523 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
523 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
524 <parent revision="-1" node="0000000000000000000000000000000000000000" />
524 <parent revision="-1" node="0000000000000000000000000000000000000000" />
525 <parent revision="-1" node="0000000000000000000000000000000000000000" />
525 <parent revision="-1" node="0000000000000000000000000000000000000000" />
526 <author email="user@hostname">User Name</author>
526 <author email="user@hostname">User Name</author>
527 <date>1970-01-12T13:46:40+00:00</date>
527 <date>1970-01-12T13:46:40+00:00</date>
528 <msg xml:space="preserve">second</msg>
528 <msg xml:space="preserve">second</msg>
529 <paths>
529 <paths>
530 <path action="A">second</path>
530 <path action="A">second</path>
531 </paths>
531 </paths>
532 <extra key="branch">default</extra>
532 <extra key="branch">default</extra>
533 </logentry>
533 </logentry>
534 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
534 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
535 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
535 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
536 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
536 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
537 <author email="person">person</author>
537 <author email="person">person</author>
538 <date>1970-01-18T08:40:01+00:00</date>
538 <date>1970-01-18T08:40:01+00:00</date>
539 <msg xml:space="preserve">merge</msg>
539 <msg xml:space="preserve">merge</msg>
540 <paths>
540 <paths>
541 </paths>
541 </paths>
542 <extra key="branch">default</extra>
542 <extra key="branch">default</extra>
543 </logentry>
543 </logentry>
544 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
544 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
545 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
545 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
546 <parent revision="-1" node="0000000000000000000000000000000000000000" />
546 <parent revision="-1" node="0000000000000000000000000000000000000000" />
547 <author email="person">person</author>
547 <author email="person">person</author>
548 <date>1970-01-18T08:40:00+00:00</date>
548 <date>1970-01-18T08:40:00+00:00</date>
549 <msg xml:space="preserve">new head</msg>
549 <msg xml:space="preserve">new head</msg>
550 <paths>
550 <paths>
551 <path action="A">d</path>
551 <path action="A">d</path>
552 </paths>
552 </paths>
553 <extra key="branch">default</extra>
553 <extra key="branch">default</extra>
554 </logentry>
554 </logentry>
555 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
555 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
556 <branch>foo</branch>
556 <branch>foo</branch>
557 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
557 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
558 <parent revision="-1" node="0000000000000000000000000000000000000000" />
558 <parent revision="-1" node="0000000000000000000000000000000000000000" />
559 <author email="person">person</author>
559 <author email="person">person</author>
560 <date>1970-01-17T04:53:20+00:00</date>
560 <date>1970-01-17T04:53:20+00:00</date>
561 <msg xml:space="preserve">new branch</msg>
561 <msg xml:space="preserve">new branch</msg>
562 <paths>
562 <paths>
563 </paths>
563 </paths>
564 <extra key="branch">foo</extra>
564 <extra key="branch">foo</extra>
565 </logentry>
565 </logentry>
566 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
566 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
567 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
567 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
568 <parent revision="-1" node="0000000000000000000000000000000000000000" />
568 <parent revision="-1" node="0000000000000000000000000000000000000000" />
569 <author email="person">person</author>
569 <author email="person">person</author>
570 <date>1970-01-16T01:06:40+00:00</date>
570 <date>1970-01-16T01:06:40+00:00</date>
571 <msg xml:space="preserve">no user, no domain</msg>
571 <msg xml:space="preserve">no user, no domain</msg>
572 <paths>
572 <paths>
573 <path action="M">c</path>
573 <path action="M">c</path>
574 </paths>
574 </paths>
575 <extra key="branch">default</extra>
575 <extra key="branch">default</extra>
576 </logentry>
576 </logentry>
577 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
577 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
578 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
578 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
579 <parent revision="-1" node="0000000000000000000000000000000000000000" />
579 <parent revision="-1" node="0000000000000000000000000000000000000000" />
580 <author email="other@place">other</author>
580 <author email="other@place">other</author>
581 <date>1970-01-14T21:20:00+00:00</date>
581 <date>1970-01-14T21:20:00+00:00</date>
582 <msg xml:space="preserve">no person</msg>
582 <msg xml:space="preserve">no person</msg>
583 <paths>
583 <paths>
584 <path action="A">c</path>
584 <path action="A">c</path>
585 </paths>
585 </paths>
586 <extra key="branch">default</extra>
586 <extra key="branch">default</extra>
587 </logentry>
587 </logentry>
588 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
588 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
589 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
589 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
590 <parent revision="-1" node="0000000000000000000000000000000000000000" />
590 <parent revision="-1" node="0000000000000000000000000000000000000000" />
591 <author email="other@place">A. N. Other</author>
591 <author email="other@place">A. N. Other</author>
592 <date>1970-01-13T17:33:20+00:00</date>
592 <date>1970-01-13T17:33:20+00:00</date>
593 <msg xml:space="preserve">other 1
593 <msg xml:space="preserve">other 1
594 other 2
594 other 2
595
595
596 other 3</msg>
596 other 3</msg>
597 <paths>
597 <paths>
598 <path action="A">b</path>
598 <path action="A">b</path>
599 </paths>
599 </paths>
600 <extra key="branch">default</extra>
600 <extra key="branch">default</extra>
601 </logentry>
601 </logentry>
602 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
602 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
603 <parent revision="-1" node="0000000000000000000000000000000000000000" />
603 <parent revision="-1" node="0000000000000000000000000000000000000000" />
604 <parent revision="-1" node="0000000000000000000000000000000000000000" />
604 <parent revision="-1" node="0000000000000000000000000000000000000000" />
605 <author email="user@hostname">User Name</author>
605 <author email="user@hostname">User Name</author>
606 <date>1970-01-12T13:46:40+00:00</date>
606 <date>1970-01-12T13:46:40+00:00</date>
607 <msg xml:space="preserve">line 1
607 <msg xml:space="preserve">line 1
608 line 2</msg>
608 line 2</msg>
609 <paths>
609 <paths>
610 <path action="A">a</path>
610 <path action="A">a</path>
611 </paths>
611 </paths>
612 <extra key="branch">default</extra>
612 <extra key="branch">default</extra>
613 </logentry>
613 </logentry>
614 </log>
614 </log>
615
615
616
616
617 Test JSON style:
617 Test JSON style:
618
618
619 $ hg log -k nosuch -Tjson
619 $ hg log -k nosuch -Tjson
620 []
620 []
621
621
622 $ hg log -qr . -Tjson
622 $ hg log -qr . -Tjson
623 [
623 [
624 {
624 {
625 "rev": 8,
625 "rev": 8,
626 "node": "95c24699272ef57d062b8bccc32c878bf841784a"
626 "node": "95c24699272ef57d062b8bccc32c878bf841784a"
627 }
627 }
628 ]
628 ]
629
629
630 $ hg log -vpr . -Tjson --stat
630 $ hg log -vpr . -Tjson --stat
631 [
631 [
632 {
632 {
633 "rev": 8,
633 "rev": 8,
634 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
634 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
635 "branch": "default",
635 "branch": "default",
636 "phase": "draft",
636 "phase": "draft",
637 "user": "test",
637 "user": "test",
638 "date": [1577872860, 0],
638 "date": [1577872860, 0],
639 "desc": "third",
639 "desc": "third",
640 "bookmarks": [],
640 "bookmarks": [],
641 "tags": ["tip"],
641 "tags": ["tip"],
642 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
642 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
643 "files": ["fourth", "second", "third"],
643 "files": ["fourth", "second", "third"],
644 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
644 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
645 "diff": "diff -r 29114dbae42b -r 95c24699272e fourth\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/fourth\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+second\ndiff -r 29114dbae42b -r 95c24699272e second\n--- a/second\tMon Jan 12 13:46:40 1970 +0000\n+++ /dev/null\tThu Jan 01 00:00:00 1970 +0000\n@@ -1,1 +0,0 @@\n-second\ndiff -r 29114dbae42b -r 95c24699272e third\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/third\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+third\n"
645 "diff": "diff -r 29114dbae42b -r 95c24699272e fourth\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/fourth\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+second\ndiff -r 29114dbae42b -r 95c24699272e second\n--- a/second\tMon Jan 12 13:46:40 1970 +0000\n+++ /dev/null\tThu Jan 01 00:00:00 1970 +0000\n@@ -1,1 +0,0 @@\n-second\ndiff -r 29114dbae42b -r 95c24699272e third\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/third\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+third\n"
646 }
646 }
647 ]
647 ]
648
648
649 honor --git but not format-breaking diffopts
649 honor --git but not format-breaking diffopts
650 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
650 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
651 [
651 [
652 {
652 {
653 "rev": 8,
653 "rev": 8,
654 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
654 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
655 "branch": "default",
655 "branch": "default",
656 "phase": "draft",
656 "phase": "draft",
657 "user": "test",
657 "user": "test",
658 "date": [1577872860, 0],
658 "date": [1577872860, 0],
659 "desc": "third",
659 "desc": "third",
660 "bookmarks": [],
660 "bookmarks": [],
661 "tags": ["tip"],
661 "tags": ["tip"],
662 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
662 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
663 "files": ["fourth", "second", "third"],
663 "files": ["fourth", "second", "third"],
664 "diff": "diff --git a/second b/fourth\nrename from second\nrename to fourth\ndiff --git a/third b/third\nnew file mode 100644\n--- /dev/null\n+++ b/third\n@@ -0,0 +1,1 @@\n+third\n"
664 "diff": "diff --git a/second b/fourth\nrename from second\nrename to fourth\ndiff --git a/third b/third\nnew file mode 100644\n--- /dev/null\n+++ b/third\n@@ -0,0 +1,1 @@\n+third\n"
665 }
665 }
666 ]
666 ]
667
667
668 $ hg log -T json
668 $ hg log -T json
669 [
669 [
670 {
670 {
671 "rev": 8,
671 "rev": 8,
672 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
672 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
673 "branch": "default",
673 "branch": "default",
674 "phase": "draft",
674 "phase": "draft",
675 "user": "test",
675 "user": "test",
676 "date": [1577872860, 0],
676 "date": [1577872860, 0],
677 "desc": "third",
677 "desc": "third",
678 "bookmarks": [],
678 "bookmarks": [],
679 "tags": ["tip"],
679 "tags": ["tip"],
680 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"]
680 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"]
681 },
681 },
682 {
682 {
683 "rev": 7,
683 "rev": 7,
684 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
684 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
685 "branch": "default",
685 "branch": "default",
686 "phase": "draft",
686 "phase": "draft",
687 "user": "User Name <user@hostname>",
687 "user": "User Name <user@hostname>",
688 "date": [1000000, 0],
688 "date": [1000000, 0],
689 "desc": "second",
689 "desc": "second",
690 "bookmarks": [],
690 "bookmarks": [],
691 "tags": [],
691 "tags": [],
692 "parents": ["0000000000000000000000000000000000000000"]
692 "parents": ["0000000000000000000000000000000000000000"]
693 },
693 },
694 {
694 {
695 "rev": 6,
695 "rev": 6,
696 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
696 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
697 "branch": "default",
697 "branch": "default",
698 "phase": "draft",
698 "phase": "draft",
699 "user": "person",
699 "user": "person",
700 "date": [1500001, 0],
700 "date": [1500001, 0],
701 "desc": "merge",
701 "desc": "merge",
702 "bookmarks": [],
702 "bookmarks": [],
703 "tags": [],
703 "tags": [],
704 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"]
704 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"]
705 },
705 },
706 {
706 {
707 "rev": 5,
707 "rev": 5,
708 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
708 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
709 "branch": "default",
709 "branch": "default",
710 "phase": "draft",
710 "phase": "draft",
711 "user": "person",
711 "user": "person",
712 "date": [1500000, 0],
712 "date": [1500000, 0],
713 "desc": "new head",
713 "desc": "new head",
714 "bookmarks": [],
714 "bookmarks": [],
715 "tags": [],
715 "tags": [],
716 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
716 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
717 },
717 },
718 {
718 {
719 "rev": 4,
719 "rev": 4,
720 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
720 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
721 "branch": "foo",
721 "branch": "foo",
722 "phase": "draft",
722 "phase": "draft",
723 "user": "person",
723 "user": "person",
724 "date": [1400000, 0],
724 "date": [1400000, 0],
725 "desc": "new branch",
725 "desc": "new branch",
726 "bookmarks": [],
726 "bookmarks": [],
727 "tags": [],
727 "tags": [],
728 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
728 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
729 },
729 },
730 {
730 {
731 "rev": 3,
731 "rev": 3,
732 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
732 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
733 "branch": "default",
733 "branch": "default",
734 "phase": "draft",
734 "phase": "draft",
735 "user": "person",
735 "user": "person",
736 "date": [1300000, 0],
736 "date": [1300000, 0],
737 "desc": "no user, no domain",
737 "desc": "no user, no domain",
738 "bookmarks": [],
738 "bookmarks": [],
739 "tags": [],
739 "tags": [],
740 "parents": ["97054abb4ab824450e9164180baf491ae0078465"]
740 "parents": ["97054abb4ab824450e9164180baf491ae0078465"]
741 },
741 },
742 {
742 {
743 "rev": 2,
743 "rev": 2,
744 "node": "97054abb4ab824450e9164180baf491ae0078465",
744 "node": "97054abb4ab824450e9164180baf491ae0078465",
745 "branch": "default",
745 "branch": "default",
746 "phase": "draft",
746 "phase": "draft",
747 "user": "other@place",
747 "user": "other@place",
748 "date": [1200000, 0],
748 "date": [1200000, 0],
749 "desc": "no person",
749 "desc": "no person",
750 "bookmarks": [],
750 "bookmarks": [],
751 "tags": [],
751 "tags": [],
752 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"]
752 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"]
753 },
753 },
754 {
754 {
755 "rev": 1,
755 "rev": 1,
756 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
756 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
757 "branch": "default",
757 "branch": "default",
758 "phase": "draft",
758 "phase": "draft",
759 "user": "A. N. Other <other@place>",
759 "user": "A. N. Other <other@place>",
760 "date": [1100000, 0],
760 "date": [1100000, 0],
761 "desc": "other 1\nother 2\n\nother 3",
761 "desc": "other 1\nother 2\n\nother 3",
762 "bookmarks": [],
762 "bookmarks": [],
763 "tags": [],
763 "tags": [],
764 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"]
764 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"]
765 },
765 },
766 {
766 {
767 "rev": 0,
767 "rev": 0,
768 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
768 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
769 "branch": "default",
769 "branch": "default",
770 "phase": "draft",
770 "phase": "draft",
771 "user": "User Name <user@hostname>",
771 "user": "User Name <user@hostname>",
772 "date": [1000000, 0],
772 "date": [1000000, 0],
773 "desc": "line 1\nline 2",
773 "desc": "line 1\nline 2",
774 "bookmarks": [],
774 "bookmarks": [],
775 "tags": [],
775 "tags": [],
776 "parents": ["0000000000000000000000000000000000000000"]
776 "parents": ["0000000000000000000000000000000000000000"]
777 }
777 }
778 ]
778 ]
779
779
780 $ hg heads -v -Tjson
780 $ hg heads -v -Tjson
781 [
781 [
782 {
782 {
783 "rev": 8,
783 "rev": 8,
784 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
784 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
785 "branch": "default",
785 "branch": "default",
786 "phase": "draft",
786 "phase": "draft",
787 "user": "test",
787 "user": "test",
788 "date": [1577872860, 0],
788 "date": [1577872860, 0],
789 "desc": "third",
789 "desc": "third",
790 "bookmarks": [],
790 "bookmarks": [],
791 "tags": ["tip"],
791 "tags": ["tip"],
792 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
792 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
793 "files": ["fourth", "second", "third"]
793 "files": ["fourth", "second", "third"]
794 },
794 },
795 {
795 {
796 "rev": 6,
796 "rev": 6,
797 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
797 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
798 "branch": "default",
798 "branch": "default",
799 "phase": "draft",
799 "phase": "draft",
800 "user": "person",
800 "user": "person",
801 "date": [1500001, 0],
801 "date": [1500001, 0],
802 "desc": "merge",
802 "desc": "merge",
803 "bookmarks": [],
803 "bookmarks": [],
804 "tags": [],
804 "tags": [],
805 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
805 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
806 "files": []
806 "files": []
807 },
807 },
808 {
808 {
809 "rev": 4,
809 "rev": 4,
810 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
810 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
811 "branch": "foo",
811 "branch": "foo",
812 "phase": "draft",
812 "phase": "draft",
813 "user": "person",
813 "user": "person",
814 "date": [1400000, 0],
814 "date": [1400000, 0],
815 "desc": "new branch",
815 "desc": "new branch",
816 "bookmarks": [],
816 "bookmarks": [],
817 "tags": [],
817 "tags": [],
818 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
818 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
819 "files": []
819 "files": []
820 }
820 }
821 ]
821 ]
822
822
823 $ hg log --debug -Tjson
823 $ hg log --debug -Tjson
824 [
824 [
825 {
825 {
826 "rev": 8,
826 "rev": 8,
827 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
827 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
828 "branch": "default",
828 "branch": "default",
829 "phase": "draft",
829 "phase": "draft",
830 "user": "test",
830 "user": "test",
831 "date": [1577872860, 0],
831 "date": [1577872860, 0],
832 "desc": "third",
832 "desc": "third",
833 "bookmarks": [],
833 "bookmarks": [],
834 "tags": ["tip"],
834 "tags": ["tip"],
835 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
835 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
836 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
836 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
837 "extra": {"branch": "default"},
837 "extra": {"branch": "default"},
838 "modified": [],
838 "modified": [],
839 "added": ["fourth", "third"],
839 "added": ["fourth", "third"],
840 "removed": ["second"]
840 "removed": ["second"]
841 },
841 },
842 {
842 {
843 "rev": 7,
843 "rev": 7,
844 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
844 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
845 "branch": "default",
845 "branch": "default",
846 "phase": "draft",
846 "phase": "draft",
847 "user": "User Name <user@hostname>",
847 "user": "User Name <user@hostname>",
848 "date": [1000000, 0],
848 "date": [1000000, 0],
849 "desc": "second",
849 "desc": "second",
850 "bookmarks": [],
850 "bookmarks": [],
851 "tags": [],
851 "tags": [],
852 "parents": ["0000000000000000000000000000000000000000"],
852 "parents": ["0000000000000000000000000000000000000000"],
853 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
853 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
854 "extra": {"branch": "default"},
854 "extra": {"branch": "default"},
855 "modified": [],
855 "modified": [],
856 "added": ["second"],
856 "added": ["second"],
857 "removed": []
857 "removed": []
858 },
858 },
859 {
859 {
860 "rev": 6,
860 "rev": 6,
861 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
861 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
862 "branch": "default",
862 "branch": "default",
863 "phase": "draft",
863 "phase": "draft",
864 "user": "person",
864 "user": "person",
865 "date": [1500001, 0],
865 "date": [1500001, 0],
866 "desc": "merge",
866 "desc": "merge",
867 "bookmarks": [],
867 "bookmarks": [],
868 "tags": [],
868 "tags": [],
869 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
869 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
870 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
870 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
871 "extra": {"branch": "default"},
871 "extra": {"branch": "default"},
872 "modified": [],
872 "modified": [],
873 "added": [],
873 "added": [],
874 "removed": []
874 "removed": []
875 },
875 },
876 {
876 {
877 "rev": 5,
877 "rev": 5,
878 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
878 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
879 "branch": "default",
879 "branch": "default",
880 "phase": "draft",
880 "phase": "draft",
881 "user": "person",
881 "user": "person",
882 "date": [1500000, 0],
882 "date": [1500000, 0],
883 "desc": "new head",
883 "desc": "new head",
884 "bookmarks": [],
884 "bookmarks": [],
885 "tags": [],
885 "tags": [],
886 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
886 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
887 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
887 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
888 "extra": {"branch": "default"},
888 "extra": {"branch": "default"},
889 "modified": [],
889 "modified": [],
890 "added": ["d"],
890 "added": ["d"],
891 "removed": []
891 "removed": []
892 },
892 },
893 {
893 {
894 "rev": 4,
894 "rev": 4,
895 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
895 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
896 "branch": "foo",
896 "branch": "foo",
897 "phase": "draft",
897 "phase": "draft",
898 "user": "person",
898 "user": "person",
899 "date": [1400000, 0],
899 "date": [1400000, 0],
900 "desc": "new branch",
900 "desc": "new branch",
901 "bookmarks": [],
901 "bookmarks": [],
902 "tags": [],
902 "tags": [],
903 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
903 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
904 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
904 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
905 "extra": {"branch": "foo"},
905 "extra": {"branch": "foo"},
906 "modified": [],
906 "modified": [],
907 "added": [],
907 "added": [],
908 "removed": []
908 "removed": []
909 },
909 },
910 {
910 {
911 "rev": 3,
911 "rev": 3,
912 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
912 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
913 "branch": "default",
913 "branch": "default",
914 "phase": "draft",
914 "phase": "draft",
915 "user": "person",
915 "user": "person",
916 "date": [1300000, 0],
916 "date": [1300000, 0],
917 "desc": "no user, no domain",
917 "desc": "no user, no domain",
918 "bookmarks": [],
918 "bookmarks": [],
919 "tags": [],
919 "tags": [],
920 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
920 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
921 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
921 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
922 "extra": {"branch": "default"},
922 "extra": {"branch": "default"},
923 "modified": ["c"],
923 "modified": ["c"],
924 "added": [],
924 "added": [],
925 "removed": []
925 "removed": []
926 },
926 },
927 {
927 {
928 "rev": 2,
928 "rev": 2,
929 "node": "97054abb4ab824450e9164180baf491ae0078465",
929 "node": "97054abb4ab824450e9164180baf491ae0078465",
930 "branch": "default",
930 "branch": "default",
931 "phase": "draft",
931 "phase": "draft",
932 "user": "other@place",
932 "user": "other@place",
933 "date": [1200000, 0],
933 "date": [1200000, 0],
934 "desc": "no person",
934 "desc": "no person",
935 "bookmarks": [],
935 "bookmarks": [],
936 "tags": [],
936 "tags": [],
937 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
937 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
938 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
938 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
939 "extra": {"branch": "default"},
939 "extra": {"branch": "default"},
940 "modified": [],
940 "modified": [],
941 "added": ["c"],
941 "added": ["c"],
942 "removed": []
942 "removed": []
943 },
943 },
944 {
944 {
945 "rev": 1,
945 "rev": 1,
946 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
946 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
947 "branch": "default",
947 "branch": "default",
948 "phase": "draft",
948 "phase": "draft",
949 "user": "A. N. Other <other@place>",
949 "user": "A. N. Other <other@place>",
950 "date": [1100000, 0],
950 "date": [1100000, 0],
951 "desc": "other 1\nother 2\n\nother 3",
951 "desc": "other 1\nother 2\n\nother 3",
952 "bookmarks": [],
952 "bookmarks": [],
953 "tags": [],
953 "tags": [],
954 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
954 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
955 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
955 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
956 "extra": {"branch": "default"},
956 "extra": {"branch": "default"},
957 "modified": [],
957 "modified": [],
958 "added": ["b"],
958 "added": ["b"],
959 "removed": []
959 "removed": []
960 },
960 },
961 {
961 {
962 "rev": 0,
962 "rev": 0,
963 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
963 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
964 "branch": "default",
964 "branch": "default",
965 "phase": "draft",
965 "phase": "draft",
966 "user": "User Name <user@hostname>",
966 "user": "User Name <user@hostname>",
967 "date": [1000000, 0],
967 "date": [1000000, 0],
968 "desc": "line 1\nline 2",
968 "desc": "line 1\nline 2",
969 "bookmarks": [],
969 "bookmarks": [],
970 "tags": [],
970 "tags": [],
971 "parents": ["0000000000000000000000000000000000000000"],
971 "parents": ["0000000000000000000000000000000000000000"],
972 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
972 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
973 "extra": {"branch": "default"},
973 "extra": {"branch": "default"},
974 "modified": [],
974 "modified": [],
975 "added": ["a"],
975 "added": ["a"],
976 "removed": []
976 "removed": []
977 }
977 }
978 ]
978 ]
979
979
980 Error if style not readable:
980 Error if style not readable:
981
981
982 #if unix-permissions no-root
982 #if unix-permissions no-root
983 $ touch q
983 $ touch q
984 $ chmod 0 q
984 $ chmod 0 q
985 $ hg log --style ./q
985 $ hg log --style ./q
986 abort: Permission denied: ./q
986 abort: Permission denied: ./q
987 [255]
987 [255]
988 #endif
988 #endif
989
989
990 Error if no style:
990 Error if no style:
991
991
992 $ hg log --style notexist
992 $ hg log --style notexist
993 abort: style 'notexist' not found
993 abort: style 'notexist' not found
994 (available styles: bisect, changelog, compact, default, phases, status, xml)
994 (available styles: bisect, changelog, compact, default, phases, status, xml)
995 [255]
995 [255]
996
996
997 $ hg log -T list
997 $ hg log -T list
998 available styles: bisect, changelog, compact, default, phases, status, xml
998 available styles: bisect, changelog, compact, default, phases, status, xml
999 abort: specify a template
999 abort: specify a template
1000 [255]
1000 [255]
1001
1001
1002 Error if style missing key:
1002 Error if style missing key:
1003
1003
1004 $ echo 'q = q' > t
1004 $ echo 'q = q' > t
1005 $ hg log --style ./t
1005 $ hg log --style ./t
1006 abort: "changeset" not in template map
1006 abort: "changeset" not in template map
1007 [255]
1007 [255]
1008
1008
1009 Error if style missing value:
1009 Error if style missing value:
1010
1010
1011 $ echo 'changeset =' > t
1011 $ echo 'changeset =' > t
1012 $ hg log --style t
1012 $ hg log --style t
1013 hg: parse error at t:1: missing value
1013 hg: parse error at t:1: missing value
1014 [255]
1014 [255]
1015
1015
1016 Error if include fails:
1016 Error if include fails:
1017
1017
1018 $ echo 'changeset = q' >> t
1018 $ echo 'changeset = q' >> t
1019 #if unix-permissions no-root
1019 #if unix-permissions no-root
1020 $ hg log --style ./t
1020 $ hg log --style ./t
1021 abort: template file ./q: Permission denied
1021 abort: template file ./q: Permission denied
1022 [255]
1022 [255]
1023 $ rm -f q
1023 $ rm -f q
1024 #endif
1024 #endif
1025
1025
1026 Include works:
1026 Include works:
1027
1027
1028 $ echo '{rev}' > q
1028 $ echo '{rev}' > q
1029 $ hg log --style ./t
1029 $ hg log --style ./t
1030 8
1030 8
1031 7
1031 7
1032 6
1032 6
1033 5
1033 5
1034 4
1034 4
1035 3
1035 3
1036 2
1036 2
1037 1
1037 1
1038 0
1038 0
1039
1039
1040 Check that recursive reference does not fall into RuntimeError (issue4758):
1040 Check that recursive reference does not fall into RuntimeError (issue4758):
1041
1041
1042 common mistake:
1042 common mistake:
1043
1043
1044 $ hg log -T '{changeset}\n'
1044 $ hg log -T '{changeset}\n'
1045 abort: recursive reference 'changeset' in template
1045 abort: recursive reference 'changeset' in template
1046 [255]
1046 [255]
1047
1047
1048 circular reference:
1048 circular reference:
1049
1049
1050 $ cat << EOF > issue4758
1050 $ cat << EOF > issue4758
1051 > changeset = '{foo}'
1051 > changeset = '{foo}'
1052 > foo = '{changeset}'
1052 > foo = '{changeset}'
1053 > EOF
1053 > EOF
1054 $ hg log --style ./issue4758
1054 $ hg log --style ./issue4758
1055 abort: recursive reference 'foo' in template
1055 abort: recursive reference 'foo' in template
1056 [255]
1056 [255]
1057
1057
1058 buildmap() -> gettemplate(), where no thunk was made:
1058 buildmap() -> gettemplate(), where no thunk was made:
1059
1059
1060 $ hg log -T '{files % changeset}\n'
1060 $ hg log -T '{files % changeset}\n'
1061 abort: recursive reference 'changeset' in template
1061 abort: recursive reference 'changeset' in template
1062 [255]
1062 [255]
1063
1063
1064 not a recursion if a keyword of the same name exists:
1064 not a recursion if a keyword of the same name exists:
1065
1065
1066 $ cat << EOF > issue4758
1066 $ cat << EOF > issue4758
1067 > changeset = '{tags % rev}'
1067 > changeset = '{tags % rev}'
1068 > rev = '{rev} {tag}\n'
1068 > rev = '{rev} {tag}\n'
1069 > EOF
1069 > EOF
1070 $ hg log --style ./issue4758 -r tip
1070 $ hg log --style ./issue4758 -r tip
1071 8 tip
1071 8 tip
1072
1072
1073 Check that {phase} works correctly on parents:
1073 Check that {phase} works correctly on parents:
1074
1074
1075 $ cat << EOF > parentphase
1075 $ cat << EOF > parentphase
1076 > changeset_debug = '{rev} ({phase}):{parents}\n'
1076 > changeset_debug = '{rev} ({phase}):{parents}\n'
1077 > parent = ' {rev} ({phase})'
1077 > parent = ' {rev} ({phase})'
1078 > EOF
1078 > EOF
1079 $ hg phase -r 5 --public
1079 $ hg phase -r 5 --public
1080 $ hg phase -r 7 --secret --force
1080 $ hg phase -r 7 --secret --force
1081 $ hg log --debug -G --style ./parentphase
1081 $ hg log --debug -G --style ./parentphase
1082 @ 8 (secret): 7 (secret) -1 (public)
1082 @ 8 (secret): 7 (secret) -1 (public)
1083 |
1083 |
1084 o 7 (secret): -1 (public) -1 (public)
1084 o 7 (secret): -1 (public) -1 (public)
1085
1085
1086 o 6 (draft): 5 (public) 4 (draft)
1086 o 6 (draft): 5 (public) 4 (draft)
1087 |\
1087 |\
1088 | o 5 (public): 3 (public) -1 (public)
1088 | o 5 (public): 3 (public) -1 (public)
1089 | |
1089 | |
1090 o | 4 (draft): 3 (public) -1 (public)
1090 o | 4 (draft): 3 (public) -1 (public)
1091 |/
1091 |/
1092 o 3 (public): 2 (public) -1 (public)
1092 o 3 (public): 2 (public) -1 (public)
1093 |
1093 |
1094 o 2 (public): 1 (public) -1 (public)
1094 o 2 (public): 1 (public) -1 (public)
1095 |
1095 |
1096 o 1 (public): 0 (public) -1 (public)
1096 o 1 (public): 0 (public) -1 (public)
1097 |
1097 |
1098 o 0 (public): -1 (public) -1 (public)
1098 o 0 (public): -1 (public) -1 (public)
1099
1099
1100
1100
1101 Missing non-standard names give no error (backward compatibility):
1101 Missing non-standard names give no error (backward compatibility):
1102
1102
1103 $ echo "changeset = '{c}'" > t
1103 $ echo "changeset = '{c}'" > t
1104 $ hg log --style ./t
1104 $ hg log --style ./t
1105
1105
1106 Defining non-standard name works:
1106 Defining non-standard name works:
1107
1107
1108 $ cat <<EOF > t
1108 $ cat <<EOF > t
1109 > changeset = '{c}'
1109 > changeset = '{c}'
1110 > c = q
1110 > c = q
1111 > EOF
1111 > EOF
1112 $ hg log --style ./t
1112 $ hg log --style ./t
1113 8
1113 8
1114 7
1114 7
1115 6
1115 6
1116 5
1116 5
1117 4
1117 4
1118 3
1118 3
1119 2
1119 2
1120 1
1120 1
1121 0
1121 0
1122
1122
1123 ui.style works:
1123 ui.style works:
1124
1124
1125 $ echo '[ui]' > .hg/hgrc
1125 $ echo '[ui]' > .hg/hgrc
1126 $ echo 'style = t' >> .hg/hgrc
1126 $ echo 'style = t' >> .hg/hgrc
1127 $ hg log
1127 $ hg log
1128 8
1128 8
1129 7
1129 7
1130 6
1130 6
1131 5
1131 5
1132 4
1132 4
1133 3
1133 3
1134 2
1134 2
1135 1
1135 1
1136 0
1136 0
1137
1137
1138
1138
1139 Issue338:
1139 Issue338:
1140
1140
1141 $ hg log --style=changelog > changelog
1141 $ hg log --style=changelog > changelog
1142
1142
1143 $ cat changelog
1143 $ cat changelog
1144 2020-01-01 test <test>
1144 2020-01-01 test <test>
1145
1145
1146 * fourth, second, third:
1146 * fourth, second, third:
1147 third
1147 third
1148 [95c24699272e] [tip]
1148 [95c24699272e] [tip]
1149
1149
1150 1970-01-12 User Name <user@hostname>
1150 1970-01-12 User Name <user@hostname>
1151
1151
1152 * second:
1152 * second:
1153 second
1153 second
1154 [29114dbae42b]
1154 [29114dbae42b]
1155
1155
1156 1970-01-18 person <person>
1156 1970-01-18 person <person>
1157
1157
1158 * merge
1158 * merge
1159 [d41e714fe50d]
1159 [d41e714fe50d]
1160
1160
1161 * d:
1161 * d:
1162 new head
1162 new head
1163 [13207e5a10d9]
1163 [13207e5a10d9]
1164
1164
1165 1970-01-17 person <person>
1165 1970-01-17 person <person>
1166
1166
1167 * new branch
1167 * new branch
1168 [bbe44766e73d] <foo>
1168 [bbe44766e73d] <foo>
1169
1169
1170 1970-01-16 person <person>
1170 1970-01-16 person <person>
1171
1171
1172 * c:
1172 * c:
1173 no user, no domain
1173 no user, no domain
1174 [10e46f2dcbf4]
1174 [10e46f2dcbf4]
1175
1175
1176 1970-01-14 other <other@place>
1176 1970-01-14 other <other@place>
1177
1177
1178 * c:
1178 * c:
1179 no person
1179 no person
1180 [97054abb4ab8]
1180 [97054abb4ab8]
1181
1181
1182 1970-01-13 A. N. Other <other@place>
1182 1970-01-13 A. N. Other <other@place>
1183
1183
1184 * b:
1184 * b:
1185 other 1 other 2
1185 other 1 other 2
1186
1186
1187 other 3
1187 other 3
1188 [b608e9d1a3f0]
1188 [b608e9d1a3f0]
1189
1189
1190 1970-01-12 User Name <user@hostname>
1190 1970-01-12 User Name <user@hostname>
1191
1191
1192 * a:
1192 * a:
1193 line 1 line 2
1193 line 1 line 2
1194 [1e4e1b8f71e0]
1194 [1e4e1b8f71e0]
1195
1195
1196
1196
1197 Issue2130: xml output for 'hg heads' is malformed
1197 Issue2130: xml output for 'hg heads' is malformed
1198
1198
1199 $ hg heads --style changelog
1199 $ hg heads --style changelog
1200 2020-01-01 test <test>
1200 2020-01-01 test <test>
1201
1201
1202 * fourth, second, third:
1202 * fourth, second, third:
1203 third
1203 third
1204 [95c24699272e] [tip]
1204 [95c24699272e] [tip]
1205
1205
1206 1970-01-18 person <person>
1206 1970-01-18 person <person>
1207
1207
1208 * merge
1208 * merge
1209 [d41e714fe50d]
1209 [d41e714fe50d]
1210
1210
1211 1970-01-17 person <person>
1211 1970-01-17 person <person>
1212
1212
1213 * new branch
1213 * new branch
1214 [bbe44766e73d] <foo>
1214 [bbe44766e73d] <foo>
1215
1215
1216
1216
1217 Keys work:
1217 Keys work:
1218
1218
1219 $ for key in author branch branches date desc file_adds file_dels file_mods \
1219 $ for key in author branch branches date desc file_adds file_dels file_mods \
1220 > file_copies file_copies_switch files \
1220 > file_copies file_copies_switch files \
1221 > manifest node parents rev tags diffstat extras \
1221 > manifest node parents rev tags diffstat extras \
1222 > p1rev p2rev p1node p2node; do
1222 > p1rev p2rev p1node p2node; do
1223 > for mode in '' --verbose --debug; do
1223 > for mode in '' --verbose --debug; do
1224 > hg log $mode --template "$key$mode: {$key}\n"
1224 > hg log $mode --template "$key$mode: {$key}\n"
1225 > done
1225 > done
1226 > done
1226 > done
1227 author: test
1227 author: test
1228 author: User Name <user@hostname>
1228 author: User Name <user@hostname>
1229 author: person
1229 author: person
1230 author: person
1230 author: person
1231 author: person
1231 author: person
1232 author: person
1232 author: person
1233 author: other@place
1233 author: other@place
1234 author: A. N. Other <other@place>
1234 author: A. N. Other <other@place>
1235 author: User Name <user@hostname>
1235 author: User Name <user@hostname>
1236 author--verbose: test
1236 author--verbose: test
1237 author--verbose: User Name <user@hostname>
1237 author--verbose: User Name <user@hostname>
1238 author--verbose: person
1238 author--verbose: person
1239 author--verbose: person
1239 author--verbose: person
1240 author--verbose: person
1240 author--verbose: person
1241 author--verbose: person
1241 author--verbose: person
1242 author--verbose: other@place
1242 author--verbose: other@place
1243 author--verbose: A. N. Other <other@place>
1243 author--verbose: A. N. Other <other@place>
1244 author--verbose: User Name <user@hostname>
1244 author--verbose: User Name <user@hostname>
1245 author--debug: test
1245 author--debug: test
1246 author--debug: User Name <user@hostname>
1246 author--debug: User Name <user@hostname>
1247 author--debug: person
1247 author--debug: person
1248 author--debug: person
1248 author--debug: person
1249 author--debug: person
1249 author--debug: person
1250 author--debug: person
1250 author--debug: person
1251 author--debug: other@place
1251 author--debug: other@place
1252 author--debug: A. N. Other <other@place>
1252 author--debug: A. N. Other <other@place>
1253 author--debug: User Name <user@hostname>
1253 author--debug: User Name <user@hostname>
1254 branch: default
1254 branch: default
1255 branch: default
1255 branch: default
1256 branch: default
1256 branch: default
1257 branch: default
1257 branch: default
1258 branch: foo
1258 branch: foo
1259 branch: default
1259 branch: default
1260 branch: default
1260 branch: default
1261 branch: default
1261 branch: default
1262 branch: default
1262 branch: default
1263 branch--verbose: default
1263 branch--verbose: default
1264 branch--verbose: default
1264 branch--verbose: default
1265 branch--verbose: default
1265 branch--verbose: default
1266 branch--verbose: default
1266 branch--verbose: default
1267 branch--verbose: foo
1267 branch--verbose: foo
1268 branch--verbose: default
1268 branch--verbose: default
1269 branch--verbose: default
1269 branch--verbose: default
1270 branch--verbose: default
1270 branch--verbose: default
1271 branch--verbose: default
1271 branch--verbose: default
1272 branch--debug: default
1272 branch--debug: default
1273 branch--debug: default
1273 branch--debug: default
1274 branch--debug: default
1274 branch--debug: default
1275 branch--debug: default
1275 branch--debug: default
1276 branch--debug: foo
1276 branch--debug: foo
1277 branch--debug: default
1277 branch--debug: default
1278 branch--debug: default
1278 branch--debug: default
1279 branch--debug: default
1279 branch--debug: default
1280 branch--debug: default
1280 branch--debug: default
1281 branches:
1281 branches:
1282 branches:
1282 branches:
1283 branches:
1283 branches:
1284 branches:
1284 branches:
1285 branches: foo
1285 branches: foo
1286 branches:
1286 branches:
1287 branches:
1287 branches:
1288 branches:
1288 branches:
1289 branches:
1289 branches:
1290 branches--verbose:
1290 branches--verbose:
1291 branches--verbose:
1291 branches--verbose:
1292 branches--verbose:
1292 branches--verbose:
1293 branches--verbose:
1293 branches--verbose:
1294 branches--verbose: foo
1294 branches--verbose: foo
1295 branches--verbose:
1295 branches--verbose:
1296 branches--verbose:
1296 branches--verbose:
1297 branches--verbose:
1297 branches--verbose:
1298 branches--verbose:
1298 branches--verbose:
1299 branches--debug:
1299 branches--debug:
1300 branches--debug:
1300 branches--debug:
1301 branches--debug:
1301 branches--debug:
1302 branches--debug:
1302 branches--debug:
1303 branches--debug: foo
1303 branches--debug: foo
1304 branches--debug:
1304 branches--debug:
1305 branches--debug:
1305 branches--debug:
1306 branches--debug:
1306 branches--debug:
1307 branches--debug:
1307 branches--debug:
1308 date: 1577872860.00
1308 date: 1577872860.00
1309 date: 1000000.00
1309 date: 1000000.00
1310 date: 1500001.00
1310 date: 1500001.00
1311 date: 1500000.00
1311 date: 1500000.00
1312 date: 1400000.00
1312 date: 1400000.00
1313 date: 1300000.00
1313 date: 1300000.00
1314 date: 1200000.00
1314 date: 1200000.00
1315 date: 1100000.00
1315 date: 1100000.00
1316 date: 1000000.00
1316 date: 1000000.00
1317 date--verbose: 1577872860.00
1317 date--verbose: 1577872860.00
1318 date--verbose: 1000000.00
1318 date--verbose: 1000000.00
1319 date--verbose: 1500001.00
1319 date--verbose: 1500001.00
1320 date--verbose: 1500000.00
1320 date--verbose: 1500000.00
1321 date--verbose: 1400000.00
1321 date--verbose: 1400000.00
1322 date--verbose: 1300000.00
1322 date--verbose: 1300000.00
1323 date--verbose: 1200000.00
1323 date--verbose: 1200000.00
1324 date--verbose: 1100000.00
1324 date--verbose: 1100000.00
1325 date--verbose: 1000000.00
1325 date--verbose: 1000000.00
1326 date--debug: 1577872860.00
1326 date--debug: 1577872860.00
1327 date--debug: 1000000.00
1327 date--debug: 1000000.00
1328 date--debug: 1500001.00
1328 date--debug: 1500001.00
1329 date--debug: 1500000.00
1329 date--debug: 1500000.00
1330 date--debug: 1400000.00
1330 date--debug: 1400000.00
1331 date--debug: 1300000.00
1331 date--debug: 1300000.00
1332 date--debug: 1200000.00
1332 date--debug: 1200000.00
1333 date--debug: 1100000.00
1333 date--debug: 1100000.00
1334 date--debug: 1000000.00
1334 date--debug: 1000000.00
1335 desc: third
1335 desc: third
1336 desc: second
1336 desc: second
1337 desc: merge
1337 desc: merge
1338 desc: new head
1338 desc: new head
1339 desc: new branch
1339 desc: new branch
1340 desc: no user, no domain
1340 desc: no user, no domain
1341 desc: no person
1341 desc: no person
1342 desc: other 1
1342 desc: other 1
1343 other 2
1343 other 2
1344
1344
1345 other 3
1345 other 3
1346 desc: line 1
1346 desc: line 1
1347 line 2
1347 line 2
1348 desc--verbose: third
1348 desc--verbose: third
1349 desc--verbose: second
1349 desc--verbose: second
1350 desc--verbose: merge
1350 desc--verbose: merge
1351 desc--verbose: new head
1351 desc--verbose: new head
1352 desc--verbose: new branch
1352 desc--verbose: new branch
1353 desc--verbose: no user, no domain
1353 desc--verbose: no user, no domain
1354 desc--verbose: no person
1354 desc--verbose: no person
1355 desc--verbose: other 1
1355 desc--verbose: other 1
1356 other 2
1356 other 2
1357
1357
1358 other 3
1358 other 3
1359 desc--verbose: line 1
1359 desc--verbose: line 1
1360 line 2
1360 line 2
1361 desc--debug: third
1361 desc--debug: third
1362 desc--debug: second
1362 desc--debug: second
1363 desc--debug: merge
1363 desc--debug: merge
1364 desc--debug: new head
1364 desc--debug: new head
1365 desc--debug: new branch
1365 desc--debug: new branch
1366 desc--debug: no user, no domain
1366 desc--debug: no user, no domain
1367 desc--debug: no person
1367 desc--debug: no person
1368 desc--debug: other 1
1368 desc--debug: other 1
1369 other 2
1369 other 2
1370
1370
1371 other 3
1371 other 3
1372 desc--debug: line 1
1372 desc--debug: line 1
1373 line 2
1373 line 2
1374 file_adds: fourth third
1374 file_adds: fourth third
1375 file_adds: second
1375 file_adds: second
1376 file_adds:
1376 file_adds:
1377 file_adds: d
1377 file_adds: d
1378 file_adds:
1378 file_adds:
1379 file_adds:
1379 file_adds:
1380 file_adds: c
1380 file_adds: c
1381 file_adds: b
1381 file_adds: b
1382 file_adds: a
1382 file_adds: a
1383 file_adds--verbose: fourth third
1383 file_adds--verbose: fourth third
1384 file_adds--verbose: second
1384 file_adds--verbose: second
1385 file_adds--verbose:
1385 file_adds--verbose:
1386 file_adds--verbose: d
1386 file_adds--verbose: d
1387 file_adds--verbose:
1387 file_adds--verbose:
1388 file_adds--verbose:
1388 file_adds--verbose:
1389 file_adds--verbose: c
1389 file_adds--verbose: c
1390 file_adds--verbose: b
1390 file_adds--verbose: b
1391 file_adds--verbose: a
1391 file_adds--verbose: a
1392 file_adds--debug: fourth third
1392 file_adds--debug: fourth third
1393 file_adds--debug: second
1393 file_adds--debug: second
1394 file_adds--debug:
1394 file_adds--debug:
1395 file_adds--debug: d
1395 file_adds--debug: d
1396 file_adds--debug:
1396 file_adds--debug:
1397 file_adds--debug:
1397 file_adds--debug:
1398 file_adds--debug: c
1398 file_adds--debug: c
1399 file_adds--debug: b
1399 file_adds--debug: b
1400 file_adds--debug: a
1400 file_adds--debug: a
1401 file_dels: second
1401 file_dels: second
1402 file_dels:
1402 file_dels:
1403 file_dels:
1403 file_dels:
1404 file_dels:
1404 file_dels:
1405 file_dels:
1405 file_dels:
1406 file_dels:
1406 file_dels:
1407 file_dels:
1407 file_dels:
1408 file_dels:
1408 file_dels:
1409 file_dels:
1409 file_dels:
1410 file_dels--verbose: second
1410 file_dels--verbose: second
1411 file_dels--verbose:
1411 file_dels--verbose:
1412 file_dels--verbose:
1412 file_dels--verbose:
1413 file_dels--verbose:
1413 file_dels--verbose:
1414 file_dels--verbose:
1414 file_dels--verbose:
1415 file_dels--verbose:
1415 file_dels--verbose:
1416 file_dels--verbose:
1416 file_dels--verbose:
1417 file_dels--verbose:
1417 file_dels--verbose:
1418 file_dels--verbose:
1418 file_dels--verbose:
1419 file_dels--debug: second
1419 file_dels--debug: second
1420 file_dels--debug:
1420 file_dels--debug:
1421 file_dels--debug:
1421 file_dels--debug:
1422 file_dels--debug:
1422 file_dels--debug:
1423 file_dels--debug:
1423 file_dels--debug:
1424 file_dels--debug:
1424 file_dels--debug:
1425 file_dels--debug:
1425 file_dels--debug:
1426 file_dels--debug:
1426 file_dels--debug:
1427 file_dels--debug:
1427 file_dels--debug:
1428 file_mods:
1428 file_mods:
1429 file_mods:
1429 file_mods:
1430 file_mods:
1430 file_mods:
1431 file_mods:
1431 file_mods:
1432 file_mods:
1432 file_mods:
1433 file_mods: c
1433 file_mods: c
1434 file_mods:
1434 file_mods:
1435 file_mods:
1435 file_mods:
1436 file_mods:
1436 file_mods:
1437 file_mods--verbose:
1437 file_mods--verbose:
1438 file_mods--verbose:
1438 file_mods--verbose:
1439 file_mods--verbose:
1439 file_mods--verbose:
1440 file_mods--verbose:
1440 file_mods--verbose:
1441 file_mods--verbose:
1441 file_mods--verbose:
1442 file_mods--verbose: c
1442 file_mods--verbose: c
1443 file_mods--verbose:
1443 file_mods--verbose:
1444 file_mods--verbose:
1444 file_mods--verbose:
1445 file_mods--verbose:
1445 file_mods--verbose:
1446 file_mods--debug:
1446 file_mods--debug:
1447 file_mods--debug:
1447 file_mods--debug:
1448 file_mods--debug:
1448 file_mods--debug:
1449 file_mods--debug:
1449 file_mods--debug:
1450 file_mods--debug:
1450 file_mods--debug:
1451 file_mods--debug: c
1451 file_mods--debug: c
1452 file_mods--debug:
1452 file_mods--debug:
1453 file_mods--debug:
1453 file_mods--debug:
1454 file_mods--debug:
1454 file_mods--debug:
1455 file_copies: fourth (second)
1455 file_copies: fourth (second)
1456 file_copies:
1456 file_copies:
1457 file_copies:
1457 file_copies:
1458 file_copies:
1458 file_copies:
1459 file_copies:
1459 file_copies:
1460 file_copies:
1460 file_copies:
1461 file_copies:
1461 file_copies:
1462 file_copies:
1462 file_copies:
1463 file_copies:
1463 file_copies:
1464 file_copies--verbose: fourth (second)
1464 file_copies--verbose: fourth (second)
1465 file_copies--verbose:
1465 file_copies--verbose:
1466 file_copies--verbose:
1466 file_copies--verbose:
1467 file_copies--verbose:
1467 file_copies--verbose:
1468 file_copies--verbose:
1468 file_copies--verbose:
1469 file_copies--verbose:
1469 file_copies--verbose:
1470 file_copies--verbose:
1470 file_copies--verbose:
1471 file_copies--verbose:
1471 file_copies--verbose:
1472 file_copies--verbose:
1472 file_copies--verbose:
1473 file_copies--debug: fourth (second)
1473 file_copies--debug: fourth (second)
1474 file_copies--debug:
1474 file_copies--debug:
1475 file_copies--debug:
1475 file_copies--debug:
1476 file_copies--debug:
1476 file_copies--debug:
1477 file_copies--debug:
1477 file_copies--debug:
1478 file_copies--debug:
1478 file_copies--debug:
1479 file_copies--debug:
1479 file_copies--debug:
1480 file_copies--debug:
1480 file_copies--debug:
1481 file_copies--debug:
1481 file_copies--debug:
1482 file_copies_switch:
1482 file_copies_switch:
1483 file_copies_switch:
1483 file_copies_switch:
1484 file_copies_switch:
1484 file_copies_switch:
1485 file_copies_switch:
1485 file_copies_switch:
1486 file_copies_switch:
1486 file_copies_switch:
1487 file_copies_switch:
1487 file_copies_switch:
1488 file_copies_switch:
1488 file_copies_switch:
1489 file_copies_switch:
1489 file_copies_switch:
1490 file_copies_switch:
1490 file_copies_switch:
1491 file_copies_switch--verbose:
1491 file_copies_switch--verbose:
1492 file_copies_switch--verbose:
1492 file_copies_switch--verbose:
1493 file_copies_switch--verbose:
1493 file_copies_switch--verbose:
1494 file_copies_switch--verbose:
1494 file_copies_switch--verbose:
1495 file_copies_switch--verbose:
1495 file_copies_switch--verbose:
1496 file_copies_switch--verbose:
1496 file_copies_switch--verbose:
1497 file_copies_switch--verbose:
1497 file_copies_switch--verbose:
1498 file_copies_switch--verbose:
1498 file_copies_switch--verbose:
1499 file_copies_switch--verbose:
1499 file_copies_switch--verbose:
1500 file_copies_switch--debug:
1500 file_copies_switch--debug:
1501 file_copies_switch--debug:
1501 file_copies_switch--debug:
1502 file_copies_switch--debug:
1502 file_copies_switch--debug:
1503 file_copies_switch--debug:
1503 file_copies_switch--debug:
1504 file_copies_switch--debug:
1504 file_copies_switch--debug:
1505 file_copies_switch--debug:
1505 file_copies_switch--debug:
1506 file_copies_switch--debug:
1506 file_copies_switch--debug:
1507 file_copies_switch--debug:
1507 file_copies_switch--debug:
1508 file_copies_switch--debug:
1508 file_copies_switch--debug:
1509 files: fourth second third
1509 files: fourth second third
1510 files: second
1510 files: second
1511 files:
1511 files:
1512 files: d
1512 files: d
1513 files:
1513 files:
1514 files: c
1514 files: c
1515 files: c
1515 files: c
1516 files: b
1516 files: b
1517 files: a
1517 files: a
1518 files--verbose: fourth second third
1518 files--verbose: fourth second third
1519 files--verbose: second
1519 files--verbose: second
1520 files--verbose:
1520 files--verbose:
1521 files--verbose: d
1521 files--verbose: d
1522 files--verbose:
1522 files--verbose:
1523 files--verbose: c
1523 files--verbose: c
1524 files--verbose: c
1524 files--verbose: c
1525 files--verbose: b
1525 files--verbose: b
1526 files--verbose: a
1526 files--verbose: a
1527 files--debug: fourth second third
1527 files--debug: fourth second third
1528 files--debug: second
1528 files--debug: second
1529 files--debug:
1529 files--debug:
1530 files--debug: d
1530 files--debug: d
1531 files--debug:
1531 files--debug:
1532 files--debug: c
1532 files--debug: c
1533 files--debug: c
1533 files--debug: c
1534 files--debug: b
1534 files--debug: b
1535 files--debug: a
1535 files--debug: a
1536 manifest: 6:94961b75a2da
1536 manifest: 6:94961b75a2da
1537 manifest: 5:f2dbc354b94e
1537 manifest: 5:f2dbc354b94e
1538 manifest: 4:4dc3def4f9b4
1538 manifest: 4:4dc3def4f9b4
1539 manifest: 4:4dc3def4f9b4
1539 manifest: 4:4dc3def4f9b4
1540 manifest: 3:cb5a1327723b
1540 manifest: 3:cb5a1327723b
1541 manifest: 3:cb5a1327723b
1541 manifest: 3:cb5a1327723b
1542 manifest: 2:6e0e82995c35
1542 manifest: 2:6e0e82995c35
1543 manifest: 1:4e8d705b1e53
1543 manifest: 1:4e8d705b1e53
1544 manifest: 0:a0c8bcbbb45c
1544 manifest: 0:a0c8bcbbb45c
1545 manifest--verbose: 6:94961b75a2da
1545 manifest--verbose: 6:94961b75a2da
1546 manifest--verbose: 5:f2dbc354b94e
1546 manifest--verbose: 5:f2dbc354b94e
1547 manifest--verbose: 4:4dc3def4f9b4
1547 manifest--verbose: 4:4dc3def4f9b4
1548 manifest--verbose: 4:4dc3def4f9b4
1548 manifest--verbose: 4:4dc3def4f9b4
1549 manifest--verbose: 3:cb5a1327723b
1549 manifest--verbose: 3:cb5a1327723b
1550 manifest--verbose: 3:cb5a1327723b
1550 manifest--verbose: 3:cb5a1327723b
1551 manifest--verbose: 2:6e0e82995c35
1551 manifest--verbose: 2:6e0e82995c35
1552 manifest--verbose: 1:4e8d705b1e53
1552 manifest--verbose: 1:4e8d705b1e53
1553 manifest--verbose: 0:a0c8bcbbb45c
1553 manifest--verbose: 0:a0c8bcbbb45c
1554 manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
1554 manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
1555 manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
1555 manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
1556 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1556 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1557 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1557 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1558 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1558 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1559 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1559 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1560 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
1560 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
1561 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
1561 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
1562 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
1562 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
1563 node: 95c24699272ef57d062b8bccc32c878bf841784a
1563 node: 95c24699272ef57d062b8bccc32c878bf841784a
1564 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1564 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1565 node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1565 node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1566 node: 13207e5a10d9fd28ec424934298e176197f2c67f
1566 node: 13207e5a10d9fd28ec424934298e176197f2c67f
1567 node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1567 node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1568 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1568 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1569 node: 97054abb4ab824450e9164180baf491ae0078465
1569 node: 97054abb4ab824450e9164180baf491ae0078465
1570 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1570 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1571 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1571 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1572 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
1572 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
1573 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1573 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1574 node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1574 node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1575 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1575 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1576 node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1576 node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1577 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1577 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1578 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1578 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1579 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1579 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1580 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1580 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1581 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
1581 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
1582 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1582 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1583 node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1583 node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1584 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1584 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1585 node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1585 node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1586 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1586 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1587 node--debug: 97054abb4ab824450e9164180baf491ae0078465
1587 node--debug: 97054abb4ab824450e9164180baf491ae0078465
1588 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1588 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1589 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1589 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1590 parents:
1590 parents:
1591 parents: -1:000000000000
1591 parents: -1:000000000000
1592 parents: 5:13207e5a10d9 4:bbe44766e73d
1592 parents: 5:13207e5a10d9 4:bbe44766e73d
1593 parents: 3:10e46f2dcbf4
1593 parents: 3:10e46f2dcbf4
1594 parents:
1594 parents:
1595 parents:
1595 parents:
1596 parents:
1596 parents:
1597 parents:
1597 parents:
1598 parents:
1598 parents:
1599 parents--verbose:
1599 parents--verbose:
1600 parents--verbose: -1:000000000000
1600 parents--verbose: -1:000000000000
1601 parents--verbose: 5:13207e5a10d9 4:bbe44766e73d
1601 parents--verbose: 5:13207e5a10d9 4:bbe44766e73d
1602 parents--verbose: 3:10e46f2dcbf4
1602 parents--verbose: 3:10e46f2dcbf4
1603 parents--verbose:
1603 parents--verbose:
1604 parents--verbose:
1604 parents--verbose:
1605 parents--verbose:
1605 parents--verbose:
1606 parents--verbose:
1606 parents--verbose:
1607 parents--verbose:
1607 parents--verbose:
1608 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
1608 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
1609 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1609 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1610 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
1610 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
1611 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1611 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1612 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1612 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1613 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
1613 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
1614 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
1614 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
1615 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
1615 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
1616 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1616 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1617 rev: 8
1617 rev: 8
1618 rev: 7
1618 rev: 7
1619 rev: 6
1619 rev: 6
1620 rev: 5
1620 rev: 5
1621 rev: 4
1621 rev: 4
1622 rev: 3
1622 rev: 3
1623 rev: 2
1623 rev: 2
1624 rev: 1
1624 rev: 1
1625 rev: 0
1625 rev: 0
1626 rev--verbose: 8
1626 rev--verbose: 8
1627 rev--verbose: 7
1627 rev--verbose: 7
1628 rev--verbose: 6
1628 rev--verbose: 6
1629 rev--verbose: 5
1629 rev--verbose: 5
1630 rev--verbose: 4
1630 rev--verbose: 4
1631 rev--verbose: 3
1631 rev--verbose: 3
1632 rev--verbose: 2
1632 rev--verbose: 2
1633 rev--verbose: 1
1633 rev--verbose: 1
1634 rev--verbose: 0
1634 rev--verbose: 0
1635 rev--debug: 8
1635 rev--debug: 8
1636 rev--debug: 7
1636 rev--debug: 7
1637 rev--debug: 6
1637 rev--debug: 6
1638 rev--debug: 5
1638 rev--debug: 5
1639 rev--debug: 4
1639 rev--debug: 4
1640 rev--debug: 3
1640 rev--debug: 3
1641 rev--debug: 2
1641 rev--debug: 2
1642 rev--debug: 1
1642 rev--debug: 1
1643 rev--debug: 0
1643 rev--debug: 0
1644 tags: tip
1644 tags: tip
1645 tags:
1645 tags:
1646 tags:
1646 tags:
1647 tags:
1647 tags:
1648 tags:
1648 tags:
1649 tags:
1649 tags:
1650 tags:
1650 tags:
1651 tags:
1651 tags:
1652 tags:
1652 tags:
1653 tags--verbose: tip
1653 tags--verbose: tip
1654 tags--verbose:
1654 tags--verbose:
1655 tags--verbose:
1655 tags--verbose:
1656 tags--verbose:
1656 tags--verbose:
1657 tags--verbose:
1657 tags--verbose:
1658 tags--verbose:
1658 tags--verbose:
1659 tags--verbose:
1659 tags--verbose:
1660 tags--verbose:
1660 tags--verbose:
1661 tags--verbose:
1661 tags--verbose:
1662 tags--debug: tip
1662 tags--debug: tip
1663 tags--debug:
1663 tags--debug:
1664 tags--debug:
1664 tags--debug:
1665 tags--debug:
1665 tags--debug:
1666 tags--debug:
1666 tags--debug:
1667 tags--debug:
1667 tags--debug:
1668 tags--debug:
1668 tags--debug:
1669 tags--debug:
1669 tags--debug:
1670 tags--debug:
1670 tags--debug:
1671 diffstat: 3: +2/-1
1671 diffstat: 3: +2/-1
1672 diffstat: 1: +1/-0
1672 diffstat: 1: +1/-0
1673 diffstat: 0: +0/-0
1673 diffstat: 0: +0/-0
1674 diffstat: 1: +1/-0
1674 diffstat: 1: +1/-0
1675 diffstat: 0: +0/-0
1675 diffstat: 0: +0/-0
1676 diffstat: 1: +1/-0
1676 diffstat: 1: +1/-0
1677 diffstat: 1: +4/-0
1677 diffstat: 1: +4/-0
1678 diffstat: 1: +2/-0
1678 diffstat: 1: +2/-0
1679 diffstat: 1: +1/-0
1679 diffstat: 1: +1/-0
1680 diffstat--verbose: 3: +2/-1
1680 diffstat--verbose: 3: +2/-1
1681 diffstat--verbose: 1: +1/-0
1681 diffstat--verbose: 1: +1/-0
1682 diffstat--verbose: 0: +0/-0
1682 diffstat--verbose: 0: +0/-0
1683 diffstat--verbose: 1: +1/-0
1683 diffstat--verbose: 1: +1/-0
1684 diffstat--verbose: 0: +0/-0
1684 diffstat--verbose: 0: +0/-0
1685 diffstat--verbose: 1: +1/-0
1685 diffstat--verbose: 1: +1/-0
1686 diffstat--verbose: 1: +4/-0
1686 diffstat--verbose: 1: +4/-0
1687 diffstat--verbose: 1: +2/-0
1687 diffstat--verbose: 1: +2/-0
1688 diffstat--verbose: 1: +1/-0
1688 diffstat--verbose: 1: +1/-0
1689 diffstat--debug: 3: +2/-1
1689 diffstat--debug: 3: +2/-1
1690 diffstat--debug: 1: +1/-0
1690 diffstat--debug: 1: +1/-0
1691 diffstat--debug: 0: +0/-0
1691 diffstat--debug: 0: +0/-0
1692 diffstat--debug: 1: +1/-0
1692 diffstat--debug: 1: +1/-0
1693 diffstat--debug: 0: +0/-0
1693 diffstat--debug: 0: +0/-0
1694 diffstat--debug: 1: +1/-0
1694 diffstat--debug: 1: +1/-0
1695 diffstat--debug: 1: +4/-0
1695 diffstat--debug: 1: +4/-0
1696 diffstat--debug: 1: +2/-0
1696 diffstat--debug: 1: +2/-0
1697 diffstat--debug: 1: +1/-0
1697 diffstat--debug: 1: +1/-0
1698 extras: branch=default
1698 extras: branch=default
1699 extras: branch=default
1699 extras: branch=default
1700 extras: branch=default
1700 extras: branch=default
1701 extras: branch=default
1701 extras: branch=default
1702 extras: branch=foo
1702 extras: branch=foo
1703 extras: branch=default
1703 extras: branch=default
1704 extras: branch=default
1704 extras: branch=default
1705 extras: branch=default
1705 extras: branch=default
1706 extras: branch=default
1706 extras: branch=default
1707 extras--verbose: branch=default
1707 extras--verbose: branch=default
1708 extras--verbose: branch=default
1708 extras--verbose: branch=default
1709 extras--verbose: branch=default
1709 extras--verbose: branch=default
1710 extras--verbose: branch=default
1710 extras--verbose: branch=default
1711 extras--verbose: branch=foo
1711 extras--verbose: branch=foo
1712 extras--verbose: branch=default
1712 extras--verbose: branch=default
1713 extras--verbose: branch=default
1713 extras--verbose: branch=default
1714 extras--verbose: branch=default
1714 extras--verbose: branch=default
1715 extras--verbose: branch=default
1715 extras--verbose: branch=default
1716 extras--debug: branch=default
1716 extras--debug: branch=default
1717 extras--debug: branch=default
1717 extras--debug: branch=default
1718 extras--debug: branch=default
1718 extras--debug: branch=default
1719 extras--debug: branch=default
1719 extras--debug: branch=default
1720 extras--debug: branch=foo
1720 extras--debug: branch=foo
1721 extras--debug: branch=default
1721 extras--debug: branch=default
1722 extras--debug: branch=default
1722 extras--debug: branch=default
1723 extras--debug: branch=default
1723 extras--debug: branch=default
1724 extras--debug: branch=default
1724 extras--debug: branch=default
1725 p1rev: 7
1725 p1rev: 7
1726 p1rev: -1
1726 p1rev: -1
1727 p1rev: 5
1727 p1rev: 5
1728 p1rev: 3
1728 p1rev: 3
1729 p1rev: 3
1729 p1rev: 3
1730 p1rev: 2
1730 p1rev: 2
1731 p1rev: 1
1731 p1rev: 1
1732 p1rev: 0
1732 p1rev: 0
1733 p1rev: -1
1733 p1rev: -1
1734 p1rev--verbose: 7
1734 p1rev--verbose: 7
1735 p1rev--verbose: -1
1735 p1rev--verbose: -1
1736 p1rev--verbose: 5
1736 p1rev--verbose: 5
1737 p1rev--verbose: 3
1737 p1rev--verbose: 3
1738 p1rev--verbose: 3
1738 p1rev--verbose: 3
1739 p1rev--verbose: 2
1739 p1rev--verbose: 2
1740 p1rev--verbose: 1
1740 p1rev--verbose: 1
1741 p1rev--verbose: 0
1741 p1rev--verbose: 0
1742 p1rev--verbose: -1
1742 p1rev--verbose: -1
1743 p1rev--debug: 7
1743 p1rev--debug: 7
1744 p1rev--debug: -1
1744 p1rev--debug: -1
1745 p1rev--debug: 5
1745 p1rev--debug: 5
1746 p1rev--debug: 3
1746 p1rev--debug: 3
1747 p1rev--debug: 3
1747 p1rev--debug: 3
1748 p1rev--debug: 2
1748 p1rev--debug: 2
1749 p1rev--debug: 1
1749 p1rev--debug: 1
1750 p1rev--debug: 0
1750 p1rev--debug: 0
1751 p1rev--debug: -1
1751 p1rev--debug: -1
1752 p2rev: -1
1752 p2rev: -1
1753 p2rev: -1
1753 p2rev: -1
1754 p2rev: 4
1754 p2rev: 4
1755 p2rev: -1
1755 p2rev: -1
1756 p2rev: -1
1756 p2rev: -1
1757 p2rev: -1
1757 p2rev: -1
1758 p2rev: -1
1758 p2rev: -1
1759 p2rev: -1
1759 p2rev: -1
1760 p2rev: -1
1760 p2rev: -1
1761 p2rev--verbose: -1
1761 p2rev--verbose: -1
1762 p2rev--verbose: -1
1762 p2rev--verbose: -1
1763 p2rev--verbose: 4
1763 p2rev--verbose: 4
1764 p2rev--verbose: -1
1764 p2rev--verbose: -1
1765 p2rev--verbose: -1
1765 p2rev--verbose: -1
1766 p2rev--verbose: -1
1766 p2rev--verbose: -1
1767 p2rev--verbose: -1
1767 p2rev--verbose: -1
1768 p2rev--verbose: -1
1768 p2rev--verbose: -1
1769 p2rev--verbose: -1
1769 p2rev--verbose: -1
1770 p2rev--debug: -1
1770 p2rev--debug: -1
1771 p2rev--debug: -1
1771 p2rev--debug: -1
1772 p2rev--debug: 4
1772 p2rev--debug: 4
1773 p2rev--debug: -1
1773 p2rev--debug: -1
1774 p2rev--debug: -1
1774 p2rev--debug: -1
1775 p2rev--debug: -1
1775 p2rev--debug: -1
1776 p2rev--debug: -1
1776 p2rev--debug: -1
1777 p2rev--debug: -1
1777 p2rev--debug: -1
1778 p2rev--debug: -1
1778 p2rev--debug: -1
1779 p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1779 p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1780 p1node: 0000000000000000000000000000000000000000
1780 p1node: 0000000000000000000000000000000000000000
1781 p1node: 13207e5a10d9fd28ec424934298e176197f2c67f
1781 p1node: 13207e5a10d9fd28ec424934298e176197f2c67f
1782 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1782 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1783 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1783 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1784 p1node: 97054abb4ab824450e9164180baf491ae0078465
1784 p1node: 97054abb4ab824450e9164180baf491ae0078465
1785 p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1785 p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1786 p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1786 p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1787 p1node: 0000000000000000000000000000000000000000
1787 p1node: 0000000000000000000000000000000000000000
1788 p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1788 p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1789 p1node--verbose: 0000000000000000000000000000000000000000
1789 p1node--verbose: 0000000000000000000000000000000000000000
1790 p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1790 p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1791 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1791 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1792 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1792 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1793 p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1793 p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1794 p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1794 p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1795 p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1795 p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1796 p1node--verbose: 0000000000000000000000000000000000000000
1796 p1node--verbose: 0000000000000000000000000000000000000000
1797 p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1797 p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1798 p1node--debug: 0000000000000000000000000000000000000000
1798 p1node--debug: 0000000000000000000000000000000000000000
1799 p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1799 p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1800 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1800 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1801 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1801 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1802 p1node--debug: 97054abb4ab824450e9164180baf491ae0078465
1802 p1node--debug: 97054abb4ab824450e9164180baf491ae0078465
1803 p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1803 p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1804 p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1804 p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1805 p1node--debug: 0000000000000000000000000000000000000000
1805 p1node--debug: 0000000000000000000000000000000000000000
1806 p2node: 0000000000000000000000000000000000000000
1806 p2node: 0000000000000000000000000000000000000000
1807 p2node: 0000000000000000000000000000000000000000
1807 p2node: 0000000000000000000000000000000000000000
1808 p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1808 p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1809 p2node: 0000000000000000000000000000000000000000
1809 p2node: 0000000000000000000000000000000000000000
1810 p2node: 0000000000000000000000000000000000000000
1810 p2node: 0000000000000000000000000000000000000000
1811 p2node: 0000000000000000000000000000000000000000
1811 p2node: 0000000000000000000000000000000000000000
1812 p2node: 0000000000000000000000000000000000000000
1812 p2node: 0000000000000000000000000000000000000000
1813 p2node: 0000000000000000000000000000000000000000
1813 p2node: 0000000000000000000000000000000000000000
1814 p2node: 0000000000000000000000000000000000000000
1814 p2node: 0000000000000000000000000000000000000000
1815 p2node--verbose: 0000000000000000000000000000000000000000
1815 p2node--verbose: 0000000000000000000000000000000000000000
1816 p2node--verbose: 0000000000000000000000000000000000000000
1816 p2node--verbose: 0000000000000000000000000000000000000000
1817 p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1817 p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1818 p2node--verbose: 0000000000000000000000000000000000000000
1818 p2node--verbose: 0000000000000000000000000000000000000000
1819 p2node--verbose: 0000000000000000000000000000000000000000
1819 p2node--verbose: 0000000000000000000000000000000000000000
1820 p2node--verbose: 0000000000000000000000000000000000000000
1820 p2node--verbose: 0000000000000000000000000000000000000000
1821 p2node--verbose: 0000000000000000000000000000000000000000
1821 p2node--verbose: 0000000000000000000000000000000000000000
1822 p2node--verbose: 0000000000000000000000000000000000000000
1822 p2node--verbose: 0000000000000000000000000000000000000000
1823 p2node--verbose: 0000000000000000000000000000000000000000
1823 p2node--verbose: 0000000000000000000000000000000000000000
1824 p2node--debug: 0000000000000000000000000000000000000000
1824 p2node--debug: 0000000000000000000000000000000000000000
1825 p2node--debug: 0000000000000000000000000000000000000000
1825 p2node--debug: 0000000000000000000000000000000000000000
1826 p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1826 p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1827 p2node--debug: 0000000000000000000000000000000000000000
1827 p2node--debug: 0000000000000000000000000000000000000000
1828 p2node--debug: 0000000000000000000000000000000000000000
1828 p2node--debug: 0000000000000000000000000000000000000000
1829 p2node--debug: 0000000000000000000000000000000000000000
1829 p2node--debug: 0000000000000000000000000000000000000000
1830 p2node--debug: 0000000000000000000000000000000000000000
1830 p2node--debug: 0000000000000000000000000000000000000000
1831 p2node--debug: 0000000000000000000000000000000000000000
1831 p2node--debug: 0000000000000000000000000000000000000000
1832 p2node--debug: 0000000000000000000000000000000000000000
1832 p2node--debug: 0000000000000000000000000000000000000000
1833
1833
1834 Filters work:
1834 Filters work:
1835
1835
1836 $ hg log --template '{author|domain}\n'
1836 $ hg log --template '{author|domain}\n'
1837
1837
1838 hostname
1838 hostname
1839
1839
1840
1840
1841
1841
1842
1842
1843 place
1843 place
1844 place
1844 place
1845 hostname
1845 hostname
1846
1846
1847 $ hg log --template '{author|person}\n'
1847 $ hg log --template '{author|person}\n'
1848 test
1848 test
1849 User Name
1849 User Name
1850 person
1850 person
1851 person
1851 person
1852 person
1852 person
1853 person
1853 person
1854 other
1854 other
1855 A. N. Other
1855 A. N. Other
1856 User Name
1856 User Name
1857
1857
1858 $ hg log --template '{author|user}\n'
1858 $ hg log --template '{author|user}\n'
1859 test
1859 test
1860 user
1860 user
1861 person
1861 person
1862 person
1862 person
1863 person
1863 person
1864 person
1864 person
1865 other
1865 other
1866 other
1866 other
1867 user
1867 user
1868
1868
1869 $ hg log --template '{date|date}\n'
1869 $ hg log --template '{date|date}\n'
1870 Wed Jan 01 10:01:00 2020 +0000
1870 Wed Jan 01 10:01:00 2020 +0000
1871 Mon Jan 12 13:46:40 1970 +0000
1871 Mon Jan 12 13:46:40 1970 +0000
1872 Sun Jan 18 08:40:01 1970 +0000
1872 Sun Jan 18 08:40:01 1970 +0000
1873 Sun Jan 18 08:40:00 1970 +0000
1873 Sun Jan 18 08:40:00 1970 +0000
1874 Sat Jan 17 04:53:20 1970 +0000
1874 Sat Jan 17 04:53:20 1970 +0000
1875 Fri Jan 16 01:06:40 1970 +0000
1875 Fri Jan 16 01:06:40 1970 +0000
1876 Wed Jan 14 21:20:00 1970 +0000
1876 Wed Jan 14 21:20:00 1970 +0000
1877 Tue Jan 13 17:33:20 1970 +0000
1877 Tue Jan 13 17:33:20 1970 +0000
1878 Mon Jan 12 13:46:40 1970 +0000
1878 Mon Jan 12 13:46:40 1970 +0000
1879
1879
1880 $ hg log --template '{date|isodate}\n'
1880 $ hg log --template '{date|isodate}\n'
1881 2020-01-01 10:01 +0000
1881 2020-01-01 10:01 +0000
1882 1970-01-12 13:46 +0000
1882 1970-01-12 13:46 +0000
1883 1970-01-18 08:40 +0000
1883 1970-01-18 08:40 +0000
1884 1970-01-18 08:40 +0000
1884 1970-01-18 08:40 +0000
1885 1970-01-17 04:53 +0000
1885 1970-01-17 04:53 +0000
1886 1970-01-16 01:06 +0000
1886 1970-01-16 01:06 +0000
1887 1970-01-14 21:20 +0000
1887 1970-01-14 21:20 +0000
1888 1970-01-13 17:33 +0000
1888 1970-01-13 17:33 +0000
1889 1970-01-12 13:46 +0000
1889 1970-01-12 13:46 +0000
1890
1890
1891 $ hg log --template '{date|isodatesec}\n'
1891 $ hg log --template '{date|isodatesec}\n'
1892 2020-01-01 10:01:00 +0000
1892 2020-01-01 10:01:00 +0000
1893 1970-01-12 13:46:40 +0000
1893 1970-01-12 13:46:40 +0000
1894 1970-01-18 08:40:01 +0000
1894 1970-01-18 08:40:01 +0000
1895 1970-01-18 08:40:00 +0000
1895 1970-01-18 08:40:00 +0000
1896 1970-01-17 04:53:20 +0000
1896 1970-01-17 04:53:20 +0000
1897 1970-01-16 01:06:40 +0000
1897 1970-01-16 01:06:40 +0000
1898 1970-01-14 21:20:00 +0000
1898 1970-01-14 21:20:00 +0000
1899 1970-01-13 17:33:20 +0000
1899 1970-01-13 17:33:20 +0000
1900 1970-01-12 13:46:40 +0000
1900 1970-01-12 13:46:40 +0000
1901
1901
1902 $ hg log --template '{date|rfc822date}\n'
1902 $ hg log --template '{date|rfc822date}\n'
1903 Wed, 01 Jan 2020 10:01:00 +0000
1903 Wed, 01 Jan 2020 10:01:00 +0000
1904 Mon, 12 Jan 1970 13:46:40 +0000
1904 Mon, 12 Jan 1970 13:46:40 +0000
1905 Sun, 18 Jan 1970 08:40:01 +0000
1905 Sun, 18 Jan 1970 08:40:01 +0000
1906 Sun, 18 Jan 1970 08:40:00 +0000
1906 Sun, 18 Jan 1970 08:40:00 +0000
1907 Sat, 17 Jan 1970 04:53:20 +0000
1907 Sat, 17 Jan 1970 04:53:20 +0000
1908 Fri, 16 Jan 1970 01:06:40 +0000
1908 Fri, 16 Jan 1970 01:06:40 +0000
1909 Wed, 14 Jan 1970 21:20:00 +0000
1909 Wed, 14 Jan 1970 21:20:00 +0000
1910 Tue, 13 Jan 1970 17:33:20 +0000
1910 Tue, 13 Jan 1970 17:33:20 +0000
1911 Mon, 12 Jan 1970 13:46:40 +0000
1911 Mon, 12 Jan 1970 13:46:40 +0000
1912
1912
1913 $ hg log --template '{desc|firstline}\n'
1913 $ hg log --template '{desc|firstline}\n'
1914 third
1914 third
1915 second
1915 second
1916 merge
1916 merge
1917 new head
1917 new head
1918 new branch
1918 new branch
1919 no user, no domain
1919 no user, no domain
1920 no person
1920 no person
1921 other 1
1921 other 1
1922 line 1
1922 line 1
1923
1923
1924 $ hg log --template '{node|short}\n'
1924 $ hg log --template '{node|short}\n'
1925 95c24699272e
1925 95c24699272e
1926 29114dbae42b
1926 29114dbae42b
1927 d41e714fe50d
1927 d41e714fe50d
1928 13207e5a10d9
1928 13207e5a10d9
1929 bbe44766e73d
1929 bbe44766e73d
1930 10e46f2dcbf4
1930 10e46f2dcbf4
1931 97054abb4ab8
1931 97054abb4ab8
1932 b608e9d1a3f0
1932 b608e9d1a3f0
1933 1e4e1b8f71e0
1933 1e4e1b8f71e0
1934
1934
1935 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
1935 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
1936 <changeset author="test"/>
1936 <changeset author="test"/>
1937 <changeset author="User Name &lt;user@hostname&gt;"/>
1937 <changeset author="User Name &lt;user@hostname&gt;"/>
1938 <changeset author="person"/>
1938 <changeset author="person"/>
1939 <changeset author="person"/>
1939 <changeset author="person"/>
1940 <changeset author="person"/>
1940 <changeset author="person"/>
1941 <changeset author="person"/>
1941 <changeset author="person"/>
1942 <changeset author="other@place"/>
1942 <changeset author="other@place"/>
1943 <changeset author="A. N. Other &lt;other@place&gt;"/>
1943 <changeset author="A. N. Other &lt;other@place&gt;"/>
1944 <changeset author="User Name &lt;user@hostname&gt;"/>
1944 <changeset author="User Name &lt;user@hostname&gt;"/>
1945
1945
1946 $ hg log --template '{rev}: {children}\n'
1946 $ hg log --template '{rev}: {children}\n'
1947 8:
1947 8:
1948 7: 8:95c24699272e
1948 7: 8:95c24699272e
1949 6:
1949 6:
1950 5: 6:d41e714fe50d
1950 5: 6:d41e714fe50d
1951 4: 6:d41e714fe50d
1951 4: 6:d41e714fe50d
1952 3: 4:bbe44766e73d 5:13207e5a10d9
1952 3: 4:bbe44766e73d 5:13207e5a10d9
1953 2: 3:10e46f2dcbf4
1953 2: 3:10e46f2dcbf4
1954 1: 2:97054abb4ab8
1954 1: 2:97054abb4ab8
1955 0: 1:b608e9d1a3f0
1955 0: 1:b608e9d1a3f0
1956
1956
1957 Formatnode filter works:
1957 Formatnode filter works:
1958
1958
1959 $ hg -q log -r 0 --template '{node|formatnode}\n'
1959 $ hg -q log -r 0 --template '{node|formatnode}\n'
1960 1e4e1b8f71e0
1960 1e4e1b8f71e0
1961
1961
1962 $ hg log -r 0 --template '{node|formatnode}\n'
1962 $ hg log -r 0 --template '{node|formatnode}\n'
1963 1e4e1b8f71e0
1963 1e4e1b8f71e0
1964
1964
1965 $ hg -v log -r 0 --template '{node|formatnode}\n'
1965 $ hg -v log -r 0 --template '{node|formatnode}\n'
1966 1e4e1b8f71e0
1966 1e4e1b8f71e0
1967
1967
1968 $ hg --debug log -r 0 --template '{node|formatnode}\n'
1968 $ hg --debug log -r 0 --template '{node|formatnode}\n'
1969 1e4e1b8f71e05681d422154f5421e385fec3454f
1969 1e4e1b8f71e05681d422154f5421e385fec3454f
1970
1970
1971 Age filter:
1971 Age filter:
1972
1972
1973 $ hg init unstable-hash
1973 $ hg init unstable-hash
1974 $ cd unstable-hash
1974 $ cd unstable-hash
1975 $ hg log --template '{date|age}\n' > /dev/null || exit 1
1975 $ hg log --template '{date|age}\n' > /dev/null || exit 1
1976
1976
1977 >>> from datetime import datetime, timedelta
1977 >>> from datetime import datetime, timedelta
1978 >>> fp = open('a', 'w')
1978 >>> fp = open('a', 'w')
1979 >>> n = datetime.now() + timedelta(366 * 7)
1979 >>> n = datetime.now() + timedelta(366 * 7)
1980 >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
1980 >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day))
1981 >>> fp.close()
1981 >>> fp.close()
1982 $ hg add a
1982 $ hg add a
1983 $ hg commit -m future -d "`cat a`"
1983 $ hg commit -m future -d "`cat a`"
1984
1984
1985 $ hg log -l1 --template '{date|age}\n'
1985 $ hg log -l1 --template '{date|age}\n'
1986 7 years from now
1986 7 years from now
1987
1987
1988 $ cd ..
1988 $ cd ..
1989 $ rm -rf unstable-hash
1989 $ rm -rf unstable-hash
1990
1990
1991 Add a dummy commit to make up for the instability of the above:
1991 Add a dummy commit to make up for the instability of the above:
1992
1992
1993 $ echo a > a
1993 $ echo a > a
1994 $ hg add a
1994 $ hg add a
1995 $ hg ci -m future
1995 $ hg ci -m future
1996
1996
1997 Count filter:
1997 Count filter:
1998
1998
1999 $ hg log -l1 --template '{node|count} {node|short|count}\n'
1999 $ hg log -l1 --template '{node|count} {node|short|count}\n'
2000 40 12
2000 40 12
2001
2001
2002 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n'
2002 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n'
2003 0 1 4
2003 0 1 4
2004
2004
2005 $ hg log -G --template '{rev}: children: {children|count}, \
2005 $ hg log -G --template '{rev}: children: {children|count}, \
2006 > tags: {tags|count}, file_adds: {file_adds|count}, \
2006 > tags: {tags|count}, file_adds: {file_adds|count}, \
2007 > ancestors: {revset("ancestors(%s)", rev)|count}'
2007 > ancestors: {revset("ancestors(%s)", rev)|count}'
2008 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3
2008 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3
2009 |
2009 |
2010 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2
2010 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2
2011 |
2011 |
2012 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1
2012 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1
2013
2013
2014 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7
2014 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7
2015 |\
2015 |\
2016 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5
2016 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5
2017 | |
2017 | |
2018 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5
2018 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5
2019 |/
2019 |/
2020 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4
2020 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4
2021 |
2021 |
2022 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3
2022 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3
2023 |
2023 |
2024 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2024 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2025 |
2025 |
2026 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2026 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2027
2027
2028
2028
2029 Upper/lower filters:
2029 Upper/lower filters:
2030
2030
2031 $ hg log -r0 --template '{branch|upper}\n'
2031 $ hg log -r0 --template '{branch|upper}\n'
2032 DEFAULT
2032 DEFAULT
2033 $ hg log -r0 --template '{author|lower}\n'
2033 $ hg log -r0 --template '{author|lower}\n'
2034 user name <user@hostname>
2034 user name <user@hostname>
2035 $ hg log -r0 --template '{date|upper}\n'
2035 $ hg log -r0 --template '{date|upper}\n'
2036 abort: template filter 'upper' is not compatible with keyword 'date'
2036 abort: template filter 'upper' is not compatible with keyword 'date'
2037 [255]
2037 [255]
2038
2038
2039 Add a commit that does all possible modifications at once
2039 Add a commit that does all possible modifications at once
2040
2040
2041 $ echo modify >> third
2041 $ echo modify >> third
2042 $ touch b
2042 $ touch b
2043 $ hg add b
2043 $ hg add b
2044 $ hg mv fourth fifth
2044 $ hg mv fourth fifth
2045 $ hg rm a
2045 $ hg rm a
2046 $ hg ci -m "Modify, add, remove, rename"
2046 $ hg ci -m "Modify, add, remove, rename"
2047
2047
2048 Check the status template
2048 Check the status template
2049
2049
2050 $ cat <<EOF >> $HGRCPATH
2050 $ cat <<EOF >> $HGRCPATH
2051 > [extensions]
2051 > [extensions]
2052 > color=
2052 > color=
2053 > EOF
2053 > EOF
2054
2054
2055 $ hg log -T status -r 10
2055 $ hg log -T status -r 10
2056 changeset: 10:0f9759ec227a
2056 changeset: 10:0f9759ec227a
2057 tag: tip
2057 tag: tip
2058 user: test
2058 user: test
2059 date: Thu Jan 01 00:00:00 1970 +0000
2059 date: Thu Jan 01 00:00:00 1970 +0000
2060 summary: Modify, add, remove, rename
2060 summary: Modify, add, remove, rename
2061 files:
2061 files:
2062 M third
2062 M third
2063 A b
2063 A b
2064 A fifth
2064 A fifth
2065 R a
2065 R a
2066 R fourth
2066 R fourth
2067
2067
2068 $ hg log -T status -C -r 10
2068 $ hg log -T status -C -r 10
2069 changeset: 10:0f9759ec227a
2069 changeset: 10:0f9759ec227a
2070 tag: tip
2070 tag: tip
2071 user: test
2071 user: test
2072 date: Thu Jan 01 00:00:00 1970 +0000
2072 date: Thu Jan 01 00:00:00 1970 +0000
2073 summary: Modify, add, remove, rename
2073 summary: Modify, add, remove, rename
2074 files:
2074 files:
2075 M third
2075 M third
2076 A b
2076 A b
2077 A fifth
2077 A fifth
2078 fourth
2078 fourth
2079 R a
2079 R a
2080 R fourth
2080 R fourth
2081
2081
2082 $ hg log -T status -C -r 10 -v
2082 $ hg log -T status -C -r 10 -v
2083 changeset: 10:0f9759ec227a
2083 changeset: 10:0f9759ec227a
2084 tag: tip
2084 tag: tip
2085 user: test
2085 user: test
2086 date: Thu Jan 01 00:00:00 1970 +0000
2086 date: Thu Jan 01 00:00:00 1970 +0000
2087 description:
2087 description:
2088 Modify, add, remove, rename
2088 Modify, add, remove, rename
2089
2089
2090 files:
2090 files:
2091 M third
2091 M third
2092 A b
2092 A b
2093 A fifth
2093 A fifth
2094 fourth
2094 fourth
2095 R a
2095 R a
2096 R fourth
2096 R fourth
2097
2097
2098 $ hg log -T status -C -r 10 --debug
2098 $ hg log -T status -C -r 10 --debug
2099 changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c
2099 changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c
2100 tag: tip
2100 tag: tip
2101 phase: secret
2101 phase: secret
2102 parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066
2102 parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066
2103 parent: -1:0000000000000000000000000000000000000000
2103 parent: -1:0000000000000000000000000000000000000000
2104 manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567
2104 manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567
2105 user: test
2105 user: test
2106 date: Thu Jan 01 00:00:00 1970 +0000
2106 date: Thu Jan 01 00:00:00 1970 +0000
2107 extra: branch=default
2107 extra: branch=default
2108 description:
2108 description:
2109 Modify, add, remove, rename
2109 Modify, add, remove, rename
2110
2110
2111 files:
2111 files:
2112 M third
2112 M third
2113 A b
2113 A b
2114 A fifth
2114 A fifth
2115 fourth
2115 fourth
2116 R a
2116 R a
2117 R fourth
2117 R fourth
2118
2118
2119 $ hg log -T status -C -r 10 --quiet
2119 $ hg log -T status -C -r 10 --quiet
2120 10:0f9759ec227a
2120 10:0f9759ec227a
2121 $ hg --color=debug log -T status -r 10
2121 $ hg --color=debug log -T status -r 10
2122 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2122 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2123 [log.tag|tag: tip]
2123 [log.tag|tag: tip]
2124 [log.user|user: test]
2124 [log.user|user: test]
2125 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2125 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2126 [log.summary|summary: Modify, add, remove, rename]
2126 [log.summary|summary: Modify, add, remove, rename]
2127 [ui.note log.files|files:]
2127 [ui.note log.files|files:]
2128 [status.modified|M third]
2128 [status.modified|M third]
2129 [status.added|A b]
2129 [status.added|A b]
2130 [status.added|A fifth]
2130 [status.added|A fifth]
2131 [status.removed|R a]
2131 [status.removed|R a]
2132 [status.removed|R fourth]
2132 [status.removed|R fourth]
2133
2133
2134 $ hg --color=debug log -T status -C -r 10
2134 $ hg --color=debug log -T status -C -r 10
2135 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2135 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2136 [log.tag|tag: tip]
2136 [log.tag|tag: tip]
2137 [log.user|user: test]
2137 [log.user|user: test]
2138 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2138 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2139 [log.summary|summary: Modify, add, remove, rename]
2139 [log.summary|summary: Modify, add, remove, rename]
2140 [ui.note log.files|files:]
2140 [ui.note log.files|files:]
2141 [status.modified|M third]
2141 [status.modified|M third]
2142 [status.added|A b]
2142 [status.added|A b]
2143 [status.added|A fifth]
2143 [status.added|A fifth]
2144 [status.copied| fourth]
2144 [status.copied| fourth]
2145 [status.removed|R a]
2145 [status.removed|R a]
2146 [status.removed|R fourth]
2146 [status.removed|R fourth]
2147
2147
2148 $ hg --color=debug log -T status -C -r 10 -v
2148 $ hg --color=debug log -T status -C -r 10 -v
2149 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2149 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2150 [log.tag|tag: tip]
2150 [log.tag|tag: tip]
2151 [log.user|user: test]
2151 [log.user|user: test]
2152 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2152 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2153 [ui.note log.description|description:]
2153 [ui.note log.description|description:]
2154 [ui.note log.description|Modify, add, remove, rename]
2154 [ui.note log.description|Modify, add, remove, rename]
2155
2155
2156 [ui.note log.files|files:]
2156 [ui.note log.files|files:]
2157 [status.modified|M third]
2157 [status.modified|M third]
2158 [status.added|A b]
2158 [status.added|A b]
2159 [status.added|A fifth]
2159 [status.added|A fifth]
2160 [status.copied| fourth]
2160 [status.copied| fourth]
2161 [status.removed|R a]
2161 [status.removed|R a]
2162 [status.removed|R fourth]
2162 [status.removed|R fourth]
2163
2163
2164 $ hg --color=debug log -T status -C -r 10 --debug
2164 $ hg --color=debug log -T status -C -r 10 --debug
2165 [log.changeset changeset.secret|changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c]
2165 [log.changeset changeset.secret|changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c]
2166 [log.tag|tag: tip]
2166 [log.tag|tag: tip]
2167 [log.phase|phase: secret]
2167 [log.phase|phase: secret]
2168 [log.parent changeset.secret|parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066]
2168 [log.parent changeset.secret|parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066]
2169 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2169 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2170 [ui.debug log.manifest|manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567]
2170 [ui.debug log.manifest|manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567]
2171 [log.user|user: test]
2171 [log.user|user: test]
2172 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2172 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2173 [ui.debug log.extra|extra: branch=default]
2173 [ui.debug log.extra|extra: branch=default]
2174 [ui.note log.description|description:]
2174 [ui.note log.description|description:]
2175 [ui.note log.description|Modify, add, remove, rename]
2175 [ui.note log.description|Modify, add, remove, rename]
2176
2176
2177 [ui.note log.files|files:]
2177 [ui.note log.files|files:]
2178 [status.modified|M third]
2178 [status.modified|M third]
2179 [status.added|A b]
2179 [status.added|A b]
2180 [status.added|A fifth]
2180 [status.added|A fifth]
2181 [status.copied| fourth]
2181 [status.copied| fourth]
2182 [status.removed|R a]
2182 [status.removed|R a]
2183 [status.removed|R fourth]
2183 [status.removed|R fourth]
2184
2184
2185 $ hg --color=debug log -T status -C -r 10 --quiet
2185 $ hg --color=debug log -T status -C -r 10 --quiet
2186 [log.node|10:0f9759ec227a]
2186 [log.node|10:0f9759ec227a]
2187
2187
2188 Check the bisect template
2188 Check the bisect template
2189
2189
2190 $ hg bisect -g 1
2190 $ hg bisect -g 1
2191 $ hg bisect -b 3 --noupdate
2191 $ hg bisect -b 3 --noupdate
2192 Testing changeset 2:97054abb4ab8 (2 changesets remaining, ~1 tests)
2192 Testing changeset 2:97054abb4ab8 (2 changesets remaining, ~1 tests)
2193 $ hg log -T bisect -r 0:4
2193 $ hg log -T bisect -r 0:4
2194 changeset: 0:1e4e1b8f71e0
2194 changeset: 0:1e4e1b8f71e0
2195 bisect: good (implicit)
2195 bisect: good (implicit)
2196 user: User Name <user@hostname>
2196 user: User Name <user@hostname>
2197 date: Mon Jan 12 13:46:40 1970 +0000
2197 date: Mon Jan 12 13:46:40 1970 +0000
2198 summary: line 1
2198 summary: line 1
2199
2199
2200 changeset: 1:b608e9d1a3f0
2200 changeset: 1:b608e9d1a3f0
2201 bisect: good
2201 bisect: good
2202 user: A. N. Other <other@place>
2202 user: A. N. Other <other@place>
2203 date: Tue Jan 13 17:33:20 1970 +0000
2203 date: Tue Jan 13 17:33:20 1970 +0000
2204 summary: other 1
2204 summary: other 1
2205
2205
2206 changeset: 2:97054abb4ab8
2206 changeset: 2:97054abb4ab8
2207 bisect: untested
2207 bisect: untested
2208 user: other@place
2208 user: other@place
2209 date: Wed Jan 14 21:20:00 1970 +0000
2209 date: Wed Jan 14 21:20:00 1970 +0000
2210 summary: no person
2210 summary: no person
2211
2211
2212 changeset: 3:10e46f2dcbf4
2212 changeset: 3:10e46f2dcbf4
2213 bisect: bad
2213 bisect: bad
2214 user: person
2214 user: person
2215 date: Fri Jan 16 01:06:40 1970 +0000
2215 date: Fri Jan 16 01:06:40 1970 +0000
2216 summary: no user, no domain
2216 summary: no user, no domain
2217
2217
2218 changeset: 4:bbe44766e73d
2218 changeset: 4:bbe44766e73d
2219 bisect: bad (implicit)
2219 bisect: bad (implicit)
2220 branch: foo
2220 branch: foo
2221 user: person
2221 user: person
2222 date: Sat Jan 17 04:53:20 1970 +0000
2222 date: Sat Jan 17 04:53:20 1970 +0000
2223 summary: new branch
2223 summary: new branch
2224
2224
2225 $ hg log --debug -T bisect -r 0:4
2225 $ hg log --debug -T bisect -r 0:4
2226 changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2226 changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2227 bisect: good (implicit)
2227 bisect: good (implicit)
2228 phase: public
2228 phase: public
2229 parent: -1:0000000000000000000000000000000000000000
2229 parent: -1:0000000000000000000000000000000000000000
2230 parent: -1:0000000000000000000000000000000000000000
2230 parent: -1:0000000000000000000000000000000000000000
2231 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
2231 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
2232 user: User Name <user@hostname>
2232 user: User Name <user@hostname>
2233 date: Mon Jan 12 13:46:40 1970 +0000
2233 date: Mon Jan 12 13:46:40 1970 +0000
2234 files+: a
2234 files+: a
2235 extra: branch=default
2235 extra: branch=default
2236 description:
2236 description:
2237 line 1
2237 line 1
2238 line 2
2238 line 2
2239
2239
2240
2240
2241 changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2241 changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2242 bisect: good
2242 bisect: good
2243 phase: public
2243 phase: public
2244 parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2244 parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2245 parent: -1:0000000000000000000000000000000000000000
2245 parent: -1:0000000000000000000000000000000000000000
2246 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
2246 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
2247 user: A. N. Other <other@place>
2247 user: A. N. Other <other@place>
2248 date: Tue Jan 13 17:33:20 1970 +0000
2248 date: Tue Jan 13 17:33:20 1970 +0000
2249 files+: b
2249 files+: b
2250 extra: branch=default
2250 extra: branch=default
2251 description:
2251 description:
2252 other 1
2252 other 1
2253 other 2
2253 other 2
2254
2254
2255 other 3
2255 other 3
2256
2256
2257
2257
2258 changeset: 2:97054abb4ab824450e9164180baf491ae0078465
2258 changeset: 2:97054abb4ab824450e9164180baf491ae0078465
2259 bisect: untested
2259 bisect: untested
2260 phase: public
2260 phase: public
2261 parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2261 parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2262 parent: -1:0000000000000000000000000000000000000000
2262 parent: -1:0000000000000000000000000000000000000000
2263 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
2263 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
2264 user: other@place
2264 user: other@place
2265 date: Wed Jan 14 21:20:00 1970 +0000
2265 date: Wed Jan 14 21:20:00 1970 +0000
2266 files+: c
2266 files+: c
2267 extra: branch=default
2267 extra: branch=default
2268 description:
2268 description:
2269 no person
2269 no person
2270
2270
2271
2271
2272 changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2272 changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2273 bisect: bad
2273 bisect: bad
2274 phase: public
2274 phase: public
2275 parent: 2:97054abb4ab824450e9164180baf491ae0078465
2275 parent: 2:97054abb4ab824450e9164180baf491ae0078465
2276 parent: -1:0000000000000000000000000000000000000000
2276 parent: -1:0000000000000000000000000000000000000000
2277 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2277 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2278 user: person
2278 user: person
2279 date: Fri Jan 16 01:06:40 1970 +0000
2279 date: Fri Jan 16 01:06:40 1970 +0000
2280 files: c
2280 files: c
2281 extra: branch=default
2281 extra: branch=default
2282 description:
2282 description:
2283 no user, no domain
2283 no user, no domain
2284
2284
2285
2285
2286 changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
2286 changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
2287 bisect: bad (implicit)
2287 bisect: bad (implicit)
2288 branch: foo
2288 branch: foo
2289 phase: draft
2289 phase: draft
2290 parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2290 parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2291 parent: -1:0000000000000000000000000000000000000000
2291 parent: -1:0000000000000000000000000000000000000000
2292 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2292 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2293 user: person
2293 user: person
2294 date: Sat Jan 17 04:53:20 1970 +0000
2294 date: Sat Jan 17 04:53:20 1970 +0000
2295 extra: branch=foo
2295 extra: branch=foo
2296 description:
2296 description:
2297 new branch
2297 new branch
2298
2298
2299
2299
2300 $ hg log -v -T bisect -r 0:4
2300 $ hg log -v -T bisect -r 0:4
2301 changeset: 0:1e4e1b8f71e0
2301 changeset: 0:1e4e1b8f71e0
2302 bisect: good (implicit)
2302 bisect: good (implicit)
2303 user: User Name <user@hostname>
2303 user: User Name <user@hostname>
2304 date: Mon Jan 12 13:46:40 1970 +0000
2304 date: Mon Jan 12 13:46:40 1970 +0000
2305 files: a
2305 files: a
2306 description:
2306 description:
2307 line 1
2307 line 1
2308 line 2
2308 line 2
2309
2309
2310
2310
2311 changeset: 1:b608e9d1a3f0
2311 changeset: 1:b608e9d1a3f0
2312 bisect: good
2312 bisect: good
2313 user: A. N. Other <other@place>
2313 user: A. N. Other <other@place>
2314 date: Tue Jan 13 17:33:20 1970 +0000
2314 date: Tue Jan 13 17:33:20 1970 +0000
2315 files: b
2315 files: b
2316 description:
2316 description:
2317 other 1
2317 other 1
2318 other 2
2318 other 2
2319
2319
2320 other 3
2320 other 3
2321
2321
2322
2322
2323 changeset: 2:97054abb4ab8
2323 changeset: 2:97054abb4ab8
2324 bisect: untested
2324 bisect: untested
2325 user: other@place
2325 user: other@place
2326 date: Wed Jan 14 21:20:00 1970 +0000
2326 date: Wed Jan 14 21:20:00 1970 +0000
2327 files: c
2327 files: c
2328 description:
2328 description:
2329 no person
2329 no person
2330
2330
2331
2331
2332 changeset: 3:10e46f2dcbf4
2332 changeset: 3:10e46f2dcbf4
2333 bisect: bad
2333 bisect: bad
2334 user: person
2334 user: person
2335 date: Fri Jan 16 01:06:40 1970 +0000
2335 date: Fri Jan 16 01:06:40 1970 +0000
2336 files: c
2336 files: c
2337 description:
2337 description:
2338 no user, no domain
2338 no user, no domain
2339
2339
2340
2340
2341 changeset: 4:bbe44766e73d
2341 changeset: 4:bbe44766e73d
2342 bisect: bad (implicit)
2342 bisect: bad (implicit)
2343 branch: foo
2343 branch: foo
2344 user: person
2344 user: person
2345 date: Sat Jan 17 04:53:20 1970 +0000
2345 date: Sat Jan 17 04:53:20 1970 +0000
2346 description:
2346 description:
2347 new branch
2347 new branch
2348
2348
2349
2349
2350 $ hg --color=debug log -T bisect -r 0:4
2350 $ hg --color=debug log -T bisect -r 0:4
2351 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2351 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2352 [log.bisect bisect.good|bisect: good (implicit)]
2352 [log.bisect bisect.good|bisect: good (implicit)]
2353 [log.user|user: User Name <user@hostname>]
2353 [log.user|user: User Name <user@hostname>]
2354 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2354 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2355 [log.summary|summary: line 1]
2355 [log.summary|summary: line 1]
2356
2356
2357 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2357 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2358 [log.bisect bisect.good|bisect: good]
2358 [log.bisect bisect.good|bisect: good]
2359 [log.user|user: A. N. Other <other@place>]
2359 [log.user|user: A. N. Other <other@place>]
2360 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2360 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2361 [log.summary|summary: other 1]
2361 [log.summary|summary: other 1]
2362
2362
2363 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2363 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2364 [log.bisect bisect.untested|bisect: untested]
2364 [log.bisect bisect.untested|bisect: untested]
2365 [log.user|user: other@place]
2365 [log.user|user: other@place]
2366 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2366 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2367 [log.summary|summary: no person]
2367 [log.summary|summary: no person]
2368
2368
2369 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2369 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2370 [log.bisect bisect.bad|bisect: bad]
2370 [log.bisect bisect.bad|bisect: bad]
2371 [log.user|user: person]
2371 [log.user|user: person]
2372 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2372 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2373 [log.summary|summary: no user, no domain]
2373 [log.summary|summary: no user, no domain]
2374
2374
2375 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2375 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2376 [log.bisect bisect.bad|bisect: bad (implicit)]
2376 [log.bisect bisect.bad|bisect: bad (implicit)]
2377 [log.branch|branch: foo]
2377 [log.branch|branch: foo]
2378 [log.user|user: person]
2378 [log.user|user: person]
2379 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2379 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2380 [log.summary|summary: new branch]
2380 [log.summary|summary: new branch]
2381
2381
2382 $ hg --color=debug log --debug -T bisect -r 0:4
2382 $ hg --color=debug log --debug -T bisect -r 0:4
2383 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2383 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2384 [log.bisect bisect.good|bisect: good (implicit)]
2384 [log.bisect bisect.good|bisect: good (implicit)]
2385 [log.phase|phase: public]
2385 [log.phase|phase: public]
2386 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2386 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2387 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2387 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2388 [ui.debug log.manifest|manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0]
2388 [ui.debug log.manifest|manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0]
2389 [log.user|user: User Name <user@hostname>]
2389 [log.user|user: User Name <user@hostname>]
2390 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2390 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2391 [ui.debug log.files|files+: a]
2391 [ui.debug log.files|files+: a]
2392 [ui.debug log.extra|extra: branch=default]
2392 [ui.debug log.extra|extra: branch=default]
2393 [ui.note log.description|description:]
2393 [ui.note log.description|description:]
2394 [ui.note log.description|line 1
2394 [ui.note log.description|line 1
2395 line 2]
2395 line 2]
2396
2396
2397
2397
2398 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2398 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2399 [log.bisect bisect.good|bisect: good]
2399 [log.bisect bisect.good|bisect: good]
2400 [log.phase|phase: public]
2400 [log.phase|phase: public]
2401 [log.parent changeset.public|parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2401 [log.parent changeset.public|parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2402 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2402 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2403 [ui.debug log.manifest|manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55]
2403 [ui.debug log.manifest|manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55]
2404 [log.user|user: A. N. Other <other@place>]
2404 [log.user|user: A. N. Other <other@place>]
2405 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2405 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2406 [ui.debug log.files|files+: b]
2406 [ui.debug log.files|files+: b]
2407 [ui.debug log.extra|extra: branch=default]
2407 [ui.debug log.extra|extra: branch=default]
2408 [ui.note log.description|description:]
2408 [ui.note log.description|description:]
2409 [ui.note log.description|other 1
2409 [ui.note log.description|other 1
2410 other 2
2410 other 2
2411
2411
2412 other 3]
2412 other 3]
2413
2413
2414
2414
2415 [log.changeset changeset.public|changeset: 2:97054abb4ab824450e9164180baf491ae0078465]
2415 [log.changeset changeset.public|changeset: 2:97054abb4ab824450e9164180baf491ae0078465]
2416 [log.bisect bisect.untested|bisect: untested]
2416 [log.bisect bisect.untested|bisect: untested]
2417 [log.phase|phase: public]
2417 [log.phase|phase: public]
2418 [log.parent changeset.public|parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2418 [log.parent changeset.public|parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2419 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2419 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2420 [ui.debug log.manifest|manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1]
2420 [ui.debug log.manifest|manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1]
2421 [log.user|user: other@place]
2421 [log.user|user: other@place]
2422 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2422 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2423 [ui.debug log.files|files+: c]
2423 [ui.debug log.files|files+: c]
2424 [ui.debug log.extra|extra: branch=default]
2424 [ui.debug log.extra|extra: branch=default]
2425 [ui.note log.description|description:]
2425 [ui.note log.description|description:]
2426 [ui.note log.description|no person]
2426 [ui.note log.description|no person]
2427
2427
2428
2428
2429 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2429 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2430 [log.bisect bisect.bad|bisect: bad]
2430 [log.bisect bisect.bad|bisect: bad]
2431 [log.phase|phase: public]
2431 [log.phase|phase: public]
2432 [log.parent changeset.public|parent: 2:97054abb4ab824450e9164180baf491ae0078465]
2432 [log.parent changeset.public|parent: 2:97054abb4ab824450e9164180baf491ae0078465]
2433 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2433 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2434 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2434 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2435 [log.user|user: person]
2435 [log.user|user: person]
2436 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2436 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2437 [ui.debug log.files|files: c]
2437 [ui.debug log.files|files: c]
2438 [ui.debug log.extra|extra: branch=default]
2438 [ui.debug log.extra|extra: branch=default]
2439 [ui.note log.description|description:]
2439 [ui.note log.description|description:]
2440 [ui.note log.description|no user, no domain]
2440 [ui.note log.description|no user, no domain]
2441
2441
2442
2442
2443 [log.changeset changeset.draft|changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74]
2443 [log.changeset changeset.draft|changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74]
2444 [log.bisect bisect.bad|bisect: bad (implicit)]
2444 [log.bisect bisect.bad|bisect: bad (implicit)]
2445 [log.branch|branch: foo]
2445 [log.branch|branch: foo]
2446 [log.phase|phase: draft]
2446 [log.phase|phase: draft]
2447 [log.parent changeset.public|parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2447 [log.parent changeset.public|parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2448 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2448 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2449 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2449 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2450 [log.user|user: person]
2450 [log.user|user: person]
2451 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2451 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2452 [ui.debug log.extra|extra: branch=foo]
2452 [ui.debug log.extra|extra: branch=foo]
2453 [ui.note log.description|description:]
2453 [ui.note log.description|description:]
2454 [ui.note log.description|new branch]
2454 [ui.note log.description|new branch]
2455
2455
2456
2456
2457 $ hg --color=debug log -v -T bisect -r 0:4
2457 $ hg --color=debug log -v -T bisect -r 0:4
2458 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2458 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2459 [log.bisect bisect.good|bisect: good (implicit)]
2459 [log.bisect bisect.good|bisect: good (implicit)]
2460 [log.user|user: User Name <user@hostname>]
2460 [log.user|user: User Name <user@hostname>]
2461 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2461 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2462 [ui.note log.files|files: a]
2462 [ui.note log.files|files: a]
2463 [ui.note log.description|description:]
2463 [ui.note log.description|description:]
2464 [ui.note log.description|line 1
2464 [ui.note log.description|line 1
2465 line 2]
2465 line 2]
2466
2466
2467
2467
2468 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2468 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2469 [log.bisect bisect.good|bisect: good]
2469 [log.bisect bisect.good|bisect: good]
2470 [log.user|user: A. N. Other <other@place>]
2470 [log.user|user: A. N. Other <other@place>]
2471 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2471 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2472 [ui.note log.files|files: b]
2472 [ui.note log.files|files: b]
2473 [ui.note log.description|description:]
2473 [ui.note log.description|description:]
2474 [ui.note log.description|other 1
2474 [ui.note log.description|other 1
2475 other 2
2475 other 2
2476
2476
2477 other 3]
2477 other 3]
2478
2478
2479
2479
2480 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2480 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2481 [log.bisect bisect.untested|bisect: untested]
2481 [log.bisect bisect.untested|bisect: untested]
2482 [log.user|user: other@place]
2482 [log.user|user: other@place]
2483 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2483 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2484 [ui.note log.files|files: c]
2484 [ui.note log.files|files: c]
2485 [ui.note log.description|description:]
2485 [ui.note log.description|description:]
2486 [ui.note log.description|no person]
2486 [ui.note log.description|no person]
2487
2487
2488
2488
2489 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2489 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2490 [log.bisect bisect.bad|bisect: bad]
2490 [log.bisect bisect.bad|bisect: bad]
2491 [log.user|user: person]
2491 [log.user|user: person]
2492 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2492 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2493 [ui.note log.files|files: c]
2493 [ui.note log.files|files: c]
2494 [ui.note log.description|description:]
2494 [ui.note log.description|description:]
2495 [ui.note log.description|no user, no domain]
2495 [ui.note log.description|no user, no domain]
2496
2496
2497
2497
2498 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2498 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2499 [log.bisect bisect.bad|bisect: bad (implicit)]
2499 [log.bisect bisect.bad|bisect: bad (implicit)]
2500 [log.branch|branch: foo]
2500 [log.branch|branch: foo]
2501 [log.user|user: person]
2501 [log.user|user: person]
2502 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2502 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2503 [ui.note log.description|description:]
2503 [ui.note log.description|description:]
2504 [ui.note log.description|new branch]
2504 [ui.note log.description|new branch]
2505
2505
2506
2506
2507 $ hg bisect --reset
2507 $ hg bisect --reset
2508
2508
2509 Error on syntax:
2509 Error on syntax:
2510
2510
2511 $ echo 'x = "f' >> t
2511 $ echo 'x = "f' >> t
2512 $ hg log
2512 $ hg log
2513 hg: parse error at t:3: unmatched quotes
2513 hg: parse error at t:3: unmatched quotes
2514 [255]
2514 [255]
2515
2515
2516 $ hg log -T '{date'
2516 $ hg log -T '{date'
2517 hg: parse error at 1: unterminated template expansion
2517 hg: parse error at 1: unterminated template expansion
2518 [255]
2518 [255]
2519
2519
2520 Behind the scenes, this will throw TypeError
2520 Behind the scenes, this will throw TypeError
2521
2521
2522 $ hg log -l 3 --template '{date|obfuscate}\n'
2522 $ hg log -l 3 --template '{date|obfuscate}\n'
2523 abort: template filter 'obfuscate' is not compatible with keyword 'date'
2523 abort: template filter 'obfuscate' is not compatible with keyword 'date'
2524 [255]
2524 [255]
2525
2525
2526 Behind the scenes, this will throw a ValueError
2526 Behind the scenes, this will throw a ValueError
2527
2527
2528 $ hg log -l 3 --template 'line: {desc|shortdate}\n'
2528 $ hg log -l 3 --template 'line: {desc|shortdate}\n'
2529 abort: template filter 'shortdate' is not compatible with keyword 'desc'
2529 abort: template filter 'shortdate' is not compatible with keyword 'desc'
2530 [255]
2530 [255]
2531
2531
2532 Behind the scenes, this will throw AttributeError
2532 Behind the scenes, this will throw AttributeError
2533
2533
2534 $ hg log -l 3 --template 'line: {date|escape}\n'
2534 $ hg log -l 3 --template 'line: {date|escape}\n'
2535 abort: template filter 'escape' is not compatible with keyword 'date'
2535 abort: template filter 'escape' is not compatible with keyword 'date'
2536 [255]
2536 [255]
2537
2537
2538 $ hg log -l 3 --template 'line: {extras|localdate}\n'
2538 $ hg log -l 3 --template 'line: {extras|localdate}\n'
2539 hg: parse error: localdate expects a date information
2539 hg: parse error: localdate expects a date information
2540 [255]
2540 [255]
2541
2541
2542 Behind the scenes, this will throw ValueError
2542 Behind the scenes, this will throw ValueError
2543
2543
2544 $ hg tip --template '{author|email|date}\n'
2544 $ hg tip --template '{author|email|date}\n'
2545 hg: parse error: date expects a date information
2545 hg: parse error: date expects a date information
2546 [255]
2546 [255]
2547
2547
2548 Error in nested template:
2548 Error in nested template:
2549
2549
2550 $ hg log -T '{"date'
2550 $ hg log -T '{"date'
2551 hg: parse error at 2: unterminated string
2551 hg: parse error at 2: unterminated string
2552 [255]
2552 [255]
2553
2553
2554 $ hg log -T '{"foo{date|=}"}'
2554 $ hg log -T '{"foo{date|=}"}'
2555 hg: parse error at 11: syntax error
2555 hg: parse error at 11: syntax error
2556 [255]
2556 [255]
2557
2557
2558 Thrown an error if a template function doesn't exist
2558 Thrown an error if a template function doesn't exist
2559
2559
2560 $ hg tip --template '{foo()}\n'
2560 $ hg tip --template '{foo()}\n'
2561 hg: parse error: unknown function 'foo'
2561 hg: parse error: unknown function 'foo'
2562 [255]
2562 [255]
2563
2563
2564 Pass generator object created by template function to filter
2564 Pass generator object created by template function to filter
2565
2565
2566 $ hg log -l 1 --template '{if(author, author)|user}\n'
2566 $ hg log -l 1 --template '{if(author, author)|user}\n'
2567 test
2567 test
2568
2568
2569 Test diff function:
2569 Test diff function:
2570
2570
2571 $ hg diff -c 8
2571 $ hg diff -c 8
2572 diff -r 29114dbae42b -r 95c24699272e fourth
2572 diff -r 29114dbae42b -r 95c24699272e fourth
2573 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2573 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2574 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2574 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2575 @@ -0,0 +1,1 @@
2575 @@ -0,0 +1,1 @@
2576 +second
2576 +second
2577 diff -r 29114dbae42b -r 95c24699272e second
2577 diff -r 29114dbae42b -r 95c24699272e second
2578 --- a/second Mon Jan 12 13:46:40 1970 +0000
2578 --- a/second Mon Jan 12 13:46:40 1970 +0000
2579 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2579 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2580 @@ -1,1 +0,0 @@
2580 @@ -1,1 +0,0 @@
2581 -second
2581 -second
2582 diff -r 29114dbae42b -r 95c24699272e third
2582 diff -r 29114dbae42b -r 95c24699272e third
2583 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2583 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2584 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2584 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2585 @@ -0,0 +1,1 @@
2585 @@ -0,0 +1,1 @@
2586 +third
2586 +third
2587
2587
2588 $ hg log -r 8 -T "{diff()}"
2588 $ hg log -r 8 -T "{diff()}"
2589 diff -r 29114dbae42b -r 95c24699272e fourth
2589 diff -r 29114dbae42b -r 95c24699272e fourth
2590 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2590 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2591 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2591 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2592 @@ -0,0 +1,1 @@
2592 @@ -0,0 +1,1 @@
2593 +second
2593 +second
2594 diff -r 29114dbae42b -r 95c24699272e second
2594 diff -r 29114dbae42b -r 95c24699272e second
2595 --- a/second Mon Jan 12 13:46:40 1970 +0000
2595 --- a/second Mon Jan 12 13:46:40 1970 +0000
2596 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2596 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2597 @@ -1,1 +0,0 @@
2597 @@ -1,1 +0,0 @@
2598 -second
2598 -second
2599 diff -r 29114dbae42b -r 95c24699272e third
2599 diff -r 29114dbae42b -r 95c24699272e third
2600 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2600 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2601 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2601 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2602 @@ -0,0 +1,1 @@
2602 @@ -0,0 +1,1 @@
2603 +third
2603 +third
2604
2604
2605 $ hg log -r 8 -T "{diff('glob:f*')}"
2605 $ hg log -r 8 -T "{diff('glob:f*')}"
2606 diff -r 29114dbae42b -r 95c24699272e fourth
2606 diff -r 29114dbae42b -r 95c24699272e fourth
2607 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2607 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2608 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2608 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2609 @@ -0,0 +1,1 @@
2609 @@ -0,0 +1,1 @@
2610 +second
2610 +second
2611
2611
2612 $ hg log -r 8 -T "{diff('', 'glob:f*')}"
2612 $ hg log -r 8 -T "{diff('', 'glob:f*')}"
2613 diff -r 29114dbae42b -r 95c24699272e second
2613 diff -r 29114dbae42b -r 95c24699272e second
2614 --- a/second Mon Jan 12 13:46:40 1970 +0000
2614 --- a/second Mon Jan 12 13:46:40 1970 +0000
2615 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2615 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2616 @@ -1,1 +0,0 @@
2616 @@ -1,1 +0,0 @@
2617 -second
2617 -second
2618 diff -r 29114dbae42b -r 95c24699272e third
2618 diff -r 29114dbae42b -r 95c24699272e third
2619 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2619 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2620 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2620 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2621 @@ -0,0 +1,1 @@
2621 @@ -0,0 +1,1 @@
2622 +third
2622 +third
2623
2623
2624 $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
2624 $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
2625 diff -r 29114dbae42b -r 95c24699272e fourth
2625 diff -r 29114dbae42b -r 95c24699272e fourth
2626 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2626 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2627 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2627 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2628 @@ -0,0 +1,1 @@
2628 @@ -0,0 +1,1 @@
2629 +second
2629 +second
2630
2630
2631 $ cd ..
2631 $ cd ..
2632
2632
2633
2633
2634 latesttag:
2634 latesttag:
2635
2635
2636 $ hg init latesttag
2636 $ hg init latesttag
2637 $ cd latesttag
2637 $ cd latesttag
2638
2638
2639 $ echo a > file
2639 $ echo a > file
2640 $ hg ci -Am a -d '0 0'
2640 $ hg ci -Am a -d '0 0'
2641 adding file
2641 adding file
2642
2642
2643 $ echo b >> file
2643 $ echo b >> file
2644 $ hg ci -m b -d '1 0'
2644 $ hg ci -m b -d '1 0'
2645
2645
2646 $ echo c >> head1
2646 $ echo c >> head1
2647 $ hg ci -Am h1c -d '2 0'
2647 $ hg ci -Am h1c -d '2 0'
2648 adding head1
2648 adding head1
2649
2649
2650 $ hg update -q 1
2650 $ hg update -q 1
2651 $ echo d >> head2
2651 $ echo d >> head2
2652 $ hg ci -Am h2d -d '3 0'
2652 $ hg ci -Am h2d -d '3 0'
2653 adding head2
2653 adding head2
2654 created new head
2654 created new head
2655
2655
2656 $ echo e >> head2
2656 $ echo e >> head2
2657 $ hg ci -m h2e -d '4 0'
2657 $ hg ci -m h2e -d '4 0'
2658
2658
2659 $ hg merge -q
2659 $ hg merge -q
2660 $ hg ci -m merge -d '5 -3600'
2660 $ hg ci -m merge -d '5 -3600'
2661
2661
2662 No tag set:
2662 No tag set:
2663
2663
2664 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2664 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2665 5: null+5
2665 5: null+5
2666 4: null+4
2666 4: null+4
2667 3: null+3
2667 3: null+3
2668 2: null+3
2668 2: null+3
2669 1: null+2
2669 1: null+2
2670 0: null+1
2670 0: null+1
2671
2671
2672 One common tag: longest path wins:
2672 One common tag: longest path wins:
2673
2673
2674 $ hg tag -r 1 -m t1 -d '6 0' t1
2674 $ hg tag -r 1 -m t1 -d '6 0' t1
2675 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2675 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2676 6: t1+4
2676 6: t1+4
2677 5: t1+3
2677 5: t1+3
2678 4: t1+2
2678 4: t1+2
2679 3: t1+1
2679 3: t1+1
2680 2: t1+1
2680 2: t1+1
2681 1: t1+0
2681 1: t1+0
2682 0: null+1
2682 0: null+1
2683
2683
2684 One ancestor tag: more recent wins:
2684 One ancestor tag: more recent wins:
2685
2685
2686 $ hg tag -r 2 -m t2 -d '7 0' t2
2686 $ hg tag -r 2 -m t2 -d '7 0' t2
2687 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2687 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2688 7: t2+3
2688 7: t2+3
2689 6: t2+2
2689 6: t2+2
2690 5: t2+1
2690 5: t2+1
2691 4: t1+2
2691 4: t1+2
2692 3: t1+1
2692 3: t1+1
2693 2: t2+0
2693 2: t2+0
2694 1: t1+0
2694 1: t1+0
2695 0: null+1
2695 0: null+1
2696
2696
2697 Two branch tags: more recent wins:
2697 Two branch tags: more recent wins:
2698
2698
2699 $ hg tag -r 3 -m t3 -d '8 0' t3
2699 $ hg tag -r 3 -m t3 -d '8 0' t3
2700 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2700 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2701 8: t3+5
2701 8: t3+5
2702 7: t3+4
2702 7: t3+4
2703 6: t3+3
2703 6: t3+3
2704 5: t3+2
2704 5: t3+2
2705 4: t3+1
2705 4: t3+1
2706 3: t3+0
2706 3: t3+0
2707 2: t2+0
2707 2: t2+0
2708 1: t1+0
2708 1: t1+0
2709 0: null+1
2709 0: null+1
2710
2710
2711 Merged tag overrides:
2711 Merged tag overrides:
2712
2712
2713 $ hg tag -r 5 -m t5 -d '9 0' t5
2713 $ hg tag -r 5 -m t5 -d '9 0' t5
2714 $ hg tag -r 3 -m at3 -d '10 0' at3
2714 $ hg tag -r 3 -m at3 -d '10 0' at3
2715 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2715 $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
2716 10: t5+5
2716 10: t5+5
2717 9: t5+4
2717 9: t5+4
2718 8: t5+3
2718 8: t5+3
2719 7: t5+2
2719 7: t5+2
2720 6: t5+1
2720 6: t5+1
2721 5: t5+0
2721 5: t5+0
2722 4: at3:t3+1
2722 4: at3:t3+1
2723 3: at3:t3+0
2723 3: at3:t3+0
2724 2: t2+0
2724 2: t2+0
2725 1: t1+0
2725 1: t1+0
2726 0: null+1
2726 0: null+1
2727
2727
2728 $ hg log --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
2728 $ hg log --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
2729 10: t5+5,5
2729 10: t5+5,5
2730 9: t5+4,4
2730 9: t5+4,4
2731 8: t5+3,3
2731 8: t5+3,3
2732 7: t5+2,2
2732 7: t5+2,2
2733 6: t5+1,1
2733 6: t5+1,1
2734 5: t5+0,0
2734 5: t5+0,0
2735 4: at3+1,1 t3+1,1
2735 4: at3+1,1 t3+1,1
2736 3: at3+0,0 t3+0,0
2736 3: at3+0,0 t3+0,0
2737 2: t2+0,0
2737 2: t2+0,0
2738 1: t1+0,0
2738 1: t1+0,0
2739 0: null+1,1
2739 0: null+1,1
2740
2740
2741 $ hg log --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
2741 $ hg log --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
2742 10: t3, C: 8, D: 7
2742 10: t3, C: 8, D: 7
2743 9: t3, C: 7, D: 6
2743 9: t3, C: 7, D: 6
2744 8: t3, C: 6, D: 5
2744 8: t3, C: 6, D: 5
2745 7: t3, C: 5, D: 4
2745 7: t3, C: 5, D: 4
2746 6: t3, C: 4, D: 3
2746 6: t3, C: 4, D: 3
2747 5: t3, C: 3, D: 2
2747 5: t3, C: 3, D: 2
2748 4: t3, C: 1, D: 1
2748 4: t3, C: 1, D: 1
2749 3: t3, C: 0, D: 0
2749 3: t3, C: 0, D: 0
2750 2: t1, C: 1, D: 1
2750 2: t1, C: 1, D: 1
2751 1: t1, C: 0, D: 0
2751 1: t1, C: 0, D: 0
2752 0: null, C: 1, D: 1
2752 0: null, C: 1, D: 1
2753
2753
2754 $ cd ..
2754 $ cd ..
2755
2755
2756
2756
2757 Style path expansion: issue1948 - ui.style option doesn't work on OSX
2757 Style path expansion: issue1948 - ui.style option doesn't work on OSX
2758 if it is a relative path
2758 if it is a relative path
2759
2759
2760 $ mkdir -p home/styles
2760 $ mkdir -p home/styles
2761
2761
2762 $ cat > home/styles/teststyle <<EOF
2762 $ cat > home/styles/teststyle <<EOF
2763 > changeset = 'test {rev}:{node|short}\n'
2763 > changeset = 'test {rev}:{node|short}\n'
2764 > EOF
2764 > EOF
2765
2765
2766 $ HOME=`pwd`/home; export HOME
2766 $ HOME=`pwd`/home; export HOME
2767
2767
2768 $ cat > latesttag/.hg/hgrc <<EOF
2768 $ cat > latesttag/.hg/hgrc <<EOF
2769 > [ui]
2769 > [ui]
2770 > style = ~/styles/teststyle
2770 > style = ~/styles/teststyle
2771 > EOF
2771 > EOF
2772
2772
2773 $ hg -R latesttag tip
2773 $ hg -R latesttag tip
2774 test 10:9b4a630e5f5f
2774 test 10:9b4a630e5f5f
2775
2775
2776 Test recursive showlist template (issue1989):
2776 Test recursive showlist template (issue1989):
2777
2777
2778 $ cat > style1989 <<EOF
2778 $ cat > style1989 <<EOF
2779 > changeset = '{file_mods}{manifest}{extras}'
2779 > changeset = '{file_mods}{manifest}{extras}'
2780 > file_mod = 'M|{author|person}\n'
2780 > file_mod = 'M|{author|person}\n'
2781 > manifest = '{rev},{author}\n'
2781 > manifest = '{rev},{author}\n'
2782 > extra = '{key}: {author}\n'
2782 > extra = '{key}: {author}\n'
2783 > EOF
2783 > EOF
2784
2784
2785 $ hg -R latesttag log -r tip --style=style1989
2785 $ hg -R latesttag log -r tip --style=style1989
2786 M|test
2786 M|test
2787 10,test
2787 10,test
2788 branch: test
2788 branch: test
2789
2789
2790 Test new-style inline templating:
2790 Test new-style inline templating:
2791
2791
2792 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
2792 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
2793 modified files: .hgtags
2793 modified files: .hgtags
2794
2794
2795
2795
2796 $ hg log -R latesttag -r tip -T '{rev % "a"}\n'
2796 $ hg log -R latesttag -r tip -T '{rev % "a"}\n'
2797 hg: parse error: keyword 'rev' is not iterable
2797 hg: parse error: keyword 'rev' is not iterable
2798 [255]
2798 [255]
2799 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n'
2799 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n'
2800 hg: parse error: None is not iterable
2800 hg: parse error: None is not iterable
2801 [255]
2801 [255]
2802
2802
2803 Test the sub function of templating for expansion:
2803 Test the sub function of templating for expansion:
2804
2804
2805 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n'
2805 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n'
2806 xx
2806 xx
2807
2807
2808 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n'
2808 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n'
2809 hg: parse error: sub got an invalid pattern: [
2809 hg: parse error: sub got an invalid pattern: [
2810 [255]
2810 [255]
2811 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n'
2811 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n'
2812 hg: parse error: sub got an invalid replacement: \1
2812 hg: parse error: sub got an invalid replacement: \1
2813 [255]
2813 [255]
2814
2814
2815 Test the strip function with chars specified:
2815 Test the strip function with chars specified:
2816
2816
2817 $ hg log -R latesttag --template '{desc}\n'
2817 $ hg log -R latesttag --template '{desc}\n'
2818 at3
2818 at3
2819 t5
2819 t5
2820 t3
2820 t3
2821 t2
2821 t2
2822 t1
2822 t1
2823 merge
2823 merge
2824 h2e
2824 h2e
2825 h2d
2825 h2d
2826 h1c
2826 h1c
2827 b
2827 b
2828 a
2828 a
2829
2829
2830 $ hg log -R latesttag --template '{strip(desc, "te")}\n'
2830 $ hg log -R latesttag --template '{strip(desc, "te")}\n'
2831 at3
2831 at3
2832 5
2832 5
2833 3
2833 3
2834 2
2834 2
2835 1
2835 1
2836 merg
2836 merg
2837 h2
2837 h2
2838 h2d
2838 h2d
2839 h1c
2839 h1c
2840 b
2840 b
2841 a
2841 a
2842
2842
2843 Test date format:
2843 Test date format:
2844
2844
2845 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
2845 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
2846 date: 70 01 01 10 +0000
2846 date: 70 01 01 10 +0000
2847 date: 70 01 01 09 +0000
2847 date: 70 01 01 09 +0000
2848 date: 70 01 01 08 +0000
2848 date: 70 01 01 08 +0000
2849 date: 70 01 01 07 +0000
2849 date: 70 01 01 07 +0000
2850 date: 70 01 01 06 +0000
2850 date: 70 01 01 06 +0000
2851 date: 70 01 01 05 +0100
2851 date: 70 01 01 05 +0100
2852 date: 70 01 01 04 +0000
2852 date: 70 01 01 04 +0000
2853 date: 70 01 01 03 +0000
2853 date: 70 01 01 03 +0000
2854 date: 70 01 01 02 +0000
2854 date: 70 01 01 02 +0000
2855 date: 70 01 01 01 +0000
2855 date: 70 01 01 01 +0000
2856 date: 70 01 01 00 +0000
2856 date: 70 01 01 00 +0000
2857
2857
2858 Test invalid date:
2858 Test invalid date:
2859
2859
2860 $ hg log -R latesttag -T '{date(rev)}\n'
2860 $ hg log -R latesttag -T '{date(rev)}\n'
2861 hg: parse error: date expects a date information
2861 hg: parse error: date expects a date information
2862 [255]
2862 [255]
2863
2863
2864 Test integer literal:
2864 Test integer literal:
2865
2865
2866 $ hg debugtemplate -v '{(0)}\n'
2866 $ hg debugtemplate -v '{(0)}\n'
2867 (template
2867 (template
2868 (group
2868 (group
2869 ('integer', '0'))
2869 ('integer', '0'))
2870 ('string', '\n'))
2870 ('string', '\n'))
2871 0
2871 0
2872 $ hg debugtemplate -v '{(123)}\n'
2872 $ hg debugtemplate -v '{(123)}\n'
2873 (template
2873 (template
2874 (group
2874 (group
2875 ('integer', '123'))
2875 ('integer', '123'))
2876 ('string', '\n'))
2876 ('string', '\n'))
2877 123
2877 123
2878 $ hg debugtemplate -v '{(-4)}\n'
2878 $ hg debugtemplate -v '{(-4)}\n'
2879 (template
2879 (template
2880 (group
2880 (group
2881 ('integer', '-4'))
2881 ('integer', '-4'))
2882 ('string', '\n'))
2882 ('string', '\n'))
2883 -4
2883 -4
2884 $ hg debugtemplate '{(-)}\n'
2884 $ hg debugtemplate '{(-)}\n'
2885 hg: parse error at 2: integer literal without digits
2885 hg: parse error at 2: integer literal without digits
2886 [255]
2886 [255]
2887 $ hg debugtemplate '{(-a)}\n'
2887 $ hg debugtemplate '{(-a)}\n'
2888 hg: parse error at 2: integer literal without digits
2888 hg: parse error at 2: integer literal without digits
2889 [255]
2889 [255]
2890
2890
2891 top-level integer literal is interpreted as symbol (i.e. variable name):
2891 top-level integer literal is interpreted as symbol (i.e. variable name):
2892
2892
2893 $ hg debugtemplate -D 1=one -v '{1}\n'
2893 $ hg debugtemplate -D 1=one -v '{1}\n'
2894 (template
2894 (template
2895 ('integer', '1')
2895 ('integer', '1')
2896 ('string', '\n'))
2896 ('string', '\n'))
2897 one
2897 one
2898 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n'
2898 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n'
2899 (template
2899 (template
2900 (func
2900 (func
2901 ('symbol', 'if')
2901 ('symbol', 'if')
2902 (list
2902 (list
2903 ('string', 't')
2903 ('string', 't')
2904 (template
2904 (template
2905 ('integer', '1'))))
2905 ('integer', '1'))))
2906 ('string', '\n'))
2906 ('string', '\n'))
2907 one
2907 one
2908 $ hg debugtemplate -D 1=one -v '{1|stringify}\n'
2908 $ hg debugtemplate -D 1=one -v '{1|stringify}\n'
2909 (template
2909 (template
2910 (|
2910 (|
2911 ('integer', '1')
2911 ('integer', '1')
2912 ('symbol', 'stringify'))
2912 ('symbol', 'stringify'))
2913 ('string', '\n'))
2913 ('string', '\n'))
2914 one
2914 one
2915
2915
2916 unless explicit symbol is expected:
2916 unless explicit symbol is expected:
2917
2917
2918 $ hg log -Ra -r0 -T '{desc|1}\n'
2918 $ hg log -Ra -r0 -T '{desc|1}\n'
2919 hg: parse error: expected a symbol, got 'integer'
2919 hg: parse error: expected a symbol, got 'integer'
2920 [255]
2920 [255]
2921 $ hg log -Ra -r0 -T '{1()}\n'
2921 $ hg log -Ra -r0 -T '{1()}\n'
2922 hg: parse error: expected a symbol, got 'integer'
2922 hg: parse error: expected a symbol, got 'integer'
2923 [255]
2923 [255]
2924
2924
2925 Test string literal:
2925 Test string literal:
2926
2926
2927 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n'
2927 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n'
2928 (template
2928 (template
2929 ('string', 'string with no template fragment')
2929 ('string', 'string with no template fragment')
2930 ('string', '\n'))
2930 ('string', '\n'))
2931 string with no template fragment
2931 string with no template fragment
2932 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n'
2932 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n'
2933 (template
2933 (template
2934 (template
2934 (template
2935 ('string', 'template: ')
2935 ('string', 'template: ')
2936 ('symbol', 'rev'))
2936 ('symbol', 'rev'))
2937 ('string', '\n'))
2937 ('string', '\n'))
2938 template: 0
2938 template: 0
2939 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n'
2939 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n'
2940 (template
2940 (template
2941 ('string', 'rawstring: {rev}')
2941 ('string', 'rawstring: {rev}')
2942 ('string', '\n'))
2942 ('string', '\n'))
2943 rawstring: {rev}
2943 rawstring: {rev}
2944 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n'
2944 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n'
2945 (template
2945 (template
2946 (%
2946 (%
2947 ('symbol', 'files')
2947 ('symbol', 'files')
2948 ('string', 'rawstring: {file}'))
2948 ('string', 'rawstring: {file}'))
2949 ('string', '\n'))
2949 ('string', '\n'))
2950 rawstring: {file}
2950 rawstring: {file}
2951
2951
2952 Test string escaping:
2952 Test string escaping:
2953
2953
2954 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2954 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2955 >
2955 >
2956 <>\n<[>
2956 <>\n<[>
2957 <>\n<]>
2957 <>\n<]>
2958 <>\n<
2958 <>\n<
2959
2959
2960 $ hg log -R latesttag -r 0 \
2960 $ hg log -R latesttag -r 0 \
2961 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2961 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2962 >
2962 >
2963 <>\n<[>
2963 <>\n<[>
2964 <>\n<]>
2964 <>\n<]>
2965 <>\n<
2965 <>\n<
2966
2966
2967 $ hg log -R latesttag -r 0 -T esc \
2967 $ hg log -R latesttag -r 0 -T esc \
2968 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2968 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2969 >
2969 >
2970 <>\n<[>
2970 <>\n<[>
2971 <>\n<]>
2971 <>\n<]>
2972 <>\n<
2972 <>\n<
2973
2973
2974 $ cat <<'EOF' > esctmpl
2974 $ cat <<'EOF' > esctmpl
2975 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2975 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
2976 > EOF
2976 > EOF
2977 $ hg log -R latesttag -r 0 --style ./esctmpl
2977 $ hg log -R latesttag -r 0 --style ./esctmpl
2978 >
2978 >
2979 <>\n<[>
2979 <>\n<[>
2980 <>\n<]>
2980 <>\n<]>
2981 <>\n<
2981 <>\n<
2982
2982
2983 Test string escaping of quotes:
2983 Test string escaping of quotes:
2984
2984
2985 $ hg log -Ra -r0 -T '{"\""}\n'
2985 $ hg log -Ra -r0 -T '{"\""}\n'
2986 "
2986 "
2987 $ hg log -Ra -r0 -T '{"\\\""}\n'
2987 $ hg log -Ra -r0 -T '{"\\\""}\n'
2988 \"
2988 \"
2989 $ hg log -Ra -r0 -T '{r"\""}\n'
2989 $ hg log -Ra -r0 -T '{r"\""}\n'
2990 \"
2990 \"
2991 $ hg log -Ra -r0 -T '{r"\\\""}\n'
2991 $ hg log -Ra -r0 -T '{r"\\\""}\n'
2992 \\\"
2992 \\\"
2993
2993
2994
2994
2995 $ hg log -Ra -r0 -T '{"\""}\n'
2995 $ hg log -Ra -r0 -T '{"\""}\n'
2996 "
2996 "
2997 $ hg log -Ra -r0 -T '{"\\\""}\n'
2997 $ hg log -Ra -r0 -T '{"\\\""}\n'
2998 \"
2998 \"
2999 $ hg log -Ra -r0 -T '{r"\""}\n'
2999 $ hg log -Ra -r0 -T '{r"\""}\n'
3000 \"
3000 \"
3001 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3001 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3002 \\\"
3002 \\\"
3003
3003
3004 Test exception in quoted template. single backslash before quotation mark is
3004 Test exception in quoted template. single backslash before quotation mark is
3005 stripped before parsing:
3005 stripped before parsing:
3006
3006
3007 $ cat <<'EOF' > escquotetmpl
3007 $ cat <<'EOF' > escquotetmpl
3008 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n"
3008 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n"
3009 > EOF
3009 > EOF
3010 $ cd latesttag
3010 $ cd latesttag
3011 $ hg log -r 2 --style ../escquotetmpl
3011 $ hg log -r 2 --style ../escquotetmpl
3012 " \" \" \\" head1
3012 " \" \" \\" head1
3013
3013
3014 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
3014 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
3015 valid
3015 valid
3016 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
3016 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
3017 valid
3017 valid
3018
3018
3019 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
3019 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
3020 _evalifliteral() templates (issue4733):
3020 _evalifliteral() templates (issue4733):
3021
3021
3022 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
3022 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
3023 "2
3023 "2
3024 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
3024 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
3025 "2
3025 "2
3026 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
3026 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
3027 "2
3027 "2
3028
3028
3029 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
3029 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
3030 \"
3030 \"
3031 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
3031 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
3032 \"
3032 \"
3033 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3033 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3034 \"
3034 \"
3035
3035
3036 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
3036 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
3037 \\\"
3037 \\\"
3038 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
3038 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
3039 \\\"
3039 \\\"
3040 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3040 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3041 \\\"
3041 \\\"
3042
3042
3043 escaped single quotes and errors:
3043 escaped single quotes and errors:
3044
3044
3045 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
3045 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
3046 foo
3046 foo
3047 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
3047 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
3048 foo
3048 foo
3049 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
3049 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
3050 hg: parse error at 21: unterminated string
3050 hg: parse error at 21: unterminated string
3051 [255]
3051 [255]
3052 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
3052 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
3053 hg: parse error: trailing \ in string
3053 hg: parse error: trailing \ in string
3054 [255]
3054 [255]
3055 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
3055 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
3056 hg: parse error: trailing \ in string
3056 hg: parse error: trailing \ in string
3057 [255]
3057 [255]
3058
3058
3059 $ cd ..
3059 $ cd ..
3060
3060
3061 Test leading backslashes:
3061 Test leading backslashes:
3062
3062
3063 $ cd latesttag
3063 $ cd latesttag
3064 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n'
3064 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n'
3065 {rev} {file}
3065 {rev} {file}
3066 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n'
3066 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n'
3067 \2 \head1
3067 \2 \head1
3068 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n'
3068 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n'
3069 \{rev} \{file}
3069 \{rev} \{file}
3070 $ cd ..
3070 $ cd ..
3071
3071
3072 Test leading backslashes in "if" expression (issue4714):
3072 Test leading backslashes in "if" expression (issue4714):
3073
3073
3074 $ cd latesttag
3074 $ cd latesttag
3075 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
3075 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
3076 {rev} \{rev}
3076 {rev} \{rev}
3077 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
3077 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
3078 \2 \\{rev}
3078 \2 \\{rev}
3079 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
3079 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
3080 \{rev} \\\{rev}
3080 \{rev} \\\{rev}
3081 $ cd ..
3081 $ cd ..
3082
3082
3083 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
3083 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
3084
3084
3085 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'
3085 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'
3086 \x6e
3086 \x6e
3087 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n'
3087 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n'
3088 \x5c\x786e
3088 \x5c\x786e
3089 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n'
3089 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n'
3090 \x6e
3090 \x6e
3091 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n'
3091 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n'
3092 \x5c\x786e
3092 \x5c\x786e
3093
3093
3094 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n'
3094 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n'
3095 \x6e
3095 \x6e
3096 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n'
3096 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n'
3097 \x5c\x786e
3097 \x5c\x786e
3098 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n'
3098 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n'
3099 \x6e
3099 \x6e
3100 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n'
3100 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n'
3101 \x5c\x786e
3101 \x5c\x786e
3102
3102
3103 $ hg log -R a -r 8 --template '{join(files, "\n")}\n'
3103 $ hg log -R a -r 8 --template '{join(files, "\n")}\n'
3104 fourth
3104 fourth
3105 second
3105 second
3106 third
3106 third
3107 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n'
3107 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n'
3108 fourth\nsecond\nthird
3108 fourth\nsecond\nthird
3109
3109
3110 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}'
3110 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}'
3111 <p>
3111 <p>
3112 1st
3112 1st
3113 </p>
3113 </p>
3114 <p>
3114 <p>
3115 2nd
3115 2nd
3116 </p>
3116 </p>
3117 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}'
3117 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}'
3118 <p>
3118 <p>
3119 1st\n\n2nd
3119 1st\n\n2nd
3120 </p>
3120 </p>
3121 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}'
3121 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}'
3122 1st
3122 1st
3123
3123
3124 2nd
3124 2nd
3125
3125
3126 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n'
3126 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n'
3127 o perso
3127 o perso
3128 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n'
3128 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n'
3129 no person
3129 no person
3130 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n'
3130 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n'
3131 o perso
3131 o perso
3132 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n'
3132 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n'
3133 no perso
3133 no perso
3134
3134
3135 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n'
3135 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n'
3136 -o perso-
3136 -o perso-
3137 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n'
3137 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n'
3138 no person
3138 no person
3139 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n'
3139 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n'
3140 \x2do perso\x2d
3140 \x2do perso\x2d
3141 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n'
3141 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n'
3142 -o perso-
3142 -o perso-
3143 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n'
3143 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n'
3144 \x2do perso\x6e
3144 \x2do perso\x6e
3145
3145
3146 $ hg log -R a -r 8 --template '{files % "{file}\n"}'
3146 $ hg log -R a -r 8 --template '{files % "{file}\n"}'
3147 fourth
3147 fourth
3148 second
3148 second
3149 third
3149 third
3150
3150
3151 Test string escaping in nested expression:
3151 Test string escaping in nested expression:
3152
3152
3153 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n'
3153 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n'
3154 fourth\x6esecond\x6ethird
3154 fourth\x6esecond\x6ethird
3155 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n'
3155 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n'
3156 fourth\x6esecond\x6ethird
3156 fourth\x6esecond\x6ethird
3157
3157
3158 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n'
3158 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n'
3159 fourth\x6esecond\x6ethird
3159 fourth\x6esecond\x6ethird
3160 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n'
3160 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n'
3161 fourth\x5c\x786esecond\x5c\x786ethird
3161 fourth\x5c\x786esecond\x5c\x786ethird
3162
3162
3163 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n'
3163 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n'
3164 3:\x6eo user, \x6eo domai\x6e
3164 3:\x6eo user, \x6eo domai\x6e
3165 4:\x5c\x786eew bra\x5c\x786ech
3165 4:\x5c\x786eew bra\x5c\x786ech
3166
3166
3167 Test quotes in nested expression are evaluated just like a $(command)
3167 Test quotes in nested expression are evaluated just like a $(command)
3168 substitution in POSIX shells:
3168 substitution in POSIX shells:
3169
3169
3170 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n'
3170 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n'
3171 8:95c24699272e
3171 8:95c24699272e
3172 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n'
3172 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n'
3173 {8} "95c24699272e"
3173 {8} "95c24699272e"
3174
3174
3175 Test recursive evaluation:
3175 Test recursive evaluation:
3176
3176
3177 $ hg init r
3177 $ hg init r
3178 $ cd r
3178 $ cd r
3179 $ echo a > a
3179 $ echo a > a
3180 $ hg ci -Am '{rev}'
3180 $ hg ci -Am '{rev}'
3181 adding a
3181 adding a
3182 $ hg log -r 0 --template '{if(rev, desc)}\n'
3182 $ hg log -r 0 --template '{if(rev, desc)}\n'
3183 {rev}
3183 {rev}
3184 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n'
3184 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n'
3185 test 0
3185 test 0
3186
3186
3187 $ hg branch -q 'text.{rev}'
3187 $ hg branch -q 'text.{rev}'
3188 $ echo aa >> aa
3188 $ echo aa >> aa
3189 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped'
3189 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped'
3190
3190
3191 $ hg log -l1 --template '{fill(desc, "20", author, branch)}'
3191 $ hg log -l1 --template '{fill(desc, "20", author, branch)}'
3192 {node|short}desc to
3192 {node|short}desc to
3193 text.{rev}be wrapped
3193 text.{rev}be wrapped
3194 text.{rev}desc to be
3194 text.{rev}desc to be
3195 text.{rev}wrapped (no-eol)
3195 text.{rev}wrapped (no-eol)
3196 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}'
3196 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}'
3197 bcc7ff960b8e:desc to
3197 bcc7ff960b8e:desc to
3198 text.1:be wrapped
3198 text.1:be wrapped
3199 text.1:desc to be
3199 text.1:desc to be
3200 text.1:wrapped (no-eol)
3200 text.1:wrapped (no-eol)
3201 $ hg log -l1 -T '{fill(desc, date, "", "")}\n'
3201 $ hg log -l1 -T '{fill(desc, date, "", "")}\n'
3202 hg: parse error: fill expects an integer width
3202 hg: parse error: fill expects an integer width
3203 [255]
3203 [255]
3204
3204
3205 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3205 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3206 {node|short} (no-eol)
3206 {node|short} (no-eol)
3207 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3207 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3208 bcc-ff---b-e (no-eol)
3208 bcc-ff---b-e (no-eol)
3209
3209
3210 $ cat >> .hg/hgrc <<EOF
3210 $ cat >> .hg/hgrc <<EOF
3211 > [extensions]
3211 > [extensions]
3212 > color=
3212 > color=
3213 > [color]
3213 > [color]
3214 > mode=ansi
3214 > mode=ansi
3215 > text.{rev} = red
3215 > text.{rev} = red
3216 > text.1 = green
3216 > text.1 = green
3217 > EOF
3217 > EOF
3218 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}'
3218 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}'
3219 \x1b[0;31mtext\x1b[0m (esc)
3219 \x1b[0;31mtext\x1b[0m (esc)
3220 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}'
3220 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}'
3221 \x1b[0;32mtext\x1b[0m (esc)
3221 \x1b[0;32mtext\x1b[0m (esc)
3222
3222
3223 color effect can be specified without quoting:
3223 color effect can be specified without quoting:
3224
3224
3225 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3225 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3226 \x1b[0;31mtext\x1b[0m (esc)
3226 \x1b[0;31mtext\x1b[0m (esc)
3227
3227
3228 label should be no-op if color is disabled:
3228 label should be no-op if color is disabled:
3229
3229
3230 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3230 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3231 text
3231 text
3232 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'
3232 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'
3233 text
3233 text
3234
3234
3235 Test branches inside if statement:
3235 Test branches inside if statement:
3236
3236
3237 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n'
3237 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n'
3238 no
3238 no
3239
3239
3240 Test get function:
3240 Test get function:
3241
3241
3242 $ hg log -r 0 --template '{get(extras, "branch")}\n'
3242 $ hg log -r 0 --template '{get(extras, "branch")}\n'
3243 default
3243 default
3244 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n'
3244 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n'
3245 default
3245 default
3246 $ hg log -r 0 --template '{get(files, "should_fail")}\n'
3246 $ hg log -r 0 --template '{get(files, "should_fail")}\n'
3247 hg: parse error: get() expects a dict as first argument
3247 hg: parse error: get() expects a dict as first argument
3248 [255]
3248 [255]
3249
3249
3250 Test localdate(date, tz) function:
3250 Test localdate(date, tz) function:
3251
3251
3252 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'
3252 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'
3253 1970-01-01 09:00 +0900
3253 1970-01-01 09:00 +0900
3254 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n'
3254 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n'
3255 1970-01-01 00:00 +0000
3255 1970-01-01 00:00 +0000
3256 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n'
3256 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n'
3257 1970-01-01 02:00 +0200
3257 1970-01-01 02:00 +0200
3258 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n'
3258 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n'
3259 1970-01-01 00:00 +0000
3259 1970-01-01 00:00 +0000
3260 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n'
3260 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n'
3261 1970-01-01 00:00 +0000
3261 1970-01-01 00:00 +0000
3262 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n'
3262 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n'
3263 hg: parse error: localdate expects a timezone
3263 hg: parse error: localdate expects a timezone
3264 [255]
3264 [255]
3265 $ hg log -r0 -T '{localdate(date, date)|isodate}\n'
3265 $ hg log -r0 -T '{localdate(date, date)|isodate}\n'
3266 hg: parse error: localdate expects a timezone
3266 hg: parse error: localdate expects a timezone
3267 [255]
3267 [255]
3268
3268
3269 Test shortest(node) function:
3269 Test shortest(node) function:
3270
3270
3271 $ echo b > b
3271 $ echo b > b
3272 $ hg ci -qAm b
3272 $ hg ci -qAm b
3273 $ hg log --template '{shortest(node)}\n'
3273 $ hg log --template '{shortest(node)}\n'
3274 e777
3274 e777
3275 bcc7
3275 bcc7
3276 f776
3276 f776
3277 $ hg log --template '{shortest(node, 10)}\n'
3277 $ hg log --template '{shortest(node, 10)}\n'
3278 e777603221
3278 e777603221
3279 bcc7ff960b
3279 bcc7ff960b
3280 f7769ec2ab
3280 f7769ec2ab
3281 $ hg log --template '{node|shortest}\n' -l1
3281 $ hg log --template '{node|shortest}\n' -l1
3282 e777
3282 e777
3283
3283
3284 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
3284 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
3285 f7769ec2ab
3285 f7769ec2ab
3286 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
3286 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
3287 hg: parse error: shortest() expects an integer minlength
3287 hg: parse error: shortest() expects an integer minlength
3288 [255]
3288 [255]
3289
3289
3290 Test pad function
3290 Test pad function
3291
3291
3292 $ hg log --template '{pad(rev, 20)} {author|user}\n'
3292 $ hg log --template '{pad(rev, 20)} {author|user}\n'
3293 2 test
3293 2 test
3294 1 {node|short}
3294 1 {node|short}
3295 0 test
3295 0 test
3296
3296
3297 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n'
3297 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n'
3298 2 test
3298 2 test
3299 1 {node|short}
3299 1 {node|short}
3300 0 test
3300 0 test
3301
3301
3302 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n'
3302 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n'
3303 2------------------- test
3303 2------------------- test
3304 1------------------- {node|short}
3304 1------------------- {node|short}
3305 0------------------- test
3305 0------------------- test
3306
3306
3307 Test template string in pad function
3307 Test template string in pad function
3308
3308
3309 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
3309 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
3310 {0} test
3310 {0} test
3311
3311
3312 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
3312 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
3313 \{rev} test
3313 \{rev} test
3314
3314
3315 Test width argument passed to pad function
3315 Test width argument passed to pad function
3316
3316
3317 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n'
3317 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n'
3318 0 test
3318 0 test
3319 $ hg log -r 0 -T '{pad(rev, "not an int")}\n'
3319 $ hg log -r 0 -T '{pad(rev, "not an int")}\n'
3320 hg: parse error: pad() expects an integer width
3320 hg: parse error: pad() expects an integer width
3321 [255]
3321 [255]
3322
3322
3323 Test ifcontains function
3323 Test ifcontains function
3324
3324
3325 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
3325 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
3326 2 is in the string
3326 2 is in the string
3327 1 is not
3327 1 is not
3328 0 is in the string
3328 0 is in the string
3329
3329
3330 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n'
3330 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n'
3331 2 is in the string
3331 2 is in the string
3332 1 is not
3332 1 is not
3333 0 is in the string
3333 0 is in the string
3334
3334
3335 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n'
3335 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n'
3336 2 did not add a
3336 2 did not add a
3337 1 did not add a
3337 1 did not add a
3338 0 added a
3338 0 added a
3339
3339
3340 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n'
3340 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n'
3341 2 is parent of 1
3341 2 is parent of 1
3342 1
3342 1
3343 0
3343 0
3344
3344
3345 Test revset function
3345 Test revset function
3346
3346
3347 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'
3347 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'
3348 2 current rev
3348 2 current rev
3349 1 not current rev
3349 1 not current rev
3350 0 not current rev
3350 0 not current rev
3351
3351
3352 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
3352 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
3353 2 match rev
3353 2 match rev
3354 1 match rev
3354 1 match rev
3355 0 not match rev
3355 0 not match rev
3356
3356
3357 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
3357 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
3358 2 Parents: 1
3358 2 Parents: 1
3359 1 Parents: 0
3359 1 Parents: 0
3360 0 Parents:
3360 0 Parents:
3361
3361
3362 $ cat >> .hg/hgrc <<EOF
3362 $ cat >> .hg/hgrc <<EOF
3363 > [revsetalias]
3363 > [revsetalias]
3364 > myparents(\$1) = parents(\$1)
3364 > myparents(\$1) = parents(\$1)
3365 > EOF
3365 > EOF
3366 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n'
3366 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n'
3367 2 Parents: 1
3367 2 Parents: 1
3368 1 Parents: 0
3368 1 Parents: 0
3369 0 Parents:
3369 0 Parents:
3370
3370
3371 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n'
3371 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n'
3372 Rev: 2
3372 Rev: 2
3373 Ancestor: 0
3373 Ancestor: 0
3374 Ancestor: 1
3374 Ancestor: 1
3375 Ancestor: 2
3375 Ancestor: 2
3376
3376
3377 Rev: 1
3377 Rev: 1
3378 Ancestor: 0
3378 Ancestor: 0
3379 Ancestor: 1
3379 Ancestor: 1
3380
3380
3381 Rev: 0
3381 Rev: 0
3382 Ancestor: 0
3382 Ancestor: 0
3383
3383
3384 $ hg log --template '{revset("TIP"|lower)}\n' -l1
3384 $ hg log --template '{revset("TIP"|lower)}\n' -l1
3385 2
3385 2
3386
3386
3387 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1
3387 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1
3388 2
3388 2
3389
3389
3390 a list template is evaluated for each item of revset/parents
3390 a list template is evaluated for each item of revset/parents
3391
3391
3392 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'
3392 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'
3393 2 p: 1:bcc7ff960b8e
3393 2 p: 1:bcc7ff960b8e
3394 1 p: 0:f7769ec2ab97
3394 1 p: 0:f7769ec2ab97
3395 0 p:
3395 0 p:
3396
3396
3397 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n'
3397 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n'
3398 2 p: 1:bcc7ff960b8e -1:000000000000
3398 2 p: 1:bcc7ff960b8e -1:000000000000
3399 1 p: 0:f7769ec2ab97 -1:000000000000
3399 1 p: 0:f7769ec2ab97 -1:000000000000
3400 0 p: -1:000000000000 -1:000000000000
3400 0 p: -1:000000000000 -1:000000000000
3401
3401
3402 therefore, 'revcache' should be recreated for each rev
3402 therefore, 'revcache' should be recreated for each rev
3403
3403
3404 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n'
3404 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n'
3405 2 aa b
3405 2 aa b
3406 p
3406 p
3407 1
3407 1
3408 p a
3408 p a
3409 0 a
3409 0 a
3410 p
3410 p
3411
3411
3412 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n'
3412 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n'
3413 2 aa b
3413 2 aa b
3414 p
3414 p
3415 1
3415 1
3416 p a
3416 p a
3417 0 a
3417 0 a
3418 p
3418 p
3419
3419
3420 a revset item must be evaluated as an integer revision, not an offset from tip
3420 a revset item must be evaluated as an integer revision, not an offset from tip
3421
3421
3422 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n'
3422 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n'
3423 -1:000000000000
3423 -1:000000000000
3424 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
3424 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
3425 -1:000000000000
3425 -1:000000000000
3426
3426
3427 Test active bookmark templating
3427 Test active bookmark templating
3428
3428
3429 $ hg book foo
3429 $ hg book foo
3430 $ hg book bar
3430 $ hg book bar
3431 $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
3431 $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
3432 2 bar* foo
3432 2 bar* foo
3433 1
3433 1
3434 0
3434 0
3435 $ hg log --template "{rev} {activebookmark}\n"
3435 $ hg log --template "{rev} {activebookmark}\n"
3436 2 bar
3436 2 bar
3437 1
3437 1
3438 0
3438 0
3439 $ hg bookmarks --inactive bar
3439 $ hg bookmarks --inactive bar
3440 $ hg log --template "{rev} {activebookmark}\n"
3440 $ hg log --template "{rev} {activebookmark}\n"
3441 2
3441 2
3442 1
3442 1
3443 0
3443 0
3444 $ hg book -r1 baz
3444 $ hg book -r1 baz
3445 $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
3445 $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
3446 2 bar foo
3446 2 bar foo
3447 1 baz
3447 1 baz
3448 0
3448 0
3449 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
3449 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
3450 2 t
3450 2 t
3451 1 f
3451 1 f
3452 0 f
3452 0 f
3453
3453
3454 Test namespaces dict
3454 Test namespaces dict
3455
3455
3456 $ hg log -T '{rev}{namespaces % " {namespace}={join(names, ",")}"}\n'
3456 $ hg log -T '{rev}{namespaces % " {namespace}={join(names, ",")}"}\n'
3457 2 bookmarks=bar,foo tags=tip branches=text.{rev}
3457 2 bookmarks=bar,foo tags=tip branches=text.{rev}
3458 1 bookmarks=baz tags= branches=text.{rev}
3458 1 bookmarks=baz tags= branches=text.{rev}
3459 0 bookmarks= tags= branches=default
3459 0 bookmarks= tags= branches=default
3460 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
3460 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
3461 bookmarks: bar foo
3461 bookmarks: bar foo
3462 tags: tip
3462 tags: tip
3463 branches: text.{rev}
3463 branches: text.{rev}
3464 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
3464 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
3465 bookmarks:
3465 bookmarks:
3466 bar
3466 bar
3467 foo
3467 foo
3468 tags:
3468 tags:
3469 tip
3469 tip
3470 branches:
3470 branches:
3471 text.{rev}
3471 text.{rev}
3472 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
3472 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
3473 bar
3473 bar
3474 foo
3474 foo
3475
3475
3476 Test stringify on sub expressions
3476 Test stringify on sub expressions
3477
3477
3478 $ cd ..
3478 $ cd ..
3479 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
3479 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
3480 fourth, second, third
3480 fourth, second, third
3481 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n'
3481 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n'
3482 abc
3482 abc
3483
3483
3484 Test splitlines
3484 Test splitlines
3485
3485
3486 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
3486 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
3487 @ foo Modify, add, remove, rename
3487 @ foo Modify, add, remove, rename
3488 |
3488 |
3489 o foo future
3489 o foo future
3490 |
3490 |
3491 o foo third
3491 o foo third
3492 |
3492 |
3493 o foo second
3493 o foo second
3494
3494
3495 o foo merge
3495 o foo merge
3496 |\
3496 |\
3497 | o foo new head
3497 | o foo new head
3498 | |
3498 | |
3499 o | foo new branch
3499 o | foo new branch
3500 |/
3500 |/
3501 o foo no user, no domain
3501 o foo no user, no domain
3502 |
3502 |
3503 o foo no person
3503 o foo no person
3504 |
3504 |
3505 o foo other 1
3505 o foo other 1
3506 | foo other 2
3506 | foo other 2
3507 | foo
3507 | foo
3508 | foo other 3
3508 | foo other 3
3509 o foo line 1
3509 o foo line 1
3510 foo line 2
3510 foo line 2
3511
3511
3512 Test startswith
3512 Test startswith
3513 $ hg log -Gv -R a --template "{startswith(desc)}"
3513 $ hg log -Gv -R a --template "{startswith(desc)}"
3514 hg: parse error: startswith expects two arguments
3514 hg: parse error: startswith expects two arguments
3515 [255]
3515 [255]
3516
3516
3517 $ hg log -Gv -R a --template "{startswith('line', desc)}"
3517 $ hg log -Gv -R a --template "{startswith('line', desc)}"
3518 @
3518 @
3519 |
3519 |
3520 o
3520 o
3521 |
3521 |
3522 o
3522 o
3523 |
3523 |
3524 o
3524 o
3525
3525
3526 o
3526 o
3527 |\
3527 |\
3528 | o
3528 | o
3529 | |
3529 | |
3530 o |
3530 o |
3531 |/
3531 |/
3532 o
3532 o
3533 |
3533 |
3534 o
3534 o
3535 |
3535 |
3536 o
3536 o
3537 |
3537 |
3538 o line 1
3538 o line 1
3539 line 2
3539 line 2
3540
3540
3541 Test bad template with better error message
3541 Test bad template with better error message
3542
3542
3543 $ hg log -Gv -R a --template '{desc|user()}'
3543 $ hg log -Gv -R a --template '{desc|user()}'
3544 hg: parse error: expected a symbol, got 'func'
3544 hg: parse error: expected a symbol, got 'func'
3545 [255]
3545 [255]
3546
3546
3547 Test word function (including index out of bounds graceful failure)
3547 Test word function (including index out of bounds graceful failure)
3548
3548
3549 $ hg log -Gv -R a --template "{word('1', desc)}"
3549 $ hg log -Gv -R a --template "{word('1', desc)}"
3550 @ add,
3550 @ add,
3551 |
3551 |
3552 o
3552 o
3553 |
3553 |
3554 o
3554 o
3555 |
3555 |
3556 o
3556 o
3557
3557
3558 o
3558 o
3559 |\
3559 |\
3560 | o head
3560 | o head
3561 | |
3561 | |
3562 o | branch
3562 o | branch
3563 |/
3563 |/
3564 o user,
3564 o user,
3565 |
3565 |
3566 o person
3566 o person
3567 |
3567 |
3568 o 1
3568 o 1
3569 |
3569 |
3570 o 1
3570 o 1
3571
3571
3572
3572
3573 Test word third parameter used as splitter
3573 Test word third parameter used as splitter
3574
3574
3575 $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
3575 $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
3576 @ M
3576 @ M
3577 |
3577 |
3578 o future
3578 o future
3579 |
3579 |
3580 o third
3580 o third
3581 |
3581 |
3582 o sec
3582 o sec
3583
3583
3584 o merge
3584 o merge
3585 |\
3585 |\
3586 | o new head
3586 | o new head
3587 | |
3587 | |
3588 o | new branch
3588 o | new branch
3589 |/
3589 |/
3590 o n
3590 o n
3591 |
3591 |
3592 o n
3592 o n
3593 |
3593 |
3594 o
3594 o
3595 |
3595 |
3596 o line 1
3596 o line 1
3597 line 2
3597 line 2
3598
3598
3599 Test word error messages for not enough and too many arguments
3599 Test word error messages for not enough and too many arguments
3600
3600
3601 $ hg log -Gv -R a --template "{word('0')}"
3601 $ hg log -Gv -R a --template "{word('0')}"
3602 hg: parse error: word expects two or three arguments, got 1
3602 hg: parse error: word expects two or three arguments, got 1
3603 [255]
3603 [255]
3604
3604
3605 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
3605 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
3606 hg: parse error: word expects two or three arguments, got 7
3606 hg: parse error: word expects two or three arguments, got 7
3607 [255]
3607 [255]
3608
3608
3609 Test word for integer literal
3609 Test word for integer literal
3610
3610
3611 $ hg log -R a --template "{word(2, desc)}\n" -r0
3611 $ hg log -R a --template "{word(2, desc)}\n" -r0
3612 line
3612 line
3613
3613
3614 Test word for invalid numbers
3614 Test word for invalid numbers
3615
3615
3616 $ hg log -Gv -R a --template "{word('a', desc)}"
3616 $ hg log -Gv -R a --template "{word('a', desc)}"
3617 hg: parse error: word expects an integer index
3617 hg: parse error: word expects an integer index
3618 [255]
3618 [255]
3619
3619
3620 Test word for out of range
3620 Test word for out of range
3621
3621
3622 $ hg log -R a --template "{word(10000, desc)}"
3622 $ hg log -R a --template "{word(10000, desc)}"
3623 $ hg log -R a --template "{word(-10000, desc)}"
3623 $ hg log -R a --template "{word(-10000, desc)}"
3624
3624
3625 Test indent and not adding to empty lines
3625 Test indent and not adding to empty lines
3626
3626
3627 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a
3627 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a
3628 -----
3628 -----
3629 > line 1
3629 > line 1
3630 >> line 2
3630 >> line 2
3631 -----
3631 -----
3632 > other 1
3632 > other 1
3633 >> other 2
3633 >> other 2
3634
3634
3635 >> other 3
3635 >> other 3
3636
3636
3637 Test with non-strings like dates
3637 Test with non-strings like dates
3638
3638
3639 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a
3639 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a
3640 1200000.00
3640 1200000.00
3641 1300000.00
3641 1300000.00
3642
3642
3643 Test broken string escapes:
3643 Test broken string escapes:
3644
3644
3645 $ hg log -T "bogus\\" -R a
3645 $ hg log -T "bogus\\" -R a
3646 hg: parse error: trailing \ in string
3646 hg: parse error: trailing \ in string
3647 [255]
3647 [255]
3648 $ hg log -T "\\xy" -R a
3648 $ hg log -T "\\xy" -R a
3649 hg: parse error: invalid \x escape
3649 hg: parse error: invalid \x escape
3650 [255]
3650 [255]
3651
3651
3652 json filter should escape HTML tags so that the output can be embedded in hgweb:
3652 json filter should escape HTML tags so that the output can be embedded in hgweb:
3653
3653
3654 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1
3654 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1
3655 "\u003cfoo@example.org\u003e"
3655 "\u003cfoo@example.org\u003e"
3656
3656
3657 Templater supports aliases of symbol and func() styles:
3657 Templater supports aliases of symbol and func() styles:
3658
3658
3659 $ hg clone -q a aliases
3659 $ hg clone -q a aliases
3660 $ cd aliases
3660 $ cd aliases
3661 $ cat <<EOF >> .hg/hgrc
3661 $ cat <<EOF >> .hg/hgrc
3662 > [templatealias]
3662 > [templatealias]
3663 > r = rev
3663 > r = rev
3664 > rn = "{r}:{node|short}"
3664 > rn = "{r}:{node|short}"
3665 > status(c, files) = files % "{c} {file}\n"
3665 > status(c, files) = files % "{c} {file}\n"
3666 > utcdate(d) = localdate(d, "UTC")
3666 > utcdate(d) = localdate(d, "UTC")
3667 > EOF
3667 > EOF
3668
3668
3669 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n'
3669 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n'
3670 (template
3670 (template
3671 ('symbol', 'rn')
3671 ('symbol', 'rn')
3672 ('string', ' ')
3672 ('string', ' ')
3673 (|
3673 (|
3674 (func
3674 (func
3675 ('symbol', 'utcdate')
3675 ('symbol', 'utcdate')
3676 ('symbol', 'date'))
3676 ('symbol', 'date'))
3677 ('symbol', 'isodate'))
3677 ('symbol', 'isodate'))
3678 ('string', '\n'))
3678 ('string', '\n'))
3679 * expanded:
3679 * expanded:
3680 (template
3680 (template
3681 (template
3681 (template
3682 ('symbol', 'rev')
3682 ('symbol', 'rev')
3683 ('string', ':')
3683 ('string', ':')
3684 (|
3684 (|
3685 ('symbol', 'node')
3685 ('symbol', 'node')
3686 ('symbol', 'short')))
3686 ('symbol', 'short')))
3687 ('string', ' ')
3687 ('string', ' ')
3688 (|
3688 (|
3689 (func
3689 (func
3690 ('symbol', 'localdate')
3690 ('symbol', 'localdate')
3691 (list
3691 (list
3692 ('symbol', 'date')
3692 ('symbol', 'date')
3693 ('string', 'UTC')))
3693 ('string', 'UTC')))
3694 ('symbol', 'isodate'))
3694 ('symbol', 'isodate'))
3695 ('string', '\n'))
3695 ('string', '\n'))
3696 hg: parse error: unknown function 'utcdate'
3696 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
3697 [255]
3698
3697
3699 $ hg debugtemplate -vr0 '{status("A", file_adds)}'
3698 $ hg debugtemplate -vr0 '{status("A", file_adds)}'
3700 (template
3699 (template
3701 (func
3700 (func
3702 ('symbol', 'status')
3701 ('symbol', 'status')
3703 (list
3702 (list
3704 ('string', 'A')
3703 ('string', 'A')
3705 ('symbol', 'file_adds'))))
3704 ('symbol', 'file_adds'))))
3706 * expanded:
3705 * expanded:
3707 (template
3706 (template
3708 (%
3707 (%
3709 ('symbol', 'file_adds')
3708 ('symbol', 'file_adds')
3710 (template
3709 (template
3711 ('string', 'A')
3710 ('string', 'A')
3712 ('string', ' ')
3711 ('string', ' ')
3713 ('symbol', 'file')
3712 ('symbol', 'file')
3714 ('string', '\n'))))
3713 ('string', '\n'))))
3715 hg: parse error: unknown function 'status'
3714 A a
3716 [255]
3717
3715
3718 A unary function alias can be called as a filter:
3716 A unary function alias can be called as a filter:
3719
3717
3720 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n'
3718 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n'
3721 (template
3719 (template
3722 (|
3720 (|
3723 (|
3721 (|
3724 ('symbol', 'date')
3722 ('symbol', 'date')
3725 ('symbol', 'utcdate'))
3723 ('symbol', 'utcdate'))
3726 ('symbol', 'isodate'))
3724 ('symbol', 'isodate'))
3727 ('string', '\n'))
3725 ('string', '\n'))
3728 * expanded:
3726 * expanded:
3729 (template
3727 (template
3730 (|
3728 (|
3731 (func
3729 (func
3732 ('symbol', 'localdate')
3730 ('symbol', 'localdate')
3733 (list
3731 (list
3734 ('symbol', 'date')
3732 ('symbol', 'date')
3735 ('string', 'UTC')))
3733 ('string', 'UTC')))
3736 ('symbol', 'isodate'))
3734 ('symbol', 'isodate'))
3737 ('string', '\n'))
3735 ('string', '\n'))
3738 hg: parse error: unknown function 'utcdate'
3736 1970-01-12 13:46 +0000
3739 [255]
3737
3738 Aliases should be applied only to command arguments and templates in hgrc.
3739 Otherwise, our stock styles and web templates could be corrupted:
3740
3741 $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n'
3742 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
3743
3744 $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"'
3745 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
3746
3747 $ cat <<EOF > tmpl
3748 > changeset = 'nothing expanded:{rn}\n'
3749 > EOF
3750 $ hg log -r0 --style ./tmpl
3751 nothing expanded:
3752
3753 Aliases in formatter:
3754
3755 $ hg branches -T '{pad(branch, 7)} {rn}\n'
3756 default 6:d41e714fe50d
3757 foo 4:bbe44766e73d
3740
3758
3741 Unparsable alias:
3759 Unparsable alias:
3742
3760
3743 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
3761 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
3744 (template
3762 (template
3745 ('symbol', 'bad'))
3763 ('symbol', 'bad'))
3746 abort: failed to parse the definition of template alias "bad": at 2: not a prefix: end
3764 abort: failed to parse the definition of template alias "bad": at 2: not a prefix: end
3747 [255]
3765 [255]
3766 $ hg log --config templatealias.bad='x(' -T '{bad}'
3767 abort: failed to parse the definition of template alias "bad": at 2: not a prefix: end
3768 [255]
3748
3769
3749 $ cd ..
3770 $ cd ..
3750
3771
3751 Set up repository for non-ascii encoding tests:
3772 Set up repository for non-ascii encoding tests:
3752
3773
3753 $ hg init nonascii
3774 $ hg init nonascii
3754 $ cd nonascii
3775 $ cd nonascii
3755 $ python <<EOF
3776 $ python <<EOF
3756 > open('latin1', 'w').write('\xe9')
3777 > open('latin1', 'w').write('\xe9')
3757 > open('utf-8', 'w').write('\xc3\xa9')
3778 > open('utf-8', 'w').write('\xc3\xa9')
3758 > EOF
3779 > EOF
3759 $ HGENCODING=utf-8 hg branch -q `cat utf-8`
3780 $ HGENCODING=utf-8 hg branch -q `cat utf-8`
3760 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
3781 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
3761
3782
3762 json filter should try round-trip conversion to utf-8:
3783 json filter should try round-trip conversion to utf-8:
3763
3784
3764 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0
3785 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0
3765 "\u00e9"
3786 "\u00e9"
3766 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0
3787 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0
3767 "non-ascii branch: \u00e9"
3788 "non-ascii branch: \u00e9"
3768
3789
3769 json filter takes input as utf-8b:
3790 json filter takes input as utf-8b:
3770
3791
3771 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1
3792 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1
3772 "\u00e9"
3793 "\u00e9"
3773 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1
3794 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1
3774 "\udce9"
3795 "\udce9"
3775
3796
3776 utf8 filter:
3797 utf8 filter:
3777
3798
3778 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0
3799 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0
3779 round-trip: c3a9
3800 round-trip: c3a9
3780 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1
3801 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1
3781 decoded: c3a9
3802 decoded: c3a9
3782 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1
3803 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1
3783 abort: decoding near * (glob)
3804 abort: decoding near * (glob)
3784 [255]
3805 [255]
3785 $ hg log -T "invalid type: {rev|utf8}\n" -r0
3806 $ hg log -T "invalid type: {rev|utf8}\n" -r0
3786 abort: template filter 'utf8' is not compatible with keyword 'rev'
3807 abort: template filter 'utf8' is not compatible with keyword 'rev'
3787 [255]
3808 [255]
3788
3809
3789 $ cd ..
3810 $ cd ..
3790
3811
3791 Test that template function in extension is registered as expected
3812 Test that template function in extension is registered as expected
3792
3813
3793 $ cd a
3814 $ cd a
3794
3815
3795 $ cat <<EOF > $TESTTMP/customfunc.py
3816 $ cat <<EOF > $TESTTMP/customfunc.py
3796 > from mercurial import registrar
3817 > from mercurial import registrar
3797 >
3818 >
3798 > templatefunc = registrar.templatefunc()
3819 > templatefunc = registrar.templatefunc()
3799 >
3820 >
3800 > @templatefunc('custom()')
3821 > @templatefunc('custom()')
3801 > def custom(context, mapping, args):
3822 > def custom(context, mapping, args):
3802 > return 'custom'
3823 > return 'custom'
3803 > EOF
3824 > EOF
3804 $ cat <<EOF > .hg/hgrc
3825 $ cat <<EOF > .hg/hgrc
3805 > [extensions]
3826 > [extensions]
3806 > customfunc = $TESTTMP/customfunc.py
3827 > customfunc = $TESTTMP/customfunc.py
3807 > EOF
3828 > EOF
3808
3829
3809 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
3830 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
3810 custom
3831 custom
3811
3832
3812 $ cd ..
3833 $ cd ..
@@ -1,54 +1,54 b''
1
1
2 $ cat > engine.py << EOF
2 $ cat > engine.py << EOF
3 >
3 >
4 > from mercurial import templater
4 > from mercurial import templater
5 >
5 >
6 > class mytemplater(object):
6 > class mytemplater(object):
7 > def __init__(self, loader, filters, defaults):
7 > def __init__(self, loader, filters, defaults, aliases):
8 > self.loader = loader
8 > self.loader = loader
9 >
9 >
10 > def process(self, t, map):
10 > def process(self, t, map):
11 > tmpl = self.loader(t)
11 > tmpl = self.loader(t)
12 > for k, v in map.iteritems():
12 > for k, v in map.iteritems():
13 > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache'):
13 > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache'):
14 > continue
14 > continue
15 > if hasattr(v, '__call__'):
15 > if hasattr(v, '__call__'):
16 > v = v(**map)
16 > v = v(**map)
17 > v = templater.stringify(v)
17 > v = templater.stringify(v)
18 > tmpl = tmpl.replace('{{%s}}' % k, v)
18 > tmpl = tmpl.replace('{{%s}}' % k, v)
19 > yield tmpl
19 > yield tmpl
20 >
20 >
21 > templater.engines['my'] = mytemplater
21 > templater.engines['my'] = mytemplater
22 > EOF
22 > EOF
23 $ hg init test
23 $ hg init test
24 $ echo '[extensions]' > test/.hg/hgrc
24 $ echo '[extensions]' > test/.hg/hgrc
25 $ echo "engine = `pwd`/engine.py" >> test/.hg/hgrc
25 $ echo "engine = `pwd`/engine.py" >> test/.hg/hgrc
26 $ cd test
26 $ cd test
27 $ cat > mymap << EOF
27 $ cat > mymap << EOF
28 > changeset = my:changeset.txt
28 > changeset = my:changeset.txt
29 > EOF
29 > EOF
30 $ cat > changeset.txt << EOF
30 $ cat > changeset.txt << EOF
31 > {{rev}} {{node}} {{author}}
31 > {{rev}} {{node}} {{author}}
32 > EOF
32 > EOF
33 $ hg ci -Ama
33 $ hg ci -Ama
34 adding changeset.txt
34 adding changeset.txt
35 adding mymap
35 adding mymap
36 $ hg log --style=./mymap
36 $ hg log --style=./mymap
37 0 97e5f848f0936960273bbf75be6388cd0350a32b test
37 0 97e5f848f0936960273bbf75be6388cd0350a32b test
38
38
39 $ cat > changeset.txt << EOF
39 $ cat > changeset.txt << EOF
40 > {{p1rev}} {{p1node}} {{p2rev}} {{p2node}}
40 > {{p1rev}} {{p1node}} {{p2rev}} {{p2node}}
41 > EOF
41 > EOF
42 $ hg ci -Ama
42 $ hg ci -Ama
43 $ hg log --style=./mymap
43 $ hg log --style=./mymap
44 0 97e5f848f0936960273bbf75be6388cd0350a32b -1 0000000000000000000000000000000000000000
44 0 97e5f848f0936960273bbf75be6388cd0350a32b -1 0000000000000000000000000000000000000000
45 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000
45 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000
46
46
47 invalid engine type:
47 invalid engine type:
48
48
49 $ echo 'changeset = unknown:changeset.txt' > unknownenginemap
49 $ echo 'changeset = unknown:changeset.txt' > unknownenginemap
50 $ hg log --style=./unknownenginemap
50 $ hg log --style=./unknownenginemap
51 abort: invalid template engine: unknown
51 abort: invalid template engine: unknown
52 [255]
52 [255]
53
53
54 $ cd ..
54 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now