Show More
@@ -1,970 +1,974 b'' | |||||
1 | # extensions.py - extension handling for mercurial |
|
1 | # extensions.py - extension handling for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com> |
|
3 | # Copyright 2005-2007 Olivia Mackall <olivia@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 ast |
|
10 | import ast | |
11 | import collections |
|
11 | import collections | |
12 | import functools |
|
12 | import functools | |
13 | import imp |
|
13 | import imp | |
14 | import inspect |
|
14 | import inspect | |
15 | import os |
|
15 | import os | |
16 |
|
16 | |||
17 | from .i18n import ( |
|
17 | from .i18n import ( | |
18 | _, |
|
18 | _, | |
19 | gettext, |
|
19 | gettext, | |
20 | ) |
|
20 | ) | |
21 | from .pycompat import ( |
|
21 | from .pycompat import ( | |
22 | getattr, |
|
22 | getattr, | |
23 | open, |
|
23 | open, | |
24 | setattr, |
|
24 | setattr, | |
25 | ) |
|
25 | ) | |
26 |
|
26 | |||
27 | from . import ( |
|
27 | from . import ( | |
28 | cmdutil, |
|
28 | cmdutil, | |
29 | configitems, |
|
29 | configitems, | |
30 | error, |
|
30 | error, | |
31 | pycompat, |
|
31 | pycompat, | |
32 | util, |
|
32 | util, | |
33 | ) |
|
33 | ) | |
34 |
|
34 | |||
35 | from .utils import stringutil |
|
35 | from .utils import stringutil | |
36 |
|
36 | |||
37 | _extensions = {} |
|
37 | _extensions = {} | |
38 | _disabledextensions = {} |
|
38 | _disabledextensions = {} | |
39 | _aftercallbacks = {} |
|
39 | _aftercallbacks = {} | |
40 | _order = [] |
|
40 | _order = [] | |
41 | _builtin = { |
|
41 | _builtin = { | |
42 | b'hbisect', |
|
42 | b'hbisect', | |
43 | b'bookmarks', |
|
43 | b'bookmarks', | |
44 | b'color', |
|
44 | b'color', | |
45 | b'parentrevspec', |
|
45 | b'parentrevspec', | |
46 | b'progress', |
|
46 | b'progress', | |
47 | b'interhg', |
|
47 | b'interhg', | |
48 | b'inotify', |
|
48 | b'inotify', | |
49 | b'hgcia', |
|
49 | b'hgcia', | |
50 | b'shelve', |
|
50 | b'shelve', | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 |
|
53 | |||
54 | def extensions(ui=None): |
|
54 | def extensions(ui=None): | |
55 | if ui: |
|
55 | if ui: | |
56 |
|
56 | |||
57 | def enabled(name): |
|
57 | def enabled(name): | |
58 | for format in [b'%s', b'hgext.%s']: |
|
58 | for format in [b'%s', b'hgext.%s']: | |
59 | conf = ui.config(b'extensions', format % name) |
|
59 | conf = ui.config(b'extensions', format % name) | |
60 | if conf is not None and not conf.startswith(b'!'): |
|
60 | if conf is not None and not conf.startswith(b'!'): | |
61 | return True |
|
61 | return True | |
62 |
|
62 | |||
63 | else: |
|
63 | else: | |
64 | enabled = lambda name: True |
|
64 | enabled = lambda name: True | |
65 | for name in _order: |
|
65 | for name in _order: | |
66 | module = _extensions[name] |
|
66 | module = _extensions[name] | |
67 | if module and enabled(name): |
|
67 | if module and enabled(name): | |
68 | yield name, module |
|
68 | yield name, module | |
69 |
|
69 | |||
70 |
|
70 | |||
71 | def find(name): |
|
71 | def find(name): | |
72 | '''return module with given extension name''' |
|
72 | '''return module with given extension name''' | |
73 | mod = None |
|
73 | mod = None | |
74 | try: |
|
74 | try: | |
75 | mod = _extensions[name] |
|
75 | mod = _extensions[name] | |
76 | except KeyError: |
|
76 | except KeyError: | |
77 | for k, v in pycompat.iteritems(_extensions): |
|
77 | for k, v in pycompat.iteritems(_extensions): | |
78 | if k.endswith(b'.' + name) or k.endswith(b'/' + name): |
|
78 | if k.endswith(b'.' + name) or k.endswith(b'/' + name): | |
79 | mod = v |
|
79 | mod = v | |
80 | break |
|
80 | break | |
81 | if not mod: |
|
81 | if not mod: | |
82 | raise KeyError(name) |
|
82 | raise KeyError(name) | |
83 | return mod |
|
83 | return mod | |
84 |
|
84 | |||
85 |
|
85 | |||
86 | def loadpath(path, module_name): |
|
86 | def loadpath(path, module_name): | |
87 | module_name = module_name.replace(b'.', b'_') |
|
87 | module_name = module_name.replace(b'.', b'_') | |
88 | path = util.normpath(util.expandpath(path)) |
|
88 | path = util.normpath(util.expandpath(path)) | |
89 | module_name = pycompat.fsdecode(module_name) |
|
89 | module_name = pycompat.fsdecode(module_name) | |
90 | path = pycompat.fsdecode(path) |
|
90 | path = pycompat.fsdecode(path) | |
91 | if os.path.isdir(path): |
|
91 | if os.path.isdir(path): | |
92 | # module/__init__.py style |
|
92 | # module/__init__.py style | |
93 | d, f = os.path.split(path) |
|
93 | d, f = os.path.split(path) | |
94 | fd, fpath, desc = imp.find_module(f, [d]) |
|
94 | fd, fpath, desc = imp.find_module(f, [d]) | |
95 | # When https://github.com/python/typeshed/issues/3466 is fixed |
|
95 | # When https://github.com/python/typeshed/issues/3466 is fixed | |
96 | # and in a pytype release we can drop this disable. |
|
96 | # and in a pytype release we can drop this disable. | |
97 | return imp.load_module( |
|
97 | return imp.load_module( | |
98 | module_name, fd, fpath, desc # pytype: disable=wrong-arg-types |
|
98 | module_name, fd, fpath, desc # pytype: disable=wrong-arg-types | |
99 | ) |
|
99 | ) | |
100 | else: |
|
100 | else: | |
101 | try: |
|
101 | try: | |
102 | return imp.load_source(module_name, path) |
|
102 | return imp.load_source(module_name, path) | |
103 | except IOError as exc: |
|
103 | except IOError as exc: | |
104 | if not exc.filename: |
|
104 | if not exc.filename: | |
105 | exc.filename = path # python does not fill this |
|
105 | exc.filename = path # python does not fill this | |
106 | raise |
|
106 | raise | |
107 |
|
107 | |||
108 |
|
108 | |||
109 | def _importh(name): |
|
109 | def _importh(name): | |
110 | """import and return the <name> module""" |
|
110 | """import and return the <name> module""" | |
111 | mod = __import__(pycompat.sysstr(name)) |
|
111 | mod = __import__(pycompat.sysstr(name)) | |
112 | components = name.split(b'.') |
|
112 | components = name.split(b'.') | |
113 | for comp in components[1:]: |
|
113 | for comp in components[1:]: | |
114 | mod = getattr(mod, comp) |
|
114 | mod = getattr(mod, comp) | |
115 | return mod |
|
115 | return mod | |
116 |
|
116 | |||
117 |
|
117 | |||
118 | def _importext(name, path=None, reportfunc=None): |
|
118 | def _importext(name, path=None, reportfunc=None): | |
119 | if path: |
|
119 | if path: | |
120 | # the module will be loaded in sys.modules |
|
120 | # the module will be loaded in sys.modules | |
121 | # choose an unique name so that it doesn't |
|
121 | # choose an unique name so that it doesn't | |
122 | # conflicts with other modules |
|
122 | # conflicts with other modules | |
123 | mod = loadpath(path, b'hgext.%s' % name) |
|
123 | mod = loadpath(path, b'hgext.%s' % name) | |
124 | else: |
|
124 | else: | |
125 | try: |
|
125 | try: | |
126 | mod = _importh(b"hgext.%s" % name) |
|
126 | mod = _importh(b"hgext.%s" % name) | |
127 | except ImportError as err: |
|
127 | except ImportError as err: | |
128 | if reportfunc: |
|
128 | if reportfunc: | |
129 | reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name) |
|
129 | reportfunc(err, b"hgext.%s" % name, b"hgext3rd.%s" % name) | |
130 | try: |
|
130 | try: | |
131 | mod = _importh(b"hgext3rd.%s" % name) |
|
131 | mod = _importh(b"hgext3rd.%s" % name) | |
132 | except ImportError as err: |
|
132 | except ImportError as err: | |
133 | if reportfunc: |
|
133 | if reportfunc: | |
134 | reportfunc(err, b"hgext3rd.%s" % name, name) |
|
134 | reportfunc(err, b"hgext3rd.%s" % name, name) | |
135 | mod = _importh(name) |
|
135 | mod = _importh(name) | |
136 | return mod |
|
136 | return mod | |
137 |
|
137 | |||
138 |
|
138 | |||
139 | def _reportimporterror(ui, err, failed, next): |
|
139 | def _reportimporterror(ui, err, failed, next): | |
140 | # note: this ui.log happens before --debug is processed, |
|
140 | # note: this ui.log happens before --debug is processed, | |
141 | # Use --config ui.debug=1 to see them. |
|
141 | # Use --config ui.debug=1 to see them. | |
142 | ui.log( |
|
142 | ui.log( | |
143 | b'extension', |
|
143 | b'extension', | |
144 | b' - could not import %s (%s): trying %s\n', |
|
144 | b' - could not import %s (%s): trying %s\n', | |
145 | failed, |
|
145 | failed, | |
146 | stringutil.forcebytestr(err), |
|
146 | stringutil.forcebytestr(err), | |
147 | next, |
|
147 | next, | |
148 | ) |
|
148 | ) | |
149 | if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'): |
|
149 | if ui.debugflag and ui.configbool(b'devel', b'debug.extensions'): | |
150 | ui.traceback() |
|
150 | ui.traceback() | |
151 |
|
151 | |||
152 |
|
152 | |||
153 | def _rejectunicode(name, xs): |
|
153 | def _rejectunicode(name, xs): | |
154 | if isinstance(xs, (list, set, tuple)): |
|
154 | if isinstance(xs, (list, set, tuple)): | |
155 | for x in xs: |
|
155 | for x in xs: | |
156 | _rejectunicode(name, x) |
|
156 | _rejectunicode(name, x) | |
157 | elif isinstance(xs, dict): |
|
157 | elif isinstance(xs, dict): | |
158 | for k, v in xs.items(): |
|
158 | for k, v in xs.items(): | |
159 | _rejectunicode(name, k) |
|
159 | _rejectunicode(name, k) | |
160 | _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v) |
|
160 | _rejectunicode(b'%s.%s' % (name, stringutil.forcebytestr(k)), v) | |
161 | elif isinstance(xs, type(u'')): |
|
161 | elif isinstance(xs, type(u'')): | |
162 | raise error.ProgrammingError( |
|
162 | raise error.ProgrammingError( | |
163 | b"unicode %r found in %s" % (xs, name), |
|
163 | b"unicode %r found in %s" % (xs, name), | |
164 | hint=b"use b'' to make it byte string", |
|
164 | hint=b"use b'' to make it byte string", | |
165 | ) |
|
165 | ) | |
166 |
|
166 | |||
167 |
|
167 | |||
168 | # attributes set by registrar.command |
|
168 | # attributes set by registrar.command | |
169 | _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo') |
|
169 | _cmdfuncattrs = (b'norepo', b'optionalrepo', b'inferrepo') | |
170 |
|
170 | |||
171 |
|
171 | |||
172 | def _validatecmdtable(ui, cmdtable): |
|
172 | def _validatecmdtable(ui, cmdtable): | |
173 | """Check if extension commands have required attributes""" |
|
173 | """Check if extension commands have required attributes""" | |
174 | for c, e in pycompat.iteritems(cmdtable): |
|
174 | for c, e in pycompat.iteritems(cmdtable): | |
175 | f = e[0] |
|
175 | f = e[0] | |
176 | missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)] |
|
176 | missing = [a for a in _cmdfuncattrs if not util.safehasattr(f, a)] | |
177 | if not missing: |
|
177 | if not missing: | |
178 | continue |
|
178 | continue | |
179 | raise error.ProgrammingError( |
|
179 | raise error.ProgrammingError( | |
180 | b'missing attributes: %s' % b', '.join(missing), |
|
180 | b'missing attributes: %s' % b', '.join(missing), | |
181 | hint=b"use @command decorator to register '%s'" % c, |
|
181 | hint=b"use @command decorator to register '%s'" % c, | |
182 | ) |
|
182 | ) | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | def _validatetables(ui, mod): |
|
185 | def _validatetables(ui, mod): | |
186 | """Sanity check for loadable tables provided by extension module""" |
|
186 | """Sanity check for loadable tables provided by extension module""" | |
187 | for t in [b'cmdtable', b'colortable', b'configtable']: |
|
187 | for t in [b'cmdtable', b'colortable', b'configtable']: | |
188 | _rejectunicode(t, getattr(mod, t, {})) |
|
188 | _rejectunicode(t, getattr(mod, t, {})) | |
189 | for t in [ |
|
189 | for t in [ | |
190 | b'filesetpredicate', |
|
190 | b'filesetpredicate', | |
191 | b'internalmerge', |
|
191 | b'internalmerge', | |
192 | b'revsetpredicate', |
|
192 | b'revsetpredicate', | |
193 | b'templatefilter', |
|
193 | b'templatefilter', | |
194 | b'templatefunc', |
|
194 | b'templatefunc', | |
195 | b'templatekeyword', |
|
195 | b'templatekeyword', | |
196 | ]: |
|
196 | ]: | |
197 | o = getattr(mod, t, None) |
|
197 | o = getattr(mod, t, None) | |
198 | if o: |
|
198 | if o: | |
199 | _rejectunicode(t, o._table) |
|
199 | _rejectunicode(t, o._table) | |
200 | _validatecmdtable(ui, getattr(mod, 'cmdtable', {})) |
|
200 | _validatecmdtable(ui, getattr(mod, 'cmdtable', {})) | |
201 |
|
201 | |||
202 |
|
202 | |||
203 | def load(ui, name, path, loadingtime=None): |
|
203 | def load(ui, name, path, loadingtime=None): | |
204 | if name.startswith(b'hgext.') or name.startswith(b'hgext/'): |
|
204 | if name.startswith(b'hgext.') or name.startswith(b'hgext/'): | |
205 | shortname = name[6:] |
|
205 | shortname = name[6:] | |
206 | else: |
|
206 | else: | |
207 | shortname = name |
|
207 | shortname = name | |
208 | if shortname in _builtin: |
|
208 | if shortname in _builtin: | |
209 | return None |
|
209 | return None | |
210 | if shortname in _extensions: |
|
210 | if shortname in _extensions: | |
211 | return _extensions[shortname] |
|
211 | return _extensions[shortname] | |
212 | ui.log(b'extension', b' - loading extension: %s\n', shortname) |
|
212 | ui.log(b'extension', b' - loading extension: %s\n', shortname) | |
213 | _extensions[shortname] = None |
|
213 | _extensions[shortname] = None | |
214 | with util.timedcm('load extension %s', shortname) as stats: |
|
214 | with util.timedcm('load extension %s', shortname) as stats: | |
215 | mod = _importext(name, path, bind(_reportimporterror, ui)) |
|
215 | mod = _importext(name, path, bind(_reportimporterror, ui)) | |
216 | ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats) |
|
216 | ui.log(b'extension', b' > %s extension loaded in %s\n', shortname, stats) | |
217 | if loadingtime is not None: |
|
217 | if loadingtime is not None: | |
218 | loadingtime[shortname] += stats.elapsed |
|
218 | loadingtime[shortname] += stats.elapsed | |
219 |
|
219 | |||
220 | # Before we do anything with the extension, check against minimum stated |
|
220 | # Before we do anything with the extension, check against minimum stated | |
221 | # compatibility. This gives extension authors a mechanism to have their |
|
221 | # compatibility. This gives extension authors a mechanism to have their | |
222 | # extensions short circuit when loaded with a known incompatible version |
|
222 | # extensions short circuit when loaded with a known incompatible version | |
223 | # of Mercurial. |
|
223 | # of Mercurial. | |
224 | minver = getattr(mod, 'minimumhgversion', None) |
|
224 | minver = getattr(mod, 'minimumhgversion', None) | |
225 | if minver: |
|
225 | if minver: | |
226 | curver = util.versiontuple(n=2) |
|
226 | curver = util.versiontuple(n=2) | |
227 | extmin = util.versiontuple(stringutil.forcebytestr(minver), 2) |
|
227 | extmin = util.versiontuple(stringutil.forcebytestr(minver), 2) | |
228 |
|
228 | |||
229 | if None in extmin: |
|
229 | if None in extmin: | |
230 | extmin = (extmin[0] or 0, extmin[1] or 0) |
|
230 | extmin = (extmin[0] or 0, extmin[1] or 0) | |
231 |
|
231 | |||
232 | if None in curver or extmin > curver: |
|
232 | if None in curver or extmin > curver: | |
233 | msg = _( |
|
233 | msg = _( | |
234 | b'(third party extension %s requires version %s or newer ' |
|
234 | b'(third party extension %s requires version %s or newer ' | |
235 | b'of Mercurial (current: %s); disabling)\n' |
|
235 | b'of Mercurial (current: %s); disabling)\n' | |
236 | ) |
|
236 | ) | |
237 | ui.warn(msg % (shortname, minver, util.version())) |
|
237 | ui.warn(msg % (shortname, minver, util.version())) | |
238 | return |
|
238 | return | |
239 | ui.log(b'extension', b' - validating extension tables: %s\n', shortname) |
|
239 | ui.log(b'extension', b' - validating extension tables: %s\n', shortname) | |
240 | _validatetables(ui, mod) |
|
240 | _validatetables(ui, mod) | |
241 |
|
241 | |||
242 | _extensions[shortname] = mod |
|
242 | _extensions[shortname] = mod | |
243 | _order.append(shortname) |
|
243 | _order.append(shortname) | |
244 | ui.log( |
|
244 | ui.log( | |
245 | b'extension', b' - invoking registered callbacks: %s\n', shortname |
|
245 | b'extension', b' - invoking registered callbacks: %s\n', shortname | |
246 | ) |
|
246 | ) | |
247 | with util.timedcm('callbacks extension %s', shortname) as stats: |
|
247 | with util.timedcm('callbacks extension %s', shortname) as stats: | |
248 | for fn in _aftercallbacks.get(shortname, []): |
|
248 | for fn in _aftercallbacks.get(shortname, []): | |
249 | fn(loaded=True) |
|
249 | fn(loaded=True) | |
250 | ui.log(b'extension', b' > callbacks completed in %s\n', stats) |
|
250 | ui.log(b'extension', b' > callbacks completed in %s\n', stats) | |
251 | return mod |
|
251 | return mod | |
252 |
|
252 | |||
253 |
|
253 | |||
254 | def _runuisetup(name, ui): |
|
254 | def _runuisetup(name, ui): | |
255 | uisetup = getattr(_extensions[name], 'uisetup', None) |
|
255 | uisetup = getattr(_extensions[name], 'uisetup', None) | |
256 | if uisetup: |
|
256 | if uisetup: | |
257 | try: |
|
257 | try: | |
258 | uisetup(ui) |
|
258 | uisetup(ui) | |
259 | except Exception as inst: |
|
259 | except Exception as inst: | |
260 | ui.traceback(force=True) |
|
260 | ui.traceback(force=True) | |
261 | msg = stringutil.forcebytestr(inst) |
|
261 | msg = stringutil.forcebytestr(inst) | |
262 | ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg)) |
|
262 | ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg)) | |
263 | return False |
|
263 | return False | |
264 | return True |
|
264 | return True | |
265 |
|
265 | |||
266 |
|
266 | |||
267 | def _runextsetup(name, ui): |
|
267 | def _runextsetup(name, ui): | |
268 | extsetup = getattr(_extensions[name], 'extsetup', None) |
|
268 | extsetup = getattr(_extensions[name], 'extsetup', None) | |
269 | if extsetup: |
|
269 | if extsetup: | |
270 | try: |
|
270 | try: | |
271 | extsetup(ui) |
|
271 | extsetup(ui) | |
272 | except Exception as inst: |
|
272 | except Exception as inst: | |
273 | ui.traceback(force=True) |
|
273 | ui.traceback(force=True) | |
274 | msg = stringutil.forcebytestr(inst) |
|
274 | msg = stringutil.forcebytestr(inst) | |
275 | ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg)) |
|
275 | ui.warn(_(b"*** failed to set up extension %s: %s\n") % (name, msg)) | |
276 | return False |
|
276 | return False | |
277 | return True |
|
277 | return True | |
278 |
|
278 | |||
279 |
|
279 | |||
280 | def loadall(ui, whitelist=None): |
|
280 | def loadall(ui, whitelist=None): | |
281 | loadingtime = collections.defaultdict(int) |
|
281 | loadingtime = collections.defaultdict(int) | |
282 | result = ui.configitems(b"extensions") |
|
282 | result = ui.configitems(b"extensions") | |
283 | if whitelist is not None: |
|
283 | if whitelist is not None: | |
284 | result = [(k, v) for (k, v) in result if k in whitelist] |
|
284 | result = [(k, v) for (k, v) in result if k in whitelist] | |
285 | result = [(k, v) for (k, v) in result if b':' not in k] |
|
285 | result = [(k, v) for (k, v) in result if b':' not in k] | |
286 | newindex = len(_order) |
|
286 | newindex = len(_order) | |
287 | ui.log( |
|
287 | ui.log( | |
288 | b'extension', |
|
288 | b'extension', | |
289 | b'loading %sextensions\n', |
|
289 | b'loading %sextensions\n', | |
290 | b'additional ' if newindex else b'', |
|
290 | b'additional ' if newindex else b'', | |
291 | ) |
|
291 | ) | |
292 | ui.log(b'extension', b'- processing %d entries\n', len(result)) |
|
292 | ui.log(b'extension', b'- processing %d entries\n', len(result)) | |
293 | with util.timedcm('load all extensions') as stats: |
|
293 | with util.timedcm('load all extensions') as stats: | |
|
294 | default_sub_options = ui.configsuboptions(b"extensions", b"*")[1] | |||
|
295 | ||||
294 | for (name, path) in result: |
|
296 | for (name, path) in result: | |
295 | if path: |
|
297 | if path: | |
296 | if path[0:1] == b'!': |
|
298 | if path[0:1] == b'!': | |
297 | if name not in _disabledextensions: |
|
299 | if name not in _disabledextensions: | |
298 | ui.log( |
|
300 | ui.log( | |
299 | b'extension', |
|
301 | b'extension', | |
300 | b' - skipping disabled extension: %s\n', |
|
302 | b' - skipping disabled extension: %s\n', | |
301 | name, |
|
303 | name, | |
302 | ) |
|
304 | ) | |
303 | _disabledextensions[name] = path[1:] |
|
305 | _disabledextensions[name] = path[1:] | |
304 | continue |
|
306 | continue | |
305 | try: |
|
307 | try: | |
306 | load(ui, name, path, loadingtime) |
|
308 | load(ui, name, path, loadingtime) | |
307 | except Exception as inst: |
|
309 | except Exception as inst: | |
308 | msg = stringutil.forcebytestr(inst) |
|
310 | msg = stringutil.forcebytestr(inst) | |
309 | if path: |
|
311 | if path: | |
310 | error_msg = _( |
|
312 | error_msg = _( | |
311 | b'failed to import extension "%s" from %s: %s' |
|
313 | b'failed to import extension "%s" from %s: %s' | |
312 | ) |
|
314 | ) | |
313 | error_msg %= (name, path, msg) |
|
315 | error_msg %= (name, path, msg) | |
314 | else: |
|
316 | else: | |
315 | error_msg = _(b'failed to import extension "%s": %s') |
|
317 | error_msg = _(b'failed to import extension "%s": %s') | |
316 | error_msg %= (name, msg) |
|
318 | error_msg %= (name, msg) | |
317 |
|
319 | |||
|
320 | options = default_sub_options.copy() | |||
318 | ext_options = ui.configsuboptions(b"extensions", name)[1] |
|
321 | ext_options = ui.configsuboptions(b"extensions", name)[1] | |
319 | if stringutil.parsebool(ext_options.get(b"required", b'no')): |
|
322 | options.update(ext_options) | |
|
323 | if stringutil.parsebool(options.get(b"required", b'no')): | |||
320 | hint = None |
|
324 | hint = None | |
321 | if isinstance(inst, error.Hint) and inst.hint: |
|
325 | if isinstance(inst, error.Hint) and inst.hint: | |
322 | hint = inst.hint |
|
326 | hint = inst.hint | |
323 | if hint is None: |
|
327 | if hint is None: | |
324 | hint = _( |
|
328 | hint = _( | |
325 | b"loading of this extension was required, " |
|
329 | b"loading of this extension was required, " | |
326 | b"see `hg help config.extensions` for details" |
|
330 | b"see `hg help config.extensions` for details" | |
327 | ) |
|
331 | ) | |
328 | raise error.Abort(error_msg, hint=hint) |
|
332 | raise error.Abort(error_msg, hint=hint) | |
329 | else: |
|
333 | else: | |
330 | ui.warn((b"*** %s\n") % error_msg) |
|
334 | ui.warn((b"*** %s\n") % error_msg) | |
331 | if isinstance(inst, error.Hint) and inst.hint: |
|
335 | if isinstance(inst, error.Hint) and inst.hint: | |
332 | ui.warn(_(b"*** (%s)\n") % inst.hint) |
|
336 | ui.warn(_(b"*** (%s)\n") % inst.hint) | |
333 | ui.traceback() |
|
337 | ui.traceback() | |
334 |
|
338 | |||
335 | ui.log( |
|
339 | ui.log( | |
336 | b'extension', |
|
340 | b'extension', | |
337 | b'> loaded %d extensions, total time %s\n', |
|
341 | b'> loaded %d extensions, total time %s\n', | |
338 | len(_order) - newindex, |
|
342 | len(_order) - newindex, | |
339 | stats, |
|
343 | stats, | |
340 | ) |
|
344 | ) | |
341 | # list of (objname, loadermod, loadername) tuple: |
|
345 | # list of (objname, loadermod, loadername) tuple: | |
342 | # - objname is the name of an object in extension module, |
|
346 | # - objname is the name of an object in extension module, | |
343 | # from which extra information is loaded |
|
347 | # from which extra information is loaded | |
344 | # - loadermod is the module where loader is placed |
|
348 | # - loadermod is the module where loader is placed | |
345 | # - loadername is the name of the function, |
|
349 | # - loadername is the name of the function, | |
346 | # which takes (ui, extensionname, extraobj) arguments |
|
350 | # which takes (ui, extensionname, extraobj) arguments | |
347 | # |
|
351 | # | |
348 | # This one is for the list of item that must be run before running any setup |
|
352 | # This one is for the list of item that must be run before running any setup | |
349 | earlyextraloaders = [ |
|
353 | earlyextraloaders = [ | |
350 | (b'configtable', configitems, b'loadconfigtable'), |
|
354 | (b'configtable', configitems, b'loadconfigtable'), | |
351 | ] |
|
355 | ] | |
352 |
|
356 | |||
353 | ui.log(b'extension', b'- loading configtable attributes\n') |
|
357 | ui.log(b'extension', b'- loading configtable attributes\n') | |
354 | _loadextra(ui, newindex, earlyextraloaders) |
|
358 | _loadextra(ui, newindex, earlyextraloaders) | |
355 |
|
359 | |||
356 | broken = set() |
|
360 | broken = set() | |
357 | ui.log(b'extension', b'- executing uisetup hooks\n') |
|
361 | ui.log(b'extension', b'- executing uisetup hooks\n') | |
358 | with util.timedcm('all uisetup') as alluisetupstats: |
|
362 | with util.timedcm('all uisetup') as alluisetupstats: | |
359 | for name in _order[newindex:]: |
|
363 | for name in _order[newindex:]: | |
360 | ui.log(b'extension', b' - running uisetup for %s\n', name) |
|
364 | ui.log(b'extension', b' - running uisetup for %s\n', name) | |
361 | with util.timedcm('uisetup %s', name) as stats: |
|
365 | with util.timedcm('uisetup %s', name) as stats: | |
362 | if not _runuisetup(name, ui): |
|
366 | if not _runuisetup(name, ui): | |
363 | ui.log( |
|
367 | ui.log( | |
364 | b'extension', |
|
368 | b'extension', | |
365 | b' - the %s extension uisetup failed\n', |
|
369 | b' - the %s extension uisetup failed\n', | |
366 | name, |
|
370 | name, | |
367 | ) |
|
371 | ) | |
368 | broken.add(name) |
|
372 | broken.add(name) | |
369 | ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats) |
|
373 | ui.log(b'extension', b' > uisetup for %s took %s\n', name, stats) | |
370 | loadingtime[name] += stats.elapsed |
|
374 | loadingtime[name] += stats.elapsed | |
371 | ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats) |
|
375 | ui.log(b'extension', b'> all uisetup took %s\n', alluisetupstats) | |
372 |
|
376 | |||
373 | ui.log(b'extension', b'- executing extsetup hooks\n') |
|
377 | ui.log(b'extension', b'- executing extsetup hooks\n') | |
374 | with util.timedcm('all extsetup') as allextetupstats: |
|
378 | with util.timedcm('all extsetup') as allextetupstats: | |
375 | for name in _order[newindex:]: |
|
379 | for name in _order[newindex:]: | |
376 | if name in broken: |
|
380 | if name in broken: | |
377 | continue |
|
381 | continue | |
378 | ui.log(b'extension', b' - running extsetup for %s\n', name) |
|
382 | ui.log(b'extension', b' - running extsetup for %s\n', name) | |
379 | with util.timedcm('extsetup %s', name) as stats: |
|
383 | with util.timedcm('extsetup %s', name) as stats: | |
380 | if not _runextsetup(name, ui): |
|
384 | if not _runextsetup(name, ui): | |
381 | ui.log( |
|
385 | ui.log( | |
382 | b'extension', |
|
386 | b'extension', | |
383 | b' - the %s extension extsetup failed\n', |
|
387 | b' - the %s extension extsetup failed\n', | |
384 | name, |
|
388 | name, | |
385 | ) |
|
389 | ) | |
386 | broken.add(name) |
|
390 | broken.add(name) | |
387 | ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats) |
|
391 | ui.log(b'extension', b' > extsetup for %s took %s\n', name, stats) | |
388 | loadingtime[name] += stats.elapsed |
|
392 | loadingtime[name] += stats.elapsed | |
389 | ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats) |
|
393 | ui.log(b'extension', b'> all extsetup took %s\n', allextetupstats) | |
390 |
|
394 | |||
391 | for name in broken: |
|
395 | for name in broken: | |
392 | ui.log(b'extension', b' - disabling broken %s extension\n', name) |
|
396 | ui.log(b'extension', b' - disabling broken %s extension\n', name) | |
393 | _extensions[name] = None |
|
397 | _extensions[name] = None | |
394 |
|
398 | |||
395 | # Call aftercallbacks that were never met. |
|
399 | # Call aftercallbacks that were never met. | |
396 | ui.log(b'extension', b'- executing remaining aftercallbacks\n') |
|
400 | ui.log(b'extension', b'- executing remaining aftercallbacks\n') | |
397 | with util.timedcm('aftercallbacks') as stats: |
|
401 | with util.timedcm('aftercallbacks') as stats: | |
398 | for shortname in _aftercallbacks: |
|
402 | for shortname in _aftercallbacks: | |
399 | if shortname in _extensions: |
|
403 | if shortname in _extensions: | |
400 | continue |
|
404 | continue | |
401 |
|
405 | |||
402 | for fn in _aftercallbacks[shortname]: |
|
406 | for fn in _aftercallbacks[shortname]: | |
403 | ui.log( |
|
407 | ui.log( | |
404 | b'extension', |
|
408 | b'extension', | |
405 | b' - extension %s not loaded, notify callbacks\n', |
|
409 | b' - extension %s not loaded, notify callbacks\n', | |
406 | shortname, |
|
410 | shortname, | |
407 | ) |
|
411 | ) | |
408 | fn(loaded=False) |
|
412 | fn(loaded=False) | |
409 | ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats) |
|
413 | ui.log(b'extension', b'> remaining aftercallbacks completed in %s\n', stats) | |
410 |
|
414 | |||
411 | # loadall() is called multiple times and lingering _aftercallbacks |
|
415 | # loadall() is called multiple times and lingering _aftercallbacks | |
412 | # entries could result in double execution. See issue4646. |
|
416 | # entries could result in double execution. See issue4646. | |
413 | _aftercallbacks.clear() |
|
417 | _aftercallbacks.clear() | |
414 |
|
418 | |||
415 | # delay importing avoids cyclic dependency (especially commands) |
|
419 | # delay importing avoids cyclic dependency (especially commands) | |
416 | from . import ( |
|
420 | from . import ( | |
417 | color, |
|
421 | color, | |
418 | commands, |
|
422 | commands, | |
419 | filemerge, |
|
423 | filemerge, | |
420 | fileset, |
|
424 | fileset, | |
421 | revset, |
|
425 | revset, | |
422 | templatefilters, |
|
426 | templatefilters, | |
423 | templatefuncs, |
|
427 | templatefuncs, | |
424 | templatekw, |
|
428 | templatekw, | |
425 | ) |
|
429 | ) | |
426 |
|
430 | |||
427 | # list of (objname, loadermod, loadername) tuple: |
|
431 | # list of (objname, loadermod, loadername) tuple: | |
428 | # - objname is the name of an object in extension module, |
|
432 | # - objname is the name of an object in extension module, | |
429 | # from which extra information is loaded |
|
433 | # from which extra information is loaded | |
430 | # - loadermod is the module where loader is placed |
|
434 | # - loadermod is the module where loader is placed | |
431 | # - loadername is the name of the function, |
|
435 | # - loadername is the name of the function, | |
432 | # which takes (ui, extensionname, extraobj) arguments |
|
436 | # which takes (ui, extensionname, extraobj) arguments | |
433 | ui.log(b'extension', b'- loading extension registration objects\n') |
|
437 | ui.log(b'extension', b'- loading extension registration objects\n') | |
434 | extraloaders = [ |
|
438 | extraloaders = [ | |
435 | (b'cmdtable', commands, b'loadcmdtable'), |
|
439 | (b'cmdtable', commands, b'loadcmdtable'), | |
436 | (b'colortable', color, b'loadcolortable'), |
|
440 | (b'colortable', color, b'loadcolortable'), | |
437 | (b'filesetpredicate', fileset, b'loadpredicate'), |
|
441 | (b'filesetpredicate', fileset, b'loadpredicate'), | |
438 | (b'internalmerge', filemerge, b'loadinternalmerge'), |
|
442 | (b'internalmerge', filemerge, b'loadinternalmerge'), | |
439 | (b'revsetpredicate', revset, b'loadpredicate'), |
|
443 | (b'revsetpredicate', revset, b'loadpredicate'), | |
440 | (b'templatefilter', templatefilters, b'loadfilter'), |
|
444 | (b'templatefilter', templatefilters, b'loadfilter'), | |
441 | (b'templatefunc', templatefuncs, b'loadfunction'), |
|
445 | (b'templatefunc', templatefuncs, b'loadfunction'), | |
442 | (b'templatekeyword', templatekw, b'loadkeyword'), |
|
446 | (b'templatekeyword', templatekw, b'loadkeyword'), | |
443 | ] |
|
447 | ] | |
444 | with util.timedcm('load registration objects') as stats: |
|
448 | with util.timedcm('load registration objects') as stats: | |
445 | _loadextra(ui, newindex, extraloaders) |
|
449 | _loadextra(ui, newindex, extraloaders) | |
446 | ui.log( |
|
450 | ui.log( | |
447 | b'extension', |
|
451 | b'extension', | |
448 | b'> extension registration object loading took %s\n', |
|
452 | b'> extension registration object loading took %s\n', | |
449 | stats, |
|
453 | stats, | |
450 | ) |
|
454 | ) | |
451 |
|
455 | |||
452 | # Report per extension loading time (except reposetup) |
|
456 | # Report per extension loading time (except reposetup) | |
453 | for name in sorted(loadingtime): |
|
457 | for name in sorted(loadingtime): | |
454 | ui.log( |
|
458 | ui.log( | |
455 | b'extension', |
|
459 | b'extension', | |
456 | b'> extension %s take a total of %s to load\n', |
|
460 | b'> extension %s take a total of %s to load\n', | |
457 | name, |
|
461 | name, | |
458 | util.timecount(loadingtime[name]), |
|
462 | util.timecount(loadingtime[name]), | |
459 | ) |
|
463 | ) | |
460 |
|
464 | |||
461 | ui.log(b'extension', b'extension loading complete\n') |
|
465 | ui.log(b'extension', b'extension loading complete\n') | |
462 |
|
466 | |||
463 |
|
467 | |||
464 | def _loadextra(ui, newindex, extraloaders): |
|
468 | def _loadextra(ui, newindex, extraloaders): | |
465 | for name in _order[newindex:]: |
|
469 | for name in _order[newindex:]: | |
466 | module = _extensions[name] |
|
470 | module = _extensions[name] | |
467 | if not module: |
|
471 | if not module: | |
468 | continue # loading this module failed |
|
472 | continue # loading this module failed | |
469 |
|
473 | |||
470 | for objname, loadermod, loadername in extraloaders: |
|
474 | for objname, loadermod, loadername in extraloaders: | |
471 | extraobj = getattr(module, objname, None) |
|
475 | extraobj = getattr(module, objname, None) | |
472 | if extraobj is not None: |
|
476 | if extraobj is not None: | |
473 | getattr(loadermod, loadername)(ui, name, extraobj) |
|
477 | getattr(loadermod, loadername)(ui, name, extraobj) | |
474 |
|
478 | |||
475 |
|
479 | |||
476 | def afterloaded(extension, callback): |
|
480 | def afterloaded(extension, callback): | |
477 | """Run the specified function after a named extension is loaded. |
|
481 | """Run the specified function after a named extension is loaded. | |
478 |
|
482 | |||
479 | If the named extension is already loaded, the callback will be called |
|
483 | If the named extension is already loaded, the callback will be called | |
480 | immediately. |
|
484 | immediately. | |
481 |
|
485 | |||
482 | If the named extension never loads, the callback will be called after |
|
486 | If the named extension never loads, the callback will be called after | |
483 | all extensions have been loaded. |
|
487 | all extensions have been loaded. | |
484 |
|
488 | |||
485 | The callback receives the named argument ``loaded``, which is a boolean |
|
489 | The callback receives the named argument ``loaded``, which is a boolean | |
486 | indicating whether the dependent extension actually loaded. |
|
490 | indicating whether the dependent extension actually loaded. | |
487 | """ |
|
491 | """ | |
488 |
|
492 | |||
489 | if extension in _extensions: |
|
493 | if extension in _extensions: | |
490 | # Report loaded as False if the extension is disabled |
|
494 | # Report loaded as False if the extension is disabled | |
491 | loaded = _extensions[extension] is not None |
|
495 | loaded = _extensions[extension] is not None | |
492 | callback(loaded=loaded) |
|
496 | callback(loaded=loaded) | |
493 | else: |
|
497 | else: | |
494 | _aftercallbacks.setdefault(extension, []).append(callback) |
|
498 | _aftercallbacks.setdefault(extension, []).append(callback) | |
495 |
|
499 | |||
496 |
|
500 | |||
497 | def populateui(ui): |
|
501 | def populateui(ui): | |
498 | """Run extension hooks on the given ui to populate additional members, |
|
502 | """Run extension hooks on the given ui to populate additional members, | |
499 | extend the class dynamically, etc. |
|
503 | extend the class dynamically, etc. | |
500 |
|
504 | |||
501 | This will be called after the configuration is loaded, and/or extensions |
|
505 | This will be called after the configuration is loaded, and/or extensions | |
502 | are loaded. In general, it's once per ui instance, but in command-server |
|
506 | are loaded. In general, it's once per ui instance, but in command-server | |
503 | and hgweb, this may be called more than once with the same ui. |
|
507 | and hgweb, this may be called more than once with the same ui. | |
504 | """ |
|
508 | """ | |
505 | for name, mod in extensions(ui): |
|
509 | for name, mod in extensions(ui): | |
506 | hook = getattr(mod, 'uipopulate', None) |
|
510 | hook = getattr(mod, 'uipopulate', None) | |
507 | if not hook: |
|
511 | if not hook: | |
508 | continue |
|
512 | continue | |
509 | try: |
|
513 | try: | |
510 | hook(ui) |
|
514 | hook(ui) | |
511 | except Exception as inst: |
|
515 | except Exception as inst: | |
512 | ui.traceback(force=True) |
|
516 | ui.traceback(force=True) | |
513 | ui.warn( |
|
517 | ui.warn( | |
514 | _(b'*** failed to populate ui by extension %s: %s\n') |
|
518 | _(b'*** failed to populate ui by extension %s: %s\n') | |
515 | % (name, stringutil.forcebytestr(inst)) |
|
519 | % (name, stringutil.forcebytestr(inst)) | |
516 | ) |
|
520 | ) | |
517 |
|
521 | |||
518 |
|
522 | |||
519 | def bind(func, *args): |
|
523 | def bind(func, *args): | |
520 | """Partial function application |
|
524 | """Partial function application | |
521 |
|
525 | |||
522 | Returns a new function that is the partial application of args and kwargs |
|
526 | Returns a new function that is the partial application of args and kwargs | |
523 | to func. For example, |
|
527 | to func. For example, | |
524 |
|
528 | |||
525 | f(1, 2, bar=3) === bind(f, 1)(2, bar=3)""" |
|
529 | f(1, 2, bar=3) === bind(f, 1)(2, bar=3)""" | |
526 | assert callable(func) |
|
530 | assert callable(func) | |
527 |
|
531 | |||
528 | def closure(*a, **kw): |
|
532 | def closure(*a, **kw): | |
529 | return func(*(args + a), **kw) |
|
533 | return func(*(args + a), **kw) | |
530 |
|
534 | |||
531 | return closure |
|
535 | return closure | |
532 |
|
536 | |||
533 |
|
537 | |||
534 | def _updatewrapper(wrap, origfn, unboundwrapper): |
|
538 | def _updatewrapper(wrap, origfn, unboundwrapper): | |
535 | '''Copy and add some useful attributes to wrapper''' |
|
539 | '''Copy and add some useful attributes to wrapper''' | |
536 | try: |
|
540 | try: | |
537 | wrap.__name__ = origfn.__name__ |
|
541 | wrap.__name__ = origfn.__name__ | |
538 | except AttributeError: |
|
542 | except AttributeError: | |
539 | pass |
|
543 | pass | |
540 | wrap.__module__ = getattr(origfn, '__module__') |
|
544 | wrap.__module__ = getattr(origfn, '__module__') | |
541 | wrap.__doc__ = getattr(origfn, '__doc__') |
|
545 | wrap.__doc__ = getattr(origfn, '__doc__') | |
542 | wrap.__dict__.update(getattr(origfn, '__dict__', {})) |
|
546 | wrap.__dict__.update(getattr(origfn, '__dict__', {})) | |
543 | wrap._origfunc = origfn |
|
547 | wrap._origfunc = origfn | |
544 | wrap._unboundwrapper = unboundwrapper |
|
548 | wrap._unboundwrapper = unboundwrapper | |
545 |
|
549 | |||
546 |
|
550 | |||
547 | def wrapcommand(table, command, wrapper, synopsis=None, docstring=None): |
|
551 | def wrapcommand(table, command, wrapper, synopsis=None, docstring=None): | |
548 | '''Wrap the command named `command' in table |
|
552 | '''Wrap the command named `command' in table | |
549 |
|
553 | |||
550 | Replace command in the command table with wrapper. The wrapped command will |
|
554 | Replace command in the command table with wrapper. The wrapped command will | |
551 | be inserted into the command table specified by the table argument. |
|
555 | be inserted into the command table specified by the table argument. | |
552 |
|
556 | |||
553 | The wrapper will be called like |
|
557 | The wrapper will be called like | |
554 |
|
558 | |||
555 | wrapper(orig, *args, **kwargs) |
|
559 | wrapper(orig, *args, **kwargs) | |
556 |
|
560 | |||
557 | where orig is the original (wrapped) function, and *args, **kwargs |
|
561 | where orig is the original (wrapped) function, and *args, **kwargs | |
558 | are the arguments passed to it. |
|
562 | are the arguments passed to it. | |
559 |
|
563 | |||
560 | Optionally append to the command synopsis and docstring, used for help. |
|
564 | Optionally append to the command synopsis and docstring, used for help. | |
561 | For example, if your extension wraps the ``bookmarks`` command to add the |
|
565 | For example, if your extension wraps the ``bookmarks`` command to add the | |
562 | flags ``--remote`` and ``--all`` you might call this function like so: |
|
566 | flags ``--remote`` and ``--all`` you might call this function like so: | |
563 |
|
567 | |||
564 | synopsis = ' [-a] [--remote]' |
|
568 | synopsis = ' [-a] [--remote]' | |
565 | docstring = """ |
|
569 | docstring = """ | |
566 |
|
570 | |||
567 | The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``) |
|
571 | The ``remotenames`` extension adds the ``--remote`` and ``--all`` (``-a``) | |
568 | flags to the bookmarks command. Either flag will show the remote bookmarks |
|
572 | flags to the bookmarks command. Either flag will show the remote bookmarks | |
569 | known to the repository; ``--remote`` will also suppress the output of the |
|
573 | known to the repository; ``--remote`` will also suppress the output of the | |
570 | local bookmarks. |
|
574 | local bookmarks. | |
571 | """ |
|
575 | """ | |
572 |
|
576 | |||
573 | extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, |
|
577 | extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, | |
574 | synopsis, docstring) |
|
578 | synopsis, docstring) | |
575 | ''' |
|
579 | ''' | |
576 | assert callable(wrapper) |
|
580 | assert callable(wrapper) | |
577 | aliases, entry = cmdutil.findcmd(command, table) |
|
581 | aliases, entry = cmdutil.findcmd(command, table) | |
578 | for alias, e in pycompat.iteritems(table): |
|
582 | for alias, e in pycompat.iteritems(table): | |
579 | if e is entry: |
|
583 | if e is entry: | |
580 | key = alias |
|
584 | key = alias | |
581 | break |
|
585 | break | |
582 |
|
586 | |||
583 | origfn = entry[0] |
|
587 | origfn = entry[0] | |
584 | wrap = functools.partial( |
|
588 | wrap = functools.partial( | |
585 | util.checksignature(wrapper), util.checksignature(origfn) |
|
589 | util.checksignature(wrapper), util.checksignature(origfn) | |
586 | ) |
|
590 | ) | |
587 | _updatewrapper(wrap, origfn, wrapper) |
|
591 | _updatewrapper(wrap, origfn, wrapper) | |
588 | if docstring is not None: |
|
592 | if docstring is not None: | |
589 | wrap.__doc__ += docstring |
|
593 | wrap.__doc__ += docstring | |
590 |
|
594 | |||
591 | newentry = list(entry) |
|
595 | newentry = list(entry) | |
592 | newentry[0] = wrap |
|
596 | newentry[0] = wrap | |
593 | if synopsis is not None: |
|
597 | if synopsis is not None: | |
594 | newentry[2] += synopsis |
|
598 | newentry[2] += synopsis | |
595 | table[key] = tuple(newentry) |
|
599 | table[key] = tuple(newentry) | |
596 | return entry |
|
600 | return entry | |
597 |
|
601 | |||
598 |
|
602 | |||
599 | def wrapfilecache(cls, propname, wrapper): |
|
603 | def wrapfilecache(cls, propname, wrapper): | |
600 | """Wraps a filecache property. |
|
604 | """Wraps a filecache property. | |
601 |
|
605 | |||
602 | These can't be wrapped using the normal wrapfunction. |
|
606 | These can't be wrapped using the normal wrapfunction. | |
603 | """ |
|
607 | """ | |
604 | propname = pycompat.sysstr(propname) |
|
608 | propname = pycompat.sysstr(propname) | |
605 | assert callable(wrapper) |
|
609 | assert callable(wrapper) | |
606 | for currcls in cls.__mro__: |
|
610 | for currcls in cls.__mro__: | |
607 | if propname in currcls.__dict__: |
|
611 | if propname in currcls.__dict__: | |
608 | origfn = currcls.__dict__[propname].func |
|
612 | origfn = currcls.__dict__[propname].func | |
609 | assert callable(origfn) |
|
613 | assert callable(origfn) | |
610 |
|
614 | |||
611 | def wrap(*args, **kwargs): |
|
615 | def wrap(*args, **kwargs): | |
612 | return wrapper(origfn, *args, **kwargs) |
|
616 | return wrapper(origfn, *args, **kwargs) | |
613 |
|
617 | |||
614 | currcls.__dict__[propname].func = wrap |
|
618 | currcls.__dict__[propname].func = wrap | |
615 | break |
|
619 | break | |
616 |
|
620 | |||
617 | if currcls is object: |
|
621 | if currcls is object: | |
618 | raise AttributeError("type '%s' has no property '%s'" % (cls, propname)) |
|
622 | raise AttributeError("type '%s' has no property '%s'" % (cls, propname)) | |
619 |
|
623 | |||
620 |
|
624 | |||
621 | class wrappedfunction(object): |
|
625 | class wrappedfunction(object): | |
622 | '''context manager for temporarily wrapping a function''' |
|
626 | '''context manager for temporarily wrapping a function''' | |
623 |
|
627 | |||
624 | def __init__(self, container, funcname, wrapper): |
|
628 | def __init__(self, container, funcname, wrapper): | |
625 | assert callable(wrapper) |
|
629 | assert callable(wrapper) | |
626 | self._container = container |
|
630 | self._container = container | |
627 | self._funcname = funcname |
|
631 | self._funcname = funcname | |
628 | self._wrapper = wrapper |
|
632 | self._wrapper = wrapper | |
629 |
|
633 | |||
630 | def __enter__(self): |
|
634 | def __enter__(self): | |
631 | wrapfunction(self._container, self._funcname, self._wrapper) |
|
635 | wrapfunction(self._container, self._funcname, self._wrapper) | |
632 |
|
636 | |||
633 | def __exit__(self, exctype, excvalue, traceback): |
|
637 | def __exit__(self, exctype, excvalue, traceback): | |
634 | unwrapfunction(self._container, self._funcname, self._wrapper) |
|
638 | unwrapfunction(self._container, self._funcname, self._wrapper) | |
635 |
|
639 | |||
636 |
|
640 | |||
637 | def wrapfunction(container, funcname, wrapper): |
|
641 | def wrapfunction(container, funcname, wrapper): | |
638 | """Wrap the function named funcname in container |
|
642 | """Wrap the function named funcname in container | |
639 |
|
643 | |||
640 | Replace the funcname member in the given container with the specified |
|
644 | Replace the funcname member in the given container with the specified | |
641 | wrapper. The container is typically a module, class, or instance. |
|
645 | wrapper. The container is typically a module, class, or instance. | |
642 |
|
646 | |||
643 | The wrapper will be called like |
|
647 | The wrapper will be called like | |
644 |
|
648 | |||
645 | wrapper(orig, *args, **kwargs) |
|
649 | wrapper(orig, *args, **kwargs) | |
646 |
|
650 | |||
647 | where orig is the original (wrapped) function, and *args, **kwargs |
|
651 | where orig is the original (wrapped) function, and *args, **kwargs | |
648 | are the arguments passed to it. |
|
652 | are the arguments passed to it. | |
649 |
|
653 | |||
650 | Wrapping methods of the repository object is not recommended since |
|
654 | Wrapping methods of the repository object is not recommended since | |
651 | it conflicts with extensions that extend the repository by |
|
655 | it conflicts with extensions that extend the repository by | |
652 | subclassing. All extensions that need to extend methods of |
|
656 | subclassing. All extensions that need to extend methods of | |
653 | localrepository should use this subclassing trick: namely, |
|
657 | localrepository should use this subclassing trick: namely, | |
654 | reposetup() should look like |
|
658 | reposetup() should look like | |
655 |
|
659 | |||
656 | def reposetup(ui, repo): |
|
660 | def reposetup(ui, repo): | |
657 | class myrepo(repo.__class__): |
|
661 | class myrepo(repo.__class__): | |
658 | def whatever(self, *args, **kwargs): |
|
662 | def whatever(self, *args, **kwargs): | |
659 | [...extension stuff...] |
|
663 | [...extension stuff...] | |
660 | super(myrepo, self).whatever(*args, **kwargs) |
|
664 | super(myrepo, self).whatever(*args, **kwargs) | |
661 | [...extension stuff...] |
|
665 | [...extension stuff...] | |
662 |
|
666 | |||
663 | repo.__class__ = myrepo |
|
667 | repo.__class__ = myrepo | |
664 |
|
668 | |||
665 | In general, combining wrapfunction() with subclassing does not |
|
669 | In general, combining wrapfunction() with subclassing does not | |
666 | work. Since you cannot control what other extensions are loaded by |
|
670 | work. Since you cannot control what other extensions are loaded by | |
667 | your end users, you should play nicely with others by using the |
|
671 | your end users, you should play nicely with others by using the | |
668 | subclass trick. |
|
672 | subclass trick. | |
669 | """ |
|
673 | """ | |
670 | assert callable(wrapper) |
|
674 | assert callable(wrapper) | |
671 |
|
675 | |||
672 | origfn = getattr(container, funcname) |
|
676 | origfn = getattr(container, funcname) | |
673 | assert callable(origfn) |
|
677 | assert callable(origfn) | |
674 | if inspect.ismodule(container): |
|
678 | if inspect.ismodule(container): | |
675 | # origfn is not an instance or class method. "partial" can be used. |
|
679 | # origfn is not an instance or class method. "partial" can be used. | |
676 | # "partial" won't insert a frame in traceback. |
|
680 | # "partial" won't insert a frame in traceback. | |
677 | wrap = functools.partial(wrapper, origfn) |
|
681 | wrap = functools.partial(wrapper, origfn) | |
678 | else: |
|
682 | else: | |
679 | # "partial" cannot be safely used. Emulate its effect by using "bind". |
|
683 | # "partial" cannot be safely used. Emulate its effect by using "bind". | |
680 | # The downside is one more frame in traceback. |
|
684 | # The downside is one more frame in traceback. | |
681 | wrap = bind(wrapper, origfn) |
|
685 | wrap = bind(wrapper, origfn) | |
682 | _updatewrapper(wrap, origfn, wrapper) |
|
686 | _updatewrapper(wrap, origfn, wrapper) | |
683 | setattr(container, funcname, wrap) |
|
687 | setattr(container, funcname, wrap) | |
684 | return origfn |
|
688 | return origfn | |
685 |
|
689 | |||
686 |
|
690 | |||
687 | def unwrapfunction(container, funcname, wrapper=None): |
|
691 | def unwrapfunction(container, funcname, wrapper=None): | |
688 | """undo wrapfunction |
|
692 | """undo wrapfunction | |
689 |
|
693 | |||
690 | If wrappers is None, undo the last wrap. Otherwise removes the wrapper |
|
694 | If wrappers is None, undo the last wrap. Otherwise removes the wrapper | |
691 | from the chain of wrappers. |
|
695 | from the chain of wrappers. | |
692 |
|
696 | |||
693 | Return the removed wrapper. |
|
697 | Return the removed wrapper. | |
694 | Raise IndexError if wrapper is None and nothing to unwrap; ValueError if |
|
698 | Raise IndexError if wrapper is None and nothing to unwrap; ValueError if | |
695 | wrapper is not None but is not found in the wrapper chain. |
|
699 | wrapper is not None but is not found in the wrapper chain. | |
696 | """ |
|
700 | """ | |
697 | chain = getwrapperchain(container, funcname) |
|
701 | chain = getwrapperchain(container, funcname) | |
698 | origfn = chain.pop() |
|
702 | origfn = chain.pop() | |
699 | if wrapper is None: |
|
703 | if wrapper is None: | |
700 | wrapper = chain[0] |
|
704 | wrapper = chain[0] | |
701 | chain.remove(wrapper) |
|
705 | chain.remove(wrapper) | |
702 | setattr(container, funcname, origfn) |
|
706 | setattr(container, funcname, origfn) | |
703 | for w in reversed(chain): |
|
707 | for w in reversed(chain): | |
704 | wrapfunction(container, funcname, w) |
|
708 | wrapfunction(container, funcname, w) | |
705 | return wrapper |
|
709 | return wrapper | |
706 |
|
710 | |||
707 |
|
711 | |||
708 | def getwrapperchain(container, funcname): |
|
712 | def getwrapperchain(container, funcname): | |
709 | """get a chain of wrappers of a function |
|
713 | """get a chain of wrappers of a function | |
710 |
|
714 | |||
711 | Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc] |
|
715 | Return a list of functions: [newest wrapper, ..., oldest wrapper, origfunc] | |
712 |
|
716 | |||
713 | The wrapper functions are the ones passed to wrapfunction, whose first |
|
717 | The wrapper functions are the ones passed to wrapfunction, whose first | |
714 | argument is origfunc. |
|
718 | argument is origfunc. | |
715 | """ |
|
719 | """ | |
716 | result = [] |
|
720 | result = [] | |
717 | fn = getattr(container, funcname) |
|
721 | fn = getattr(container, funcname) | |
718 | while fn: |
|
722 | while fn: | |
719 | assert callable(fn) |
|
723 | assert callable(fn) | |
720 | result.append(getattr(fn, '_unboundwrapper', fn)) |
|
724 | result.append(getattr(fn, '_unboundwrapper', fn)) | |
721 | fn = getattr(fn, '_origfunc', None) |
|
725 | fn = getattr(fn, '_origfunc', None) | |
722 | return result |
|
726 | return result | |
723 |
|
727 | |||
724 |
|
728 | |||
725 | def _disabledpaths(): |
|
729 | def _disabledpaths(): | |
726 | '''find paths of disabled extensions. returns a dict of {name: path}''' |
|
730 | '''find paths of disabled extensions. returns a dict of {name: path}''' | |
727 | import hgext |
|
731 | import hgext | |
728 |
|
732 | |||
729 | # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and |
|
733 | # The hgext might not have a __file__ attribute (e.g. in PyOxidizer) and | |
730 | # it might not be on a filesystem even if it does. |
|
734 | # it might not be on a filesystem even if it does. | |
731 | if util.safehasattr(hgext, '__file__'): |
|
735 | if util.safehasattr(hgext, '__file__'): | |
732 | extpath = os.path.dirname( |
|
736 | extpath = os.path.dirname( | |
733 | util.abspath(pycompat.fsencode(hgext.__file__)) |
|
737 | util.abspath(pycompat.fsencode(hgext.__file__)) | |
734 | ) |
|
738 | ) | |
735 | try: |
|
739 | try: | |
736 | files = os.listdir(extpath) |
|
740 | files = os.listdir(extpath) | |
737 | except OSError: |
|
741 | except OSError: | |
738 | return {} |
|
742 | return {} | |
739 | else: |
|
743 | else: | |
740 | return {} |
|
744 | return {} | |
741 |
|
745 | |||
742 | exts = {} |
|
746 | exts = {} | |
743 | for e in files: |
|
747 | for e in files: | |
744 | if e.endswith(b'.py'): |
|
748 | if e.endswith(b'.py'): | |
745 | name = e.rsplit(b'.', 1)[0] |
|
749 | name = e.rsplit(b'.', 1)[0] | |
746 | path = os.path.join(extpath, e) |
|
750 | path = os.path.join(extpath, e) | |
747 | else: |
|
751 | else: | |
748 | name = e |
|
752 | name = e | |
749 | path = os.path.join(extpath, e, b'__init__.py') |
|
753 | path = os.path.join(extpath, e, b'__init__.py') | |
750 | if not os.path.exists(path): |
|
754 | if not os.path.exists(path): | |
751 | continue |
|
755 | continue | |
752 | if name in exts or name in _order or name == b'__init__': |
|
756 | if name in exts or name in _order or name == b'__init__': | |
753 | continue |
|
757 | continue | |
754 | exts[name] = path |
|
758 | exts[name] = path | |
755 | for name, path in pycompat.iteritems(_disabledextensions): |
|
759 | for name, path in pycompat.iteritems(_disabledextensions): | |
756 | # If no path was provided for a disabled extension (e.g. "color=!"), |
|
760 | # If no path was provided for a disabled extension (e.g. "color=!"), | |
757 | # don't replace the path we already found by the scan above. |
|
761 | # don't replace the path we already found by the scan above. | |
758 | if path: |
|
762 | if path: | |
759 | exts[name] = path |
|
763 | exts[name] = path | |
760 | return exts |
|
764 | return exts | |
761 |
|
765 | |||
762 |
|
766 | |||
763 | def _moduledoc(file): |
|
767 | def _moduledoc(file): | |
764 | """return the top-level python documentation for the given file |
|
768 | """return the top-level python documentation for the given file | |
765 |
|
769 | |||
766 | Loosely inspired by pydoc.source_synopsis(), but rewritten to |
|
770 | Loosely inspired by pydoc.source_synopsis(), but rewritten to | |
767 | handle triple quotes and to return the whole text instead of just |
|
771 | handle triple quotes and to return the whole text instead of just | |
768 | the synopsis""" |
|
772 | the synopsis""" | |
769 | result = [] |
|
773 | result = [] | |
770 |
|
774 | |||
771 | line = file.readline() |
|
775 | line = file.readline() | |
772 | while line[:1] == b'#' or not line.strip(): |
|
776 | while line[:1] == b'#' or not line.strip(): | |
773 | line = file.readline() |
|
777 | line = file.readline() | |
774 | if not line: |
|
778 | if not line: | |
775 | break |
|
779 | break | |
776 |
|
780 | |||
777 | start = line[:3] |
|
781 | start = line[:3] | |
778 | if start == b'"""' or start == b"'''": |
|
782 | if start == b'"""' or start == b"'''": | |
779 | line = line[3:] |
|
783 | line = line[3:] | |
780 | while line: |
|
784 | while line: | |
781 | if line.rstrip().endswith(start): |
|
785 | if line.rstrip().endswith(start): | |
782 | line = line.split(start)[0] |
|
786 | line = line.split(start)[0] | |
783 | if line: |
|
787 | if line: | |
784 | result.append(line) |
|
788 | result.append(line) | |
785 | break |
|
789 | break | |
786 | elif not line: |
|
790 | elif not line: | |
787 | return None # unmatched delimiter |
|
791 | return None # unmatched delimiter | |
788 | result.append(line) |
|
792 | result.append(line) | |
789 | line = file.readline() |
|
793 | line = file.readline() | |
790 | else: |
|
794 | else: | |
791 | return None |
|
795 | return None | |
792 |
|
796 | |||
793 | return b''.join(result) |
|
797 | return b''.join(result) | |
794 |
|
798 | |||
795 |
|
799 | |||
796 | def _disabledhelp(path): |
|
800 | def _disabledhelp(path): | |
797 | '''retrieve help synopsis of a disabled extension (without importing)''' |
|
801 | '''retrieve help synopsis of a disabled extension (without importing)''' | |
798 | try: |
|
802 | try: | |
799 | with open(path, b'rb') as src: |
|
803 | with open(path, b'rb') as src: | |
800 | doc = _moduledoc(src) |
|
804 | doc = _moduledoc(src) | |
801 | except IOError: |
|
805 | except IOError: | |
802 | return |
|
806 | return | |
803 |
|
807 | |||
804 | if doc: # extracting localized synopsis |
|
808 | if doc: # extracting localized synopsis | |
805 | return gettext(doc) |
|
809 | return gettext(doc) | |
806 | else: |
|
810 | else: | |
807 | return _(b'(no help text available)') |
|
811 | return _(b'(no help text available)') | |
808 |
|
812 | |||
809 |
|
813 | |||
810 | def disabled(): |
|
814 | def disabled(): | |
811 | '''find disabled extensions from hgext. returns a dict of {name: desc}''' |
|
815 | '''find disabled extensions from hgext. returns a dict of {name: desc}''' | |
812 | try: |
|
816 | try: | |
813 | from hgext import __index__ # pytype: disable=import-error |
|
817 | from hgext import __index__ # pytype: disable=import-error | |
814 |
|
818 | |||
815 | return { |
|
819 | return { | |
816 | name: gettext(desc) |
|
820 | name: gettext(desc) | |
817 | for name, desc in pycompat.iteritems(__index__.docs) |
|
821 | for name, desc in pycompat.iteritems(__index__.docs) | |
818 | if name not in _order |
|
822 | if name not in _order | |
819 | } |
|
823 | } | |
820 | except (ImportError, AttributeError): |
|
824 | except (ImportError, AttributeError): | |
821 | pass |
|
825 | pass | |
822 |
|
826 | |||
823 | paths = _disabledpaths() |
|
827 | paths = _disabledpaths() | |
824 | if not paths: |
|
828 | if not paths: | |
825 | return {} |
|
829 | return {} | |
826 |
|
830 | |||
827 | exts = {} |
|
831 | exts = {} | |
828 | for name, path in pycompat.iteritems(paths): |
|
832 | for name, path in pycompat.iteritems(paths): | |
829 | doc = _disabledhelp(path) |
|
833 | doc = _disabledhelp(path) | |
830 | if doc and name != b'__index__': |
|
834 | if doc and name != b'__index__': | |
831 | exts[name] = doc.splitlines()[0] |
|
835 | exts[name] = doc.splitlines()[0] | |
832 |
|
836 | |||
833 | return exts |
|
837 | return exts | |
834 |
|
838 | |||
835 |
|
839 | |||
836 | def disabled_help(name): |
|
840 | def disabled_help(name): | |
837 | """Obtain the full help text for a disabled extension, or None.""" |
|
841 | """Obtain the full help text for a disabled extension, or None.""" | |
838 | paths = _disabledpaths() |
|
842 | paths = _disabledpaths() | |
839 | if name in paths: |
|
843 | if name in paths: | |
840 | return _disabledhelp(paths[name]) |
|
844 | return _disabledhelp(paths[name]) | |
841 |
|
845 | |||
842 |
|
846 | |||
843 | def _walkcommand(node): |
|
847 | def _walkcommand(node): | |
844 | """Scan @command() decorators in the tree starting at node""" |
|
848 | """Scan @command() decorators in the tree starting at node""" | |
845 | todo = collections.deque([node]) |
|
849 | todo = collections.deque([node]) | |
846 | while todo: |
|
850 | while todo: | |
847 | node = todo.popleft() |
|
851 | node = todo.popleft() | |
848 | if not isinstance(node, ast.FunctionDef): |
|
852 | if not isinstance(node, ast.FunctionDef): | |
849 | todo.extend(ast.iter_child_nodes(node)) |
|
853 | todo.extend(ast.iter_child_nodes(node)) | |
850 | continue |
|
854 | continue | |
851 | for d in node.decorator_list: |
|
855 | for d in node.decorator_list: | |
852 | if not isinstance(d, ast.Call): |
|
856 | if not isinstance(d, ast.Call): | |
853 | continue |
|
857 | continue | |
854 | if not isinstance(d.func, ast.Name): |
|
858 | if not isinstance(d.func, ast.Name): | |
855 | continue |
|
859 | continue | |
856 | if d.func.id != 'command': |
|
860 | if d.func.id != 'command': | |
857 | continue |
|
861 | continue | |
858 | yield d |
|
862 | yield d | |
859 |
|
863 | |||
860 |
|
864 | |||
861 | def _disabledcmdtable(path): |
|
865 | def _disabledcmdtable(path): | |
862 | """Construct a dummy command table without loading the extension module |
|
866 | """Construct a dummy command table without loading the extension module | |
863 |
|
867 | |||
864 | This may raise IOError or SyntaxError. |
|
868 | This may raise IOError or SyntaxError. | |
865 | """ |
|
869 | """ | |
866 | with open(path, b'rb') as src: |
|
870 | with open(path, b'rb') as src: | |
867 | root = ast.parse(src.read(), path) |
|
871 | root = ast.parse(src.read(), path) | |
868 | cmdtable = {} |
|
872 | cmdtable = {} | |
869 | for node in _walkcommand(root): |
|
873 | for node in _walkcommand(root): | |
870 | if not node.args: |
|
874 | if not node.args: | |
871 | continue |
|
875 | continue | |
872 | a = node.args[0] |
|
876 | a = node.args[0] | |
873 | if isinstance(a, ast.Str): |
|
877 | if isinstance(a, ast.Str): | |
874 | name = pycompat.sysbytes(a.s) |
|
878 | name = pycompat.sysbytes(a.s) | |
875 | elif pycompat.ispy3 and isinstance(a, ast.Bytes): |
|
879 | elif pycompat.ispy3 and isinstance(a, ast.Bytes): | |
876 | name = a.s |
|
880 | name = a.s | |
877 | else: |
|
881 | else: | |
878 | continue |
|
882 | continue | |
879 | cmdtable[name] = (None, [], b'') |
|
883 | cmdtable[name] = (None, [], b'') | |
880 | return cmdtable |
|
884 | return cmdtable | |
881 |
|
885 | |||
882 |
|
886 | |||
883 | def _finddisabledcmd(ui, cmd, name, path, strict): |
|
887 | def _finddisabledcmd(ui, cmd, name, path, strict): | |
884 | try: |
|
888 | try: | |
885 | cmdtable = _disabledcmdtable(path) |
|
889 | cmdtable = _disabledcmdtable(path) | |
886 | except (IOError, SyntaxError): |
|
890 | except (IOError, SyntaxError): | |
887 | return |
|
891 | return | |
888 | try: |
|
892 | try: | |
889 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) |
|
893 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) | |
890 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
894 | except (error.AmbiguousCommand, error.UnknownCommand): | |
891 | return |
|
895 | return | |
892 | for c in aliases: |
|
896 | for c in aliases: | |
893 | if c.startswith(cmd): |
|
897 | if c.startswith(cmd): | |
894 | cmd = c |
|
898 | cmd = c | |
895 | break |
|
899 | break | |
896 | else: |
|
900 | else: | |
897 | cmd = aliases[0] |
|
901 | cmd = aliases[0] | |
898 | doc = _disabledhelp(path) |
|
902 | doc = _disabledhelp(path) | |
899 | return (cmd, name, doc) |
|
903 | return (cmd, name, doc) | |
900 |
|
904 | |||
901 |
|
905 | |||
902 | def disabledcmd(ui, cmd, strict=False): |
|
906 | def disabledcmd(ui, cmd, strict=False): | |
903 | """find cmd from disabled extensions without importing. |
|
907 | """find cmd from disabled extensions without importing. | |
904 | returns (cmdname, extname, doc)""" |
|
908 | returns (cmdname, extname, doc)""" | |
905 |
|
909 | |||
906 | paths = _disabledpaths() |
|
910 | paths = _disabledpaths() | |
907 | if not paths: |
|
911 | if not paths: | |
908 | raise error.UnknownCommand(cmd) |
|
912 | raise error.UnknownCommand(cmd) | |
909 |
|
913 | |||
910 | ext = None |
|
914 | ext = None | |
911 | # first, search for an extension with the same name as the command |
|
915 | # first, search for an extension with the same name as the command | |
912 | path = paths.pop(cmd, None) |
|
916 | path = paths.pop(cmd, None) | |
913 | if path: |
|
917 | if path: | |
914 | ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict) |
|
918 | ext = _finddisabledcmd(ui, cmd, cmd, path, strict=strict) | |
915 | if not ext: |
|
919 | if not ext: | |
916 | # otherwise, interrogate each extension until there's a match |
|
920 | # otherwise, interrogate each extension until there's a match | |
917 | for name, path in pycompat.iteritems(paths): |
|
921 | for name, path in pycompat.iteritems(paths): | |
918 | ext = _finddisabledcmd(ui, cmd, name, path, strict=strict) |
|
922 | ext = _finddisabledcmd(ui, cmd, name, path, strict=strict) | |
919 | if ext: |
|
923 | if ext: | |
920 | break |
|
924 | break | |
921 | if ext: |
|
925 | if ext: | |
922 | return ext |
|
926 | return ext | |
923 |
|
927 | |||
924 | raise error.UnknownCommand(cmd) |
|
928 | raise error.UnknownCommand(cmd) | |
925 |
|
929 | |||
926 |
|
930 | |||
927 | def enabled(shortname=True): |
|
931 | def enabled(shortname=True): | |
928 | '''return a dict of {name: desc} of extensions''' |
|
932 | '''return a dict of {name: desc} of extensions''' | |
929 | exts = {} |
|
933 | exts = {} | |
930 | for ename, ext in extensions(): |
|
934 | for ename, ext in extensions(): | |
931 | doc = gettext(ext.__doc__) or _(b'(no help text available)') |
|
935 | doc = gettext(ext.__doc__) or _(b'(no help text available)') | |
932 | assert doc is not None # help pytype |
|
936 | assert doc is not None # help pytype | |
933 | if shortname: |
|
937 | if shortname: | |
934 | ename = ename.split(b'.')[-1] |
|
938 | ename = ename.split(b'.')[-1] | |
935 | exts[ename] = doc.splitlines()[0].strip() |
|
939 | exts[ename] = doc.splitlines()[0].strip() | |
936 |
|
940 | |||
937 | return exts |
|
941 | return exts | |
938 |
|
942 | |||
939 |
|
943 | |||
940 | def notloaded(): |
|
944 | def notloaded(): | |
941 | '''return short names of extensions that failed to load''' |
|
945 | '''return short names of extensions that failed to load''' | |
942 | return [ |
|
946 | return [ | |
943 | name for name, mod in pycompat.iteritems(_extensions) if mod is None |
|
947 | name for name, mod in pycompat.iteritems(_extensions) if mod is None | |
944 | ] |
|
948 | ] | |
945 |
|
949 | |||
946 |
|
950 | |||
947 | def moduleversion(module): |
|
951 | def moduleversion(module): | |
948 | '''return version information from given module as a string''' |
|
952 | '''return version information from given module as a string''' | |
949 | if util.safehasattr(module, b'getversion') and callable(module.getversion): |
|
953 | if util.safehasattr(module, b'getversion') and callable(module.getversion): | |
950 | try: |
|
954 | try: | |
951 | version = module.getversion() |
|
955 | version = module.getversion() | |
952 | except Exception: |
|
956 | except Exception: | |
953 | version = b'unknown' |
|
957 | version = b'unknown' | |
954 |
|
958 | |||
955 | elif util.safehasattr(module, b'__version__'): |
|
959 | elif util.safehasattr(module, b'__version__'): | |
956 | version = module.__version__ |
|
960 | version = module.__version__ | |
957 | else: |
|
961 | else: | |
958 | version = b'' |
|
962 | version = b'' | |
959 | if isinstance(version, (list, tuple)): |
|
963 | if isinstance(version, (list, tuple)): | |
960 | version = b'.'.join(pycompat.bytestr(o) for o in version) |
|
964 | version = b'.'.join(pycompat.bytestr(o) for o in version) | |
961 | else: |
|
965 | else: | |
962 | # version data should be bytes, but not all extensions are ported |
|
966 | # version data should be bytes, but not all extensions are ported | |
963 | # to py3. |
|
967 | # to py3. | |
964 | version = stringutil.forcebytestr(version) |
|
968 | version = stringutil.forcebytestr(version) | |
965 | return version |
|
969 | return version | |
966 |
|
970 | |||
967 |
|
971 | |||
968 | def ismoduleinternal(module): |
|
972 | def ismoduleinternal(module): | |
969 | exttestedwith = getattr(module, 'testedwith', None) |
|
973 | exttestedwith = getattr(module, 'testedwith', None) | |
970 | return exttestedwith == b"ships-with-hg-core" |
|
974 | return exttestedwith == b"ships-with-hg-core" |
@@ -1,3131 +1,3138 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 --source` can help you understand what is introducing |
|
8 | :hg:`config --source` 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-not-shared`` (per-repository) |
|
57 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) | |
58 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
58 | - ``<repo>/.hg/hgrc`` (per-repository) | |
59 | - ``$HOME/.hgrc`` (per-user) |
|
59 | - ``$HOME/.hgrc`` (per-user) | |
60 | - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user) |
|
60 | - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user) | |
61 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
61 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) | |
62 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
62 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) | |
63 | - ``/etc/mercurial/hgrc`` (per-system) |
|
63 | - ``/etc/mercurial/hgrc`` (per-system) | |
64 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
64 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) | |
65 | - ``<internal>/*.rc`` (defaults) |
|
65 | - ``<internal>/*.rc`` (defaults) | |
66 |
|
66 | |||
67 | .. container:: verbose.windows |
|
67 | .. container:: verbose.windows | |
68 |
|
68 | |||
69 | On Windows, the following files are consulted: |
|
69 | On Windows, the following files are consulted: | |
70 |
|
70 | |||
71 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) |
|
71 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) | |
72 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
72 | - ``<repo>/.hg/hgrc`` (per-repository) | |
73 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
73 | - ``%USERPROFILE%\.hgrc`` (per-user) | |
74 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
74 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) | |
75 | - ``%HOME%\.hgrc`` (per-user) |
|
75 | - ``%HOME%\.hgrc`` (per-user) | |
76 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
76 | - ``%HOME%\Mercurial.ini`` (per-user) | |
77 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system) |
|
77 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-system) | |
78 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
78 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) | |
79 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
79 | - ``<install-dir>\Mercurial.ini`` (per-installation) | |
80 | - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system) |
|
80 | - ``%PROGRAMDATA%\Mercurial\hgrc`` (per-system) | |
81 | - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system) |
|
81 | - ``%PROGRAMDATA%\Mercurial\Mercurial.ini`` (per-system) | |
82 | - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system) |
|
82 | - ``%PROGRAMDATA%\Mercurial\hgrc.d\*.rc`` (per-system) | |
83 | - ``<internal>/*.rc`` (defaults) |
|
83 | - ``<internal>/*.rc`` (defaults) | |
84 |
|
84 | |||
85 | .. note:: |
|
85 | .. note:: | |
86 |
|
86 | |||
87 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
87 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |
88 | is used when running 32-bit Python on 64-bit Windows. |
|
88 | is used when running 32-bit Python on 64-bit Windows. | |
89 |
|
89 | |||
90 | .. container:: verbose.plan9 |
|
90 | .. container:: verbose.plan9 | |
91 |
|
91 | |||
92 | On Plan9, the following files are consulted: |
|
92 | On Plan9, the following files are consulted: | |
93 |
|
93 | |||
94 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) |
|
94 | - ``<repo>/.hg/hgrc-not-shared`` (per-repository) | |
95 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
95 | - ``<repo>/.hg/hgrc`` (per-repository) | |
96 | - ``$home/lib/hgrc`` (per-user) |
|
96 | - ``$home/lib/hgrc`` (per-user) | |
97 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
97 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) | |
98 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
98 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) | |
99 | - ``/lib/mercurial/hgrc`` (per-system) |
|
99 | - ``/lib/mercurial/hgrc`` (per-system) | |
100 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
100 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) | |
101 | - ``<internal>/*.rc`` (defaults) |
|
101 | - ``<internal>/*.rc`` (defaults) | |
102 |
|
102 | |||
103 | Per-repository configuration options only apply in a |
|
103 | Per-repository configuration options only apply in a | |
104 | particular repository. This file is not version-controlled, and |
|
104 | particular repository. This file is not version-controlled, and | |
105 | will not get transferred during a "clone" operation. Options in |
|
105 | will not get transferred during a "clone" operation. Options in | |
106 | this file override options in all other configuration files. |
|
106 | this file override options in all other configuration files. | |
107 |
|
107 | |||
108 | .. container:: unix.plan9 |
|
108 | .. container:: unix.plan9 | |
109 |
|
109 | |||
110 | On Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
110 | On Plan 9 and Unix, most of this file will be ignored if it doesn't | |
111 | belong to a trusted user or to a trusted group. See |
|
111 | belong to a trusted user or to a trusted group. See | |
112 | :hg:`help config.trusted` for more details. |
|
112 | :hg:`help config.trusted` for more details. | |
113 |
|
113 | |||
114 | Per-user configuration file(s) are for the user running Mercurial. Options |
|
114 | Per-user configuration file(s) are for the user running Mercurial. Options | |
115 | in these files apply to all Mercurial commands executed by this user in any |
|
115 | in these files apply to all Mercurial commands executed by this user in any | |
116 | directory. Options in these files override per-system and per-installation |
|
116 | directory. Options in these files override per-system and per-installation | |
117 | options. |
|
117 | options. | |
118 |
|
118 | |||
119 | Per-installation configuration files are searched for in the |
|
119 | Per-installation configuration files are searched for in the | |
120 | directory where Mercurial is installed. ``<install-root>`` is the |
|
120 | directory where Mercurial is installed. ``<install-root>`` is the | |
121 | parent directory of the **hg** executable (or symlink) being run. |
|
121 | parent directory of the **hg** executable (or symlink) being run. | |
122 |
|
122 | |||
123 | .. container:: unix.plan9 |
|
123 | .. container:: unix.plan9 | |
124 |
|
124 | |||
125 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial |
|
125 | For example, if installed in ``/shared/tools/bin/hg``, Mercurial | |
126 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these |
|
126 | will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these | |
127 | files apply to all Mercurial commands executed by any user in any |
|
127 | files apply to all Mercurial commands executed by any user in any | |
128 | directory. |
|
128 | directory. | |
129 |
|
129 | |||
130 | Per-installation configuration files are for the system on |
|
130 | Per-installation configuration files are for the system on | |
131 | which Mercurial is running. Options in these files apply to all |
|
131 | which Mercurial is running. Options in these files apply to all | |
132 | Mercurial commands executed by any user in any directory. Registry |
|
132 | Mercurial commands executed by any user in any directory. Registry | |
133 | keys contain PATH-like strings, every part of which must reference |
|
133 | keys contain PATH-like strings, every part of which must reference | |
134 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
134 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
135 | be read. Mercurial checks each of these locations in the specified |
|
135 | be read. Mercurial checks each of these locations in the specified | |
136 | order until one or more configuration files are detected. |
|
136 | order until one or more configuration files are detected. | |
137 |
|
137 | |||
138 | Per-system configuration files are for the system on which Mercurial |
|
138 | Per-system configuration files are for the system on which Mercurial | |
139 | is running. Options in these files apply to all Mercurial commands |
|
139 | is running. Options in these files apply to all Mercurial commands | |
140 | executed by any user in any directory. Options in these files |
|
140 | executed by any user in any directory. Options in these files | |
141 | override per-installation options. |
|
141 | override per-installation options. | |
142 |
|
142 | |||
143 | Mercurial comes with some default configuration. The default configuration |
|
143 | Mercurial comes with some default configuration. The default configuration | |
144 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
144 | files are installed with Mercurial and will be overwritten on upgrades. Default | |
145 | configuration files should never be edited by users or administrators but can |
|
145 | configuration files should never be edited by users or administrators but can | |
146 | be overridden in other configuration files. So far the directory only contains |
|
146 | be overridden in other configuration files. So far the directory only contains | |
147 | merge tool configuration but packagers can also put other default configuration |
|
147 | merge tool configuration but packagers can also put other default configuration | |
148 | there. |
|
148 | there. | |
149 |
|
149 | |||
150 | On versions 5.7 and later, if share-safe functionality is enabled, |
|
150 | On versions 5.7 and later, if share-safe functionality is enabled, | |
151 | shares will read config file of share source too. |
|
151 | shares will read config file of share source too. | |
152 | `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`. |
|
152 | `<share-source/.hg/hgrc>` is read before reading `<repo/.hg/hgrc>`. | |
153 |
|
153 | |||
154 | For configs which should not be shared, `<repo/.hg/hgrc-not-shared>` |
|
154 | For configs which should not be shared, `<repo/.hg/hgrc-not-shared>` | |
155 | should be used. |
|
155 | should be used. | |
156 |
|
156 | |||
157 | Syntax |
|
157 | Syntax | |
158 | ====== |
|
158 | ====== | |
159 |
|
159 | |||
160 | A configuration file consists of sections, led by a ``[section]`` header |
|
160 | A configuration file consists of sections, led by a ``[section]`` header | |
161 | and followed by ``name = value`` entries (sometimes called |
|
161 | and followed by ``name = value`` entries (sometimes called | |
162 | ``configuration keys``):: |
|
162 | ``configuration keys``):: | |
163 |
|
163 | |||
164 | [spam] |
|
164 | [spam] | |
165 | eggs=ham |
|
165 | eggs=ham | |
166 | green= |
|
166 | green= | |
167 | eggs |
|
167 | eggs | |
168 |
|
168 | |||
169 | Each line contains one entry. If the lines that follow are indented, |
|
169 | Each line contains one entry. If the lines that follow are indented, | |
170 | they are treated as continuations of that entry. Leading whitespace is |
|
170 | they are treated as continuations of that entry. Leading whitespace is | |
171 | removed from values. Empty lines are skipped. Lines beginning with |
|
171 | removed from values. Empty lines are skipped. Lines beginning with | |
172 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
172 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
173 |
|
173 | |||
174 | Configuration keys can be set multiple times, in which case Mercurial |
|
174 | Configuration keys can be set multiple times, in which case Mercurial | |
175 | will use the value that was configured last. As an example:: |
|
175 | will use the value that was configured last. As an example:: | |
176 |
|
176 | |||
177 | [spam] |
|
177 | [spam] | |
178 | eggs=large |
|
178 | eggs=large | |
179 | ham=serrano |
|
179 | ham=serrano | |
180 | eggs=small |
|
180 | eggs=small | |
181 |
|
181 | |||
182 | This would set the configuration key named ``eggs`` to ``small``. |
|
182 | This would set the configuration key named ``eggs`` to ``small``. | |
183 |
|
183 | |||
184 | It is also possible to define a section multiple times. A section can |
|
184 | It is also possible to define a section multiple times. A section can | |
185 | be redefined on the same and/or on different configuration files. For |
|
185 | be redefined on the same and/or on different configuration files. For | |
186 | example:: |
|
186 | example:: | |
187 |
|
187 | |||
188 | [foo] |
|
188 | [foo] | |
189 | eggs=large |
|
189 | eggs=large | |
190 | ham=serrano |
|
190 | ham=serrano | |
191 | eggs=small |
|
191 | eggs=small | |
192 |
|
192 | |||
193 | [bar] |
|
193 | [bar] | |
194 | eggs=ham |
|
194 | eggs=ham | |
195 | green= |
|
195 | green= | |
196 | eggs |
|
196 | eggs | |
197 |
|
197 | |||
198 | [foo] |
|
198 | [foo] | |
199 | ham=prosciutto |
|
199 | ham=prosciutto | |
200 | eggs=medium |
|
200 | eggs=medium | |
201 | bread=toasted |
|
201 | bread=toasted | |
202 |
|
202 | |||
203 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
203 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
204 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
204 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
205 | respectively. As you can see there only thing that matters is the last |
|
205 | respectively. As you can see there only thing that matters is the last | |
206 | value that was set for each of the configuration keys. |
|
206 | value that was set for each of the configuration keys. | |
207 |
|
207 | |||
208 | If a configuration key is set multiple times in different |
|
208 | If a configuration key is set multiple times in different | |
209 | configuration files the final value will depend on the order in which |
|
209 | configuration files the final value will depend on the order in which | |
210 | the different configuration files are read, with settings from earlier |
|
210 | the different configuration files are read, with settings from earlier | |
211 | paths overriding later ones as described on the ``Files`` section |
|
211 | paths overriding later ones as described on the ``Files`` section | |
212 | above. |
|
212 | above. | |
213 |
|
213 | |||
214 | A line of the form ``%include file`` will include ``file`` into the |
|
214 | A line of the form ``%include file`` will include ``file`` into the | |
215 | current configuration file. The inclusion is recursive, which means |
|
215 | current configuration file. The inclusion is recursive, which means | |
216 | that included files can include other files. Filenames are relative to |
|
216 | that included files can include other files. Filenames are relative to | |
217 | the configuration file in which the ``%include`` directive is found. |
|
217 | the configuration file in which the ``%include`` directive is found. | |
218 | Environment variables and ``~user`` constructs are expanded in |
|
218 | Environment variables and ``~user`` constructs are expanded in | |
219 | ``file``. This lets you do something like:: |
|
219 | ``file``. This lets you do something like:: | |
220 |
|
220 | |||
221 | %include ~/.hgrc.d/$HOST.rc |
|
221 | %include ~/.hgrc.d/$HOST.rc | |
222 |
|
222 | |||
223 | to include a different configuration file on each computer you use. |
|
223 | to include a different configuration file on each computer you use. | |
224 |
|
224 | |||
225 | A line with ``%unset name`` will remove ``name`` from the current |
|
225 | A line with ``%unset name`` will remove ``name`` from the current | |
226 | section, if it has been set previously. |
|
226 | section, if it has been set previously. | |
227 |
|
227 | |||
228 | The values are either free-form text strings, lists of text strings, |
|
228 | The values are either free-form text strings, lists of text strings, | |
229 | or Boolean values. Boolean values can be set to true using any of "1", |
|
229 | or Boolean values. Boolean values can be set to true using any of "1", | |
230 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
230 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
231 | (all case insensitive). |
|
231 | (all case insensitive). | |
232 |
|
232 | |||
233 | List values are separated by whitespace or comma, except when values are |
|
233 | List values are separated by whitespace or comma, except when values are | |
234 | placed in double quotation marks:: |
|
234 | placed in double quotation marks:: | |
235 |
|
235 | |||
236 | allow_read = "John Doe, PhD", brian, betty |
|
236 | allow_read = "John Doe, PhD", brian, betty | |
237 |
|
237 | |||
238 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
238 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
239 | quotation marks at the beginning of a word is counted as a quotation |
|
239 | quotation marks at the beginning of a word is counted as a quotation | |
240 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
240 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
241 |
|
241 | |||
242 | Sections |
|
242 | Sections | |
243 | ======== |
|
243 | ======== | |
244 |
|
244 | |||
245 | This section describes the different sections that may appear in a |
|
245 | This section describes the different sections that may appear in a | |
246 | Mercurial configuration file, the purpose of each section, its possible |
|
246 | Mercurial configuration file, the purpose of each section, its possible | |
247 | keys, and their possible values. |
|
247 | keys, and their possible values. | |
248 |
|
248 | |||
249 | ``alias`` |
|
249 | ``alias`` | |
250 | --------- |
|
250 | --------- | |
251 |
|
251 | |||
252 | Defines command aliases. |
|
252 | Defines command aliases. | |
253 |
|
253 | |||
254 | Aliases allow you to define your own commands in terms of other |
|
254 | Aliases allow you to define your own commands in terms of other | |
255 | commands (or aliases), optionally including arguments. Positional |
|
255 | commands (or aliases), optionally including arguments. Positional | |
256 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
256 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition | |
257 | are expanded by Mercurial before execution. Positional arguments not |
|
257 | are expanded by Mercurial before execution. Positional arguments not | |
258 | already used by ``$N`` in the definition are put at the end of the |
|
258 | already used by ``$N`` in the definition are put at the end of the | |
259 | command to be executed. |
|
259 | command to be executed. | |
260 |
|
260 | |||
261 | Alias definitions consist of lines of the form:: |
|
261 | Alias definitions consist of lines of the form:: | |
262 |
|
262 | |||
263 | <alias> = <command> [<argument>]... |
|
263 | <alias> = <command> [<argument>]... | |
264 |
|
264 | |||
265 | For example, this definition:: |
|
265 | For example, this definition:: | |
266 |
|
266 | |||
267 | latest = log --limit 5 |
|
267 | latest = log --limit 5 | |
268 |
|
268 | |||
269 | creates a new command ``latest`` that shows only the five most recent |
|
269 | creates a new command ``latest`` that shows only the five most recent | |
270 | changesets. You can define subsequent aliases using earlier ones:: |
|
270 | changesets. You can define subsequent aliases using earlier ones:: | |
271 |
|
271 | |||
272 | stable5 = latest -b stable |
|
272 | stable5 = latest -b stable | |
273 |
|
273 | |||
274 | .. note:: |
|
274 | .. note:: | |
275 |
|
275 | |||
276 | It is possible to create aliases with the same names as |
|
276 | It is possible to create aliases with the same names as | |
277 | existing commands, which will then override the original |
|
277 | existing commands, which will then override the original | |
278 | definitions. This is almost always a bad idea! |
|
278 | definitions. This is almost always a bad idea! | |
279 |
|
279 | |||
280 | An alias can start with an exclamation point (``!``) to make it a |
|
280 | An alias can start with an exclamation point (``!``) to make it a | |
281 | shell alias. A shell alias is executed with the shell and will let you |
|
281 | shell alias. A shell alias is executed with the shell and will let you | |
282 | run arbitrary commands. As an example, :: |
|
282 | run arbitrary commands. As an example, :: | |
283 |
|
283 | |||
284 | echo = !echo $@ |
|
284 | echo = !echo $@ | |
285 |
|
285 | |||
286 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
286 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
287 | terminal. A better example might be:: |
|
287 | terminal. A better example might be:: | |
288 |
|
288 | |||
289 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f |
|
289 | purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f | |
290 |
|
290 | |||
291 | which will make ``hg purge`` delete all unknown files in the |
|
291 | which will make ``hg purge`` delete all unknown files in the | |
292 | repository in the same manner as the purge extension. |
|
292 | repository in the same manner as the purge extension. | |
293 |
|
293 | |||
294 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
294 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
295 | expand to the command arguments. Unmatched arguments are |
|
295 | expand to the command arguments. Unmatched arguments are | |
296 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
296 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
297 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
297 | arguments separated by a space. ``"$@"`` (with quotes) expands to all | |
298 | arguments quoted individually and separated by a space. These expansions |
|
298 | arguments quoted individually and separated by a space. These expansions | |
299 | happen before the command is passed to the shell. |
|
299 | happen before the command is passed to the shell. | |
300 |
|
300 | |||
301 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
301 | Shell aliases are executed in an environment where ``$HG`` expands to | |
302 | the path of the Mercurial that was used to execute the alias. This is |
|
302 | the path of the Mercurial that was used to execute the alias. This is | |
303 | useful when you want to call further Mercurial commands in a shell |
|
303 | useful when you want to call further Mercurial commands in a shell | |
304 | alias, as was done above for the purge alias. In addition, |
|
304 | alias, as was done above for the purge alias. In addition, | |
305 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
305 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
306 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
306 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
307 |
|
307 | |||
308 | .. note:: |
|
308 | .. note:: | |
309 |
|
309 | |||
310 | Some global configuration options such as ``-R`` are |
|
310 | Some global configuration options such as ``-R`` are | |
311 | processed before shell aliases and will thus not be passed to |
|
311 | processed before shell aliases and will thus not be passed to | |
312 | aliases. |
|
312 | aliases. | |
313 |
|
313 | |||
314 |
|
314 | |||
315 | ``annotate`` |
|
315 | ``annotate`` | |
316 | ------------ |
|
316 | ------------ | |
317 |
|
317 | |||
318 | Settings used when displaying file annotations. All values are |
|
318 | Settings used when displaying file annotations. All values are | |
319 | Booleans and default to False. See :hg:`help config.diff` for |
|
319 | Booleans and default to False. See :hg:`help config.diff` for | |
320 | related options for the diff command. |
|
320 | related options for the diff command. | |
321 |
|
321 | |||
322 | ``ignorews`` |
|
322 | ``ignorews`` | |
323 | Ignore white space when comparing lines. |
|
323 | Ignore white space when comparing lines. | |
324 |
|
324 | |||
325 | ``ignorewseol`` |
|
325 | ``ignorewseol`` | |
326 | Ignore white space at the end of a line when comparing lines. |
|
326 | Ignore white space at the end of a line when comparing lines. | |
327 |
|
327 | |||
328 | ``ignorewsamount`` |
|
328 | ``ignorewsamount`` | |
329 | Ignore changes in the amount of white space. |
|
329 | Ignore changes in the amount of white space. | |
330 |
|
330 | |||
331 | ``ignoreblanklines`` |
|
331 | ``ignoreblanklines`` | |
332 | Ignore changes whose lines are all blank. |
|
332 | Ignore changes whose lines are all blank. | |
333 |
|
333 | |||
334 |
|
334 | |||
335 | ``auth`` |
|
335 | ``auth`` | |
336 | -------- |
|
336 | -------- | |
337 |
|
337 | |||
338 | Authentication credentials and other authentication-like configuration |
|
338 | Authentication credentials and other authentication-like configuration | |
339 | for HTTP connections. This section allows you to store usernames and |
|
339 | for HTTP connections. This section allows you to store usernames and | |
340 | passwords for use when logging *into* HTTP servers. See |
|
340 | passwords for use when logging *into* HTTP servers. See | |
341 | :hg:`help config.web` if you want to configure *who* can login to |
|
341 | :hg:`help config.web` if you want to configure *who* can login to | |
342 | your HTTP server. |
|
342 | your HTTP server. | |
343 |
|
343 | |||
344 | The following options apply to all hosts. |
|
344 | The following options apply to all hosts. | |
345 |
|
345 | |||
346 | ``cookiefile`` |
|
346 | ``cookiefile`` | |
347 | Path to a file containing HTTP cookie lines. Cookies matching a |
|
347 | Path to a file containing HTTP cookie lines. Cookies matching a | |
348 | host will be sent automatically. |
|
348 | host will be sent automatically. | |
349 |
|
349 | |||
350 | The file format uses the Mozilla cookies.txt format, which defines cookies |
|
350 | The file format uses the Mozilla cookies.txt format, which defines cookies | |
351 | on their own lines. Each line contains 7 fields delimited by the tab |
|
351 | on their own lines. Each line contains 7 fields delimited by the tab | |
352 | character (domain, is_domain_cookie, path, is_secure, expires, name, |
|
352 | character (domain, is_domain_cookie, path, is_secure, expires, name, | |
353 | value). For more info, do an Internet search for "Netscape cookies.txt |
|
353 | value). For more info, do an Internet search for "Netscape cookies.txt | |
354 | format." |
|
354 | format." | |
355 |
|
355 | |||
356 | Note: the cookies parser does not handle port numbers on domains. You |
|
356 | Note: the cookies parser does not handle port numbers on domains. You | |
357 | will need to remove ports from the domain for the cookie to be recognized. |
|
357 | will need to remove ports from the domain for the cookie to be recognized. | |
358 | This could result in a cookie being disclosed to an unwanted server. |
|
358 | This could result in a cookie being disclosed to an unwanted server. | |
359 |
|
359 | |||
360 | The cookies file is read-only. |
|
360 | The cookies file is read-only. | |
361 |
|
361 | |||
362 | Other options in this section are grouped by name and have the following |
|
362 | Other options in this section are grouped by name and have the following | |
363 | format:: |
|
363 | format:: | |
364 |
|
364 | |||
365 | <name>.<argument> = <value> |
|
365 | <name>.<argument> = <value> | |
366 |
|
366 | |||
367 | where ``<name>`` is used to group arguments into authentication |
|
367 | where ``<name>`` is used to group arguments into authentication | |
368 | entries. Example:: |
|
368 | entries. Example:: | |
369 |
|
369 | |||
370 | foo.prefix = hg.intevation.de/mercurial |
|
370 | foo.prefix = hg.intevation.de/mercurial | |
371 | foo.username = foo |
|
371 | foo.username = foo | |
372 | foo.password = bar |
|
372 | foo.password = bar | |
373 | foo.schemes = http https |
|
373 | foo.schemes = http https | |
374 |
|
374 | |||
375 | bar.prefix = secure.example.org |
|
375 | bar.prefix = secure.example.org | |
376 | bar.key = path/to/file.key |
|
376 | bar.key = path/to/file.key | |
377 | bar.cert = path/to/file.cert |
|
377 | bar.cert = path/to/file.cert | |
378 | bar.schemes = https |
|
378 | bar.schemes = https | |
379 |
|
379 | |||
380 | Supported arguments: |
|
380 | Supported arguments: | |
381 |
|
381 | |||
382 | ``prefix`` |
|
382 | ``prefix`` | |
383 | Either ``*`` or a URI prefix with or without the scheme part. |
|
383 | Either ``*`` or a URI prefix with or without the scheme part. | |
384 | The authentication entry with the longest matching prefix is used |
|
384 | The authentication entry with the longest matching prefix is used | |
385 | (where ``*`` matches everything and counts as a match of length |
|
385 | (where ``*`` matches everything and counts as a match of length | |
386 | 1). If the prefix doesn't include a scheme, the match is performed |
|
386 | 1). If the prefix doesn't include a scheme, the match is performed | |
387 | against the URI with its scheme stripped as well, and the schemes |
|
387 | against the URI with its scheme stripped as well, and the schemes | |
388 | argument, q.v., is then subsequently consulted. |
|
388 | argument, q.v., is then subsequently consulted. | |
389 |
|
389 | |||
390 | ``username`` |
|
390 | ``username`` | |
391 | Optional. Username to authenticate with. If not given, and the |
|
391 | Optional. Username to authenticate with. If not given, and the | |
392 | remote site requires basic or digest authentication, the user will |
|
392 | remote site requires basic or digest authentication, the user will | |
393 | be prompted for it. Environment variables are expanded in the |
|
393 | be prompted for it. Environment variables are expanded in the | |
394 | username letting you do ``foo.username = $USER``. If the URI |
|
394 | username letting you do ``foo.username = $USER``. If the URI | |
395 | includes a username, only ``[auth]`` entries with a matching |
|
395 | includes a username, only ``[auth]`` entries with a matching | |
396 | username or without a username will be considered. |
|
396 | username or without a username will be considered. | |
397 |
|
397 | |||
398 | ``password`` |
|
398 | ``password`` | |
399 | Optional. Password to authenticate with. If not given, and the |
|
399 | Optional. Password to authenticate with. If not given, and the | |
400 | remote site requires basic or digest authentication, the user |
|
400 | remote site requires basic or digest authentication, the user | |
401 | will be prompted for it. |
|
401 | will be prompted for it. | |
402 |
|
402 | |||
403 | ``key`` |
|
403 | ``key`` | |
404 | Optional. PEM encoded client certificate key file. Environment |
|
404 | Optional. PEM encoded client certificate key file. Environment | |
405 | variables are expanded in the filename. |
|
405 | variables are expanded in the filename. | |
406 |
|
406 | |||
407 | ``cert`` |
|
407 | ``cert`` | |
408 | Optional. PEM encoded client certificate chain file. Environment |
|
408 | Optional. PEM encoded client certificate chain file. Environment | |
409 | variables are expanded in the filename. |
|
409 | variables are expanded in the filename. | |
410 |
|
410 | |||
411 | ``schemes`` |
|
411 | ``schemes`` | |
412 | Optional. Space separated list of URI schemes to use this |
|
412 | Optional. Space separated list of URI schemes to use this | |
413 | authentication entry with. Only used if the prefix doesn't include |
|
413 | authentication entry with. Only used if the prefix doesn't include | |
414 | a scheme. Supported schemes are http and https. They will match |
|
414 | a scheme. Supported schemes are http and https. They will match | |
415 | static-http and static-https respectively, as well. |
|
415 | static-http and static-https respectively, as well. | |
416 | (default: https) |
|
416 | (default: https) | |
417 |
|
417 | |||
418 | If no suitable authentication entry is found, the user is prompted |
|
418 | If no suitable authentication entry is found, the user is prompted | |
419 | for credentials as usual if required by the remote. |
|
419 | for credentials as usual if required by the remote. | |
420 |
|
420 | |||
421 | ``cmdserver`` |
|
421 | ``cmdserver`` | |
422 | ------------- |
|
422 | ------------- | |
423 |
|
423 | |||
424 | Controls command server settings. (ADVANCED) |
|
424 | Controls command server settings. (ADVANCED) | |
425 |
|
425 | |||
426 | ``message-encodings`` |
|
426 | ``message-encodings`` | |
427 | List of encodings for the ``m`` (message) channel. The first encoding |
|
427 | List of encodings for the ``m`` (message) channel. The first encoding | |
428 | supported by the server will be selected and advertised in the hello |
|
428 | supported by the server will be selected and advertised in the hello | |
429 | message. This is useful only when ``ui.message-output`` is set to |
|
429 | message. This is useful only when ``ui.message-output`` is set to | |
430 | ``channel``. Supported encodings are ``cbor``. |
|
430 | ``channel``. Supported encodings are ``cbor``. | |
431 |
|
431 | |||
432 | ``shutdown-on-interrupt`` |
|
432 | ``shutdown-on-interrupt`` | |
433 | If set to false, the server's main loop will continue running after |
|
433 | If set to false, the server's main loop will continue running after | |
434 | SIGINT received. ``runcommand`` requests can still be interrupted by |
|
434 | SIGINT received. ``runcommand`` requests can still be interrupted by | |
435 | SIGINT. Close the write end of the pipe to shut down the server |
|
435 | SIGINT. Close the write end of the pipe to shut down the server | |
436 | process gracefully. |
|
436 | process gracefully. | |
437 | (default: True) |
|
437 | (default: True) | |
438 |
|
438 | |||
439 | ``color`` |
|
439 | ``color`` | |
440 | --------- |
|
440 | --------- | |
441 |
|
441 | |||
442 | Configure the Mercurial color mode. For details about how to define your custom |
|
442 | Configure the Mercurial color mode. For details about how to define your custom | |
443 | effect and style see :hg:`help color`. |
|
443 | effect and style see :hg:`help color`. | |
444 |
|
444 | |||
445 | ``mode`` |
|
445 | ``mode`` | |
446 | String: control the method used to output color. One of ``auto``, ``ansi``, |
|
446 | String: control the method used to output color. One of ``auto``, ``ansi``, | |
447 | ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will |
|
447 | ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will | |
448 | use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a |
|
448 | use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a | |
449 | terminal. Any invalid value will disable color. |
|
449 | terminal. Any invalid value will disable color. | |
450 |
|
450 | |||
451 | ``pagermode`` |
|
451 | ``pagermode`` | |
452 | String: optional override of ``color.mode`` used with pager. |
|
452 | String: optional override of ``color.mode`` used with pager. | |
453 |
|
453 | |||
454 | On some systems, terminfo mode may cause problems when using |
|
454 | On some systems, terminfo mode may cause problems when using | |
455 | color with ``less -R`` as a pager program. less with the -R option |
|
455 | color with ``less -R`` as a pager program. less with the -R option | |
456 | will only display ECMA-48 color codes, and terminfo mode may sometimes |
|
456 | will only display ECMA-48 color codes, and terminfo mode may sometimes | |
457 | emit codes that less doesn't understand. You can work around this by |
|
457 | emit codes that less doesn't understand. You can work around this by | |
458 | either using ansi mode (or auto mode), or by using less -r (which will |
|
458 | either using ansi mode (or auto mode), or by using less -r (which will | |
459 | pass through all terminal control codes, not just color control |
|
459 | pass through all terminal control codes, not just color control | |
460 | codes). |
|
460 | codes). | |
461 |
|
461 | |||
462 | On some systems (such as MSYS in Windows), the terminal may support |
|
462 | On some systems (such as MSYS in Windows), the terminal may support | |
463 | a different color mode than the pager program. |
|
463 | a different color mode than the pager program. | |
464 |
|
464 | |||
465 | ``commands`` |
|
465 | ``commands`` | |
466 | ------------ |
|
466 | ------------ | |
467 |
|
467 | |||
468 | ``commit.post-status`` |
|
468 | ``commit.post-status`` | |
469 | Show status of files in the working directory after successful commit. |
|
469 | Show status of files in the working directory after successful commit. | |
470 | (default: False) |
|
470 | (default: False) | |
471 |
|
471 | |||
472 | ``merge.require-rev`` |
|
472 | ``merge.require-rev`` | |
473 | Require that the revision to merge the current commit with be specified on |
|
473 | Require that the revision to merge the current commit with be specified on | |
474 | the command line. If this is enabled and a revision is not specified, the |
|
474 | the command line. If this is enabled and a revision is not specified, the | |
475 | command aborts. |
|
475 | command aborts. | |
476 | (default: False) |
|
476 | (default: False) | |
477 |
|
477 | |||
478 | ``push.require-revs`` |
|
478 | ``push.require-revs`` | |
479 | Require revisions to push be specified using one or more mechanisms such as |
|
479 | Require revisions to push be specified using one or more mechanisms such as | |
480 | specifying them positionally on the command line, using ``-r``, ``-b``, |
|
480 | specifying them positionally on the command line, using ``-r``, ``-b``, | |
481 | and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the |
|
481 | and/or ``-B`` on the command line, or using ``paths.<path>:pushrev`` in the | |
482 | configuration. If this is enabled and revisions are not specified, the |
|
482 | configuration. If this is enabled and revisions are not specified, the | |
483 | command aborts. |
|
483 | command aborts. | |
484 | (default: False) |
|
484 | (default: False) | |
485 |
|
485 | |||
486 | ``resolve.confirm`` |
|
486 | ``resolve.confirm`` | |
487 | Confirm before performing action if no filename is passed. |
|
487 | Confirm before performing action if no filename is passed. | |
488 | (default: False) |
|
488 | (default: False) | |
489 |
|
489 | |||
490 | ``resolve.explicit-re-merge`` |
|
490 | ``resolve.explicit-re-merge`` | |
491 | Require uses of ``hg resolve`` to specify which action it should perform, |
|
491 | Require uses of ``hg resolve`` to specify which action it should perform, | |
492 | instead of re-merging files by default. |
|
492 | instead of re-merging files by default. | |
493 | (default: False) |
|
493 | (default: False) | |
494 |
|
494 | |||
495 | ``resolve.mark-check`` |
|
495 | ``resolve.mark-check`` | |
496 | Determines what level of checking :hg:`resolve --mark` will perform before |
|
496 | Determines what level of checking :hg:`resolve --mark` will perform before | |
497 | marking files as resolved. Valid values are ``none`, ``warn``, and |
|
497 | marking files as resolved. Valid values are ``none`, ``warn``, and | |
498 | ``abort``. ``warn`` will output a warning listing the file(s) that still |
|
498 | ``abort``. ``warn`` will output a warning listing the file(s) that still | |
499 | have conflict markers in them, but will still mark everything resolved. |
|
499 | have conflict markers in them, but will still mark everything resolved. | |
500 | ``abort`` will output the same warning but will not mark things as resolved. |
|
500 | ``abort`` will output the same warning but will not mark things as resolved. | |
501 | If --all is passed and this is set to ``abort``, only a warning will be |
|
501 | If --all is passed and this is set to ``abort``, only a warning will be | |
502 | shown (an error will not be raised). |
|
502 | shown (an error will not be raised). | |
503 | (default: ``none``) |
|
503 | (default: ``none``) | |
504 |
|
504 | |||
505 | ``status.relative`` |
|
505 | ``status.relative`` | |
506 | Make paths in :hg:`status` output relative to the current directory. |
|
506 | Make paths in :hg:`status` output relative to the current directory. | |
507 | (default: False) |
|
507 | (default: False) | |
508 |
|
508 | |||
509 | ``status.terse`` |
|
509 | ``status.terse`` | |
510 | Default value for the --terse flag, which condenses status output. |
|
510 | Default value for the --terse flag, which condenses status output. | |
511 | (default: empty) |
|
511 | (default: empty) | |
512 |
|
512 | |||
513 | ``update.check`` |
|
513 | ``update.check`` | |
514 | Determines what level of checking :hg:`update` will perform before moving |
|
514 | Determines what level of checking :hg:`update` will perform before moving | |
515 | to a destination revision. Valid values are ``abort``, ``none``, |
|
515 | to a destination revision. Valid values are ``abort``, ``none``, | |
516 | ``linear``, and ``noconflict``. ``abort`` always fails if the working |
|
516 | ``linear``, and ``noconflict``. ``abort`` always fails if the working | |
517 | directory has uncommitted changes. ``none`` performs no checking, and may |
|
517 | directory has uncommitted changes. ``none`` performs no checking, and may | |
518 | result in a merge with uncommitted changes. ``linear`` allows any update |
|
518 | result in a merge with uncommitted changes. ``linear`` allows any update | |
519 | as long as it follows a straight line in the revision history, and may |
|
519 | as long as it follows a straight line in the revision history, and may | |
520 | trigger a merge with uncommitted changes. ``noconflict`` will allow any |
|
520 | trigger a merge with uncommitted changes. ``noconflict`` will allow any | |
521 | update which would not trigger a merge with uncommitted changes, if any |
|
521 | update which would not trigger a merge with uncommitted changes, if any | |
522 | are present. |
|
522 | are present. | |
523 | (default: ``linear``) |
|
523 | (default: ``linear``) | |
524 |
|
524 | |||
525 | ``update.requiredest`` |
|
525 | ``update.requiredest`` | |
526 | Require that the user pass a destination when running :hg:`update`. |
|
526 | Require that the user pass a destination when running :hg:`update`. | |
527 | For example, :hg:`update .::` will be allowed, but a plain :hg:`update` |
|
527 | For example, :hg:`update .::` will be allowed, but a plain :hg:`update` | |
528 | will be disallowed. |
|
528 | will be disallowed. | |
529 | (default: False) |
|
529 | (default: False) | |
530 |
|
530 | |||
531 | ``committemplate`` |
|
531 | ``committemplate`` | |
532 | ------------------ |
|
532 | ------------------ | |
533 |
|
533 | |||
534 | ``changeset`` |
|
534 | ``changeset`` | |
535 | String: configuration in this section is used as the template to |
|
535 | String: configuration in this section is used as the template to | |
536 | customize the text shown in the editor when committing. |
|
536 | customize the text shown in the editor when committing. | |
537 |
|
537 | |||
538 | In addition to pre-defined template keywords, commit log specific one |
|
538 | In addition to pre-defined template keywords, commit log specific one | |
539 | below can be used for customization: |
|
539 | below can be used for customization: | |
540 |
|
540 | |||
541 | ``extramsg`` |
|
541 | ``extramsg`` | |
542 | String: Extra message (typically 'Leave message empty to abort |
|
542 | String: Extra message (typically 'Leave message empty to abort | |
543 | commit.'). This may be changed by some commands or extensions. |
|
543 | commit.'). This may be changed by some commands or extensions. | |
544 |
|
544 | |||
545 | For example, the template configuration below shows as same text as |
|
545 | For example, the template configuration below shows as same text as | |
546 | one shown by default:: |
|
546 | one shown by default:: | |
547 |
|
547 | |||
548 | [committemplate] |
|
548 | [committemplate] | |
549 | changeset = {desc}\n\n |
|
549 | changeset = {desc}\n\n | |
550 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
550 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
551 | HG: {extramsg} |
|
551 | HG: {extramsg} | |
552 | HG: -- |
|
552 | HG: -- | |
553 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
553 | HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
554 | "HG: branch merge\n") |
|
554 | "HG: branch merge\n") | |
555 | }HG: branch '{branch}'\n{if(activebookmark, |
|
555 | }HG: branch '{branch}'\n{if(activebookmark, | |
556 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
556 | "HG: bookmark '{activebookmark}'\n") }{subrepos % | |
557 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
557 | "HG: subrepo {subrepo}\n" }{file_adds % | |
558 | "HG: added {file}\n" }{file_mods % |
|
558 | "HG: added {file}\n" }{file_mods % | |
559 | "HG: changed {file}\n" }{file_dels % |
|
559 | "HG: changed {file}\n" }{file_dels % | |
560 | "HG: removed {file}\n" }{if(files, "", |
|
560 | "HG: removed {file}\n" }{if(files, "", | |
561 | "HG: no files changed\n")} |
|
561 | "HG: no files changed\n")} | |
562 |
|
562 | |||
563 | ``diff()`` |
|
563 | ``diff()`` | |
564 | String: show the diff (see :hg:`help templates` for detail) |
|
564 | String: show the diff (see :hg:`help templates` for detail) | |
565 |
|
565 | |||
566 | Sometimes it is helpful to show the diff of the changeset in the editor without |
|
566 | Sometimes it is helpful to show the diff of the changeset in the editor without | |
567 | having to prefix 'HG: ' to each line so that highlighting works correctly. For |
|
567 | having to prefix 'HG: ' to each line so that highlighting works correctly. For | |
568 | this, Mercurial provides a special string which will ignore everything below |
|
568 | this, Mercurial provides a special string which will ignore everything below | |
569 | it:: |
|
569 | it:: | |
570 |
|
570 | |||
571 | HG: ------------------------ >8 ------------------------ |
|
571 | HG: ------------------------ >8 ------------------------ | |
572 |
|
572 | |||
573 | For example, the template configuration below will show the diff below the |
|
573 | For example, the template configuration below will show the diff below the | |
574 | extra message:: |
|
574 | extra message:: | |
575 |
|
575 | |||
576 | [committemplate] |
|
576 | [committemplate] | |
577 | changeset = {desc}\n\n |
|
577 | changeset = {desc}\n\n | |
578 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
578 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
579 | HG: {extramsg} |
|
579 | HG: {extramsg} | |
580 | HG: ------------------------ >8 ------------------------ |
|
580 | HG: ------------------------ >8 ------------------------ | |
581 | HG: Do not touch the line above. |
|
581 | HG: Do not touch the line above. | |
582 | HG: Everything below will be removed. |
|
582 | HG: Everything below will be removed. | |
583 | {diff()} |
|
583 | {diff()} | |
584 |
|
584 | |||
585 | .. note:: |
|
585 | .. note:: | |
586 |
|
586 | |||
587 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
587 | For some problematic encodings (see :hg:`help win32mbcs` for | |
588 | detail), this customization should be configured carefully, to |
|
588 | detail), this customization should be configured carefully, to | |
589 | avoid showing broken characters. |
|
589 | avoid showing broken characters. | |
590 |
|
590 | |||
591 | For example, if a multibyte character ending with backslash (0x5c) is |
|
591 | For example, if a multibyte character ending with backslash (0x5c) is | |
592 | followed by the ASCII character 'n' in the customized template, |
|
592 | followed by the ASCII character 'n' in the customized template, | |
593 | the sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
593 | the sequence of backslash and 'n' is treated as line-feed unexpectedly | |
594 | (and the multibyte character is broken, too). |
|
594 | (and the multibyte character is broken, too). | |
595 |
|
595 | |||
596 | Customized template is used for commands below (``--edit`` may be |
|
596 | Customized template is used for commands below (``--edit`` may be | |
597 | required): |
|
597 | required): | |
598 |
|
598 | |||
599 | - :hg:`backout` |
|
599 | - :hg:`backout` | |
600 | - :hg:`commit` |
|
600 | - :hg:`commit` | |
601 | - :hg:`fetch` (for merge commit only) |
|
601 | - :hg:`fetch` (for merge commit only) | |
602 | - :hg:`graft` |
|
602 | - :hg:`graft` | |
603 | - :hg:`histedit` |
|
603 | - :hg:`histedit` | |
604 | - :hg:`import` |
|
604 | - :hg:`import` | |
605 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
605 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` | |
606 | - :hg:`rebase` |
|
606 | - :hg:`rebase` | |
607 | - :hg:`shelve` |
|
607 | - :hg:`shelve` | |
608 | - :hg:`sign` |
|
608 | - :hg:`sign` | |
609 | - :hg:`tag` |
|
609 | - :hg:`tag` | |
610 | - :hg:`transplant` |
|
610 | - :hg:`transplant` | |
611 |
|
611 | |||
612 | Configuring items below instead of ``changeset`` allows showing |
|
612 | Configuring items below instead of ``changeset`` allows showing | |
613 | customized message only for specific actions, or showing different |
|
613 | customized message only for specific actions, or showing different | |
614 | messages for each action. |
|
614 | messages for each action. | |
615 |
|
615 | |||
616 | - ``changeset.backout`` for :hg:`backout` |
|
616 | - ``changeset.backout`` for :hg:`backout` | |
617 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
617 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges | |
618 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
618 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other | |
619 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
619 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges | |
620 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
620 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other | |
621 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
621 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) | |
622 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
622 | - ``changeset.gpg.sign`` for :hg:`sign` | |
623 | - ``changeset.graft`` for :hg:`graft` |
|
623 | - ``changeset.graft`` for :hg:`graft` | |
624 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
624 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` | |
625 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
625 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` | |
626 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
626 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` | |
627 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
627 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` | |
628 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
628 | - ``changeset.import.bypass`` for :hg:`import --bypass` | |
629 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
629 | - ``changeset.import.normal.merge`` for :hg:`import` on merges | |
630 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
630 | - ``changeset.import.normal.normal`` for :hg:`import` on other | |
631 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
631 | - ``changeset.mq.qnew`` for :hg:`qnew` | |
632 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
632 | - ``changeset.mq.qfold`` for :hg:`qfold` | |
633 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
633 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` | |
634 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
634 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` | |
635 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
635 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges | |
636 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
636 | - ``changeset.rebase.normal`` for :hg:`rebase` on other | |
637 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
637 | - ``changeset.shelve.shelve`` for :hg:`shelve` | |
638 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
638 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` | |
639 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
639 | - ``changeset.tag.remove`` for :hg:`tag --remove` | |
640 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
640 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges | |
641 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
641 | - ``changeset.transplant.normal`` for :hg:`transplant` on other | |
642 |
|
642 | |||
643 | These dot-separated lists of names are treated as hierarchical ones. |
|
643 | These dot-separated lists of names are treated as hierarchical ones. | |
644 | For example, ``changeset.tag.remove`` customizes the commit message |
|
644 | For example, ``changeset.tag.remove`` customizes the commit message | |
645 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
645 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the | |
646 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
646 | commit message for :hg:`tag` regardless of ``--remove`` option. | |
647 |
|
647 | |||
648 | When the external editor is invoked for a commit, the corresponding |
|
648 | When the external editor is invoked for a commit, the corresponding | |
649 | dot-separated list of names without the ``changeset.`` prefix |
|
649 | dot-separated list of names without the ``changeset.`` prefix | |
650 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment |
|
650 | (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment | |
651 | variable. |
|
651 | variable. | |
652 |
|
652 | |||
653 | In this section, items other than ``changeset`` can be referred from |
|
653 | In this section, items other than ``changeset`` can be referred from | |
654 | others. For example, the configuration to list committed files up |
|
654 | others. For example, the configuration to list committed files up | |
655 | below can be referred as ``{listupfiles}``:: |
|
655 | below can be referred as ``{listupfiles}``:: | |
656 |
|
656 | |||
657 | [committemplate] |
|
657 | [committemplate] | |
658 | listupfiles = {file_adds % |
|
658 | listupfiles = {file_adds % | |
659 | "HG: added {file}\n" }{file_mods % |
|
659 | "HG: added {file}\n" }{file_mods % | |
660 | "HG: changed {file}\n" }{file_dels % |
|
660 | "HG: changed {file}\n" }{file_dels % | |
661 | "HG: removed {file}\n" }{if(files, "", |
|
661 | "HG: removed {file}\n" }{if(files, "", | |
662 | "HG: no files changed\n")} |
|
662 | "HG: no files changed\n")} | |
663 |
|
663 | |||
664 | ``decode/encode`` |
|
664 | ``decode/encode`` | |
665 | ----------------- |
|
665 | ----------------- | |
666 |
|
666 | |||
667 | Filters for transforming files on checkout/checkin. This would |
|
667 | Filters for transforming files on checkout/checkin. This would | |
668 | typically be used for newline processing or other |
|
668 | typically be used for newline processing or other | |
669 | localization/canonicalization of files. |
|
669 | localization/canonicalization of files. | |
670 |
|
670 | |||
671 | Filters consist of a filter pattern followed by a filter command. |
|
671 | Filters consist of a filter pattern followed by a filter command. | |
672 | Filter patterns are globs by default, rooted at the repository root. |
|
672 | Filter patterns are globs by default, rooted at the repository root. | |
673 | For example, to match any file ending in ``.txt`` in the root |
|
673 | For example, to match any file ending in ``.txt`` in the root | |
674 | directory only, use the pattern ``*.txt``. To match any file ending |
|
674 | directory only, use the pattern ``*.txt``. To match any file ending | |
675 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
675 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
676 | For each file only the first matching filter applies. |
|
676 | For each file only the first matching filter applies. | |
677 |
|
677 | |||
678 | The filter command can start with a specifier, either ``pipe:`` or |
|
678 | The filter command can start with a specifier, either ``pipe:`` or | |
679 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
679 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
680 |
|
680 | |||
681 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
681 | A ``pipe:`` command must accept data on stdin and return the transformed | |
682 | data on stdout. |
|
682 | data on stdout. | |
683 |
|
683 | |||
684 | Pipe example:: |
|
684 | Pipe example:: | |
685 |
|
685 | |||
686 | [encode] |
|
686 | [encode] | |
687 | # uncompress gzip files on checkin to improve delta compression |
|
687 | # uncompress gzip files on checkin to improve delta compression | |
688 | # note: not necessarily a good idea, just an example |
|
688 | # note: not necessarily a good idea, just an example | |
689 | *.gz = pipe: gunzip |
|
689 | *.gz = pipe: gunzip | |
690 |
|
690 | |||
691 | [decode] |
|
691 | [decode] | |
692 | # recompress gzip files when writing them to the working dir (we |
|
692 | # recompress gzip files when writing them to the working dir (we | |
693 | # can safely omit "pipe:", because it's the default) |
|
693 | # can safely omit "pipe:", because it's the default) | |
694 | *.gz = gzip |
|
694 | *.gz = gzip | |
695 |
|
695 | |||
696 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
696 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
697 | with the name of a temporary file that contains the data to be |
|
697 | with the name of a temporary file that contains the data to be | |
698 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
698 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
699 | of an empty temporary file, where the filtered data must be written by |
|
699 | of an empty temporary file, where the filtered data must be written by | |
700 | the command. |
|
700 | the command. | |
701 |
|
701 | |||
702 | .. container:: windows |
|
702 | .. container:: windows | |
703 |
|
703 | |||
704 | .. note:: |
|
704 | .. note:: | |
705 |
|
705 | |||
706 | The tempfile mechanism is recommended for Windows systems, |
|
706 | The tempfile mechanism is recommended for Windows systems, | |
707 | where the standard shell I/O redirection operators often have |
|
707 | where the standard shell I/O redirection operators often have | |
708 | strange effects and may corrupt the contents of your files. |
|
708 | strange effects and may corrupt the contents of your files. | |
709 |
|
709 | |||
710 | This filter mechanism is used internally by the ``eol`` extension to |
|
710 | This filter mechanism is used internally by the ``eol`` extension to | |
711 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
711 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
712 | format. We suggest you use the ``eol`` extension for convenience. |
|
712 | format. We suggest you use the ``eol`` extension for convenience. | |
713 |
|
713 | |||
714 |
|
714 | |||
715 | ``defaults`` |
|
715 | ``defaults`` | |
716 | ------------ |
|
716 | ------------ | |
717 |
|
717 | |||
718 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
718 | (defaults are deprecated. Don't use them. Use aliases instead.) | |
719 |
|
719 | |||
720 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
720 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
721 | default options/arguments to pass to the specified commands. |
|
721 | default options/arguments to pass to the specified commands. | |
722 |
|
722 | |||
723 | The following example makes :hg:`log` run in verbose mode, and |
|
723 | The following example makes :hg:`log` run in verbose mode, and | |
724 | :hg:`status` show only the modified files, by default:: |
|
724 | :hg:`status` show only the modified files, by default:: | |
725 |
|
725 | |||
726 | [defaults] |
|
726 | [defaults] | |
727 | log = -v |
|
727 | log = -v | |
728 | status = -m |
|
728 | status = -m | |
729 |
|
729 | |||
730 | The actual commands, instead of their aliases, must be used when |
|
730 | The actual commands, instead of their aliases, must be used when | |
731 | defining command defaults. The command defaults will also be applied |
|
731 | defining command defaults. The command defaults will also be applied | |
732 | to the aliases of the commands defined. |
|
732 | to the aliases of the commands defined. | |
733 |
|
733 | |||
734 |
|
734 | |||
735 | ``diff`` |
|
735 | ``diff`` | |
736 | -------- |
|
736 | -------- | |
737 |
|
737 | |||
738 | Settings used when displaying diffs. Everything except for ``unified`` |
|
738 | Settings used when displaying diffs. Everything except for ``unified`` | |
739 | is a Boolean and defaults to False. See :hg:`help config.annotate` |
|
739 | is a Boolean and defaults to False. See :hg:`help config.annotate` | |
740 | for related options for the annotate command. |
|
740 | for related options for the annotate command. | |
741 |
|
741 | |||
742 | ``git`` |
|
742 | ``git`` | |
743 | Use git extended diff format. |
|
743 | Use git extended diff format. | |
744 |
|
744 | |||
745 | ``nobinary`` |
|
745 | ``nobinary`` | |
746 | Omit git binary patches. |
|
746 | Omit git binary patches. | |
747 |
|
747 | |||
748 | ``nodates`` |
|
748 | ``nodates`` | |
749 | Don't include dates in diff headers. |
|
749 | Don't include dates in diff headers. | |
750 |
|
750 | |||
751 | ``noprefix`` |
|
751 | ``noprefix`` | |
752 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
752 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. | |
753 |
|
753 | |||
754 | ``showfunc`` |
|
754 | ``showfunc`` | |
755 | Show which function each change is in. |
|
755 | Show which function each change is in. | |
756 |
|
756 | |||
757 | ``ignorews`` |
|
757 | ``ignorews`` | |
758 | Ignore white space when comparing lines. |
|
758 | Ignore white space when comparing lines. | |
759 |
|
759 | |||
760 | ``ignorewsamount`` |
|
760 | ``ignorewsamount`` | |
761 | Ignore changes in the amount of white space. |
|
761 | Ignore changes in the amount of white space. | |
762 |
|
762 | |||
763 | ``ignoreblanklines`` |
|
763 | ``ignoreblanklines`` | |
764 | Ignore changes whose lines are all blank. |
|
764 | Ignore changes whose lines are all blank. | |
765 |
|
765 | |||
766 | ``unified`` |
|
766 | ``unified`` | |
767 | Number of lines of context to show. |
|
767 | Number of lines of context to show. | |
768 |
|
768 | |||
769 | ``word-diff`` |
|
769 | ``word-diff`` | |
770 | Highlight changed words. |
|
770 | Highlight changed words. | |
771 |
|
771 | |||
772 | ``email`` |
|
772 | ``email`` | |
773 | --------- |
|
773 | --------- | |
774 |
|
774 | |||
775 | Settings for extensions that send email messages. |
|
775 | Settings for extensions that send email messages. | |
776 |
|
776 | |||
777 | ``from`` |
|
777 | ``from`` | |
778 | Optional. Email address to use in "From" header and SMTP envelope |
|
778 | Optional. Email address to use in "From" header and SMTP envelope | |
779 | of outgoing messages. |
|
779 | of outgoing messages. | |
780 |
|
780 | |||
781 | ``to`` |
|
781 | ``to`` | |
782 | Optional. Comma-separated list of recipients' email addresses. |
|
782 | Optional. Comma-separated list of recipients' email addresses. | |
783 |
|
783 | |||
784 | ``cc`` |
|
784 | ``cc`` | |
785 | Optional. Comma-separated list of carbon copy recipients' |
|
785 | Optional. Comma-separated list of carbon copy recipients' | |
786 | email addresses. |
|
786 | email addresses. | |
787 |
|
787 | |||
788 | ``bcc`` |
|
788 | ``bcc`` | |
789 | Optional. Comma-separated list of blind carbon copy recipients' |
|
789 | Optional. Comma-separated list of blind carbon copy recipients' | |
790 | email addresses. |
|
790 | email addresses. | |
791 |
|
791 | |||
792 | ``method`` |
|
792 | ``method`` | |
793 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
793 | Optional. Method to use to send email messages. If value is ``smtp`` | |
794 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
794 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
795 | Otherwise, use as name of program to run that acts like sendmail |
|
795 | Otherwise, use as name of program to run that acts like sendmail | |
796 | (takes ``-f`` option for sender, list of recipients on command line, |
|
796 | (takes ``-f`` option for sender, list of recipients on command line, | |
797 | message on stdin). Normally, setting this to ``sendmail`` or |
|
797 | message on stdin). Normally, setting this to ``sendmail`` or | |
798 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
798 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
799 |
|
799 | |||
800 | ``charsets`` |
|
800 | ``charsets`` | |
801 | Optional. Comma-separated list of character sets considered |
|
801 | Optional. Comma-separated list of character sets considered | |
802 | convenient for recipients. Addresses, headers, and parts not |
|
802 | convenient for recipients. Addresses, headers, and parts not | |
803 | containing patches of outgoing messages will be encoded in the |
|
803 | containing patches of outgoing messages will be encoded in the | |
804 | first character set to which conversion from local encoding |
|
804 | first character set to which conversion from local encoding | |
805 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
805 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
806 | conversion fails, the text in question is sent as is. |
|
806 | conversion fails, the text in question is sent as is. | |
807 | (default: '') |
|
807 | (default: '') | |
808 |
|
808 | |||
809 | Order of outgoing email character sets: |
|
809 | Order of outgoing email character sets: | |
810 |
|
810 | |||
811 | 1. ``us-ascii``: always first, regardless of settings |
|
811 | 1. ``us-ascii``: always first, regardless of settings | |
812 | 2. ``email.charsets``: in order given by user |
|
812 | 2. ``email.charsets``: in order given by user | |
813 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
813 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
814 | 4. ``$HGENCODING``: if not in email.charsets |
|
814 | 4. ``$HGENCODING``: if not in email.charsets | |
815 | 5. ``utf-8``: always last, regardless of settings |
|
815 | 5. ``utf-8``: always last, regardless of settings | |
816 |
|
816 | |||
817 | Email example:: |
|
817 | Email example:: | |
818 |
|
818 | |||
819 | [email] |
|
819 | [email] | |
820 | from = Joseph User <joe.user@example.com> |
|
820 | from = Joseph User <joe.user@example.com> | |
821 | method = /usr/sbin/sendmail |
|
821 | method = /usr/sbin/sendmail | |
822 | # charsets for western Europeans |
|
822 | # charsets for western Europeans | |
823 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
823 | # us-ascii, utf-8 omitted, as they are tried first and last | |
824 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
824 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
825 |
|
825 | |||
826 |
|
826 | |||
827 | ``extensions`` |
|
827 | ``extensions`` | |
828 | -------------- |
|
828 | -------------- | |
829 |
|
829 | |||
830 | Mercurial has an extension mechanism for adding new features. To |
|
830 | Mercurial has an extension mechanism for adding new features. To | |
831 | enable an extension, create an entry for it in this section. |
|
831 | enable an extension, create an entry for it in this section. | |
832 |
|
832 | |||
833 | If you know that the extension is already in Python's search path, |
|
833 | If you know that the extension is already in Python's search path, | |
834 | you can give the name of the module, followed by ``=``, with nothing |
|
834 | you can give the name of the module, followed by ``=``, with nothing | |
835 | after the ``=``. |
|
835 | after the ``=``. | |
836 |
|
836 | |||
837 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
837 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
838 | the path to the ``.py`` file (including the file name extension) that |
|
838 | the path to the ``.py`` file (including the file name extension) that | |
839 | defines the extension. |
|
839 | defines the extension. | |
840 |
|
840 | |||
841 | To explicitly disable an extension that is enabled in an hgrc of |
|
841 | To explicitly disable an extension that is enabled in an hgrc of | |
842 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
842 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
843 | or ``foo = !`` when path is not supplied. |
|
843 | or ``foo = !`` when path is not supplied. | |
844 |
|
844 | |||
845 | Example for ``~/.hgrc``:: |
|
845 | Example for ``~/.hgrc``:: | |
846 |
|
846 | |||
847 | [extensions] |
|
847 | [extensions] | |
848 | # (the churn extension will get loaded from Mercurial's path) |
|
848 | # (the churn extension will get loaded from Mercurial's path) | |
849 | churn = |
|
849 | churn = | |
850 | # (this extension will get loaded from the file specified) |
|
850 | # (this extension will get loaded from the file specified) | |
851 | myfeature = ~/.hgext/myfeature.py |
|
851 | myfeature = ~/.hgext/myfeature.py | |
852 |
|
852 | |||
853 | If an extension fails to load, a warning will be issued, and Mercurial will |
|
853 | If an extension fails to load, a warning will be issued, and Mercurial will | |
854 | proceed. To enforce that an extension must be loaded, one can set the `required` |
|
854 | proceed. To enforce that an extension must be loaded, one can set the `required` | |
855 | suboption in the config:: |
|
855 | suboption in the config:: | |
856 |
|
856 | |||
857 | [extensions] |
|
857 | [extensions] | |
858 | myfeature = ~/.hgext/myfeature.py |
|
858 | myfeature = ~/.hgext/myfeature.py | |
859 | myfeature:required = yes |
|
859 | myfeature:required = yes | |
860 |
|
860 | |||
861 | To debug extension loading issue, one can add `--traceback` to their mercurial |
|
861 | To debug extension loading issue, one can add `--traceback` to their mercurial | |
862 | invocation. |
|
862 | invocation. | |
863 |
|
863 | |||
|
864 | A default setting can we set using the special `*` extension key:: | |||
|
865 | ||||
|
866 | [extensions] | |||
|
867 | *:required = yes | |||
|
868 | myfeature = ~/.hgext/myfeature.py | |||
|
869 | rebase= | |||
|
870 | ||||
864 |
|
871 | |||
865 | ``format`` |
|
872 | ``format`` | |
866 | ---------- |
|
873 | ---------- | |
867 |
|
874 | |||
868 | Configuration that controls the repository format. Newer format options are more |
|
875 | Configuration that controls the repository format. Newer format options are more | |
869 | powerful, but incompatible with some older versions of Mercurial. Format options |
|
876 | powerful, but incompatible with some older versions of Mercurial. Format options | |
870 | are considered at repository initialization only. You need to make a new clone |
|
877 | are considered at repository initialization only. You need to make a new clone | |
871 | for config changes to be taken into account. |
|
878 | for config changes to be taken into account. | |
872 |
|
879 | |||
873 | For more details about repository format and version compatibility, see |
|
880 | For more details about repository format and version compatibility, see | |
874 | https://www.mercurial-scm.org/wiki/MissingRequirement |
|
881 | https://www.mercurial-scm.org/wiki/MissingRequirement | |
875 |
|
882 | |||
876 | ``usegeneraldelta`` |
|
883 | ``usegeneraldelta`` | |
877 | Enable or disable the "generaldelta" repository format which improves |
|
884 | Enable or disable the "generaldelta" repository format which improves | |
878 | repository compression by allowing "revlog" to store deltas against |
|
885 | repository compression by allowing "revlog" to store deltas against | |
879 | arbitrary revisions instead of the previously stored one. This provides |
|
886 | arbitrary revisions instead of the previously stored one. This provides | |
880 | significant improvement for repositories with branches. |
|
887 | significant improvement for repositories with branches. | |
881 |
|
888 | |||
882 | Repositories with this on-disk format require Mercurial version 1.9. |
|
889 | Repositories with this on-disk format require Mercurial version 1.9. | |
883 |
|
890 | |||
884 | Enabled by default. |
|
891 | Enabled by default. | |
885 |
|
892 | |||
886 | ``dotencode`` |
|
893 | ``dotencode`` | |
887 | Enable or disable the "dotencode" repository format which enhances |
|
894 | Enable or disable the "dotencode" repository format which enhances | |
888 | the "fncache" repository format (which has to be enabled to use |
|
895 | the "fncache" repository format (which has to be enabled to use | |
889 | dotencode) to avoid issues with filenames starting with "._" on |
|
896 | dotencode) to avoid issues with filenames starting with "._" on | |
890 | Mac OS X and spaces on Windows. |
|
897 | Mac OS X and spaces on Windows. | |
891 |
|
898 | |||
892 | Repositories with this on-disk format require Mercurial version 1.7. |
|
899 | Repositories with this on-disk format require Mercurial version 1.7. | |
893 |
|
900 | |||
894 | Enabled by default. |
|
901 | Enabled by default. | |
895 |
|
902 | |||
896 | ``usefncache`` |
|
903 | ``usefncache`` | |
897 | Enable or disable the "fncache" repository format which enhances |
|
904 | Enable or disable the "fncache" repository format which enhances | |
898 | the "store" repository format (which has to be enabled to use |
|
905 | the "store" repository format (which has to be enabled to use | |
899 | fncache) to allow longer filenames and avoids using Windows |
|
906 | fncache) to allow longer filenames and avoids using Windows | |
900 | reserved names, e.g. "nul". |
|
907 | reserved names, e.g. "nul". | |
901 |
|
908 | |||
902 | Repositories with this on-disk format require Mercurial version 1.1. |
|
909 | Repositories with this on-disk format require Mercurial version 1.1. | |
903 |
|
910 | |||
904 | Enabled by default. |
|
911 | Enabled by default. | |
905 |
|
912 | |||
906 | ``use-persistent-nodemap`` |
|
913 | ``use-persistent-nodemap`` | |
907 | Enable or disable the "persistent-nodemap" feature which improves |
|
914 | Enable or disable the "persistent-nodemap" feature which improves | |
908 | performance if the rust extensions are available. |
|
915 | performance if the rust extensions are available. | |
909 |
|
916 | |||
910 | The "persistence-nodemap" persist the "node -> rev" on disk removing the |
|
917 | The "persistence-nodemap" persist the "node -> rev" on disk removing the | |
911 | need to dynamically build that mapping for each Mercurial invocation. This |
|
918 | need to dynamically build that mapping for each Mercurial invocation. This | |
912 | significantly reduce the startup cost of various local and server-side |
|
919 | significantly reduce the startup cost of various local and server-side | |
913 | operation for larger repository. |
|
920 | operation for larger repository. | |
914 |
|
921 | |||
915 | The performance improving version of this feature is currently only |
|
922 | The performance improving version of this feature is currently only | |
916 | implemented in Rust, so people not using a version of Mercurial compiled |
|
923 | implemented in Rust, so people not using a version of Mercurial compiled | |
917 | with the Rust part might actually suffer some slowdown. For this reason, |
|
924 | with the Rust part might actually suffer some slowdown. For this reason, | |
918 | Such version will by default refuse to access such repositories. That |
|
925 | Such version will by default refuse to access such repositories. That | |
919 | behavior can be controlled by configuration. Check |
|
926 | behavior can be controlled by configuration. Check | |
920 | :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details. |
|
927 | :hg:`help config.storage.revlog.persistent-nodemap.slow-path` for details. | |
921 |
|
928 | |||
922 | Repository with this on-disk format require Mercurial version 5.4 or above. |
|
929 | Repository with this on-disk format require Mercurial version 5.4 or above. | |
923 |
|
930 | |||
924 | By default this format variant is disabled if fast implementation is not |
|
931 | By default this format variant is disabled if fast implementation is not | |
925 | available and enabled by default if the fast implementation is available. |
|
932 | available and enabled by default if the fast implementation is available. | |
926 |
|
933 | |||
927 | To accomodate install of Mercurial without the fast implementation you can |
|
934 | To accomodate install of Mercurial without the fast implementation you can | |
928 | downgrade your repository. To do so run the following command: |
|
935 | downgrade your repository. To do so run the following command: | |
929 |
|
936 | |||
930 | $ hg debugupgraderepo \ |
|
937 | $ hg debugupgraderepo \ | |
931 | --run \ |
|
938 | --run \ | |
932 | --config format.use-persistent-nodemap=False \ |
|
939 | --config format.use-persistent-nodemap=False \ | |
933 | --config storage.revlog.persistent-nodemap.slow-path=allow |
|
940 | --config storage.revlog.persistent-nodemap.slow-path=allow | |
934 |
|
941 | |||
935 | ``use-share-safe`` |
|
942 | ``use-share-safe`` | |
936 | Enforce "safe" behaviors for all "shares" that access this repository. |
|
943 | Enforce "safe" behaviors for all "shares" that access this repository. | |
937 |
|
944 | |||
938 | With this feature, "shares" using this repository as a source will: |
|
945 | With this feature, "shares" using this repository as a source will: | |
939 |
|
946 | |||
940 | * read the source repository's configuration (`<source>/.hg/hgrc`). |
|
947 | * read the source repository's configuration (`<source>/.hg/hgrc`). | |
941 | * read and use the source repository's "requirements" |
|
948 | * read and use the source repository's "requirements" | |
942 | (except the working copy specific one). |
|
949 | (except the working copy specific one). | |
943 |
|
950 | |||
944 | Without this feature, "shares" using this repository as a source will: |
|
951 | Without this feature, "shares" using this repository as a source will: | |
945 |
|
952 | |||
946 | * keep tracking the repository "requirements" in the share only, ignoring |
|
953 | * keep tracking the repository "requirements" in the share only, ignoring | |
947 | the source "requirements", possibly diverging from them. |
|
954 | the source "requirements", possibly diverging from them. | |
948 | * ignore source repository config. This can create problems, like silently |
|
955 | * ignore source repository config. This can create problems, like silently | |
949 | ignoring important hooks. |
|
956 | ignoring important hooks. | |
950 |
|
957 | |||
951 | Beware that existing shares will not be upgraded/downgraded, and by |
|
958 | Beware that existing shares will not be upgraded/downgraded, and by | |
952 | default, Mercurial will refuse to interact with them until the mismatch |
|
959 | default, Mercurial will refuse to interact with them until the mismatch | |
953 | is resolved. See :hg:`help config share.safe-mismatch.source-safe` and |
|
960 | is resolved. See :hg:`help config share.safe-mismatch.source-safe` and | |
954 | :hg:`help config share.safe-mismatch.source-not-safe` for details. |
|
961 | :hg:`help config share.safe-mismatch.source-not-safe` for details. | |
955 |
|
962 | |||
956 | Introduced in Mercurial 5.7. |
|
963 | Introduced in Mercurial 5.7. | |
957 |
|
964 | |||
958 | Disabled by default. |
|
965 | Disabled by default. | |
959 |
|
966 | |||
960 | ``usestore`` |
|
967 | ``usestore`` | |
961 | Enable or disable the "store" repository format which improves |
|
968 | Enable or disable the "store" repository format which improves | |
962 | compatibility with systems that fold case or otherwise mangle |
|
969 | compatibility with systems that fold case or otherwise mangle | |
963 | filenames. Disabling this option will allow you to store longer filenames |
|
970 | filenames. Disabling this option will allow you to store longer filenames | |
964 | in some situations at the expense of compatibility. |
|
971 | in some situations at the expense of compatibility. | |
965 |
|
972 | |||
966 | Repositories with this on-disk format require Mercurial version 0.9.4. |
|
973 | Repositories with this on-disk format require Mercurial version 0.9.4. | |
967 |
|
974 | |||
968 | Enabled by default. |
|
975 | Enabled by default. | |
969 |
|
976 | |||
970 | ``sparse-revlog`` |
|
977 | ``sparse-revlog`` | |
971 | Enable or disable the ``sparse-revlog`` delta strategy. This format improves |
|
978 | Enable or disable the ``sparse-revlog`` delta strategy. This format improves | |
972 | delta re-use inside revlog. For very branchy repositories, it results in a |
|
979 | delta re-use inside revlog. For very branchy repositories, it results in a | |
973 | smaller store. For repositories with many revisions, it also helps |
|
980 | smaller store. For repositories with many revisions, it also helps | |
974 | performance (by using shortened delta chains.) |
|
981 | performance (by using shortened delta chains.) | |
975 |
|
982 | |||
976 | Repositories with this on-disk format require Mercurial version 4.7 |
|
983 | Repositories with this on-disk format require Mercurial version 4.7 | |
977 |
|
984 | |||
978 | Enabled by default. |
|
985 | Enabled by default. | |
979 |
|
986 | |||
980 | ``revlog-compression`` |
|
987 | ``revlog-compression`` | |
981 | Compression algorithm used by revlog. Supported values are `zlib` and |
|
988 | Compression algorithm used by revlog. Supported values are `zlib` and | |
982 | `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is |
|
989 | `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is | |
983 | a newer format that is usually a net win over `zlib`, operating faster at |
|
990 | a newer format that is usually a net win over `zlib`, operating faster at | |
984 | better compression rates. Use `zstd` to reduce CPU usage. Multiple values |
|
991 | better compression rates. Use `zstd` to reduce CPU usage. Multiple values | |
985 | can be specified, the first available one will be used. |
|
992 | can be specified, the first available one will be used. | |
986 |
|
993 | |||
987 | On some systems, the Mercurial installation may lack `zstd` support. |
|
994 | On some systems, the Mercurial installation may lack `zstd` support. | |
988 |
|
995 | |||
989 | Default is `zstd` if available, `zlib` otherwise. |
|
996 | Default is `zstd` if available, `zlib` otherwise. | |
990 |
|
997 | |||
991 | ``bookmarks-in-store`` |
|
998 | ``bookmarks-in-store`` | |
992 | Store bookmarks in .hg/store/. This means that bookmarks are shared when |
|
999 | Store bookmarks in .hg/store/. This means that bookmarks are shared when | |
993 | using `hg share` regardless of the `-B` option. |
|
1000 | using `hg share` regardless of the `-B` option. | |
994 |
|
1001 | |||
995 | Repositories with this on-disk format require Mercurial version 5.1. |
|
1002 | Repositories with this on-disk format require Mercurial version 5.1. | |
996 |
|
1003 | |||
997 | Disabled by default. |
|
1004 | Disabled by default. | |
998 |
|
1005 | |||
999 |
|
1006 | |||
1000 | ``graph`` |
|
1007 | ``graph`` | |
1001 | --------- |
|
1008 | --------- | |
1002 |
|
1009 | |||
1003 | Web graph view configuration. This section let you change graph |
|
1010 | Web graph view configuration. This section let you change graph | |
1004 | elements display properties by branches, for instance to make the |
|
1011 | elements display properties by branches, for instance to make the | |
1005 | ``default`` branch stand out. |
|
1012 | ``default`` branch stand out. | |
1006 |
|
1013 | |||
1007 | Each line has the following format:: |
|
1014 | Each line has the following format:: | |
1008 |
|
1015 | |||
1009 | <branch>.<argument> = <value> |
|
1016 | <branch>.<argument> = <value> | |
1010 |
|
1017 | |||
1011 | where ``<branch>`` is the name of the branch being |
|
1018 | where ``<branch>`` is the name of the branch being | |
1012 | customized. Example:: |
|
1019 | customized. Example:: | |
1013 |
|
1020 | |||
1014 | [graph] |
|
1021 | [graph] | |
1015 | # 2px width |
|
1022 | # 2px width | |
1016 | default.width = 2 |
|
1023 | default.width = 2 | |
1017 | # red color |
|
1024 | # red color | |
1018 | default.color = FF0000 |
|
1025 | default.color = FF0000 | |
1019 |
|
1026 | |||
1020 | Supported arguments: |
|
1027 | Supported arguments: | |
1021 |
|
1028 | |||
1022 | ``width`` |
|
1029 | ``width`` | |
1023 | Set branch edges width in pixels. |
|
1030 | Set branch edges width in pixels. | |
1024 |
|
1031 | |||
1025 | ``color`` |
|
1032 | ``color`` | |
1026 | Set branch edges color in hexadecimal RGB notation. |
|
1033 | Set branch edges color in hexadecimal RGB notation. | |
1027 |
|
1034 | |||
1028 | ``hooks`` |
|
1035 | ``hooks`` | |
1029 | --------- |
|
1036 | --------- | |
1030 |
|
1037 | |||
1031 | Commands or Python functions that get automatically executed by |
|
1038 | Commands or Python functions that get automatically executed by | |
1032 | various actions such as starting or finishing a commit. Multiple |
|
1039 | various actions such as starting or finishing a commit. Multiple | |
1033 | hooks can be run for the same action by appending a suffix to the |
|
1040 | hooks can be run for the same action by appending a suffix to the | |
1034 | action. Overriding a site-wide hook can be done by changing its |
|
1041 | action. Overriding a site-wide hook can be done by changing its | |
1035 | value or setting it to an empty string. Hooks can be prioritized |
|
1042 | value or setting it to an empty string. Hooks can be prioritized | |
1036 | by adding a prefix of ``priority.`` to the hook name on a new line |
|
1043 | by adding a prefix of ``priority.`` to the hook name on a new line | |
1037 | and setting the priority. The default priority is 0. |
|
1044 | and setting the priority. The default priority is 0. | |
1038 |
|
1045 | |||
1039 | Example ``.hg/hgrc``:: |
|
1046 | Example ``.hg/hgrc``:: | |
1040 |
|
1047 | |||
1041 | [hooks] |
|
1048 | [hooks] | |
1042 | # update working directory after adding changesets |
|
1049 | # update working directory after adding changesets | |
1043 | changegroup.update = hg update |
|
1050 | changegroup.update = hg update | |
1044 | # do not use the site-wide hook |
|
1051 | # do not use the site-wide hook | |
1045 | incoming = |
|
1052 | incoming = | |
1046 | incoming.email = /my/email/hook |
|
1053 | incoming.email = /my/email/hook | |
1047 | incoming.autobuild = /my/build/hook |
|
1054 | incoming.autobuild = /my/build/hook | |
1048 | # force autobuild hook to run before other incoming hooks |
|
1055 | # force autobuild hook to run before other incoming hooks | |
1049 | priority.incoming.autobuild = 1 |
|
1056 | priority.incoming.autobuild = 1 | |
1050 | ### control HGPLAIN setting when running autobuild hook |
|
1057 | ### control HGPLAIN setting when running autobuild hook | |
1051 | # HGPLAIN always set (default from Mercurial 5.7) |
|
1058 | # HGPLAIN always set (default from Mercurial 5.7) | |
1052 | incoming.autobuild:run-with-plain = yes |
|
1059 | incoming.autobuild:run-with-plain = yes | |
1053 | # HGPLAIN never set |
|
1060 | # HGPLAIN never set | |
1054 | incoming.autobuild:run-with-plain = no |
|
1061 | incoming.autobuild:run-with-plain = no | |
1055 | # HGPLAIN inherited from environment (default before Mercurial 5.7) |
|
1062 | # HGPLAIN inherited from environment (default before Mercurial 5.7) | |
1056 | incoming.autobuild:run-with-plain = auto |
|
1063 | incoming.autobuild:run-with-plain = auto | |
1057 |
|
1064 | |||
1058 | Most hooks are run with environment variables set that give useful |
|
1065 | Most hooks are run with environment variables set that give useful | |
1059 | additional information. For each hook below, the environment variables |
|
1066 | additional information. For each hook below, the environment variables | |
1060 | it is passed are listed with names in the form ``$HG_foo``. The |
|
1067 | it is passed are listed with names in the form ``$HG_foo``. The | |
1061 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. |
|
1068 | ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks. | |
1062 | They contain the type of hook which triggered the run and the full name |
|
1069 | They contain the type of hook which triggered the run and the full name | |
1063 | of the hook in the config, respectively. In the example above, this will |
|
1070 | of the hook in the config, respectively. In the example above, this will | |
1064 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. |
|
1071 | be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``. | |
1065 |
|
1072 | |||
1066 | .. container:: windows |
|
1073 | .. container:: windows | |
1067 |
|
1074 | |||
1068 | Some basic Unix syntax can be enabled for portability, including ``$VAR`` |
|
1075 | Some basic Unix syntax can be enabled for portability, including ``$VAR`` | |
1069 | and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will |
|
1076 | and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will | |
1070 | be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion |
|
1077 | be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion | |
1071 | on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back |
|
1078 | on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back | |
1072 | slash or inside of a strong quote. Strong quotes will be replaced by |
|
1079 | slash or inside of a strong quote. Strong quotes will be replaced by | |
1073 | double quotes after processing. |
|
1080 | double quotes after processing. | |
1074 |
|
1081 | |||
1075 | This feature is enabled by adding a prefix of ``tonative.`` to the hook |
|
1082 | This feature is enabled by adding a prefix of ``tonative.`` to the hook | |
1076 | name on a new line, and setting it to ``True``. For example:: |
|
1083 | name on a new line, and setting it to ``True``. For example:: | |
1077 |
|
1084 | |||
1078 | [hooks] |
|
1085 | [hooks] | |
1079 | incoming.autobuild = /my/build/hook |
|
1086 | incoming.autobuild = /my/build/hook | |
1080 | # enable translation to cmd.exe syntax for autobuild hook |
|
1087 | # enable translation to cmd.exe syntax for autobuild hook | |
1081 | tonative.incoming.autobuild = True |
|
1088 | tonative.incoming.autobuild = True | |
1082 |
|
1089 | |||
1083 | ``changegroup`` |
|
1090 | ``changegroup`` | |
1084 | Run after a changegroup has been added via push, pull or unbundle. The ID of |
|
1091 | Run after a changegroup has been added via push, pull or unbundle. The ID of | |
1085 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. |
|
1092 | the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``. | |
1086 | The URL from which changes came is in ``$HG_URL``. |
|
1093 | The URL from which changes came is in ``$HG_URL``. | |
1087 |
|
1094 | |||
1088 | ``commit`` |
|
1095 | ``commit`` | |
1089 | Run after a changeset has been created in the local repository. The ID |
|
1096 | Run after a changeset has been created in the local repository. The ID | |
1090 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
1097 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
1091 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1098 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
1092 |
|
1099 | |||
1093 | ``incoming`` |
|
1100 | ``incoming`` | |
1094 | Run after a changeset has been pulled, pushed, or unbundled into |
|
1101 | Run after a changeset has been pulled, pushed, or unbundled into | |
1095 | the local repository. The ID of the newly arrived changeset is in |
|
1102 | the local repository. The ID of the newly arrived changeset is in | |
1096 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. |
|
1103 | ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``. | |
1097 |
|
1104 | |||
1098 | ``outgoing`` |
|
1105 | ``outgoing`` | |
1099 | Run after sending changes from the local repository to another. The ID of |
|
1106 | Run after sending changes from the local repository to another. The ID of | |
1100 | first changeset sent is in ``$HG_NODE``. The source of operation is in |
|
1107 | first changeset sent is in ``$HG_NODE``. The source of operation is in | |
1101 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. |
|
1108 | ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`. | |
1102 |
|
1109 | |||
1103 | ``post-<command>`` |
|
1110 | ``post-<command>`` | |
1104 | Run after successful invocations of the associated command. The |
|
1111 | Run after successful invocations of the associated command. The | |
1105 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
1112 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
1106 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
1113 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
1107 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
1114 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
1108 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
1115 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
1109 | dictionary of options (with unspecified options set to their defaults). |
|
1116 | dictionary of options (with unspecified options set to their defaults). | |
1110 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
1117 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
1111 |
|
1118 | |||
1112 | ``fail-<command>`` |
|
1119 | ``fail-<command>`` | |
1113 | Run after a failed invocation of an associated command. The contents |
|
1120 | Run after a failed invocation of an associated command. The contents | |
1114 | of the command line are passed as ``$HG_ARGS``. Parsed command line |
|
1121 | of the command line are passed as ``$HG_ARGS``. Parsed command line | |
1115 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain |
|
1122 | arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain | |
1116 | string representations of the python data internally passed to |
|
1123 | string representations of the python data internally passed to | |
1117 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified |
|
1124 | <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified | |
1118 | options set to their defaults). ``$HG_PATS`` is a list of arguments. |
|
1125 | options set to their defaults). ``$HG_PATS`` is a list of arguments. | |
1119 | Hook failure is ignored. |
|
1126 | Hook failure is ignored. | |
1120 |
|
1127 | |||
1121 | ``pre-<command>`` |
|
1128 | ``pre-<command>`` | |
1122 | Run before executing the associated command. The contents of the |
|
1129 | Run before executing the associated command. The contents of the | |
1123 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
1130 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
1124 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
1131 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
1125 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
1132 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
1126 | is a dictionary of options (with unspecified options set to their |
|
1133 | is a dictionary of options (with unspecified options set to their | |
1127 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
1134 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
1128 | failure, the command doesn't execute and Mercurial returns the failure |
|
1135 | failure, the command doesn't execute and Mercurial returns the failure | |
1129 | code. |
|
1136 | code. | |
1130 |
|
1137 | |||
1131 | ``prechangegroup`` |
|
1138 | ``prechangegroup`` | |
1132 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
1139 | Run before a changegroup is added via push, pull or unbundle. Exit | |
1133 | status 0 allows the changegroup to proceed. A non-zero status will |
|
1140 | status 0 allows the changegroup to proceed. A non-zero status will | |
1134 | cause the push, pull or unbundle to fail. The URL from which changes |
|
1141 | cause the push, pull or unbundle to fail. The URL from which changes | |
1135 | will come is in ``$HG_URL``. |
|
1142 | will come is in ``$HG_URL``. | |
1136 |
|
1143 | |||
1137 | ``precommit`` |
|
1144 | ``precommit`` | |
1138 | Run before starting a local commit. Exit status 0 allows the |
|
1145 | Run before starting a local commit. Exit status 0 allows the | |
1139 | commit to proceed. A non-zero status will cause the commit to fail. |
|
1146 | commit to proceed. A non-zero status will cause the commit to fail. | |
1140 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1147 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
1141 |
|
1148 | |||
1142 | ``prelistkeys`` |
|
1149 | ``prelistkeys`` | |
1143 | Run before listing pushkeys (like bookmarks) in the |
|
1150 | Run before listing pushkeys (like bookmarks) in the | |
1144 | repository. A non-zero status will cause failure. The key namespace is |
|
1151 | repository. A non-zero status will cause failure. The key namespace is | |
1145 | in ``$HG_NAMESPACE``. |
|
1152 | in ``$HG_NAMESPACE``. | |
1146 |
|
1153 | |||
1147 | ``preoutgoing`` |
|
1154 | ``preoutgoing`` | |
1148 | Run before collecting changes to send from the local repository to |
|
1155 | Run before collecting changes to send from the local repository to | |
1149 | another. A non-zero status will cause failure. This lets you prevent |
|
1156 | another. A non-zero status will cause failure. This lets you prevent | |
1150 | pull over HTTP or SSH. It can also prevent propagating commits (via |
|
1157 | pull over HTTP or SSH. It can also prevent propagating commits (via | |
1151 | local pull, push (outbound) or bundle commands), but not completely, |
|
1158 | local pull, push (outbound) or bundle commands), but not completely, | |
1152 | since you can just copy files instead. The source of operation is in |
|
1159 | since you can just copy files instead. The source of operation is in | |
1153 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote |
|
1160 | ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote | |
1154 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation |
|
1161 | SSH or HTTP repository. If "push", "pull" or "bundle", the operation | |
1155 | is happening on behalf of a repository on same system. |
|
1162 | is happening on behalf of a repository on same system. | |
1156 |
|
1163 | |||
1157 | ``prepushkey`` |
|
1164 | ``prepushkey`` | |
1158 | Run before a pushkey (like a bookmark) is added to the |
|
1165 | Run before a pushkey (like a bookmark) is added to the | |
1159 | repository. A non-zero status will cause the key to be rejected. The |
|
1166 | repository. A non-zero status will cause the key to be rejected. The | |
1160 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
1167 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
1161 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
1168 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
1162 | ``$HG_NEW``. |
|
1169 | ``$HG_NEW``. | |
1163 |
|
1170 | |||
1164 | ``pretag`` |
|
1171 | ``pretag`` | |
1165 | Run before creating a tag. Exit status 0 allows the tag to be |
|
1172 | Run before creating a tag. Exit status 0 allows the tag to be | |
1166 | created. A non-zero status will cause the tag to fail. The ID of the |
|
1173 | created. A non-zero status will cause the tag to fail. The ID of the | |
1167 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The |
|
1174 | changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The | |
1168 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. |
|
1175 | tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``. | |
1169 |
|
1176 | |||
1170 | ``pretxnopen`` |
|
1177 | ``pretxnopen`` | |
1171 | Run before any new repository transaction is open. The reason for the |
|
1178 | Run before any new repository transaction is open. The reason for the | |
1172 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the |
|
1179 | transaction will be in ``$HG_TXNNAME``, and a unique identifier for the | |
1173 | transaction will be in ``$HG_TXNID``. A non-zero status will prevent the |
|
1180 | transaction will be in ``$HG_TXNID``. A non-zero status will prevent the | |
1174 | transaction from being opened. |
|
1181 | transaction from being opened. | |
1175 |
|
1182 | |||
1176 | ``pretxnclose`` |
|
1183 | ``pretxnclose`` | |
1177 | Run right before the transaction is actually finalized. Any repository change |
|
1184 | Run right before the transaction is actually finalized. Any repository change | |
1178 | will be visible to the hook program. This lets you validate the transaction |
|
1185 | will be visible to the hook program. This lets you validate the transaction | |
1179 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1186 | content or change it. Exit status 0 allows the commit to proceed. A non-zero | |
1180 | status will cause the transaction to be rolled back. The reason for the |
|
1187 | status will cause the transaction to be rolled back. The reason for the | |
1181 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for |
|
1188 | transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for | |
1182 | the transaction will be in ``$HG_TXNID``. The rest of the available data will |
|
1189 | the transaction will be in ``$HG_TXNID``. The rest of the available data will | |
1183 | vary according the transaction type. Changes unbundled to the repository will |
|
1190 | vary according the transaction type. Changes unbundled to the repository will | |
1184 | add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the |
|
1191 | add ``$HG_URL`` and ``$HG_SOURCE``. New changesets will add ``$HG_NODE`` (the | |
1185 | ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added |
|
1192 | ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last added | |
1186 | changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and |
|
1193 | changeset). Bookmark and phase changes will set ``$HG_BOOKMARK_MOVED`` and | |
1187 | ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if |
|
1194 | ``$HG_PHASES_MOVED`` to ``1`` respectively. The number of new obsmarkers, if | |
1188 | any, will be in ``$HG_NEW_OBSMARKERS``, etc. |
|
1195 | any, will be in ``$HG_NEW_OBSMARKERS``, etc. | |
1189 |
|
1196 | |||
1190 | ``pretxnclose-bookmark`` |
|
1197 | ``pretxnclose-bookmark`` | |
1191 | Run right before a bookmark change is actually finalized. Any repository |
|
1198 | Run right before a bookmark change is actually finalized. Any repository | |
1192 | change will be visible to the hook program. This lets you validate the |
|
1199 | change will be visible to the hook program. This lets you validate the | |
1193 | transaction content or change it. Exit status 0 allows the commit to |
|
1200 | transaction content or change it. Exit status 0 allows the commit to | |
1194 | proceed. A non-zero status will cause the transaction to be rolled back. |
|
1201 | proceed. A non-zero status will cause the transaction to be rolled back. | |
1195 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new |
|
1202 | The name of the bookmark will be available in ``$HG_BOOKMARK``, the new | |
1196 | bookmark location will be available in ``$HG_NODE`` while the previous |
|
1203 | bookmark location will be available in ``$HG_NODE`` while the previous | |
1197 | location will be available in ``$HG_OLDNODE``. In case of a bookmark |
|
1204 | location will be available in ``$HG_OLDNODE``. In case of a bookmark | |
1198 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` |
|
1205 | creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE`` | |
1199 | will be empty. |
|
1206 | will be empty. | |
1200 | In addition, the reason for the transaction opening will be in |
|
1207 | In addition, the reason for the transaction opening will be in | |
1201 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1208 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in | |
1202 | ``$HG_TXNID``. |
|
1209 | ``$HG_TXNID``. | |
1203 |
|
1210 | |||
1204 | ``pretxnclose-phase`` |
|
1211 | ``pretxnclose-phase`` | |
1205 | Run right before a phase change is actually finalized. Any repository change |
|
1212 | Run right before a phase change is actually finalized. Any repository change | |
1206 | will be visible to the hook program. This lets you validate the transaction |
|
1213 | will be visible to the hook program. This lets you validate the transaction | |
1207 | content or change it. Exit status 0 allows the commit to proceed. A non-zero |
|
1214 | content or change it. Exit status 0 allows the commit to proceed. A non-zero | |
1208 | status will cause the transaction to be rolled back. The hook is called |
|
1215 | status will cause the transaction to be rolled back. The hook is called | |
1209 | multiple times, once for each revision affected by a phase change. |
|
1216 | multiple times, once for each revision affected by a phase change. | |
1210 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` |
|
1217 | The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE`` | |
1211 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` |
|
1218 | while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE`` | |
1212 | will be empty. In addition, the reason for the transaction opening will be in |
|
1219 | will be empty. In addition, the reason for the transaction opening will be in | |
1213 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in |
|
1220 | ``$HG_TXNNAME``, and a unique identifier for the transaction will be in | |
1214 | ``$HG_TXNID``. The hook is also run for newly added revisions. In this case |
|
1221 | ``$HG_TXNID``. The hook is also run for newly added revisions. In this case | |
1215 | the ``$HG_OLDPHASE`` entry will be empty. |
|
1222 | the ``$HG_OLDPHASE`` entry will be empty. | |
1216 |
|
1223 | |||
1217 | ``txnclose`` |
|
1224 | ``txnclose`` | |
1218 | Run after any repository transaction has been committed. At this |
|
1225 | Run after any repository transaction has been committed. At this | |
1219 | point, the transaction can no longer be rolled back. The hook will run |
|
1226 | point, the transaction can no longer be rolled back. The hook will run | |
1220 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for |
|
1227 | after the lock is released. See :hg:`help config.hooks.pretxnclose` for | |
1221 | details about available variables. |
|
1228 | details about available variables. | |
1222 |
|
1229 | |||
1223 | ``txnclose-bookmark`` |
|
1230 | ``txnclose-bookmark`` | |
1224 | Run after any bookmark change has been committed. At this point, the |
|
1231 | Run after any bookmark change has been committed. At this point, the | |
1225 | transaction can no longer be rolled back. The hook will run after the lock |
|
1232 | transaction can no longer be rolled back. The hook will run after the lock | |
1226 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details |
|
1233 | is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details | |
1227 | about available variables. |
|
1234 | about available variables. | |
1228 |
|
1235 | |||
1229 | ``txnclose-phase`` |
|
1236 | ``txnclose-phase`` | |
1230 | Run after any phase change has been committed. At this point, the |
|
1237 | Run after any phase change has been committed. At this point, the | |
1231 | transaction can no longer be rolled back. The hook will run after the lock |
|
1238 | transaction can no longer be rolled back. The hook will run after the lock | |
1232 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about |
|
1239 | is released. See :hg:`help config.hooks.pretxnclose-phase` for details about | |
1233 | available variables. |
|
1240 | available variables. | |
1234 |
|
1241 | |||
1235 | ``txnabort`` |
|
1242 | ``txnabort`` | |
1236 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` |
|
1243 | Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose` | |
1237 | for details about available variables. |
|
1244 | for details about available variables. | |
1238 |
|
1245 | |||
1239 | ``pretxnchangegroup`` |
|
1246 | ``pretxnchangegroup`` | |
1240 | Run after a changegroup has been added via push, pull or unbundle, but before |
|
1247 | Run after a changegroup has been added via push, pull or unbundle, but before | |
1241 | the transaction has been committed. The changegroup is visible to the hook |
|
1248 | the transaction has been committed. The changegroup is visible to the hook | |
1242 | program. This allows validation of incoming changes before accepting them. |
|
1249 | program. This allows validation of incoming changes before accepting them. | |
1243 | The ID of the first new changeset is in ``$HG_NODE`` and last is in |
|
1250 | The ID of the first new changeset is in ``$HG_NODE`` and last is in | |
1244 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero |
|
1251 | ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero | |
1245 | status will cause the transaction to be rolled back, and the push, pull or |
|
1252 | status will cause the transaction to be rolled back, and the push, pull or | |
1246 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. |
|
1253 | unbundle will fail. The URL that was the source of changes is in ``$HG_URL``. | |
1247 |
|
1254 | |||
1248 | ``pretxncommit`` |
|
1255 | ``pretxncommit`` | |
1249 | Run after a changeset has been created, but before the transaction is |
|
1256 | Run after a changeset has been created, but before the transaction is | |
1250 | committed. The changeset is visible to the hook program. This allows |
|
1257 | committed. The changeset is visible to the hook program. This allows | |
1251 | validation of the commit message and changes. Exit status 0 allows the |
|
1258 | validation of the commit message and changes. Exit status 0 allows the | |
1252 | commit to proceed. A non-zero status will cause the transaction to |
|
1259 | commit to proceed. A non-zero status will cause the transaction to | |
1253 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent |
|
1260 | be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent | |
1254 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
1261 | changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
1255 |
|
1262 | |||
1256 | ``preupdate`` |
|
1263 | ``preupdate`` | |
1257 | Run before updating the working directory. Exit status 0 allows |
|
1264 | Run before updating the working directory. Exit status 0 allows | |
1258 | the update to proceed. A non-zero status will prevent the update. |
|
1265 | the update to proceed. A non-zero status will prevent the update. | |
1259 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a |
|
1266 | The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a | |
1260 | merge, the ID of second new parent is in ``$HG_PARENT2``. |
|
1267 | merge, the ID of second new parent is in ``$HG_PARENT2``. | |
1261 |
|
1268 | |||
1262 | ``listkeys`` |
|
1269 | ``listkeys`` | |
1263 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
1270 | Run after listing pushkeys (like bookmarks) in the repository. The | |
1264 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
1271 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
1265 | dictionary containing the keys and values. |
|
1272 | dictionary containing the keys and values. | |
1266 |
|
1273 | |||
1267 | ``pushkey`` |
|
1274 | ``pushkey`` | |
1268 | Run after a pushkey (like a bookmark) is added to the |
|
1275 | Run after a pushkey (like a bookmark) is added to the | |
1269 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
1276 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
1270 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
1277 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
1271 | value is in ``$HG_NEW``. |
|
1278 | value is in ``$HG_NEW``. | |
1272 |
|
1279 | |||
1273 | ``tag`` |
|
1280 | ``tag`` | |
1274 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. |
|
1281 | Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``. | |
1275 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in |
|
1282 | The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in | |
1276 | the repository if ``$HG_LOCAL=0``. |
|
1283 | the repository if ``$HG_LOCAL=0``. | |
1277 |
|
1284 | |||
1278 | ``update`` |
|
1285 | ``update`` | |
1279 | Run after updating the working directory. The changeset ID of first |
|
1286 | Run after updating the working directory. The changeset ID of first | |
1280 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new |
|
1287 | new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new | |
1281 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
1288 | parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
1282 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. |
|
1289 | update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``. | |
1283 |
|
1290 | |||
1284 | .. note:: |
|
1291 | .. note:: | |
1285 |
|
1292 | |||
1286 | It is generally better to use standard hooks rather than the |
|
1293 | It is generally better to use standard hooks rather than the | |
1287 | generic pre- and post- command hooks, as they are guaranteed to be |
|
1294 | generic pre- and post- command hooks, as they are guaranteed to be | |
1288 | called in the appropriate contexts for influencing transactions. |
|
1295 | called in the appropriate contexts for influencing transactions. | |
1289 | Also, hooks like "commit" will be called in all contexts that |
|
1296 | Also, hooks like "commit" will be called in all contexts that | |
1290 | generate a commit (e.g. tag) and not just the commit command. |
|
1297 | generate a commit (e.g. tag) and not just the commit command. | |
1291 |
|
1298 | |||
1292 | .. note:: |
|
1299 | .. note:: | |
1293 |
|
1300 | |||
1294 | Environment variables with empty values may not be passed to |
|
1301 | Environment variables with empty values may not be passed to | |
1295 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
1302 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
1296 | will have an empty value under Unix-like platforms for non-merge |
|
1303 | will have an empty value under Unix-like platforms for non-merge | |
1297 | changesets, while it will not be available at all under Windows. |
|
1304 | changesets, while it will not be available at all under Windows. | |
1298 |
|
1305 | |||
1299 | The syntax for Python hooks is as follows:: |
|
1306 | The syntax for Python hooks is as follows:: | |
1300 |
|
1307 | |||
1301 | hookname = python:modulename.submodule.callable |
|
1308 | hookname = python:modulename.submodule.callable | |
1302 | hookname = python:/path/to/python/module.py:callable |
|
1309 | hookname = python:/path/to/python/module.py:callable | |
1303 |
|
1310 | |||
1304 | Python hooks are run within the Mercurial process. Each hook is |
|
1311 | Python hooks are run within the Mercurial process. Each hook is | |
1305 | called with at least three keyword arguments: a ui object (keyword |
|
1312 | called with at least three keyword arguments: a ui object (keyword | |
1306 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
1313 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
1307 | keyword that tells what kind of hook is used. Arguments listed as |
|
1314 | keyword that tells what kind of hook is used. Arguments listed as | |
1308 | environment variables above are passed as keyword arguments, with no |
|
1315 | environment variables above are passed as keyword arguments, with no | |
1309 | ``HG_`` prefix, and names in lower case. |
|
1316 | ``HG_`` prefix, and names in lower case. | |
1310 |
|
1317 | |||
1311 | If a Python hook returns a "true" value or raises an exception, this |
|
1318 | If a Python hook returns a "true" value or raises an exception, this | |
1312 | is treated as a failure. |
|
1319 | is treated as a failure. | |
1313 |
|
1320 | |||
1314 |
|
1321 | |||
1315 | ``hostfingerprints`` |
|
1322 | ``hostfingerprints`` | |
1316 | -------------------- |
|
1323 | -------------------- | |
1317 |
|
1324 | |||
1318 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) |
|
1325 | (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.) | |
1319 |
|
1326 | |||
1320 | Fingerprints of the certificates of known HTTPS servers. |
|
1327 | Fingerprints of the certificates of known HTTPS servers. | |
1321 |
|
1328 | |||
1322 | A HTTPS connection to a server with a fingerprint configured here will |
|
1329 | A HTTPS connection to a server with a fingerprint configured here will | |
1323 | only succeed if the servers certificate matches the fingerprint. |
|
1330 | only succeed if the servers certificate matches the fingerprint. | |
1324 | This is very similar to how ssh known hosts works. |
|
1331 | This is very similar to how ssh known hosts works. | |
1325 |
|
1332 | |||
1326 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
1333 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
1327 | Multiple values can be specified (separated by spaces or commas). This can |
|
1334 | Multiple values can be specified (separated by spaces or commas). This can | |
1328 | be used to define both old and new fingerprints while a host transitions |
|
1335 | be used to define both old and new fingerprints while a host transitions | |
1329 | to a new certificate. |
|
1336 | to a new certificate. | |
1330 |
|
1337 | |||
1331 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
1338 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
1332 |
|
1339 | |||
1333 | For example:: |
|
1340 | For example:: | |
1334 |
|
1341 | |||
1335 | [hostfingerprints] |
|
1342 | [hostfingerprints] | |
1336 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1343 | hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 | |
1337 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1344 | hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 | |
1338 |
|
1345 | |||
1339 | ``hostsecurity`` |
|
1346 | ``hostsecurity`` | |
1340 | ---------------- |
|
1347 | ---------------- | |
1341 |
|
1348 | |||
1342 | Used to specify global and per-host security settings for connecting to |
|
1349 | Used to specify global and per-host security settings for connecting to | |
1343 | other machines. |
|
1350 | other machines. | |
1344 |
|
1351 | |||
1345 | The following options control default behavior for all hosts. |
|
1352 | The following options control default behavior for all hosts. | |
1346 |
|
1353 | |||
1347 | ``ciphers`` |
|
1354 | ``ciphers`` | |
1348 | Defines the cryptographic ciphers to use for connections. |
|
1355 | Defines the cryptographic ciphers to use for connections. | |
1349 |
|
1356 | |||
1350 | Value must be a valid OpenSSL Cipher List Format as documented at |
|
1357 | Value must be a valid OpenSSL Cipher List Format as documented at | |
1351 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. |
|
1358 | https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT. | |
1352 |
|
1359 | |||
1353 | This setting is for advanced users only. Setting to incorrect values |
|
1360 | This setting is for advanced users only. Setting to incorrect values | |
1354 | can significantly lower connection security or decrease performance. |
|
1361 | can significantly lower connection security or decrease performance. | |
1355 | You have been warned. |
|
1362 | You have been warned. | |
1356 |
|
1363 | |||
1357 | This option requires Python 2.7. |
|
1364 | This option requires Python 2.7. | |
1358 |
|
1365 | |||
1359 | ``minimumprotocol`` |
|
1366 | ``minimumprotocol`` | |
1360 | Defines the minimum channel encryption protocol to use. |
|
1367 | Defines the minimum channel encryption protocol to use. | |
1361 |
|
1368 | |||
1362 | By default, the highest version of TLS supported by both client and server |
|
1369 | By default, the highest version of TLS supported by both client and server | |
1363 | is used. |
|
1370 | is used. | |
1364 |
|
1371 | |||
1365 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. |
|
1372 | Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``. | |
1366 |
|
1373 | |||
1367 | When running on an old Python version, only ``tls1.0`` is allowed since |
|
1374 | When running on an old Python version, only ``tls1.0`` is allowed since | |
1368 | old versions of Python only support up to TLS 1.0. |
|
1375 | old versions of Python only support up to TLS 1.0. | |
1369 |
|
1376 | |||
1370 | When running a Python that supports modern TLS versions, the default is |
|
1377 | When running a Python that supports modern TLS versions, the default is | |
1371 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this |
|
1378 | ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this | |
1372 | weakens security and should only be used as a feature of last resort if |
|
1379 | weakens security and should only be used as a feature of last resort if | |
1373 | a server does not support TLS 1.1+. |
|
1380 | a server does not support TLS 1.1+. | |
1374 |
|
1381 | |||
1375 | Options in the ``[hostsecurity]`` section can have the form |
|
1382 | Options in the ``[hostsecurity]`` section can have the form | |
1376 | ``hostname``:``setting``. This allows multiple settings to be defined on a |
|
1383 | ``hostname``:``setting``. This allows multiple settings to be defined on a | |
1377 | per-host basis. |
|
1384 | per-host basis. | |
1378 |
|
1385 | |||
1379 | The following per-host settings can be defined. |
|
1386 | The following per-host settings can be defined. | |
1380 |
|
1387 | |||
1381 | ``ciphers`` |
|
1388 | ``ciphers`` | |
1382 | This behaves like ``ciphers`` as described above except it only applies |
|
1389 | This behaves like ``ciphers`` as described above except it only applies | |
1383 | to the host on which it is defined. |
|
1390 | to the host on which it is defined. | |
1384 |
|
1391 | |||
1385 | ``fingerprints`` |
|
1392 | ``fingerprints`` | |
1386 | A list of hashes of the DER encoded peer/remote certificate. Values have |
|
1393 | A list of hashes of the DER encoded peer/remote certificate. Values have | |
1387 | the form ``algorithm``:``fingerprint``. e.g. |
|
1394 | the form ``algorithm``:``fingerprint``. e.g. | |
1388 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. |
|
1395 | ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``. | |
1389 | In addition, colons (``:``) can appear in the fingerprint part. |
|
1396 | In addition, colons (``:``) can appear in the fingerprint part. | |
1390 |
|
1397 | |||
1391 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, |
|
1398 | The following algorithms/prefixes are supported: ``sha1``, ``sha256``, | |
1392 | ``sha512``. |
|
1399 | ``sha512``. | |
1393 |
|
1400 | |||
1394 | Use of ``sha256`` or ``sha512`` is preferred. |
|
1401 | Use of ``sha256`` or ``sha512`` is preferred. | |
1395 |
|
1402 | |||
1396 | If a fingerprint is specified, the CA chain is not validated for this |
|
1403 | If a fingerprint is specified, the CA chain is not validated for this | |
1397 | host and Mercurial will require the remote certificate to match one |
|
1404 | host and Mercurial will require the remote certificate to match one | |
1398 | of the fingerprints specified. This means if the server updates its |
|
1405 | of the fingerprints specified. This means if the server updates its | |
1399 | certificate, Mercurial will abort until a new fingerprint is defined. |
|
1406 | certificate, Mercurial will abort until a new fingerprint is defined. | |
1400 | This can provide stronger security than traditional CA-based validation |
|
1407 | This can provide stronger security than traditional CA-based validation | |
1401 | at the expense of convenience. |
|
1408 | at the expense of convenience. | |
1402 |
|
1409 | |||
1403 | This option takes precedence over ``verifycertsfile``. |
|
1410 | This option takes precedence over ``verifycertsfile``. | |
1404 |
|
1411 | |||
1405 | ``minimumprotocol`` |
|
1412 | ``minimumprotocol`` | |
1406 | This behaves like ``minimumprotocol`` as described above except it |
|
1413 | This behaves like ``minimumprotocol`` as described above except it | |
1407 | only applies to the host on which it is defined. |
|
1414 | only applies to the host on which it is defined. | |
1408 |
|
1415 | |||
1409 | ``verifycertsfile`` |
|
1416 | ``verifycertsfile`` | |
1410 | Path to file a containing a list of PEM encoded certificates used to |
|
1417 | Path to file a containing a list of PEM encoded certificates used to | |
1411 | verify the server certificate. Environment variables and ``~user`` |
|
1418 | verify the server certificate. Environment variables and ``~user`` | |
1412 | constructs are expanded in the filename. |
|
1419 | constructs are expanded in the filename. | |
1413 |
|
1420 | |||
1414 | The server certificate or the certificate's certificate authority (CA) |
|
1421 | The server certificate or the certificate's certificate authority (CA) | |
1415 | must match a certificate from this file or certificate verification |
|
1422 | must match a certificate from this file or certificate verification | |
1416 | will fail and connections to the server will be refused. |
|
1423 | will fail and connections to the server will be refused. | |
1417 |
|
1424 | |||
1418 | If defined, only certificates provided by this file will be used: |
|
1425 | If defined, only certificates provided by this file will be used: | |
1419 | ``web.cacerts`` and any system/default certificates will not be |
|
1426 | ``web.cacerts`` and any system/default certificates will not be | |
1420 | used. |
|
1427 | used. | |
1421 |
|
1428 | |||
1422 | This option has no effect if the per-host ``fingerprints`` option |
|
1429 | This option has no effect if the per-host ``fingerprints`` option | |
1423 | is set. |
|
1430 | is set. | |
1424 |
|
1431 | |||
1425 | The format of the file is as follows:: |
|
1432 | The format of the file is as follows:: | |
1426 |
|
1433 | |||
1427 | -----BEGIN CERTIFICATE----- |
|
1434 | -----BEGIN CERTIFICATE----- | |
1428 | ... (certificate in base64 PEM encoding) ... |
|
1435 | ... (certificate in base64 PEM encoding) ... | |
1429 | -----END CERTIFICATE----- |
|
1436 | -----END CERTIFICATE----- | |
1430 | -----BEGIN CERTIFICATE----- |
|
1437 | -----BEGIN CERTIFICATE----- | |
1431 | ... (certificate in base64 PEM encoding) ... |
|
1438 | ... (certificate in base64 PEM encoding) ... | |
1432 | -----END CERTIFICATE----- |
|
1439 | -----END CERTIFICATE----- | |
1433 |
|
1440 | |||
1434 | For example:: |
|
1441 | For example:: | |
1435 |
|
1442 | |||
1436 | [hostsecurity] |
|
1443 | [hostsecurity] | |
1437 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 |
|
1444 | hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 | |
1438 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 |
|
1445 | hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33 | |
1439 | hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2 |
|
1446 | hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2 | |
1440 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem |
|
1447 | foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem | |
1441 |
|
1448 | |||
1442 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 |
|
1449 | To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1 | |
1443 | when connecting to ``hg.example.com``:: |
|
1450 | when connecting to ``hg.example.com``:: | |
1444 |
|
1451 | |||
1445 | [hostsecurity] |
|
1452 | [hostsecurity] | |
1446 | minimumprotocol = tls1.2 |
|
1453 | minimumprotocol = tls1.2 | |
1447 | hg.example.com:minimumprotocol = tls1.1 |
|
1454 | hg.example.com:minimumprotocol = tls1.1 | |
1448 |
|
1455 | |||
1449 | ``http_proxy`` |
|
1456 | ``http_proxy`` | |
1450 | -------------- |
|
1457 | -------------- | |
1451 |
|
1458 | |||
1452 | Used to access web-based Mercurial repositories through a HTTP |
|
1459 | Used to access web-based Mercurial repositories through a HTTP | |
1453 | proxy. |
|
1460 | proxy. | |
1454 |
|
1461 | |||
1455 | ``host`` |
|
1462 | ``host`` | |
1456 | Host name and (optional) port of the proxy server, for example |
|
1463 | Host name and (optional) port of the proxy server, for example | |
1457 | "myproxy:8000". |
|
1464 | "myproxy:8000". | |
1458 |
|
1465 | |||
1459 | ``no`` |
|
1466 | ``no`` | |
1460 | Optional. Comma-separated list of host names that should bypass |
|
1467 | Optional. Comma-separated list of host names that should bypass | |
1461 | the proxy. |
|
1468 | the proxy. | |
1462 |
|
1469 | |||
1463 | ``passwd`` |
|
1470 | ``passwd`` | |
1464 | Optional. Password to authenticate with at the proxy server. |
|
1471 | Optional. Password to authenticate with at the proxy server. | |
1465 |
|
1472 | |||
1466 | ``user`` |
|
1473 | ``user`` | |
1467 | Optional. User name to authenticate with at the proxy server. |
|
1474 | Optional. User name to authenticate with at the proxy server. | |
1468 |
|
1475 | |||
1469 | ``always`` |
|
1476 | ``always`` | |
1470 | Optional. Always use the proxy, even for localhost and any entries |
|
1477 | Optional. Always use the proxy, even for localhost and any entries | |
1471 | in ``http_proxy.no``. (default: False) |
|
1478 | in ``http_proxy.no``. (default: False) | |
1472 |
|
1479 | |||
1473 | ``http`` |
|
1480 | ``http`` | |
1474 | ---------- |
|
1481 | ---------- | |
1475 |
|
1482 | |||
1476 | Used to configure access to Mercurial repositories via HTTP. |
|
1483 | Used to configure access to Mercurial repositories via HTTP. | |
1477 |
|
1484 | |||
1478 | ``timeout`` |
|
1485 | ``timeout`` | |
1479 | If set, blocking operations will timeout after that many seconds. |
|
1486 | If set, blocking operations will timeout after that many seconds. | |
1480 | (default: None) |
|
1487 | (default: None) | |
1481 |
|
1488 | |||
1482 | ``merge`` |
|
1489 | ``merge`` | |
1483 | --------- |
|
1490 | --------- | |
1484 |
|
1491 | |||
1485 | This section specifies behavior during merges and updates. |
|
1492 | This section specifies behavior during merges and updates. | |
1486 |
|
1493 | |||
1487 | ``checkignored`` |
|
1494 | ``checkignored`` | |
1488 | Controls behavior when an ignored file on disk has the same name as a tracked |
|
1495 | Controls behavior when an ignored file on disk has the same name as a tracked | |
1489 | file in the changeset being merged or updated to, and has different |
|
1496 | file in the changeset being merged or updated to, and has different | |
1490 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, |
|
1497 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, | |
1491 | abort on such files. With ``warn``, warn on such files and back them up as |
|
1498 | abort on such files. With ``warn``, warn on such files and back them up as | |
1492 | ``.orig``. With ``ignore``, don't print a warning and back them up as |
|
1499 | ``.orig``. With ``ignore``, don't print a warning and back them up as | |
1493 | ``.orig``. (default: ``abort``) |
|
1500 | ``.orig``. (default: ``abort``) | |
1494 |
|
1501 | |||
1495 | ``checkunknown`` |
|
1502 | ``checkunknown`` | |
1496 | Controls behavior when an unknown file that isn't ignored has the same name |
|
1503 | Controls behavior when an unknown file that isn't ignored has the same name | |
1497 | as a tracked file in the changeset being merged or updated to, and has |
|
1504 | as a tracked file in the changeset being merged or updated to, and has | |
1498 | different contents. Similar to ``merge.checkignored``, except for files that |
|
1505 | different contents. Similar to ``merge.checkignored``, except for files that | |
1499 | are not ignored. (default: ``abort``) |
|
1506 | are not ignored. (default: ``abort``) | |
1500 |
|
1507 | |||
1501 | ``on-failure`` |
|
1508 | ``on-failure`` | |
1502 | When set to ``continue`` (the default), the merge process attempts to |
|
1509 | When set to ``continue`` (the default), the merge process attempts to | |
1503 | merge all unresolved files using the merge chosen tool, regardless of |
|
1510 | merge all unresolved files using the merge chosen tool, regardless of | |
1504 | whether previous file merge attempts during the process succeeded or not. |
|
1511 | whether previous file merge attempts during the process succeeded or not. | |
1505 | Setting this to ``prompt`` will prompt after any merge failure continue |
|
1512 | Setting this to ``prompt`` will prompt after any merge failure continue | |
1506 | or halt the merge process. Setting this to ``halt`` will automatically |
|
1513 | or halt the merge process. Setting this to ``halt`` will automatically | |
1507 | halt the merge process on any merge tool failure. The merge process |
|
1514 | halt the merge process on any merge tool failure. The merge process | |
1508 | can be restarted by using the ``resolve`` command. When a merge is |
|
1515 | can be restarted by using the ``resolve`` command. When a merge is | |
1509 | halted, the repository is left in a normal ``unresolved`` merge state. |
|
1516 | halted, the repository is left in a normal ``unresolved`` merge state. | |
1510 | (default: ``continue``) |
|
1517 | (default: ``continue``) | |
1511 |
|
1518 | |||
1512 | ``strict-capability-check`` |
|
1519 | ``strict-capability-check`` | |
1513 | Whether capabilities of internal merge tools are checked strictly |
|
1520 | Whether capabilities of internal merge tools are checked strictly | |
1514 | or not, while examining rules to decide merge tool to be used. |
|
1521 | or not, while examining rules to decide merge tool to be used. | |
1515 | (default: False) |
|
1522 | (default: False) | |
1516 |
|
1523 | |||
1517 | ``merge-patterns`` |
|
1524 | ``merge-patterns`` | |
1518 | ------------------ |
|
1525 | ------------------ | |
1519 |
|
1526 | |||
1520 | This section specifies merge tools to associate with particular file |
|
1527 | This section specifies merge tools to associate with particular file | |
1521 | patterns. Tools matched here will take precedence over the default |
|
1528 | patterns. Tools matched here will take precedence over the default | |
1522 | merge tool. Patterns are globs by default, rooted at the repository |
|
1529 | merge tool. Patterns are globs by default, rooted at the repository | |
1523 | root. |
|
1530 | root. | |
1524 |
|
1531 | |||
1525 | Example:: |
|
1532 | Example:: | |
1526 |
|
1533 | |||
1527 | [merge-patterns] |
|
1534 | [merge-patterns] | |
1528 | **.c = kdiff3 |
|
1535 | **.c = kdiff3 | |
1529 | **.jpg = myimgmerge |
|
1536 | **.jpg = myimgmerge | |
1530 |
|
1537 | |||
1531 | ``merge-tools`` |
|
1538 | ``merge-tools`` | |
1532 | --------------- |
|
1539 | --------------- | |
1533 |
|
1540 | |||
1534 | This section configures external merge tools to use for file-level |
|
1541 | This section configures external merge tools to use for file-level | |
1535 | merges. This section has likely been preconfigured at install time. |
|
1542 | merges. This section has likely been preconfigured at install time. | |
1536 | Use :hg:`config merge-tools` to check the existing configuration. |
|
1543 | Use :hg:`config merge-tools` to check the existing configuration. | |
1537 | Also see :hg:`help merge-tools` for more details. |
|
1544 | Also see :hg:`help merge-tools` for more details. | |
1538 |
|
1545 | |||
1539 | Example ``~/.hgrc``:: |
|
1546 | Example ``~/.hgrc``:: | |
1540 |
|
1547 | |||
1541 | [merge-tools] |
|
1548 | [merge-tools] | |
1542 | # Override stock tool location |
|
1549 | # Override stock tool location | |
1543 | kdiff3.executable = ~/bin/kdiff3 |
|
1550 | kdiff3.executable = ~/bin/kdiff3 | |
1544 | # Specify command line |
|
1551 | # Specify command line | |
1545 | kdiff3.args = $base $local $other -o $output |
|
1552 | kdiff3.args = $base $local $other -o $output | |
1546 | # Give higher priority |
|
1553 | # Give higher priority | |
1547 | kdiff3.priority = 1 |
|
1554 | kdiff3.priority = 1 | |
1548 |
|
1555 | |||
1549 | # Changing the priority of preconfigured tool |
|
1556 | # Changing the priority of preconfigured tool | |
1550 | meld.priority = 0 |
|
1557 | meld.priority = 0 | |
1551 |
|
1558 | |||
1552 | # Disable a preconfigured tool |
|
1559 | # Disable a preconfigured tool | |
1553 | vimdiff.disabled = yes |
|
1560 | vimdiff.disabled = yes | |
1554 |
|
1561 | |||
1555 | # Define new tool |
|
1562 | # Define new tool | |
1556 | myHtmlTool.args = -m $local $other $base $output |
|
1563 | myHtmlTool.args = -m $local $other $base $output | |
1557 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
1564 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
1558 | myHtmlTool.priority = 1 |
|
1565 | myHtmlTool.priority = 1 | |
1559 |
|
1566 | |||
1560 | Supported arguments: |
|
1567 | Supported arguments: | |
1561 |
|
1568 | |||
1562 | ``priority`` |
|
1569 | ``priority`` | |
1563 | The priority in which to evaluate this tool. |
|
1570 | The priority in which to evaluate this tool. | |
1564 | (default: 0) |
|
1571 | (default: 0) | |
1565 |
|
1572 | |||
1566 | ``executable`` |
|
1573 | ``executable`` | |
1567 | Either just the name of the executable or its pathname. |
|
1574 | Either just the name of the executable or its pathname. | |
1568 |
|
1575 | |||
1569 | .. container:: windows |
|
1576 | .. container:: windows | |
1570 |
|
1577 | |||
1571 | On Windows, the path can use environment variables with ${ProgramFiles} |
|
1578 | On Windows, the path can use environment variables with ${ProgramFiles} | |
1572 | syntax. |
|
1579 | syntax. | |
1573 |
|
1580 | |||
1574 | (default: the tool name) |
|
1581 | (default: the tool name) | |
1575 |
|
1582 | |||
1576 | ``args`` |
|
1583 | ``args`` | |
1577 | The arguments to pass to the tool executable. You can refer to the |
|
1584 | The arguments to pass to the tool executable. You can refer to the | |
1578 | files being merged as well as the output file through these |
|
1585 | files being merged as well as the output file through these | |
1579 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
1586 | variables: ``$base``, ``$local``, ``$other``, ``$output``. | |
1580 |
|
1587 | |||
1581 | The meaning of ``$local`` and ``$other`` can vary depending on which action is |
|
1588 | The meaning of ``$local`` and ``$other`` can vary depending on which action is | |
1582 | being performed. During an update or merge, ``$local`` represents the original |
|
1589 | being performed. During an update or merge, ``$local`` represents the original | |
1583 | state of the file, while ``$other`` represents the commit you are updating to or |
|
1590 | state of the file, while ``$other`` represents the commit you are updating to or | |
1584 | the commit you are merging with. During a rebase, ``$local`` represents the |
|
1591 | the commit you are merging with. During a rebase, ``$local`` represents the | |
1585 | destination of the rebase, and ``$other`` represents the commit being rebased. |
|
1592 | destination of the rebase, and ``$other`` represents the commit being rebased. | |
1586 |
|
1593 | |||
1587 | Some operations define custom labels to assist with identifying the revisions, |
|
1594 | Some operations define custom labels to assist with identifying the revisions, | |
1588 | accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom |
|
1595 | accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom | |
1589 | labels are not available, these will be ``local``, ``other``, and ``base``, |
|
1596 | labels are not available, these will be ``local``, ``other``, and ``base``, | |
1590 | respectively. |
|
1597 | respectively. | |
1591 | (default: ``$local $base $other``) |
|
1598 | (default: ``$local $base $other``) | |
1592 |
|
1599 | |||
1593 | ``premerge`` |
|
1600 | ``premerge`` | |
1594 | Attempt to run internal non-interactive 3-way merge tool before |
|
1601 | Attempt to run internal non-interactive 3-way merge tool before | |
1595 | launching external tool. Options are ``true``, ``false``, ``keep``, |
|
1602 | launching external tool. Options are ``true``, ``false``, ``keep``, | |
1596 | ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option |
|
1603 | ``keep-merge3``, or ``keep-mergediff`` (experimental). The ``keep`` option | |
1597 | will leave markers in the file if the premerge fails. The ``keep-merge3`` |
|
1604 | will leave markers in the file if the premerge fails. The ``keep-merge3`` | |
1598 | will do the same but include information about the base of the merge in the |
|
1605 | will do the same but include information about the base of the merge in the | |
1599 | marker (see internal :merge3 in :hg:`help merge-tools`). The |
|
1606 | marker (see internal :merge3 in :hg:`help merge-tools`). The | |
1600 | ``keep-mergediff`` option is similar but uses a different marker style |
|
1607 | ``keep-mergediff`` option is similar but uses a different marker style | |
1601 | (see internal :merge3 in :hg:`help merge-tools`). (default: True) |
|
1608 | (see internal :merge3 in :hg:`help merge-tools`). (default: True) | |
1602 |
|
1609 | |||
1603 | ``binary`` |
|
1610 | ``binary`` | |
1604 | This tool can merge binary files. (default: False, unless tool |
|
1611 | This tool can merge binary files. (default: False, unless tool | |
1605 | was selected by file pattern match) |
|
1612 | was selected by file pattern match) | |
1606 |
|
1613 | |||
1607 | ``symlink`` |
|
1614 | ``symlink`` | |
1608 | This tool can merge symlinks. (default: False) |
|
1615 | This tool can merge symlinks. (default: False) | |
1609 |
|
1616 | |||
1610 | ``check`` |
|
1617 | ``check`` | |
1611 | A list of merge success-checking options: |
|
1618 | A list of merge success-checking options: | |
1612 |
|
1619 | |||
1613 | ``changed`` |
|
1620 | ``changed`` | |
1614 | Ask whether merge was successful when the merged file shows no changes. |
|
1621 | Ask whether merge was successful when the merged file shows no changes. | |
1615 | ``conflicts`` |
|
1622 | ``conflicts`` | |
1616 | Check whether there are conflicts even though the tool reported success. |
|
1623 | Check whether there are conflicts even though the tool reported success. | |
1617 | ``prompt`` |
|
1624 | ``prompt`` | |
1618 | Always prompt for merge success, regardless of success reported by tool. |
|
1625 | Always prompt for merge success, regardless of success reported by tool. | |
1619 |
|
1626 | |||
1620 | ``fixeol`` |
|
1627 | ``fixeol`` | |
1621 | Attempt to fix up EOL changes caused by the merge tool. |
|
1628 | Attempt to fix up EOL changes caused by the merge tool. | |
1622 | (default: False) |
|
1629 | (default: False) | |
1623 |
|
1630 | |||
1624 | ``gui`` |
|
1631 | ``gui`` | |
1625 | This tool requires a graphical interface to run. (default: False) |
|
1632 | This tool requires a graphical interface to run. (default: False) | |
1626 |
|
1633 | |||
1627 | ``mergemarkers`` |
|
1634 | ``mergemarkers`` | |
1628 | Controls whether the labels passed via ``$labellocal``, ``$labelother``, and |
|
1635 | Controls whether the labels passed via ``$labellocal``, ``$labelother``, and | |
1629 | ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or |
|
1636 | ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or | |
1630 | ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict |
|
1637 | ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict | |
1631 | markers generated during premerge will be ``detailed`` if either this option or |
|
1638 | markers generated during premerge will be ``detailed`` if either this option or | |
1632 | the corresponding option in the ``[ui]`` section is ``detailed``. |
|
1639 | the corresponding option in the ``[ui]`` section is ``detailed``. | |
1633 | (default: ``basic``) |
|
1640 | (default: ``basic``) | |
1634 |
|
1641 | |||
1635 | ``mergemarkertemplate`` |
|
1642 | ``mergemarkertemplate`` | |
1636 | This setting can be used to override ``mergemarker`` from the |
|
1643 | This setting can be used to override ``mergemarker`` from the | |
1637 | ``[command-templates]`` section on a per-tool basis; this applies to the |
|
1644 | ``[command-templates]`` section on a per-tool basis; this applies to the | |
1638 | ``$label``-prefixed variables and to the conflict markers that are generated |
|
1645 | ``$label``-prefixed variables and to the conflict markers that are generated | |
1639 | if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable |
|
1646 | if ``premerge`` is ``keep` or ``keep-merge3``. See the corresponding variable | |
1640 | in ``[ui]`` for more information. |
|
1647 | in ``[ui]`` for more information. | |
1641 |
|
1648 | |||
1642 | .. container:: windows |
|
1649 | .. container:: windows | |
1643 |
|
1650 | |||
1644 | ``regkey`` |
|
1651 | ``regkey`` | |
1645 | Windows registry key which describes install location of this |
|
1652 | Windows registry key which describes install location of this | |
1646 | tool. Mercurial will search for this key first under |
|
1653 | tool. Mercurial will search for this key first under | |
1647 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1654 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
1648 | (default: None) |
|
1655 | (default: None) | |
1649 |
|
1656 | |||
1650 | ``regkeyalt`` |
|
1657 | ``regkeyalt`` | |
1651 | An alternate Windows registry key to try if the first key is not |
|
1658 | An alternate Windows registry key to try if the first key is not | |
1652 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1659 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
1653 | semantics of the primary key. The most common use for this key |
|
1660 | semantics of the primary key. The most common use for this key | |
1654 | is to search for 32bit applications on 64bit operating systems. |
|
1661 | is to search for 32bit applications on 64bit operating systems. | |
1655 | (default: None) |
|
1662 | (default: None) | |
1656 |
|
1663 | |||
1657 | ``regname`` |
|
1664 | ``regname`` | |
1658 | Name of value to read from specified registry key. |
|
1665 | Name of value to read from specified registry key. | |
1659 | (default: the unnamed (default) value) |
|
1666 | (default: the unnamed (default) value) | |
1660 |
|
1667 | |||
1661 | ``regappend`` |
|
1668 | ``regappend`` | |
1662 | String to append to the value read from the registry, typically |
|
1669 | String to append to the value read from the registry, typically | |
1663 | the executable name of the tool. |
|
1670 | the executable name of the tool. | |
1664 | (default: None) |
|
1671 | (default: None) | |
1665 |
|
1672 | |||
1666 | ``pager`` |
|
1673 | ``pager`` | |
1667 | --------- |
|
1674 | --------- | |
1668 |
|
1675 | |||
1669 | Setting used to control when to paginate and with what external tool. See |
|
1676 | Setting used to control when to paginate and with what external tool. See | |
1670 | :hg:`help pager` for details. |
|
1677 | :hg:`help pager` for details. | |
1671 |
|
1678 | |||
1672 | ``pager`` |
|
1679 | ``pager`` | |
1673 | Define the external tool used as pager. |
|
1680 | Define the external tool used as pager. | |
1674 |
|
1681 | |||
1675 | If no pager is set, Mercurial uses the environment variable $PAGER. |
|
1682 | If no pager is set, Mercurial uses the environment variable $PAGER. | |
1676 | If neither pager.pager, nor $PAGER is set, a default pager will be |
|
1683 | If neither pager.pager, nor $PAGER is set, a default pager will be | |
1677 | used, typically `less` on Unix and `more` on Windows. Example:: |
|
1684 | used, typically `less` on Unix and `more` on Windows. Example:: | |
1678 |
|
1685 | |||
1679 | [pager] |
|
1686 | [pager] | |
1680 | pager = less -FRX |
|
1687 | pager = less -FRX | |
1681 |
|
1688 | |||
1682 | ``ignore`` |
|
1689 | ``ignore`` | |
1683 | List of commands to disable the pager for. Example:: |
|
1690 | List of commands to disable the pager for. Example:: | |
1684 |
|
1691 | |||
1685 | [pager] |
|
1692 | [pager] | |
1686 | ignore = version, help, update |
|
1693 | ignore = version, help, update | |
1687 |
|
1694 | |||
1688 | ``patch`` |
|
1695 | ``patch`` | |
1689 | --------- |
|
1696 | --------- | |
1690 |
|
1697 | |||
1691 | Settings used when applying patches, for instance through the 'import' |
|
1698 | Settings used when applying patches, for instance through the 'import' | |
1692 | command or with Mercurial Queues extension. |
|
1699 | command or with Mercurial Queues extension. | |
1693 |
|
1700 | |||
1694 | ``eol`` |
|
1701 | ``eol`` | |
1695 | When set to 'strict' patch content and patched files end of lines |
|
1702 | When set to 'strict' patch content and patched files end of lines | |
1696 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1703 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
1697 | lines are ignored when patching and the result line endings are |
|
1704 | lines are ignored when patching and the result line endings are | |
1698 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1705 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
1699 | ``auto``, end of lines are again ignored while patching but line |
|
1706 | ``auto``, end of lines are again ignored while patching but line | |
1700 | endings in patched files are normalized to their original setting |
|
1707 | endings in patched files are normalized to their original setting | |
1701 | on a per-file basis. If target file does not exist or has no end |
|
1708 | on a per-file basis. If target file does not exist or has no end | |
1702 | of line, patch line endings are preserved. |
|
1709 | of line, patch line endings are preserved. | |
1703 | (default: strict) |
|
1710 | (default: strict) | |
1704 |
|
1711 | |||
1705 | ``fuzz`` |
|
1712 | ``fuzz`` | |
1706 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1713 | The number of lines of 'fuzz' to allow when applying patches. This | |
1707 | controls how much context the patcher is allowed to ignore when |
|
1714 | controls how much context the patcher is allowed to ignore when | |
1708 | trying to apply a patch. |
|
1715 | trying to apply a patch. | |
1709 | (default: 2) |
|
1716 | (default: 2) | |
1710 |
|
1717 | |||
1711 | ``paths`` |
|
1718 | ``paths`` | |
1712 | --------- |
|
1719 | --------- | |
1713 |
|
1720 | |||
1714 | Assigns symbolic names and behavior to repositories. |
|
1721 | Assigns symbolic names and behavior to repositories. | |
1715 |
|
1722 | |||
1716 | Options are symbolic names defining the URL or directory that is the |
|
1723 | Options are symbolic names defining the URL or directory that is the | |
1717 | location of the repository. Example:: |
|
1724 | location of the repository. Example:: | |
1718 |
|
1725 | |||
1719 | [paths] |
|
1726 | [paths] | |
1720 | my_server = https://example.com/my_repo |
|
1727 | my_server = https://example.com/my_repo | |
1721 | local_path = /home/me/repo |
|
1728 | local_path = /home/me/repo | |
1722 |
|
1729 | |||
1723 | These symbolic names can be used from the command line. To pull |
|
1730 | These symbolic names can be used from the command line. To pull | |
1724 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: |
|
1731 | from ``my_server``: :hg:`pull my_server`. To push to ``local_path``: | |
1725 | :hg:`push local_path`. You can check :hg:`help urls` for details about |
|
1732 | :hg:`push local_path`. You can check :hg:`help urls` for details about | |
1726 | valid URLs. |
|
1733 | valid URLs. | |
1727 |
|
1734 | |||
1728 | Options containing colons (``:``) denote sub-options that can influence |
|
1735 | Options containing colons (``:``) denote sub-options that can influence | |
1729 | behavior for that specific path. Example:: |
|
1736 | behavior for that specific path. Example:: | |
1730 |
|
1737 | |||
1731 | [paths] |
|
1738 | [paths] | |
1732 | my_server = https://example.com/my_path |
|
1739 | my_server = https://example.com/my_path | |
1733 | my_server:pushurl = ssh://example.com/my_path |
|
1740 | my_server:pushurl = ssh://example.com/my_path | |
1734 |
|
1741 | |||
1735 | Paths using the `path://otherpath` scheme will inherit the sub-options value from |
|
1742 | Paths using the `path://otherpath` scheme will inherit the sub-options value from | |
1736 | the path they point to. |
|
1743 | the path they point to. | |
1737 |
|
1744 | |||
1738 | The following sub-options can be defined: |
|
1745 | The following sub-options can be defined: | |
1739 |
|
1746 | |||
1740 | ``multi-urls`` |
|
1747 | ``multi-urls`` | |
1741 | A boolean option. When enabled the value of the `[paths]` entry will be |
|
1748 | A boolean option. When enabled the value of the `[paths]` entry will be | |
1742 | parsed as a list and the alias will resolve to multiple destination. If some |
|
1749 | parsed as a list and the alias will resolve to multiple destination. If some | |
1743 | of the list entry use the `path://` syntax, the suboption will be inherited |
|
1750 | of the list entry use the `path://` syntax, the suboption will be inherited | |
1744 | individually. |
|
1751 | individually. | |
1745 |
|
1752 | |||
1746 | ``pushurl`` |
|
1753 | ``pushurl`` | |
1747 | The URL to use for push operations. If not defined, the location |
|
1754 | The URL to use for push operations. If not defined, the location | |
1748 | defined by the path's main entry is used. |
|
1755 | defined by the path's main entry is used. | |
1749 |
|
1756 | |||
1750 | ``pushrev`` |
|
1757 | ``pushrev`` | |
1751 | A revset defining which revisions to push by default. |
|
1758 | A revset defining which revisions to push by default. | |
1752 |
|
1759 | |||
1753 | When :hg:`push` is executed without a ``-r`` argument, the revset |
|
1760 | When :hg:`push` is executed without a ``-r`` argument, the revset | |
1754 | defined by this sub-option is evaluated to determine what to push. |
|
1761 | defined by this sub-option is evaluated to determine what to push. | |
1755 |
|
1762 | |||
1756 | For example, a value of ``.`` will push the working directory's |
|
1763 | For example, a value of ``.`` will push the working directory's | |
1757 | revision by default. |
|
1764 | revision by default. | |
1758 |
|
1765 | |||
1759 | Revsets specifying bookmarks will not result in the bookmark being |
|
1766 | Revsets specifying bookmarks will not result in the bookmark being | |
1760 | pushed. |
|
1767 | pushed. | |
1761 |
|
1768 | |||
1762 | ``bookmarks.mode`` |
|
1769 | ``bookmarks.mode`` | |
1763 | How bookmark will be dealt during the exchange. It support the following value |
|
1770 | How bookmark will be dealt during the exchange. It support the following value | |
1764 |
|
1771 | |||
1765 | - ``default``: the default behavior, local and remote bookmarks are "merged" |
|
1772 | - ``default``: the default behavior, local and remote bookmarks are "merged" | |
1766 | on push/pull. |
|
1773 | on push/pull. | |
1767 |
|
1774 | |||
1768 | - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This |
|
1775 | - ``mirror``: when pulling, replace local bookmarks by remote bookmarks. This | |
1769 | is useful to replicate a repository, or as an optimization. |
|
1776 | is useful to replicate a repository, or as an optimization. | |
1770 |
|
1777 | |||
1771 | - ``ignore``: ignore bookmarks during exchange. |
|
1778 | - ``ignore``: ignore bookmarks during exchange. | |
1772 | (This currently only affect pulling) |
|
1779 | (This currently only affect pulling) | |
1773 |
|
1780 | |||
1774 | The following special named paths exist: |
|
1781 | The following special named paths exist: | |
1775 |
|
1782 | |||
1776 | ``default`` |
|
1783 | ``default`` | |
1777 | The URL or directory to use when no source or remote is specified. |
|
1784 | The URL or directory to use when no source or remote is specified. | |
1778 |
|
1785 | |||
1779 | :hg:`clone` will automatically define this path to the location the |
|
1786 | :hg:`clone` will automatically define this path to the location the | |
1780 | repository was cloned from. |
|
1787 | repository was cloned from. | |
1781 |
|
1788 | |||
1782 | ``default-push`` |
|
1789 | ``default-push`` | |
1783 | (deprecated) The URL or directory for the default :hg:`push` location. |
|
1790 | (deprecated) The URL or directory for the default :hg:`push` location. | |
1784 | ``default:pushurl`` should be used instead. |
|
1791 | ``default:pushurl`` should be used instead. | |
1785 |
|
1792 | |||
1786 | ``phases`` |
|
1793 | ``phases`` | |
1787 | ---------- |
|
1794 | ---------- | |
1788 |
|
1795 | |||
1789 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1796 | Specifies default handling of phases. See :hg:`help phases` for more | |
1790 | information about working with phases. |
|
1797 | information about working with phases. | |
1791 |
|
1798 | |||
1792 | ``publish`` |
|
1799 | ``publish`` | |
1793 | Controls draft phase behavior when working as a server. When true, |
|
1800 | Controls draft phase behavior when working as a server. When true, | |
1794 | pushed changesets are set to public in both client and server and |
|
1801 | pushed changesets are set to public in both client and server and | |
1795 | pulled or cloned changesets are set to public in the client. |
|
1802 | pulled or cloned changesets are set to public in the client. | |
1796 | (default: True) |
|
1803 | (default: True) | |
1797 |
|
1804 | |||
1798 | ``new-commit`` |
|
1805 | ``new-commit`` | |
1799 | Phase of newly-created commits. |
|
1806 | Phase of newly-created commits. | |
1800 | (default: draft) |
|
1807 | (default: draft) | |
1801 |
|
1808 | |||
1802 | ``checksubrepos`` |
|
1809 | ``checksubrepos`` | |
1803 | Check the phase of the current revision of each subrepository. Allowed |
|
1810 | Check the phase of the current revision of each subrepository. Allowed | |
1804 | values are "ignore", "follow" and "abort". For settings other than |
|
1811 | values are "ignore", "follow" and "abort". For settings other than | |
1805 | "ignore", the phase of the current revision of each subrepository is |
|
1812 | "ignore", the phase of the current revision of each subrepository is | |
1806 | checked before committing the parent repository. If any of those phases is |
|
1813 | checked before committing the parent repository. If any of those phases is | |
1807 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1814 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
1808 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1815 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
1809 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1816 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
1810 | used for the parent repository commit (if set to "follow"). |
|
1817 | used for the parent repository commit (if set to "follow"). | |
1811 | (default: follow) |
|
1818 | (default: follow) | |
1812 |
|
1819 | |||
1813 |
|
1820 | |||
1814 | ``profiling`` |
|
1821 | ``profiling`` | |
1815 | ------------- |
|
1822 | ------------- | |
1816 |
|
1823 | |||
1817 | Specifies profiling type, format, and file output. Two profilers are |
|
1824 | Specifies profiling type, format, and file output. Two profilers are | |
1818 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1825 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
1819 | profiler (named ``stat``). |
|
1826 | profiler (named ``stat``). | |
1820 |
|
1827 | |||
1821 | In this section description, 'profiling data' stands for the raw data |
|
1828 | In this section description, 'profiling data' stands for the raw data | |
1822 | collected during profiling, while 'profiling report' stands for a |
|
1829 | collected during profiling, while 'profiling report' stands for a | |
1823 | statistical text report generated from the profiling data. |
|
1830 | statistical text report generated from the profiling data. | |
1824 |
|
1831 | |||
1825 | ``enabled`` |
|
1832 | ``enabled`` | |
1826 | Enable the profiler. |
|
1833 | Enable the profiler. | |
1827 | (default: false) |
|
1834 | (default: false) | |
1828 |
|
1835 | |||
1829 | This is equivalent to passing ``--profile`` on the command line. |
|
1836 | This is equivalent to passing ``--profile`` on the command line. | |
1830 |
|
1837 | |||
1831 | ``type`` |
|
1838 | ``type`` | |
1832 | The type of profiler to use. |
|
1839 | The type of profiler to use. | |
1833 | (default: stat) |
|
1840 | (default: stat) | |
1834 |
|
1841 | |||
1835 | ``ls`` |
|
1842 | ``ls`` | |
1836 | Use Python's built-in instrumenting profiler. This profiler |
|
1843 | Use Python's built-in instrumenting profiler. This profiler | |
1837 | works on all platforms, but each line number it reports is the |
|
1844 | works on all platforms, but each line number it reports is the | |
1838 | first line of a function. This restriction makes it difficult to |
|
1845 | first line of a function. This restriction makes it difficult to | |
1839 | identify the expensive parts of a non-trivial function. |
|
1846 | identify the expensive parts of a non-trivial function. | |
1840 | ``stat`` |
|
1847 | ``stat`` | |
1841 | Use a statistical profiler, statprof. This profiler is most |
|
1848 | Use a statistical profiler, statprof. This profiler is most | |
1842 | useful for profiling commands that run for longer than about 0.1 |
|
1849 | useful for profiling commands that run for longer than about 0.1 | |
1843 | seconds. |
|
1850 | seconds. | |
1844 |
|
1851 | |||
1845 | ``format`` |
|
1852 | ``format`` | |
1846 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1853 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
1847 | (default: text) |
|
1854 | (default: text) | |
1848 |
|
1855 | |||
1849 | ``text`` |
|
1856 | ``text`` | |
1850 | Generate a profiling report. When saving to a file, it should be |
|
1857 | Generate a profiling report. When saving to a file, it should be | |
1851 | noted that only the report is saved, and the profiling data is |
|
1858 | noted that only the report is saved, and the profiling data is | |
1852 | not kept. |
|
1859 | not kept. | |
1853 | ``kcachegrind`` |
|
1860 | ``kcachegrind`` | |
1854 | Format profiling data for kcachegrind use: when saving to a |
|
1861 | Format profiling data for kcachegrind use: when saving to a | |
1855 | file, the generated file can directly be loaded into |
|
1862 | file, the generated file can directly be loaded into | |
1856 | kcachegrind. |
|
1863 | kcachegrind. | |
1857 |
|
1864 | |||
1858 | ``statformat`` |
|
1865 | ``statformat`` | |
1859 | Profiling format for the ``stat`` profiler. |
|
1866 | Profiling format for the ``stat`` profiler. | |
1860 | (default: hotpath) |
|
1867 | (default: hotpath) | |
1861 |
|
1868 | |||
1862 | ``hotpath`` |
|
1869 | ``hotpath`` | |
1863 | Show a tree-based display containing the hot path of execution (where |
|
1870 | Show a tree-based display containing the hot path of execution (where | |
1864 | most time was spent). |
|
1871 | most time was spent). | |
1865 | ``bymethod`` |
|
1872 | ``bymethod`` | |
1866 | Show a table of methods ordered by how frequently they are active. |
|
1873 | Show a table of methods ordered by how frequently they are active. | |
1867 | ``byline`` |
|
1874 | ``byline`` | |
1868 | Show a table of lines in files ordered by how frequently they are active. |
|
1875 | Show a table of lines in files ordered by how frequently they are active. | |
1869 | ``json`` |
|
1876 | ``json`` | |
1870 | Render profiling data as JSON. |
|
1877 | Render profiling data as JSON. | |
1871 |
|
1878 | |||
1872 | ``freq`` |
|
1879 | ``freq`` | |
1873 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1880 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1874 | (default: 1000) |
|
1881 | (default: 1000) | |
1875 |
|
1882 | |||
1876 | ``output`` |
|
1883 | ``output`` | |
1877 | File path where profiling data or report should be saved. If the |
|
1884 | File path where profiling data or report should be saved. If the | |
1878 | file exists, it is replaced. (default: None, data is printed on |
|
1885 | file exists, it is replaced. (default: None, data is printed on | |
1879 | stderr) |
|
1886 | stderr) | |
1880 |
|
1887 | |||
1881 | ``sort`` |
|
1888 | ``sort`` | |
1882 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1889 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1883 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1890 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1884 | ``inlinetime``. |
|
1891 | ``inlinetime``. | |
1885 | (default: inlinetime) |
|
1892 | (default: inlinetime) | |
1886 |
|
1893 | |||
1887 | ``time-track`` |
|
1894 | ``time-track`` | |
1888 | Control if the stat profiler track ``cpu`` or ``real`` time. |
|
1895 | Control if the stat profiler track ``cpu`` or ``real`` time. | |
1889 | (default: ``cpu`` on Windows, otherwise ``real``) |
|
1896 | (default: ``cpu`` on Windows, otherwise ``real``) | |
1890 |
|
1897 | |||
1891 | ``limit`` |
|
1898 | ``limit`` | |
1892 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1899 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1893 | (default: 30) |
|
1900 | (default: 30) | |
1894 |
|
1901 | |||
1895 | ``nested`` |
|
1902 | ``nested`` | |
1896 | Show at most this number of lines of drill-down info after each main entry. |
|
1903 | Show at most this number of lines of drill-down info after each main entry. | |
1897 | This can help explain the difference between Total and Inline. |
|
1904 | This can help explain the difference between Total and Inline. | |
1898 | Specific to the ``ls`` instrumenting profiler. |
|
1905 | Specific to the ``ls`` instrumenting profiler. | |
1899 | (default: 0) |
|
1906 | (default: 0) | |
1900 |
|
1907 | |||
1901 | ``showmin`` |
|
1908 | ``showmin`` | |
1902 | Minimum fraction of samples an entry must have for it to be displayed. |
|
1909 | Minimum fraction of samples an entry must have for it to be displayed. | |
1903 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a |
|
1910 | Can be specified as a float between ``0.0`` and ``1.0`` or can have a | |
1904 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. |
|
1911 | ``%`` afterwards to allow values up to ``100``. e.g. ``5%``. | |
1905 |
|
1912 | |||
1906 | Only used by the ``stat`` profiler. |
|
1913 | Only used by the ``stat`` profiler. | |
1907 |
|
1914 | |||
1908 | For the ``hotpath`` format, default is ``0.05``. |
|
1915 | For the ``hotpath`` format, default is ``0.05``. | |
1909 | For the ``chrome`` format, default is ``0.005``. |
|
1916 | For the ``chrome`` format, default is ``0.005``. | |
1910 |
|
1917 | |||
1911 | The option is unused on other formats. |
|
1918 | The option is unused on other formats. | |
1912 |
|
1919 | |||
1913 | ``showmax`` |
|
1920 | ``showmax`` | |
1914 | Maximum fraction of samples an entry can have before it is ignored in |
|
1921 | Maximum fraction of samples an entry can have before it is ignored in | |
1915 | display. Values format is the same as ``showmin``. |
|
1922 | display. Values format is the same as ``showmin``. | |
1916 |
|
1923 | |||
1917 | Only used by the ``stat`` profiler. |
|
1924 | Only used by the ``stat`` profiler. | |
1918 |
|
1925 | |||
1919 | For the ``chrome`` format, default is ``0.999``. |
|
1926 | For the ``chrome`` format, default is ``0.999``. | |
1920 |
|
1927 | |||
1921 | The option is unused on other formats. |
|
1928 | The option is unused on other formats. | |
1922 |
|
1929 | |||
1923 | ``showtime`` |
|
1930 | ``showtime`` | |
1924 | Show time taken as absolute durations, in addition to percentages. |
|
1931 | Show time taken as absolute durations, in addition to percentages. | |
1925 | Only used by the ``hotpath`` format. |
|
1932 | Only used by the ``hotpath`` format. | |
1926 | (default: true) |
|
1933 | (default: true) | |
1927 |
|
1934 | |||
1928 | ``progress`` |
|
1935 | ``progress`` | |
1929 | ------------ |
|
1936 | ------------ | |
1930 |
|
1937 | |||
1931 | Mercurial commands can draw progress bars that are as informative as |
|
1938 | Mercurial commands can draw progress bars that are as informative as | |
1932 | possible. Some progress bars only offer indeterminate information, while others |
|
1939 | possible. Some progress bars only offer indeterminate information, while others | |
1933 | have a definite end point. |
|
1940 | have a definite end point. | |
1934 |
|
1941 | |||
1935 | ``debug`` |
|
1942 | ``debug`` | |
1936 | Whether to print debug info when updating the progress bar. (default: False) |
|
1943 | Whether to print debug info when updating the progress bar. (default: False) | |
1937 |
|
1944 | |||
1938 | ``delay`` |
|
1945 | ``delay`` | |
1939 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1946 | Number of seconds (float) before showing the progress bar. (default: 3) | |
1940 |
|
1947 | |||
1941 | ``changedelay`` |
|
1948 | ``changedelay`` | |
1942 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1949 | Minimum delay before showing a new topic. When set to less than 3 * refresh, | |
1943 | that value will be used instead. (default: 1) |
|
1950 | that value will be used instead. (default: 1) | |
1944 |
|
1951 | |||
1945 | ``estimateinterval`` |
|
1952 | ``estimateinterval`` | |
1946 | Maximum sampling interval in seconds for speed and estimated time |
|
1953 | Maximum sampling interval in seconds for speed and estimated time | |
1947 | calculation. (default: 60) |
|
1954 | calculation. (default: 60) | |
1948 |
|
1955 | |||
1949 | ``refresh`` |
|
1956 | ``refresh`` | |
1950 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1957 | Time in seconds between refreshes of the progress bar. (default: 0.1) | |
1951 |
|
1958 | |||
1952 | ``format`` |
|
1959 | ``format`` | |
1953 | Format of the progress bar. |
|
1960 | Format of the progress bar. | |
1954 |
|
1961 | |||
1955 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1962 | Valid entries for the format field are ``topic``, ``bar``, ``number``, | |
1956 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the |
|
1963 | ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the | |
1957 | last 20 characters of the item, but this can be changed by adding either |
|
1964 | last 20 characters of the item, but this can be changed by adding either | |
1958 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the |
|
1965 | ``-<num>`` which would take the last num characters, or ``+<num>`` for the | |
1959 | first num characters. |
|
1966 | first num characters. | |
1960 |
|
1967 | |||
1961 | (default: topic bar number estimate) |
|
1968 | (default: topic bar number estimate) | |
1962 |
|
1969 | |||
1963 | ``width`` |
|
1970 | ``width`` | |
1964 | If set, the maximum width of the progress information (that is, min(width, |
|
1971 | If set, the maximum width of the progress information (that is, min(width, | |
1965 | term width) will be used). |
|
1972 | term width) will be used). | |
1966 |
|
1973 | |||
1967 | ``clear-complete`` |
|
1974 | ``clear-complete`` | |
1968 | Clear the progress bar after it's done. (default: True) |
|
1975 | Clear the progress bar after it's done. (default: True) | |
1969 |
|
1976 | |||
1970 | ``disable`` |
|
1977 | ``disable`` | |
1971 | If true, don't show a progress bar. |
|
1978 | If true, don't show a progress bar. | |
1972 |
|
1979 | |||
1973 | ``assume-tty`` |
|
1980 | ``assume-tty`` | |
1974 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1981 | If true, ALWAYS show a progress bar, unless disable is given. | |
1975 |
|
1982 | |||
1976 | ``rebase`` |
|
1983 | ``rebase`` | |
1977 | ---------- |
|
1984 | ---------- | |
1978 |
|
1985 | |||
1979 | ``evolution.allowdivergence`` |
|
1986 | ``evolution.allowdivergence`` | |
1980 | Default to False, when True allow creating divergence when performing |
|
1987 | Default to False, when True allow creating divergence when performing | |
1981 | rebase of obsolete changesets. |
|
1988 | rebase of obsolete changesets. | |
1982 |
|
1989 | |||
1983 | ``revsetalias`` |
|
1990 | ``revsetalias`` | |
1984 | --------------- |
|
1991 | --------------- | |
1985 |
|
1992 | |||
1986 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1993 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1987 |
|
1994 | |||
1988 | ``rewrite`` |
|
1995 | ``rewrite`` | |
1989 | ----------- |
|
1996 | ----------- | |
1990 |
|
1997 | |||
1991 | ``backup-bundle`` |
|
1998 | ``backup-bundle`` | |
1992 | Whether to save stripped changesets to a bundle file. (default: True) |
|
1999 | Whether to save stripped changesets to a bundle file. (default: True) | |
1993 |
|
2000 | |||
1994 | ``update-timestamp`` |
|
2001 | ``update-timestamp`` | |
1995 | If true, updates the date and time of the changeset to current. It is only |
|
2002 | If true, updates the date and time of the changeset to current. It is only | |
1996 | applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the |
|
2003 | applicable for `hg amend`, `hg commit --amend` and `hg uncommit` in the | |
1997 | current version. |
|
2004 | current version. | |
1998 |
|
2005 | |||
1999 | ``empty-successor`` |
|
2006 | ``empty-successor`` | |
2000 |
|
2007 | |||
2001 | Control what happens with empty successors that are the result of rewrite |
|
2008 | Control what happens with empty successors that are the result of rewrite | |
2002 | operations. If set to ``skip``, the successor is not created. If set to |
|
2009 | operations. If set to ``skip``, the successor is not created. If set to | |
2003 | ``keep``, the empty successor is created and kept. |
|
2010 | ``keep``, the empty successor is created and kept. | |
2004 |
|
2011 | |||
2005 | Currently, only the rebase and absorb commands consider this configuration. |
|
2012 | Currently, only the rebase and absorb commands consider this configuration. | |
2006 | (EXPERIMENTAL) |
|
2013 | (EXPERIMENTAL) | |
2007 |
|
2014 | |||
2008 | ``share`` |
|
2015 | ``share`` | |
2009 | --------- |
|
2016 | --------- | |
2010 |
|
2017 | |||
2011 | ``safe-mismatch.source-safe`` |
|
2018 | ``safe-mismatch.source-safe`` | |
2012 |
|
2019 | |||
2013 | Controls what happens when the shared repository does not use the |
|
2020 | Controls what happens when the shared repository does not use the | |
2014 | share-safe mechanism but its source repository does. |
|
2021 | share-safe mechanism but its source repository does. | |
2015 |
|
2022 | |||
2016 | Possible values are `abort` (default), `allow`, `upgrade-abort` and |
|
2023 | Possible values are `abort` (default), `allow`, `upgrade-abort` and | |
2017 | `upgrade-abort`. |
|
2024 | `upgrade-abort`. | |
2018 |
|
2025 | |||
2019 | ``abort`` |
|
2026 | ``abort`` | |
2020 | Disallows running any command and aborts |
|
2027 | Disallows running any command and aborts | |
2021 | ``allow`` |
|
2028 | ``allow`` | |
2022 | Respects the feature presence in the share source |
|
2029 | Respects the feature presence in the share source | |
2023 | ``upgrade-abort`` |
|
2030 | ``upgrade-abort`` | |
2024 | tries to upgrade the share to use share-safe; if it fails, aborts |
|
2031 | tries to upgrade the share to use share-safe; if it fails, aborts | |
2025 | ``upgrade-allow`` |
|
2032 | ``upgrade-allow`` | |
2026 | tries to upgrade the share; if it fails, continue by |
|
2033 | tries to upgrade the share; if it fails, continue by | |
2027 | respecting the share source setting |
|
2034 | respecting the share source setting | |
2028 |
|
2035 | |||
2029 | Check :hg:`help config format.use-share-safe` for details about the |
|
2036 | Check :hg:`help config format.use-share-safe` for details about the | |
2030 | share-safe feature. |
|
2037 | share-safe feature. | |
2031 |
|
2038 | |||
2032 | ``safe-mismatch.source-safe.warn`` |
|
2039 | ``safe-mismatch.source-safe.warn`` | |
2033 | Shows a warning on operations if the shared repository does not use |
|
2040 | Shows a warning on operations if the shared repository does not use | |
2034 | share-safe, but the source repository does. |
|
2041 | share-safe, but the source repository does. | |
2035 | (default: True) |
|
2042 | (default: True) | |
2036 |
|
2043 | |||
2037 | ``safe-mismatch.source-not-safe`` |
|
2044 | ``safe-mismatch.source-not-safe`` | |
2038 |
|
2045 | |||
2039 | Controls what happens when the shared repository uses the share-safe |
|
2046 | Controls what happens when the shared repository uses the share-safe | |
2040 | mechanism but its source does not. |
|
2047 | mechanism but its source does not. | |
2041 |
|
2048 | |||
2042 | Possible values are `abort` (default), `allow`, `downgrade-abort` and |
|
2049 | Possible values are `abort` (default), `allow`, `downgrade-abort` and | |
2043 | `downgrade-abort`. |
|
2050 | `downgrade-abort`. | |
2044 |
|
2051 | |||
2045 | ``abort`` |
|
2052 | ``abort`` | |
2046 | Disallows running any command and aborts |
|
2053 | Disallows running any command and aborts | |
2047 | ``allow`` |
|
2054 | ``allow`` | |
2048 | Respects the feature presence in the share source |
|
2055 | Respects the feature presence in the share source | |
2049 | ``downgrade-abort`` |
|
2056 | ``downgrade-abort`` | |
2050 | tries to downgrade the share to not use share-safe; if it fails, aborts |
|
2057 | tries to downgrade the share to not use share-safe; if it fails, aborts | |
2051 | ``downgrade-allow`` |
|
2058 | ``downgrade-allow`` | |
2052 | tries to downgrade the share to not use share-safe; |
|
2059 | tries to downgrade the share to not use share-safe; | |
2053 | if it fails, continue by respecting the shared source setting |
|
2060 | if it fails, continue by respecting the shared source setting | |
2054 |
|
2061 | |||
2055 | Check :hg:`help config format.use-share-safe` for details about the |
|
2062 | Check :hg:`help config format.use-share-safe` for details about the | |
2056 | share-safe feature. |
|
2063 | share-safe feature. | |
2057 |
|
2064 | |||
2058 | ``safe-mismatch.source-not-safe.warn`` |
|
2065 | ``safe-mismatch.source-not-safe.warn`` | |
2059 | Shows a warning on operations if the shared repository uses share-safe, |
|
2066 | Shows a warning on operations if the shared repository uses share-safe, | |
2060 | but the source repository does not. |
|
2067 | but the source repository does not. | |
2061 | (default: True) |
|
2068 | (default: True) | |
2062 |
|
2069 | |||
2063 | ``storage`` |
|
2070 | ``storage`` | |
2064 | ----------- |
|
2071 | ----------- | |
2065 |
|
2072 | |||
2066 | Control the strategy Mercurial uses internally to store history. Options in this |
|
2073 | Control the strategy Mercurial uses internally to store history. Options in this | |
2067 | category impact performance and repository size. |
|
2074 | category impact performance and repository size. | |
2068 |
|
2075 | |||
2069 | ``revlog.issue6528.fix-incoming`` |
|
2076 | ``revlog.issue6528.fix-incoming`` | |
2070 | Version 5.8 of Mercurial had a bug leading to altering the parent of file |
|
2077 | Version 5.8 of Mercurial had a bug leading to altering the parent of file | |
2071 | revision with copy information (or any other metadata) on exchange. This |
|
2078 | revision with copy information (or any other metadata) on exchange. This | |
2072 | leads to the copy metadata to be overlooked by various internal logic. The |
|
2079 | leads to the copy metadata to be overlooked by various internal logic. The | |
2073 | issue was fixed in Mercurial 5.8.1. |
|
2080 | issue was fixed in Mercurial 5.8.1. | |
2074 | (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details) |
|
2081 | (See https://bz.mercurial-scm.org/show_bug.cgi?id=6528 for details) | |
2075 |
|
2082 | |||
2076 | As a result Mercurial is now checking and fixing incoming file revisions to |
|
2083 | As a result Mercurial is now checking and fixing incoming file revisions to | |
2077 | make sure there parents are in the right order. This behavior can be |
|
2084 | make sure there parents are in the right order. This behavior can be | |
2078 | disabled by setting this option to `no`. This apply to revisions added |
|
2085 | disabled by setting this option to `no`. This apply to revisions added | |
2079 | through push, pull, clone and unbundle. |
|
2086 | through push, pull, clone and unbundle. | |
2080 |
|
2087 | |||
2081 | To fix affected revisions that already exist within the repository, one can |
|
2088 | To fix affected revisions that already exist within the repository, one can | |
2082 | use :hg:`debug-repair-issue-6528`. |
|
2089 | use :hg:`debug-repair-issue-6528`. | |
2083 |
|
2090 | |||
2084 | ``revlog.optimize-delta-parent-choice`` |
|
2091 | ``revlog.optimize-delta-parent-choice`` | |
2085 | When storing a merge revision, both parents will be equally considered as |
|
2092 | When storing a merge revision, both parents will be equally considered as | |
2086 | a possible delta base. This results in better delta selection and improved |
|
2093 | a possible delta base. This results in better delta selection and improved | |
2087 | revlog compression. This option is enabled by default. |
|
2094 | revlog compression. This option is enabled by default. | |
2088 |
|
2095 | |||
2089 | Turning this option off can result in large increase of repository size for |
|
2096 | Turning this option off can result in large increase of repository size for | |
2090 | repository with many merges. |
|
2097 | repository with many merges. | |
2091 |
|
2098 | |||
2092 | ``revlog.persistent-nodemap.mmap`` |
|
2099 | ``revlog.persistent-nodemap.mmap`` | |
2093 | Whether to use the Operating System "memory mapping" feature (when |
|
2100 | Whether to use the Operating System "memory mapping" feature (when | |
2094 | possible) to access the persistent nodemap data. This improve performance |
|
2101 | possible) to access the persistent nodemap data. This improve performance | |
2095 | and reduce memory pressure. |
|
2102 | and reduce memory pressure. | |
2096 |
|
2103 | |||
2097 | Default to True. |
|
2104 | Default to True. | |
2098 |
|
2105 | |||
2099 | For details on the "persistent-nodemap" feature, see: |
|
2106 | For details on the "persistent-nodemap" feature, see: | |
2100 | :hg:`help config format.use-persistent-nodemap`. |
|
2107 | :hg:`help config format.use-persistent-nodemap`. | |
2101 |
|
2108 | |||
2102 | ``revlog.persistent-nodemap.slow-path`` |
|
2109 | ``revlog.persistent-nodemap.slow-path`` | |
2103 | Control the behavior of Merucrial when using a repository with "persistent" |
|
2110 | Control the behavior of Merucrial when using a repository with "persistent" | |
2104 | nodemap with an installation of Mercurial without a fast implementation for |
|
2111 | nodemap with an installation of Mercurial without a fast implementation for | |
2105 | the feature: |
|
2112 | the feature: | |
2106 |
|
2113 | |||
2107 | ``allow``: Silently use the slower implementation to access the repository. |
|
2114 | ``allow``: Silently use the slower implementation to access the repository. | |
2108 | ``warn``: Warn, but use the slower implementation to access the repository. |
|
2115 | ``warn``: Warn, but use the slower implementation to access the repository. | |
2109 | ``abort``: Prevent access to such repositories. (This is the default) |
|
2116 | ``abort``: Prevent access to such repositories. (This is the default) | |
2110 |
|
2117 | |||
2111 | For details on the "persistent-nodemap" feature, see: |
|
2118 | For details on the "persistent-nodemap" feature, see: | |
2112 | :hg:`help config format.use-persistent-nodemap`. |
|
2119 | :hg:`help config format.use-persistent-nodemap`. | |
2113 |
|
2120 | |||
2114 | ``revlog.reuse-external-delta-parent`` |
|
2121 | ``revlog.reuse-external-delta-parent`` | |
2115 | Control the order in which delta parents are considered when adding new |
|
2122 | Control the order in which delta parents are considered when adding new | |
2116 | revisions from an external source. |
|
2123 | revisions from an external source. | |
2117 | (typically: apply bundle from `hg pull` or `hg push`). |
|
2124 | (typically: apply bundle from `hg pull` or `hg push`). | |
2118 |
|
2125 | |||
2119 | New revisions are usually provided as a delta against other revisions. By |
|
2126 | New revisions are usually provided as a delta against other revisions. By | |
2120 | default, Mercurial will try to reuse this delta first, therefore using the |
|
2127 | default, Mercurial will try to reuse this delta first, therefore using the | |
2121 | same "delta parent" as the source. Directly using delta's from the source |
|
2128 | same "delta parent" as the source. Directly using delta's from the source | |
2122 | reduces CPU usage and usually speeds up operation. However, in some case, |
|
2129 | reduces CPU usage and usually speeds up operation. However, in some case, | |
2123 | the source might have sub-optimal delta bases and forcing their reevaluation |
|
2130 | the source might have sub-optimal delta bases and forcing their reevaluation | |
2124 | is useful. For example, pushes from an old client could have sub-optimal |
|
2131 | is useful. For example, pushes from an old client could have sub-optimal | |
2125 | delta's parent that the server want to optimize. (lack of general delta, bad |
|
2132 | delta's parent that the server want to optimize. (lack of general delta, bad | |
2126 | parents, choice, lack of sparse-revlog, etc). |
|
2133 | parents, choice, lack of sparse-revlog, etc). | |
2127 |
|
2134 | |||
2128 | This option is enabled by default. Turning it off will ensure bad delta |
|
2135 | This option is enabled by default. Turning it off will ensure bad delta | |
2129 | parent choices from older client do not propagate to this repository, at |
|
2136 | parent choices from older client do not propagate to this repository, at | |
2130 | the cost of a small increase in CPU consumption. |
|
2137 | the cost of a small increase in CPU consumption. | |
2131 |
|
2138 | |||
2132 | Note: this option only control the order in which delta parents are |
|
2139 | Note: this option only control the order in which delta parents are | |
2133 | considered. Even when disabled, the existing delta from the source will be |
|
2140 | considered. Even when disabled, the existing delta from the source will be | |
2134 | reused if the same delta parent is selected. |
|
2141 | reused if the same delta parent is selected. | |
2135 |
|
2142 | |||
2136 | ``revlog.reuse-external-delta`` |
|
2143 | ``revlog.reuse-external-delta`` | |
2137 | Control the reuse of delta from external source. |
|
2144 | Control the reuse of delta from external source. | |
2138 | (typically: apply bundle from `hg pull` or `hg push`). |
|
2145 | (typically: apply bundle from `hg pull` or `hg push`). | |
2139 |
|
2146 | |||
2140 | New revisions are usually provided as a delta against another revision. By |
|
2147 | New revisions are usually provided as a delta against another revision. By | |
2141 | default, Mercurial will not recompute the same delta again, trusting |
|
2148 | default, Mercurial will not recompute the same delta again, trusting | |
2142 | externally provided deltas. There have been rare cases of small adjustment |
|
2149 | externally provided deltas. There have been rare cases of small adjustment | |
2143 | to the diffing algorithm in the past. So in some rare case, recomputing |
|
2150 | to the diffing algorithm in the past. So in some rare case, recomputing | |
2144 | delta provided by ancient clients can provides better results. Disabling |
|
2151 | delta provided by ancient clients can provides better results. Disabling | |
2145 | this option means going through a full delta recomputation for all incoming |
|
2152 | this option means going through a full delta recomputation for all incoming | |
2146 | revisions. It means a large increase in CPU usage and will slow operations |
|
2153 | revisions. It means a large increase in CPU usage and will slow operations | |
2147 | down. |
|
2154 | down. | |
2148 |
|
2155 | |||
2149 | This option is enabled by default. When disabled, it also disables the |
|
2156 | This option is enabled by default. When disabled, it also disables the | |
2150 | related ``storage.revlog.reuse-external-delta-parent`` option. |
|
2157 | related ``storage.revlog.reuse-external-delta-parent`` option. | |
2151 |
|
2158 | |||
2152 | ``revlog.zlib.level`` |
|
2159 | ``revlog.zlib.level`` | |
2153 | Zlib compression level used when storing data into the repository. Accepted |
|
2160 | Zlib compression level used when storing data into the repository. Accepted | |
2154 | Value range from 1 (lowest compression) to 9 (highest compression). Zlib |
|
2161 | Value range from 1 (lowest compression) to 9 (highest compression). Zlib | |
2155 | default value is 6. |
|
2162 | default value is 6. | |
2156 |
|
2163 | |||
2157 |
|
2164 | |||
2158 | ``revlog.zstd.level`` |
|
2165 | ``revlog.zstd.level`` | |
2159 | zstd compression level used when storing data into the repository. Accepted |
|
2166 | zstd compression level used when storing data into the repository. Accepted | |
2160 | Value range from 1 (lowest compression) to 22 (highest compression). |
|
2167 | Value range from 1 (lowest compression) to 22 (highest compression). | |
2161 | (default 3) |
|
2168 | (default 3) | |
2162 |
|
2169 | |||
2163 | ``server`` |
|
2170 | ``server`` | |
2164 | ---------- |
|
2171 | ---------- | |
2165 |
|
2172 | |||
2166 | Controls generic server settings. |
|
2173 | Controls generic server settings. | |
2167 |
|
2174 | |||
2168 | ``bookmarks-pushkey-compat`` |
|
2175 | ``bookmarks-pushkey-compat`` | |
2169 | Trigger pushkey hook when being pushed bookmark updates. This config exist |
|
2176 | Trigger pushkey hook when being pushed bookmark updates. This config exist | |
2170 | for compatibility purpose (default to True) |
|
2177 | for compatibility purpose (default to True) | |
2171 |
|
2178 | |||
2172 | If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark |
|
2179 | If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark | |
2173 | movement we recommend you migrate them to ``txnclose-bookmark`` and |
|
2180 | movement we recommend you migrate them to ``txnclose-bookmark`` and | |
2174 | ``pretxnclose-bookmark``. |
|
2181 | ``pretxnclose-bookmark``. | |
2175 |
|
2182 | |||
2176 | ``compressionengines`` |
|
2183 | ``compressionengines`` | |
2177 | List of compression engines and their relative priority to advertise |
|
2184 | List of compression engines and their relative priority to advertise | |
2178 | to clients. |
|
2185 | to clients. | |
2179 |
|
2186 | |||
2180 | The order of compression engines determines their priority, the first |
|
2187 | The order of compression engines determines their priority, the first | |
2181 | having the highest priority. If a compression engine is not listed |
|
2188 | having the highest priority. If a compression engine is not listed | |
2182 | here, it won't be advertised to clients. |
|
2189 | here, it won't be advertised to clients. | |
2183 |
|
2190 | |||
2184 | If not set (the default), built-in defaults are used. Run |
|
2191 | If not set (the default), built-in defaults are used. Run | |
2185 | :hg:`debuginstall` to list available compression engines and their |
|
2192 | :hg:`debuginstall` to list available compression engines and their | |
2186 | default wire protocol priority. |
|
2193 | default wire protocol priority. | |
2187 |
|
2194 | |||
2188 | Older Mercurial clients only support zlib compression and this setting |
|
2195 | Older Mercurial clients only support zlib compression and this setting | |
2189 | has no effect for legacy clients. |
|
2196 | has no effect for legacy clients. | |
2190 |
|
2197 | |||
2191 | ``uncompressed`` |
|
2198 | ``uncompressed`` | |
2192 | Whether to allow clients to clone a repository using the |
|
2199 | Whether to allow clients to clone a repository using the | |
2193 | uncompressed streaming protocol. This transfers about 40% more |
|
2200 | uncompressed streaming protocol. This transfers about 40% more | |
2194 | data than a regular clone, but uses less memory and CPU on both |
|
2201 | data than a regular clone, but uses less memory and CPU on both | |
2195 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
2202 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
2196 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
2203 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
2197 | regular clone. Over most WAN connections (anything slower than |
|
2204 | regular clone. Over most WAN connections (anything slower than | |
2198 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
2205 | about 6 Mbps), uncompressed streaming is slower, because of the | |
2199 | extra data transfer overhead. This mode will also temporarily hold |
|
2206 | extra data transfer overhead. This mode will also temporarily hold | |
2200 | the write lock while determining what data to transfer. |
|
2207 | the write lock while determining what data to transfer. | |
2201 | (default: True) |
|
2208 | (default: True) | |
2202 |
|
2209 | |||
2203 | ``uncompressedallowsecret`` |
|
2210 | ``uncompressedallowsecret`` | |
2204 | Whether to allow stream clones when the repository contains secret |
|
2211 | Whether to allow stream clones when the repository contains secret | |
2205 | changesets. (default: False) |
|
2212 | changesets. (default: False) | |
2206 |
|
2213 | |||
2207 | ``preferuncompressed`` |
|
2214 | ``preferuncompressed`` | |
2208 | When set, clients will try to use the uncompressed streaming |
|
2215 | When set, clients will try to use the uncompressed streaming | |
2209 | protocol. (default: False) |
|
2216 | protocol. (default: False) | |
2210 |
|
2217 | |||
2211 | ``disablefullbundle`` |
|
2218 | ``disablefullbundle`` | |
2212 | When set, servers will refuse attempts to do pull-based clones. |
|
2219 | When set, servers will refuse attempts to do pull-based clones. | |
2213 | If this option is set, ``preferuncompressed`` and/or clone bundles |
|
2220 | If this option is set, ``preferuncompressed`` and/or clone bundles | |
2214 | are highly recommended. Partial clones will still be allowed. |
|
2221 | are highly recommended. Partial clones will still be allowed. | |
2215 | (default: False) |
|
2222 | (default: False) | |
2216 |
|
2223 | |||
2217 | ``streamunbundle`` |
|
2224 | ``streamunbundle`` | |
2218 | When set, servers will apply data sent from the client directly, |
|
2225 | When set, servers will apply data sent from the client directly, | |
2219 | otherwise it will be written to a temporary file first. This option |
|
2226 | otherwise it will be written to a temporary file first. This option | |
2220 | effectively prevents concurrent pushes. |
|
2227 | effectively prevents concurrent pushes. | |
2221 |
|
2228 | |||
2222 | ``pullbundle`` |
|
2229 | ``pullbundle`` | |
2223 | When set, the server will check pullbundle.manifest for bundles |
|
2230 | When set, the server will check pullbundle.manifest for bundles | |
2224 | covering the requested heads and common nodes. The first matching |
|
2231 | covering the requested heads and common nodes. The first matching | |
2225 | entry will be streamed to the client. |
|
2232 | entry will be streamed to the client. | |
2226 |
|
2233 | |||
2227 | For HTTP transport, the stream will still use zlib compression |
|
2234 | For HTTP transport, the stream will still use zlib compression | |
2228 | for older clients. |
|
2235 | for older clients. | |
2229 |
|
2236 | |||
2230 | ``concurrent-push-mode`` |
|
2237 | ``concurrent-push-mode`` | |
2231 | Level of allowed race condition between two pushing clients. |
|
2238 | Level of allowed race condition between two pushing clients. | |
2232 |
|
2239 | |||
2233 | - 'strict': push is abort if another client touched the repository |
|
2240 | - 'strict': push is abort if another client touched the repository | |
2234 | while the push was preparing. |
|
2241 | while the push was preparing. | |
2235 | - 'check-related': push is only aborted if it affects head that got also |
|
2242 | - 'check-related': push is only aborted if it affects head that got also | |
2236 | affected while the push was preparing. (default since 5.4) |
|
2243 | affected while the push was preparing. (default since 5.4) | |
2237 |
|
2244 | |||
2238 | 'check-related' only takes effect for compatible clients (version |
|
2245 | 'check-related' only takes effect for compatible clients (version | |
2239 | 4.3 and later). Older clients will use 'strict'. |
|
2246 | 4.3 and later). Older clients will use 'strict'. | |
2240 |
|
2247 | |||
2241 | ``validate`` |
|
2248 | ``validate`` | |
2242 | Whether to validate the completeness of pushed changesets by |
|
2249 | Whether to validate the completeness of pushed changesets by | |
2243 | checking that all new file revisions specified in manifests are |
|
2250 | checking that all new file revisions specified in manifests are | |
2244 | present. (default: False) |
|
2251 | present. (default: False) | |
2245 |
|
2252 | |||
2246 | ``maxhttpheaderlen`` |
|
2253 | ``maxhttpheaderlen`` | |
2247 | Instruct HTTP clients not to send request headers longer than this |
|
2254 | Instruct HTTP clients not to send request headers longer than this | |
2248 | many bytes. (default: 1024) |
|
2255 | many bytes. (default: 1024) | |
2249 |
|
2256 | |||
2250 | ``bundle1`` |
|
2257 | ``bundle1`` | |
2251 | Whether to allow clients to push and pull using the legacy bundle1 |
|
2258 | Whether to allow clients to push and pull using the legacy bundle1 | |
2252 | exchange format. (default: True) |
|
2259 | exchange format. (default: True) | |
2253 |
|
2260 | |||
2254 | ``bundle1gd`` |
|
2261 | ``bundle1gd`` | |
2255 | Like ``bundle1`` but only used if the repository is using the |
|
2262 | Like ``bundle1`` but only used if the repository is using the | |
2256 | *generaldelta* storage format. (default: True) |
|
2263 | *generaldelta* storage format. (default: True) | |
2257 |
|
2264 | |||
2258 | ``bundle1.push`` |
|
2265 | ``bundle1.push`` | |
2259 | Whether to allow clients to push using the legacy bundle1 exchange |
|
2266 | Whether to allow clients to push using the legacy bundle1 exchange | |
2260 | format. (default: True) |
|
2267 | format. (default: True) | |
2261 |
|
2268 | |||
2262 | ``bundle1gd.push`` |
|
2269 | ``bundle1gd.push`` | |
2263 | Like ``bundle1.push`` but only used if the repository is using the |
|
2270 | Like ``bundle1.push`` but only used if the repository is using the | |
2264 | *generaldelta* storage format. (default: True) |
|
2271 | *generaldelta* storage format. (default: True) | |
2265 |
|
2272 | |||
2266 | ``bundle1.pull`` |
|
2273 | ``bundle1.pull`` | |
2267 | Whether to allow clients to pull using the legacy bundle1 exchange |
|
2274 | Whether to allow clients to pull using the legacy bundle1 exchange | |
2268 | format. (default: True) |
|
2275 | format. (default: True) | |
2269 |
|
2276 | |||
2270 | ``bundle1gd.pull`` |
|
2277 | ``bundle1gd.pull`` | |
2271 | Like ``bundle1.pull`` but only used if the repository is using the |
|
2278 | Like ``bundle1.pull`` but only used if the repository is using the | |
2272 | *generaldelta* storage format. (default: True) |
|
2279 | *generaldelta* storage format. (default: True) | |
2273 |
|
2280 | |||
2274 | Large repositories using the *generaldelta* storage format should |
|
2281 | Large repositories using the *generaldelta* storage format should | |
2275 | consider setting this option because converting *generaldelta* |
|
2282 | consider setting this option because converting *generaldelta* | |
2276 | repositories to the exchange format required by the bundle1 data |
|
2283 | repositories to the exchange format required by the bundle1 data | |
2277 | format can consume a lot of CPU. |
|
2284 | format can consume a lot of CPU. | |
2278 |
|
2285 | |||
2279 | ``bundle2.stream`` |
|
2286 | ``bundle2.stream`` | |
2280 | Whether to allow clients to pull using the bundle2 streaming protocol. |
|
2287 | Whether to allow clients to pull using the bundle2 streaming protocol. | |
2281 | (default: True) |
|
2288 | (default: True) | |
2282 |
|
2289 | |||
2283 | ``zliblevel`` |
|
2290 | ``zliblevel`` | |
2284 | Integer between ``-1`` and ``9`` that controls the zlib compression level |
|
2291 | Integer between ``-1`` and ``9`` that controls the zlib compression level | |
2285 | for wire protocol commands that send zlib compressed output (notably the |
|
2292 | for wire protocol commands that send zlib compressed output (notably the | |
2286 | commands that send repository history data). |
|
2293 | commands that send repository history data). | |
2287 |
|
2294 | |||
2288 | The default (``-1``) uses the default zlib compression level, which is |
|
2295 | The default (``-1``) uses the default zlib compression level, which is | |
2289 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means |
|
2296 | likely equivalent to ``6``. ``0`` means no compression. ``9`` means | |
2290 | maximum compression. |
|
2297 | maximum compression. | |
2291 |
|
2298 | |||
2292 | Setting this option allows server operators to make trade-offs between |
|
2299 | Setting this option allows server operators to make trade-offs between | |
2293 | bandwidth and CPU used. Lowering the compression lowers CPU utilization |
|
2300 | bandwidth and CPU used. Lowering the compression lowers CPU utilization | |
2294 | but sends more bytes to clients. |
|
2301 | but sends more bytes to clients. | |
2295 |
|
2302 | |||
2296 | This option only impacts the HTTP server. |
|
2303 | This option only impacts the HTTP server. | |
2297 |
|
2304 | |||
2298 | ``zstdlevel`` |
|
2305 | ``zstdlevel`` | |
2299 | Integer between ``1`` and ``22`` that controls the zstd compression level |
|
2306 | Integer between ``1`` and ``22`` that controls the zstd compression level | |
2300 | for wire protocol commands. ``1`` is the minimal amount of compression and |
|
2307 | for wire protocol commands. ``1`` is the minimal amount of compression and | |
2301 | ``22`` is the highest amount of compression. |
|
2308 | ``22`` is the highest amount of compression. | |
2302 |
|
2309 | |||
2303 | The default (``3``) should be significantly faster than zlib while likely |
|
2310 | The default (``3``) should be significantly faster than zlib while likely | |
2304 | delivering better compression ratios. |
|
2311 | delivering better compression ratios. | |
2305 |
|
2312 | |||
2306 | This option only impacts the HTTP server. |
|
2313 | This option only impacts the HTTP server. | |
2307 |
|
2314 | |||
2308 | See also ``server.zliblevel``. |
|
2315 | See also ``server.zliblevel``. | |
2309 |
|
2316 | |||
2310 | ``view`` |
|
2317 | ``view`` | |
2311 | Repository filter used when exchanging revisions with the peer. |
|
2318 | Repository filter used when exchanging revisions with the peer. | |
2312 |
|
2319 | |||
2313 | The default view (``served``) excludes secret and hidden changesets. |
|
2320 | The default view (``served``) excludes secret and hidden changesets. | |
2314 | Another useful value is ``immutable`` (no draft, secret or hidden |
|
2321 | Another useful value is ``immutable`` (no draft, secret or hidden | |
2315 | changesets). (EXPERIMENTAL) |
|
2322 | changesets). (EXPERIMENTAL) | |
2316 |
|
2323 | |||
2317 | ``smtp`` |
|
2324 | ``smtp`` | |
2318 | -------- |
|
2325 | -------- | |
2319 |
|
2326 | |||
2320 | Configuration for extensions that need to send email messages. |
|
2327 | Configuration for extensions that need to send email messages. | |
2321 |
|
2328 | |||
2322 | ``host`` |
|
2329 | ``host`` | |
2323 | Host name of mail server, e.g. "mail.example.com". |
|
2330 | Host name of mail server, e.g. "mail.example.com". | |
2324 |
|
2331 | |||
2325 | ``port`` |
|
2332 | ``port`` | |
2326 | Optional. Port to connect to on mail server. (default: 465 if |
|
2333 | Optional. Port to connect to on mail server. (default: 465 if | |
2327 | ``tls`` is smtps; 25 otherwise) |
|
2334 | ``tls`` is smtps; 25 otherwise) | |
2328 |
|
2335 | |||
2329 | ``tls`` |
|
2336 | ``tls`` | |
2330 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
2337 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
2331 | smtps or none. (default: none) |
|
2338 | smtps or none. (default: none) | |
2332 |
|
2339 | |||
2333 | ``username`` |
|
2340 | ``username`` | |
2334 | Optional. User name for authenticating with the SMTP server. |
|
2341 | Optional. User name for authenticating with the SMTP server. | |
2335 | (default: None) |
|
2342 | (default: None) | |
2336 |
|
2343 | |||
2337 | ``password`` |
|
2344 | ``password`` | |
2338 | Optional. Password for authenticating with the SMTP server. If not |
|
2345 | Optional. Password for authenticating with the SMTP server. If not | |
2339 | specified, interactive sessions will prompt the user for a |
|
2346 | specified, interactive sessions will prompt the user for a | |
2340 | password; non-interactive sessions will fail. (default: None) |
|
2347 | password; non-interactive sessions will fail. (default: None) | |
2341 |
|
2348 | |||
2342 | ``local_hostname`` |
|
2349 | ``local_hostname`` | |
2343 | Optional. The hostname that the sender can use to identify |
|
2350 | Optional. The hostname that the sender can use to identify | |
2344 | itself to the MTA. |
|
2351 | itself to the MTA. | |
2345 |
|
2352 | |||
2346 |
|
2353 | |||
2347 | ``subpaths`` |
|
2354 | ``subpaths`` | |
2348 | ------------ |
|
2355 | ------------ | |
2349 |
|
2356 | |||
2350 | Subrepository source URLs can go stale if a remote server changes name |
|
2357 | Subrepository source URLs can go stale if a remote server changes name | |
2351 | or becomes temporarily unavailable. This section lets you define |
|
2358 | or becomes temporarily unavailable. This section lets you define | |
2352 | rewrite rules of the form:: |
|
2359 | rewrite rules of the form:: | |
2353 |
|
2360 | |||
2354 | <pattern> = <replacement> |
|
2361 | <pattern> = <replacement> | |
2355 |
|
2362 | |||
2356 | where ``pattern`` is a regular expression matching a subrepository |
|
2363 | where ``pattern`` is a regular expression matching a subrepository | |
2357 | source URL and ``replacement`` is the replacement string used to |
|
2364 | source URL and ``replacement`` is the replacement string used to | |
2358 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
2365 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
2359 | ``replacements``. For instance:: |
|
2366 | ``replacements``. For instance:: | |
2360 |
|
2367 | |||
2361 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
2368 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
2362 |
|
2369 | |||
2363 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
2370 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
2364 |
|
2371 | |||
2365 | Relative subrepository paths are first made absolute, and the |
|
2372 | Relative subrepository paths are first made absolute, and the | |
2366 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` |
|
2373 | rewrite rules are then applied on the full (absolute) path. If ``pattern`` | |
2367 | doesn't match the full path, an attempt is made to apply it on the |
|
2374 | doesn't match the full path, an attempt is made to apply it on the | |
2368 | relative path alone. The rules are applied in definition order. |
|
2375 | relative path alone. The rules are applied in definition order. | |
2369 |
|
2376 | |||
2370 | ``subrepos`` |
|
2377 | ``subrepos`` | |
2371 | ------------ |
|
2378 | ------------ | |
2372 |
|
2379 | |||
2373 | This section contains options that control the behavior of the |
|
2380 | This section contains options that control the behavior of the | |
2374 | subrepositories feature. See also :hg:`help subrepos`. |
|
2381 | subrepositories feature. See also :hg:`help subrepos`. | |
2375 |
|
2382 | |||
2376 | Security note: auditing in Mercurial is known to be insufficient to |
|
2383 | Security note: auditing in Mercurial is known to be insufficient to | |
2377 | prevent clone-time code execution with carefully constructed Git |
|
2384 | prevent clone-time code execution with carefully constructed Git | |
2378 | subrepos. It is unknown if a similar detect is present in Subversion |
|
2385 | subrepos. It is unknown if a similar detect is present in Subversion | |
2379 | subrepos. Both Git and Subversion subrepos are disabled by default |
|
2386 | subrepos. Both Git and Subversion subrepos are disabled by default | |
2380 | out of security concerns. These subrepo types can be enabled using |
|
2387 | out of security concerns. These subrepo types can be enabled using | |
2381 | the respective options below. |
|
2388 | the respective options below. | |
2382 |
|
2389 | |||
2383 | ``allowed`` |
|
2390 | ``allowed`` | |
2384 | Whether subrepositories are allowed in the working directory. |
|
2391 | Whether subrepositories are allowed in the working directory. | |
2385 |
|
2392 | |||
2386 | When false, commands involving subrepositories (like :hg:`update`) |
|
2393 | When false, commands involving subrepositories (like :hg:`update`) | |
2387 | will fail for all subrepository types. |
|
2394 | will fail for all subrepository types. | |
2388 | (default: true) |
|
2395 | (default: true) | |
2389 |
|
2396 | |||
2390 | ``hg:allowed`` |
|
2397 | ``hg:allowed`` | |
2391 | Whether Mercurial subrepositories are allowed in the working |
|
2398 | Whether Mercurial subrepositories are allowed in the working | |
2392 | directory. This option only has an effect if ``subrepos.allowed`` |
|
2399 | directory. This option only has an effect if ``subrepos.allowed`` | |
2393 | is true. |
|
2400 | is true. | |
2394 | (default: true) |
|
2401 | (default: true) | |
2395 |
|
2402 | |||
2396 | ``git:allowed`` |
|
2403 | ``git:allowed`` | |
2397 | Whether Git subrepositories are allowed in the working directory. |
|
2404 | Whether Git subrepositories are allowed in the working directory. | |
2398 | This option only has an effect if ``subrepos.allowed`` is true. |
|
2405 | This option only has an effect if ``subrepos.allowed`` is true. | |
2399 |
|
2406 | |||
2400 | See the security note above before enabling Git subrepos. |
|
2407 | See the security note above before enabling Git subrepos. | |
2401 | (default: false) |
|
2408 | (default: false) | |
2402 |
|
2409 | |||
2403 | ``svn:allowed`` |
|
2410 | ``svn:allowed`` | |
2404 | Whether Subversion subrepositories are allowed in the working |
|
2411 | Whether Subversion subrepositories are allowed in the working | |
2405 | directory. This option only has an effect if ``subrepos.allowed`` |
|
2412 | directory. This option only has an effect if ``subrepos.allowed`` | |
2406 | is true. |
|
2413 | is true. | |
2407 |
|
2414 | |||
2408 | See the security note above before enabling Subversion subrepos. |
|
2415 | See the security note above before enabling Subversion subrepos. | |
2409 | (default: false) |
|
2416 | (default: false) | |
2410 |
|
2417 | |||
2411 | ``templatealias`` |
|
2418 | ``templatealias`` | |
2412 | ----------------- |
|
2419 | ----------------- | |
2413 |
|
2420 | |||
2414 | Alias definitions for templates. See :hg:`help templates` for details. |
|
2421 | Alias definitions for templates. See :hg:`help templates` for details. | |
2415 |
|
2422 | |||
2416 | ``templates`` |
|
2423 | ``templates`` | |
2417 | ------------- |
|
2424 | ------------- | |
2418 |
|
2425 | |||
2419 | Use the ``[templates]`` section to define template strings. |
|
2426 | Use the ``[templates]`` section to define template strings. | |
2420 | See :hg:`help templates` for details. |
|
2427 | See :hg:`help templates` for details. | |
2421 |
|
2428 | |||
2422 | ``trusted`` |
|
2429 | ``trusted`` | |
2423 | ----------- |
|
2430 | ----------- | |
2424 |
|
2431 | |||
2425 | Mercurial will not use the settings in the |
|
2432 | Mercurial will not use the settings in the | |
2426 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
2433 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
2427 | user or to a trusted group, as various hgrc features allow arbitrary |
|
2434 | user or to a trusted group, as various hgrc features allow arbitrary | |
2428 | commands to be run. This issue is often encountered when configuring |
|
2435 | commands to be run. This issue is often encountered when configuring | |
2429 | hooks or extensions for shared repositories or servers. However, |
|
2436 | hooks or extensions for shared repositories or servers. However, | |
2430 | the web interface will use some safe settings from the ``[web]`` |
|
2437 | the web interface will use some safe settings from the ``[web]`` | |
2431 | section. |
|
2438 | section. | |
2432 |
|
2439 | |||
2433 | This section specifies what users and groups are trusted. The |
|
2440 | This section specifies what users and groups are trusted. The | |
2434 | current user is always trusted. To trust everybody, list a user or a |
|
2441 | current user is always trusted. To trust everybody, list a user or a | |
2435 | group with name ``*``. These settings must be placed in an |
|
2442 | group with name ``*``. These settings must be placed in an | |
2436 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
2443 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
2437 | user or service running Mercurial. |
|
2444 | user or service running Mercurial. | |
2438 |
|
2445 | |||
2439 | ``users`` |
|
2446 | ``users`` | |
2440 | Comma-separated list of trusted users. |
|
2447 | Comma-separated list of trusted users. | |
2441 |
|
2448 | |||
2442 | ``groups`` |
|
2449 | ``groups`` | |
2443 | Comma-separated list of trusted groups. |
|
2450 | Comma-separated list of trusted groups. | |
2444 |
|
2451 | |||
2445 |
|
2452 | |||
2446 | ``ui`` |
|
2453 | ``ui`` | |
2447 | ------ |
|
2454 | ------ | |
2448 |
|
2455 | |||
2449 | User interface controls. |
|
2456 | User interface controls. | |
2450 |
|
2457 | |||
2451 | ``archivemeta`` |
|
2458 | ``archivemeta`` | |
2452 | Whether to include the .hg_archival.txt file containing meta data |
|
2459 | Whether to include the .hg_archival.txt file containing meta data | |
2453 | (hashes for the repository base and for tip) in archives created |
|
2460 | (hashes for the repository base and for tip) in archives created | |
2454 | by the :hg:`archive` command or downloaded via hgweb. |
|
2461 | by the :hg:`archive` command or downloaded via hgweb. | |
2455 | (default: True) |
|
2462 | (default: True) | |
2456 |
|
2463 | |||
2457 | ``askusername`` |
|
2464 | ``askusername`` | |
2458 | Whether to prompt for a username when committing. If True, and |
|
2465 | Whether to prompt for a username when committing. If True, and | |
2459 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
2466 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
2460 | be prompted to enter a username. If no username is entered, the |
|
2467 | be prompted to enter a username. If no username is entered, the | |
2461 | default ``USER@HOST`` is used instead. |
|
2468 | default ``USER@HOST`` is used instead. | |
2462 | (default: False) |
|
2469 | (default: False) | |
2463 |
|
2470 | |||
2464 | ``clonebundles`` |
|
2471 | ``clonebundles`` | |
2465 | Whether the "clone bundles" feature is enabled. |
|
2472 | Whether the "clone bundles" feature is enabled. | |
2466 |
|
2473 | |||
2467 | When enabled, :hg:`clone` may download and apply a server-advertised |
|
2474 | When enabled, :hg:`clone` may download and apply a server-advertised | |
2468 | bundle file from a URL instead of using the normal exchange mechanism. |
|
2475 | bundle file from a URL instead of using the normal exchange mechanism. | |
2469 |
|
2476 | |||
2470 | This can likely result in faster and more reliable clones. |
|
2477 | This can likely result in faster and more reliable clones. | |
2471 |
|
2478 | |||
2472 | (default: True) |
|
2479 | (default: True) | |
2473 |
|
2480 | |||
2474 | ``clonebundlefallback`` |
|
2481 | ``clonebundlefallback`` | |
2475 | Whether failure to apply an advertised "clone bundle" from a server |
|
2482 | Whether failure to apply an advertised "clone bundle" from a server | |
2476 | should result in fallback to a regular clone. |
|
2483 | should result in fallback to a regular clone. | |
2477 |
|
2484 | |||
2478 | This is disabled by default because servers advertising "clone |
|
2485 | This is disabled by default because servers advertising "clone | |
2479 | bundles" often do so to reduce server load. If advertised bundles |
|
2486 | bundles" often do so to reduce server load. If advertised bundles | |
2480 | start mass failing and clients automatically fall back to a regular |
|
2487 | start mass failing and clients automatically fall back to a regular | |
2481 | clone, this would add significant and unexpected load to the server |
|
2488 | clone, this would add significant and unexpected load to the server | |
2482 | since the server is expecting clone operations to be offloaded to |
|
2489 | since the server is expecting clone operations to be offloaded to | |
2483 | pre-generated bundles. Failing fast (the default behavior) ensures |
|
2490 | pre-generated bundles. Failing fast (the default behavior) ensures | |
2484 | clients don't overwhelm the server when "clone bundle" application |
|
2491 | clients don't overwhelm the server when "clone bundle" application | |
2485 | fails. |
|
2492 | fails. | |
2486 |
|
2493 | |||
2487 | (default: False) |
|
2494 | (default: False) | |
2488 |
|
2495 | |||
2489 | ``clonebundleprefers`` |
|
2496 | ``clonebundleprefers`` | |
2490 | Defines preferences for which "clone bundles" to use. |
|
2497 | Defines preferences for which "clone bundles" to use. | |
2491 |
|
2498 | |||
2492 | Servers advertising "clone bundles" may advertise multiple available |
|
2499 | Servers advertising "clone bundles" may advertise multiple available | |
2493 | bundles. Each bundle may have different attributes, such as the bundle |
|
2500 | bundles. Each bundle may have different attributes, such as the bundle | |
2494 | type and compression format. This option is used to prefer a particular |
|
2501 | type and compression format. This option is used to prefer a particular | |
2495 | bundle over another. |
|
2502 | bundle over another. | |
2496 |
|
2503 | |||
2497 | The following keys are defined by Mercurial: |
|
2504 | The following keys are defined by Mercurial: | |
2498 |
|
2505 | |||
2499 | BUNDLESPEC |
|
2506 | BUNDLESPEC | |
2500 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. |
|
2507 | A bundle type specifier. These are strings passed to :hg:`bundle -t`. | |
2501 | e.g. ``gzip-v2`` or ``bzip2-v1``. |
|
2508 | e.g. ``gzip-v2`` or ``bzip2-v1``. | |
2502 |
|
2509 | |||
2503 | COMPRESSION |
|
2510 | COMPRESSION | |
2504 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. |
|
2511 | The compression format of the bundle. e.g. ``gzip`` and ``bzip2``. | |
2505 |
|
2512 | |||
2506 | Server operators may define custom keys. |
|
2513 | Server operators may define custom keys. | |
2507 |
|
2514 | |||
2508 | Example values: ``COMPRESSION=bzip2``, |
|
2515 | Example values: ``COMPRESSION=bzip2``, | |
2509 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. |
|
2516 | ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``. | |
2510 |
|
2517 | |||
2511 | By default, the first bundle advertised by the server is used. |
|
2518 | By default, the first bundle advertised by the server is used. | |
2512 |
|
2519 | |||
2513 | ``color`` |
|
2520 | ``color`` | |
2514 | When to colorize output. Possible value are Boolean ("yes" or "no"), or |
|
2521 | When to colorize output. Possible value are Boolean ("yes" or "no"), or | |
2515 | "debug", or "always". (default: "yes"). "yes" will use color whenever it |
|
2522 | "debug", or "always". (default: "yes"). "yes" will use color whenever it | |
2516 | seems possible. See :hg:`help color` for details. |
|
2523 | seems possible. See :hg:`help color` for details. | |
2517 |
|
2524 | |||
2518 | ``commitsubrepos`` |
|
2525 | ``commitsubrepos`` | |
2519 | Whether to commit modified subrepositories when committing the |
|
2526 | Whether to commit modified subrepositories when committing the | |
2520 | parent repository. If False and one subrepository has uncommitted |
|
2527 | parent repository. If False and one subrepository has uncommitted | |
2521 | changes, abort the commit. |
|
2528 | changes, abort the commit. | |
2522 | (default: False) |
|
2529 | (default: False) | |
2523 |
|
2530 | |||
2524 | ``debug`` |
|
2531 | ``debug`` | |
2525 | Print debugging information. (default: False) |
|
2532 | Print debugging information. (default: False) | |
2526 |
|
2533 | |||
2527 | ``editor`` |
|
2534 | ``editor`` | |
2528 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
2535 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) | |
2529 |
|
2536 | |||
2530 | ``fallbackencoding`` |
|
2537 | ``fallbackencoding`` | |
2531 | Encoding to try if it's not possible to decode the changelog using |
|
2538 | Encoding to try if it's not possible to decode the changelog using | |
2532 | UTF-8. (default: ISO-8859-1) |
|
2539 | UTF-8. (default: ISO-8859-1) | |
2533 |
|
2540 | |||
2534 | ``graphnodetemplate`` |
|
2541 | ``graphnodetemplate`` | |
2535 | (DEPRECATED) Use ``command-templates.graphnode`` instead. |
|
2542 | (DEPRECATED) Use ``command-templates.graphnode`` instead. | |
2536 |
|
2543 | |||
2537 | ``ignore`` |
|
2544 | ``ignore`` | |
2538 | A file to read per-user ignore patterns from. This file should be |
|
2545 | A file to read per-user ignore patterns from. This file should be | |
2539 | in the same format as a repository-wide .hgignore file. Filenames |
|
2546 | in the same format as a repository-wide .hgignore file. Filenames | |
2540 | are relative to the repository root. This option supports hook syntax, |
|
2547 | are relative to the repository root. This option supports hook syntax, | |
2541 | so if you want to specify multiple ignore files, you can do so by |
|
2548 | so if you want to specify multiple ignore files, you can do so by | |
2542 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
2549 | setting something like ``ignore.other = ~/.hgignore2``. For details | |
2543 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
2550 | of the ignore file format, see the ``hgignore(5)`` man page. | |
2544 |
|
2551 | |||
2545 | ``interactive`` |
|
2552 | ``interactive`` | |
2546 | Allow to prompt the user. (default: True) |
|
2553 | Allow to prompt the user. (default: True) | |
2547 |
|
2554 | |||
2548 | ``interface`` |
|
2555 | ``interface`` | |
2549 | Select the default interface for interactive features (default: text). |
|
2556 | Select the default interface for interactive features (default: text). | |
2550 | Possible values are 'text' and 'curses'. |
|
2557 | Possible values are 'text' and 'curses'. | |
2551 |
|
2558 | |||
2552 | ``interface.chunkselector`` |
|
2559 | ``interface.chunkselector`` | |
2553 | Select the interface for change recording (e.g. :hg:`commit -i`). |
|
2560 | Select the interface for change recording (e.g. :hg:`commit -i`). | |
2554 | Possible values are 'text' and 'curses'. |
|
2561 | Possible values are 'text' and 'curses'. | |
2555 | This config overrides the interface specified by ui.interface. |
|
2562 | This config overrides the interface specified by ui.interface. | |
2556 |
|
2563 | |||
2557 | ``large-file-limit`` |
|
2564 | ``large-file-limit`` | |
2558 | Largest file size that gives no memory use warning. |
|
2565 | Largest file size that gives no memory use warning. | |
2559 | Possible values are integers or 0 to disable the check. |
|
2566 | Possible values are integers or 0 to disable the check. | |
2560 | (default: 10000000) |
|
2567 | (default: 10000000) | |
2561 |
|
2568 | |||
2562 | ``logtemplate`` |
|
2569 | ``logtemplate`` | |
2563 | (DEPRECATED) Use ``command-templates.log`` instead. |
|
2570 | (DEPRECATED) Use ``command-templates.log`` instead. | |
2564 |
|
2571 | |||
2565 | ``merge`` |
|
2572 | ``merge`` | |
2566 | The conflict resolution program to use during a manual merge. |
|
2573 | The conflict resolution program to use during a manual merge. | |
2567 | For more information on merge tools see :hg:`help merge-tools`. |
|
2574 | For more information on merge tools see :hg:`help merge-tools`. | |
2568 | For configuring merge tools see the ``[merge-tools]`` section. |
|
2575 | For configuring merge tools see the ``[merge-tools]`` section. | |
2569 |
|
2576 | |||
2570 | ``mergemarkers`` |
|
2577 | ``mergemarkers`` | |
2571 | Sets the merge conflict marker label styling. The ``detailed`` style |
|
2578 | Sets the merge conflict marker label styling. The ``detailed`` style | |
2572 | uses the ``command-templates.mergemarker`` setting to style the labels. |
|
2579 | uses the ``command-templates.mergemarker`` setting to style the labels. | |
2573 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
2580 | The ``basic`` style just uses 'local' and 'other' as the marker label. | |
2574 | One of ``basic`` or ``detailed``. |
|
2581 | One of ``basic`` or ``detailed``. | |
2575 | (default: ``basic``) |
|
2582 | (default: ``basic``) | |
2576 |
|
2583 | |||
2577 | ``mergemarkertemplate`` |
|
2584 | ``mergemarkertemplate`` | |
2578 | (DEPRECATED) Use ``command-templates.mergemarker`` instead. |
|
2585 | (DEPRECATED) Use ``command-templates.mergemarker`` instead. | |
2579 |
|
2586 | |||
2580 | ``message-output`` |
|
2587 | ``message-output`` | |
2581 | Where to write status and error messages. (default: ``stdio``) |
|
2588 | Where to write status and error messages. (default: ``stdio``) | |
2582 |
|
2589 | |||
2583 | ``channel`` |
|
2590 | ``channel`` | |
2584 | Use separate channel for structured output. (Command-server only) |
|
2591 | Use separate channel for structured output. (Command-server only) | |
2585 | ``stderr`` |
|
2592 | ``stderr`` | |
2586 | Everything to stderr. |
|
2593 | Everything to stderr. | |
2587 | ``stdio`` |
|
2594 | ``stdio`` | |
2588 | Status to stdout, and error to stderr. |
|
2595 | Status to stdout, and error to stderr. | |
2589 |
|
2596 | |||
2590 | ``origbackuppath`` |
|
2597 | ``origbackuppath`` | |
2591 | The path to a directory used to store generated .orig files. If the path is |
|
2598 | The path to a directory used to store generated .orig files. If the path is | |
2592 | not a directory, one will be created. If set, files stored in this |
|
2599 | not a directory, one will be created. If set, files stored in this | |
2593 | directory have the same name as the original file and do not have a .orig |
|
2600 | directory have the same name as the original file and do not have a .orig | |
2594 | suffix. |
|
2601 | suffix. | |
2595 |
|
2602 | |||
2596 | ``paginate`` |
|
2603 | ``paginate`` | |
2597 | Control the pagination of command output (default: True). See :hg:`help pager` |
|
2604 | Control the pagination of command output (default: True). See :hg:`help pager` | |
2598 | for details. |
|
2605 | for details. | |
2599 |
|
2606 | |||
2600 | ``patch`` |
|
2607 | ``patch`` | |
2601 | An optional external tool that ``hg import`` and some extensions |
|
2608 | An optional external tool that ``hg import`` and some extensions | |
2602 | will use for applying patches. By default Mercurial uses an |
|
2609 | will use for applying patches. By default Mercurial uses an | |
2603 | internal patch utility. The external tool must work as the common |
|
2610 | internal patch utility. The external tool must work as the common | |
2604 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
2611 | Unix ``patch`` program. In particular, it must accept a ``-p`` | |
2605 | argument to strip patch headers, a ``-d`` argument to specify the |
|
2612 | argument to strip patch headers, a ``-d`` argument to specify the | |
2606 | current directory, a file name to patch, and a patch file to take |
|
2613 | current directory, a file name to patch, and a patch file to take | |
2607 | from stdin. |
|
2614 | from stdin. | |
2608 |
|
2615 | |||
2609 | It is possible to specify a patch tool together with extra |
|
2616 | It is possible to specify a patch tool together with extra | |
2610 | arguments. For example, setting this option to ``patch --merge`` |
|
2617 | arguments. For example, setting this option to ``patch --merge`` | |
2611 | will use the ``patch`` program with its 2-way merge option. |
|
2618 | will use the ``patch`` program with its 2-way merge option. | |
2612 |
|
2619 | |||
2613 | ``portablefilenames`` |
|
2620 | ``portablefilenames`` | |
2614 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
2621 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
2615 | (default: ``warn``) |
|
2622 | (default: ``warn``) | |
2616 |
|
2623 | |||
2617 | ``warn`` |
|
2624 | ``warn`` | |
2618 | Print a warning message on POSIX platforms, if a file with a non-portable |
|
2625 | Print a warning message on POSIX platforms, if a file with a non-portable | |
2619 | filename is added (e.g. a file with a name that can't be created on |
|
2626 | filename is added (e.g. a file with a name that can't be created on | |
2620 | Windows because it contains reserved parts like ``AUX``, reserved |
|
2627 | Windows because it contains reserved parts like ``AUX``, reserved | |
2621 | characters like ``:``, or would cause a case collision with an existing |
|
2628 | characters like ``:``, or would cause a case collision with an existing | |
2622 | file). |
|
2629 | file). | |
2623 |
|
2630 | |||
2624 | ``ignore`` |
|
2631 | ``ignore`` | |
2625 | Don't print a warning. |
|
2632 | Don't print a warning. | |
2626 |
|
2633 | |||
2627 | ``abort`` |
|
2634 | ``abort`` | |
2628 | The command is aborted. |
|
2635 | The command is aborted. | |
2629 |
|
2636 | |||
2630 | ``true`` |
|
2637 | ``true`` | |
2631 | Alias for ``warn``. |
|
2638 | Alias for ``warn``. | |
2632 |
|
2639 | |||
2633 | ``false`` |
|
2640 | ``false`` | |
2634 | Alias for ``ignore``. |
|
2641 | Alias for ``ignore``. | |
2635 |
|
2642 | |||
2636 | .. container:: windows |
|
2643 | .. container:: windows | |
2637 |
|
2644 | |||
2638 | On Windows, this configuration option is ignored and the command aborted. |
|
2645 | On Windows, this configuration option is ignored and the command aborted. | |
2639 |
|
2646 | |||
2640 | ``pre-merge-tool-output-template`` |
|
2647 | ``pre-merge-tool-output-template`` | |
2641 | (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead. |
|
2648 | (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead. | |
2642 |
|
2649 | |||
2643 | ``quiet`` |
|
2650 | ``quiet`` | |
2644 | Reduce the amount of output printed. |
|
2651 | Reduce the amount of output printed. | |
2645 | (default: False) |
|
2652 | (default: False) | |
2646 |
|
2653 | |||
2647 | ``relative-paths`` |
|
2654 | ``relative-paths`` | |
2648 | Prefer relative paths in the UI. |
|
2655 | Prefer relative paths in the UI. | |
2649 |
|
2656 | |||
2650 | ``remotecmd`` |
|
2657 | ``remotecmd`` | |
2651 | Remote command to use for clone/push/pull operations. |
|
2658 | Remote command to use for clone/push/pull operations. | |
2652 | (default: ``hg``) |
|
2659 | (default: ``hg``) | |
2653 |
|
2660 | |||
2654 | ``report_untrusted`` |
|
2661 | ``report_untrusted`` | |
2655 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
2662 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
2656 | trusted user or group. |
|
2663 | trusted user or group. | |
2657 | (default: True) |
|
2664 | (default: True) | |
2658 |
|
2665 | |||
2659 | ``slash`` |
|
2666 | ``slash`` | |
2660 | (Deprecated. Use ``slashpath`` template filter instead.) |
|
2667 | (Deprecated. Use ``slashpath`` template filter instead.) | |
2661 |
|
2668 | |||
2662 | Display paths using a slash (``/``) as the path separator. This |
|
2669 | Display paths using a slash (``/``) as the path separator. This | |
2663 | only makes a difference on systems where the default path |
|
2670 | only makes a difference on systems where the default path | |
2664 | separator is not the slash character (e.g. Windows uses the |
|
2671 | separator is not the slash character (e.g. Windows uses the | |
2665 | backslash character (``\``)). |
|
2672 | backslash character (``\``)). | |
2666 | (default: False) |
|
2673 | (default: False) | |
2667 |
|
2674 | |||
2668 | ``statuscopies`` |
|
2675 | ``statuscopies`` | |
2669 | Display copies in the status command. |
|
2676 | Display copies in the status command. | |
2670 |
|
2677 | |||
2671 | ``ssh`` |
|
2678 | ``ssh`` | |
2672 | Command to use for SSH connections. (default: ``ssh``) |
|
2679 | Command to use for SSH connections. (default: ``ssh``) | |
2673 |
|
2680 | |||
2674 | ``ssherrorhint`` |
|
2681 | ``ssherrorhint`` | |
2675 | A hint shown to the user in the case of SSH error (e.g. |
|
2682 | A hint shown to the user in the case of SSH error (e.g. | |
2676 | ``Please see http://company/internalwiki/ssh.html``) |
|
2683 | ``Please see http://company/internalwiki/ssh.html``) | |
2677 |
|
2684 | |||
2678 | ``strict`` |
|
2685 | ``strict`` | |
2679 | Require exact command names, instead of allowing unambiguous |
|
2686 | Require exact command names, instead of allowing unambiguous | |
2680 | abbreviations. (default: False) |
|
2687 | abbreviations. (default: False) | |
2681 |
|
2688 | |||
2682 | ``style`` |
|
2689 | ``style`` | |
2683 | Name of style to use for command output. |
|
2690 | Name of style to use for command output. | |
2684 |
|
2691 | |||
2685 | ``supportcontact`` |
|
2692 | ``supportcontact`` | |
2686 | A URL where users should report a Mercurial traceback. Use this if you are a |
|
2693 | A URL where users should report a Mercurial traceback. Use this if you are a | |
2687 | large organisation with its own Mercurial deployment process and crash |
|
2694 | large organisation with its own Mercurial deployment process and crash | |
2688 | reports should be addressed to your internal support. |
|
2695 | reports should be addressed to your internal support. | |
2689 |
|
2696 | |||
2690 | ``textwidth`` |
|
2697 | ``textwidth`` | |
2691 | Maximum width of help text. A longer line generated by ``hg help`` or |
|
2698 | Maximum width of help text. A longer line generated by ``hg help`` or | |
2692 | ``hg subcommand --help`` will be broken after white space to get this |
|
2699 | ``hg subcommand --help`` will be broken after white space to get this | |
2693 | width or the terminal width, whichever comes first. |
|
2700 | width or the terminal width, whichever comes first. | |
2694 | A non-positive value will disable this and the terminal width will be |
|
2701 | A non-positive value will disable this and the terminal width will be | |
2695 | used. (default: 78) |
|
2702 | used. (default: 78) | |
2696 |
|
2703 | |||
2697 | ``timeout`` |
|
2704 | ``timeout`` | |
2698 | The timeout used when a lock is held (in seconds), a negative value |
|
2705 | The timeout used when a lock is held (in seconds), a negative value | |
2699 | means no timeout. (default: 600) |
|
2706 | means no timeout. (default: 600) | |
2700 |
|
2707 | |||
2701 | ``timeout.warn`` |
|
2708 | ``timeout.warn`` | |
2702 | Time (in seconds) before a warning is printed about held lock. A negative |
|
2709 | Time (in seconds) before a warning is printed about held lock. A negative | |
2703 | value means no warning. (default: 0) |
|
2710 | value means no warning. (default: 0) | |
2704 |
|
2711 | |||
2705 | ``traceback`` |
|
2712 | ``traceback`` | |
2706 | Mercurial always prints a traceback when an unknown exception |
|
2713 | Mercurial always prints a traceback when an unknown exception | |
2707 | occurs. Setting this to True will make Mercurial print a traceback |
|
2714 | occurs. Setting this to True will make Mercurial print a traceback | |
2708 | on all exceptions, even those recognized by Mercurial (such as |
|
2715 | on all exceptions, even those recognized by Mercurial (such as | |
2709 | IOError or MemoryError). (default: False) |
|
2716 | IOError or MemoryError). (default: False) | |
2710 |
|
2717 | |||
2711 | ``tweakdefaults`` |
|
2718 | ``tweakdefaults`` | |
2712 |
|
2719 | |||
2713 | By default Mercurial's behavior changes very little from release |
|
2720 | By default Mercurial's behavior changes very little from release | |
2714 | to release, but over time the recommended config settings |
|
2721 | to release, but over time the recommended config settings | |
2715 | shift. Enable this config to opt in to get automatic tweaks to |
|
2722 | shift. Enable this config to opt in to get automatic tweaks to | |
2716 | Mercurial's behavior over time. This config setting will have no |
|
2723 | Mercurial's behavior over time. This config setting will have no | |
2717 | effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does |
|
2724 | effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does | |
2718 | not include ``tweakdefaults``. (default: False) |
|
2725 | not include ``tweakdefaults``. (default: False) | |
2719 |
|
2726 | |||
2720 | It currently means:: |
|
2727 | It currently means:: | |
2721 |
|
2728 | |||
2722 | .. tweakdefaultsmarker |
|
2729 | .. tweakdefaultsmarker | |
2723 |
|
2730 | |||
2724 | ``username`` |
|
2731 | ``username`` | |
2725 | The committer of a changeset created when running "commit". |
|
2732 | The committer of a changeset created when running "commit". | |
2726 | Typically a person's name and email address, e.g. ``Fred Widget |
|
2733 | Typically a person's name and email address, e.g. ``Fred Widget | |
2727 | <fred@example.com>``. Environment variables in the |
|
2734 | <fred@example.com>``. Environment variables in the | |
2728 | username are expanded. |
|
2735 | username are expanded. | |
2729 |
|
2736 | |||
2730 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
2737 | (default: ``$EMAIL`` or ``username@hostname``. If the username in | |
2731 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
2738 | hgrc is empty, e.g. if the system admin set ``username =`` in the | |
2732 | system hgrc, it has to be specified manually or in a different |
|
2739 | system hgrc, it has to be specified manually or in a different | |
2733 | hgrc file) |
|
2740 | hgrc file) | |
2734 |
|
2741 | |||
2735 | ``verbose`` |
|
2742 | ``verbose`` | |
2736 | Increase the amount of output printed. (default: False) |
|
2743 | Increase the amount of output printed. (default: False) | |
2737 |
|
2744 | |||
2738 |
|
2745 | |||
2739 | ``command-templates`` |
|
2746 | ``command-templates`` | |
2740 | --------------------- |
|
2747 | --------------------- | |
2741 |
|
2748 | |||
2742 | Templates used for customizing the output of commands. |
|
2749 | Templates used for customizing the output of commands. | |
2743 |
|
2750 | |||
2744 | ``graphnode`` |
|
2751 | ``graphnode`` | |
2745 | The template used to print changeset nodes in an ASCII revision graph. |
|
2752 | The template used to print changeset nodes in an ASCII revision graph. | |
2746 | (default: ``{graphnode}``) |
|
2753 | (default: ``{graphnode}``) | |
2747 |
|
2754 | |||
2748 | ``log`` |
|
2755 | ``log`` | |
2749 | Template string for commands that print changesets. |
|
2756 | Template string for commands that print changesets. | |
2750 |
|
2757 | |||
2751 | ``mergemarker`` |
|
2758 | ``mergemarker`` | |
2752 | The template used to print the commit description next to each conflict |
|
2759 | The template used to print the commit description next to each conflict | |
2753 | marker during merge conflicts. See :hg:`help templates` for the template |
|
2760 | marker during merge conflicts. See :hg:`help templates` for the template | |
2754 | format. |
|
2761 | format. | |
2755 |
|
2762 | |||
2756 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
2763 | Defaults to showing the hash, tags, branches, bookmarks, author, and | |
2757 | the first line of the commit description. |
|
2764 | the first line of the commit description. | |
2758 |
|
2765 | |||
2759 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
2766 | If you use non-ASCII characters in names for tags, branches, bookmarks, | |
2760 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
2767 | authors, and/or commit descriptions, you must pay attention to encodings of | |
2761 | managed files. At template expansion, non-ASCII characters use the encoding |
|
2768 | managed files. At template expansion, non-ASCII characters use the encoding | |
2762 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
2769 | specified by the ``--encoding`` global option, ``HGENCODING`` or other | |
2763 | environment variables that govern your locale. If the encoding of the merge |
|
2770 | environment variables that govern your locale. If the encoding of the merge | |
2764 | markers is different from the encoding of the merged files, |
|
2771 | markers is different from the encoding of the merged files, | |
2765 | serious problems may occur. |
|
2772 | serious problems may occur. | |
2766 |
|
2773 | |||
2767 | Can be overridden per-merge-tool, see the ``[merge-tools]`` section. |
|
2774 | Can be overridden per-merge-tool, see the ``[merge-tools]`` section. | |
2768 |
|
2775 | |||
2769 | ``oneline-summary`` |
|
2776 | ``oneline-summary`` | |
2770 | A template used by `hg rebase` and other commands for showing a one-line |
|
2777 | A template used by `hg rebase` and other commands for showing a one-line | |
2771 | summary of a commit. If the template configured here is longer than one |
|
2778 | summary of a commit. If the template configured here is longer than one | |
2772 | line, then only the first line is used. |
|
2779 | line, then only the first line is used. | |
2773 |
|
2780 | |||
2774 | The template can be overridden per command by defining a template in |
|
2781 | The template can be overridden per command by defining a template in | |
2775 | `oneline-summary.<command>`, where `<command>` can be e.g. "rebase". |
|
2782 | `oneline-summary.<command>`, where `<command>` can be e.g. "rebase". | |
2776 |
|
2783 | |||
2777 | ``pre-merge-tool-output`` |
|
2784 | ``pre-merge-tool-output`` | |
2778 | A template that is printed before executing an external merge tool. This can |
|
2785 | A template that is printed before executing an external merge tool. This can | |
2779 | be used to print out additional context that might be useful to have during |
|
2786 | be used to print out additional context that might be useful to have during | |
2780 | the conflict resolution, such as the description of the various commits |
|
2787 | the conflict resolution, such as the description of the various commits | |
2781 | involved or bookmarks/tags. |
|
2788 | involved or bookmarks/tags. | |
2782 |
|
2789 | |||
2783 | Additional information is available in the ``local`, ``base``, and ``other`` |
|
2790 | Additional information is available in the ``local`, ``base``, and ``other`` | |
2784 | dicts. For example: ``{local.label}``, ``{base.name}``, or |
|
2791 | dicts. For example: ``{local.label}``, ``{base.name}``, or | |
2785 | ``{other.islink}``. |
|
2792 | ``{other.islink}``. | |
2786 |
|
2793 | |||
2787 |
|
2794 | |||
2788 | ``web`` |
|
2795 | ``web`` | |
2789 | ------- |
|
2796 | ------- | |
2790 |
|
2797 | |||
2791 | Web interface configuration. The settings in this section apply to |
|
2798 | Web interface configuration. The settings in this section apply to | |
2792 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
2799 | both the builtin webserver (started by :hg:`serve`) and the script you | |
2793 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
2800 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
2794 | and WSGI). |
|
2801 | and WSGI). | |
2795 |
|
2802 | |||
2796 | The Mercurial webserver does no authentication (it does not prompt for |
|
2803 | The Mercurial webserver does no authentication (it does not prompt for | |
2797 | usernames and passwords to validate *who* users are), but it does do |
|
2804 | usernames and passwords to validate *who* users are), but it does do | |
2798 | authorization (it grants or denies access for *authenticated users* |
|
2805 | authorization (it grants or denies access for *authenticated users* | |
2799 | based on settings in this section). You must either configure your |
|
2806 | based on settings in this section). You must either configure your | |
2800 | webserver to do authentication for you, or disable the authorization |
|
2807 | webserver to do authentication for you, or disable the authorization | |
2801 | checks. |
|
2808 | checks. | |
2802 |
|
2809 | |||
2803 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
2810 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
2804 | you want it to accept pushes from anybody, you can use the following |
|
2811 | you want it to accept pushes from anybody, you can use the following | |
2805 | command line:: |
|
2812 | command line:: | |
2806 |
|
2813 | |||
2807 | $ hg --config web.allow-push=* --config web.push_ssl=False serve |
|
2814 | $ hg --config web.allow-push=* --config web.push_ssl=False serve | |
2808 |
|
2815 | |||
2809 | Note that this will allow anybody to push anything to the server and |
|
2816 | Note that this will allow anybody to push anything to the server and | |
2810 | that this should not be used for public servers. |
|
2817 | that this should not be used for public servers. | |
2811 |
|
2818 | |||
2812 | The full set of options is: |
|
2819 | The full set of options is: | |
2813 |
|
2820 | |||
2814 | ``accesslog`` |
|
2821 | ``accesslog`` | |
2815 | Where to output the access log. (default: stdout) |
|
2822 | Where to output the access log. (default: stdout) | |
2816 |
|
2823 | |||
2817 | ``address`` |
|
2824 | ``address`` | |
2818 | Interface address to bind to. (default: all) |
|
2825 | Interface address to bind to. (default: all) | |
2819 |
|
2826 | |||
2820 | ``allow-archive`` |
|
2827 | ``allow-archive`` | |
2821 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
2828 | List of archive format (bz2, gz, zip) allowed for downloading. | |
2822 | (default: empty) |
|
2829 | (default: empty) | |
2823 |
|
2830 | |||
2824 | ``allowbz2`` |
|
2831 | ``allowbz2`` | |
2825 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
2832 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
2826 | revisions. |
|
2833 | revisions. | |
2827 | (default: False) |
|
2834 | (default: False) | |
2828 |
|
2835 | |||
2829 | ``allowgz`` |
|
2836 | ``allowgz`` | |
2830 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
2837 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
2831 | revisions. |
|
2838 | revisions. | |
2832 | (default: False) |
|
2839 | (default: False) | |
2833 |
|
2840 | |||
2834 | ``allow-pull`` |
|
2841 | ``allow-pull`` | |
2835 | Whether to allow pulling from the repository. (default: True) |
|
2842 | Whether to allow pulling from the repository. (default: True) | |
2836 |
|
2843 | |||
2837 | ``allow-push`` |
|
2844 | ``allow-push`` | |
2838 | Whether to allow pushing to the repository. If empty or not set, |
|
2845 | Whether to allow pushing to the repository. If empty or not set, | |
2839 | pushing is not allowed. If the special value ``*``, any remote |
|
2846 | pushing is not allowed. If the special value ``*``, any remote | |
2840 | user can push, including unauthenticated users. Otherwise, the |
|
2847 | user can push, including unauthenticated users. Otherwise, the | |
2841 | remote user must have been authenticated, and the authenticated |
|
2848 | remote user must have been authenticated, and the authenticated | |
2842 | user name must be present in this list. The contents of the |
|
2849 | user name must be present in this list. The contents of the | |
2843 | allow-push list are examined after the deny_push list. |
|
2850 | allow-push list are examined after the deny_push list. | |
2844 |
|
2851 | |||
2845 | ``allow_read`` |
|
2852 | ``allow_read`` | |
2846 | If the user has not already been denied repository access due to |
|
2853 | If the user has not already been denied repository access due to | |
2847 | the contents of deny_read, this list determines whether to grant |
|
2854 | the contents of deny_read, this list determines whether to grant | |
2848 | repository access to the user. If this list is not empty, and the |
|
2855 | repository access to the user. If this list is not empty, and the | |
2849 | user is unauthenticated or not present in the list, then access is |
|
2856 | user is unauthenticated or not present in the list, then access is | |
2850 | denied for the user. If the list is empty or not set, then access |
|
2857 | denied for the user. If the list is empty or not set, then access | |
2851 | is permitted to all users by default. Setting allow_read to the |
|
2858 | is permitted to all users by default. Setting allow_read to the | |
2852 | special value ``*`` is equivalent to it not being set (i.e. access |
|
2859 | special value ``*`` is equivalent to it not being set (i.e. access | |
2853 | is permitted to all users). The contents of the allow_read list are |
|
2860 | is permitted to all users). The contents of the allow_read list are | |
2854 | examined after the deny_read list. |
|
2861 | examined after the deny_read list. | |
2855 |
|
2862 | |||
2856 | ``allowzip`` |
|
2863 | ``allowzip`` | |
2857 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
2864 | (DEPRECATED) Whether to allow .zip downloading of repository | |
2858 | revisions. This feature creates temporary files. |
|
2865 | revisions. This feature creates temporary files. | |
2859 | (default: False) |
|
2866 | (default: False) | |
2860 |
|
2867 | |||
2861 | ``archivesubrepos`` |
|
2868 | ``archivesubrepos`` | |
2862 | Whether to recurse into subrepositories when archiving. |
|
2869 | Whether to recurse into subrepositories when archiving. | |
2863 | (default: False) |
|
2870 | (default: False) | |
2864 |
|
2871 | |||
2865 | ``baseurl`` |
|
2872 | ``baseurl`` | |
2866 | Base URL to use when publishing URLs in other locations, so |
|
2873 | Base URL to use when publishing URLs in other locations, so | |
2867 | third-party tools like email notification hooks can construct |
|
2874 | third-party tools like email notification hooks can construct | |
2868 | URLs. Example: ``http://hgserver/repos/``. |
|
2875 | URLs. Example: ``http://hgserver/repos/``. | |
2869 |
|
2876 | |||
2870 | ``cacerts`` |
|
2877 | ``cacerts`` | |
2871 | Path to file containing a list of PEM encoded certificate |
|
2878 | Path to file containing a list of PEM encoded certificate | |
2872 | authority certificates. Environment variables and ``~user`` |
|
2879 | authority certificates. Environment variables and ``~user`` | |
2873 | constructs are expanded in the filename. If specified on the |
|
2880 | constructs are expanded in the filename. If specified on the | |
2874 | client, then it will verify the identity of remote HTTPS servers |
|
2881 | client, then it will verify the identity of remote HTTPS servers | |
2875 | with these certificates. |
|
2882 | with these certificates. | |
2876 |
|
2883 | |||
2877 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
2884 | To disable SSL verification temporarily, specify ``--insecure`` from | |
2878 | command line. |
|
2885 | command line. | |
2879 |
|
2886 | |||
2880 | You can use OpenSSL's CA certificate file if your platform has |
|
2887 | You can use OpenSSL's CA certificate file if your platform has | |
2881 | one. On most Linux systems this will be |
|
2888 | one. On most Linux systems this will be | |
2882 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
2889 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
2883 | generate this file manually. The form must be as follows:: |
|
2890 | generate this file manually. The form must be as follows:: | |
2884 |
|
2891 | |||
2885 | -----BEGIN CERTIFICATE----- |
|
2892 | -----BEGIN CERTIFICATE----- | |
2886 | ... (certificate in base64 PEM encoding) ... |
|
2893 | ... (certificate in base64 PEM encoding) ... | |
2887 | -----END CERTIFICATE----- |
|
2894 | -----END CERTIFICATE----- | |
2888 | -----BEGIN CERTIFICATE----- |
|
2895 | -----BEGIN CERTIFICATE----- | |
2889 | ... (certificate in base64 PEM encoding) ... |
|
2896 | ... (certificate in base64 PEM encoding) ... | |
2890 | -----END CERTIFICATE----- |
|
2897 | -----END CERTIFICATE----- | |
2891 |
|
2898 | |||
2892 | ``cache`` |
|
2899 | ``cache`` | |
2893 | Whether to support caching in hgweb. (default: True) |
|
2900 | Whether to support caching in hgweb. (default: True) | |
2894 |
|
2901 | |||
2895 | ``certificate`` |
|
2902 | ``certificate`` | |
2896 | Certificate to use when running :hg:`serve`. |
|
2903 | Certificate to use when running :hg:`serve`. | |
2897 |
|
2904 | |||
2898 | ``collapse`` |
|
2905 | ``collapse`` | |
2899 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
2906 | With ``descend`` enabled, repositories in subdirectories are shown at | |
2900 | a single level alongside repositories in the current path. With |
|
2907 | a single level alongside repositories in the current path. With | |
2901 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
2908 | ``collapse`` also enabled, repositories residing at a deeper level than | |
2902 | the current path are grouped behind navigable directory entries that |
|
2909 | the current path are grouped behind navigable directory entries that | |
2903 | lead to the locations of these repositories. In effect, this setting |
|
2910 | lead to the locations of these repositories. In effect, this setting | |
2904 | collapses each collection of repositories found within a subdirectory |
|
2911 | collapses each collection of repositories found within a subdirectory | |
2905 | into a single entry for that subdirectory. (default: False) |
|
2912 | into a single entry for that subdirectory. (default: False) | |
2906 |
|
2913 | |||
2907 | ``comparisoncontext`` |
|
2914 | ``comparisoncontext`` | |
2908 | Number of lines of context to show in side-by-side file comparison. If |
|
2915 | Number of lines of context to show in side-by-side file comparison. If | |
2909 | negative or the value ``full``, whole files are shown. (default: 5) |
|
2916 | negative or the value ``full``, whole files are shown. (default: 5) | |
2910 |
|
2917 | |||
2911 | This setting can be overridden by a ``context`` request parameter to the |
|
2918 | This setting can be overridden by a ``context`` request parameter to the | |
2912 | ``comparison`` command, taking the same values. |
|
2919 | ``comparison`` command, taking the same values. | |
2913 |
|
2920 | |||
2914 | ``contact`` |
|
2921 | ``contact`` | |
2915 | Name or email address of the person in charge of the repository. |
|
2922 | Name or email address of the person in charge of the repository. | |
2916 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
2923 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) | |
2917 |
|
2924 | |||
2918 | ``csp`` |
|
2925 | ``csp`` | |
2919 | Send a ``Content-Security-Policy`` HTTP header with this value. |
|
2926 | Send a ``Content-Security-Policy`` HTTP header with this value. | |
2920 |
|
2927 | |||
2921 | The value may contain a special string ``%nonce%``, which will be replaced |
|
2928 | The value may contain a special string ``%nonce%``, which will be replaced | |
2922 | by a randomly-generated one-time use value. If the value contains |
|
2929 | by a randomly-generated one-time use value. If the value contains | |
2923 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the |
|
2930 | ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the | |
2924 | one-time property of the nonce. This nonce will also be inserted into |
|
2931 | one-time property of the nonce. This nonce will also be inserted into | |
2925 | ``<script>`` elements containing inline JavaScript. |
|
2932 | ``<script>`` elements containing inline JavaScript. | |
2926 |
|
2933 | |||
2927 | Note: lots of HTML content sent by the server is derived from repository |
|
2934 | Note: lots of HTML content sent by the server is derived from repository | |
2928 | data. Please consider the potential for malicious repository data to |
|
2935 | data. Please consider the potential for malicious repository data to | |
2929 | "inject" itself into generated HTML content as part of your security |
|
2936 | "inject" itself into generated HTML content as part of your security | |
2930 | threat model. |
|
2937 | threat model. | |
2931 |
|
2938 | |||
2932 | ``deny_push`` |
|
2939 | ``deny_push`` | |
2933 | Whether to deny pushing to the repository. If empty or not set, |
|
2940 | Whether to deny pushing to the repository. If empty or not set, | |
2934 | push is not denied. If the special value ``*``, all remote users are |
|
2941 | push is not denied. If the special value ``*``, all remote users are | |
2935 | denied push. Otherwise, unauthenticated users are all denied, and |
|
2942 | denied push. Otherwise, unauthenticated users are all denied, and | |
2936 | any authenticated user name present in this list is also denied. The |
|
2943 | any authenticated user name present in this list is also denied. The | |
2937 | contents of the deny_push list are examined before the allow-push list. |
|
2944 | contents of the deny_push list are examined before the allow-push list. | |
2938 |
|
2945 | |||
2939 | ``deny_read`` |
|
2946 | ``deny_read`` | |
2940 | Whether to deny reading/viewing of the repository. If this list is |
|
2947 | Whether to deny reading/viewing of the repository. If this list is | |
2941 | not empty, unauthenticated users are all denied, and any |
|
2948 | not empty, unauthenticated users are all denied, and any | |
2942 | authenticated user name present in this list is also denied access to |
|
2949 | authenticated user name present in this list is also denied access to | |
2943 | the repository. If set to the special value ``*``, all remote users |
|
2950 | the repository. If set to the special value ``*``, all remote users | |
2944 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
2951 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
2945 | the determination of repository access depends on the presence and |
|
2952 | the determination of repository access depends on the presence and | |
2946 | content of the allow_read list (see description). If both |
|
2953 | content of the allow_read list (see description). If both | |
2947 | deny_read and allow_read are empty or not set, then access is |
|
2954 | deny_read and allow_read are empty or not set, then access is | |
2948 | permitted to all users by default. If the repository is being |
|
2955 | permitted to all users by default. If the repository is being | |
2949 | served via hgwebdir, denied users will not be able to see it in |
|
2956 | served via hgwebdir, denied users will not be able to see it in | |
2950 | the list of repositories. The contents of the deny_read list have |
|
2957 | the list of repositories. The contents of the deny_read list have | |
2951 | priority over (are examined before) the contents of the allow_read |
|
2958 | priority over (are examined before) the contents of the allow_read | |
2952 | list. |
|
2959 | list. | |
2953 |
|
2960 | |||
2954 | ``descend`` |
|
2961 | ``descend`` | |
2955 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
2962 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
2956 | directly in the current path will be shown (other repositories are still |
|
2963 | directly in the current path will be shown (other repositories are still | |
2957 | available from the index corresponding to their containing path). |
|
2964 | available from the index corresponding to their containing path). | |
2958 |
|
2965 | |||
2959 | ``description`` |
|
2966 | ``description`` | |
2960 | Textual description of the repository's purpose or contents. |
|
2967 | Textual description of the repository's purpose or contents. | |
2961 | (default: "unknown") |
|
2968 | (default: "unknown") | |
2962 |
|
2969 | |||
2963 | ``encoding`` |
|
2970 | ``encoding`` | |
2964 | Character encoding name. (default: the current locale charset) |
|
2971 | Character encoding name. (default: the current locale charset) | |
2965 | Example: "UTF-8". |
|
2972 | Example: "UTF-8". | |
2966 |
|
2973 | |||
2967 | ``errorlog`` |
|
2974 | ``errorlog`` | |
2968 | Where to output the error log. (default: stderr) |
|
2975 | Where to output the error log. (default: stderr) | |
2969 |
|
2976 | |||
2970 | ``guessmime`` |
|
2977 | ``guessmime`` | |
2971 | Control MIME types for raw download of file content. |
|
2978 | Control MIME types for raw download of file content. | |
2972 | Set to True to let hgweb guess the content type from the file |
|
2979 | Set to True to let hgweb guess the content type from the file | |
2973 | extension. This will serve HTML files as ``text/html`` and might |
|
2980 | extension. This will serve HTML files as ``text/html`` and might | |
2974 | allow cross-site scripting attacks when serving untrusted |
|
2981 | allow cross-site scripting attacks when serving untrusted | |
2975 | repositories. (default: False) |
|
2982 | repositories. (default: False) | |
2976 |
|
2983 | |||
2977 | ``hidden`` |
|
2984 | ``hidden`` | |
2978 | Whether to hide the repository in the hgwebdir index. |
|
2985 | Whether to hide the repository in the hgwebdir index. | |
2979 | (default: False) |
|
2986 | (default: False) | |
2980 |
|
2987 | |||
2981 | ``ipv6`` |
|
2988 | ``ipv6`` | |
2982 | Whether to use IPv6. (default: False) |
|
2989 | Whether to use IPv6. (default: False) | |
2983 |
|
2990 | |||
2984 | ``labels`` |
|
2991 | ``labels`` | |
2985 | List of string *labels* associated with the repository. |
|
2992 | List of string *labels* associated with the repository. | |
2986 |
|
2993 | |||
2987 | Labels are exposed as a template keyword and can be used to customize |
|
2994 | Labels are exposed as a template keyword and can be used to customize | |
2988 | output. e.g. the ``index`` template can group or filter repositories |
|
2995 | output. e.g. the ``index`` template can group or filter repositories | |
2989 | by labels and the ``summary`` template can display additional content |
|
2996 | by labels and the ``summary`` template can display additional content | |
2990 | if a specific label is present. |
|
2997 | if a specific label is present. | |
2991 |
|
2998 | |||
2992 | ``logoimg`` |
|
2999 | ``logoimg`` | |
2993 | File name of the logo image that some templates display on each page. |
|
3000 | File name of the logo image that some templates display on each page. | |
2994 | The file name is relative to ``staticurl``. That is, the full path to |
|
3001 | The file name is relative to ``staticurl``. That is, the full path to | |
2995 | the logo image is "staticurl/logoimg". |
|
3002 | the logo image is "staticurl/logoimg". | |
2996 | If unset, ``hglogo.png`` will be used. |
|
3003 | If unset, ``hglogo.png`` will be used. | |
2997 |
|
3004 | |||
2998 | ``logourl`` |
|
3005 | ``logourl`` | |
2999 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` |
|
3006 | Base URL to use for logos. If unset, ``https://mercurial-scm.org/`` | |
3000 | will be used. |
|
3007 | will be used. | |
3001 |
|
3008 | |||
3002 | ``maxchanges`` |
|
3009 | ``maxchanges`` | |
3003 | Maximum number of changes to list on the changelog. (default: 10) |
|
3010 | Maximum number of changes to list on the changelog. (default: 10) | |
3004 |
|
3011 | |||
3005 | ``maxfiles`` |
|
3012 | ``maxfiles`` | |
3006 | Maximum number of files to list per changeset. (default: 10) |
|
3013 | Maximum number of files to list per changeset. (default: 10) | |
3007 |
|
3014 | |||
3008 | ``maxshortchanges`` |
|
3015 | ``maxshortchanges`` | |
3009 | Maximum number of changes to list on the shortlog, graph or filelog |
|
3016 | Maximum number of changes to list on the shortlog, graph or filelog | |
3010 | pages. (default: 60) |
|
3017 | pages. (default: 60) | |
3011 |
|
3018 | |||
3012 | ``name`` |
|
3019 | ``name`` | |
3013 | Repository name to use in the web interface. |
|
3020 | Repository name to use in the web interface. | |
3014 | (default: current working directory) |
|
3021 | (default: current working directory) | |
3015 |
|
3022 | |||
3016 | ``port`` |
|
3023 | ``port`` | |
3017 | Port to listen on. (default: 8000) |
|
3024 | Port to listen on. (default: 8000) | |
3018 |
|
3025 | |||
3019 | ``prefix`` |
|
3026 | ``prefix`` | |
3020 | Prefix path to serve from. (default: '' (server root)) |
|
3027 | Prefix path to serve from. (default: '' (server root)) | |
3021 |
|
3028 | |||
3022 | ``push_ssl`` |
|
3029 | ``push_ssl`` | |
3023 | Whether to require that inbound pushes be transported over SSL to |
|
3030 | Whether to require that inbound pushes be transported over SSL to | |
3024 | prevent password sniffing. (default: True) |
|
3031 | prevent password sniffing. (default: True) | |
3025 |
|
3032 | |||
3026 | ``refreshinterval`` |
|
3033 | ``refreshinterval`` | |
3027 | How frequently directory listings re-scan the filesystem for new |
|
3034 | How frequently directory listings re-scan the filesystem for new | |
3028 | repositories, in seconds. This is relevant when wildcards are used |
|
3035 | repositories, in seconds. This is relevant when wildcards are used | |
3029 | to define paths. Depending on how much filesystem traversal is |
|
3036 | to define paths. Depending on how much filesystem traversal is | |
3030 | required, refreshing may negatively impact performance. |
|
3037 | required, refreshing may negatively impact performance. | |
3031 |
|
3038 | |||
3032 | Values less than or equal to 0 always refresh. |
|
3039 | Values less than or equal to 0 always refresh. | |
3033 | (default: 20) |
|
3040 | (default: 20) | |
3034 |
|
3041 | |||
3035 | ``server-header`` |
|
3042 | ``server-header`` | |
3036 | Value for HTTP ``Server`` response header. |
|
3043 | Value for HTTP ``Server`` response header. | |
3037 |
|
3044 | |||
3038 | ``static`` |
|
3045 | ``static`` | |
3039 | Directory where static files are served from. |
|
3046 | Directory where static files are served from. | |
3040 |
|
3047 | |||
3041 | ``staticurl`` |
|
3048 | ``staticurl`` | |
3042 | Base URL to use for static files. If unset, static files (e.g. the |
|
3049 | Base URL to use for static files. If unset, static files (e.g. the | |
3043 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
3050 | hgicon.png favicon) will be served by the CGI script itself. Use | |
3044 | this setting to serve them directly with the HTTP server. |
|
3051 | this setting to serve them directly with the HTTP server. | |
3045 | Example: ``http://hgserver/static/``. |
|
3052 | Example: ``http://hgserver/static/``. | |
3046 |
|
3053 | |||
3047 | ``stripes`` |
|
3054 | ``stripes`` | |
3048 | How many lines a "zebra stripe" should span in multi-line output. |
|
3055 | How many lines a "zebra stripe" should span in multi-line output. | |
3049 | Set to 0 to disable. (default: 1) |
|
3056 | Set to 0 to disable. (default: 1) | |
3050 |
|
3057 | |||
3051 | ``style`` |
|
3058 | ``style`` | |
3052 | Which template map style to use. The available options are the names of |
|
3059 | Which template map style to use. The available options are the names of | |
3053 | subdirectories in the HTML templates path. (default: ``paper``) |
|
3060 | subdirectories in the HTML templates path. (default: ``paper``) | |
3054 | Example: ``monoblue``. |
|
3061 | Example: ``monoblue``. | |
3055 |
|
3062 | |||
3056 | ``templates`` |
|
3063 | ``templates`` | |
3057 | Where to find the HTML templates. The default path to the HTML templates |
|
3064 | Where to find the HTML templates. The default path to the HTML templates | |
3058 | can be obtained from ``hg debuginstall``. |
|
3065 | can be obtained from ``hg debuginstall``. | |
3059 |
|
3066 | |||
3060 | ``websub`` |
|
3067 | ``websub`` | |
3061 | ---------- |
|
3068 | ---------- | |
3062 |
|
3069 | |||
3063 | Web substitution filter definition. You can use this section to |
|
3070 | Web substitution filter definition. You can use this section to | |
3064 | define a set of regular expression substitution patterns which |
|
3071 | define a set of regular expression substitution patterns which | |
3065 | let you automatically modify the hgweb server output. |
|
3072 | let you automatically modify the hgweb server output. | |
3066 |
|
3073 | |||
3067 | The default hgweb templates only apply these substitution patterns |
|
3074 | The default hgweb templates only apply these substitution patterns | |
3068 | on the revision description fields. You can apply them anywhere |
|
3075 | on the revision description fields. You can apply them anywhere | |
3069 | you want when you create your own templates by adding calls to the |
|
3076 | you want when you create your own templates by adding calls to the | |
3070 | "websub" filter (usually after calling the "escape" filter). |
|
3077 | "websub" filter (usually after calling the "escape" filter). | |
3071 |
|
3078 | |||
3072 | This can be used, for example, to convert issue references to links |
|
3079 | This can be used, for example, to convert issue references to links | |
3073 | to your issue tracker, or to convert "markdown-like" syntax into |
|
3080 | to your issue tracker, or to convert "markdown-like" syntax into | |
3074 | HTML (see the examples below). |
|
3081 | HTML (see the examples below). | |
3075 |
|
3082 | |||
3076 | Each entry in this section names a substitution filter. |
|
3083 | Each entry in this section names a substitution filter. | |
3077 | The value of each entry defines the substitution expression itself. |
|
3084 | The value of each entry defines the substitution expression itself. | |
3078 | The websub expressions follow the old interhg extension syntax, |
|
3085 | The websub expressions follow the old interhg extension syntax, | |
3079 | which in turn imitates the Unix sed replacement syntax:: |
|
3086 | which in turn imitates the Unix sed replacement syntax:: | |
3080 |
|
3087 | |||
3081 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
3088 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
3082 |
|
3089 | |||
3083 | You can use any separator other than "/". The final "i" is optional |
|
3090 | You can use any separator other than "/". The final "i" is optional | |
3084 | and indicates that the search must be case insensitive. |
|
3091 | and indicates that the search must be case insensitive. | |
3085 |
|
3092 | |||
3086 | Examples:: |
|
3093 | Examples:: | |
3087 |
|
3094 | |||
3088 | [websub] |
|
3095 | [websub] | |
3089 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
3096 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
3090 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
3097 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
3091 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
3098 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
3092 |
|
3099 | |||
3093 | ``worker`` |
|
3100 | ``worker`` | |
3094 | ---------- |
|
3101 | ---------- | |
3095 |
|
3102 | |||
3096 | Parallel master/worker configuration. We currently perform working |
|
3103 | Parallel master/worker configuration. We currently perform working | |
3097 | directory updates in parallel on Unix-like systems, which greatly |
|
3104 | directory updates in parallel on Unix-like systems, which greatly | |
3098 | helps performance. |
|
3105 | helps performance. | |
3099 |
|
3106 | |||
3100 | ``enabled`` |
|
3107 | ``enabled`` | |
3101 | Whether to enable workers code to be used. |
|
3108 | Whether to enable workers code to be used. | |
3102 | (default: true) |
|
3109 | (default: true) | |
3103 |
|
3110 | |||
3104 | ``numcpus`` |
|
3111 | ``numcpus`` | |
3105 | Number of CPUs to use for parallel operations. A zero or |
|
3112 | Number of CPUs to use for parallel operations. A zero or | |
3106 | negative value is treated as ``use the default``. |
|
3113 | negative value is treated as ``use the default``. | |
3107 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
3114 | (default: 4 or the number of CPUs on the system, whichever is larger) | |
3108 |
|
3115 | |||
3109 | ``backgroundclose`` |
|
3116 | ``backgroundclose`` | |
3110 | Whether to enable closing file handles on background threads during certain |
|
3117 | Whether to enable closing file handles on background threads during certain | |
3111 | operations. Some platforms aren't very efficient at closing file |
|
3118 | operations. Some platforms aren't very efficient at closing file | |
3112 | handles that have been written or appended to. By performing file closing |
|
3119 | handles that have been written or appended to. By performing file closing | |
3113 | on background threads, file write rate can increase substantially. |
|
3120 | on background threads, file write rate can increase substantially. | |
3114 | (default: true on Windows, false elsewhere) |
|
3121 | (default: true on Windows, false elsewhere) | |
3115 |
|
3122 | |||
3116 | ``backgroundcloseminfilecount`` |
|
3123 | ``backgroundcloseminfilecount`` | |
3117 | Minimum number of files required to trigger background file closing. |
|
3124 | Minimum number of files required to trigger background file closing. | |
3118 | Operations not writing this many files won't start background close |
|
3125 | Operations not writing this many files won't start background close | |
3119 | threads. |
|
3126 | threads. | |
3120 | (default: 2048) |
|
3127 | (default: 2048) | |
3121 |
|
3128 | |||
3122 | ``backgroundclosemaxqueue`` |
|
3129 | ``backgroundclosemaxqueue`` | |
3123 | The maximum number of opened file handles waiting to be closed in the |
|
3130 | The maximum number of opened file handles waiting to be closed in the | |
3124 | background. This option only has an effect if ``backgroundclose`` is |
|
3131 | background. This option only has an effect if ``backgroundclose`` is | |
3125 | enabled. |
|
3132 | enabled. | |
3126 | (default: 384) |
|
3133 | (default: 384) | |
3127 |
|
3134 | |||
3128 | ``backgroundclosethreadcount`` |
|
3135 | ``backgroundclosethreadcount`` | |
3129 | Number of threads to process background file closes. Only relevant if |
|
3136 | Number of threads to process background file closes. Only relevant if | |
3130 | ``backgroundclose`` is enabled. |
|
3137 | ``backgroundclose`` is enabled. | |
3131 | (default: 4) |
|
3138 | (default: 4) |
@@ -1,44 +1,45 b'' | |||||
1 | #require test-repo |
|
1 | #require test-repo | |
2 |
|
2 | |||
3 | $ . "$TESTDIR/helpers-testrepo.sh" |
|
3 | $ . "$TESTDIR/helpers-testrepo.sh" | |
4 | $ import_checker="$TESTDIR"/../contrib/import-checker.py |
|
4 | $ import_checker="$TESTDIR"/../contrib/import-checker.py | |
5 |
|
5 | |||
6 | $ cd "$TESTDIR"/.. |
|
6 | $ cd "$TESTDIR"/.. | |
7 |
|
7 | |||
8 | There are a handful of cases here that require renaming a module so it |
|
8 | There are a handful of cases here that require renaming a module so it | |
9 | doesn't overlap with a stdlib module name. There are also some cycles |
|
9 | doesn't overlap with a stdlib module name. There are also some cycles | |
10 | here that we should still endeavor to fix, and some cycles will be |
|
10 | here that we should still endeavor to fix, and some cycles will be | |
11 | hidden by deduplication algorithm in the cycle detector, so fixing |
|
11 | hidden by deduplication algorithm in the cycle detector, so fixing | |
12 | these may expose other cycles. |
|
12 | these may expose other cycles. | |
13 |
|
13 | |||
14 | Known-bad files are excluded by -X as some of them would produce unstable |
|
14 | Known-bad files are excluded by -X as some of them would produce unstable | |
15 | outputs, which should be fixed later. |
|
15 | outputs, which should be fixed later. | |
16 |
|
16 | |||
17 | NOTE: the `hg locate` command here only works on files that are known to |
|
17 | NOTE: the `hg locate` command here only works on files that are known to | |
18 | Mercurial. If you add an import of a new file and haven't yet `hg add`ed it, you |
|
18 | Mercurial. If you add an import of a new file and haven't yet `hg add`ed it, you | |
19 | will likely receive warnings about a direct import. |
|
19 | will likely receive warnings about a direct import. | |
20 |
|
20 | |||
21 | $ testrepohg locate 'set:**.py or grep(r"^#!.*?python")' \ |
|
21 | $ testrepohg locate 'set:**.py or grep(r"^#!.*?python")' \ | |
22 | > 'tests/**.t' \ |
|
22 | > 'tests/**.t' \ | |
23 | > -X hgweb.cgi \ |
|
23 | > -X hgweb.cgi \ | |
24 | > -X setup.py \ |
|
24 | > -X setup.py \ | |
25 | > -X contrib/automation/ \ |
|
25 | > -X contrib/automation/ \ | |
26 | > -X contrib/debugshell.py \ |
|
26 | > -X contrib/debugshell.py \ | |
27 | > -X contrib/hgweb.fcgi \ |
|
27 | > -X contrib/hgweb.fcgi \ | |
28 | > -X contrib/packaging/hg-docker \ |
|
28 | > -X contrib/packaging/hg-docker \ | |
29 | > -X contrib/packaging/hgpackaging/ \ |
|
29 | > -X contrib/packaging/hgpackaging/ \ | |
30 | > -X contrib/packaging/inno/ \ |
|
30 | > -X contrib/packaging/inno/ \ | |
31 | > -X contrib/phab-clean.py \ |
|
31 | > -X contrib/phab-clean.py \ | |
32 | > -X contrib/python-zstandard/ \ |
|
32 | > -X contrib/python-zstandard/ \ | |
33 | > -X contrib/win32/hgwebdir_wsgi.py \ |
|
33 | > -X contrib/win32/hgwebdir_wsgi.py \ | |
34 | > -X contrib/perf-utils/perf-revlog-write-plot.py \ |
|
34 | > -X contrib/perf-utils/perf-revlog-write-plot.py \ | |
35 | > -X doc/gendoc.py \ |
|
35 | > -X doc/gendoc.py \ | |
36 | > -X doc/hgmanpage.py \ |
|
36 | > -X doc/hgmanpage.py \ | |
37 | > -X i18n/posplit \ |
|
37 | > -X i18n/posplit \ | |
38 | > -X mercurial/thirdparty \ |
|
38 | > -X mercurial/thirdparty \ | |
39 | > -X tests/hypothesishelpers.py \ |
|
39 | > -X tests/hypothesishelpers.py \ | |
40 | > -X tests/test-check-interfaces.py \ |
|
40 | > -X tests/test-check-interfaces.py \ | |
41 | > -X tests/test-demandimport.py \ |
|
41 | > -X tests/test-demandimport.py \ | |
42 | > -X tests/test-imports-checker.t \ |
|
42 | > -X tests/test-imports-checker.t \ | |
43 | > -X tests/test-verify-repo-operations.py \ |
|
43 | > -X tests/test-verify-repo-operations.py \ | |
|
44 | > -X tests/test-extension.t \ | |||
44 | > | sed 's-\\-/-g' | "$PYTHON" "$import_checker" - |
|
45 | > | sed 's-\\-/-g' | "$PYTHON" "$import_checker" - |
@@ -1,2037 +1,2054 b'' | |||||
1 | Test basic extension support |
|
1 | Test basic extension support | |
2 | $ cat > unflush.py <<EOF |
|
2 | $ cat > unflush.py <<EOF | |
3 | > import sys |
|
3 | > import sys | |
4 | > from mercurial import pycompat |
|
4 | > from mercurial import pycompat | |
5 | > if pycompat.ispy3: |
|
5 | > if pycompat.ispy3: | |
6 | > # no changes required |
|
6 | > # no changes required | |
7 | > sys.exit(0) |
|
7 | > sys.exit(0) | |
8 | > with open(sys.argv[1], 'rb') as f: |
|
8 | > with open(sys.argv[1], 'rb') as f: | |
9 | > data = f.read() |
|
9 | > data = f.read() | |
10 | > with open(sys.argv[1], 'wb') as f: |
|
10 | > with open(sys.argv[1], 'wb') as f: | |
11 | > f.write(data.replace(b', flush=True', b'')) |
|
11 | > f.write(data.replace(b', flush=True', b'')) | |
12 | > EOF |
|
12 | > EOF | |
13 |
|
13 | |||
14 | $ cat > foobar.py <<EOF |
|
14 | $ cat > foobar.py <<EOF | |
15 | > import os |
|
15 | > import os | |
16 | > from mercurial import commands, exthelper, registrar |
|
16 | > from mercurial import commands, exthelper, registrar | |
17 | > |
|
17 | > | |
18 | > eh = exthelper.exthelper() |
|
18 | > eh = exthelper.exthelper() | |
19 | > eh.configitem(b'tests', b'foo', default=b"Foo") |
|
19 | > eh.configitem(b'tests', b'foo', default=b"Foo") | |
20 | > |
|
20 | > | |
21 | > uisetup = eh.finaluisetup |
|
21 | > uisetup = eh.finaluisetup | |
22 | > uipopulate = eh.finaluipopulate |
|
22 | > uipopulate = eh.finaluipopulate | |
23 | > reposetup = eh.finalreposetup |
|
23 | > reposetup = eh.finalreposetup | |
24 | > cmdtable = eh.cmdtable |
|
24 | > cmdtable = eh.cmdtable | |
25 | > configtable = eh.configtable |
|
25 | > configtable = eh.configtable | |
26 | > |
|
26 | > | |
27 | > @eh.uisetup |
|
27 | > @eh.uisetup | |
28 | > def _uisetup(ui): |
|
28 | > def _uisetup(ui): | |
29 | > ui.debug(b"uisetup called [debug]\\n") |
|
29 | > ui.debug(b"uisetup called [debug]\\n") | |
30 | > ui.write(b"uisetup called\\n") |
|
30 | > ui.write(b"uisetup called\\n") | |
31 | > ui.status(b"uisetup called [status]\\n") |
|
31 | > ui.status(b"uisetup called [status]\\n") | |
32 | > ui.flush() |
|
32 | > ui.flush() | |
33 | > @eh.uipopulate |
|
33 | > @eh.uipopulate | |
34 | > def _uipopulate(ui): |
|
34 | > def _uipopulate(ui): | |
35 | > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1 |
|
35 | > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1 | |
36 | > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt) |
|
36 | > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt) | |
37 | > @eh.reposetup |
|
37 | > @eh.reposetup | |
38 | > def _reposetup(ui, repo): |
|
38 | > def _reposetup(ui, repo): | |
39 | > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
39 | > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) | |
40 | > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) |
|
40 | > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) | |
41 | > ui.flush() |
|
41 | > ui.flush() | |
42 | > @eh.command(b'foo', [], b'hg foo') |
|
42 | > @eh.command(b'foo', [], b'hg foo') | |
43 | > def foo(ui, *args, **kwargs): |
|
43 | > def foo(ui, *args, **kwargs): | |
44 | > foo = ui.config(b'tests', b'foo') |
|
44 | > foo = ui.config(b'tests', b'foo') | |
45 | > ui.write(foo) |
|
45 | > ui.write(foo) | |
46 | > ui.write(b"\\n") |
|
46 | > ui.write(b"\\n") | |
47 | > @eh.command(b'bar', [], b'hg bar', norepo=True) |
|
47 | > @eh.command(b'bar', [], b'hg bar', norepo=True) | |
48 | > def bar(ui, *args, **kwargs): |
|
48 | > def bar(ui, *args, **kwargs): | |
49 | > ui.write(b"Bar\\n") |
|
49 | > ui.write(b"Bar\\n") | |
50 | > EOF |
|
50 | > EOF | |
51 | $ abspath=`pwd`/foobar.py |
|
51 | $ abspath=`pwd`/foobar.py | |
52 |
|
52 | |||
53 | $ mkdir barfoo |
|
53 | $ mkdir barfoo | |
54 | $ cp foobar.py barfoo/__init__.py |
|
54 | $ cp foobar.py barfoo/__init__.py | |
55 | $ barfoopath=`pwd`/barfoo |
|
55 | $ barfoopath=`pwd`/barfoo | |
56 |
|
56 | |||
57 | $ hg init a |
|
57 | $ hg init a | |
58 | $ cd a |
|
58 | $ cd a | |
59 | $ echo foo > file |
|
59 | $ echo foo > file | |
60 | $ hg add file |
|
60 | $ hg add file | |
61 | $ hg commit -m 'add file' |
|
61 | $ hg commit -m 'add file' | |
62 |
|
62 | |||
63 | $ echo '[extensions]' >> $HGRCPATH |
|
63 | $ echo '[extensions]' >> $HGRCPATH | |
64 | $ echo "foobar = $abspath" >> $HGRCPATH |
|
64 | $ echo "foobar = $abspath" >> $HGRCPATH | |
65 | $ hg foo |
|
65 | $ hg foo | |
66 | uisetup called |
|
66 | uisetup called | |
67 | uisetup called [status] |
|
67 | uisetup called [status] | |
68 | uipopulate called (1 times) |
|
68 | uipopulate called (1 times) | |
69 | uipopulate called (1 times) |
|
69 | uipopulate called (1 times) | |
70 | uipopulate called (1 times) |
|
70 | uipopulate called (1 times) | |
71 | reposetup called for a |
|
71 | reposetup called for a | |
72 | ui == repo.ui |
|
72 | ui == repo.ui | |
73 | uipopulate called (1 times) (chg !) |
|
73 | uipopulate called (1 times) (chg !) | |
74 | uipopulate called (1 times) (chg !) |
|
74 | uipopulate called (1 times) (chg !) | |
75 | uipopulate called (1 times) (chg !) |
|
75 | uipopulate called (1 times) (chg !) | |
76 | uipopulate called (1 times) (chg !) |
|
76 | uipopulate called (1 times) (chg !) | |
77 | uipopulate called (1 times) (chg !) |
|
77 | uipopulate called (1 times) (chg !) | |
78 | reposetup called for a (chg !) |
|
78 | reposetup called for a (chg !) | |
79 | ui == repo.ui (chg !) |
|
79 | ui == repo.ui (chg !) | |
80 | Foo |
|
80 | Foo | |
81 | $ hg foo --quiet |
|
81 | $ hg foo --quiet | |
82 | uisetup called (no-chg !) |
|
82 | uisetup called (no-chg !) | |
83 | uipopulate called (1 times) |
|
83 | uipopulate called (1 times) | |
84 | uipopulate called (1 times) |
|
84 | uipopulate called (1 times) | |
85 | uipopulate called (1 times) (chg !) |
|
85 | uipopulate called (1 times) (chg !) | |
86 | uipopulate called (1 times) (chg !) |
|
86 | uipopulate called (1 times) (chg !) | |
87 | uipopulate called (1 times) |
|
87 | uipopulate called (1 times) | |
88 | reposetup called for a |
|
88 | reposetup called for a | |
89 | ui == repo.ui |
|
89 | ui == repo.ui | |
90 | Foo |
|
90 | Foo | |
91 | $ hg foo --debug |
|
91 | $ hg foo --debug | |
92 | uisetup called [debug] (no-chg !) |
|
92 | uisetup called [debug] (no-chg !) | |
93 | uisetup called (no-chg !) |
|
93 | uisetup called (no-chg !) | |
94 | uisetup called [status] (no-chg !) |
|
94 | uisetup called [status] (no-chg !) | |
95 | uipopulate called (1 times) |
|
95 | uipopulate called (1 times) | |
96 | uipopulate called (1 times) |
|
96 | uipopulate called (1 times) | |
97 | uipopulate called (1 times) (chg !) |
|
97 | uipopulate called (1 times) (chg !) | |
98 | uipopulate called (1 times) (chg !) |
|
98 | uipopulate called (1 times) (chg !) | |
99 | uipopulate called (1 times) |
|
99 | uipopulate called (1 times) | |
100 | reposetup called for a |
|
100 | reposetup called for a | |
101 | ui == repo.ui |
|
101 | ui == repo.ui | |
102 | Foo |
|
102 | Foo | |
103 |
|
103 | |||
104 | $ cd .. |
|
104 | $ cd .. | |
105 | $ hg clone a b |
|
105 | $ hg clone a b | |
106 | uisetup called (no-chg !) |
|
106 | uisetup called (no-chg !) | |
107 | uisetup called [status] (no-chg !) |
|
107 | uisetup called [status] (no-chg !) | |
108 | uipopulate called (1 times) |
|
108 | uipopulate called (1 times) | |
109 | uipopulate called (1 times) (chg !) |
|
109 | uipopulate called (1 times) (chg !) | |
110 | uipopulate called (1 times) |
|
110 | uipopulate called (1 times) | |
111 | reposetup called for a |
|
111 | reposetup called for a | |
112 | ui == repo.ui |
|
112 | ui == repo.ui | |
113 | uipopulate called (1 times) |
|
113 | uipopulate called (1 times) | |
114 | uipopulate called (1 times) |
|
114 | uipopulate called (1 times) | |
115 | reposetup called for b |
|
115 | reposetup called for b | |
116 | ui == repo.ui |
|
116 | ui == repo.ui | |
117 | updating to branch default |
|
117 | updating to branch default | |
118 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
119 |
|
119 | |||
120 | $ hg bar |
|
120 | $ hg bar | |
121 | uisetup called (no-chg !) |
|
121 | uisetup called (no-chg !) | |
122 | uisetup called [status] (no-chg !) |
|
122 | uisetup called [status] (no-chg !) | |
123 | uipopulate called (1 times) |
|
123 | uipopulate called (1 times) | |
124 | uipopulate called (1 times) (chg !) |
|
124 | uipopulate called (1 times) (chg !) | |
125 | Bar |
|
125 | Bar | |
126 | $ echo 'foobar = !' >> $HGRCPATH |
|
126 | $ echo 'foobar = !' >> $HGRCPATH | |
127 |
|
127 | |||
128 | module/__init__.py-style |
|
128 | module/__init__.py-style | |
129 |
|
129 | |||
130 | $ echo "barfoo = $barfoopath" >> $HGRCPATH |
|
130 | $ echo "barfoo = $barfoopath" >> $HGRCPATH | |
131 | $ cd a |
|
131 | $ cd a | |
132 | $ hg foo |
|
132 | $ hg foo | |
133 | uisetup called |
|
133 | uisetup called | |
134 | uisetup called [status] |
|
134 | uisetup called [status] | |
135 | uipopulate called (1 times) |
|
135 | uipopulate called (1 times) | |
136 | uipopulate called (1 times) |
|
136 | uipopulate called (1 times) | |
137 | uipopulate called (1 times) |
|
137 | uipopulate called (1 times) | |
138 | reposetup called for a |
|
138 | reposetup called for a | |
139 | ui == repo.ui |
|
139 | ui == repo.ui | |
140 | uipopulate called (1 times) (chg !) |
|
140 | uipopulate called (1 times) (chg !) | |
141 | uipopulate called (1 times) (chg !) |
|
141 | uipopulate called (1 times) (chg !) | |
142 | uipopulate called (1 times) (chg !) |
|
142 | uipopulate called (1 times) (chg !) | |
143 | uipopulate called (1 times) (chg !) |
|
143 | uipopulate called (1 times) (chg !) | |
144 | uipopulate called (1 times) (chg !) |
|
144 | uipopulate called (1 times) (chg !) | |
145 | reposetup called for a (chg !) |
|
145 | reposetup called for a (chg !) | |
146 | ui == repo.ui (chg !) |
|
146 | ui == repo.ui (chg !) | |
147 | Foo |
|
147 | Foo | |
148 | $ echo 'barfoo = !' >> $HGRCPATH |
|
148 | $ echo 'barfoo = !' >> $HGRCPATH | |
149 |
|
149 | |||
150 | Check that extensions are loaded in phases: |
|
150 | Check that extensions are loaded in phases: | |
151 |
|
151 | |||
152 | $ cat > foo.py <<EOF |
|
152 | $ cat > foo.py <<EOF | |
153 | > from __future__ import print_function |
|
153 | > from __future__ import print_function | |
154 | > import os |
|
154 | > import os | |
155 | > from mercurial import exthelper |
|
155 | > from mercurial import exthelper | |
156 | > from mercurial.utils import procutil |
|
156 | > from mercurial.utils import procutil | |
157 | > |
|
157 | > | |
158 | > def write(msg): |
|
158 | > def write(msg): | |
159 | > procutil.stdout.write(msg) |
|
159 | > procutil.stdout.write(msg) | |
160 | > procutil.stdout.flush() |
|
160 | > procutil.stdout.flush() | |
161 | > |
|
161 | > | |
162 | > name = os.path.basename(__file__).rsplit('.', 1)[0] |
|
162 | > name = os.path.basename(__file__).rsplit('.', 1)[0] | |
163 | > bytesname = name.encode('utf-8') |
|
163 | > bytesname = name.encode('utf-8') | |
164 | > write(b"1) %s imported\n" % bytesname) |
|
164 | > write(b"1) %s imported\n" % bytesname) | |
165 | > eh = exthelper.exthelper() |
|
165 | > eh = exthelper.exthelper() | |
166 | > @eh.uisetup |
|
166 | > @eh.uisetup | |
167 | > def _uisetup(ui): |
|
167 | > def _uisetup(ui): | |
168 | > write(b"2) %s uisetup\n" % bytesname) |
|
168 | > write(b"2) %s uisetup\n" % bytesname) | |
169 | > @eh.extsetup |
|
169 | > @eh.extsetup | |
170 | > def _extsetup(ui): |
|
170 | > def _extsetup(ui): | |
171 | > write(b"3) %s extsetup\n" % bytesname) |
|
171 | > write(b"3) %s extsetup\n" % bytesname) | |
172 | > @eh.uipopulate |
|
172 | > @eh.uipopulate | |
173 | > def _uipopulate(ui): |
|
173 | > def _uipopulate(ui): | |
174 | > write(b"4) %s uipopulate\n" % bytesname) |
|
174 | > write(b"4) %s uipopulate\n" % bytesname) | |
175 | > @eh.reposetup |
|
175 | > @eh.reposetup | |
176 | > def _reposetup(ui, repo): |
|
176 | > def _reposetup(ui, repo): | |
177 | > write(b"5) %s reposetup\n" % bytesname) |
|
177 | > write(b"5) %s reposetup\n" % bytesname) | |
178 | > |
|
178 | > | |
179 | > extsetup = eh.finalextsetup |
|
179 | > extsetup = eh.finalextsetup | |
180 | > reposetup = eh.finalreposetup |
|
180 | > reposetup = eh.finalreposetup | |
181 | > uipopulate = eh.finaluipopulate |
|
181 | > uipopulate = eh.finaluipopulate | |
182 | > uisetup = eh.finaluisetup |
|
182 | > uisetup = eh.finaluisetup | |
183 | > revsetpredicate = eh.revsetpredicate |
|
183 | > revsetpredicate = eh.revsetpredicate | |
184 | > |
|
184 | > | |
185 | > # custom predicate to check registration of functions at loading |
|
185 | > # custom predicate to check registration of functions at loading | |
186 | > from mercurial import ( |
|
186 | > from mercurial import ( | |
187 | > smartset, |
|
187 | > smartset, | |
188 | > ) |
|
188 | > ) | |
189 | > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb |
|
189 | > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb | |
190 | > def custompredicate(repo, subset, x): |
|
190 | > def custompredicate(repo, subset, x): | |
191 | > return smartset.baseset([r for r in subset if r in {0}]) |
|
191 | > return smartset.baseset([r for r in subset if r in {0}]) | |
192 | > EOF |
|
192 | > EOF | |
193 | $ "$PYTHON" $TESTTMP/unflush.py foo.py |
|
193 | $ "$PYTHON" $TESTTMP/unflush.py foo.py | |
194 |
|
194 | |||
195 | $ cp foo.py bar.py |
|
195 | $ cp foo.py bar.py | |
196 | $ echo 'foo = foo.py' >> $HGRCPATH |
|
196 | $ echo 'foo = foo.py' >> $HGRCPATH | |
197 | $ echo 'bar = bar.py' >> $HGRCPATH |
|
197 | $ echo 'bar = bar.py' >> $HGRCPATH | |
198 |
|
198 | |||
199 | Check normal command's load order of extensions and registration of functions |
|
199 | Check normal command's load order of extensions and registration of functions | |
200 |
|
200 | |||
201 | On chg server, extension should be first set up by the server. Then |
|
201 | On chg server, extension should be first set up by the server. Then | |
202 | object-level setup should follow in the worker process. |
|
202 | object-level setup should follow in the worker process. | |
203 |
|
203 | |||
204 | $ hg log -r "foo() and bar()" -q |
|
204 | $ hg log -r "foo() and bar()" -q | |
205 | 1) foo imported |
|
205 | 1) foo imported | |
206 | 1) bar imported |
|
206 | 1) bar imported | |
207 | 2) foo uisetup |
|
207 | 2) foo uisetup | |
208 | 2) bar uisetup |
|
208 | 2) bar uisetup | |
209 | 3) foo extsetup |
|
209 | 3) foo extsetup | |
210 | 3) bar extsetup |
|
210 | 3) bar extsetup | |
211 | 4) foo uipopulate |
|
211 | 4) foo uipopulate | |
212 | 4) bar uipopulate |
|
212 | 4) bar uipopulate | |
213 | 4) foo uipopulate |
|
213 | 4) foo uipopulate | |
214 | 4) bar uipopulate |
|
214 | 4) bar uipopulate | |
215 | 4) foo uipopulate |
|
215 | 4) foo uipopulate | |
216 | 4) bar uipopulate |
|
216 | 4) bar uipopulate | |
217 | 5) foo reposetup |
|
217 | 5) foo reposetup | |
218 | 5) bar reposetup |
|
218 | 5) bar reposetup | |
219 | 4) foo uipopulate (chg !) |
|
219 | 4) foo uipopulate (chg !) | |
220 | 4) bar uipopulate (chg !) |
|
220 | 4) bar uipopulate (chg !) | |
221 | 4) foo uipopulate (chg !) |
|
221 | 4) foo uipopulate (chg !) | |
222 | 4) bar uipopulate (chg !) |
|
222 | 4) bar uipopulate (chg !) | |
223 | 4) foo uipopulate (chg !) |
|
223 | 4) foo uipopulate (chg !) | |
224 | 4) bar uipopulate (chg !) |
|
224 | 4) bar uipopulate (chg !) | |
225 | 4) foo uipopulate (chg !) |
|
225 | 4) foo uipopulate (chg !) | |
226 | 4) bar uipopulate (chg !) |
|
226 | 4) bar uipopulate (chg !) | |
227 | 4) foo uipopulate (chg !) |
|
227 | 4) foo uipopulate (chg !) | |
228 | 4) bar uipopulate (chg !) |
|
228 | 4) bar uipopulate (chg !) | |
229 | 5) foo reposetup (chg !) |
|
229 | 5) foo reposetup (chg !) | |
230 | 5) bar reposetup (chg !) |
|
230 | 5) bar reposetup (chg !) | |
231 | 0:c24b9ac61126 |
|
231 | 0:c24b9ac61126 | |
232 |
|
232 | |||
233 | Check hgweb's load order of extensions and registration of functions |
|
233 | Check hgweb's load order of extensions and registration of functions | |
234 |
|
234 | |||
235 | $ cat > hgweb.cgi <<EOF |
|
235 | $ cat > hgweb.cgi <<EOF | |
236 | > #!$PYTHON |
|
236 | > #!$PYTHON | |
237 | > from mercurial import demandimport; demandimport.enable() |
|
237 | > from mercurial import demandimport; demandimport.enable() | |
238 | > from mercurial.hgweb import hgweb |
|
238 | > from mercurial.hgweb import hgweb | |
239 | > from mercurial.hgweb import wsgicgi |
|
239 | > from mercurial.hgweb import wsgicgi | |
240 | > application = hgweb(b'.', b'test repo') |
|
240 | > application = hgweb(b'.', b'test repo') | |
241 | > wsgicgi.launch(application) |
|
241 | > wsgicgi.launch(application) | |
242 | > EOF |
|
242 | > EOF | |
243 | $ . "$TESTDIR/cgienv" |
|
243 | $ . "$TESTDIR/cgienv" | |
244 |
|
244 | |||
245 | $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \ |
|
245 | $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \ | |
246 | > | grep '^[0-9]) ' # ignores HTML output |
|
246 | > | grep '^[0-9]) ' # ignores HTML output | |
247 | 1) foo imported |
|
247 | 1) foo imported | |
248 | 1) bar imported |
|
248 | 1) bar imported | |
249 | 2) foo uisetup |
|
249 | 2) foo uisetup | |
250 | 2) bar uisetup |
|
250 | 2) bar uisetup | |
251 | 3) foo extsetup |
|
251 | 3) foo extsetup | |
252 | 3) bar extsetup |
|
252 | 3) bar extsetup | |
253 | 4) foo uipopulate |
|
253 | 4) foo uipopulate | |
254 | 4) bar uipopulate |
|
254 | 4) bar uipopulate | |
255 | 4) foo uipopulate |
|
255 | 4) foo uipopulate | |
256 | 4) bar uipopulate |
|
256 | 4) bar uipopulate | |
257 | 5) foo reposetup |
|
257 | 5) foo reposetup | |
258 | 5) bar reposetup |
|
258 | 5) bar reposetup | |
259 |
|
259 | |||
260 | (check that revset predicate foo() and bar() are available) |
|
260 | (check that revset predicate foo() and bar() are available) | |
261 |
|
261 | |||
262 | #if msys |
|
262 | #if msys | |
263 | $ PATH_INFO='//shortlog' |
|
263 | $ PATH_INFO='//shortlog' | |
264 | #else |
|
264 | #else | |
265 | $ PATH_INFO='/shortlog' |
|
265 | $ PATH_INFO='/shortlog' | |
266 | #endif |
|
266 | #endif | |
267 | $ export PATH_INFO |
|
267 | $ export PATH_INFO | |
268 | $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \ |
|
268 | $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \ | |
269 | > | grep '<a href="/rev/[0-9a-z]*">' |
|
269 | > | grep '<a href="/rev/[0-9a-z]*">' | |
270 | <a href="/rev/c24b9ac61126">add file</a> |
|
270 | <a href="/rev/c24b9ac61126">add file</a> | |
271 |
|
271 | |||
272 | $ echo 'foo = !' >> $HGRCPATH |
|
272 | $ echo 'foo = !' >> $HGRCPATH | |
273 | $ echo 'bar = !' >> $HGRCPATH |
|
273 | $ echo 'bar = !' >> $HGRCPATH | |
274 |
|
274 | |||
275 | Check "from __future__ import absolute_import" support for external libraries |
|
275 | Check "from __future__ import absolute_import" support for external libraries | |
276 |
|
276 | |||
277 | (import-checker.py reports issues for some of heredoc python code |
|
277 | (import-checker.py reports issues for some of heredoc python code | |
278 | fragments below, because import-checker.py does not know test specific |
|
278 | fragments below, because import-checker.py does not know test specific | |
279 | package hierarchy. NO_CHECK_* should be used as a limit mark of |
|
279 | package hierarchy. NO_CHECK_* should be used as a limit mark of | |
280 | heredoc, in order to make import-checker.py ignore them. For |
|
280 | heredoc, in order to make import-checker.py ignore them. For | |
281 | simplicity, all python code fragments below are generated with such |
|
281 | simplicity, all python code fragments below are generated with such | |
282 | limit mark, regardless of importing module or not.) |
|
282 | limit mark, regardless of importing module or not.) | |
283 |
|
283 | |||
284 | #if windows |
|
284 | #if windows | |
285 | $ PATHSEP=";" |
|
285 | $ PATHSEP=";" | |
286 | #else |
|
286 | #else | |
287 | $ PATHSEP=":" |
|
287 | $ PATHSEP=":" | |
288 | #endif |
|
288 | #endif | |
289 | $ export PATHSEP |
|
289 | $ export PATHSEP | |
290 |
|
290 | |||
291 | $ mkdir $TESTTMP/libroot |
|
291 | $ mkdir $TESTTMP/libroot | |
292 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py |
|
292 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py | |
293 | $ mkdir $TESTTMP/libroot/mod |
|
293 | $ mkdir $TESTTMP/libroot/mod | |
294 | $ touch $TESTTMP/libroot/mod/__init__.py |
|
294 | $ touch $TESTTMP/libroot/mod/__init__.py | |
295 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py |
|
295 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py | |
296 |
|
296 | |||
297 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF |
|
297 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF | |
298 | > from __future__ import absolute_import, print_function |
|
298 | > from __future__ import absolute_import, print_function | |
299 | > import ambig # should load "libroot/ambig.py" |
|
299 | > import ambig # should load "libroot/ambig.py" | |
300 | > s = ambig.s |
|
300 | > s = ambig.s | |
301 | > NO_CHECK_EOF |
|
301 | > NO_CHECK_EOF | |
302 | $ cat > loadabs.py <<NO_CHECK_EOF |
|
302 | $ cat > loadabs.py <<NO_CHECK_EOF | |
303 | > import mod.ambigabs as ambigabs |
|
303 | > import mod.ambigabs as ambigabs | |
304 | > def extsetup(ui): |
|
304 | > def extsetup(ui): | |
305 | > print('ambigabs.s=%s' % ambigabs.s, flush=True) |
|
305 | > print('ambigabs.s=%s' % ambigabs.s, flush=True) | |
306 | > NO_CHECK_EOF |
|
306 | > NO_CHECK_EOF | |
307 | $ "$PYTHON" $TESTTMP/unflush.py loadabs.py |
|
307 | $ "$PYTHON" $TESTTMP/unflush.py loadabs.py | |
308 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) |
|
308 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) | |
309 | ambigabs.s=libroot/ambig.py |
|
309 | ambigabs.s=libroot/ambig.py | |
310 | $TESTTMP/a |
|
310 | $TESTTMP/a | |
311 |
|
311 | |||
312 | #if no-py3 |
|
312 | #if no-py3 | |
313 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF |
|
313 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF | |
314 | > from __future__ import print_function |
|
314 | > from __future__ import print_function | |
315 | > import ambig # should load "libroot/mod/ambig.py" |
|
315 | > import ambig # should load "libroot/mod/ambig.py" | |
316 | > s = ambig.s |
|
316 | > s = ambig.s | |
317 | > NO_CHECK_EOF |
|
317 | > NO_CHECK_EOF | |
318 | $ cat > loadrel.py <<NO_CHECK_EOF |
|
318 | $ cat > loadrel.py <<NO_CHECK_EOF | |
319 | > import mod.ambigrel as ambigrel |
|
319 | > import mod.ambigrel as ambigrel | |
320 | > def extsetup(ui): |
|
320 | > def extsetup(ui): | |
321 | > print('ambigrel.s=%s' % ambigrel.s, flush=True) |
|
321 | > print('ambigrel.s=%s' % ambigrel.s, flush=True) | |
322 | > NO_CHECK_EOF |
|
322 | > NO_CHECK_EOF | |
323 | $ "$PYTHON" $TESTTMP/unflush.py loadrel.py |
|
323 | $ "$PYTHON" $TESTTMP/unflush.py loadrel.py | |
324 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) |
|
324 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) | |
325 | ambigrel.s=libroot/mod/ambig.py |
|
325 | ambigrel.s=libroot/mod/ambig.py | |
326 | $TESTTMP/a |
|
326 | $TESTTMP/a | |
327 | #endif |
|
327 | #endif | |
328 |
|
328 | |||
329 | Check absolute/relative import of extension specific modules |
|
329 | Check absolute/relative import of extension specific modules | |
330 |
|
330 | |||
331 | $ mkdir $TESTTMP/extroot |
|
331 | $ mkdir $TESTTMP/extroot | |
332 | $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF |
|
332 | $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF | |
333 | > s = b'this is extroot.bar' |
|
333 | > s = b'this is extroot.bar' | |
334 | > NO_CHECK_EOF |
|
334 | > NO_CHECK_EOF | |
335 | $ mkdir $TESTTMP/extroot/sub1 |
|
335 | $ mkdir $TESTTMP/extroot/sub1 | |
336 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF |
|
336 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF | |
337 | > s = b'this is extroot.sub1.__init__' |
|
337 | > s = b'this is extroot.sub1.__init__' | |
338 | > NO_CHECK_EOF |
|
338 | > NO_CHECK_EOF | |
339 | $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF |
|
339 | $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF | |
340 | > s = b'this is extroot.sub1.baz' |
|
340 | > s = b'this is extroot.sub1.baz' | |
341 | > NO_CHECK_EOF |
|
341 | > NO_CHECK_EOF | |
342 | $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF |
|
342 | $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF | |
343 | > from __future__ import absolute_import |
|
343 | > from __future__ import absolute_import | |
344 | > s = b'this is extroot.__init__' |
|
344 | > s = b'this is extroot.__init__' | |
345 | > from . import foo |
|
345 | > from . import foo | |
346 | > def extsetup(ui): |
|
346 | > def extsetup(ui): | |
347 | > ui.write(b'(extroot) ', foo.func(), b'\n') |
|
347 | > ui.write(b'(extroot) ', foo.func(), b'\n') | |
348 | > ui.flush() |
|
348 | > ui.flush() | |
349 | > NO_CHECK_EOF |
|
349 | > NO_CHECK_EOF | |
350 |
|
350 | |||
351 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF |
|
351 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF | |
352 | > # test absolute import |
|
352 | > # test absolute import | |
353 | > buf = [] |
|
353 | > buf = [] | |
354 | > def func(): |
|
354 | > def func(): | |
355 | > # "not locals" case |
|
355 | > # "not locals" case | |
356 | > import extroot.bar |
|
356 | > import extroot.bar | |
357 | > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s) |
|
357 | > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s) | |
358 | > return b'\n(extroot) '.join(buf) |
|
358 | > return b'\n(extroot) '.join(buf) | |
359 | > # b"fromlist == ('*',)" case |
|
359 | > # b"fromlist == ('*',)" case | |
360 | > from extroot.bar import * |
|
360 | > from extroot.bar import * | |
361 | > buf.append(b'from extroot.bar import *: %s' % s) |
|
361 | > buf.append(b'from extroot.bar import *: %s' % s) | |
362 | > # "not fromlist" and "if '.' in name" case |
|
362 | > # "not fromlist" and "if '.' in name" case | |
363 | > import extroot.sub1.baz |
|
363 | > import extroot.sub1.baz | |
364 | > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s) |
|
364 | > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s) | |
365 | > # "not fromlist" and NOT "if '.' in name" case |
|
365 | > # "not fromlist" and NOT "if '.' in name" case | |
366 | > import extroot |
|
366 | > import extroot | |
367 | > buf.append(b'import extroot: %s' % extroot.s) |
|
367 | > buf.append(b'import extroot: %s' % extroot.s) | |
368 | > # NOT "not fromlist" and NOT "level != -1" case |
|
368 | > # NOT "not fromlist" and NOT "level != -1" case | |
369 | > from extroot.bar import s |
|
369 | > from extroot.bar import s | |
370 | > buf.append(b'from extroot.bar import s: %s' % s) |
|
370 | > buf.append(b'from extroot.bar import s: %s' % s) | |
371 | > NO_CHECK_EOF |
|
371 | > NO_CHECK_EOF | |
372 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) |
|
372 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) | |
373 | (extroot) from extroot.bar import *: this is extroot.bar |
|
373 | (extroot) from extroot.bar import *: this is extroot.bar | |
374 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz |
|
374 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz | |
375 | (extroot) import extroot: this is extroot.__init__ |
|
375 | (extroot) import extroot: this is extroot.__init__ | |
376 | (extroot) from extroot.bar import s: this is extroot.bar |
|
376 | (extroot) from extroot.bar import s: this is extroot.bar | |
377 | (extroot) import extroot.bar in func(): this is extroot.bar |
|
377 | (extroot) import extroot.bar in func(): this is extroot.bar | |
378 | $TESTTMP/a |
|
378 | $TESTTMP/a | |
379 |
|
379 | |||
380 | #if no-py3 |
|
380 | #if no-py3 | |
381 | $ rm "$TESTTMP"/extroot/foo.* |
|
381 | $ rm "$TESTTMP"/extroot/foo.* | |
382 | $ rm -Rf "$TESTTMP/extroot/__pycache__" |
|
382 | $ rm -Rf "$TESTTMP/extroot/__pycache__" | |
383 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF |
|
383 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF | |
384 | > # test relative import |
|
384 | > # test relative import | |
385 | > buf = [] |
|
385 | > buf = [] | |
386 | > def func(): |
|
386 | > def func(): | |
387 | > # "not locals" case |
|
387 | > # "not locals" case | |
388 | > import bar |
|
388 | > import bar | |
389 | > buf.append('import bar in func(): %s' % bar.s) |
|
389 | > buf.append('import bar in func(): %s' % bar.s) | |
390 | > return '\n(extroot) '.join(buf) |
|
390 | > return '\n(extroot) '.join(buf) | |
391 | > # "fromlist == ('*',)" case |
|
391 | > # "fromlist == ('*',)" case | |
392 | > from bar import * |
|
392 | > from bar import * | |
393 | > buf.append('from bar import *: %s' % s) |
|
393 | > buf.append('from bar import *: %s' % s) | |
394 | > # "not fromlist" and "if '.' in name" case |
|
394 | > # "not fromlist" and "if '.' in name" case | |
395 | > import sub1.baz |
|
395 | > import sub1.baz | |
396 | > buf.append('import sub1.baz: %s' % sub1.baz.s) |
|
396 | > buf.append('import sub1.baz: %s' % sub1.baz.s) | |
397 | > # "not fromlist" and NOT "if '.' in name" case |
|
397 | > # "not fromlist" and NOT "if '.' in name" case | |
398 | > import sub1 |
|
398 | > import sub1 | |
399 | > buf.append('import sub1: %s' % sub1.s) |
|
399 | > buf.append('import sub1: %s' % sub1.s) | |
400 | > # NOT "not fromlist" and NOT "level != -1" case |
|
400 | > # NOT "not fromlist" and NOT "level != -1" case | |
401 | > from bar import s |
|
401 | > from bar import s | |
402 | > buf.append('from bar import s: %s' % s) |
|
402 | > buf.append('from bar import s: %s' % s) | |
403 | > NO_CHECK_EOF |
|
403 | > NO_CHECK_EOF | |
404 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
404 | $ hg --config extensions.extroot=$TESTTMP/extroot root | |
405 | (extroot) from bar import *: this is extroot.bar |
|
405 | (extroot) from bar import *: this is extroot.bar | |
406 | (extroot) import sub1.baz: this is extroot.sub1.baz |
|
406 | (extroot) import sub1.baz: this is extroot.sub1.baz | |
407 | (extroot) import sub1: this is extroot.sub1.__init__ |
|
407 | (extroot) import sub1: this is extroot.sub1.__init__ | |
408 | (extroot) from bar import s: this is extroot.bar |
|
408 | (extroot) from bar import s: this is extroot.bar | |
409 | (extroot) import bar in func(): this is extroot.bar |
|
409 | (extroot) import bar in func(): this is extroot.bar | |
410 | $TESTTMP/a |
|
410 | $TESTTMP/a | |
411 | #endif |
|
411 | #endif | |
412 |
|
412 | |||
413 | #if demandimport |
|
413 | #if demandimport | |
414 |
|
414 | |||
415 | Examine whether module loading is delayed until actual referring, even |
|
415 | Examine whether module loading is delayed until actual referring, even | |
416 | though module is imported with "absolute_import" feature. |
|
416 | though module is imported with "absolute_import" feature. | |
417 |
|
417 | |||
418 | Files below in each packages are used for described purpose: |
|
418 | Files below in each packages are used for described purpose: | |
419 |
|
419 | |||
420 | - "called": examine whether "from MODULE import ATTR" works correctly |
|
420 | - "called": examine whether "from MODULE import ATTR" works correctly | |
421 | - "unused": examine whether loading is delayed correctly |
|
421 | - "unused": examine whether loading is delayed correctly | |
422 | - "used": examine whether "from PACKAGE import MODULE" works correctly |
|
422 | - "used": examine whether "from PACKAGE import MODULE" works correctly | |
423 |
|
423 | |||
424 | Package hierarchy is needed to examine whether demand importing works |
|
424 | Package hierarchy is needed to examine whether demand importing works | |
425 | as expected for "from SUB.PACK.AGE import MODULE". |
|
425 | as expected for "from SUB.PACK.AGE import MODULE". | |
426 |
|
426 | |||
427 | Setup "external library" to be imported with "absolute_import" |
|
427 | Setup "external library" to be imported with "absolute_import" | |
428 | feature. |
|
428 | feature. | |
429 |
|
429 | |||
430 | $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2 |
|
430 | $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2 | |
431 | $ touch $TESTTMP/extlibroot/__init__.py |
|
431 | $ touch $TESTTMP/extlibroot/__init__.py | |
432 | $ touch $TESTTMP/extlibroot/lsub1/__init__.py |
|
432 | $ touch $TESTTMP/extlibroot/lsub1/__init__.py | |
433 | $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py |
|
433 | $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py | |
434 |
|
434 | |||
435 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF |
|
435 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF | |
436 | > def func(): |
|
436 | > def func(): | |
437 | > return b"this is extlibroot.lsub1.lsub2.called.func()" |
|
437 | > return b"this is extlibroot.lsub1.lsub2.called.func()" | |
438 | > NO_CHECK_EOF |
|
438 | > NO_CHECK_EOF | |
439 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF |
|
439 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF | |
440 | > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") |
|
440 | > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") | |
441 | > NO_CHECK_EOF |
|
441 | > NO_CHECK_EOF | |
442 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF |
|
442 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF | |
443 | > detail = b"this is extlibroot.lsub1.lsub2.used" |
|
443 | > detail = b"this is extlibroot.lsub1.lsub2.used" | |
444 | > NO_CHECK_EOF |
|
444 | > NO_CHECK_EOF | |
445 |
|
445 | |||
446 | Setup sub-package of "external library", which causes instantiation of |
|
446 | Setup sub-package of "external library", which causes instantiation of | |
447 | demandmod in "recurse down the module chain" code path. Relative |
|
447 | demandmod in "recurse down the module chain" code path. Relative | |
448 | importing with "absolute_import" feature isn't tested, because "level |
|
448 | importing with "absolute_import" feature isn't tested, because "level | |
449 | >=1 " doesn't cause instantiation of demandmod. |
|
449 | >=1 " doesn't cause instantiation of demandmod. | |
450 |
|
450 | |||
451 | $ mkdir -p $TESTTMP/extlibroot/recursedown/abs |
|
451 | $ mkdir -p $TESTTMP/extlibroot/recursedown/abs | |
452 | $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF |
|
452 | $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF | |
453 | > detail = b"this is extlibroot.recursedown.abs.used" |
|
453 | > detail = b"this is extlibroot.recursedown.abs.used" | |
454 | > NO_CHECK_EOF |
|
454 | > NO_CHECK_EOF | |
455 | $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF |
|
455 | $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF | |
456 | > from __future__ import absolute_import |
|
456 | > from __future__ import absolute_import | |
457 | > from extlibroot.recursedown.abs.used import detail |
|
457 | > from extlibroot.recursedown.abs.used import detail | |
458 | > NO_CHECK_EOF |
|
458 | > NO_CHECK_EOF | |
459 |
|
459 | |||
460 | $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy |
|
460 | $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy | |
461 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF |
|
461 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF | |
462 | > detail = b"this is extlibroot.recursedown.legacy.used" |
|
462 | > detail = b"this is extlibroot.recursedown.legacy.used" | |
463 | > NO_CHECK_EOF |
|
463 | > NO_CHECK_EOF | |
464 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF |
|
464 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF | |
465 | > # legacy style (level == -1) import |
|
465 | > # legacy style (level == -1) import | |
466 | > from extlibroot.recursedown.legacy.used import detail |
|
466 | > from extlibroot.recursedown.legacy.used import detail | |
467 | > NO_CHECK_EOF |
|
467 | > NO_CHECK_EOF | |
468 |
|
468 | |||
469 | $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF |
|
469 | $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF | |
470 | > from __future__ import absolute_import |
|
470 | > from __future__ import absolute_import | |
471 | > from extlibroot.recursedown.abs import detail as absdetail |
|
471 | > from extlibroot.recursedown.abs import detail as absdetail | |
472 | > from .legacy import detail as legacydetail |
|
472 | > from .legacy import detail as legacydetail | |
473 | > NO_CHECK_EOF |
|
473 | > NO_CHECK_EOF | |
474 |
|
474 | |||
475 | Setup package that re-exports an attribute of its submodule as the same |
|
475 | Setup package that re-exports an attribute of its submodule as the same | |
476 | name. This leaves 'shadowing.used' pointing to 'used.detail', but still |
|
476 | name. This leaves 'shadowing.used' pointing to 'used.detail', but still | |
477 | the submodule 'used' should be somehow accessible. (issue5617) |
|
477 | the submodule 'used' should be somehow accessible. (issue5617) | |
478 |
|
478 | |||
479 | $ mkdir -p $TESTTMP/extlibroot/shadowing |
|
479 | $ mkdir -p $TESTTMP/extlibroot/shadowing | |
480 | $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF |
|
480 | $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF | |
481 | > detail = b"this is extlibroot.shadowing.used" |
|
481 | > detail = b"this is extlibroot.shadowing.used" | |
482 | > NO_CHECK_EOF |
|
482 | > NO_CHECK_EOF | |
483 | $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF |
|
483 | $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF | |
484 | > from __future__ import absolute_import |
|
484 | > from __future__ import absolute_import | |
485 | > from extlibroot.shadowing.used import detail |
|
485 | > from extlibroot.shadowing.used import detail | |
486 | > NO_CHECK_EOF |
|
486 | > NO_CHECK_EOF | |
487 | $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF |
|
487 | $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF | |
488 | > from __future__ import absolute_import |
|
488 | > from __future__ import absolute_import | |
489 | > from .used import detail as used |
|
489 | > from .used import detail as used | |
490 | > NO_CHECK_EOF |
|
490 | > NO_CHECK_EOF | |
491 |
|
491 | |||
492 | Setup extension local modules to be imported with "absolute_import" |
|
492 | Setup extension local modules to be imported with "absolute_import" | |
493 | feature. |
|
493 | feature. | |
494 |
|
494 | |||
495 | $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2 |
|
495 | $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2 | |
496 | $ touch $TESTTMP/absextroot/xsub1/__init__.py |
|
496 | $ touch $TESTTMP/absextroot/xsub1/__init__.py | |
497 | $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py |
|
497 | $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py | |
498 |
|
498 | |||
499 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF |
|
499 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF | |
500 | > def func(): |
|
500 | > def func(): | |
501 | > return b"this is absextroot.xsub1.xsub2.called.func()" |
|
501 | > return b"this is absextroot.xsub1.xsub2.called.func()" | |
502 | > NO_CHECK_EOF |
|
502 | > NO_CHECK_EOF | |
503 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF |
|
503 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF | |
504 | > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") |
|
504 | > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") | |
505 | > NO_CHECK_EOF |
|
505 | > NO_CHECK_EOF | |
506 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF |
|
506 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF | |
507 | > detail = b"this is absextroot.xsub1.xsub2.used" |
|
507 | > detail = b"this is absextroot.xsub1.xsub2.used" | |
508 | > NO_CHECK_EOF |
|
508 | > NO_CHECK_EOF | |
509 |
|
509 | |||
510 | Setup extension local modules to examine whether demand importing |
|
510 | Setup extension local modules to examine whether demand importing | |
511 | works as expected in "level > 1" case. |
|
511 | works as expected in "level > 1" case. | |
512 |
|
512 | |||
513 | $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF |
|
513 | $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF | |
514 | > detail = b"this is absextroot.relimportee" |
|
514 | > detail = b"this is absextroot.relimportee" | |
515 | > NO_CHECK_EOF |
|
515 | > NO_CHECK_EOF | |
516 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF |
|
516 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF | |
517 | > from __future__ import absolute_import |
|
517 | > from __future__ import absolute_import | |
518 | > from mercurial import pycompat |
|
518 | > from mercurial import pycompat | |
519 | > from ... import relimportee |
|
519 | > from ... import relimportee | |
520 | > detail = b"this relimporter imports %r" % ( |
|
520 | > detail = b"this relimporter imports %r" % ( | |
521 | > pycompat.bytestr(relimportee.detail)) |
|
521 | > pycompat.bytestr(relimportee.detail)) | |
522 | > NO_CHECK_EOF |
|
522 | > NO_CHECK_EOF | |
523 |
|
523 | |||
524 | Setup modules, which actually import extension local modules at |
|
524 | Setup modules, which actually import extension local modules at | |
525 | runtime. |
|
525 | runtime. | |
526 |
|
526 | |||
527 | $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF |
|
527 | $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF | |
528 | > from __future__ import absolute_import |
|
528 | > from __future__ import absolute_import | |
529 | > |
|
529 | > | |
530 | > # import extension local modules absolutely (level = 0) |
|
530 | > # import extension local modules absolutely (level = 0) | |
531 | > from absextroot.xsub1.xsub2 import used, unused |
|
531 | > from absextroot.xsub1.xsub2 import used, unused | |
532 | > from absextroot.xsub1.xsub2.called import func |
|
532 | > from absextroot.xsub1.xsub2.called import func | |
533 | > |
|
533 | > | |
534 | > def getresult(): |
|
534 | > def getresult(): | |
535 | > result = [] |
|
535 | > result = [] | |
536 | > result.append(used.detail) |
|
536 | > result.append(used.detail) | |
537 | > result.append(func()) |
|
537 | > result.append(func()) | |
538 | > return result |
|
538 | > return result | |
539 | > NO_CHECK_EOF |
|
539 | > NO_CHECK_EOF | |
540 |
|
540 | |||
541 | $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF |
|
541 | $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF | |
542 | > from __future__ import absolute_import |
|
542 | > from __future__ import absolute_import | |
543 | > |
|
543 | > | |
544 | > # import extension local modules relatively (level == 1) |
|
544 | > # import extension local modules relatively (level == 1) | |
545 | > from .xsub1.xsub2 import used, unused |
|
545 | > from .xsub1.xsub2 import used, unused | |
546 | > from .xsub1.xsub2.called import func |
|
546 | > from .xsub1.xsub2.called import func | |
547 | > |
|
547 | > | |
548 | > # import a module, which implies "importing with level > 1" |
|
548 | > # import a module, which implies "importing with level > 1" | |
549 | > from .xsub1.xsub2 import relimporter |
|
549 | > from .xsub1.xsub2 import relimporter | |
550 | > |
|
550 | > | |
551 | > def getresult(): |
|
551 | > def getresult(): | |
552 | > result = [] |
|
552 | > result = [] | |
553 | > result.append(used.detail) |
|
553 | > result.append(used.detail) | |
554 | > result.append(func()) |
|
554 | > result.append(func()) | |
555 | > result.append(relimporter.detail) |
|
555 | > result.append(relimporter.detail) | |
556 | > return result |
|
556 | > return result | |
557 | > NO_CHECK_EOF |
|
557 | > NO_CHECK_EOF | |
558 |
|
558 | |||
559 | Setup main procedure of extension. |
|
559 | Setup main procedure of extension. | |
560 |
|
560 | |||
561 | $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF |
|
561 | $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF | |
562 | > from __future__ import absolute_import |
|
562 | > from __future__ import absolute_import | |
563 | > from mercurial import registrar |
|
563 | > from mercurial import registrar | |
564 | > cmdtable = {} |
|
564 | > cmdtable = {} | |
565 | > command = registrar.command(cmdtable) |
|
565 | > command = registrar.command(cmdtable) | |
566 | > |
|
566 | > | |
567 | > # "absolute" and "relative" shouldn't be imported before actual |
|
567 | > # "absolute" and "relative" shouldn't be imported before actual | |
568 | > # command execution, because (1) they import same modules, and (2) |
|
568 | > # command execution, because (1) they import same modules, and (2) | |
569 | > # preceding import (= instantiate "demandmod" object instead of |
|
569 | > # preceding import (= instantiate "demandmod" object instead of | |
570 | > # real "module" object) might hide problem of succeeding import. |
|
570 | > # real "module" object) might hide problem of succeeding import. | |
571 | > |
|
571 | > | |
572 | > @command(b'showabsolute', [], norepo=True) |
|
572 | > @command(b'showabsolute', [], norepo=True) | |
573 | > def showabsolute(ui, *args, **opts): |
|
573 | > def showabsolute(ui, *args, **opts): | |
574 | > from absextroot import absolute |
|
574 | > from absextroot import absolute | |
575 | > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult())) |
|
575 | > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult())) | |
576 | > |
|
576 | > | |
577 | > @command(b'showrelative', [], norepo=True) |
|
577 | > @command(b'showrelative', [], norepo=True) | |
578 | > def showrelative(ui, *args, **opts): |
|
578 | > def showrelative(ui, *args, **opts): | |
579 | > from . import relative |
|
579 | > from . import relative | |
580 | > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult())) |
|
580 | > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult())) | |
581 | > |
|
581 | > | |
582 | > # import modules from external library |
|
582 | > # import modules from external library | |
583 | > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused |
|
583 | > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused | |
584 | > from extlibroot.lsub1.lsub2.called import func as lfunc |
|
584 | > from extlibroot.lsub1.lsub2.called import func as lfunc | |
585 | > from extlibroot.recursedown import absdetail, legacydetail |
|
585 | > from extlibroot.recursedown import absdetail, legacydetail | |
586 | > from extlibroot.shadowing import proxied |
|
586 | > from extlibroot.shadowing import proxied | |
587 | > |
|
587 | > | |
588 | > def uisetup(ui): |
|
588 | > def uisetup(ui): | |
589 | > result = [] |
|
589 | > result = [] | |
590 | > result.append(lused.detail) |
|
590 | > result.append(lused.detail) | |
591 | > result.append(lfunc()) |
|
591 | > result.append(lfunc()) | |
592 | > result.append(absdetail) |
|
592 | > result.append(absdetail) | |
593 | > result.append(legacydetail) |
|
593 | > result.append(legacydetail) | |
594 | > result.append(proxied.detail) |
|
594 | > result.append(proxied.detail) | |
595 | > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result)) |
|
595 | > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result)) | |
596 | > NO_CHECK_EOF |
|
596 | > NO_CHECK_EOF | |
597 |
|
597 | |||
598 | Examine module importing. |
|
598 | Examine module importing. | |
599 |
|
599 | |||
600 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) |
|
600 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) | |
601 | LIB: this is extlibroot.lsub1.lsub2.used |
|
601 | LIB: this is extlibroot.lsub1.lsub2.used | |
602 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
602 | LIB: this is extlibroot.lsub1.lsub2.called.func() | |
603 | LIB: this is extlibroot.recursedown.abs.used |
|
603 | LIB: this is extlibroot.recursedown.abs.used | |
604 | LIB: this is extlibroot.recursedown.legacy.used |
|
604 | LIB: this is extlibroot.recursedown.legacy.used | |
605 | LIB: this is extlibroot.shadowing.used |
|
605 | LIB: this is extlibroot.shadowing.used | |
606 | ABS: this is absextroot.xsub1.xsub2.used |
|
606 | ABS: this is absextroot.xsub1.xsub2.used | |
607 | ABS: this is absextroot.xsub1.xsub2.called.func() |
|
607 | ABS: this is absextroot.xsub1.xsub2.called.func() | |
608 |
|
608 | |||
609 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) |
|
609 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) | |
610 | LIB: this is extlibroot.lsub1.lsub2.used |
|
610 | LIB: this is extlibroot.lsub1.lsub2.used | |
611 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
611 | LIB: this is extlibroot.lsub1.lsub2.called.func() | |
612 | LIB: this is extlibroot.recursedown.abs.used |
|
612 | LIB: this is extlibroot.recursedown.abs.used | |
613 | LIB: this is extlibroot.recursedown.legacy.used |
|
613 | LIB: this is extlibroot.recursedown.legacy.used | |
614 | LIB: this is extlibroot.shadowing.used |
|
614 | LIB: this is extlibroot.shadowing.used | |
615 | REL: this is absextroot.xsub1.xsub2.used |
|
615 | REL: this is absextroot.xsub1.xsub2.used | |
616 | REL: this is absextroot.xsub1.xsub2.called.func() |
|
616 | REL: this is absextroot.xsub1.xsub2.called.func() | |
617 | REL: this relimporter imports 'this is absextroot.relimportee' |
|
617 | REL: this relimporter imports 'this is absextroot.relimportee' | |
618 |
|
618 | |||
619 | Examine whether sub-module is imported relatively as expected. |
|
619 | Examine whether sub-module is imported relatively as expected. | |
620 |
|
620 | |||
621 | See also issue5208 for detail about example case on Python 3.x. |
|
621 | See also issue5208 for detail about example case on Python 3.x. | |
622 |
|
622 | |||
623 | $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py |
|
623 | $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py | |
624 | $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found |
|
624 | $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found | |
625 |
|
625 | |||
626 | $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF |
|
626 | $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF | |
627 | > text = 'notexist.py at root is loaded unintentionally\n' |
|
627 | > text = 'notexist.py at root is loaded unintentionally\n' | |
628 | > NO_CHECK_EOF |
|
628 | > NO_CHECK_EOF | |
629 |
|
629 | |||
630 | $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF |
|
630 | $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF | |
631 | > from mercurial import registrar |
|
631 | > from mercurial import registrar | |
632 | > cmdtable = {} |
|
632 | > cmdtable = {} | |
633 | > command = registrar.command(cmdtable) |
|
633 | > command = registrar.command(cmdtable) | |
634 | > |
|
634 | > | |
635 | > # demand import avoids failure of importing notexist here, but only on |
|
635 | > # demand import avoids failure of importing notexist here, but only on | |
636 | > # Python 2. |
|
636 | > # Python 2. | |
637 | > import extlibroot.lsub1.lsub2.notexist |
|
637 | > import extlibroot.lsub1.lsub2.notexist | |
638 | > |
|
638 | > | |
639 | > @command(b'checkrelativity', [], norepo=True) |
|
639 | > @command(b'checkrelativity', [], norepo=True) | |
640 | > def checkrelativity(ui, *args, **opts): |
|
640 | > def checkrelativity(ui, *args, **opts): | |
641 | > try: |
|
641 | > try: | |
642 | > ui.write(extlibroot.lsub1.lsub2.notexist.text) |
|
642 | > ui.write(extlibroot.lsub1.lsub2.notexist.text) | |
643 | > return 1 # unintentional success |
|
643 | > return 1 # unintentional success | |
644 | > except ImportError: |
|
644 | > except ImportError: | |
645 | > pass # intentional failure |
|
645 | > pass # intentional failure | |
646 | > NO_CHECK_EOF |
|
646 | > NO_CHECK_EOF | |
647 |
|
647 | |||
648 | Python 3's lazy importer verifies modules exist before returning the lazy |
|
648 | Python 3's lazy importer verifies modules exist before returning the lazy | |
649 | module stub. Our custom lazy importer for Python 2 always returns a stub. |
|
649 | module stub. Our custom lazy importer for Python 2 always returns a stub. | |
650 |
|
650 | |||
651 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true |
|
651 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true | |
652 | *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist' |
|
652 | *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist' | |
653 | hg: unknown command 'checkrelativity' (py3 !) |
|
653 | hg: unknown command 'checkrelativity' (py3 !) | |
654 | (use 'hg help' for a list of commands) (py3 !) |
|
654 | (use 'hg help' for a list of commands) (py3 !) | |
655 |
|
655 | |||
656 | #endif |
|
656 | #endif | |
657 |
|
657 | |||
658 | (Here, module importing tests are finished. Therefore, use other than |
|
658 | (Here, module importing tests are finished. Therefore, use other than | |
659 | NO_CHECK_* limit mark for heredoc python files, in order to apply |
|
659 | NO_CHECK_* limit mark for heredoc python files, in order to apply | |
660 | import-checker.py or so on their contents) |
|
660 | import-checker.py or so on their contents) | |
661 |
|
661 | |||
662 | Make sure a broken uisetup doesn't globally break hg: |
|
662 | Make sure a broken uisetup doesn't globally break hg: | |
663 | $ cat > $TESTTMP/baduisetup.py <<EOF |
|
663 | $ cat > $TESTTMP/baduisetup.py <<EOF | |
664 | > def uisetup(ui): |
|
664 | > def uisetup(ui): | |
665 | > 1 / 0 |
|
665 | > 1 / 0 | |
666 | > EOF |
|
666 | > EOF | |
667 |
|
667 | |||
668 | Even though the extension fails during uisetup, hg is still basically usable: |
|
668 | Even though the extension fails during uisetup, hg is still basically usable: | |
669 | $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version |
|
669 | $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version | |
670 | Traceback (most recent call last): |
|
670 | Traceback (most recent call last): | |
671 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) (no-pyoxidizer !) |
|
671 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) (no-pyoxidizer !) | |
672 | File "mercurial.extensions", line *, in _runuisetup (glob) (pyoxidizer !) |
|
672 | File "mercurial.extensions", line *, in _runuisetup (glob) (pyoxidizer !) | |
673 | uisetup(ui) |
|
673 | uisetup(ui) | |
674 | File "$TESTTMP/baduisetup.py", line 2, in uisetup |
|
674 | File "$TESTTMP/baduisetup.py", line 2, in uisetup | |
675 | 1 / 0 |
|
675 | 1 / 0 | |
676 | ZeroDivisionError: * by zero (glob) |
|
676 | ZeroDivisionError: * by zero (glob) | |
677 | *** failed to set up extension baduisetup: * by zero (glob) |
|
677 | *** failed to set up extension baduisetup: * by zero (glob) | |
678 | Mercurial Distributed SCM (version *) (glob) |
|
678 | Mercurial Distributed SCM (version *) (glob) | |
679 | (see https://mercurial-scm.org for more information) |
|
679 | (see https://mercurial-scm.org for more information) | |
680 |
|
680 | |||
681 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
681 | Copyright (C) 2005-* Olivia Mackall and others (glob) | |
682 | This is free software; see the source for copying conditions. There is NO |
|
682 | This is free software; see the source for copying conditions. There is NO | |
683 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
683 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
684 |
|
684 | |||
685 | $ cd .. |
|
685 | $ cd .. | |
686 |
|
686 | |||
687 | hide outer repo |
|
687 | hide outer repo | |
688 | $ hg init |
|
688 | $ hg init | |
689 |
|
689 | |||
690 | $ cat > empty.py <<EOF |
|
690 | $ cat > empty.py <<EOF | |
691 | > '''empty cmdtable |
|
691 | > '''empty cmdtable | |
692 | > ''' |
|
692 | > ''' | |
693 | > cmdtable = {} |
|
693 | > cmdtable = {} | |
694 | > EOF |
|
694 | > EOF | |
695 | $ emptypath=`pwd`/empty.py |
|
695 | $ emptypath=`pwd`/empty.py | |
696 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
696 | $ echo "empty = $emptypath" >> $HGRCPATH | |
697 | $ hg help empty |
|
697 | $ hg help empty | |
698 | empty extension - empty cmdtable |
|
698 | empty extension - empty cmdtable | |
699 |
|
699 | |||
700 | no commands defined |
|
700 | no commands defined | |
701 |
|
701 | |||
702 |
|
702 | |||
703 | $ echo 'empty = !' >> $HGRCPATH |
|
703 | $ echo 'empty = !' >> $HGRCPATH | |
704 |
|
704 | |||
705 | $ cat > debugextension.py <<EOF |
|
705 | $ cat > debugextension.py <<EOF | |
706 | > '''only debugcommands |
|
706 | > '''only debugcommands | |
707 | > ''' |
|
707 | > ''' | |
708 | > from mercurial import registrar |
|
708 | > from mercurial import registrar | |
709 | > cmdtable = {} |
|
709 | > cmdtable = {} | |
710 | > command = registrar.command(cmdtable) |
|
710 | > command = registrar.command(cmdtable) | |
711 | > @command(b'debugfoobar', [], b'hg debugfoobar') |
|
711 | > @command(b'debugfoobar', [], b'hg debugfoobar') | |
712 | > def debugfoobar(ui, repo, *args, **opts): |
|
712 | > def debugfoobar(ui, repo, *args, **opts): | |
713 | > "yet another debug command" |
|
713 | > "yet another debug command" | |
714 | > @command(b'foo', [], b'hg foo') |
|
714 | > @command(b'foo', [], b'hg foo') | |
715 | > def foo(ui, repo, *args, **opts): |
|
715 | > def foo(ui, repo, *args, **opts): | |
716 | > """yet another foo command |
|
716 | > """yet another foo command | |
717 | > This command has been DEPRECATED since forever. |
|
717 | > This command has been DEPRECATED since forever. | |
718 | > """ |
|
718 | > """ | |
719 | > EOF |
|
719 | > EOF | |
720 | $ debugpath=`pwd`/debugextension.py |
|
720 | $ debugpath=`pwd`/debugextension.py | |
721 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
721 | $ echo "debugextension = $debugpath" >> $HGRCPATH | |
722 |
|
722 | |||
723 | $ hg help debugextension |
|
723 | $ hg help debugextension | |
724 | hg debugextensions |
|
724 | hg debugextensions | |
725 |
|
725 | |||
726 | show information about active extensions |
|
726 | show information about active extensions | |
727 |
|
727 | |||
728 | options: |
|
728 | options: | |
729 |
|
729 | |||
730 | -T --template TEMPLATE display with template |
|
730 | -T --template TEMPLATE display with template | |
731 |
|
731 | |||
732 | (some details hidden, use --verbose to show complete help) |
|
732 | (some details hidden, use --verbose to show complete help) | |
733 |
|
733 | |||
734 |
|
734 | |||
735 | $ hg --verbose help debugextension |
|
735 | $ hg --verbose help debugextension | |
736 | hg debugextensions |
|
736 | hg debugextensions | |
737 |
|
737 | |||
738 | show information about active extensions |
|
738 | show information about active extensions | |
739 |
|
739 | |||
740 | options: |
|
740 | options: | |
741 |
|
741 | |||
742 | -T --template TEMPLATE display with template |
|
742 | -T --template TEMPLATE display with template | |
743 |
|
743 | |||
744 | global options ([+] can be repeated): |
|
744 | global options ([+] can be repeated): | |
745 |
|
745 | |||
746 | -R --repository REPO repository root directory or name of overlay bundle |
|
746 | -R --repository REPO repository root directory or name of overlay bundle | |
747 | file |
|
747 | file | |
748 | --cwd DIR change working directory |
|
748 | --cwd DIR change working directory | |
749 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
749 | -y --noninteractive do not prompt, automatically pick the first choice for | |
750 | all prompts |
|
750 | all prompts | |
751 | -q --quiet suppress output |
|
751 | -q --quiet suppress output | |
752 | -v --verbose enable additional output |
|
752 | -v --verbose enable additional output | |
753 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
753 | --color TYPE when to colorize (boolean, always, auto, never, or | |
754 | debug) |
|
754 | debug) | |
755 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
755 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
756 | --debug enable debugging output |
|
756 | --debug enable debugging output | |
757 | --debugger start debugger |
|
757 | --debugger start debugger | |
758 | --encoding ENCODE set the charset encoding (default: ascii) |
|
758 | --encoding ENCODE set the charset encoding (default: ascii) | |
759 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
759 | --encodingmode MODE set the charset encoding mode (default: strict) | |
760 | --traceback always print a traceback on exception |
|
760 | --traceback always print a traceback on exception | |
761 | --time time how long the command takes |
|
761 | --time time how long the command takes | |
762 | --profile print command execution profile |
|
762 | --profile print command execution profile | |
763 | --version output version information and exit |
|
763 | --version output version information and exit | |
764 | -h --help display help and exit |
|
764 | -h --help display help and exit | |
765 | --hidden consider hidden changesets |
|
765 | --hidden consider hidden changesets | |
766 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
766 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
767 | (default: auto) |
|
767 | (default: auto) | |
768 |
|
768 | |||
769 |
|
769 | |||
770 |
|
770 | |||
771 |
|
771 | |||
772 |
|
772 | |||
773 |
|
773 | |||
774 | $ hg --debug help debugextension |
|
774 | $ hg --debug help debugextension | |
775 | hg debugextensions |
|
775 | hg debugextensions | |
776 |
|
776 | |||
777 | show information about active extensions |
|
777 | show information about active extensions | |
778 |
|
778 | |||
779 | options: |
|
779 | options: | |
780 |
|
780 | |||
781 | -T --template TEMPLATE display with template |
|
781 | -T --template TEMPLATE display with template | |
782 |
|
782 | |||
783 | global options ([+] can be repeated): |
|
783 | global options ([+] can be repeated): | |
784 |
|
784 | |||
785 | -R --repository REPO repository root directory or name of overlay bundle |
|
785 | -R --repository REPO repository root directory or name of overlay bundle | |
786 | file |
|
786 | file | |
787 | --cwd DIR change working directory |
|
787 | --cwd DIR change working directory | |
788 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
788 | -y --noninteractive do not prompt, automatically pick the first choice for | |
789 | all prompts |
|
789 | all prompts | |
790 | -q --quiet suppress output |
|
790 | -q --quiet suppress output | |
791 | -v --verbose enable additional output |
|
791 | -v --verbose enable additional output | |
792 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
792 | --color TYPE when to colorize (boolean, always, auto, never, or | |
793 | debug) |
|
793 | debug) | |
794 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
794 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
795 | --debug enable debugging output |
|
795 | --debug enable debugging output | |
796 | --debugger start debugger |
|
796 | --debugger start debugger | |
797 | --encoding ENCODE set the charset encoding (default: ascii) |
|
797 | --encoding ENCODE set the charset encoding (default: ascii) | |
798 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
798 | --encodingmode MODE set the charset encoding mode (default: strict) | |
799 | --traceback always print a traceback on exception |
|
799 | --traceback always print a traceback on exception | |
800 | --time time how long the command takes |
|
800 | --time time how long the command takes | |
801 | --profile print command execution profile |
|
801 | --profile print command execution profile | |
802 | --version output version information and exit |
|
802 | --version output version information and exit | |
803 | -h --help display help and exit |
|
803 | -h --help display help and exit | |
804 | --hidden consider hidden changesets |
|
804 | --hidden consider hidden changesets | |
805 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
805 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
806 | (default: auto) |
|
806 | (default: auto) | |
807 |
|
807 | |||
808 |
|
808 | |||
809 |
|
809 | |||
810 |
|
810 | |||
811 |
|
811 | |||
812 | $ echo 'debugextension = !' >> $HGRCPATH |
|
812 | $ echo 'debugextension = !' >> $HGRCPATH | |
813 |
|
813 | |||
814 | Asking for help about a deprecated extension should do something useful: |
|
814 | Asking for help about a deprecated extension should do something useful: | |
815 |
|
815 | |||
816 | $ hg help glog |
|
816 | $ hg help glog | |
817 | 'glog' is provided by the following extension: |
|
817 | 'glog' is provided by the following extension: | |
818 |
|
818 | |||
819 | graphlog command to view revision graphs from a shell (DEPRECATED) |
|
819 | graphlog command to view revision graphs from a shell (DEPRECATED) | |
820 |
|
820 | |||
821 | (use 'hg help extensions' for information on enabling extensions) |
|
821 | (use 'hg help extensions' for information on enabling extensions) | |
822 |
|
822 | |||
823 | Extension module help vs command help: |
|
823 | Extension module help vs command help: | |
824 |
|
824 | |||
825 | $ echo 'extdiff =' >> $HGRCPATH |
|
825 | $ echo 'extdiff =' >> $HGRCPATH | |
826 | $ hg help extdiff |
|
826 | $ hg help extdiff | |
827 | hg extdiff [OPT]... [FILE]... |
|
827 | hg extdiff [OPT]... [FILE]... | |
828 |
|
828 | |||
829 | use external program to diff repository (or selected files) |
|
829 | use external program to diff repository (or selected files) | |
830 |
|
830 | |||
831 | Show differences between revisions for the specified files, using an |
|
831 | Show differences between revisions for the specified files, using an | |
832 | external program. The default program used is diff, with default options |
|
832 | external program. The default program used is diff, with default options | |
833 | "-Npru". |
|
833 | "-Npru". | |
834 |
|
834 | |||
835 | To select a different program, use the -p/--program option. The program |
|
835 | To select a different program, use the -p/--program option. The program | |
836 | will be passed the names of two directories to compare, unless the --per- |
|
836 | will be passed the names of two directories to compare, unless the --per- | |
837 | file option is specified (see below). To pass additional options to the |
|
837 | file option is specified (see below). To pass additional options to the | |
838 | program, use -o/--option. These will be passed before the names of the |
|
838 | program, use -o/--option. These will be passed before the names of the | |
839 | directories or files to compare. |
|
839 | directories or files to compare. | |
840 |
|
840 | |||
841 | The --from, --to, and --change options work the same way they do for 'hg |
|
841 | The --from, --to, and --change options work the same way they do for 'hg | |
842 | diff'. |
|
842 | diff'. | |
843 |
|
843 | |||
844 | The --per-file option runs the external program repeatedly on each file to |
|
844 | The --per-file option runs the external program repeatedly on each file to | |
845 | diff, instead of once on two directories. By default, this happens one by |
|
845 | diff, instead of once on two directories. By default, this happens one by | |
846 | one, where the next file diff is open in the external program only once |
|
846 | one, where the next file diff is open in the external program only once | |
847 | the previous external program (for the previous file diff) has exited. If |
|
847 | the previous external program (for the previous file diff) has exited. If | |
848 | the external program has a graphical interface, it can open all the file |
|
848 | the external program has a graphical interface, it can open all the file | |
849 | diffs at once instead of one by one. See 'hg help -e extdiff' for |
|
849 | diffs at once instead of one by one. See 'hg help -e extdiff' for | |
850 | information about how to tell Mercurial that a given program has a |
|
850 | information about how to tell Mercurial that a given program has a | |
851 | graphical interface. |
|
851 | graphical interface. | |
852 |
|
852 | |||
853 | The --confirm option will prompt the user before each invocation of the |
|
853 | The --confirm option will prompt the user before each invocation of the | |
854 | external program. It is ignored if --per-file isn't specified. |
|
854 | external program. It is ignored if --per-file isn't specified. | |
855 |
|
855 | |||
856 | (use 'hg help -e extdiff' to show help for the extdiff extension) |
|
856 | (use 'hg help -e extdiff' to show help for the extdiff extension) | |
857 |
|
857 | |||
858 | options ([+] can be repeated): |
|
858 | options ([+] can be repeated): | |
859 |
|
859 | |||
860 | -p --program CMD comparison program to run |
|
860 | -p --program CMD comparison program to run | |
861 | -o --option OPT [+] pass option to comparison program |
|
861 | -o --option OPT [+] pass option to comparison program | |
862 | --from REV1 revision to diff from |
|
862 | --from REV1 revision to diff from | |
863 | --to REV2 revision to diff to |
|
863 | --to REV2 revision to diff to | |
864 | -c --change REV change made by revision |
|
864 | -c --change REV change made by revision | |
865 | --per-file compare each file instead of revision snapshots |
|
865 | --per-file compare each file instead of revision snapshots | |
866 | --confirm prompt user before each external program invocation |
|
866 | --confirm prompt user before each external program invocation | |
867 | --patch compare patches for two revisions |
|
867 | --patch compare patches for two revisions | |
868 | -I --include PATTERN [+] include names matching the given patterns |
|
868 | -I --include PATTERN [+] include names matching the given patterns | |
869 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
869 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
870 | -S --subrepos recurse into subrepositories |
|
870 | -S --subrepos recurse into subrepositories | |
871 |
|
871 | |||
872 | (some details hidden, use --verbose to show complete help) |
|
872 | (some details hidden, use --verbose to show complete help) | |
873 |
|
873 | |||
874 |
|
874 | |||
875 |
|
875 | |||
876 |
|
876 | |||
877 |
|
877 | |||
878 |
|
878 | |||
879 |
|
879 | |||
880 |
|
880 | |||
881 |
|
881 | |||
882 |
|
882 | |||
883 | $ hg help --extension extdiff |
|
883 | $ hg help --extension extdiff | |
884 | extdiff extension - command to allow external programs to compare revisions |
|
884 | extdiff extension - command to allow external programs to compare revisions | |
885 |
|
885 | |||
886 | The extdiff Mercurial extension allows you to use external programs to compare |
|
886 | The extdiff Mercurial extension allows you to use external programs to compare | |
887 | revisions, or revision with working directory. The external diff programs are |
|
887 | revisions, or revision with working directory. The external diff programs are | |
888 | called with a configurable set of options and two non-option arguments: paths |
|
888 | called with a configurable set of options and two non-option arguments: paths | |
889 | to directories containing snapshots of files to compare. |
|
889 | to directories containing snapshots of files to compare. | |
890 |
|
890 | |||
891 | If there is more than one file being compared and the "child" revision is the |
|
891 | If there is more than one file being compared and the "child" revision is the | |
892 | working directory, any modifications made in the external diff program will be |
|
892 | working directory, any modifications made in the external diff program will be | |
893 | copied back to the working directory from the temporary directory. |
|
893 | copied back to the working directory from the temporary directory. | |
894 |
|
894 | |||
895 | The extdiff extension also allows you to configure new diff commands, so you |
|
895 | The extdiff extension also allows you to configure new diff commands, so you | |
896 | do not need to type 'hg extdiff -p kdiff3' always. |
|
896 | do not need to type 'hg extdiff -p kdiff3' always. | |
897 |
|
897 | |||
898 | [extdiff] |
|
898 | [extdiff] | |
899 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
899 | # add new command that runs GNU diff(1) in 'context diff' mode | |
900 | cdiff = gdiff -Nprc5 |
|
900 | cdiff = gdiff -Nprc5 | |
901 | ## or the old way: |
|
901 | ## or the old way: | |
902 | #cmd.cdiff = gdiff |
|
902 | #cmd.cdiff = gdiff | |
903 | #opts.cdiff = -Nprc5 |
|
903 | #opts.cdiff = -Nprc5 | |
904 |
|
904 | |||
905 | # add new command called meld, runs meld (no need to name twice). If |
|
905 | # add new command called meld, runs meld (no need to name twice). If | |
906 | # the meld executable is not available, the meld tool in [merge-tools] |
|
906 | # the meld executable is not available, the meld tool in [merge-tools] | |
907 | # will be used, if available |
|
907 | # will be used, if available | |
908 | meld = |
|
908 | meld = | |
909 |
|
909 | |||
910 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
910 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin | |
911 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
911 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non | |
912 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
912 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in | |
913 | # your .vimrc |
|
913 | # your .vimrc | |
914 | vimdiff = gvim -f "+next" \ |
|
914 | vimdiff = gvim -f "+next" \ | |
915 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
915 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" | |
916 |
|
916 | |||
917 | Tool arguments can include variables that are expanded at runtime: |
|
917 | Tool arguments can include variables that are expanded at runtime: | |
918 |
|
918 | |||
919 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
919 | $parent1, $plabel1 - filename, descriptive label of first parent | |
920 | $child, $clabel - filename, descriptive label of child revision |
|
920 | $child, $clabel - filename, descriptive label of child revision | |
921 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
921 | $parent2, $plabel2 - filename, descriptive label of second parent | |
922 | $root - repository root |
|
922 | $root - repository root | |
923 | $parent is an alias for $parent1. |
|
923 | $parent is an alias for $parent1. | |
924 |
|
924 | |||
925 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
925 | The extdiff extension will look in your [diff-tools] and [merge-tools] | |
926 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
926 | sections for diff tool arguments, when none are specified in [extdiff]. | |
927 |
|
927 | |||
928 | [extdiff] |
|
928 | [extdiff] | |
929 | kdiff3 = |
|
929 | kdiff3 = | |
930 |
|
930 | |||
931 | [diff-tools] |
|
931 | [diff-tools] | |
932 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
932 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child | |
933 |
|
933 | |||
934 | If a program has a graphical interface, it might be interesting to tell |
|
934 | If a program has a graphical interface, it might be interesting to tell | |
935 | Mercurial about it. It will prevent the program from being mistakenly used in |
|
935 | Mercurial about it. It will prevent the program from being mistakenly used in | |
936 | a terminal-only environment (such as an SSH terminal session), and will make |
|
936 | a terminal-only environment (such as an SSH terminal session), and will make | |
937 | 'hg extdiff --per-file' open multiple file diffs at once instead of one by one |
|
937 | 'hg extdiff --per-file' open multiple file diffs at once instead of one by one | |
938 | (if you still want to open file diffs one by one, you can use the --confirm |
|
938 | (if you still want to open file diffs one by one, you can use the --confirm | |
939 | option). |
|
939 | option). | |
940 |
|
940 | |||
941 | Declaring that a tool has a graphical interface can be done with the "gui" |
|
941 | Declaring that a tool has a graphical interface can be done with the "gui" | |
942 | flag next to where "diffargs" are specified: |
|
942 | flag next to where "diffargs" are specified: | |
943 |
|
943 | |||
944 | [diff-tools] |
|
944 | [diff-tools] | |
945 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
945 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child | |
946 | kdiff3.gui = true |
|
946 | kdiff3.gui = true | |
947 |
|
947 | |||
948 | You can use -I/-X and list of file or directory names like normal 'hg diff' |
|
948 | You can use -I/-X and list of file or directory names like normal 'hg diff' | |
949 | command. The extdiff extension makes snapshots of only needed files, so |
|
949 | command. The extdiff extension makes snapshots of only needed files, so | |
950 | running the external diff program will actually be pretty fast (at least |
|
950 | running the external diff program will actually be pretty fast (at least | |
951 | faster than having to compare the entire tree). |
|
951 | faster than having to compare the entire tree). | |
952 |
|
952 | |||
953 | list of commands: |
|
953 | list of commands: | |
954 |
|
954 | |||
955 | extdiff use external program to diff repository (or selected files) |
|
955 | extdiff use external program to diff repository (or selected files) | |
956 |
|
956 | |||
957 | (use 'hg help -v -e extdiff' to show built-in aliases and global options) |
|
957 | (use 'hg help -v -e extdiff' to show built-in aliases and global options) | |
958 |
|
958 | |||
959 |
|
959 | |||
960 |
|
960 | |||
961 |
|
961 | |||
962 |
|
962 | |||
963 |
|
963 | |||
964 |
|
964 | |||
965 |
|
965 | |||
966 |
|
966 | |||
967 |
|
967 | |||
968 |
|
968 | |||
969 |
|
969 | |||
970 |
|
970 | |||
971 |
|
971 | |||
972 |
|
972 | |||
973 |
|
973 | |||
974 | $ echo 'extdiff = !' >> $HGRCPATH |
|
974 | $ echo 'extdiff = !' >> $HGRCPATH | |
975 |
|
975 | |||
976 | Test help topic with same name as extension |
|
976 | Test help topic with same name as extension | |
977 |
|
977 | |||
978 | $ cat > multirevs.py <<EOF |
|
978 | $ cat > multirevs.py <<EOF | |
979 | > from mercurial import commands, registrar |
|
979 | > from mercurial import commands, registrar | |
980 | > cmdtable = {} |
|
980 | > cmdtable = {} | |
981 | > command = registrar.command(cmdtable) |
|
981 | > command = registrar.command(cmdtable) | |
982 | > """multirevs extension |
|
982 | > """multirevs extension | |
983 | > Big multi-line module docstring.""" |
|
983 | > Big multi-line module docstring.""" | |
984 | > @command(b'multirevs', [], b'ARG', norepo=True) |
|
984 | > @command(b'multirevs', [], b'ARG', norepo=True) | |
985 | > def multirevs(ui, repo, arg, *args, **opts): |
|
985 | > def multirevs(ui, repo, arg, *args, **opts): | |
986 | > """multirevs command""" |
|
986 | > """multirevs command""" | |
987 | > EOF |
|
987 | > EOF | |
988 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
988 | $ echo "multirevs = multirevs.py" >> $HGRCPATH | |
989 |
|
989 | |||
990 | $ hg help multirevs | tail |
|
990 | $ hg help multirevs | tail | |
991 | used): |
|
991 | used): | |
992 |
|
992 | |||
993 | hg update :@ |
|
993 | hg update :@ | |
994 |
|
994 | |||
995 | - Show diff between tags 1.3 and 1.5 (this works because the first and the |
|
995 | - Show diff between tags 1.3 and 1.5 (this works because the first and the | |
996 | last revisions of the revset are used): |
|
996 | last revisions of the revset are used): | |
997 |
|
997 | |||
998 | hg diff -r 1.3::1.5 |
|
998 | hg diff -r 1.3::1.5 | |
999 |
|
999 | |||
1000 | use 'hg help -c multirevs' to see help for the multirevs command |
|
1000 | use 'hg help -c multirevs' to see help for the multirevs command | |
1001 |
|
1001 | |||
1002 |
|
1002 | |||
1003 |
|
1003 | |||
1004 |
|
1004 | |||
1005 |
|
1005 | |||
1006 |
|
1006 | |||
1007 | $ hg help -c multirevs |
|
1007 | $ hg help -c multirevs | |
1008 | hg multirevs ARG |
|
1008 | hg multirevs ARG | |
1009 |
|
1009 | |||
1010 | multirevs command |
|
1010 | multirevs command | |
1011 |
|
1011 | |||
1012 | (some details hidden, use --verbose to show complete help) |
|
1012 | (some details hidden, use --verbose to show complete help) | |
1013 |
|
1013 | |||
1014 |
|
1014 | |||
1015 |
|
1015 | |||
1016 | $ hg multirevs |
|
1016 | $ hg multirevs | |
1017 | hg multirevs: invalid arguments |
|
1017 | hg multirevs: invalid arguments | |
1018 | hg multirevs ARG |
|
1018 | hg multirevs ARG | |
1019 |
|
1019 | |||
1020 | multirevs command |
|
1020 | multirevs command | |
1021 |
|
1021 | |||
1022 | (use 'hg multirevs -h' to show more help) |
|
1022 | (use 'hg multirevs -h' to show more help) | |
1023 | [10] |
|
1023 | [10] | |
1024 |
|
1024 | |||
1025 |
|
1025 | |||
1026 |
|
1026 | |||
1027 | $ echo "multirevs = !" >> $HGRCPATH |
|
1027 | $ echo "multirevs = !" >> $HGRCPATH | |
1028 |
|
1028 | |||
1029 | Issue811: Problem loading extensions twice (by site and by user) |
|
1029 | Issue811: Problem loading extensions twice (by site and by user) | |
1030 |
|
1030 | |||
1031 | $ cat <<EOF >> $HGRCPATH |
|
1031 | $ cat <<EOF >> $HGRCPATH | |
1032 | > mq = |
|
1032 | > mq = | |
1033 | > strip = |
|
1033 | > strip = | |
1034 | > hgext.mq = |
|
1034 | > hgext.mq = | |
1035 | > hgext/mq = |
|
1035 | > hgext/mq = | |
1036 | > EOF |
|
1036 | > EOF | |
1037 |
|
1037 | |||
1038 | Show extensions: |
|
1038 | Show extensions: | |
1039 | (note that mq force load strip, also checking it's not loaded twice) |
|
1039 | (note that mq force load strip, also checking it's not loaded twice) | |
1040 |
|
1040 | |||
1041 | #if no-extraextensions |
|
1041 | #if no-extraextensions | |
1042 | $ hg debugextensions |
|
1042 | $ hg debugextensions | |
1043 | mq |
|
1043 | mq | |
1044 | strip |
|
1044 | strip | |
1045 | #endif |
|
1045 | #endif | |
1046 |
|
1046 | |||
1047 | For extensions, which name matches one of its commands, help |
|
1047 | For extensions, which name matches one of its commands, help | |
1048 | message should ask '-v -e' to get list of built-in aliases |
|
1048 | message should ask '-v -e' to get list of built-in aliases | |
1049 | along with extension help itself |
|
1049 | along with extension help itself | |
1050 |
|
1050 | |||
1051 | $ mkdir $TESTTMP/d |
|
1051 | $ mkdir $TESTTMP/d | |
1052 | $ cat > $TESTTMP/d/dodo.py <<EOF |
|
1052 | $ cat > $TESTTMP/d/dodo.py <<EOF | |
1053 | > """ |
|
1053 | > """ | |
1054 | > This is an awesome 'dodo' extension. It does nothing and |
|
1054 | > This is an awesome 'dodo' extension. It does nothing and | |
1055 | > writes 'Foo foo' |
|
1055 | > writes 'Foo foo' | |
1056 | > """ |
|
1056 | > """ | |
1057 | > from mercurial import commands, registrar |
|
1057 | > from mercurial import commands, registrar | |
1058 | > cmdtable = {} |
|
1058 | > cmdtable = {} | |
1059 | > command = registrar.command(cmdtable) |
|
1059 | > command = registrar.command(cmdtable) | |
1060 | > @command(b'dodo', [], b'hg dodo') |
|
1060 | > @command(b'dodo', [], b'hg dodo') | |
1061 | > def dodo(ui, *args, **kwargs): |
|
1061 | > def dodo(ui, *args, **kwargs): | |
1062 | > """Does nothing""" |
|
1062 | > """Does nothing""" | |
1063 | > ui.write(b"I do nothing. Yay\\n") |
|
1063 | > ui.write(b"I do nothing. Yay\\n") | |
1064 | > @command(b'foofoo', [], b'hg foofoo') |
|
1064 | > @command(b'foofoo', [], b'hg foofoo') | |
1065 | > def foofoo(ui, *args, **kwargs): |
|
1065 | > def foofoo(ui, *args, **kwargs): | |
1066 | > """Writes 'Foo foo'""" |
|
1066 | > """Writes 'Foo foo'""" | |
1067 | > ui.write(b"Foo foo\\n") |
|
1067 | > ui.write(b"Foo foo\\n") | |
1068 | > EOF |
|
1068 | > EOF | |
1069 | $ dodopath=$TESTTMP/d/dodo.py |
|
1069 | $ dodopath=$TESTTMP/d/dodo.py | |
1070 |
|
1070 | |||
1071 | $ echo "dodo = $dodopath" >> $HGRCPATH |
|
1071 | $ echo "dodo = $dodopath" >> $HGRCPATH | |
1072 |
|
1072 | |||
1073 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases |
|
1073 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases | |
1074 | $ hg help -e dodo |
|
1074 | $ hg help -e dodo | |
1075 | dodo extension - |
|
1075 | dodo extension - | |
1076 |
|
1076 | |||
1077 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
1077 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
1078 |
|
1078 | |||
1079 | list of commands: |
|
1079 | list of commands: | |
1080 |
|
1080 | |||
1081 | dodo Does nothing |
|
1081 | dodo Does nothing | |
1082 | foofoo Writes 'Foo foo' |
|
1082 | foofoo Writes 'Foo foo' | |
1083 |
|
1083 | |||
1084 | (use 'hg help -v -e dodo' to show built-in aliases and global options) |
|
1084 | (use 'hg help -v -e dodo' to show built-in aliases and global options) | |
1085 |
|
1085 | |||
1086 | Make sure that '-v -e' prints list of built-in aliases along with |
|
1086 | Make sure that '-v -e' prints list of built-in aliases along with | |
1087 | extension help itself |
|
1087 | extension help itself | |
1088 | $ hg help -v -e dodo |
|
1088 | $ hg help -v -e dodo | |
1089 | dodo extension - |
|
1089 | dodo extension - | |
1090 |
|
1090 | |||
1091 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
1091 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
1092 |
|
1092 | |||
1093 | list of commands: |
|
1093 | list of commands: | |
1094 |
|
1094 | |||
1095 | dodo Does nothing |
|
1095 | dodo Does nothing | |
1096 | foofoo Writes 'Foo foo' |
|
1096 | foofoo Writes 'Foo foo' | |
1097 |
|
1097 | |||
1098 | global options ([+] can be repeated): |
|
1098 | global options ([+] can be repeated): | |
1099 |
|
1099 | |||
1100 | -R --repository REPO repository root directory or name of overlay bundle |
|
1100 | -R --repository REPO repository root directory or name of overlay bundle | |
1101 | file |
|
1101 | file | |
1102 | --cwd DIR change working directory |
|
1102 | --cwd DIR change working directory | |
1103 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1103 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1104 | all prompts |
|
1104 | all prompts | |
1105 | -q --quiet suppress output |
|
1105 | -q --quiet suppress output | |
1106 | -v --verbose enable additional output |
|
1106 | -v --verbose enable additional output | |
1107 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1107 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1108 | debug) |
|
1108 | debug) | |
1109 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1109 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1110 | --debug enable debugging output |
|
1110 | --debug enable debugging output | |
1111 | --debugger start debugger |
|
1111 | --debugger start debugger | |
1112 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1112 | --encoding ENCODE set the charset encoding (default: ascii) | |
1113 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1113 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1114 | --traceback always print a traceback on exception |
|
1114 | --traceback always print a traceback on exception | |
1115 | --time time how long the command takes |
|
1115 | --time time how long the command takes | |
1116 | --profile print command execution profile |
|
1116 | --profile print command execution profile | |
1117 | --version output version information and exit |
|
1117 | --version output version information and exit | |
1118 | -h --help display help and exit |
|
1118 | -h --help display help and exit | |
1119 | --hidden consider hidden changesets |
|
1119 | --hidden consider hidden changesets | |
1120 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1120 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1121 | (default: auto) |
|
1121 | (default: auto) | |
1122 |
|
1122 | |||
1123 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command |
|
1123 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command | |
1124 | $ hg help -v dodo |
|
1124 | $ hg help -v dodo | |
1125 | hg dodo |
|
1125 | hg dodo | |
1126 |
|
1126 | |||
1127 | Does nothing |
|
1127 | Does nothing | |
1128 |
|
1128 | |||
1129 | (use 'hg help -e dodo' to show help for the dodo extension) |
|
1129 | (use 'hg help -e dodo' to show help for the dodo extension) | |
1130 |
|
1130 | |||
1131 | options: |
|
1131 | options: | |
1132 |
|
1132 | |||
1133 | --mq operate on patch repository |
|
1133 | --mq operate on patch repository | |
1134 |
|
1134 | |||
1135 | global options ([+] can be repeated): |
|
1135 | global options ([+] can be repeated): | |
1136 |
|
1136 | |||
1137 | -R --repository REPO repository root directory or name of overlay bundle |
|
1137 | -R --repository REPO repository root directory or name of overlay bundle | |
1138 | file |
|
1138 | file | |
1139 | --cwd DIR change working directory |
|
1139 | --cwd DIR change working directory | |
1140 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1140 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1141 | all prompts |
|
1141 | all prompts | |
1142 | -q --quiet suppress output |
|
1142 | -q --quiet suppress output | |
1143 | -v --verbose enable additional output |
|
1143 | -v --verbose enable additional output | |
1144 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1144 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1145 | debug) |
|
1145 | debug) | |
1146 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1146 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1147 | --debug enable debugging output |
|
1147 | --debug enable debugging output | |
1148 | --debugger start debugger |
|
1148 | --debugger start debugger | |
1149 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1149 | --encoding ENCODE set the charset encoding (default: ascii) | |
1150 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1150 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1151 | --traceback always print a traceback on exception |
|
1151 | --traceback always print a traceback on exception | |
1152 | --time time how long the command takes |
|
1152 | --time time how long the command takes | |
1153 | --profile print command execution profile |
|
1153 | --profile print command execution profile | |
1154 | --version output version information and exit |
|
1154 | --version output version information and exit | |
1155 | -h --help display help and exit |
|
1155 | -h --help display help and exit | |
1156 | --hidden consider hidden changesets |
|
1156 | --hidden consider hidden changesets | |
1157 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1157 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1158 | (default: auto) |
|
1158 | (default: auto) | |
1159 |
|
1159 | |||
1160 | In case when extension name doesn't match any of its commands, |
|
1160 | In case when extension name doesn't match any of its commands, | |
1161 | help message should ask for '-v' to get list of built-in aliases |
|
1161 | help message should ask for '-v' to get list of built-in aliases | |
1162 | along with extension help |
|
1162 | along with extension help | |
1163 | $ cat > $TESTTMP/d/dudu.py <<EOF |
|
1163 | $ cat > $TESTTMP/d/dudu.py <<EOF | |
1164 | > """ |
|
1164 | > """ | |
1165 | > This is an awesome 'dudu' extension. It does something and |
|
1165 | > This is an awesome 'dudu' extension. It does something and | |
1166 | > also writes 'Beep beep' |
|
1166 | > also writes 'Beep beep' | |
1167 | > """ |
|
1167 | > """ | |
1168 | > from mercurial import commands, registrar |
|
1168 | > from mercurial import commands, registrar | |
1169 | > cmdtable = {} |
|
1169 | > cmdtable = {} | |
1170 | > command = registrar.command(cmdtable) |
|
1170 | > command = registrar.command(cmdtable) | |
1171 | > @command(b'something', [], b'hg something') |
|
1171 | > @command(b'something', [], b'hg something') | |
1172 | > def something(ui, *args, **kwargs): |
|
1172 | > def something(ui, *args, **kwargs): | |
1173 | > """Does something""" |
|
1173 | > """Does something""" | |
1174 | > ui.write(b"I do something. Yaaay\\n") |
|
1174 | > ui.write(b"I do something. Yaaay\\n") | |
1175 | > @command(b'beep', [], b'hg beep') |
|
1175 | > @command(b'beep', [], b'hg beep') | |
1176 | > def beep(ui, *args, **kwargs): |
|
1176 | > def beep(ui, *args, **kwargs): | |
1177 | > """Writes 'Beep beep'""" |
|
1177 | > """Writes 'Beep beep'""" | |
1178 | > ui.write(b"Beep beep\\n") |
|
1178 | > ui.write(b"Beep beep\\n") | |
1179 | > EOF |
|
1179 | > EOF | |
1180 | $ dudupath=$TESTTMP/d/dudu.py |
|
1180 | $ dudupath=$TESTTMP/d/dudu.py | |
1181 |
|
1181 | |||
1182 | $ echo "dudu = $dudupath" >> $HGRCPATH |
|
1182 | $ echo "dudu = $dudupath" >> $HGRCPATH | |
1183 |
|
1183 | |||
1184 | $ hg help -e dudu |
|
1184 | $ hg help -e dudu | |
1185 | dudu extension - |
|
1185 | dudu extension - | |
1186 |
|
1186 | |||
1187 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1187 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
1188 | beep' |
|
1188 | beep' | |
1189 |
|
1189 | |||
1190 | list of commands: |
|
1190 | list of commands: | |
1191 |
|
1191 | |||
1192 | beep Writes 'Beep beep' |
|
1192 | beep Writes 'Beep beep' | |
1193 | something Does something |
|
1193 | something Does something | |
1194 |
|
1194 | |||
1195 | (use 'hg help -v dudu' to show built-in aliases and global options) |
|
1195 | (use 'hg help -v dudu' to show built-in aliases and global options) | |
1196 |
|
1196 | |||
1197 | In case when extension name doesn't match any of its commands, |
|
1197 | In case when extension name doesn't match any of its commands, | |
1198 | help options '-v' and '-v -e' should be equivalent |
|
1198 | help options '-v' and '-v -e' should be equivalent | |
1199 | $ hg help -v dudu |
|
1199 | $ hg help -v dudu | |
1200 | dudu extension - |
|
1200 | dudu extension - | |
1201 |
|
1201 | |||
1202 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1202 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
1203 | beep' |
|
1203 | beep' | |
1204 |
|
1204 | |||
1205 | list of commands: |
|
1205 | list of commands: | |
1206 |
|
1206 | |||
1207 | beep Writes 'Beep beep' |
|
1207 | beep Writes 'Beep beep' | |
1208 | something Does something |
|
1208 | something Does something | |
1209 |
|
1209 | |||
1210 | global options ([+] can be repeated): |
|
1210 | global options ([+] can be repeated): | |
1211 |
|
1211 | |||
1212 | -R --repository REPO repository root directory or name of overlay bundle |
|
1212 | -R --repository REPO repository root directory or name of overlay bundle | |
1213 | file |
|
1213 | file | |
1214 | --cwd DIR change working directory |
|
1214 | --cwd DIR change working directory | |
1215 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1215 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1216 | all prompts |
|
1216 | all prompts | |
1217 | -q --quiet suppress output |
|
1217 | -q --quiet suppress output | |
1218 | -v --verbose enable additional output |
|
1218 | -v --verbose enable additional output | |
1219 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1219 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1220 | debug) |
|
1220 | debug) | |
1221 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1221 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1222 | --debug enable debugging output |
|
1222 | --debug enable debugging output | |
1223 | --debugger start debugger |
|
1223 | --debugger start debugger | |
1224 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1224 | --encoding ENCODE set the charset encoding (default: ascii) | |
1225 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1225 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1226 | --traceback always print a traceback on exception |
|
1226 | --traceback always print a traceback on exception | |
1227 | --time time how long the command takes |
|
1227 | --time time how long the command takes | |
1228 | --profile print command execution profile |
|
1228 | --profile print command execution profile | |
1229 | --version output version information and exit |
|
1229 | --version output version information and exit | |
1230 | -h --help display help and exit |
|
1230 | -h --help display help and exit | |
1231 | --hidden consider hidden changesets |
|
1231 | --hidden consider hidden changesets | |
1232 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1232 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1233 | (default: auto) |
|
1233 | (default: auto) | |
1234 |
|
1234 | |||
1235 | $ hg help -v -e dudu |
|
1235 | $ hg help -v -e dudu | |
1236 | dudu extension - |
|
1236 | dudu extension - | |
1237 |
|
1237 | |||
1238 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1238 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
1239 | beep' |
|
1239 | beep' | |
1240 |
|
1240 | |||
1241 | list of commands: |
|
1241 | list of commands: | |
1242 |
|
1242 | |||
1243 | beep Writes 'Beep beep' |
|
1243 | beep Writes 'Beep beep' | |
1244 | something Does something |
|
1244 | something Does something | |
1245 |
|
1245 | |||
1246 | global options ([+] can be repeated): |
|
1246 | global options ([+] can be repeated): | |
1247 |
|
1247 | |||
1248 | -R --repository REPO repository root directory or name of overlay bundle |
|
1248 | -R --repository REPO repository root directory or name of overlay bundle | |
1249 | file |
|
1249 | file | |
1250 | --cwd DIR change working directory |
|
1250 | --cwd DIR change working directory | |
1251 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1251 | -y --noninteractive do not prompt, automatically pick the first choice for | |
1252 | all prompts |
|
1252 | all prompts | |
1253 | -q --quiet suppress output |
|
1253 | -q --quiet suppress output | |
1254 | -v --verbose enable additional output |
|
1254 | -v --verbose enable additional output | |
1255 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1255 | --color TYPE when to colorize (boolean, always, auto, never, or | |
1256 | debug) |
|
1256 | debug) | |
1257 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1257 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
1258 | --debug enable debugging output |
|
1258 | --debug enable debugging output | |
1259 | --debugger start debugger |
|
1259 | --debugger start debugger | |
1260 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1260 | --encoding ENCODE set the charset encoding (default: ascii) | |
1261 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1261 | --encodingmode MODE set the charset encoding mode (default: strict) | |
1262 | --traceback always print a traceback on exception |
|
1262 | --traceback always print a traceback on exception | |
1263 | --time time how long the command takes |
|
1263 | --time time how long the command takes | |
1264 | --profile print command execution profile |
|
1264 | --profile print command execution profile | |
1265 | --version output version information and exit |
|
1265 | --version output version information and exit | |
1266 | -h --help display help and exit |
|
1266 | -h --help display help and exit | |
1267 | --hidden consider hidden changesets |
|
1267 | --hidden consider hidden changesets | |
1268 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1268 | --pager TYPE when to paginate (boolean, always, auto, or never) | |
1269 | (default: auto) |
|
1269 | (default: auto) | |
1270 |
|
1270 | |||
1271 | Disabled extension commands: |
|
1271 | Disabled extension commands: | |
1272 |
|
1272 | |||
1273 | $ ORGHGRCPATH=$HGRCPATH |
|
1273 | $ ORGHGRCPATH=$HGRCPATH | |
1274 | $ HGRCPATH= |
|
1274 | $ HGRCPATH= | |
1275 | $ export HGRCPATH |
|
1275 | $ export HGRCPATH | |
1276 | $ hg help email |
|
1276 | $ hg help email | |
1277 | 'email' is provided by the following extension: |
|
1277 | 'email' is provided by the following extension: | |
1278 |
|
1278 | |||
1279 | patchbomb command to send changesets as (a series of) patch emails |
|
1279 | patchbomb command to send changesets as (a series of) patch emails | |
1280 |
|
1280 | |||
1281 | (use 'hg help extensions' for information on enabling extensions) |
|
1281 | (use 'hg help extensions' for information on enabling extensions) | |
1282 |
|
1282 | |||
1283 |
|
1283 | |||
1284 | $ hg qdel |
|
1284 | $ hg qdel | |
1285 | hg: unknown command 'qdel' |
|
1285 | hg: unknown command 'qdel' | |
1286 | 'qdelete' is provided by the following extension: |
|
1286 | 'qdelete' is provided by the following extension: | |
1287 |
|
1287 | |||
1288 | mq manage a stack of patches |
|
1288 | mq manage a stack of patches | |
1289 |
|
1289 | |||
1290 | (use 'hg help extensions' for information on enabling extensions) |
|
1290 | (use 'hg help extensions' for information on enabling extensions) | |
1291 | [255] |
|
1291 | [255] | |
1292 |
|
1292 | |||
1293 |
|
1293 | |||
1294 | $ hg churn |
|
1294 | $ hg churn | |
1295 | hg: unknown command 'churn' |
|
1295 | hg: unknown command 'churn' | |
1296 | 'churn' is provided by the following extension: |
|
1296 | 'churn' is provided by the following extension: | |
1297 |
|
1297 | |||
1298 | churn command to display statistics about repository history |
|
1298 | churn command to display statistics about repository history | |
1299 |
|
1299 | |||
1300 | (use 'hg help extensions' for information on enabling extensions) |
|
1300 | (use 'hg help extensions' for information on enabling extensions) | |
1301 | [255] |
|
1301 | [255] | |
1302 |
|
1302 | |||
1303 |
|
1303 | |||
1304 |
|
1304 | |||
1305 | Disabled extensions: |
|
1305 | Disabled extensions: | |
1306 |
|
1306 | |||
1307 | $ hg help churn |
|
1307 | $ hg help churn | |
1308 | churn extension - command to display statistics about repository history |
|
1308 | churn extension - command to display statistics about repository history | |
1309 |
|
1309 | |||
1310 | (use 'hg help extensions' for information on enabling extensions) |
|
1310 | (use 'hg help extensions' for information on enabling extensions) | |
1311 |
|
1311 | |||
1312 | $ hg help patchbomb |
|
1312 | $ hg help patchbomb | |
1313 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
1313 | patchbomb extension - command to send changesets as (a series of) patch emails | |
1314 |
|
1314 | |||
1315 | The series is started off with a "[PATCH 0 of N]" introduction, which |
|
1315 | The series is started off with a "[PATCH 0 of N]" introduction, which | |
1316 | describes the series as a whole. |
|
1316 | describes the series as a whole. | |
1317 |
|
1317 | |||
1318 | Each patch email has a Subject line of "[PATCH M of N] ...", using the first |
|
1318 | Each patch email has a Subject line of "[PATCH M of N] ...", using the first | |
1319 | line of the changeset description as the subject text. The message contains |
|
1319 | line of the changeset description as the subject text. The message contains | |
1320 | two or three body parts: |
|
1320 | two or three body parts: | |
1321 |
|
1321 | |||
1322 | - The changeset description. |
|
1322 | - The changeset description. | |
1323 | - [Optional] The result of running diffstat on the patch. |
|
1323 | - [Optional] The result of running diffstat on the patch. | |
1324 | - The patch itself, as generated by 'hg export'. |
|
1324 | - The patch itself, as generated by 'hg export'. | |
1325 |
|
1325 | |||
1326 | Each message refers to the first in the series using the In-Reply-To and |
|
1326 | Each message refers to the first in the series using the In-Reply-To and | |
1327 | References headers, so they will show up as a sequence in threaded mail and |
|
1327 | References headers, so they will show up as a sequence in threaded mail and | |
1328 | news readers, and in mail archives. |
|
1328 | news readers, and in mail archives. | |
1329 |
|
1329 | |||
1330 | To configure other defaults, add a section like this to your configuration |
|
1330 | To configure other defaults, add a section like this to your configuration | |
1331 | file: |
|
1331 | file: | |
1332 |
|
1332 | |||
1333 | [email] |
|
1333 | [email] | |
1334 | from = My Name <my@email> |
|
1334 | from = My Name <my@email> | |
1335 | to = recipient1, recipient2, ... |
|
1335 | to = recipient1, recipient2, ... | |
1336 | cc = cc1, cc2, ... |
|
1336 | cc = cc1, cc2, ... | |
1337 | bcc = bcc1, bcc2, ... |
|
1337 | bcc = bcc1, bcc2, ... | |
1338 | reply-to = address1, address2, ... |
|
1338 | reply-to = address1, address2, ... | |
1339 |
|
1339 | |||
1340 | Use "[patchbomb]" as configuration section name if you need to override global |
|
1340 | Use "[patchbomb]" as configuration section name if you need to override global | |
1341 | "[email]" address settings. |
|
1341 | "[email]" address settings. | |
1342 |
|
1342 | |||
1343 | Then you can use the 'hg email' command to mail a series of changesets as a |
|
1343 | Then you can use the 'hg email' command to mail a series of changesets as a | |
1344 | patchbomb. |
|
1344 | patchbomb. | |
1345 |
|
1345 | |||
1346 | You can also either configure the method option in the email section to be a |
|
1346 | You can also either configure the method option in the email section to be a | |
1347 | sendmail compatible mailer or fill out the [smtp] section so that the |
|
1347 | sendmail compatible mailer or fill out the [smtp] section so that the | |
1348 | patchbomb extension can automatically send patchbombs directly from the |
|
1348 | patchbomb extension can automatically send patchbombs directly from the | |
1349 | commandline. See the [email] and [smtp] sections in hgrc(5) for details. |
|
1349 | commandline. See the [email] and [smtp] sections in hgrc(5) for details. | |
1350 |
|
1350 | |||
1351 | By default, 'hg email' will prompt for a "To" or "CC" header if you do not |
|
1351 | By default, 'hg email' will prompt for a "To" or "CC" header if you do not | |
1352 | supply one via configuration or the command line. You can override this to |
|
1352 | supply one via configuration or the command line. You can override this to | |
1353 | never prompt by configuring an empty value: |
|
1353 | never prompt by configuring an empty value: | |
1354 |
|
1354 | |||
1355 | [email] |
|
1355 | [email] | |
1356 | cc = |
|
1356 | cc = | |
1357 |
|
1357 | |||
1358 | You can control the default inclusion of an introduction message with the |
|
1358 | You can control the default inclusion of an introduction message with the | |
1359 | "patchbomb.intro" configuration option. The configuration is always |
|
1359 | "patchbomb.intro" configuration option. The configuration is always | |
1360 | overwritten by command line flags like --intro and --desc: |
|
1360 | overwritten by command line flags like --intro and --desc: | |
1361 |
|
1361 | |||
1362 | [patchbomb] |
|
1362 | [patchbomb] | |
1363 | intro=auto # include introduction message if more than 1 patch (default) |
|
1363 | intro=auto # include introduction message if more than 1 patch (default) | |
1364 | intro=never # never include an introduction message |
|
1364 | intro=never # never include an introduction message | |
1365 | intro=always # always include an introduction message |
|
1365 | intro=always # always include an introduction message | |
1366 |
|
1366 | |||
1367 | You can specify a template for flags to be added in subject prefixes. Flags |
|
1367 | You can specify a template for flags to be added in subject prefixes. Flags | |
1368 | specified by --flag option are exported as "{flags}" keyword: |
|
1368 | specified by --flag option are exported as "{flags}" keyword: | |
1369 |
|
1369 | |||
1370 | [patchbomb] |
|
1370 | [patchbomb] | |
1371 | flagtemplate = "{separate(' ', |
|
1371 | flagtemplate = "{separate(' ', | |
1372 | ifeq(branch, 'default', '', branch|upper), |
|
1372 | ifeq(branch, 'default', '', branch|upper), | |
1373 | flags)}" |
|
1373 | flags)}" | |
1374 |
|
1374 | |||
1375 | You can set patchbomb to always ask for confirmation by setting |
|
1375 | You can set patchbomb to always ask for confirmation by setting | |
1376 | "patchbomb.confirm" to true. |
|
1376 | "patchbomb.confirm" to true. | |
1377 |
|
1377 | |||
1378 | (use 'hg help extensions' for information on enabling extensions) |
|
1378 | (use 'hg help extensions' for information on enabling extensions) | |
1379 |
|
1379 | |||
1380 |
|
1380 | |||
1381 | Help can find unimported extensions |
|
1381 | Help can find unimported extensions | |
1382 | ----------------------------------- |
|
1382 | ----------------------------------- | |
1383 |
|
1383 | |||
1384 | XXX-PYOXIDIZER since the frozen binary does not have source directory tree, |
|
1384 | XXX-PYOXIDIZER since the frozen binary does not have source directory tree, | |
1385 | this make the checking for actual file under `hgext` a bit complicated. In |
|
1385 | this make the checking for actual file under `hgext` a bit complicated. In | |
1386 | addition these tests do some strange dance to ensure some other module are the |
|
1386 | addition these tests do some strange dance to ensure some other module are the | |
1387 | first in `sys.path` (since the current install path is always in front |
|
1387 | first in `sys.path` (since the current install path is always in front | |
1388 | otherwise) that are fragile and that does not match reality in the field. So |
|
1388 | otherwise) that are fragile and that does not match reality in the field. So | |
1389 | for now we disable this test untill a deeper rework of that logic is done. |
|
1389 | for now we disable this test untill a deeper rework of that logic is done. | |
1390 |
|
1390 | |||
1391 | #if no-pyoxidizer |
|
1391 | #if no-pyoxidizer | |
1392 |
|
1392 | |||
1393 | Broken disabled extension and command: |
|
1393 | Broken disabled extension and command: | |
1394 |
|
1394 | |||
1395 | $ mkdir hgext |
|
1395 | $ mkdir hgext | |
1396 | $ echo > hgext/__init__.py |
|
1396 | $ echo > hgext/__init__.py | |
1397 | $ cat > hgext/broken.py <<NO_CHECK_EOF |
|
1397 | $ cat > hgext/broken.py <<NO_CHECK_EOF | |
1398 | > "broken extension' |
|
1398 | > "broken extension' | |
1399 | > NO_CHECK_EOF |
|
1399 | > NO_CHECK_EOF | |
1400 | $ cat > path.py <<EOF |
|
1400 | $ cat > path.py <<EOF | |
1401 | > import os |
|
1401 | > import os | |
1402 | > import sys |
|
1402 | > import sys | |
1403 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
1403 | > sys.path.insert(0, os.environ['HGEXTPATH']) | |
1404 | > EOF |
|
1404 | > EOF | |
1405 | $ HGEXTPATH=`pwd` |
|
1405 | $ HGEXTPATH=`pwd` | |
1406 | $ export HGEXTPATH |
|
1406 | $ export HGEXTPATH | |
1407 |
|
1407 | |||
1408 | $ hg --config extensions.path=./path.py help broken |
|
1408 | $ hg --config extensions.path=./path.py help broken | |
1409 | broken extension - (no help text available) |
|
1409 | broken extension - (no help text available) | |
1410 |
|
1410 | |||
1411 | (use 'hg help extensions' for information on enabling extensions) |
|
1411 | (use 'hg help extensions' for information on enabling extensions) | |
1412 |
|
1412 | |||
1413 |
|
1413 | |||
1414 | $ cat > hgext/forest.py <<EOF |
|
1414 | $ cat > hgext/forest.py <<EOF | |
1415 | > cmdtable = None |
|
1415 | > cmdtable = None | |
1416 | > @command() |
|
1416 | > @command() | |
1417 | > def f(): |
|
1417 | > def f(): | |
1418 | > pass |
|
1418 | > pass | |
1419 | > @command(123) |
|
1419 | > @command(123) | |
1420 | > def g(): |
|
1420 | > def g(): | |
1421 | > pass |
|
1421 | > pass | |
1422 | > EOF |
|
1422 | > EOF | |
1423 | $ hg --config extensions.path=./path.py help foo |
|
1423 | $ hg --config extensions.path=./path.py help foo | |
1424 | abort: no such help topic: foo |
|
1424 | abort: no such help topic: foo | |
1425 | (try 'hg help --keyword foo') |
|
1425 | (try 'hg help --keyword foo') | |
1426 | [255] |
|
1426 | [255] | |
1427 |
|
1427 | |||
1428 | #endif |
|
1428 | #endif | |
1429 |
|
1429 | |||
1430 | --- |
|
1430 | --- | |
1431 |
|
1431 | |||
1432 | $ cat > throw.py <<EOF |
|
1432 | $ cat > throw.py <<EOF | |
1433 | > from mercurial import commands, registrar, util |
|
1433 | > from mercurial import commands, registrar, util | |
1434 | > cmdtable = {} |
|
1434 | > cmdtable = {} | |
1435 | > command = registrar.command(cmdtable) |
|
1435 | > command = registrar.command(cmdtable) | |
1436 | > class Bogon(Exception): pass |
|
1436 | > class Bogon(Exception): pass | |
1437 | > # NB: version should be bytes; simulating extension not ported to py3 |
|
1437 | > # NB: version should be bytes; simulating extension not ported to py3 | |
1438 | > __version__ = '1.0.0' |
|
1438 | > __version__ = '1.0.0' | |
1439 | > @command(b'throw', [], b'hg throw', norepo=True) |
|
1439 | > @command(b'throw', [], b'hg throw', norepo=True) | |
1440 | > def throw(ui, **opts): |
|
1440 | > def throw(ui, **opts): | |
1441 | > """throws an exception""" |
|
1441 | > """throws an exception""" | |
1442 | > raise Bogon() |
|
1442 | > raise Bogon() | |
1443 | > EOF |
|
1443 | > EOF | |
1444 |
|
1444 | |||
1445 | Test extension without proper byteification of key attributes doesn't crash when |
|
1445 | Test extension without proper byteification of key attributes doesn't crash when | |
1446 | accessed. |
|
1446 | accessed. | |
1447 |
|
1447 | |||
1448 | $ hg version -v --config extensions.throw=throw.py | grep '^ ' |
|
1448 | $ hg version -v --config extensions.throw=throw.py | grep '^ ' | |
1449 | throw external 1.0.0 |
|
1449 | throw external 1.0.0 | |
1450 |
|
1450 | |||
1451 | No declared supported version, extension complains: |
|
1451 | No declared supported version, extension complains: | |
1452 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1452 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1453 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1453 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 | |
1454 | ** which supports versions unknown of Mercurial. |
|
1454 | ** which supports versions unknown of Mercurial. | |
1455 | ** Please disable "throw" and try your action again. |
|
1455 | ** Please disable "throw" and try your action again. | |
1456 | ** If that fixes the bug please report it to the extension author. |
|
1456 | ** If that fixes the bug please report it to the extension author. | |
1457 | ** Python * (glob) |
|
1457 | ** Python * (glob) | |
1458 | ** Mercurial Distributed SCM * (glob) |
|
1458 | ** Mercurial Distributed SCM * (glob) | |
1459 | ** Extensions loaded: throw 1.0.0 |
|
1459 | ** Extensions loaded: throw 1.0.0 | |
1460 |
|
1460 | |||
1461 | empty declaration of supported version, extension complains (but doesn't choke if |
|
1461 | empty declaration of supported version, extension complains (but doesn't choke if | |
1462 | the value is improperly a str instead of bytes): |
|
1462 | the value is improperly a str instead of bytes): | |
1463 | $ echo "testedwith = ''" >> throw.py |
|
1463 | $ echo "testedwith = ''" >> throw.py | |
1464 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1464 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1465 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1465 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 | |
1466 | ** which supports versions unknown of Mercurial. |
|
1466 | ** which supports versions unknown of Mercurial. | |
1467 | ** Please disable "throw" and try your action again. |
|
1467 | ** Please disable "throw" and try your action again. | |
1468 | ** If that fixes the bug please report it to the extension author. |
|
1468 | ** If that fixes the bug please report it to the extension author. | |
1469 | ** Python * (glob) |
|
1469 | ** Python * (glob) | |
1470 | ** Mercurial Distributed SCM (*) (glob) |
|
1470 | ** Mercurial Distributed SCM (*) (glob) | |
1471 | ** Extensions loaded: throw 1.0.0 |
|
1471 | ** Extensions loaded: throw 1.0.0 | |
1472 |
|
1472 | |||
1473 | If the extension specifies a buglink, show that (but don't choke if the value is |
|
1473 | If the extension specifies a buglink, show that (but don't choke if the value is | |
1474 | improperly a str instead of bytes): |
|
1474 | improperly a str instead of bytes): | |
1475 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
1475 | $ echo 'buglink = "http://example.com/bts"' >> throw.py | |
1476 | $ rm -f throw.pyc throw.pyo |
|
1476 | $ rm -f throw.pyc throw.pyo | |
1477 | $ rm -Rf __pycache__ |
|
1477 | $ rm -Rf __pycache__ | |
1478 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1478 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1479 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1479 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 | |
1480 | ** which supports versions unknown of Mercurial. |
|
1480 | ** which supports versions unknown of Mercurial. | |
1481 | ** Please disable "throw" and try your action again. |
|
1481 | ** Please disable "throw" and try your action again. | |
1482 | ** If that fixes the bug please report it to http://example.com/bts |
|
1482 | ** If that fixes the bug please report it to http://example.com/bts | |
1483 | ** Python * (glob) |
|
1483 | ** Python * (glob) | |
1484 | ** Mercurial Distributed SCM (*) (glob) |
|
1484 | ** Mercurial Distributed SCM (*) (glob) | |
1485 | ** Extensions loaded: throw 1.0.0 |
|
1485 | ** Extensions loaded: throw 1.0.0 | |
1486 |
|
1486 | |||
1487 | If the extensions declare outdated versions, accuse the older extension first: |
|
1487 | If the extensions declare outdated versions, accuse the older extension first: | |
1488 | $ echo "from mercurial import util" >> older.py |
|
1488 | $ echo "from mercurial import util" >> older.py | |
1489 | $ echo "util.version = lambda:b'2.2'" >> older.py |
|
1489 | $ echo "util.version = lambda:b'2.2'" >> older.py | |
1490 | $ echo "testedwith = b'1.9.3'" >> older.py |
|
1490 | $ echo "testedwith = b'1.9.3'" >> older.py | |
1491 | $ echo "testedwith = b'2.1.1'" >> throw.py |
|
1491 | $ echo "testedwith = b'2.1.1'" >> throw.py | |
1492 | $ rm -f throw.pyc throw.pyo |
|
1492 | $ rm -f throw.pyc throw.pyo | |
1493 | $ rm -Rf __pycache__ |
|
1493 | $ rm -Rf __pycache__ | |
1494 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1494 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1495 | > throw 2>&1 | egrep '^\*\*' |
|
1495 | > throw 2>&1 | egrep '^\*\*' | |
1496 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) |
|
1496 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) | |
1497 | ** which supports versions 1.9 of Mercurial. |
|
1497 | ** which supports versions 1.9 of Mercurial. | |
1498 | ** Please disable "older" and try your action again. |
|
1498 | ** Please disable "older" and try your action again. | |
1499 | ** If that fixes the bug please report it to the extension author. |
|
1499 | ** If that fixes the bug please report it to the extension author. | |
1500 | ** Python * (glob) |
|
1500 | ** Python * (glob) | |
1501 | ** Mercurial Distributed SCM (version 2.2) |
|
1501 | ** Mercurial Distributed SCM (version 2.2) | |
1502 | ** Extensions loaded: older, throw 1.0.0 |
|
1502 | ** Extensions loaded: older, throw 1.0.0 | |
1503 |
|
1503 | |||
1504 | One extension only tested with older, one only with newer versions: |
|
1504 | One extension only tested with older, one only with newer versions: | |
1505 | $ echo "util.version = lambda:b'2.1'" >> older.py |
|
1505 | $ echo "util.version = lambda:b'2.1'" >> older.py | |
1506 | $ rm -f older.pyc older.pyo |
|
1506 | $ rm -f older.pyc older.pyo | |
1507 | $ rm -Rf __pycache__ |
|
1507 | $ rm -Rf __pycache__ | |
1508 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1508 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1509 | > throw 2>&1 | egrep '^\*\*' |
|
1509 | > throw 2>&1 | egrep '^\*\*' | |
1510 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) |
|
1510 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) | |
1511 | ** which supports versions 1.9 of Mercurial. |
|
1511 | ** which supports versions 1.9 of Mercurial. | |
1512 | ** Please disable "older" and try your action again. |
|
1512 | ** Please disable "older" and try your action again. | |
1513 | ** If that fixes the bug please report it to the extension author. |
|
1513 | ** If that fixes the bug please report it to the extension author. | |
1514 | ** Python * (glob) |
|
1514 | ** Python * (glob) | |
1515 | ** Mercurial Distributed SCM (version 2.1) |
|
1515 | ** Mercurial Distributed SCM (version 2.1) | |
1516 | ** Extensions loaded: older, throw 1.0.0 |
|
1516 | ** Extensions loaded: older, throw 1.0.0 | |
1517 |
|
1517 | |||
1518 | Older extension is tested with current version, the other only with newer: |
|
1518 | Older extension is tested with current version, the other only with newer: | |
1519 | $ echo "util.version = lambda:b'1.9.3'" >> older.py |
|
1519 | $ echo "util.version = lambda:b'1.9.3'" >> older.py | |
1520 | $ rm -f older.pyc older.pyo |
|
1520 | $ rm -f older.pyc older.pyo | |
1521 | $ rm -Rf __pycache__ |
|
1521 | $ rm -Rf __pycache__ | |
1522 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1522 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1523 | > throw 2>&1 | egrep '^\*\*' |
|
1523 | > throw 2>&1 | egrep '^\*\*' | |
1524 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1524 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 | |
1525 | ** which supports versions 2.1 of Mercurial. |
|
1525 | ** which supports versions 2.1 of Mercurial. | |
1526 | ** Please disable "throw" and try your action again. |
|
1526 | ** Please disable "throw" and try your action again. | |
1527 | ** If that fixes the bug please report it to http://example.com/bts |
|
1527 | ** If that fixes the bug please report it to http://example.com/bts | |
1528 | ** Python * (glob) |
|
1528 | ** Python * (glob) | |
1529 | ** Mercurial Distributed SCM (version 1.9.3) |
|
1529 | ** Mercurial Distributed SCM (version 1.9.3) | |
1530 | ** Extensions loaded: older, throw 1.0.0 |
|
1530 | ** Extensions loaded: older, throw 1.0.0 | |
1531 |
|
1531 | |||
1532 | Ability to point to a different point |
|
1532 | Ability to point to a different point | |
1533 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1533 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
1534 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' |
|
1534 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' | |
1535 | ** unknown exception encountered, please report by visiting |
|
1535 | ** unknown exception encountered, please report by visiting | |
1536 | ** Your Local Goat Lenders |
|
1536 | ** Your Local Goat Lenders | |
1537 | ** Python * (glob) |
|
1537 | ** Python * (glob) | |
1538 | ** Mercurial Distributed SCM (*) (glob) |
|
1538 | ** Mercurial Distributed SCM (*) (glob) | |
1539 | ** Extensions loaded: older, throw 1.0.0 |
|
1539 | ** Extensions loaded: older, throw 1.0.0 | |
1540 |
|
1540 | |||
1541 | Declare the version as supporting this hg version, show regular bts link: |
|
1541 | Declare the version as supporting this hg version, show regular bts link: | |
1542 | $ hgver=`hg debuginstall -T '{hgver}'` |
|
1542 | $ hgver=`hg debuginstall -T '{hgver}'` | |
1543 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
1543 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py | |
1544 | $ if [ -z "$hgver" ]; then |
|
1544 | $ if [ -z "$hgver" ]; then | |
1545 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; |
|
1545 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; | |
1546 | > fi |
|
1546 | > fi | |
1547 | $ rm -f throw.pyc throw.pyo |
|
1547 | $ rm -f throw.pyc throw.pyo | |
1548 | $ rm -Rf __pycache__ |
|
1548 | $ rm -Rf __pycache__ | |
1549 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1549 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1550 | ** unknown exception encountered, please report by visiting |
|
1550 | ** unknown exception encountered, please report by visiting | |
1551 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1551 | ** https://mercurial-scm.org/wiki/BugTracker | |
1552 | ** Python * (glob) |
|
1552 | ** Python * (glob) | |
1553 | ** Mercurial Distributed SCM (*) (glob) |
|
1553 | ** Mercurial Distributed SCM (*) (glob) | |
1554 | ** Extensions loaded: throw 1.0.0 |
|
1554 | ** Extensions loaded: throw 1.0.0 | |
1555 |
|
1555 | |||
1556 | Patch version is ignored during compatibility check |
|
1556 | Patch version is ignored during compatibility check | |
1557 | $ echo "testedwith = b'3.2'" >> throw.py |
|
1557 | $ echo "testedwith = b'3.2'" >> throw.py | |
1558 | $ echo "util.version = lambda:b'3.2.2'" >> throw.py |
|
1558 | $ echo "util.version = lambda:b'3.2.2'" >> throw.py | |
1559 | $ rm -f throw.pyc throw.pyo |
|
1559 | $ rm -f throw.pyc throw.pyo | |
1560 | $ rm -Rf __pycache__ |
|
1560 | $ rm -Rf __pycache__ | |
1561 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1561 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
1562 | ** unknown exception encountered, please report by visiting |
|
1562 | ** unknown exception encountered, please report by visiting | |
1563 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1563 | ** https://mercurial-scm.org/wiki/BugTracker | |
1564 | ** Python * (glob) |
|
1564 | ** Python * (glob) | |
1565 | ** Mercurial Distributed SCM (*) (glob) |
|
1565 | ** Mercurial Distributed SCM (*) (glob) | |
1566 | ** Extensions loaded: throw 1.0.0 |
|
1566 | ** Extensions loaded: throw 1.0.0 | |
1567 |
|
1567 | |||
1568 | Test version number support in 'hg version': |
|
1568 | Test version number support in 'hg version': | |
1569 | $ echo '__version__ = (1, 2, 3)' >> throw.py |
|
1569 | $ echo '__version__ = (1, 2, 3)' >> throw.py | |
1570 | $ rm -f throw.pyc throw.pyo |
|
1570 | $ rm -f throw.pyc throw.pyo | |
1571 | $ rm -Rf __pycache__ |
|
1571 | $ rm -Rf __pycache__ | |
1572 | $ hg version -v |
|
1572 | $ hg version -v | |
1573 | Mercurial Distributed SCM (version *) (glob) |
|
1573 | Mercurial Distributed SCM (version *) (glob) | |
1574 | (see https://mercurial-scm.org for more information) |
|
1574 | (see https://mercurial-scm.org for more information) | |
1575 |
|
1575 | |||
1576 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1576 | Copyright (C) 2005-* Olivia Mackall and others (glob) | |
1577 | This is free software; see the source for copying conditions. There is NO |
|
1577 | This is free software; see the source for copying conditions. There is NO | |
1578 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1578 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1579 |
|
1579 | |||
1580 | Enabled extensions: |
|
1580 | Enabled extensions: | |
1581 |
|
1581 | |||
1582 |
|
1582 | |||
1583 | $ hg version -v --config extensions.throw=throw.py |
|
1583 | $ hg version -v --config extensions.throw=throw.py | |
1584 | Mercurial Distributed SCM (version *) (glob) |
|
1584 | Mercurial Distributed SCM (version *) (glob) | |
1585 | (see https://mercurial-scm.org for more information) |
|
1585 | (see https://mercurial-scm.org for more information) | |
1586 |
|
1586 | |||
1587 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1587 | Copyright (C) 2005-* Olivia Mackall and others (glob) | |
1588 | This is free software; see the source for copying conditions. There is NO |
|
1588 | This is free software; see the source for copying conditions. There is NO | |
1589 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1589 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1590 |
|
1590 | |||
1591 | Enabled extensions: |
|
1591 | Enabled extensions: | |
1592 |
|
1592 | |||
1593 | throw external 1.2.3 |
|
1593 | throw external 1.2.3 | |
1594 | $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py |
|
1594 | $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py | |
1595 | $ rm -f throw.pyc throw.pyo |
|
1595 | $ rm -f throw.pyc throw.pyo | |
1596 | $ rm -Rf __pycache__ |
|
1596 | $ rm -Rf __pycache__ | |
1597 | $ hg version -v --config extensions.throw=throw.py --config extensions.strip= |
|
1597 | $ hg version -v --config extensions.throw=throw.py --config extensions.strip= | |
1598 | Mercurial Distributed SCM (version *) (glob) |
|
1598 | Mercurial Distributed SCM (version *) (glob) | |
1599 | (see https://mercurial-scm.org for more information) |
|
1599 | (see https://mercurial-scm.org for more information) | |
1600 |
|
1600 | |||
1601 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1601 | Copyright (C) 2005-* Olivia Mackall and others (glob) | |
1602 | This is free software; see the source for copying conditions. There is NO |
|
1602 | This is free software; see the source for copying conditions. There is NO | |
1603 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1603 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1604 |
|
1604 | |||
1605 | Enabled extensions: |
|
1605 | Enabled extensions: | |
1606 |
|
1606 | |||
1607 | strip internal |
|
1607 | strip internal | |
1608 | throw external 1.twentythree |
|
1608 | throw external 1.twentythree | |
1609 |
|
1609 | |||
1610 | $ hg version -q --config extensions.throw=throw.py |
|
1610 | $ hg version -q --config extensions.throw=throw.py | |
1611 | Mercurial Distributed SCM (version *) (glob) |
|
1611 | Mercurial Distributed SCM (version *) (glob) | |
1612 |
|
1612 | |||
1613 | Test template output: |
|
1613 | Test template output: | |
1614 |
|
1614 | |||
1615 | $ hg version --config extensions.strip= -T'{extensions}' |
|
1615 | $ hg version --config extensions.strip= -T'{extensions}' | |
1616 | strip |
|
1616 | strip | |
1617 |
|
1617 | |||
1618 | Test JSON output of version: |
|
1618 | Test JSON output of version: | |
1619 |
|
1619 | |||
1620 | $ hg version -Tjson |
|
1620 | $ hg version -Tjson | |
1621 | [ |
|
1621 | [ | |
1622 | { |
|
1622 | { | |
1623 | "extensions": [], |
|
1623 | "extensions": [], | |
1624 | "ver": "*" (glob) |
|
1624 | "ver": "*" (glob) | |
1625 | } |
|
1625 | } | |
1626 | ] |
|
1626 | ] | |
1627 |
|
1627 | |||
1628 | $ hg version --config extensions.throw=throw.py -Tjson |
|
1628 | $ hg version --config extensions.throw=throw.py -Tjson | |
1629 | [ |
|
1629 | [ | |
1630 | { |
|
1630 | { | |
1631 | "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}], |
|
1631 | "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}], | |
1632 | "ver": "3.2.2" |
|
1632 | "ver": "3.2.2" | |
1633 | } |
|
1633 | } | |
1634 | ] |
|
1634 | ] | |
1635 |
|
1635 | |||
1636 | $ hg version --config extensions.strip= -Tjson |
|
1636 | $ hg version --config extensions.strip= -Tjson | |
1637 | [ |
|
1637 | [ | |
1638 | { |
|
1638 | { | |
1639 | "extensions": [{"bundled": true, "name": "strip", "ver": null}], |
|
1639 | "extensions": [{"bundled": true, "name": "strip", "ver": null}], | |
1640 | "ver": "*" (glob) |
|
1640 | "ver": "*" (glob) | |
1641 | } |
|
1641 | } | |
1642 | ] |
|
1642 | ] | |
1643 |
|
1643 | |||
1644 | Test template output of version: |
|
1644 | Test template output of version: | |
1645 |
|
1645 | |||
1646 | $ hg version --config extensions.throw=throw.py --config extensions.strip= \ |
|
1646 | $ hg version --config extensions.throw=throw.py --config extensions.strip= \ | |
1647 | > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}' |
|
1647 | > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}' | |
1648 | strip (internal) |
|
1648 | strip (internal) | |
1649 | throw 1.twentythree (external) |
|
1649 | throw 1.twentythree (external) | |
1650 |
|
1650 | |||
1651 | Refuse to load extensions with minimum version requirements |
|
1651 | Refuse to load extensions with minimum version requirements | |
1652 |
|
1652 | |||
1653 | $ cat > minversion1.py << EOF |
|
1653 | $ cat > minversion1.py << EOF | |
1654 | > from mercurial import util |
|
1654 | > from mercurial import util | |
1655 | > util.version = lambda: b'3.5.2' |
|
1655 | > util.version = lambda: b'3.5.2' | |
1656 | > minimumhgversion = b'3.6' |
|
1656 | > minimumhgversion = b'3.6' | |
1657 | > EOF |
|
1657 | > EOF | |
1658 | $ hg --config extensions.minversion=minversion1.py version |
|
1658 | $ hg --config extensions.minversion=minversion1.py version | |
1659 | (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling) |
|
1659 | (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling) | |
1660 | Mercurial Distributed SCM (version 3.5.2) |
|
1660 | Mercurial Distributed SCM (version 3.5.2) | |
1661 | (see https://mercurial-scm.org for more information) |
|
1661 | (see https://mercurial-scm.org for more information) | |
1662 |
|
1662 | |||
1663 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1663 | Copyright (C) 2005-* Olivia Mackall and others (glob) | |
1664 | This is free software; see the source for copying conditions. There is NO |
|
1664 | This is free software; see the source for copying conditions. There is NO | |
1665 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1665 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1666 |
|
1666 | |||
1667 | $ cat > minversion2.py << EOF |
|
1667 | $ cat > minversion2.py << EOF | |
1668 | > from mercurial import util |
|
1668 | > from mercurial import util | |
1669 | > util.version = lambda: b'3.6' |
|
1669 | > util.version = lambda: b'3.6' | |
1670 | > minimumhgversion = b'3.7' |
|
1670 | > minimumhgversion = b'3.7' | |
1671 | > EOF |
|
1671 | > EOF | |
1672 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' |
|
1672 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' | |
1673 | (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling) |
|
1673 | (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling) | |
1674 |
|
1674 | |||
1675 | Can load version that is only off by point release |
|
1675 | Can load version that is only off by point release | |
1676 |
|
1676 | |||
1677 | $ cat > minversion2.py << EOF |
|
1677 | $ cat > minversion2.py << EOF | |
1678 | > from mercurial import util |
|
1678 | > from mercurial import util | |
1679 | > util.version = lambda: b'3.6.1' |
|
1679 | > util.version = lambda: b'3.6.1' | |
1680 | > minimumhgversion = b'3.6' |
|
1680 | > minimumhgversion = b'3.6' | |
1681 | > EOF |
|
1681 | > EOF | |
1682 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1682 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' | |
1683 | [1] |
|
1683 | [1] | |
1684 |
|
1684 | |||
1685 | Can load minimum version identical to current |
|
1685 | Can load minimum version identical to current | |
1686 |
|
1686 | |||
1687 | $ cat > minversion3.py << EOF |
|
1687 | $ cat > minversion3.py << EOF | |
1688 | > from mercurial import util |
|
1688 | > from mercurial import util | |
1689 | > util.version = lambda: b'3.5' |
|
1689 | > util.version = lambda: b'3.5' | |
1690 | > minimumhgversion = b'3.5' |
|
1690 | > minimumhgversion = b'3.5' | |
1691 | > EOF |
|
1691 | > EOF | |
1692 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1692 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' | |
1693 | [1] |
|
1693 | [1] | |
1694 |
|
1694 | |||
1695 | Don't explode on py3 with a bad version number (both str vs bytes, and not enough |
|
1695 | Don't explode on py3 with a bad version number (both str vs bytes, and not enough | |
1696 | parts) |
|
1696 | parts) | |
1697 |
|
1697 | |||
1698 | $ cat > minversion4.py << EOF |
|
1698 | $ cat > minversion4.py << EOF | |
1699 | > from mercurial import util |
|
1699 | > from mercurial import util | |
1700 | > util.version = lambda: b'3.5' |
|
1700 | > util.version = lambda: b'3.5' | |
1701 | > minimumhgversion = '3' |
|
1701 | > minimumhgversion = '3' | |
1702 | > EOF |
|
1702 | > EOF | |
1703 | $ hg --config extensions.minversion=minversion4.py version -v |
|
1703 | $ hg --config extensions.minversion=minversion4.py version -v | |
1704 | Mercurial Distributed SCM (version 3.5) |
|
1704 | Mercurial Distributed SCM (version 3.5) | |
1705 | (see https://mercurial-scm.org for more information) |
|
1705 | (see https://mercurial-scm.org for more information) | |
1706 |
|
1706 | |||
1707 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
1707 | Copyright (C) 2005-* Olivia Mackall and others (glob) | |
1708 | This is free software; see the source for copying conditions. There is NO |
|
1708 | This is free software; see the source for copying conditions. There is NO | |
1709 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1709 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1710 |
|
1710 | |||
1711 | Enabled extensions: |
|
1711 | Enabled extensions: | |
1712 |
|
1712 | |||
1713 | minversion external |
|
1713 | minversion external | |
1714 |
|
1714 | |||
1715 | Restore HGRCPATH |
|
1715 | Restore HGRCPATH | |
1716 |
|
1716 | |||
1717 | $ HGRCPATH=$ORGHGRCPATH |
|
1717 | $ HGRCPATH=$ORGHGRCPATH | |
1718 | $ export HGRCPATH |
|
1718 | $ export HGRCPATH | |
1719 |
|
1719 | |||
1720 | Commands handling multiple repositories at a time should invoke only |
|
1720 | Commands handling multiple repositories at a time should invoke only | |
1721 | "reposetup()" of extensions enabling in the target repository. |
|
1721 | "reposetup()" of extensions enabling in the target repository. | |
1722 |
|
1722 | |||
1723 | $ mkdir reposetup-test |
|
1723 | $ mkdir reposetup-test | |
1724 | $ cd reposetup-test |
|
1724 | $ cd reposetup-test | |
1725 |
|
1725 | |||
1726 | $ cat > $TESTTMP/reposetuptest.py <<EOF |
|
1726 | $ cat > $TESTTMP/reposetuptest.py <<EOF | |
1727 | > from mercurial import extensions |
|
1727 | > from mercurial import extensions | |
1728 | > def reposetup(ui, repo): |
|
1728 | > def reposetup(ui, repo): | |
1729 | > ui.write(b'reposetup() for %s\n' % (repo.root)) |
|
1729 | > ui.write(b'reposetup() for %s\n' % (repo.root)) | |
1730 | > ui.flush() |
|
1730 | > ui.flush() | |
1731 | > EOF |
|
1731 | > EOF | |
1732 | $ hg init src |
|
1732 | $ hg init src | |
1733 | $ echo a > src/a |
|
1733 | $ echo a > src/a | |
1734 | $ hg -R src commit -Am '#0 at src/a' |
|
1734 | $ hg -R src commit -Am '#0 at src/a' | |
1735 | adding a |
|
1735 | adding a | |
1736 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1736 | $ echo '[extensions]' >> src/.hg/hgrc | |
1737 | $ echo '# enable extension locally' >> src/.hg/hgrc |
|
1737 | $ echo '# enable extension locally' >> src/.hg/hgrc | |
1738 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc |
|
1738 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc | |
1739 | $ hg -R src status |
|
1739 | $ hg -R src status | |
1740 | reposetup() for $TESTTMP/reposetup-test/src |
|
1740 | reposetup() for $TESTTMP/reposetup-test/src | |
1741 | reposetup() for $TESTTMP/reposetup-test/src (chg !) |
|
1741 | reposetup() for $TESTTMP/reposetup-test/src (chg !) | |
1742 |
|
1742 | |||
1743 | #if no-extraextensions |
|
1743 | #if no-extraextensions | |
1744 | $ hg --cwd src debugextensions |
|
1744 | $ hg --cwd src debugextensions | |
1745 | reposetup() for $TESTTMP/reposetup-test/src |
|
1745 | reposetup() for $TESTTMP/reposetup-test/src | |
1746 | dodo (untested!) |
|
1746 | dodo (untested!) | |
1747 | dudu (untested!) |
|
1747 | dudu (untested!) | |
1748 | mq |
|
1748 | mq | |
1749 | reposetuptest (untested!) |
|
1749 | reposetuptest (untested!) | |
1750 | strip |
|
1750 | strip | |
1751 | #endif |
|
1751 | #endif | |
1752 |
|
1752 | |||
1753 | $ hg clone -U src clone-dst1 |
|
1753 | $ hg clone -U src clone-dst1 | |
1754 | reposetup() for $TESTTMP/reposetup-test/src |
|
1754 | reposetup() for $TESTTMP/reposetup-test/src | |
1755 | $ hg init push-dst1 |
|
1755 | $ hg init push-dst1 | |
1756 | $ hg -q -R src push push-dst1 |
|
1756 | $ hg -q -R src push push-dst1 | |
1757 | reposetup() for $TESTTMP/reposetup-test/src |
|
1757 | reposetup() for $TESTTMP/reposetup-test/src | |
1758 | $ hg init pull-src1 |
|
1758 | $ hg init pull-src1 | |
1759 | $ hg -q -R pull-src1 pull src |
|
1759 | $ hg -q -R pull-src1 pull src | |
1760 | reposetup() for $TESTTMP/reposetup-test/src |
|
1760 | reposetup() for $TESTTMP/reposetup-test/src | |
1761 |
|
1761 | |||
1762 | $ cat <<EOF >> $HGRCPATH |
|
1762 | $ cat <<EOF >> $HGRCPATH | |
1763 | > [extensions] |
|
1763 | > [extensions] | |
1764 | > # disable extension globally and explicitly |
|
1764 | > # disable extension globally and explicitly | |
1765 | > reposetuptest = ! |
|
1765 | > reposetuptest = ! | |
1766 | > EOF |
|
1766 | > EOF | |
1767 | $ hg clone -U src clone-dst2 |
|
1767 | $ hg clone -U src clone-dst2 | |
1768 | reposetup() for $TESTTMP/reposetup-test/src |
|
1768 | reposetup() for $TESTTMP/reposetup-test/src | |
1769 | $ hg init push-dst2 |
|
1769 | $ hg init push-dst2 | |
1770 | $ hg -q -R src push push-dst2 |
|
1770 | $ hg -q -R src push push-dst2 | |
1771 | reposetup() for $TESTTMP/reposetup-test/src |
|
1771 | reposetup() for $TESTTMP/reposetup-test/src | |
1772 | $ hg init pull-src2 |
|
1772 | $ hg init pull-src2 | |
1773 | $ hg -q -R pull-src2 pull src |
|
1773 | $ hg -q -R pull-src2 pull src | |
1774 | reposetup() for $TESTTMP/reposetup-test/src |
|
1774 | reposetup() for $TESTTMP/reposetup-test/src | |
1775 |
|
1775 | |||
1776 | $ cat <<EOF >> $HGRCPATH |
|
1776 | $ cat <<EOF >> $HGRCPATH | |
1777 | > [extensions] |
|
1777 | > [extensions] | |
1778 | > # enable extension globally |
|
1778 | > # enable extension globally | |
1779 | > reposetuptest = $TESTTMP/reposetuptest.py |
|
1779 | > reposetuptest = $TESTTMP/reposetuptest.py | |
1780 | > EOF |
|
1780 | > EOF | |
1781 | $ hg clone -U src clone-dst3 |
|
1781 | $ hg clone -U src clone-dst3 | |
1782 | reposetup() for $TESTTMP/reposetup-test/src |
|
1782 | reposetup() for $TESTTMP/reposetup-test/src | |
1783 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 |
|
1783 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 | |
1784 | $ hg init push-dst3 |
|
1784 | $ hg init push-dst3 | |
1785 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1785 | reposetup() for $TESTTMP/reposetup-test/push-dst3 | |
1786 | $ hg -q -R src push push-dst3 |
|
1786 | $ hg -q -R src push push-dst3 | |
1787 | reposetup() for $TESTTMP/reposetup-test/src |
|
1787 | reposetup() for $TESTTMP/reposetup-test/src | |
1788 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1788 | reposetup() for $TESTTMP/reposetup-test/push-dst3 | |
1789 | $ hg init pull-src3 |
|
1789 | $ hg init pull-src3 | |
1790 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1790 | reposetup() for $TESTTMP/reposetup-test/pull-src3 | |
1791 | $ hg -q -R pull-src3 pull src |
|
1791 | $ hg -q -R pull-src3 pull src | |
1792 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1792 | reposetup() for $TESTTMP/reposetup-test/pull-src3 | |
1793 | reposetup() for $TESTTMP/reposetup-test/src |
|
1793 | reposetup() for $TESTTMP/reposetup-test/src | |
1794 |
|
1794 | |||
1795 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1795 | $ echo '[extensions]' >> src/.hg/hgrc | |
1796 | $ echo '# disable extension locally' >> src/.hg/hgrc |
|
1796 | $ echo '# disable extension locally' >> src/.hg/hgrc | |
1797 | $ echo 'reposetuptest = !' >> src/.hg/hgrc |
|
1797 | $ echo 'reposetuptest = !' >> src/.hg/hgrc | |
1798 | $ hg clone -U src clone-dst4 |
|
1798 | $ hg clone -U src clone-dst4 | |
1799 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 |
|
1799 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 | |
1800 | $ hg init push-dst4 |
|
1800 | $ hg init push-dst4 | |
1801 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1801 | reposetup() for $TESTTMP/reposetup-test/push-dst4 | |
1802 | $ hg -q -R src push push-dst4 |
|
1802 | $ hg -q -R src push push-dst4 | |
1803 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1803 | reposetup() for $TESTTMP/reposetup-test/push-dst4 | |
1804 | $ hg init pull-src4 |
|
1804 | $ hg init pull-src4 | |
1805 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1805 | reposetup() for $TESTTMP/reposetup-test/pull-src4 | |
1806 | $ hg -q -R pull-src4 pull src |
|
1806 | $ hg -q -R pull-src4 pull src | |
1807 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1807 | reposetup() for $TESTTMP/reposetup-test/pull-src4 | |
1808 |
|
1808 | |||
1809 | disabling in command line overlays with all configuration |
|
1809 | disabling in command line overlays with all configuration | |
1810 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 |
|
1810 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 | |
1811 | $ hg --config extensions.reposetuptest=! init push-dst5 |
|
1811 | $ hg --config extensions.reposetuptest=! init push-dst5 | |
1812 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 |
|
1812 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 | |
1813 | $ hg --config extensions.reposetuptest=! init pull-src5 |
|
1813 | $ hg --config extensions.reposetuptest=! init pull-src5 | |
1814 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src |
|
1814 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src | |
1815 |
|
1815 | |||
1816 | $ cat <<EOF >> $HGRCPATH |
|
1816 | $ cat <<EOF >> $HGRCPATH | |
1817 | > [extensions] |
|
1817 | > [extensions] | |
1818 | > # disable extension globally and explicitly |
|
1818 | > # disable extension globally and explicitly | |
1819 | > reposetuptest = ! |
|
1819 | > reposetuptest = ! | |
1820 | > EOF |
|
1820 | > EOF | |
1821 | $ hg init parent |
|
1821 | $ hg init parent | |
1822 | $ hg init parent/sub1 |
|
1822 | $ hg init parent/sub1 | |
1823 | $ echo 1 > parent/sub1/1 |
|
1823 | $ echo 1 > parent/sub1/1 | |
1824 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' |
|
1824 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' | |
1825 | adding 1 |
|
1825 | adding 1 | |
1826 | $ hg init parent/sub2 |
|
1826 | $ hg init parent/sub2 | |
1827 | $ hg init parent/sub2/sub21 |
|
1827 | $ hg init parent/sub2/sub21 | |
1828 | $ echo 21 > parent/sub2/sub21/21 |
|
1828 | $ echo 21 > parent/sub2/sub21/21 | |
1829 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' |
|
1829 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' | |
1830 | adding 21 |
|
1830 | adding 21 | |
1831 | $ cat > parent/sub2/.hgsub <<EOF |
|
1831 | $ cat > parent/sub2/.hgsub <<EOF | |
1832 | > sub21 = sub21 |
|
1832 | > sub21 = sub21 | |
1833 | > EOF |
|
1833 | > EOF | |
1834 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' |
|
1834 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' | |
1835 | adding .hgsub |
|
1835 | adding .hgsub | |
1836 | $ hg init parent/sub3 |
|
1836 | $ hg init parent/sub3 | |
1837 | $ echo 3 > parent/sub3/3 |
|
1837 | $ echo 3 > parent/sub3/3 | |
1838 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' |
|
1838 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' | |
1839 | adding 3 |
|
1839 | adding 3 | |
1840 | $ cat > parent/.hgsub <<EOF |
|
1840 | $ cat > parent/.hgsub <<EOF | |
1841 | > sub1 = sub1 |
|
1841 | > sub1 = sub1 | |
1842 | > sub2 = sub2 |
|
1842 | > sub2 = sub2 | |
1843 | > sub3 = sub3 |
|
1843 | > sub3 = sub3 | |
1844 | > EOF |
|
1844 | > EOF | |
1845 | $ hg -R parent commit -Am '#0 at parent' |
|
1845 | $ hg -R parent commit -Am '#0 at parent' | |
1846 | adding .hgsub |
|
1846 | adding .hgsub | |
1847 | $ echo '[extensions]' >> parent/.hg/hgrc |
|
1847 | $ echo '[extensions]' >> parent/.hg/hgrc | |
1848 | $ echo '# enable extension locally' >> parent/.hg/hgrc |
|
1848 | $ echo '# enable extension locally' >> parent/.hg/hgrc | |
1849 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc |
|
1849 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc | |
1850 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc |
|
1850 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc | |
1851 | $ hg -R parent status -S -A |
|
1851 | $ hg -R parent status -S -A | |
1852 | reposetup() for $TESTTMP/reposetup-test/parent |
|
1852 | reposetup() for $TESTTMP/reposetup-test/parent | |
1853 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 |
|
1853 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 | |
1854 | C .hgsub |
|
1854 | C .hgsub | |
1855 | C .hgsubstate |
|
1855 | C .hgsubstate | |
1856 | C sub1/1 |
|
1856 | C sub1/1 | |
1857 | C sub2/.hgsub |
|
1857 | C sub2/.hgsub | |
1858 | C sub2/.hgsubstate |
|
1858 | C sub2/.hgsubstate | |
1859 | C sub2/sub21/21 |
|
1859 | C sub2/sub21/21 | |
1860 | C sub3/3 |
|
1860 | C sub3/3 | |
1861 |
|
1861 | |||
1862 | $ cd .. |
|
1862 | $ cd .. | |
1863 |
|
1863 | |||
1864 | Prohibit registration of commands that don't use @command (issue5137) |
|
1864 | Prohibit registration of commands that don't use @command (issue5137) | |
1865 |
|
1865 | |||
1866 | $ hg init deprecated |
|
1866 | $ hg init deprecated | |
1867 | $ cd deprecated |
|
1867 | $ cd deprecated | |
1868 |
|
1868 | |||
1869 | $ cat <<EOF > deprecatedcmd.py |
|
1869 | $ cat <<EOF > deprecatedcmd.py | |
1870 | > def deprecatedcmd(repo, ui): |
|
1870 | > def deprecatedcmd(repo, ui): | |
1871 | > pass |
|
1871 | > pass | |
1872 | > cmdtable = { |
|
1872 | > cmdtable = { | |
1873 | > b'deprecatedcmd': (deprecatedcmd, [], b''), |
|
1873 | > b'deprecatedcmd': (deprecatedcmd, [], b''), | |
1874 | > } |
|
1874 | > } | |
1875 | > EOF |
|
1875 | > EOF | |
1876 | $ cat <<EOF > .hg/hgrc |
|
1876 | $ cat <<EOF > .hg/hgrc | |
1877 | > [extensions] |
|
1877 | > [extensions] | |
1878 | > deprecatedcmd = `pwd`/deprecatedcmd.py |
|
1878 | > deprecatedcmd = `pwd`/deprecatedcmd.py | |
1879 | > mq = ! |
|
1879 | > mq = ! | |
1880 | > hgext.mq = ! |
|
1880 | > hgext.mq = ! | |
1881 | > hgext/mq = ! |
|
1881 | > hgext/mq = ! | |
1882 | > EOF |
|
1882 | > EOF | |
1883 |
|
1883 | |||
1884 | $ hg deprecatedcmd > /dev/null |
|
1884 | $ hg deprecatedcmd > /dev/null | |
1885 | *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1885 | *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo | |
1886 | *** (use @command decorator to register 'deprecatedcmd') |
|
1886 | *** (use @command decorator to register 'deprecatedcmd') | |
1887 | hg: unknown command 'deprecatedcmd' |
|
1887 | hg: unknown command 'deprecatedcmd' | |
1888 | (use 'hg help' for a list of commands) |
|
1888 | (use 'hg help' for a list of commands) | |
1889 | [10] |
|
1889 | [10] | |
1890 |
|
1890 | |||
1891 | the extension shouldn't be loaded at all so the mq works: |
|
1891 | the extension shouldn't be loaded at all so the mq works: | |
1892 |
|
1892 | |||
1893 | $ hg qseries --config extensions.mq= > /dev/null |
|
1893 | $ hg qseries --config extensions.mq= > /dev/null | |
1894 | *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1894 | *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo | |
1895 | *** (use @command decorator to register 'deprecatedcmd') |
|
1895 | *** (use @command decorator to register 'deprecatedcmd') | |
1896 |
|
1896 | |||
1897 | $ cd .. |
|
1897 | $ cd .. | |
1898 |
|
1898 | |||
1899 | Test synopsis and docstring extending |
|
1899 | Test synopsis and docstring extending | |
1900 |
|
1900 | |||
1901 | $ hg init exthelp |
|
1901 | $ hg init exthelp | |
1902 | $ cat > exthelp.py <<EOF |
|
1902 | $ cat > exthelp.py <<EOF | |
1903 | > from mercurial import commands, extensions |
|
1903 | > from mercurial import commands, extensions | |
1904 | > def exbookmarks(orig, *args, **opts): |
|
1904 | > def exbookmarks(orig, *args, **opts): | |
1905 | > return orig(*args, **opts) |
|
1905 | > return orig(*args, **opts) | |
1906 | > def uisetup(ui): |
|
1906 | > def uisetup(ui): | |
1907 | > synopsis = b' GREPME [--foo] [-x]' |
|
1907 | > synopsis = b' GREPME [--foo] [-x]' | |
1908 | > docstring = ''' |
|
1908 | > docstring = ''' | |
1909 | > GREPME make sure that this is in the help! |
|
1909 | > GREPME make sure that this is in the help! | |
1910 | > ''' |
|
1910 | > ''' | |
1911 | > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks, |
|
1911 | > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks, | |
1912 | > synopsis, docstring) |
|
1912 | > synopsis, docstring) | |
1913 | > EOF |
|
1913 | > EOF | |
1914 | $ abspath=`pwd`/exthelp.py |
|
1914 | $ abspath=`pwd`/exthelp.py | |
1915 | $ echo '[extensions]' >> $HGRCPATH |
|
1915 | $ echo '[extensions]' >> $HGRCPATH | |
1916 | $ echo "exthelp = $abspath" >> $HGRCPATH |
|
1916 | $ echo "exthelp = $abspath" >> $HGRCPATH | |
1917 | $ cd exthelp |
|
1917 | $ cd exthelp | |
1918 | $ hg help bookmarks | grep GREPME |
|
1918 | $ hg help bookmarks | grep GREPME | |
1919 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] |
|
1919 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] | |
1920 | GREPME make sure that this is in the help! |
|
1920 | GREPME make sure that this is in the help! | |
1921 | $ cd .. |
|
1921 | $ cd .. | |
1922 |
|
1922 | |||
1923 | Prohibit the use of unicode strings as the default value of options |
|
1923 | Prohibit the use of unicode strings as the default value of options | |
1924 |
|
1924 | |||
1925 | $ hg init $TESTTMP/opt-unicode-default |
|
1925 | $ hg init $TESTTMP/opt-unicode-default | |
1926 |
|
1926 | |||
1927 | $ cat > $TESTTMP/test_unicode_default_value.py << EOF |
|
1927 | $ cat > $TESTTMP/test_unicode_default_value.py << EOF | |
1928 | > from __future__ import print_function |
|
1928 | > from __future__ import print_function | |
1929 | > from mercurial import registrar |
|
1929 | > from mercurial import registrar | |
1930 | > cmdtable = {} |
|
1930 | > cmdtable = {} | |
1931 | > command = registrar.command(cmdtable) |
|
1931 | > command = registrar.command(cmdtable) | |
1932 | > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]') |
|
1932 | > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]') | |
1933 | > def ext(*args, **opts): |
|
1933 | > def ext(*args, **opts): | |
1934 | > print(opts[b'opt'], flush=True) |
|
1934 | > print(opts[b'opt'], flush=True) | |
1935 | > EOF |
|
1935 | > EOF | |
1936 | $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py |
|
1936 | $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py | |
1937 | $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF |
|
1937 | $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF | |
1938 | > [extensions] |
|
1938 | > [extensions] | |
1939 | > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py |
|
1939 | > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py | |
1940 | > EOF |
|
1940 | > EOF | |
1941 | $ hg -R $TESTTMP/opt-unicode-default dummy |
|
1941 | $ hg -R $TESTTMP/opt-unicode-default dummy | |
1942 | *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy |
|
1942 | *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy | |
1943 | *** (use b'' to make it byte string) |
|
1943 | *** (use b'' to make it byte string) | |
1944 | hg: unknown command 'dummy' |
|
1944 | hg: unknown command 'dummy' | |
1945 | (did you mean summary?) |
|
1945 | (did you mean summary?) | |
1946 | [10] |
|
1946 | [10] | |
1947 |
|
1947 | |||
1948 | Check the mandatory extension feature |
|
1948 | Check the mandatory extension feature | |
1949 | ------------------------------------- |
|
1949 | ------------------------------------- | |
1950 |
|
1950 | |||
1951 | $ hg init mandatory-extensions |
|
1951 | $ hg init mandatory-extensions | |
1952 | $ cat > $TESTTMP/mandatory-extensions/.hg/good.py << EOF |
|
1952 | $ cat > $TESTTMP/mandatory-extensions/.hg/good.py << EOF | |
1953 | > pass |
|
1953 | > pass | |
1954 | > EOF |
|
1954 | > EOF | |
1955 | $ cat > $TESTTMP/mandatory-extensions/.hg/bad.py << EOF |
|
1955 | $ cat > $TESTTMP/mandatory-extensions/.hg/bad.py << EOF | |
1956 | > raise RuntimeError("babar") |
|
1956 | > raise RuntimeError("babar") | |
1957 | > EOF |
|
1957 | > EOF | |
1958 | $ cat > $TESTTMP/mandatory-extensions/.hg/syntax.py << EOF |
|
1958 | $ cat > $TESTTMP/mandatory-extensions/.hg/syntax.py << EOF | |
1959 | > def ( |
|
1959 | > def ( | |
1960 | > EOF |
|
1960 | > EOF | |
1961 |
|
1961 | |||
1962 | Check that the good one load : |
|
1962 | Check that the good one load : | |
1963 |
|
1963 | |||
1964 | $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
1964 | $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
1965 | > [extensions] |
|
1965 | > [extensions] | |
1966 | > good = $TESTTMP/mandatory-extensions/.hg/good.py |
|
1966 | > good = $TESTTMP/mandatory-extensions/.hg/good.py | |
1967 | > EOF |
|
1967 | > EOF | |
1968 |
|
1968 | |||
1969 | $ hg -R mandatory-extensions id |
|
1969 | $ hg -R mandatory-extensions id | |
1970 | 000000000000 tip |
|
1970 | 000000000000 tip | |
1971 |
|
1971 | |||
1972 | Make it mandatory to load |
|
1972 | Make it mandatory to load | |
1973 |
|
1973 | |||
1974 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
1974 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
1975 | > good:required = yes |
|
1975 | > good:required = yes | |
1976 | > EOF |
|
1976 | > EOF | |
1977 |
|
1977 | |||
1978 | $ hg -R mandatory-extensions id |
|
1978 | $ hg -R mandatory-extensions id | |
1979 | 000000000000 tip |
|
1979 | 000000000000 tip | |
1980 |
|
1980 | |||
1981 | Check that the bad one does not load |
|
1981 | Check that the bad one does not load | |
1982 |
|
1982 | |||
1983 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
1983 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
1984 | > bad = $TESTTMP/mandatory-extensions/.hg/bad.py |
|
1984 | > bad = $TESTTMP/mandatory-extensions/.hg/bad.py | |
1985 | > EOF |
|
1985 | > EOF | |
1986 |
|
1986 | |||
1987 | $ hg -R mandatory-extensions id |
|
1987 | $ hg -R mandatory-extensions id | |
1988 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar |
|
1988 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |
1989 | 000000000000 tip |
|
1989 | 000000000000 tip | |
1990 |
|
1990 | |||
1991 | Make it mandatory to load |
|
1991 | Make it mandatory to load | |
1992 |
|
1992 | |||
1993 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
1993 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
1994 | > bad:required = yes |
|
1994 | > bad:required = yes | |
1995 | > EOF |
|
1995 | > EOF | |
1996 |
|
1996 | |||
1997 | $ hg -R mandatory-extensions id |
|
1997 | $ hg -R mandatory-extensions id | |
1998 | abort: failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar |
|
1998 | abort: failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |
1999 | (loading of this extension was required, see `hg help config.extensions` for details) |
|
1999 | (loading of this extension was required, see `hg help config.extensions` for details) | |
2000 | [255] |
|
2000 | [255] | |
2001 |
|
2001 | |||
2002 | Make it not mandatory to load |
|
2002 | Make it not mandatory to load | |
2003 |
|
2003 | |||
2004 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
2004 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
2005 | > bad:required = no |
|
2005 | > bad:required = no | |
2006 | > EOF |
|
2006 | > EOF | |
2007 |
|
2007 | |||
2008 | $ hg -R mandatory-extensions id |
|
2008 | $ hg -R mandatory-extensions id | |
2009 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar |
|
2009 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |
2010 | 000000000000 tip |
|
2010 | 000000000000 tip | |
2011 |
|
2011 | |||
2012 | Same check with the syntax error one |
|
2012 | Same check with the syntax error one | |
2013 |
|
2013 | |||
2014 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
2014 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
2015 | > bad = ! |
|
2015 | > bad = ! | |
2016 | > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py |
|
2016 | > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py | |
2017 | > syntax:required = yes |
|
2017 | > syntax:required = yes | |
2018 | > EOF |
|
2018 | > EOF | |
2019 |
|
2019 | |||
2020 | $ hg -R mandatory-extensions id |
|
2020 | $ hg -R mandatory-extensions id | |
2021 | abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob) |
|
2021 | abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob) | |
2022 | (loading of this extension was required, see `hg help config.extensions` for details) |
|
2022 | (loading of this extension was required, see `hg help config.extensions` for details) | |
2023 | [255] |
|
2023 | [255] | |
2024 |
|
2024 | |||
2025 | Same check with a missing one |
|
2025 | Same check with a missing one | |
2026 |
|
2026 | |||
2027 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF |
|
2027 | $ cat >> $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |
2028 | > syntax = ! |
|
2028 | > syntax = ! | |
2029 | > syntax:required = |
|
2029 | > syntax:required = | |
2030 | > missing = foo/bar/baz/I/do/not/exist/ |
|
2030 | > missing = foo/bar/baz/I/do/not/exist/ | |
2031 | > missing:required = yes |
|
2031 | > missing:required = yes | |
2032 | > EOF |
|
2032 | > EOF | |
2033 |
|
2033 | |||
2034 | $ hg -R mandatory-extensions id |
|
2034 | $ hg -R mandatory-extensions id | |
2035 | abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist' |
|
2035 | abort: failed to import extension "missing" from foo/bar/baz/I/do/not/exist/: [Errno 2] $ENOENT$: 'foo/bar/baz/I/do/not/exist' | |
2036 | (loading of this extension was required, see `hg help config.extensions` for details) |
|
2036 | (loading of this extension was required, see `hg help config.extensions` for details) | |
2037 | [255] |
|
2037 | [255] | |
|
2038 | ||||
|
2039 | Have a "default" setting for the suboption: | |||
|
2040 | ||||
|
2041 | $ cat > $TESTTMP/mandatory-extensions/.hg/hgrc << EOF | |||
|
2042 | > [extensions] | |||
|
2043 | > bad = $TESTTMP/mandatory-extensions/.hg/bad.py | |||
|
2044 | > bad:required = no | |||
|
2045 | > good = $TESTTMP/mandatory-extensions/.hg/good.py | |||
|
2046 | > syntax = $TESTTMP/mandatory-extensions/.hg/syntax.py | |||
|
2047 | > *:required = yes | |||
|
2048 | > EOF | |||
|
2049 | ||||
|
2050 | $ hg -R mandatory-extensions id | |||
|
2051 | *** failed to import extension "bad" from $TESTTMP/mandatory-extensions/.hg/bad.py: babar | |||
|
2052 | abort: failed to import extension "syntax" from $TESTTMP/mandatory-extensions/.hg/syntax.py: invalid syntax (*syntax.py, line 1) (glob) | |||
|
2053 | (loading of this extension was required, see `hg help config.extensions` for details) | |||
|
2054 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now