Show More
@@ -1,1053 +1,1055 b'' | |||||
1 | # dispatch.py - command dispatching for mercurial |
|
1 | # dispatch.py - command dispatching for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import atexit |
|
10 | import atexit | |
11 | import difflib |
|
11 | import difflib | |
12 | import errno |
|
12 | import errno | |
13 | import os |
|
13 | import os | |
14 | import pdb |
|
14 | import pdb | |
15 | import re |
|
15 | import re | |
16 | import shlex |
|
16 | import shlex | |
17 | import signal |
|
17 | import signal | |
18 | import socket |
|
18 | import socket | |
19 | import sys |
|
19 | import sys | |
20 | import time |
|
20 | import time | |
21 | import traceback |
|
21 | import traceback | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | from .i18n import _ |
|
24 | from .i18n import _ | |
25 |
|
25 | |||
26 | from . import ( |
|
26 | from . import ( | |
27 | cmdutil, |
|
27 | cmdutil, | |
28 | commands, |
|
28 | commands, | |
29 | demandimport, |
|
29 | demandimport, | |
30 | encoding, |
|
30 | encoding, | |
31 | error, |
|
31 | error, | |
32 | extensions, |
|
32 | extensions, | |
33 | fancyopts, |
|
33 | fancyopts, | |
34 | hg, |
|
34 | hg, | |
35 | hook, |
|
35 | hook, | |
36 | ui as uimod, |
|
36 | ui as uimod, | |
37 | util, |
|
37 | util, | |
38 | ) |
|
38 | ) | |
39 |
|
39 | |||
40 | class request(object): |
|
40 | class request(object): | |
41 | def __init__(self, args, ui=None, repo=None, fin=None, fout=None, |
|
41 | def __init__(self, args, ui=None, repo=None, fin=None, fout=None, | |
42 | ferr=None): |
|
42 | ferr=None): | |
43 | self.args = args |
|
43 | self.args = args | |
44 | self.ui = ui |
|
44 | self.ui = ui | |
45 | self.repo = repo |
|
45 | self.repo = repo | |
46 |
|
46 | |||
47 | # input/output/error streams |
|
47 | # input/output/error streams | |
48 | self.fin = fin |
|
48 | self.fin = fin | |
49 | self.fout = fout |
|
49 | self.fout = fout | |
50 | self.ferr = ferr |
|
50 | self.ferr = ferr | |
51 |
|
51 | |||
52 | def run(): |
|
52 | def run(): | |
53 | "run the command in sys.argv" |
|
53 | "run the command in sys.argv" | |
54 | sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) |
|
54 | sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) | |
55 |
|
55 | |||
56 | def _getsimilar(symbols, value): |
|
56 | def _getsimilar(symbols, value): | |
57 | sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() |
|
57 | sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() | |
58 | # The cutoff for similarity here is pretty arbitrary. It should |
|
58 | # The cutoff for similarity here is pretty arbitrary. It should | |
59 | # probably be investigated and tweaked. |
|
59 | # probably be investigated and tweaked. | |
60 | return [s for s in symbols if sim(s) > 0.6] |
|
60 | return [s for s in symbols if sim(s) > 0.6] | |
61 |
|
61 | |||
62 | def _formatparse(write, inst): |
|
62 | def _formatparse(write, inst): | |
63 | similar = [] |
|
63 | similar = [] | |
64 | if isinstance(inst, error.UnknownIdentifier): |
|
64 | if isinstance(inst, error.UnknownIdentifier): | |
65 | # make sure to check fileset first, as revset can invoke fileset |
|
65 | # make sure to check fileset first, as revset can invoke fileset | |
66 | similar = _getsimilar(inst.symbols, inst.function) |
|
66 | similar = _getsimilar(inst.symbols, inst.function) | |
67 | if len(inst.args) > 1: |
|
67 | if len(inst.args) > 1: | |
68 | write(_("hg: parse error at %s: %s\n") % |
|
68 | write(_("hg: parse error at %s: %s\n") % | |
69 | (inst.args[1], inst.args[0])) |
|
69 | (inst.args[1], inst.args[0])) | |
70 | if (inst.args[0][0] == ' '): |
|
70 | if (inst.args[0][0] == ' '): | |
71 | write(_("unexpected leading whitespace\n")) |
|
71 | write(_("unexpected leading whitespace\n")) | |
72 | else: |
|
72 | else: | |
73 | write(_("hg: parse error: %s\n") % inst.args[0]) |
|
73 | write(_("hg: parse error: %s\n") % inst.args[0]) | |
74 | if similar: |
|
74 | if similar: | |
75 | if len(similar) == 1: |
|
75 | if len(similar) == 1: | |
76 | write(_("(did you mean %r?)\n") % similar[0]) |
|
76 | write(_("(did you mean %r?)\n") % similar[0]) | |
77 | else: |
|
77 | else: | |
78 | ss = ", ".join(sorted(similar)) |
|
78 | ss = ", ".join(sorted(similar)) | |
79 | write(_("(did you mean one of %s?)\n") % ss) |
|
79 | write(_("(did you mean one of %s?)\n") % ss) | |
80 |
|
80 | |||
81 | def dispatch(req): |
|
81 | def dispatch(req): | |
82 | "run the command specified in req.args" |
|
82 | "run the command specified in req.args" | |
83 | if req.ferr: |
|
83 | if req.ferr: | |
84 | ferr = req.ferr |
|
84 | ferr = req.ferr | |
85 | elif req.ui: |
|
85 | elif req.ui: | |
86 | ferr = req.ui.ferr |
|
86 | ferr = req.ui.ferr | |
87 | else: |
|
87 | else: | |
88 | ferr = sys.stderr |
|
88 | ferr = sys.stderr | |
89 |
|
89 | |||
90 | try: |
|
90 | try: | |
91 | if not req.ui: |
|
91 | if not req.ui: | |
92 | req.ui = uimod.ui() |
|
92 | req.ui = uimod.ui() | |
93 | if '--traceback' in req.args: |
|
93 | if '--traceback' in req.args: | |
94 | req.ui.setconfig('ui', 'traceback', 'on', '--traceback') |
|
94 | req.ui.setconfig('ui', 'traceback', 'on', '--traceback') | |
95 |
|
95 | |||
96 | # set ui streams from the request |
|
96 | # set ui streams from the request | |
97 | if req.fin: |
|
97 | if req.fin: | |
98 | req.ui.fin = req.fin |
|
98 | req.ui.fin = req.fin | |
99 | if req.fout: |
|
99 | if req.fout: | |
100 | req.ui.fout = req.fout |
|
100 | req.ui.fout = req.fout | |
101 | if req.ferr: |
|
101 | if req.ferr: | |
102 | req.ui.ferr = req.ferr |
|
102 | req.ui.ferr = req.ferr | |
103 | except util.Abort as inst: |
|
103 | except util.Abort as inst: | |
104 | ferr.write(_("abort: %s\n") % inst) |
|
104 | ferr.write(_("abort: %s\n") % inst) | |
105 | if inst.hint: |
|
105 | if inst.hint: | |
106 | ferr.write(_("(%s)\n") % inst.hint) |
|
106 | ferr.write(_("(%s)\n") % inst.hint) | |
107 | return -1 |
|
107 | return -1 | |
108 | except error.ParseError as inst: |
|
108 | except error.ParseError as inst: | |
109 | _formatparse(ferr.write, inst) |
|
109 | _formatparse(ferr.write, inst) | |
110 | return -1 |
|
110 | return -1 | |
111 |
|
111 | |||
112 | msg = ' '.join(' ' in a and repr(a) or a for a in req.args) |
|
112 | msg = ' '.join(' ' in a and repr(a) or a for a in req.args) | |
113 | starttime = time.time() |
|
113 | starttime = time.time() | |
114 | ret = None |
|
114 | ret = None | |
115 | try: |
|
115 | try: | |
116 | ret = _runcatch(req) |
|
116 | ret = _runcatch(req) | |
117 | return ret |
|
117 | return ret | |
118 | finally: |
|
118 | finally: | |
119 | duration = time.time() - starttime |
|
119 | duration = time.time() - starttime | |
120 | req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", |
|
120 | req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", | |
121 | msg, ret or 0, duration) |
|
121 | msg, ret or 0, duration) | |
122 |
|
122 | |||
123 | def _runcatch(req): |
|
123 | def _runcatch(req): | |
124 | def catchterm(*args): |
|
124 | def catchterm(*args): | |
125 | raise error.SignalInterrupt |
|
125 | raise error.SignalInterrupt | |
126 |
|
126 | |||
127 | ui = req.ui |
|
127 | ui = req.ui | |
128 | try: |
|
128 | try: | |
129 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
|
129 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | |
130 | num = getattr(signal, name, None) |
|
130 | num = getattr(signal, name, None) | |
131 | if num: |
|
131 | if num: | |
132 | signal.signal(num, catchterm) |
|
132 | signal.signal(num, catchterm) | |
133 | except ValueError: |
|
133 | except ValueError: | |
134 | pass # happens if called in a thread |
|
134 | pass # happens if called in a thread | |
135 |
|
135 | |||
136 | try: |
|
136 | try: | |
137 | try: |
|
137 | try: | |
138 | debugger = 'pdb' |
|
138 | debugger = 'pdb' | |
139 | debugtrace = { |
|
139 | debugtrace = { | |
140 | 'pdb' : pdb.set_trace |
|
140 | 'pdb' : pdb.set_trace | |
141 | } |
|
141 | } | |
142 | debugmortem = { |
|
142 | debugmortem = { | |
143 | 'pdb' : pdb.post_mortem |
|
143 | 'pdb' : pdb.post_mortem | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 | # read --config before doing anything else |
|
146 | # read --config before doing anything else | |
147 | # (e.g. to change trust settings for reading .hg/hgrc) |
|
147 | # (e.g. to change trust settings for reading .hg/hgrc) | |
148 | cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args)) |
|
148 | cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args)) | |
149 |
|
149 | |||
150 | if req.repo: |
|
150 | if req.repo: | |
151 | # copy configs that were passed on the cmdline (--config) to |
|
151 | # copy configs that were passed on the cmdline (--config) to | |
152 | # the repo ui |
|
152 | # the repo ui | |
153 | for sec, name, val in cfgs: |
|
153 | for sec, name, val in cfgs: | |
154 | req.repo.ui.setconfig(sec, name, val, source='--config') |
|
154 | req.repo.ui.setconfig(sec, name, val, source='--config') | |
155 |
|
155 | |||
156 | # developer config: ui.debugger |
|
156 | # developer config: ui.debugger | |
157 | debugger = ui.config("ui", "debugger") |
|
157 | debugger = ui.config("ui", "debugger") | |
158 | debugmod = pdb |
|
158 | debugmod = pdb | |
159 | if not debugger or ui.plain(): |
|
159 | if not debugger or ui.plain(): | |
160 | # if we are in HGPLAIN mode, then disable custom debugging |
|
160 | # if we are in HGPLAIN mode, then disable custom debugging | |
161 | debugger = 'pdb' |
|
161 | debugger = 'pdb' | |
162 | elif '--debugger' in req.args: |
|
162 | elif '--debugger' in req.args: | |
163 | # This import can be slow for fancy debuggers, so only |
|
163 | # This import can be slow for fancy debuggers, so only | |
164 | # do it when absolutely necessary, i.e. when actual |
|
164 | # do it when absolutely necessary, i.e. when actual | |
165 | # debugging has been requested |
|
165 | # debugging has been requested | |
166 | with demandimport.deactivated(): |
|
166 | with demandimport.deactivated(): | |
167 | try: |
|
167 | try: | |
168 | debugmod = __import__(debugger) |
|
168 | debugmod = __import__(debugger) | |
169 | except ImportError: |
|
169 | except ImportError: | |
170 | pass # Leave debugmod = pdb |
|
170 | pass # Leave debugmod = pdb | |
171 |
|
171 | |||
172 | debugtrace[debugger] = debugmod.set_trace |
|
172 | debugtrace[debugger] = debugmod.set_trace | |
173 | debugmortem[debugger] = debugmod.post_mortem |
|
173 | debugmortem[debugger] = debugmod.post_mortem | |
174 |
|
174 | |||
175 | # enter the debugger before command execution |
|
175 | # enter the debugger before command execution | |
176 | if '--debugger' in req.args: |
|
176 | if '--debugger' in req.args: | |
177 | ui.warn(_("entering debugger - " |
|
177 | ui.warn(_("entering debugger - " | |
178 | "type c to continue starting hg or h for help\n")) |
|
178 | "type c to continue starting hg or h for help\n")) | |
179 |
|
179 | |||
180 | if (debugger != 'pdb' and |
|
180 | if (debugger != 'pdb' and | |
181 | debugtrace[debugger] == debugtrace['pdb']): |
|
181 | debugtrace[debugger] == debugtrace['pdb']): | |
182 | ui.warn(_("%s debugger specified " |
|
182 | ui.warn(_("%s debugger specified " | |
183 | "but its module was not found\n") % debugger) |
|
183 | "but its module was not found\n") % debugger) | |
184 | with demandimport.deactivated(): |
|
184 | with demandimport.deactivated(): | |
185 | debugtrace[debugger]() |
|
185 | debugtrace[debugger]() | |
186 | try: |
|
186 | try: | |
187 | return _dispatch(req) |
|
187 | return _dispatch(req) | |
188 | finally: |
|
188 | finally: | |
189 | ui.flush() |
|
189 | ui.flush() | |
190 | except: # re-raises |
|
190 | except: # re-raises | |
191 | # enter the debugger when we hit an exception |
|
191 | # enter the debugger when we hit an exception | |
192 | if '--debugger' in req.args: |
|
192 | if '--debugger' in req.args: | |
193 | traceback.print_exc() |
|
193 | traceback.print_exc() | |
194 | debugmortem[debugger](sys.exc_info()[2]) |
|
194 | debugmortem[debugger](sys.exc_info()[2]) | |
195 | ui.traceback() |
|
195 | ui.traceback() | |
196 | raise |
|
196 | raise | |
197 |
|
197 | |||
198 | # Global exception handling, alphabetically |
|
198 | # Global exception handling, alphabetically | |
199 | # Mercurial-specific first, followed by built-in and library exceptions |
|
199 | # Mercurial-specific first, followed by built-in and library exceptions | |
200 | except error.AmbiguousCommand as inst: |
|
200 | except error.AmbiguousCommand as inst: | |
201 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
|
201 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % | |
202 | (inst.args[0], " ".join(inst.args[1]))) |
|
202 | (inst.args[0], " ".join(inst.args[1]))) | |
203 | except error.ParseError as inst: |
|
203 | except error.ParseError as inst: | |
204 | _formatparse(ui.warn, inst) |
|
204 | _formatparse(ui.warn, inst) | |
205 | return -1 |
|
205 | return -1 | |
206 | except error.LockHeld as inst: |
|
206 | except error.LockHeld as inst: | |
207 | if inst.errno == errno.ETIMEDOUT: |
|
207 | if inst.errno == errno.ETIMEDOUT: | |
208 | reason = _('timed out waiting for lock held by %s') % inst.locker |
|
208 | reason = _('timed out waiting for lock held by %s') % inst.locker | |
209 | else: |
|
209 | else: | |
210 | reason = _('lock held by %s') % inst.locker |
|
210 | reason = _('lock held by %s') % inst.locker | |
211 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
|
211 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) | |
212 | except error.LockUnavailable as inst: |
|
212 | except error.LockUnavailable as inst: | |
213 | ui.warn(_("abort: could not lock %s: %s\n") % |
|
213 | ui.warn(_("abort: could not lock %s: %s\n") % | |
214 | (inst.desc or inst.filename, inst.strerror)) |
|
214 | (inst.desc or inst.filename, inst.strerror)) | |
215 | except error.CommandError as inst: |
|
215 | except error.CommandError as inst: | |
216 | if inst.args[0]: |
|
216 | if inst.args[0]: | |
217 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) |
|
217 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) | |
218 | commands.help_(ui, inst.args[0], full=False, command=True) |
|
218 | commands.help_(ui, inst.args[0], full=False, command=True) | |
219 | else: |
|
219 | else: | |
220 | ui.warn(_("hg: %s\n") % inst.args[1]) |
|
220 | ui.warn(_("hg: %s\n") % inst.args[1]) | |
221 | commands.help_(ui, 'shortlist') |
|
221 | commands.help_(ui, 'shortlist') | |
222 | except error.OutOfBandError as inst: |
|
222 | except error.OutOfBandError as inst: | |
223 | if inst.args: |
|
223 | if inst.args: | |
224 | msg = _("abort: remote error:\n") |
|
224 | msg = _("abort: remote error:\n") | |
225 | else: |
|
225 | else: | |
226 | msg = _("abort: remote error\n") |
|
226 | msg = _("abort: remote error\n") | |
227 | ui.warn(msg) |
|
227 | ui.warn(msg) | |
228 | if inst.args: |
|
228 | if inst.args: | |
229 | ui.warn(''.join(inst.args)) |
|
229 | ui.warn(''.join(inst.args)) | |
230 | if inst.hint: |
|
230 | if inst.hint: | |
231 | ui.warn('(%s)\n' % inst.hint) |
|
231 | ui.warn('(%s)\n' % inst.hint) | |
232 | except error.RepoError as inst: |
|
232 | except error.RepoError as inst: | |
233 | ui.warn(_("abort: %s!\n") % inst) |
|
233 | ui.warn(_("abort: %s!\n") % inst) | |
234 | if inst.hint: |
|
234 | if inst.hint: | |
235 | ui.warn(_("(%s)\n") % inst.hint) |
|
235 | ui.warn(_("(%s)\n") % inst.hint) | |
236 | except error.ResponseError as inst: |
|
236 | except error.ResponseError as inst: | |
237 | ui.warn(_("abort: %s") % inst.args[0]) |
|
237 | ui.warn(_("abort: %s") % inst.args[0]) | |
238 | if not isinstance(inst.args[1], basestring): |
|
238 | if not isinstance(inst.args[1], basestring): | |
239 | ui.warn(" %r\n" % (inst.args[1],)) |
|
239 | ui.warn(" %r\n" % (inst.args[1],)) | |
240 | elif not inst.args[1]: |
|
240 | elif not inst.args[1]: | |
241 | ui.warn(_(" empty string\n")) |
|
241 | ui.warn(_(" empty string\n")) | |
242 | else: |
|
242 | else: | |
243 | ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) |
|
243 | ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) | |
244 | except error.CensoredNodeError as inst: |
|
244 | except error.CensoredNodeError as inst: | |
245 | ui.warn(_("abort: file censored %s!\n") % inst) |
|
245 | ui.warn(_("abort: file censored %s!\n") % inst) | |
246 | except error.RevlogError as inst: |
|
246 | except error.RevlogError as inst: | |
247 | ui.warn(_("abort: %s!\n") % inst) |
|
247 | ui.warn(_("abort: %s!\n") % inst) | |
248 | except error.SignalInterrupt: |
|
248 | except error.SignalInterrupt: | |
249 | ui.warn(_("killed!\n")) |
|
249 | ui.warn(_("killed!\n")) | |
250 | except error.UnknownCommand as inst: |
|
250 | except error.UnknownCommand as inst: | |
251 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
|
251 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) | |
252 | try: |
|
252 | try: | |
253 | # check if the command is in a disabled extension |
|
253 | # check if the command is in a disabled extension | |
254 | # (but don't check for extensions themselves) |
|
254 | # (but don't check for extensions themselves) | |
255 | commands.help_(ui, inst.args[0], unknowncmd=True) |
|
255 | commands.help_(ui, inst.args[0], unknowncmd=True) | |
256 | except error.UnknownCommand: |
|
256 | except error.UnknownCommand: | |
257 | suggested = False |
|
257 | suggested = False | |
258 | if len(inst.args) == 2: |
|
258 | if len(inst.args) == 2: | |
259 | sim = _getsimilar(inst.args[1], inst.args[0]) |
|
259 | sim = _getsimilar(inst.args[1], inst.args[0]) | |
260 | if sim: |
|
260 | if sim: | |
261 | ui.warn(_('(did you mean one of %s?)\n') % |
|
261 | ui.warn(_('(did you mean one of %s?)\n') % | |
262 | ', '.join(sorted(sim))) |
|
262 | ', '.join(sorted(sim))) | |
263 | suggested = True |
|
263 | suggested = True | |
264 | if not suggested: |
|
264 | if not suggested: | |
265 | commands.help_(ui, 'shortlist') |
|
265 | commands.help_(ui, 'shortlist') | |
266 | except error.InterventionRequired as inst: |
|
266 | except error.InterventionRequired as inst: | |
267 | ui.warn("%s\n" % inst) |
|
267 | ui.warn("%s\n" % inst) | |
268 | return 1 |
|
268 | return 1 | |
269 | except util.Abort as inst: |
|
269 | except util.Abort as inst: | |
270 | ui.warn(_("abort: %s\n") % inst) |
|
270 | ui.warn(_("abort: %s\n") % inst) | |
271 | if inst.hint: |
|
271 | if inst.hint: | |
272 | ui.warn(_("(%s)\n") % inst.hint) |
|
272 | ui.warn(_("(%s)\n") % inst.hint) | |
273 | except ImportError as inst: |
|
273 | except ImportError as inst: | |
274 | ui.warn(_("abort: %s!\n") % inst) |
|
274 | ui.warn(_("abort: %s!\n") % inst) | |
275 | m = str(inst).split()[-1] |
|
275 | m = str(inst).split()[-1] | |
276 | if m in "mpatch bdiff".split(): |
|
276 | if m in "mpatch bdiff".split(): | |
277 | ui.warn(_("(did you forget to compile extensions?)\n")) |
|
277 | ui.warn(_("(did you forget to compile extensions?)\n")) | |
278 | elif m in "zlib".split(): |
|
278 | elif m in "zlib".split(): | |
279 | ui.warn(_("(is your Python install correct?)\n")) |
|
279 | ui.warn(_("(is your Python install correct?)\n")) | |
280 | except IOError as inst: |
|
280 | except IOError as inst: | |
281 | if util.safehasattr(inst, "code"): |
|
281 | if util.safehasattr(inst, "code"): | |
282 | ui.warn(_("abort: %s\n") % inst) |
|
282 | ui.warn(_("abort: %s\n") % inst) | |
283 | elif util.safehasattr(inst, "reason"): |
|
283 | elif util.safehasattr(inst, "reason"): | |
284 | try: # usually it is in the form (errno, strerror) |
|
284 | try: # usually it is in the form (errno, strerror) | |
285 | reason = inst.reason.args[1] |
|
285 | reason = inst.reason.args[1] | |
286 | except (AttributeError, IndexError): |
|
286 | except (AttributeError, IndexError): | |
287 | # it might be anything, for example a string |
|
287 | # it might be anything, for example a string | |
288 | reason = inst.reason |
|
288 | reason = inst.reason | |
289 | if isinstance(reason, unicode): |
|
289 | if isinstance(reason, unicode): | |
290 | # SSLError of Python 2.7.9 contains a unicode |
|
290 | # SSLError of Python 2.7.9 contains a unicode | |
291 | reason = reason.encode(encoding.encoding, 'replace') |
|
291 | reason = reason.encode(encoding.encoding, 'replace') | |
292 | ui.warn(_("abort: error: %s\n") % reason) |
|
292 | ui.warn(_("abort: error: %s\n") % reason) | |
293 | elif (util.safehasattr(inst, "args") |
|
293 | elif (util.safehasattr(inst, "args") | |
294 | and inst.args and inst.args[0] == errno.EPIPE): |
|
294 | and inst.args and inst.args[0] == errno.EPIPE): | |
295 | if ui.debugflag: |
|
295 | if ui.debugflag: | |
296 | ui.warn(_("broken pipe\n")) |
|
296 | ui.warn(_("broken pipe\n")) | |
297 | elif getattr(inst, "strerror", None): |
|
297 | elif getattr(inst, "strerror", None): | |
298 | if getattr(inst, "filename", None): |
|
298 | if getattr(inst, "filename", None): | |
299 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
|
299 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | |
300 | else: |
|
300 | else: | |
301 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
301 | ui.warn(_("abort: %s\n") % inst.strerror) | |
302 | else: |
|
302 | else: | |
303 | raise |
|
303 | raise | |
304 | except OSError as inst: |
|
304 | except OSError as inst: | |
305 | if getattr(inst, "filename", None) is not None: |
|
305 | if getattr(inst, "filename", None) is not None: | |
306 | ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename)) |
|
306 | ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename)) | |
307 | else: |
|
307 | else: | |
308 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
308 | ui.warn(_("abort: %s\n") % inst.strerror) | |
309 | except KeyboardInterrupt: |
|
309 | except KeyboardInterrupt: | |
310 | try: |
|
310 | try: | |
311 | ui.warn(_("interrupted!\n")) |
|
311 | ui.warn(_("interrupted!\n")) | |
312 | except IOError as inst: |
|
312 | except IOError as inst: | |
313 | if inst.errno == errno.EPIPE: |
|
313 | if inst.errno == errno.EPIPE: | |
314 | if ui.debugflag: |
|
314 | if ui.debugflag: | |
315 | ui.warn(_("\nbroken pipe\n")) |
|
315 | ui.warn(_("\nbroken pipe\n")) | |
316 | else: |
|
316 | else: | |
317 | raise |
|
317 | raise | |
318 | except MemoryError: |
|
318 | except MemoryError: | |
319 | ui.warn(_("abort: out of memory\n")) |
|
319 | ui.warn(_("abort: out of memory\n")) | |
320 | except SystemExit as inst: |
|
320 | except SystemExit as inst: | |
321 | # Commands shouldn't sys.exit directly, but give a return code. |
|
321 | # Commands shouldn't sys.exit directly, but give a return code. | |
322 | # Just in case catch this and and pass exit code to caller. |
|
322 | # Just in case catch this and and pass exit code to caller. | |
323 | return inst.code |
|
323 | return inst.code | |
324 | except socket.error as inst: |
|
324 | except socket.error as inst: | |
325 | ui.warn(_("abort: %s\n") % inst.args[-1]) |
|
325 | ui.warn(_("abort: %s\n") % inst.args[-1]) | |
326 | except: # re-raises |
|
326 | except: # re-raises | |
327 | myver = util.version() |
|
327 | myver = util.version() | |
328 | # For compatibility checking, we discard the portion of the hg |
|
328 | # For compatibility checking, we discard the portion of the hg | |
329 | # version after the + on the assumption that if a "normal |
|
329 | # version after the + on the assumption that if a "normal | |
330 | # user" is running a build with a + in it the packager |
|
330 | # user" is running a build with a + in it the packager | |
331 | # probably built from fairly close to a tag and anyone with a |
|
331 | # probably built from fairly close to a tag and anyone with a | |
332 | # 'make local' copy of hg (where the version number can be out |
|
332 | # 'make local' copy of hg (where the version number can be out | |
333 | # of date) will be clueful enough to notice the implausible |
|
333 | # of date) will be clueful enough to notice the implausible | |
334 | # version number and try updating. |
|
334 | # version number and try updating. | |
335 | compare = myver.split('+')[0] |
|
335 | compare = myver.split('+')[0] | |
336 | ct = tuplever(compare) |
|
336 | ct = tuplever(compare) | |
337 | worst = None, ct, '' |
|
337 | worst = None, ct, '' | |
338 | if True: |
|
338 | if ui.config('ui', 'supportcontact', None) is None: | |
339 | for name, mod in extensions.extensions(): |
|
339 | for name, mod in extensions.extensions(): | |
340 | testedwith = getattr(mod, 'testedwith', '') |
|
340 | testedwith = getattr(mod, 'testedwith', '') | |
341 | report = getattr(mod, 'buglink', _('the extension author.')) |
|
341 | report = getattr(mod, 'buglink', _('the extension author.')) | |
342 | if not testedwith.strip(): |
|
342 | if not testedwith.strip(): | |
343 | # We found an untested extension. It's likely the culprit. |
|
343 | # We found an untested extension. It's likely the culprit. | |
344 | worst = name, 'unknown', report |
|
344 | worst = name, 'unknown', report | |
345 | break |
|
345 | break | |
346 |
|
346 | |||
347 | # Never blame on extensions bundled with Mercurial. |
|
347 | # Never blame on extensions bundled with Mercurial. | |
348 | if testedwith == 'internal': |
|
348 | if testedwith == 'internal': | |
349 | continue |
|
349 | continue | |
350 |
|
350 | |||
351 | tested = [tuplever(t) for t in testedwith.split()] |
|
351 | tested = [tuplever(t) for t in testedwith.split()] | |
352 | if ct in tested: |
|
352 | if ct in tested: | |
353 | continue |
|
353 | continue | |
354 |
|
354 | |||
355 | lower = [t for t in tested if t < ct] |
|
355 | lower = [t for t in tested if t < ct] | |
356 | nearest = max(lower or tested) |
|
356 | nearest = max(lower or tested) | |
357 | if worst[0] is None or nearest < worst[1]: |
|
357 | if worst[0] is None or nearest < worst[1]: | |
358 | worst = name, nearest, report |
|
358 | worst = name, nearest, report | |
359 | if worst[0] is not None: |
|
359 | if worst[0] is not None: | |
360 | name, testedwith, report = worst |
|
360 | name, testedwith, report = worst | |
361 | if not isinstance(testedwith, str): |
|
361 | if not isinstance(testedwith, str): | |
362 | testedwith = '.'.join([str(c) for c in testedwith]) |
|
362 | testedwith = '.'.join([str(c) for c in testedwith]) | |
363 | warning = (_('** Unknown exception encountered with ' |
|
363 | warning = (_('** Unknown exception encountered with ' | |
364 | 'possibly-broken third-party extension %s\n' |
|
364 | 'possibly-broken third-party extension %s\n' | |
365 | '** which supports versions %s of Mercurial.\n' |
|
365 | '** which supports versions %s of Mercurial.\n' | |
366 | '** Please disable %s and try your action again.\n' |
|
366 | '** Please disable %s and try your action again.\n' | |
367 | '** If that fixes the bug please report it to %s\n') |
|
367 | '** If that fixes the bug please report it to %s\n') | |
368 | % (name, testedwith, name, report)) |
|
368 | % (name, testedwith, name, report)) | |
369 | else: |
|
369 | else: | |
|
370 | bugtracker = ui.config('ui', 'supportcontact', None) | |||
|
371 | if bugtracker is None: | |||
|
372 | bugtracker = _("http://mercurial.selenic.com/wiki/BugTracker") | |||
370 | warning = (_("** unknown exception encountered, " |
|
373 | warning = (_("** unknown exception encountered, " | |
371 | "please report by visiting\n") + |
|
374 | "please report by visiting\n** ") + bugtracker + '\n') | |
372 | _("** http://mercurial.selenic.com/wiki/BugTracker\n")) |
|
|||
373 | warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) + |
|
375 | warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) + | |
374 | (_("** Mercurial Distributed SCM (version %s)\n") % myver) + |
|
376 | (_("** Mercurial Distributed SCM (version %s)\n") % myver) + | |
375 | (_("** Extensions loaded: %s\n") % |
|
377 | (_("** Extensions loaded: %s\n") % | |
376 | ", ".join([x[0] for x in extensions.extensions()]))) |
|
378 | ", ".join([x[0] for x in extensions.extensions()]))) | |
377 | ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc()) |
|
379 | ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc()) | |
378 | ui.warn(warning) |
|
380 | ui.warn(warning) | |
379 | raise |
|
381 | raise | |
380 |
|
382 | |||
381 | return -1 |
|
383 | return -1 | |
382 |
|
384 | |||
383 | def tuplever(v): |
|
385 | def tuplever(v): | |
384 | try: |
|
386 | try: | |
385 | # Assertion: tuplever is only used for extension compatibility |
|
387 | # Assertion: tuplever is only used for extension compatibility | |
386 | # checking. Otherwise, the discarding of extra version fields is |
|
388 | # checking. Otherwise, the discarding of extra version fields is | |
387 | # incorrect. |
|
389 | # incorrect. | |
388 | return tuple([int(i) for i in v.split('.')[0:2]]) |
|
390 | return tuple([int(i) for i in v.split('.')[0:2]]) | |
389 | except ValueError: |
|
391 | except ValueError: | |
390 | return tuple() |
|
392 | return tuple() | |
391 |
|
393 | |||
392 | def aliasargs(fn, givenargs): |
|
394 | def aliasargs(fn, givenargs): | |
393 | args = getattr(fn, 'args', []) |
|
395 | args = getattr(fn, 'args', []) | |
394 | if args: |
|
396 | if args: | |
395 | cmd = ' '.join(map(util.shellquote, args)) |
|
397 | cmd = ' '.join(map(util.shellquote, args)) | |
396 |
|
398 | |||
397 | nums = [] |
|
399 | nums = [] | |
398 | def replacer(m): |
|
400 | def replacer(m): | |
399 | num = int(m.group(1)) - 1 |
|
401 | num = int(m.group(1)) - 1 | |
400 | nums.append(num) |
|
402 | nums.append(num) | |
401 | if num < len(givenargs): |
|
403 | if num < len(givenargs): | |
402 | return givenargs[num] |
|
404 | return givenargs[num] | |
403 | raise util.Abort(_('too few arguments for command alias')) |
|
405 | raise util.Abort(_('too few arguments for command alias')) | |
404 | cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) |
|
406 | cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) | |
405 | givenargs = [x for i, x in enumerate(givenargs) |
|
407 | givenargs = [x for i, x in enumerate(givenargs) | |
406 | if i not in nums] |
|
408 | if i not in nums] | |
407 | args = shlex.split(cmd) |
|
409 | args = shlex.split(cmd) | |
408 | return args + givenargs |
|
410 | return args + givenargs | |
409 |
|
411 | |||
410 | def aliasinterpolate(name, args, cmd): |
|
412 | def aliasinterpolate(name, args, cmd): | |
411 | '''interpolate args into cmd for shell aliases |
|
413 | '''interpolate args into cmd for shell aliases | |
412 |
|
414 | |||
413 | This also handles $0, $@ and "$@". |
|
415 | This also handles $0, $@ and "$@". | |
414 | ''' |
|
416 | ''' | |
415 | # util.interpolate can't deal with "$@" (with quotes) because it's only |
|
417 | # util.interpolate can't deal with "$@" (with quotes) because it's only | |
416 | # built to match prefix + patterns. |
|
418 | # built to match prefix + patterns. | |
417 | replacemap = dict(('$%d' % (i + 1), arg) for i, arg in enumerate(args)) |
|
419 | replacemap = dict(('$%d' % (i + 1), arg) for i, arg in enumerate(args)) | |
418 | replacemap['$0'] = name |
|
420 | replacemap['$0'] = name | |
419 | replacemap['$$'] = '$' |
|
421 | replacemap['$$'] = '$' | |
420 | replacemap['$@'] = ' '.join(args) |
|
422 | replacemap['$@'] = ' '.join(args) | |
421 | # Typical Unix shells interpolate "$@" (with quotes) as all the positional |
|
423 | # Typical Unix shells interpolate "$@" (with quotes) as all the positional | |
422 | # parameters, separated out into words. Emulate the same behavior here by |
|
424 | # parameters, separated out into words. Emulate the same behavior here by | |
423 | # quoting the arguments individually. POSIX shells will then typically |
|
425 | # quoting the arguments individually. POSIX shells will then typically | |
424 | # tokenize each argument into exactly one word. |
|
426 | # tokenize each argument into exactly one word. | |
425 | replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args) |
|
427 | replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args) | |
426 | # escape '\$' for regex |
|
428 | # escape '\$' for regex | |
427 | regex = '|'.join(replacemap.keys()).replace('$', r'\$') |
|
429 | regex = '|'.join(replacemap.keys()).replace('$', r'\$') | |
428 | r = re.compile(regex) |
|
430 | r = re.compile(regex) | |
429 | return r.sub(lambda x: replacemap[x.group()], cmd) |
|
431 | return r.sub(lambda x: replacemap[x.group()], cmd) | |
430 |
|
432 | |||
431 | class cmdalias(object): |
|
433 | class cmdalias(object): | |
432 | def __init__(self, name, definition, cmdtable): |
|
434 | def __init__(self, name, definition, cmdtable): | |
433 | self.name = self.cmd = name |
|
435 | self.name = self.cmd = name | |
434 | self.cmdname = '' |
|
436 | self.cmdname = '' | |
435 | self.definition = definition |
|
437 | self.definition = definition | |
436 | self.fn = None |
|
438 | self.fn = None | |
437 | self.args = [] |
|
439 | self.args = [] | |
438 | self.opts = [] |
|
440 | self.opts = [] | |
439 | self.help = '' |
|
441 | self.help = '' | |
440 | self.norepo = True |
|
442 | self.norepo = True | |
441 | self.optionalrepo = False |
|
443 | self.optionalrepo = False | |
442 | self.badalias = None |
|
444 | self.badalias = None | |
443 | self.unknowncmd = False |
|
445 | self.unknowncmd = False | |
444 |
|
446 | |||
445 | try: |
|
447 | try: | |
446 | aliases, entry = cmdutil.findcmd(self.name, cmdtable) |
|
448 | aliases, entry = cmdutil.findcmd(self.name, cmdtable) | |
447 | for alias, e in cmdtable.iteritems(): |
|
449 | for alias, e in cmdtable.iteritems(): | |
448 | if e is entry: |
|
450 | if e is entry: | |
449 | self.cmd = alias |
|
451 | self.cmd = alias | |
450 | break |
|
452 | break | |
451 | self.shadows = True |
|
453 | self.shadows = True | |
452 | except error.UnknownCommand: |
|
454 | except error.UnknownCommand: | |
453 | self.shadows = False |
|
455 | self.shadows = False | |
454 |
|
456 | |||
455 | if not self.definition: |
|
457 | if not self.definition: | |
456 | self.badalias = _("no definition for alias '%s'") % self.name |
|
458 | self.badalias = _("no definition for alias '%s'") % self.name | |
457 | return |
|
459 | return | |
458 |
|
460 | |||
459 | if self.definition.startswith('!'): |
|
461 | if self.definition.startswith('!'): | |
460 | self.shell = True |
|
462 | self.shell = True | |
461 | def fn(ui, *args): |
|
463 | def fn(ui, *args): | |
462 | env = {'HG_ARGS': ' '.join((self.name,) + args)} |
|
464 | env = {'HG_ARGS': ' '.join((self.name,) + args)} | |
463 | def _checkvar(m): |
|
465 | def _checkvar(m): | |
464 | if m.groups()[0] == '$': |
|
466 | if m.groups()[0] == '$': | |
465 | return m.group() |
|
467 | return m.group() | |
466 | elif int(m.groups()[0]) <= len(args): |
|
468 | elif int(m.groups()[0]) <= len(args): | |
467 | return m.group() |
|
469 | return m.group() | |
468 | else: |
|
470 | else: | |
469 | ui.debug("No argument found for substitution " |
|
471 | ui.debug("No argument found for substitution " | |
470 | "of %i variable in alias '%s' definition." |
|
472 | "of %i variable in alias '%s' definition." | |
471 | % (int(m.groups()[0]), self.name)) |
|
473 | % (int(m.groups()[0]), self.name)) | |
472 | return '' |
|
474 | return '' | |
473 | cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:]) |
|
475 | cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:]) | |
474 | cmd = aliasinterpolate(self.name, args, cmd) |
|
476 | cmd = aliasinterpolate(self.name, args, cmd) | |
475 | return ui.system(cmd, environ=env) |
|
477 | return ui.system(cmd, environ=env) | |
476 | self.fn = fn |
|
478 | self.fn = fn | |
477 | return |
|
479 | return | |
478 |
|
480 | |||
479 | try: |
|
481 | try: | |
480 | args = shlex.split(self.definition) |
|
482 | args = shlex.split(self.definition) | |
481 | except ValueError as inst: |
|
483 | except ValueError as inst: | |
482 | self.badalias = (_("error in definition for alias '%s': %s") |
|
484 | self.badalias = (_("error in definition for alias '%s': %s") | |
483 | % (self.name, inst)) |
|
485 | % (self.name, inst)) | |
484 | return |
|
486 | return | |
485 | self.cmdname = cmd = args.pop(0) |
|
487 | self.cmdname = cmd = args.pop(0) | |
486 | args = map(util.expandpath, args) |
|
488 | args = map(util.expandpath, args) | |
487 |
|
489 | |||
488 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): |
|
490 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): | |
489 | if _earlygetopt([invalidarg], args): |
|
491 | if _earlygetopt([invalidarg], args): | |
490 | self.badalias = (_("error in definition for alias '%s': %s may " |
|
492 | self.badalias = (_("error in definition for alias '%s': %s may " | |
491 | "only be given on the command line") |
|
493 | "only be given on the command line") | |
492 | % (self.name, invalidarg)) |
|
494 | % (self.name, invalidarg)) | |
493 | return |
|
495 | return | |
494 |
|
496 | |||
495 | try: |
|
497 | try: | |
496 | tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1] |
|
498 | tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1] | |
497 | if len(tableentry) > 2: |
|
499 | if len(tableentry) > 2: | |
498 | self.fn, self.opts, self.help = tableentry |
|
500 | self.fn, self.opts, self.help = tableentry | |
499 | else: |
|
501 | else: | |
500 | self.fn, self.opts = tableentry |
|
502 | self.fn, self.opts = tableentry | |
501 |
|
503 | |||
502 | self.args = aliasargs(self.fn, args) |
|
504 | self.args = aliasargs(self.fn, args) | |
503 | if cmd not in commands.norepo.split(' '): |
|
505 | if cmd not in commands.norepo.split(' '): | |
504 | self.norepo = False |
|
506 | self.norepo = False | |
505 | if cmd in commands.optionalrepo.split(' '): |
|
507 | if cmd in commands.optionalrepo.split(' '): | |
506 | self.optionalrepo = True |
|
508 | self.optionalrepo = True | |
507 | if self.help.startswith("hg " + cmd): |
|
509 | if self.help.startswith("hg " + cmd): | |
508 | # drop prefix in old-style help lines so hg shows the alias |
|
510 | # drop prefix in old-style help lines so hg shows the alias | |
509 | self.help = self.help[4 + len(cmd):] |
|
511 | self.help = self.help[4 + len(cmd):] | |
510 | self.__doc__ = self.fn.__doc__ |
|
512 | self.__doc__ = self.fn.__doc__ | |
511 |
|
513 | |||
512 | except error.UnknownCommand: |
|
514 | except error.UnknownCommand: | |
513 | self.badalias = (_("alias '%s' resolves to unknown command '%s'") |
|
515 | self.badalias = (_("alias '%s' resolves to unknown command '%s'") | |
514 | % (self.name, cmd)) |
|
516 | % (self.name, cmd)) | |
515 | self.unknowncmd = True |
|
517 | self.unknowncmd = True | |
516 | except error.AmbiguousCommand: |
|
518 | except error.AmbiguousCommand: | |
517 | self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") |
|
519 | self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") | |
518 | % (self.name, cmd)) |
|
520 | % (self.name, cmd)) | |
519 |
|
521 | |||
520 | def __call__(self, ui, *args, **opts): |
|
522 | def __call__(self, ui, *args, **opts): | |
521 | if self.badalias: |
|
523 | if self.badalias: | |
522 | hint = None |
|
524 | hint = None | |
523 | if self.unknowncmd: |
|
525 | if self.unknowncmd: | |
524 | try: |
|
526 | try: | |
525 | # check if the command is in a disabled extension |
|
527 | # check if the command is in a disabled extension | |
526 | cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2] |
|
528 | cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2] | |
527 | hint = _("'%s' is provided by '%s' extension") % (cmd, ext) |
|
529 | hint = _("'%s' is provided by '%s' extension") % (cmd, ext) | |
528 | except error.UnknownCommand: |
|
530 | except error.UnknownCommand: | |
529 | pass |
|
531 | pass | |
530 | raise util.Abort(self.badalias, hint=hint) |
|
532 | raise util.Abort(self.badalias, hint=hint) | |
531 | if self.shadows: |
|
533 | if self.shadows: | |
532 | ui.debug("alias '%s' shadows command '%s'\n" % |
|
534 | ui.debug("alias '%s' shadows command '%s'\n" % | |
533 | (self.name, self.cmdname)) |
|
535 | (self.name, self.cmdname)) | |
534 |
|
536 | |||
535 | if util.safehasattr(self, 'shell'): |
|
537 | if util.safehasattr(self, 'shell'): | |
536 | return self.fn(ui, *args, **opts) |
|
538 | return self.fn(ui, *args, **opts) | |
537 | else: |
|
539 | else: | |
538 | try: |
|
540 | try: | |
539 | return util.checksignature(self.fn)(ui, *args, **opts) |
|
541 | return util.checksignature(self.fn)(ui, *args, **opts) | |
540 | except error.SignatureError: |
|
542 | except error.SignatureError: | |
541 | args = ' '.join([self.cmdname] + self.args) |
|
543 | args = ' '.join([self.cmdname] + self.args) | |
542 | ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) |
|
544 | ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) | |
543 | raise |
|
545 | raise | |
544 |
|
546 | |||
545 | def addaliases(ui, cmdtable): |
|
547 | def addaliases(ui, cmdtable): | |
546 | # aliases are processed after extensions have been loaded, so they |
|
548 | # aliases are processed after extensions have been loaded, so they | |
547 | # may use extension commands. Aliases can also use other alias definitions, |
|
549 | # may use extension commands. Aliases can also use other alias definitions, | |
548 | # but only if they have been defined prior to the current definition. |
|
550 | # but only if they have been defined prior to the current definition. | |
549 | for alias, definition in ui.configitems('alias'): |
|
551 | for alias, definition in ui.configitems('alias'): | |
550 | aliasdef = cmdalias(alias, definition, cmdtable) |
|
552 | aliasdef = cmdalias(alias, definition, cmdtable) | |
551 |
|
553 | |||
552 | try: |
|
554 | try: | |
553 | olddef = cmdtable[aliasdef.cmd][0] |
|
555 | olddef = cmdtable[aliasdef.cmd][0] | |
554 | if olddef.definition == aliasdef.definition: |
|
556 | if olddef.definition == aliasdef.definition: | |
555 | continue |
|
557 | continue | |
556 | except (KeyError, AttributeError): |
|
558 | except (KeyError, AttributeError): | |
557 | # definition might not exist or it might not be a cmdalias |
|
559 | # definition might not exist or it might not be a cmdalias | |
558 | pass |
|
560 | pass | |
559 |
|
561 | |||
560 | cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help) |
|
562 | cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help) | |
561 | if aliasdef.norepo: |
|
563 | if aliasdef.norepo: | |
562 | commands.norepo += ' %s' % alias |
|
564 | commands.norepo += ' %s' % alias | |
563 | if aliasdef.optionalrepo: |
|
565 | if aliasdef.optionalrepo: | |
564 | commands.optionalrepo += ' %s' % alias |
|
566 | commands.optionalrepo += ' %s' % alias | |
565 |
|
567 | |||
566 | def _parse(ui, args): |
|
568 | def _parse(ui, args): | |
567 | options = {} |
|
569 | options = {} | |
568 | cmdoptions = {} |
|
570 | cmdoptions = {} | |
569 |
|
571 | |||
570 | try: |
|
572 | try: | |
571 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
573 | args = fancyopts.fancyopts(args, commands.globalopts, options) | |
572 | except fancyopts.getopt.GetoptError as inst: |
|
574 | except fancyopts.getopt.GetoptError as inst: | |
573 | raise error.CommandError(None, inst) |
|
575 | raise error.CommandError(None, inst) | |
574 |
|
576 | |||
575 | if args: |
|
577 | if args: | |
576 | cmd, args = args[0], args[1:] |
|
578 | cmd, args = args[0], args[1:] | |
577 | aliases, entry = cmdutil.findcmd(cmd, commands.table, |
|
579 | aliases, entry = cmdutil.findcmd(cmd, commands.table, | |
578 | ui.configbool("ui", "strict")) |
|
580 | ui.configbool("ui", "strict")) | |
579 | cmd = aliases[0] |
|
581 | cmd = aliases[0] | |
580 | args = aliasargs(entry[0], args) |
|
582 | args = aliasargs(entry[0], args) | |
581 | defaults = ui.config("defaults", cmd) |
|
583 | defaults = ui.config("defaults", cmd) | |
582 | if defaults: |
|
584 | if defaults: | |
583 | args = map(util.expandpath, shlex.split(defaults)) + args |
|
585 | args = map(util.expandpath, shlex.split(defaults)) + args | |
584 | c = list(entry[1]) |
|
586 | c = list(entry[1]) | |
585 | else: |
|
587 | else: | |
586 | cmd = None |
|
588 | cmd = None | |
587 | c = [] |
|
589 | c = [] | |
588 |
|
590 | |||
589 | # combine global options into local |
|
591 | # combine global options into local | |
590 | for o in commands.globalopts: |
|
592 | for o in commands.globalopts: | |
591 | c.append((o[0], o[1], options[o[1]], o[3])) |
|
593 | c.append((o[0], o[1], options[o[1]], o[3])) | |
592 |
|
594 | |||
593 | try: |
|
595 | try: | |
594 | args = fancyopts.fancyopts(args, c, cmdoptions, True) |
|
596 | args = fancyopts.fancyopts(args, c, cmdoptions, True) | |
595 | except fancyopts.getopt.GetoptError as inst: |
|
597 | except fancyopts.getopt.GetoptError as inst: | |
596 | raise error.CommandError(cmd, inst) |
|
598 | raise error.CommandError(cmd, inst) | |
597 |
|
599 | |||
598 | # separate global options back out |
|
600 | # separate global options back out | |
599 | for o in commands.globalopts: |
|
601 | for o in commands.globalopts: | |
600 | n = o[1] |
|
602 | n = o[1] | |
601 | options[n] = cmdoptions[n] |
|
603 | options[n] = cmdoptions[n] | |
602 | del cmdoptions[n] |
|
604 | del cmdoptions[n] | |
603 |
|
605 | |||
604 | return (cmd, cmd and entry[0] or None, args, options, cmdoptions) |
|
606 | return (cmd, cmd and entry[0] or None, args, options, cmdoptions) | |
605 |
|
607 | |||
606 | def _parseconfig(ui, config): |
|
608 | def _parseconfig(ui, config): | |
607 | """parse the --config options from the command line""" |
|
609 | """parse the --config options from the command line""" | |
608 | configs = [] |
|
610 | configs = [] | |
609 |
|
611 | |||
610 | for cfg in config: |
|
612 | for cfg in config: | |
611 | try: |
|
613 | try: | |
612 | name, value = cfg.split('=', 1) |
|
614 | name, value = cfg.split('=', 1) | |
613 | section, name = name.split('.', 1) |
|
615 | section, name = name.split('.', 1) | |
614 | if not section or not name: |
|
616 | if not section or not name: | |
615 | raise IndexError |
|
617 | raise IndexError | |
616 | ui.setconfig(section, name, value, '--config') |
|
618 | ui.setconfig(section, name, value, '--config') | |
617 | configs.append((section, name, value)) |
|
619 | configs.append((section, name, value)) | |
618 | except (IndexError, ValueError): |
|
620 | except (IndexError, ValueError): | |
619 | raise util.Abort(_('malformed --config option: %r ' |
|
621 | raise util.Abort(_('malformed --config option: %r ' | |
620 | '(use --config section.name=value)') % cfg) |
|
622 | '(use --config section.name=value)') % cfg) | |
621 |
|
623 | |||
622 | return configs |
|
624 | return configs | |
623 |
|
625 | |||
624 | def _earlygetopt(aliases, args): |
|
626 | def _earlygetopt(aliases, args): | |
625 | """Return list of values for an option (or aliases). |
|
627 | """Return list of values for an option (or aliases). | |
626 |
|
628 | |||
627 | The values are listed in the order they appear in args. |
|
629 | The values are listed in the order they appear in args. | |
628 | The options and values are removed from args. |
|
630 | The options and values are removed from args. | |
629 |
|
631 | |||
630 | >>> args = ['x', '--cwd', 'foo', 'y'] |
|
632 | >>> args = ['x', '--cwd', 'foo', 'y'] | |
631 | >>> _earlygetopt(['--cwd'], args), args |
|
633 | >>> _earlygetopt(['--cwd'], args), args | |
632 | (['foo'], ['x', 'y']) |
|
634 | (['foo'], ['x', 'y']) | |
633 |
|
635 | |||
634 | >>> args = ['x', '--cwd=bar', 'y'] |
|
636 | >>> args = ['x', '--cwd=bar', 'y'] | |
635 | >>> _earlygetopt(['--cwd'], args), args |
|
637 | >>> _earlygetopt(['--cwd'], args), args | |
636 | (['bar'], ['x', 'y']) |
|
638 | (['bar'], ['x', 'y']) | |
637 |
|
639 | |||
638 | >>> args = ['x', '-R', 'foo', 'y'] |
|
640 | >>> args = ['x', '-R', 'foo', 'y'] | |
639 | >>> _earlygetopt(['-R'], args), args |
|
641 | >>> _earlygetopt(['-R'], args), args | |
640 | (['foo'], ['x', 'y']) |
|
642 | (['foo'], ['x', 'y']) | |
641 |
|
643 | |||
642 | >>> args = ['x', '-Rbar', 'y'] |
|
644 | >>> args = ['x', '-Rbar', 'y'] | |
643 | >>> _earlygetopt(['-R'], args), args |
|
645 | >>> _earlygetopt(['-R'], args), args | |
644 | (['bar'], ['x', 'y']) |
|
646 | (['bar'], ['x', 'y']) | |
645 | """ |
|
647 | """ | |
646 | try: |
|
648 | try: | |
647 | argcount = args.index("--") |
|
649 | argcount = args.index("--") | |
648 | except ValueError: |
|
650 | except ValueError: | |
649 | argcount = len(args) |
|
651 | argcount = len(args) | |
650 | shortopts = [opt for opt in aliases if len(opt) == 2] |
|
652 | shortopts = [opt for opt in aliases if len(opt) == 2] | |
651 | values = [] |
|
653 | values = [] | |
652 | pos = 0 |
|
654 | pos = 0 | |
653 | while pos < argcount: |
|
655 | while pos < argcount: | |
654 | fullarg = arg = args[pos] |
|
656 | fullarg = arg = args[pos] | |
655 | equals = arg.find('=') |
|
657 | equals = arg.find('=') | |
656 | if equals > -1: |
|
658 | if equals > -1: | |
657 | arg = arg[:equals] |
|
659 | arg = arg[:equals] | |
658 | if arg in aliases: |
|
660 | if arg in aliases: | |
659 | del args[pos] |
|
661 | del args[pos] | |
660 | if equals > -1: |
|
662 | if equals > -1: | |
661 | values.append(fullarg[equals + 1:]) |
|
663 | values.append(fullarg[equals + 1:]) | |
662 | argcount -= 1 |
|
664 | argcount -= 1 | |
663 | else: |
|
665 | else: | |
664 | if pos + 1 >= argcount: |
|
666 | if pos + 1 >= argcount: | |
665 | # ignore and let getopt report an error if there is no value |
|
667 | # ignore and let getopt report an error if there is no value | |
666 | break |
|
668 | break | |
667 | values.append(args.pop(pos)) |
|
669 | values.append(args.pop(pos)) | |
668 | argcount -= 2 |
|
670 | argcount -= 2 | |
669 | elif arg[:2] in shortopts: |
|
671 | elif arg[:2] in shortopts: | |
670 | # short option can have no following space, e.g. hg log -Rfoo |
|
672 | # short option can have no following space, e.g. hg log -Rfoo | |
671 | values.append(args.pop(pos)[2:]) |
|
673 | values.append(args.pop(pos)[2:]) | |
672 | argcount -= 1 |
|
674 | argcount -= 1 | |
673 | else: |
|
675 | else: | |
674 | pos += 1 |
|
676 | pos += 1 | |
675 | return values |
|
677 | return values | |
676 |
|
678 | |||
677 | def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
|
679 | def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): | |
678 | # run pre-hook, and abort if it fails |
|
680 | # run pre-hook, and abort if it fails | |
679 | hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
|
681 | hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), | |
680 | pats=cmdpats, opts=cmdoptions) |
|
682 | pats=cmdpats, opts=cmdoptions) | |
681 | ret = _runcommand(ui, options, cmd, d) |
|
683 | ret = _runcommand(ui, options, cmd, d) | |
682 | # run post-hook, passing command result |
|
684 | # run post-hook, passing command result | |
683 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
|
685 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), | |
684 | result=ret, pats=cmdpats, opts=cmdoptions) |
|
686 | result=ret, pats=cmdpats, opts=cmdoptions) | |
685 | return ret |
|
687 | return ret | |
686 |
|
688 | |||
687 | def _getlocal(ui, rpath): |
|
689 | def _getlocal(ui, rpath): | |
688 | """Return (path, local ui object) for the given target path. |
|
690 | """Return (path, local ui object) for the given target path. | |
689 |
|
691 | |||
690 | Takes paths in [cwd]/.hg/hgrc into account." |
|
692 | Takes paths in [cwd]/.hg/hgrc into account." | |
691 | """ |
|
693 | """ | |
692 | try: |
|
694 | try: | |
693 | wd = os.getcwd() |
|
695 | wd = os.getcwd() | |
694 | except OSError as e: |
|
696 | except OSError as e: | |
695 | raise util.Abort(_("error getting current working directory: %s") % |
|
697 | raise util.Abort(_("error getting current working directory: %s") % | |
696 | e.strerror) |
|
698 | e.strerror) | |
697 | path = cmdutil.findrepo(wd) or "" |
|
699 | path = cmdutil.findrepo(wd) or "" | |
698 | if not path: |
|
700 | if not path: | |
699 | lui = ui |
|
701 | lui = ui | |
700 | else: |
|
702 | else: | |
701 | lui = ui.copy() |
|
703 | lui = ui.copy() | |
702 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
|
704 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) | |
703 |
|
705 | |||
704 | if rpath and rpath[-1]: |
|
706 | if rpath and rpath[-1]: | |
705 | path = lui.expandpath(rpath[-1]) |
|
707 | path = lui.expandpath(rpath[-1]) | |
706 | lui = ui.copy() |
|
708 | lui = ui.copy() | |
707 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
|
709 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) | |
708 |
|
710 | |||
709 | return path, lui |
|
711 | return path, lui | |
710 |
|
712 | |||
711 | def _checkshellalias(lui, ui, args, precheck=True): |
|
713 | def _checkshellalias(lui, ui, args, precheck=True): | |
712 | """Return the function to run the shell alias, if it is required |
|
714 | """Return the function to run the shell alias, if it is required | |
713 |
|
715 | |||
714 | 'precheck' is whether this function is invoked before adding |
|
716 | 'precheck' is whether this function is invoked before adding | |
715 | aliases or not. |
|
717 | aliases or not. | |
716 | """ |
|
718 | """ | |
717 | options = {} |
|
719 | options = {} | |
718 |
|
720 | |||
719 | try: |
|
721 | try: | |
720 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
722 | args = fancyopts.fancyopts(args, commands.globalopts, options) | |
721 | except fancyopts.getopt.GetoptError: |
|
723 | except fancyopts.getopt.GetoptError: | |
722 | return |
|
724 | return | |
723 |
|
725 | |||
724 | if not args: |
|
726 | if not args: | |
725 | return |
|
727 | return | |
726 |
|
728 | |||
727 | if precheck: |
|
729 | if precheck: | |
728 | strict = True |
|
730 | strict = True | |
729 | norepo = commands.norepo |
|
731 | norepo = commands.norepo | |
730 | optionalrepo = commands.optionalrepo |
|
732 | optionalrepo = commands.optionalrepo | |
731 | def restorecommands(): |
|
733 | def restorecommands(): | |
732 | commands.norepo = norepo |
|
734 | commands.norepo = norepo | |
733 | commands.optionalrepo = optionalrepo |
|
735 | commands.optionalrepo = optionalrepo | |
734 | cmdtable = commands.table.copy() |
|
736 | cmdtable = commands.table.copy() | |
735 | addaliases(lui, cmdtable) |
|
737 | addaliases(lui, cmdtable) | |
736 | else: |
|
738 | else: | |
737 | strict = False |
|
739 | strict = False | |
738 | def restorecommands(): |
|
740 | def restorecommands(): | |
739 | pass |
|
741 | pass | |
740 | cmdtable = commands.table |
|
742 | cmdtable = commands.table | |
741 |
|
743 | |||
742 | cmd = args[0] |
|
744 | cmd = args[0] | |
743 | try: |
|
745 | try: | |
744 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) |
|
746 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) | |
745 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
747 | except (error.AmbiguousCommand, error.UnknownCommand): | |
746 | restorecommands() |
|
748 | restorecommands() | |
747 | return |
|
749 | return | |
748 |
|
750 | |||
749 | cmd = aliases[0] |
|
751 | cmd = aliases[0] | |
750 | fn = entry[0] |
|
752 | fn = entry[0] | |
751 |
|
753 | |||
752 | if cmd and util.safehasattr(fn, 'shell'): |
|
754 | if cmd and util.safehasattr(fn, 'shell'): | |
753 | d = lambda: fn(ui, *args[1:]) |
|
755 | d = lambda: fn(ui, *args[1:]) | |
754 | return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, |
|
756 | return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, | |
755 | [], {}) |
|
757 | [], {}) | |
756 |
|
758 | |||
757 | restorecommands() |
|
759 | restorecommands() | |
758 |
|
760 | |||
759 | _loaded = set() |
|
761 | _loaded = set() | |
760 | def _dispatch(req): |
|
762 | def _dispatch(req): | |
761 | args = req.args |
|
763 | args = req.args | |
762 | ui = req.ui |
|
764 | ui = req.ui | |
763 |
|
765 | |||
764 | # check for cwd |
|
766 | # check for cwd | |
765 | cwd = _earlygetopt(['--cwd'], args) |
|
767 | cwd = _earlygetopt(['--cwd'], args) | |
766 | if cwd: |
|
768 | if cwd: | |
767 | os.chdir(cwd[-1]) |
|
769 | os.chdir(cwd[-1]) | |
768 |
|
770 | |||
769 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) |
|
771 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) | |
770 | path, lui = _getlocal(ui, rpath) |
|
772 | path, lui = _getlocal(ui, rpath) | |
771 |
|
773 | |||
772 | # Now that we're operating in the right directory/repository with |
|
774 | # Now that we're operating in the right directory/repository with | |
773 | # the right config settings, check for shell aliases |
|
775 | # the right config settings, check for shell aliases | |
774 | shellaliasfn = _checkshellalias(lui, ui, args) |
|
776 | shellaliasfn = _checkshellalias(lui, ui, args) | |
775 | if shellaliasfn: |
|
777 | if shellaliasfn: | |
776 | return shellaliasfn() |
|
778 | return shellaliasfn() | |
777 |
|
779 | |||
778 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
|
780 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and | |
779 | # reposetup. Programs like TortoiseHg will call _dispatch several |
|
781 | # reposetup. Programs like TortoiseHg will call _dispatch several | |
780 | # times so we keep track of configured extensions in _loaded. |
|
782 | # times so we keep track of configured extensions in _loaded. | |
781 | extensions.loadall(lui) |
|
783 | extensions.loadall(lui) | |
782 | exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] |
|
784 | exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] | |
783 | # Propagate any changes to lui.__class__ by extensions |
|
785 | # Propagate any changes to lui.__class__ by extensions | |
784 | ui.__class__ = lui.__class__ |
|
786 | ui.__class__ = lui.__class__ | |
785 |
|
787 | |||
786 | # (uisetup and extsetup are handled in extensions.loadall) |
|
788 | # (uisetup and extsetup are handled in extensions.loadall) | |
787 |
|
789 | |||
788 | for name, module in exts: |
|
790 | for name, module in exts: | |
789 | cmdtable = getattr(module, 'cmdtable', {}) |
|
791 | cmdtable = getattr(module, 'cmdtable', {}) | |
790 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] |
|
792 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] | |
791 | if overrides: |
|
793 | if overrides: | |
792 | ui.warn(_("extension '%s' overrides commands: %s\n") |
|
794 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
793 | % (name, " ".join(overrides))) |
|
795 | % (name, " ".join(overrides))) | |
794 | commands.table.update(cmdtable) |
|
796 | commands.table.update(cmdtable) | |
795 | _loaded.add(name) |
|
797 | _loaded.add(name) | |
796 |
|
798 | |||
797 | # (reposetup is handled in hg.repository) |
|
799 | # (reposetup is handled in hg.repository) | |
798 |
|
800 | |||
799 | addaliases(lui, commands.table) |
|
801 | addaliases(lui, commands.table) | |
800 |
|
802 | |||
801 | if not lui.configbool("ui", "strict"): |
|
803 | if not lui.configbool("ui", "strict"): | |
802 | # All aliases and commands are completely defined, now. |
|
804 | # All aliases and commands are completely defined, now. | |
803 | # Check abbreviation/ambiguity of shell alias again, because shell |
|
805 | # Check abbreviation/ambiguity of shell alias again, because shell | |
804 | # alias may cause failure of "_parse" (see issue4355) |
|
806 | # alias may cause failure of "_parse" (see issue4355) | |
805 | shellaliasfn = _checkshellalias(lui, ui, args, precheck=False) |
|
807 | shellaliasfn = _checkshellalias(lui, ui, args, precheck=False) | |
806 | if shellaliasfn: |
|
808 | if shellaliasfn: | |
807 | return shellaliasfn() |
|
809 | return shellaliasfn() | |
808 |
|
810 | |||
809 | # check for fallback encoding |
|
811 | # check for fallback encoding | |
810 | fallback = lui.config('ui', 'fallbackencoding') |
|
812 | fallback = lui.config('ui', 'fallbackencoding') | |
811 | if fallback: |
|
813 | if fallback: | |
812 | encoding.fallbackencoding = fallback |
|
814 | encoding.fallbackencoding = fallback | |
813 |
|
815 | |||
814 | fullargs = args |
|
816 | fullargs = args | |
815 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
817 | cmd, func, args, options, cmdoptions = _parse(lui, args) | |
816 |
|
818 | |||
817 | if options["config"]: |
|
819 | if options["config"]: | |
818 | raise util.Abort(_("option --config may not be abbreviated!")) |
|
820 | raise util.Abort(_("option --config may not be abbreviated!")) | |
819 | if options["cwd"]: |
|
821 | if options["cwd"]: | |
820 | raise util.Abort(_("option --cwd may not be abbreviated!")) |
|
822 | raise util.Abort(_("option --cwd may not be abbreviated!")) | |
821 | if options["repository"]: |
|
823 | if options["repository"]: | |
822 | raise util.Abort(_( |
|
824 | raise util.Abort(_( | |
823 | "option -R has to be separated from other options (e.g. not -qR) " |
|
825 | "option -R has to be separated from other options (e.g. not -qR) " | |
824 | "and --repository may only be abbreviated as --repo!")) |
|
826 | "and --repository may only be abbreviated as --repo!")) | |
825 |
|
827 | |||
826 | if options["encoding"]: |
|
828 | if options["encoding"]: | |
827 | encoding.encoding = options["encoding"] |
|
829 | encoding.encoding = options["encoding"] | |
828 | if options["encodingmode"]: |
|
830 | if options["encodingmode"]: | |
829 | encoding.encodingmode = options["encodingmode"] |
|
831 | encoding.encodingmode = options["encodingmode"] | |
830 | if options["time"]: |
|
832 | if options["time"]: | |
831 | def get_times(): |
|
833 | def get_times(): | |
832 | t = os.times() |
|
834 | t = os.times() | |
833 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() |
|
835 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() | |
834 | t = (t[0], t[1], t[2], t[3], time.clock()) |
|
836 | t = (t[0], t[1], t[2], t[3], time.clock()) | |
835 | return t |
|
837 | return t | |
836 | s = get_times() |
|
838 | s = get_times() | |
837 | def print_time(): |
|
839 | def print_time(): | |
838 | t = get_times() |
|
840 | t = get_times() | |
839 | ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
|
841 | ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % | |
840 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
|
842 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | |
841 | atexit.register(print_time) |
|
843 | atexit.register(print_time) | |
842 |
|
844 | |||
843 | uis = set([ui, lui]) |
|
845 | uis = set([ui, lui]) | |
844 |
|
846 | |||
845 | if req.repo: |
|
847 | if req.repo: | |
846 | uis.add(req.repo.ui) |
|
848 | uis.add(req.repo.ui) | |
847 |
|
849 | |||
848 | if options['verbose'] or options['debug'] or options['quiet']: |
|
850 | if options['verbose'] or options['debug'] or options['quiet']: | |
849 | for opt in ('verbose', 'debug', 'quiet'): |
|
851 | for opt in ('verbose', 'debug', 'quiet'): | |
850 | val = str(bool(options[opt])) |
|
852 | val = str(bool(options[opt])) | |
851 | for ui_ in uis: |
|
853 | for ui_ in uis: | |
852 | ui_.setconfig('ui', opt, val, '--' + opt) |
|
854 | ui_.setconfig('ui', opt, val, '--' + opt) | |
853 |
|
855 | |||
854 | if options['traceback']: |
|
856 | if options['traceback']: | |
855 | for ui_ in uis: |
|
857 | for ui_ in uis: | |
856 | ui_.setconfig('ui', 'traceback', 'on', '--traceback') |
|
858 | ui_.setconfig('ui', 'traceback', 'on', '--traceback') | |
857 |
|
859 | |||
858 | if options['noninteractive']: |
|
860 | if options['noninteractive']: | |
859 | for ui_ in uis: |
|
861 | for ui_ in uis: | |
860 | ui_.setconfig('ui', 'interactive', 'off', '-y') |
|
862 | ui_.setconfig('ui', 'interactive', 'off', '-y') | |
861 |
|
863 | |||
862 | if cmdoptions.get('insecure', False): |
|
864 | if cmdoptions.get('insecure', False): | |
863 | for ui_ in uis: |
|
865 | for ui_ in uis: | |
864 | ui_.setconfig('web', 'cacerts', '!', '--insecure') |
|
866 | ui_.setconfig('web', 'cacerts', '!', '--insecure') | |
865 |
|
867 | |||
866 | if options['version']: |
|
868 | if options['version']: | |
867 | return commands.version_(ui) |
|
869 | return commands.version_(ui) | |
868 | if options['help']: |
|
870 | if options['help']: | |
869 | return commands.help_(ui, cmd, command=True) |
|
871 | return commands.help_(ui, cmd, command=True) | |
870 | elif not cmd: |
|
872 | elif not cmd: | |
871 | return commands.help_(ui, 'shortlist') |
|
873 | return commands.help_(ui, 'shortlist') | |
872 |
|
874 | |||
873 | repo = None |
|
875 | repo = None | |
874 | cmdpats = args[:] |
|
876 | cmdpats = args[:] | |
875 | if cmd not in commands.norepo.split(): |
|
877 | if cmd not in commands.norepo.split(): | |
876 | # use the repo from the request only if we don't have -R |
|
878 | # use the repo from the request only if we don't have -R | |
877 | if not rpath and not cwd: |
|
879 | if not rpath and not cwd: | |
878 | repo = req.repo |
|
880 | repo = req.repo | |
879 |
|
881 | |||
880 | if repo: |
|
882 | if repo: | |
881 | # set the descriptors of the repo ui to those of ui |
|
883 | # set the descriptors of the repo ui to those of ui | |
882 | repo.ui.fin = ui.fin |
|
884 | repo.ui.fin = ui.fin | |
883 | repo.ui.fout = ui.fout |
|
885 | repo.ui.fout = ui.fout | |
884 | repo.ui.ferr = ui.ferr |
|
886 | repo.ui.ferr = ui.ferr | |
885 | else: |
|
887 | else: | |
886 | try: |
|
888 | try: | |
887 | repo = hg.repository(ui, path=path) |
|
889 | repo = hg.repository(ui, path=path) | |
888 | if not repo.local(): |
|
890 | if not repo.local(): | |
889 | raise util.Abort(_("repository '%s' is not local") % path) |
|
891 | raise util.Abort(_("repository '%s' is not local") % path) | |
890 | repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') |
|
892 | repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') | |
891 | except error.RequirementError: |
|
893 | except error.RequirementError: | |
892 | raise |
|
894 | raise | |
893 | except error.RepoError: |
|
895 | except error.RepoError: | |
894 | if rpath and rpath[-1]: # invalid -R path |
|
896 | if rpath and rpath[-1]: # invalid -R path | |
895 | raise |
|
897 | raise | |
896 | if cmd not in commands.optionalrepo.split(): |
|
898 | if cmd not in commands.optionalrepo.split(): | |
897 | if (cmd in commands.inferrepo.split() and |
|
899 | if (cmd in commands.inferrepo.split() and | |
898 | args and not path): # try to infer -R from command args |
|
900 | args and not path): # try to infer -R from command args | |
899 | repos = map(cmdutil.findrepo, args) |
|
901 | repos = map(cmdutil.findrepo, args) | |
900 | guess = repos[0] |
|
902 | guess = repos[0] | |
901 | if guess and repos.count(guess) == len(repos): |
|
903 | if guess and repos.count(guess) == len(repos): | |
902 | req.args = ['--repository', guess] + fullargs |
|
904 | req.args = ['--repository', guess] + fullargs | |
903 | return _dispatch(req) |
|
905 | return _dispatch(req) | |
904 | if not path: |
|
906 | if not path: | |
905 | raise error.RepoError(_("no repository found in '%s'" |
|
907 | raise error.RepoError(_("no repository found in '%s'" | |
906 | " (.hg not found)") |
|
908 | " (.hg not found)") | |
907 | % os.getcwd()) |
|
909 | % os.getcwd()) | |
908 | raise |
|
910 | raise | |
909 | if repo: |
|
911 | if repo: | |
910 | ui = repo.ui |
|
912 | ui = repo.ui | |
911 | if options['hidden']: |
|
913 | if options['hidden']: | |
912 | repo = repo.unfiltered() |
|
914 | repo = repo.unfiltered() | |
913 | args.insert(0, repo) |
|
915 | args.insert(0, repo) | |
914 | elif rpath: |
|
916 | elif rpath: | |
915 | ui.warn(_("warning: --repository ignored\n")) |
|
917 | ui.warn(_("warning: --repository ignored\n")) | |
916 |
|
918 | |||
917 | msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) |
|
919 | msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) | |
918 | ui.log("command", '%s\n', msg) |
|
920 | ui.log("command", '%s\n', msg) | |
919 | d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) |
|
921 | d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) | |
920 | try: |
|
922 | try: | |
921 | return runcommand(lui, repo, cmd, fullargs, ui, options, d, |
|
923 | return runcommand(lui, repo, cmd, fullargs, ui, options, d, | |
922 | cmdpats, cmdoptions) |
|
924 | cmdpats, cmdoptions) | |
923 | finally: |
|
925 | finally: | |
924 | if repo and repo != req.repo: |
|
926 | if repo and repo != req.repo: | |
925 | repo.close() |
|
927 | repo.close() | |
926 |
|
928 | |||
927 | def lsprofile(ui, func, fp): |
|
929 | def lsprofile(ui, func, fp): | |
928 | format = ui.config('profiling', 'format', default='text') |
|
930 | format = ui.config('profiling', 'format', default='text') | |
929 | field = ui.config('profiling', 'sort', default='inlinetime') |
|
931 | field = ui.config('profiling', 'sort', default='inlinetime') | |
930 | limit = ui.configint('profiling', 'limit', default=30) |
|
932 | limit = ui.configint('profiling', 'limit', default=30) | |
931 | climit = ui.configint('profiling', 'nested', default=0) |
|
933 | climit = ui.configint('profiling', 'nested', default=0) | |
932 |
|
934 | |||
933 | if format not in ['text', 'kcachegrind']: |
|
935 | if format not in ['text', 'kcachegrind']: | |
934 | ui.warn(_("unrecognized profiling format '%s'" |
|
936 | ui.warn(_("unrecognized profiling format '%s'" | |
935 | " - Ignored\n") % format) |
|
937 | " - Ignored\n") % format) | |
936 | format = 'text' |
|
938 | format = 'text' | |
937 |
|
939 | |||
938 | try: |
|
940 | try: | |
939 | from . import lsprof |
|
941 | from . import lsprof | |
940 | except ImportError: |
|
942 | except ImportError: | |
941 | raise util.Abort(_( |
|
943 | raise util.Abort(_( | |
942 | 'lsprof not available - install from ' |
|
944 | 'lsprof not available - install from ' | |
943 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) |
|
945 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) | |
944 | p = lsprof.Profiler() |
|
946 | p = lsprof.Profiler() | |
945 | p.enable(subcalls=True) |
|
947 | p.enable(subcalls=True) | |
946 | try: |
|
948 | try: | |
947 | return func() |
|
949 | return func() | |
948 | finally: |
|
950 | finally: | |
949 | p.disable() |
|
951 | p.disable() | |
950 |
|
952 | |||
951 | if format == 'kcachegrind': |
|
953 | if format == 'kcachegrind': | |
952 | from . import lsprofcalltree |
|
954 | from . import lsprofcalltree | |
953 | calltree = lsprofcalltree.KCacheGrind(p) |
|
955 | calltree = lsprofcalltree.KCacheGrind(p) | |
954 | calltree.output(fp) |
|
956 | calltree.output(fp) | |
955 | else: |
|
957 | else: | |
956 | # format == 'text' |
|
958 | # format == 'text' | |
957 | stats = lsprof.Stats(p.getstats()) |
|
959 | stats = lsprof.Stats(p.getstats()) | |
958 | stats.sort(field) |
|
960 | stats.sort(field) | |
959 | stats.pprint(limit=limit, file=fp, climit=climit) |
|
961 | stats.pprint(limit=limit, file=fp, climit=climit) | |
960 |
|
962 | |||
961 | def flameprofile(ui, func, fp): |
|
963 | def flameprofile(ui, func, fp): | |
962 | try: |
|
964 | try: | |
963 | from flamegraph import flamegraph |
|
965 | from flamegraph import flamegraph | |
964 | except ImportError: |
|
966 | except ImportError: | |
965 | raise util.Abort(_( |
|
967 | raise util.Abort(_( | |
966 | 'flamegraph not available - install from ' |
|
968 | 'flamegraph not available - install from ' | |
967 | 'https://github.com/evanhempel/python-flamegraph')) |
|
969 | 'https://github.com/evanhempel/python-flamegraph')) | |
968 | # developer config: profiling.freq |
|
970 | # developer config: profiling.freq | |
969 | freq = ui.configint('profiling', 'freq', default=1000) |
|
971 | freq = ui.configint('profiling', 'freq', default=1000) | |
970 | filter_ = None |
|
972 | filter_ = None | |
971 | collapse_recursion = True |
|
973 | collapse_recursion = True | |
972 | thread = flamegraph.ProfileThread(fp, 1.0 / freq, |
|
974 | thread = flamegraph.ProfileThread(fp, 1.0 / freq, | |
973 | filter_, collapse_recursion) |
|
975 | filter_, collapse_recursion) | |
974 | start_time = time.clock() |
|
976 | start_time = time.clock() | |
975 | try: |
|
977 | try: | |
976 | thread.start() |
|
978 | thread.start() | |
977 | func() |
|
979 | func() | |
978 | finally: |
|
980 | finally: | |
979 | thread.stop() |
|
981 | thread.stop() | |
980 | thread.join() |
|
982 | thread.join() | |
981 | print 'Collected %d stack frames (%d unique) in %2.2f seconds.' % ( |
|
983 | print 'Collected %d stack frames (%d unique) in %2.2f seconds.' % ( | |
982 | time.clock() - start_time, thread.num_frames(), |
|
984 | time.clock() - start_time, thread.num_frames(), | |
983 | thread.num_frames(unique=True)) |
|
985 | thread.num_frames(unique=True)) | |
984 |
|
986 | |||
985 |
|
987 | |||
986 | def statprofile(ui, func, fp): |
|
988 | def statprofile(ui, func, fp): | |
987 | try: |
|
989 | try: | |
988 | import statprof |
|
990 | import statprof | |
989 | except ImportError: |
|
991 | except ImportError: | |
990 | raise util.Abort(_( |
|
992 | raise util.Abort(_( | |
991 | 'statprof not available - install using "easy_install statprof"')) |
|
993 | 'statprof not available - install using "easy_install statprof"')) | |
992 |
|
994 | |||
993 | freq = ui.configint('profiling', 'freq', default=1000) |
|
995 | freq = ui.configint('profiling', 'freq', default=1000) | |
994 | if freq > 0: |
|
996 | if freq > 0: | |
995 | statprof.reset(freq) |
|
997 | statprof.reset(freq) | |
996 | else: |
|
998 | else: | |
997 | ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq) |
|
999 | ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq) | |
998 |
|
1000 | |||
999 | statprof.start() |
|
1001 | statprof.start() | |
1000 | try: |
|
1002 | try: | |
1001 | return func() |
|
1003 | return func() | |
1002 | finally: |
|
1004 | finally: | |
1003 | statprof.stop() |
|
1005 | statprof.stop() | |
1004 | statprof.display(fp) |
|
1006 | statprof.display(fp) | |
1005 |
|
1007 | |||
1006 | def _runcommand(ui, options, cmd, cmdfunc): |
|
1008 | def _runcommand(ui, options, cmd, cmdfunc): | |
1007 | """Enables the profiler if applicable. |
|
1009 | """Enables the profiler if applicable. | |
1008 |
|
1010 | |||
1009 | ``profiling.enabled`` - boolean config that enables or disables profiling |
|
1011 | ``profiling.enabled`` - boolean config that enables or disables profiling | |
1010 | """ |
|
1012 | """ | |
1011 | def checkargs(): |
|
1013 | def checkargs(): | |
1012 | try: |
|
1014 | try: | |
1013 | return cmdfunc() |
|
1015 | return cmdfunc() | |
1014 | except error.SignatureError: |
|
1016 | except error.SignatureError: | |
1015 | raise error.CommandError(cmd, _("invalid arguments")) |
|
1017 | raise error.CommandError(cmd, _("invalid arguments")) | |
1016 |
|
1018 | |||
1017 | if options['profile'] or ui.configbool('profiling', 'enabled'): |
|
1019 | if options['profile'] or ui.configbool('profiling', 'enabled'): | |
1018 | profiler = os.getenv('HGPROF') |
|
1020 | profiler = os.getenv('HGPROF') | |
1019 | if profiler is None: |
|
1021 | if profiler is None: | |
1020 | profiler = ui.config('profiling', 'type', default='ls') |
|
1022 | profiler = ui.config('profiling', 'type', default='ls') | |
1021 | if profiler not in ('ls', 'stat', 'flame'): |
|
1023 | if profiler not in ('ls', 'stat', 'flame'): | |
1022 | ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler) |
|
1024 | ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler) | |
1023 | profiler = 'ls' |
|
1025 | profiler = 'ls' | |
1024 |
|
1026 | |||
1025 | output = ui.config('profiling', 'output') |
|
1027 | output = ui.config('profiling', 'output') | |
1026 |
|
1028 | |||
1027 | if output == 'blackbox': |
|
1029 | if output == 'blackbox': | |
1028 | import StringIO |
|
1030 | import StringIO | |
1029 | fp = StringIO.StringIO() |
|
1031 | fp = StringIO.StringIO() | |
1030 | elif output: |
|
1032 | elif output: | |
1031 | path = ui.expandpath(output) |
|
1033 | path = ui.expandpath(output) | |
1032 | fp = open(path, 'wb') |
|
1034 | fp = open(path, 'wb') | |
1033 | else: |
|
1035 | else: | |
1034 | fp = sys.stderr |
|
1036 | fp = sys.stderr | |
1035 |
|
1037 | |||
1036 | try: |
|
1038 | try: | |
1037 | if profiler == 'ls': |
|
1039 | if profiler == 'ls': | |
1038 | return lsprofile(ui, checkargs, fp) |
|
1040 | return lsprofile(ui, checkargs, fp) | |
1039 | elif profiler == 'flame': |
|
1041 | elif profiler == 'flame': | |
1040 | return flameprofile(ui, checkargs, fp) |
|
1042 | return flameprofile(ui, checkargs, fp) | |
1041 | else: |
|
1043 | else: | |
1042 | return statprofile(ui, checkargs, fp) |
|
1044 | return statprofile(ui, checkargs, fp) | |
1043 | finally: |
|
1045 | finally: | |
1044 | if output: |
|
1046 | if output: | |
1045 | if output == 'blackbox': |
|
1047 | if output == 'blackbox': | |
1046 | val = "Profile:\n%s" % fp.getvalue() |
|
1048 | val = "Profile:\n%s" % fp.getvalue() | |
1047 | # ui.log treats the input as a format string, |
|
1049 | # ui.log treats the input as a format string, | |
1048 | # so we need to escape any % signs. |
|
1050 | # so we need to escape any % signs. | |
1049 | val = val.replace('%', '%%') |
|
1051 | val = val.replace('%', '%%') | |
1050 | ui.log('profile', val) |
|
1052 | ui.log('profile', val) | |
1051 | fp.close() |
|
1053 | fp.close() | |
1052 | else: |
|
1054 | else: | |
1053 | return checkargs() |
|
1055 | return checkargs() |
@@ -1,1831 +1,1836 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 | The configuration files use a simple ini-file format. A configuration |
|
4 | The configuration files use a simple ini-file format. A configuration | |
5 | file consists of sections, led by a ``[section]`` header and followed |
|
5 | file consists of sections, led by a ``[section]`` header and followed | |
6 | by ``name = value`` entries:: |
|
6 | by ``name = value`` entries:: | |
7 |
|
7 | |||
8 | [ui] |
|
8 | [ui] | |
9 | username = Firstname Lastname <firstname.lastname@example.net> |
|
9 | username = Firstname Lastname <firstname.lastname@example.net> | |
10 | verbose = True |
|
10 | verbose = True | |
11 |
|
11 | |||
12 | The above entries will be referred to as ``ui.username`` and |
|
12 | The above entries will be referred to as ``ui.username`` and | |
13 | ``ui.verbose``, respectively. See the Syntax section below. |
|
13 | ``ui.verbose``, respectively. See the Syntax section below. | |
14 |
|
14 | |||
15 | Files |
|
15 | Files | |
16 | ===== |
|
16 | ===== | |
17 |
|
17 | |||
18 | Mercurial reads configuration data from several files, if they exist. |
|
18 | Mercurial reads configuration data from several files, if they exist. | |
19 | These files do not exist by default and you will have to create the |
|
19 | These files do not exist by default and you will have to create the | |
20 | appropriate configuration files yourself: global configuration like |
|
20 | appropriate configuration files yourself: global configuration like | |
21 | the username setting is typically put into |
|
21 | the username setting is typically put into | |
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local |
|
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local | |
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. | |
24 |
|
24 | |||
25 | The names of these files depend on the system on which Mercurial is |
|
25 | The names of these files depend on the system on which Mercurial is | |
26 | installed. ``*.rc`` files from a single directory are read in |
|
26 | installed. ``*.rc`` files from a single directory are read in | |
27 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
27 | alphabetical order, later ones overriding earlier ones. Where multiple | |
28 | paths are given below, settings from earlier paths override later |
|
28 | paths are given below, settings from earlier paths override later | |
29 | ones. |
|
29 | ones. | |
30 |
|
30 | |||
31 | .. container:: verbose.unix |
|
31 | .. container:: verbose.unix | |
32 |
|
32 | |||
33 | On Unix, the following files are consulted: |
|
33 | On Unix, the following files are consulted: | |
34 |
|
34 | |||
35 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
35 | - ``<repo>/.hg/hgrc`` (per-repository) | |
36 | - ``$HOME/.hgrc`` (per-user) |
|
36 | - ``$HOME/.hgrc`` (per-user) | |
37 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) |
|
37 | - ``<install-root>/etc/mercurial/hgrc`` (per-installation) | |
38 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) |
|
38 | - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation) | |
39 | - ``/etc/mercurial/hgrc`` (per-system) |
|
39 | - ``/etc/mercurial/hgrc`` (per-system) | |
40 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) |
|
40 | - ``/etc/mercurial/hgrc.d/*.rc`` (per-system) | |
41 | - ``<internal>/default.d/*.rc`` (defaults) |
|
41 | - ``<internal>/default.d/*.rc`` (defaults) | |
42 |
|
42 | |||
43 | .. container:: verbose.windows |
|
43 | .. container:: verbose.windows | |
44 |
|
44 | |||
45 | On Windows, the following files are consulted: |
|
45 | On Windows, the following files are consulted: | |
46 |
|
46 | |||
47 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
47 | - ``<repo>/.hg/hgrc`` (per-repository) | |
48 | - ``%USERPROFILE%\.hgrc`` (per-user) |
|
48 | - ``%USERPROFILE%\.hgrc`` (per-user) | |
49 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) |
|
49 | - ``%USERPROFILE%\Mercurial.ini`` (per-user) | |
50 | - ``%HOME%\.hgrc`` (per-user) |
|
50 | - ``%HOME%\.hgrc`` (per-user) | |
51 | - ``%HOME%\Mercurial.ini`` (per-user) |
|
51 | - ``%HOME%\Mercurial.ini`` (per-user) | |
52 | - ``<install-dir>\Mercurial.ini`` (per-installation) |
|
52 | - ``<install-dir>\Mercurial.ini`` (per-installation) | |
53 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) |
|
53 | - ``<install-dir>\hgrc.d\*.rc`` (per-installation) | |
54 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) |
|
54 | - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation) | |
55 | - ``<internal>/default.d/*.rc`` (defaults) |
|
55 | - ``<internal>/default.d/*.rc`` (defaults) | |
56 |
|
56 | |||
57 | .. note:: |
|
57 | .. note:: | |
58 |
|
58 | |||
59 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
59 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |
60 | is used when running 32-bit Python on 64-bit Windows. |
|
60 | is used when running 32-bit Python on 64-bit Windows. | |
61 |
|
61 | |||
62 | .. container:: verbose.plan9 |
|
62 | .. container:: verbose.plan9 | |
63 |
|
63 | |||
64 | On Plan9, the following files are consulted: |
|
64 | On Plan9, the following files are consulted: | |
65 |
|
65 | |||
66 | - ``<repo>/.hg/hgrc`` (per-repository) |
|
66 | - ``<repo>/.hg/hgrc`` (per-repository) | |
67 | - ``$home/lib/hgrc`` (per-user) |
|
67 | - ``$home/lib/hgrc`` (per-user) | |
68 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) |
|
68 | - ``<install-root>/lib/mercurial/hgrc`` (per-installation) | |
69 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) |
|
69 | - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation) | |
70 | - ``/lib/mercurial/hgrc`` (per-system) |
|
70 | - ``/lib/mercurial/hgrc`` (per-system) | |
71 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) |
|
71 | - ``/lib/mercurial/hgrc.d/*.rc`` (per-system) | |
72 | - ``<internal>/default.d/*.rc`` (defaults) |
|
72 | - ``<internal>/default.d/*.rc`` (defaults) | |
73 |
|
73 | |||
74 | Per-repository configuration options only apply in a |
|
74 | Per-repository configuration options only apply in a | |
75 | particular repository. This file is not version-controlled, and |
|
75 | particular repository. This file is not version-controlled, and | |
76 | will not get transferred during a "clone" operation. Options in |
|
76 | will not get transferred during a "clone" operation. Options in | |
77 | this file override options in all other configuration files. On |
|
77 | this file override options in all other configuration files. On | |
78 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
78 | Plan 9 and Unix, most of this file will be ignored if it doesn't | |
79 | belong to a trusted user or to a trusted group. See the documentation |
|
79 | belong to a trusted user or to a trusted group. See the documentation | |
80 | for the ``[trusted]`` section below for more details. |
|
80 | for the ``[trusted]`` section below for more details. | |
81 |
|
81 | |||
82 | Per-user configuration file(s) are for the user running Mercurial. On |
|
82 | Per-user configuration file(s) are for the user running Mercurial. On | |
83 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
83 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
84 | files apply to all Mercurial commands executed by this user in any |
|
84 | files apply to all Mercurial commands executed by this user in any | |
85 | directory. Options in these files override per-system and per-installation |
|
85 | directory. Options in these files override per-system and per-installation | |
86 | options. |
|
86 | options. | |
87 |
|
87 | |||
88 | Per-installation configuration files are searched for in the |
|
88 | Per-installation configuration files are searched for in the | |
89 | directory where Mercurial is installed. ``<install-root>`` is the |
|
89 | directory where Mercurial is installed. ``<install-root>`` is the | |
90 | parent directory of the **hg** executable (or symlink) being run. For |
|
90 | parent directory of the **hg** executable (or symlink) being run. For | |
91 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
91 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
92 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
92 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
93 | to all Mercurial commands executed by any user in any directory. |
|
93 | to all Mercurial commands executed by any user in any directory. | |
94 |
|
94 | |||
95 | Per-installation configuration files are for the system on |
|
95 | Per-installation configuration files are for the system on | |
96 | which Mercurial is running. Options in these files apply to all |
|
96 | which Mercurial is running. Options in these files apply to all | |
97 | Mercurial commands executed by any user in any directory. Registry |
|
97 | Mercurial commands executed by any user in any directory. Registry | |
98 | keys contain PATH-like strings, every part of which must reference |
|
98 | keys contain PATH-like strings, every part of which must reference | |
99 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
99 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
100 | be read. Mercurial checks each of these locations in the specified |
|
100 | be read. Mercurial checks each of these locations in the specified | |
101 | order until one or more configuration files are detected. |
|
101 | order until one or more configuration files are detected. | |
102 |
|
102 | |||
103 | Per-system configuration files are for the system on which Mercurial |
|
103 | Per-system configuration files are for the system on which Mercurial | |
104 | is running. Options in these files apply to all Mercurial commands |
|
104 | is running. Options in these files apply to all Mercurial commands | |
105 | executed by any user in any directory. Options in these files |
|
105 | executed by any user in any directory. Options in these files | |
106 | override per-installation options. |
|
106 | override per-installation options. | |
107 |
|
107 | |||
108 | Mercurial comes with some default configuration. The default configuration |
|
108 | Mercurial comes with some default configuration. The default configuration | |
109 | files are installed with Mercurial and will be overwritten on upgrades. Default |
|
109 | files are installed with Mercurial and will be overwritten on upgrades. Default | |
110 | configuration files should never be edited by users or administrators but can |
|
110 | configuration files should never be edited by users or administrators but can | |
111 | be overridden in other configuration files. So far the directory only contains |
|
111 | be overridden in other configuration files. So far the directory only contains | |
112 | merge tool configuration but packagers can also put other default configuration |
|
112 | merge tool configuration but packagers can also put other default configuration | |
113 | there. |
|
113 | there. | |
114 |
|
114 | |||
115 | Syntax |
|
115 | Syntax | |
116 | ====== |
|
116 | ====== | |
117 |
|
117 | |||
118 | A configuration file consists of sections, led by a ``[section]`` header |
|
118 | A configuration file consists of sections, led by a ``[section]`` header | |
119 | and followed by ``name = value`` entries (sometimes called |
|
119 | and followed by ``name = value`` entries (sometimes called | |
120 | ``configuration keys``):: |
|
120 | ``configuration keys``):: | |
121 |
|
121 | |||
122 | [spam] |
|
122 | [spam] | |
123 | eggs=ham |
|
123 | eggs=ham | |
124 | green= |
|
124 | green= | |
125 | eggs |
|
125 | eggs | |
126 |
|
126 | |||
127 | Each line contains one entry. If the lines that follow are indented, |
|
127 | Each line contains one entry. If the lines that follow are indented, | |
128 | they are treated as continuations of that entry. Leading whitespace is |
|
128 | they are treated as continuations of that entry. Leading whitespace is | |
129 | removed from values. Empty lines are skipped. Lines beginning with |
|
129 | removed from values. Empty lines are skipped. Lines beginning with | |
130 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
130 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
131 |
|
131 | |||
132 | Configuration keys can be set multiple times, in which case Mercurial |
|
132 | Configuration keys can be set multiple times, in which case Mercurial | |
133 | will use the value that was configured last. As an example:: |
|
133 | will use the value that was configured last. As an example:: | |
134 |
|
134 | |||
135 | [spam] |
|
135 | [spam] | |
136 | eggs=large |
|
136 | eggs=large | |
137 | ham=serrano |
|
137 | ham=serrano | |
138 | eggs=small |
|
138 | eggs=small | |
139 |
|
139 | |||
140 | This would set the configuration key named ``eggs`` to ``small``. |
|
140 | This would set the configuration key named ``eggs`` to ``small``. | |
141 |
|
141 | |||
142 | It is also possible to define a section multiple times. A section can |
|
142 | It is also possible to define a section multiple times. A section can | |
143 | be redefined on the same and/or on different configuration files. For |
|
143 | be redefined on the same and/or on different configuration files. For | |
144 | example:: |
|
144 | example:: | |
145 |
|
145 | |||
146 | [foo] |
|
146 | [foo] | |
147 | eggs=large |
|
147 | eggs=large | |
148 | ham=serrano |
|
148 | ham=serrano | |
149 | eggs=small |
|
149 | eggs=small | |
150 |
|
150 | |||
151 | [bar] |
|
151 | [bar] | |
152 | eggs=ham |
|
152 | eggs=ham | |
153 | green= |
|
153 | green= | |
154 | eggs |
|
154 | eggs | |
155 |
|
155 | |||
156 | [foo] |
|
156 | [foo] | |
157 | ham=prosciutto |
|
157 | ham=prosciutto | |
158 | eggs=medium |
|
158 | eggs=medium | |
159 | bread=toasted |
|
159 | bread=toasted | |
160 |
|
160 | |||
161 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
161 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
162 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
162 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
163 | respectively. As you can see there only thing that matters is the last |
|
163 | respectively. As you can see there only thing that matters is the last | |
164 | value that was set for each of the configuration keys. |
|
164 | value that was set for each of the configuration keys. | |
165 |
|
165 | |||
166 | If a configuration key is set multiple times in different |
|
166 | If a configuration key is set multiple times in different | |
167 | configuration files the final value will depend on the order in which |
|
167 | configuration files the final value will depend on the order in which | |
168 | the different configuration files are read, with settings from earlier |
|
168 | the different configuration files are read, with settings from earlier | |
169 | paths overriding later ones as described on the ``Files`` section |
|
169 | paths overriding later ones as described on the ``Files`` section | |
170 | above. |
|
170 | above. | |
171 |
|
171 | |||
172 | A line of the form ``%include file`` will include ``file`` into the |
|
172 | A line of the form ``%include file`` will include ``file`` into the | |
173 | current configuration file. The inclusion is recursive, which means |
|
173 | current configuration file. The inclusion is recursive, which means | |
174 | that included files can include other files. Filenames are relative to |
|
174 | that included files can include other files. Filenames are relative to | |
175 | the configuration file in which the ``%include`` directive is found. |
|
175 | the configuration file in which the ``%include`` directive is found. | |
176 | Environment variables and ``~user`` constructs are expanded in |
|
176 | Environment variables and ``~user`` constructs are expanded in | |
177 | ``file``. This lets you do something like:: |
|
177 | ``file``. This lets you do something like:: | |
178 |
|
178 | |||
179 | %include ~/.hgrc.d/$HOST.rc |
|
179 | %include ~/.hgrc.d/$HOST.rc | |
180 |
|
180 | |||
181 | to include a different configuration file on each computer you use. |
|
181 | to include a different configuration file on each computer you use. | |
182 |
|
182 | |||
183 | A line with ``%unset name`` will remove ``name`` from the current |
|
183 | A line with ``%unset name`` will remove ``name`` from the current | |
184 | section, if it has been set previously. |
|
184 | section, if it has been set previously. | |
185 |
|
185 | |||
186 | The values are either free-form text strings, lists of text strings, |
|
186 | The values are either free-form text strings, lists of text strings, | |
187 | or Boolean values. Boolean values can be set to true using any of "1", |
|
187 | or Boolean values. Boolean values can be set to true using any of "1", | |
188 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
188 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
189 | (all case insensitive). |
|
189 | (all case insensitive). | |
190 |
|
190 | |||
191 | List values are separated by whitespace or comma, except when values are |
|
191 | List values are separated by whitespace or comma, except when values are | |
192 | placed in double quotation marks:: |
|
192 | placed in double quotation marks:: | |
193 |
|
193 | |||
194 | allow_read = "John Doe, PhD", brian, betty |
|
194 | allow_read = "John Doe, PhD", brian, betty | |
195 |
|
195 | |||
196 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
196 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
197 | quotation marks at the beginning of a word is counted as a quotation |
|
197 | quotation marks at the beginning of a word is counted as a quotation | |
198 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
198 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
199 |
|
199 | |||
200 | Sections |
|
200 | Sections | |
201 | ======== |
|
201 | ======== | |
202 |
|
202 | |||
203 | This section describes the different sections that may appear in a |
|
203 | This section describes the different sections that may appear in a | |
204 | Mercurial configuration file, the purpose of each section, its possible |
|
204 | Mercurial configuration file, the purpose of each section, its possible | |
205 | keys, and their possible values. |
|
205 | keys, and their possible values. | |
206 |
|
206 | |||
207 | ``alias`` |
|
207 | ``alias`` | |
208 | --------- |
|
208 | --------- | |
209 |
|
209 | |||
210 | Defines command aliases. |
|
210 | Defines command aliases. | |
211 |
|
211 | |||
212 | Aliases allow you to define your own commands in terms of other |
|
212 | Aliases allow you to define your own commands in terms of other | |
213 | commands (or aliases), optionally including arguments. Positional |
|
213 | commands (or aliases), optionally including arguments. Positional | |
214 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition |
|
214 | arguments in the form of ``$1``, ``$2``, etc. in the alias definition | |
215 | are expanded by Mercurial before execution. Positional arguments not |
|
215 | are expanded by Mercurial before execution. Positional arguments not | |
216 | already used by ``$N`` in the definition are put at the end of the |
|
216 | already used by ``$N`` in the definition are put at the end of the | |
217 | command to be executed. |
|
217 | command to be executed. | |
218 |
|
218 | |||
219 | Alias definitions consist of lines of the form:: |
|
219 | Alias definitions consist of lines of the form:: | |
220 |
|
220 | |||
221 | <alias> = <command> [<argument>]... |
|
221 | <alias> = <command> [<argument>]... | |
222 |
|
222 | |||
223 | For example, this definition:: |
|
223 | For example, this definition:: | |
224 |
|
224 | |||
225 | latest = log --limit 5 |
|
225 | latest = log --limit 5 | |
226 |
|
226 | |||
227 | creates a new command ``latest`` that shows only the five most recent |
|
227 | creates a new command ``latest`` that shows only the five most recent | |
228 | changesets. You can define subsequent aliases using earlier ones:: |
|
228 | changesets. You can define subsequent aliases using earlier ones:: | |
229 |
|
229 | |||
230 | stable5 = latest -b stable |
|
230 | stable5 = latest -b stable | |
231 |
|
231 | |||
232 | .. note:: |
|
232 | .. note:: | |
233 |
|
233 | |||
234 | It is possible to create aliases with the same names as |
|
234 | It is possible to create aliases with the same names as | |
235 | existing commands, which will then override the original |
|
235 | existing commands, which will then override the original | |
236 | definitions. This is almost always a bad idea! |
|
236 | definitions. This is almost always a bad idea! | |
237 |
|
237 | |||
238 | An alias can start with an exclamation point (``!``) to make it a |
|
238 | An alias can start with an exclamation point (``!``) to make it a | |
239 | shell alias. A shell alias is executed with the shell and will let you |
|
239 | shell alias. A shell alias is executed with the shell and will let you | |
240 | run arbitrary commands. As an example, :: |
|
240 | run arbitrary commands. As an example, :: | |
241 |
|
241 | |||
242 | echo = !echo $@ |
|
242 | echo = !echo $@ | |
243 |
|
243 | |||
244 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
244 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
245 | terminal. A better example might be:: |
|
245 | terminal. A better example might be:: | |
246 |
|
246 | |||
247 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
247 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm | |
248 |
|
248 | |||
249 | which will make ``hg purge`` delete all unknown files in the |
|
249 | which will make ``hg purge`` delete all unknown files in the | |
250 | repository in the same manner as the purge extension. |
|
250 | repository in the same manner as the purge extension. | |
251 |
|
251 | |||
252 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
252 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
253 | expand to the command arguments. Unmatched arguments are |
|
253 | expand to the command arguments. Unmatched arguments are | |
254 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
254 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
255 | arguments separated by a space. ``"$@"`` (with quotes) expands to all |
|
255 | arguments separated by a space. ``"$@"`` (with quotes) expands to all | |
256 | arguments quoted individually and separated by a space. These expansions |
|
256 | arguments quoted individually and separated by a space. These expansions | |
257 | happen before the command is passed to the shell. |
|
257 | happen before the command is passed to the shell. | |
258 |
|
258 | |||
259 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
259 | Shell aliases are executed in an environment where ``$HG`` expands to | |
260 | the path of the Mercurial that was used to execute the alias. This is |
|
260 | the path of the Mercurial that was used to execute the alias. This is | |
261 | useful when you want to call further Mercurial commands in a shell |
|
261 | useful when you want to call further Mercurial commands in a shell | |
262 | alias, as was done above for the purge alias. In addition, |
|
262 | alias, as was done above for the purge alias. In addition, | |
263 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
263 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
264 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
264 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
265 |
|
265 | |||
266 | .. note:: |
|
266 | .. note:: | |
267 |
|
267 | |||
268 | Some global configuration options such as ``-R`` are |
|
268 | Some global configuration options such as ``-R`` are | |
269 | processed before shell aliases and will thus not be passed to |
|
269 | processed before shell aliases and will thus not be passed to | |
270 | aliases. |
|
270 | aliases. | |
271 |
|
271 | |||
272 |
|
272 | |||
273 | ``annotate`` |
|
273 | ``annotate`` | |
274 | ------------ |
|
274 | ------------ | |
275 |
|
275 | |||
276 | Settings used when displaying file annotations. All values are |
|
276 | Settings used when displaying file annotations. All values are | |
277 | Booleans and default to False. See ``diff`` section for related |
|
277 | Booleans and default to False. See ``diff`` section for related | |
278 | options for the diff command. |
|
278 | options for the diff command. | |
279 |
|
279 | |||
280 | ``ignorews`` |
|
280 | ``ignorews`` | |
281 | Ignore white space when comparing lines. |
|
281 | Ignore white space when comparing lines. | |
282 |
|
282 | |||
283 | ``ignorewsamount`` |
|
283 | ``ignorewsamount`` | |
284 | Ignore changes in the amount of white space. |
|
284 | Ignore changes in the amount of white space. | |
285 |
|
285 | |||
286 | ``ignoreblanklines`` |
|
286 | ``ignoreblanklines`` | |
287 | Ignore changes whose lines are all blank. |
|
287 | Ignore changes whose lines are all blank. | |
288 |
|
288 | |||
289 |
|
289 | |||
290 | ``auth`` |
|
290 | ``auth`` | |
291 | -------- |
|
291 | -------- | |
292 |
|
292 | |||
293 | Authentication credentials for HTTP authentication. This section |
|
293 | Authentication credentials for HTTP authentication. This section | |
294 | allows you to store usernames and passwords for use when logging |
|
294 | allows you to store usernames and passwords for use when logging | |
295 | *into* HTTP servers. See the ``[web]`` configuration section if |
|
295 | *into* HTTP servers. See the ``[web]`` configuration section if | |
296 | you want to configure *who* can login to your HTTP server. |
|
296 | you want to configure *who* can login to your HTTP server. | |
297 |
|
297 | |||
298 | Each line has the following format:: |
|
298 | Each line has the following format:: | |
299 |
|
299 | |||
300 | <name>.<argument> = <value> |
|
300 | <name>.<argument> = <value> | |
301 |
|
301 | |||
302 | where ``<name>`` is used to group arguments into authentication |
|
302 | where ``<name>`` is used to group arguments into authentication | |
303 | entries. Example:: |
|
303 | entries. Example:: | |
304 |
|
304 | |||
305 | foo.prefix = hg.intevation.org/mercurial |
|
305 | foo.prefix = hg.intevation.org/mercurial | |
306 | foo.username = foo |
|
306 | foo.username = foo | |
307 | foo.password = bar |
|
307 | foo.password = bar | |
308 | foo.schemes = http https |
|
308 | foo.schemes = http https | |
309 |
|
309 | |||
310 | bar.prefix = secure.example.org |
|
310 | bar.prefix = secure.example.org | |
311 | bar.key = path/to/file.key |
|
311 | bar.key = path/to/file.key | |
312 | bar.cert = path/to/file.cert |
|
312 | bar.cert = path/to/file.cert | |
313 | bar.schemes = https |
|
313 | bar.schemes = https | |
314 |
|
314 | |||
315 | Supported arguments: |
|
315 | Supported arguments: | |
316 |
|
316 | |||
317 | ``prefix`` |
|
317 | ``prefix`` | |
318 | Either ``*`` or a URI prefix with or without the scheme part. |
|
318 | Either ``*`` or a URI prefix with or without the scheme part. | |
319 | The authentication entry with the longest matching prefix is used |
|
319 | The authentication entry with the longest matching prefix is used | |
320 | (where ``*`` matches everything and counts as a match of length |
|
320 | (where ``*`` matches everything and counts as a match of length | |
321 | 1). If the prefix doesn't include a scheme, the match is performed |
|
321 | 1). If the prefix doesn't include a scheme, the match is performed | |
322 | against the URI with its scheme stripped as well, and the schemes |
|
322 | against the URI with its scheme stripped as well, and the schemes | |
323 | argument, q.v., is then subsequently consulted. |
|
323 | argument, q.v., is then subsequently consulted. | |
324 |
|
324 | |||
325 | ``username`` |
|
325 | ``username`` | |
326 | Optional. Username to authenticate with. If not given, and the |
|
326 | Optional. Username to authenticate with. If not given, and the | |
327 | remote site requires basic or digest authentication, the user will |
|
327 | remote site requires basic or digest authentication, the user will | |
328 | be prompted for it. Environment variables are expanded in the |
|
328 | be prompted for it. Environment variables are expanded in the | |
329 | username letting you do ``foo.username = $USER``. If the URI |
|
329 | username letting you do ``foo.username = $USER``. If the URI | |
330 | includes a username, only ``[auth]`` entries with a matching |
|
330 | includes a username, only ``[auth]`` entries with a matching | |
331 | username or without a username will be considered. |
|
331 | username or without a username will be considered. | |
332 |
|
332 | |||
333 | ``password`` |
|
333 | ``password`` | |
334 | Optional. Password to authenticate with. If not given, and the |
|
334 | Optional. Password to authenticate with. If not given, and the | |
335 | remote site requires basic or digest authentication, the user |
|
335 | remote site requires basic or digest authentication, the user | |
336 | will be prompted for it. |
|
336 | will be prompted for it. | |
337 |
|
337 | |||
338 | ``key`` |
|
338 | ``key`` | |
339 | Optional. PEM encoded client certificate key file. Environment |
|
339 | Optional. PEM encoded client certificate key file. Environment | |
340 | variables are expanded in the filename. |
|
340 | variables are expanded in the filename. | |
341 |
|
341 | |||
342 | ``cert`` |
|
342 | ``cert`` | |
343 | Optional. PEM encoded client certificate chain file. Environment |
|
343 | Optional. PEM encoded client certificate chain file. Environment | |
344 | variables are expanded in the filename. |
|
344 | variables are expanded in the filename. | |
345 |
|
345 | |||
346 | ``schemes`` |
|
346 | ``schemes`` | |
347 | Optional. Space separated list of URI schemes to use this |
|
347 | Optional. Space separated list of URI schemes to use this | |
348 | authentication entry with. Only used if the prefix doesn't include |
|
348 | authentication entry with. Only used if the prefix doesn't include | |
349 | a scheme. Supported schemes are http and https. They will match |
|
349 | a scheme. Supported schemes are http and https. They will match | |
350 | static-http and static-https respectively, as well. |
|
350 | static-http and static-https respectively, as well. | |
351 | (default: https) |
|
351 | (default: https) | |
352 |
|
352 | |||
353 | If no suitable authentication entry is found, the user is prompted |
|
353 | If no suitable authentication entry is found, the user is prompted | |
354 | for credentials as usual if required by the remote. |
|
354 | for credentials as usual if required by the remote. | |
355 |
|
355 | |||
356 |
|
356 | |||
357 | ``committemplate`` |
|
357 | ``committemplate`` | |
358 | ------------------ |
|
358 | ------------------ | |
359 |
|
359 | |||
360 | ``changeset`` |
|
360 | ``changeset`` | |
361 | String: configuration in this section is used as the template to |
|
361 | String: configuration in this section is used as the template to | |
362 | customize the text shown in the editor when committing. |
|
362 | customize the text shown in the editor when committing. | |
363 |
|
363 | |||
364 | In addition to pre-defined template keywords, commit log specific one |
|
364 | In addition to pre-defined template keywords, commit log specific one | |
365 | below can be used for customization: |
|
365 | below can be used for customization: | |
366 |
|
366 | |||
367 | ``extramsg`` |
|
367 | ``extramsg`` | |
368 | String: Extra message (typically 'Leave message empty to abort |
|
368 | String: Extra message (typically 'Leave message empty to abort | |
369 | commit.'). This may be changed by some commands or extensions. |
|
369 | commit.'). This may be changed by some commands or extensions. | |
370 |
|
370 | |||
371 | For example, the template configuration below shows as same text as |
|
371 | For example, the template configuration below shows as same text as | |
372 | one shown by default:: |
|
372 | one shown by default:: | |
373 |
|
373 | |||
374 | [committemplate] |
|
374 | [committemplate] | |
375 | changeset = {desc}\n\n |
|
375 | changeset = {desc}\n\n | |
376 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
376 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
377 | HG: {extramsg} |
|
377 | HG: {extramsg} | |
378 | HG: -- |
|
378 | HG: -- | |
379 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
379 | HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
380 | "HG: branch merge\n") |
|
380 | "HG: branch merge\n") | |
381 | }HG: branch '{branch}'\n{if(activebookmark, |
|
381 | }HG: branch '{branch}'\n{if(activebookmark, | |
382 | "HG: bookmark '{activebookmark}'\n") }{subrepos % |
|
382 | "HG: bookmark '{activebookmark}'\n") }{subrepos % | |
383 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
383 | "HG: subrepo {subrepo}\n" }{file_adds % | |
384 | "HG: added {file}\n" }{file_mods % |
|
384 | "HG: added {file}\n" }{file_mods % | |
385 | "HG: changed {file}\n" }{file_dels % |
|
385 | "HG: changed {file}\n" }{file_dels % | |
386 | "HG: removed {file}\n" }{if(files, "", |
|
386 | "HG: removed {file}\n" }{if(files, "", | |
387 | "HG: no files changed\n")} |
|
387 | "HG: no files changed\n")} | |
388 |
|
388 | |||
389 | .. note:: |
|
389 | .. note:: | |
390 |
|
390 | |||
391 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
391 | For some problematic encodings (see :hg:`help win32mbcs` for | |
392 | detail), this customization should be configured carefully, to |
|
392 | detail), this customization should be configured carefully, to | |
393 | avoid showing broken characters. |
|
393 | avoid showing broken characters. | |
394 |
|
394 | |||
395 | For example, if multibyte character ending with backslash (0x5c) is |
|
395 | For example, if multibyte character ending with backslash (0x5c) is | |
396 | followed by ASCII character 'n' in the customized template, |
|
396 | followed by ASCII character 'n' in the customized template, | |
397 | sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
397 | sequence of backslash and 'n' is treated as line-feed unexpectedly | |
398 | (and multibyte character is broken, too). |
|
398 | (and multibyte character is broken, too). | |
399 |
|
399 | |||
400 | Customized template is used for commands below (``--edit`` may be |
|
400 | Customized template is used for commands below (``--edit`` may be | |
401 | required): |
|
401 | required): | |
402 |
|
402 | |||
403 | - :hg:`backout` |
|
403 | - :hg:`backout` | |
404 | - :hg:`commit` |
|
404 | - :hg:`commit` | |
405 | - :hg:`fetch` (for merge commit only) |
|
405 | - :hg:`fetch` (for merge commit only) | |
406 | - :hg:`graft` |
|
406 | - :hg:`graft` | |
407 | - :hg:`histedit` |
|
407 | - :hg:`histedit` | |
408 | - :hg:`import` |
|
408 | - :hg:`import` | |
409 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
409 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` | |
410 | - :hg:`rebase` |
|
410 | - :hg:`rebase` | |
411 | - :hg:`shelve` |
|
411 | - :hg:`shelve` | |
412 | - :hg:`sign` |
|
412 | - :hg:`sign` | |
413 | - :hg:`tag` |
|
413 | - :hg:`tag` | |
414 | - :hg:`transplant` |
|
414 | - :hg:`transplant` | |
415 |
|
415 | |||
416 | Configuring items below instead of ``changeset`` allows showing |
|
416 | Configuring items below instead of ``changeset`` allows showing | |
417 | customized message only for specific actions, or showing different |
|
417 | customized message only for specific actions, or showing different | |
418 | messages for each action. |
|
418 | messages for each action. | |
419 |
|
419 | |||
420 | - ``changeset.backout`` for :hg:`backout` |
|
420 | - ``changeset.backout`` for :hg:`backout` | |
421 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges |
|
421 | - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges | |
422 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other |
|
422 | - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other | |
423 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges |
|
423 | - ``changeset.commit.normal.merge`` for :hg:`commit` on merges | |
424 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other |
|
424 | - ``changeset.commit.normal.normal`` for :hg:`commit` on other | |
425 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
425 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) | |
426 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
426 | - ``changeset.gpg.sign`` for :hg:`sign` | |
427 | - ``changeset.graft`` for :hg:`graft` |
|
427 | - ``changeset.graft`` for :hg:`graft` | |
428 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
428 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` | |
429 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
429 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` | |
430 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
430 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` | |
431 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
431 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` | |
432 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
432 | - ``changeset.import.bypass`` for :hg:`import --bypass` | |
433 | - ``changeset.import.normal.merge`` for :hg:`import` on merges |
|
433 | - ``changeset.import.normal.merge`` for :hg:`import` on merges | |
434 | - ``changeset.import.normal.normal`` for :hg:`import` on other |
|
434 | - ``changeset.import.normal.normal`` for :hg:`import` on other | |
435 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
435 | - ``changeset.mq.qnew`` for :hg:`qnew` | |
436 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
436 | - ``changeset.mq.qfold`` for :hg:`qfold` | |
437 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
437 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` | |
438 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
438 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` | |
439 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges |
|
439 | - ``changeset.rebase.merge`` for :hg:`rebase` on merges | |
440 | - ``changeset.rebase.normal`` for :hg:`rebase` on other |
|
440 | - ``changeset.rebase.normal`` for :hg:`rebase` on other | |
441 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
441 | - ``changeset.shelve.shelve`` for :hg:`shelve` | |
442 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
442 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` | |
443 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
443 | - ``changeset.tag.remove`` for :hg:`tag --remove` | |
444 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges |
|
444 | - ``changeset.transplant.merge`` for :hg:`transplant` on merges | |
445 | - ``changeset.transplant.normal`` for :hg:`transplant` on other |
|
445 | - ``changeset.transplant.normal`` for :hg:`transplant` on other | |
446 |
|
446 | |||
447 | These dot-separated lists of names are treated as hierarchical ones. |
|
447 | These dot-separated lists of names are treated as hierarchical ones. | |
448 | For example, ``changeset.tag.remove`` customizes the commit message |
|
448 | For example, ``changeset.tag.remove`` customizes the commit message | |
449 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
449 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the | |
450 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
450 | commit message for :hg:`tag` regardless of ``--remove`` option. | |
451 |
|
451 | |||
452 | At the external editor invocation for committing, corresponding |
|
452 | At the external editor invocation for committing, corresponding | |
453 | dot-separated list of names without ``changeset.`` prefix |
|
453 | dot-separated list of names without ``changeset.`` prefix | |
454 | (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable. |
|
454 | (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable. | |
455 |
|
455 | |||
456 | In this section, items other than ``changeset`` can be referred from |
|
456 | In this section, items other than ``changeset`` can be referred from | |
457 | others. For example, the configuration to list committed files up |
|
457 | others. For example, the configuration to list committed files up | |
458 | below can be referred as ``{listupfiles}``:: |
|
458 | below can be referred as ``{listupfiles}``:: | |
459 |
|
459 | |||
460 | [committemplate] |
|
460 | [committemplate] | |
461 | listupfiles = {file_adds % |
|
461 | listupfiles = {file_adds % | |
462 | "HG: added {file}\n" }{file_mods % |
|
462 | "HG: added {file}\n" }{file_mods % | |
463 | "HG: changed {file}\n" }{file_dels % |
|
463 | "HG: changed {file}\n" }{file_dels % | |
464 | "HG: removed {file}\n" }{if(files, "", |
|
464 | "HG: removed {file}\n" }{if(files, "", | |
465 | "HG: no files changed\n")} |
|
465 | "HG: no files changed\n")} | |
466 |
|
466 | |||
467 | ``decode/encode`` |
|
467 | ``decode/encode`` | |
468 | ----------------- |
|
468 | ----------------- | |
469 |
|
469 | |||
470 | Filters for transforming files on checkout/checkin. This would |
|
470 | Filters for transforming files on checkout/checkin. This would | |
471 | typically be used for newline processing or other |
|
471 | typically be used for newline processing or other | |
472 | localization/canonicalization of files. |
|
472 | localization/canonicalization of files. | |
473 |
|
473 | |||
474 | Filters consist of a filter pattern followed by a filter command. |
|
474 | Filters consist of a filter pattern followed by a filter command. | |
475 | Filter patterns are globs by default, rooted at the repository root. |
|
475 | Filter patterns are globs by default, rooted at the repository root. | |
476 | For example, to match any file ending in ``.txt`` in the root |
|
476 | For example, to match any file ending in ``.txt`` in the root | |
477 | directory only, use the pattern ``*.txt``. To match any file ending |
|
477 | directory only, use the pattern ``*.txt``. To match any file ending | |
478 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
478 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
479 | For each file only the first matching filter applies. |
|
479 | For each file only the first matching filter applies. | |
480 |
|
480 | |||
481 | The filter command can start with a specifier, either ``pipe:`` or |
|
481 | The filter command can start with a specifier, either ``pipe:`` or | |
482 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
482 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
483 |
|
483 | |||
484 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
484 | A ``pipe:`` command must accept data on stdin and return the transformed | |
485 | data on stdout. |
|
485 | data on stdout. | |
486 |
|
486 | |||
487 | Pipe example:: |
|
487 | Pipe example:: | |
488 |
|
488 | |||
489 | [encode] |
|
489 | [encode] | |
490 | # uncompress gzip files on checkin to improve delta compression |
|
490 | # uncompress gzip files on checkin to improve delta compression | |
491 | # note: not necessarily a good idea, just an example |
|
491 | # note: not necessarily a good idea, just an example | |
492 | *.gz = pipe: gunzip |
|
492 | *.gz = pipe: gunzip | |
493 |
|
493 | |||
494 | [decode] |
|
494 | [decode] | |
495 | # recompress gzip files when writing them to the working dir (we |
|
495 | # recompress gzip files when writing them to the working dir (we | |
496 | # can safely omit "pipe:", because it's the default) |
|
496 | # can safely omit "pipe:", because it's the default) | |
497 | *.gz = gzip |
|
497 | *.gz = gzip | |
498 |
|
498 | |||
499 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
499 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
500 | with the name of a temporary file that contains the data to be |
|
500 | with the name of a temporary file that contains the data to be | |
501 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
501 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
502 | of an empty temporary file, where the filtered data must be written by |
|
502 | of an empty temporary file, where the filtered data must be written by | |
503 | the command. |
|
503 | the command. | |
504 |
|
504 | |||
505 | .. note:: |
|
505 | .. note:: | |
506 |
|
506 | |||
507 | The tempfile mechanism is recommended for Windows systems, |
|
507 | The tempfile mechanism is recommended for Windows systems, | |
508 | where the standard shell I/O redirection operators often have |
|
508 | where the standard shell I/O redirection operators often have | |
509 | strange effects and may corrupt the contents of your files. |
|
509 | strange effects and may corrupt the contents of your files. | |
510 |
|
510 | |||
511 | This filter mechanism is used internally by the ``eol`` extension to |
|
511 | This filter mechanism is used internally by the ``eol`` extension to | |
512 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
512 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
513 | format. We suggest you use the ``eol`` extension for convenience. |
|
513 | format. We suggest you use the ``eol`` extension for convenience. | |
514 |
|
514 | |||
515 |
|
515 | |||
516 | ``defaults`` |
|
516 | ``defaults`` | |
517 | ------------ |
|
517 | ------------ | |
518 |
|
518 | |||
519 | (defaults are deprecated. Don't use them. Use aliases instead.) |
|
519 | (defaults are deprecated. Don't use them. Use aliases instead.) | |
520 |
|
520 | |||
521 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
521 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
522 | default options/arguments to pass to the specified commands. |
|
522 | default options/arguments to pass to the specified commands. | |
523 |
|
523 | |||
524 | The following example makes :hg:`log` run in verbose mode, and |
|
524 | The following example makes :hg:`log` run in verbose mode, and | |
525 | :hg:`status` show only the modified files, by default:: |
|
525 | :hg:`status` show only the modified files, by default:: | |
526 |
|
526 | |||
527 | [defaults] |
|
527 | [defaults] | |
528 | log = -v |
|
528 | log = -v | |
529 | status = -m |
|
529 | status = -m | |
530 |
|
530 | |||
531 | The actual commands, instead of their aliases, must be used when |
|
531 | The actual commands, instead of their aliases, must be used when | |
532 | defining command defaults. The command defaults will also be applied |
|
532 | defining command defaults. The command defaults will also be applied | |
533 | to the aliases of the commands defined. |
|
533 | to the aliases of the commands defined. | |
534 |
|
534 | |||
535 |
|
535 | |||
536 | ``diff`` |
|
536 | ``diff`` | |
537 | -------- |
|
537 | -------- | |
538 |
|
538 | |||
539 | Settings used when displaying diffs. Everything except for ``unified`` |
|
539 | Settings used when displaying diffs. Everything except for ``unified`` | |
540 | is a Boolean and defaults to False. See ``annotate`` section for |
|
540 | is a Boolean and defaults to False. See ``annotate`` section for | |
541 | related options for the annotate command. |
|
541 | related options for the annotate command. | |
542 |
|
542 | |||
543 | ``git`` |
|
543 | ``git`` | |
544 | Use git extended diff format. |
|
544 | Use git extended diff format. | |
545 |
|
545 | |||
546 | ``nobinary`` |
|
546 | ``nobinary`` | |
547 | Omit git binary patches. |
|
547 | Omit git binary patches. | |
548 |
|
548 | |||
549 | ``nodates`` |
|
549 | ``nodates`` | |
550 | Don't include dates in diff headers. |
|
550 | Don't include dates in diff headers. | |
551 |
|
551 | |||
552 | ``noprefix`` |
|
552 | ``noprefix`` | |
553 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. |
|
553 | Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode. | |
554 |
|
554 | |||
555 | ``showfunc`` |
|
555 | ``showfunc`` | |
556 | Show which function each change is in. |
|
556 | Show which function each change is in. | |
557 |
|
557 | |||
558 | ``ignorews`` |
|
558 | ``ignorews`` | |
559 | Ignore white space when comparing lines. |
|
559 | Ignore white space when comparing lines. | |
560 |
|
560 | |||
561 | ``ignorewsamount`` |
|
561 | ``ignorewsamount`` | |
562 | Ignore changes in the amount of white space. |
|
562 | Ignore changes in the amount of white space. | |
563 |
|
563 | |||
564 | ``ignoreblanklines`` |
|
564 | ``ignoreblanklines`` | |
565 | Ignore changes whose lines are all blank. |
|
565 | Ignore changes whose lines are all blank. | |
566 |
|
566 | |||
567 | ``unified`` |
|
567 | ``unified`` | |
568 | Number of lines of context to show. |
|
568 | Number of lines of context to show. | |
569 |
|
569 | |||
570 | ``email`` |
|
570 | ``email`` | |
571 | --------- |
|
571 | --------- | |
572 |
|
572 | |||
573 | Settings for extensions that send email messages. |
|
573 | Settings for extensions that send email messages. | |
574 |
|
574 | |||
575 | ``from`` |
|
575 | ``from`` | |
576 | Optional. Email address to use in "From" header and SMTP envelope |
|
576 | Optional. Email address to use in "From" header and SMTP envelope | |
577 | of outgoing messages. |
|
577 | of outgoing messages. | |
578 |
|
578 | |||
579 | ``to`` |
|
579 | ``to`` | |
580 | Optional. Comma-separated list of recipients' email addresses. |
|
580 | Optional. Comma-separated list of recipients' email addresses. | |
581 |
|
581 | |||
582 | ``cc`` |
|
582 | ``cc`` | |
583 | Optional. Comma-separated list of carbon copy recipients' |
|
583 | Optional. Comma-separated list of carbon copy recipients' | |
584 | email addresses. |
|
584 | email addresses. | |
585 |
|
585 | |||
586 | ``bcc`` |
|
586 | ``bcc`` | |
587 | Optional. Comma-separated list of blind carbon copy recipients' |
|
587 | Optional. Comma-separated list of blind carbon copy recipients' | |
588 | email addresses. |
|
588 | email addresses. | |
589 |
|
589 | |||
590 | ``method`` |
|
590 | ``method`` | |
591 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
591 | Optional. Method to use to send email messages. If value is ``smtp`` | |
592 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
592 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
593 | Otherwise, use as name of program to run that acts like sendmail |
|
593 | Otherwise, use as name of program to run that acts like sendmail | |
594 | (takes ``-f`` option for sender, list of recipients on command line, |
|
594 | (takes ``-f`` option for sender, list of recipients on command line, | |
595 | message on stdin). Normally, setting this to ``sendmail`` or |
|
595 | message on stdin). Normally, setting this to ``sendmail`` or | |
596 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
596 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
597 |
|
597 | |||
598 | ``charsets`` |
|
598 | ``charsets`` | |
599 | Optional. Comma-separated list of character sets considered |
|
599 | Optional. Comma-separated list of character sets considered | |
600 | convenient for recipients. Addresses, headers, and parts not |
|
600 | convenient for recipients. Addresses, headers, and parts not | |
601 | containing patches of outgoing messages will be encoded in the |
|
601 | containing patches of outgoing messages will be encoded in the | |
602 | first character set to which conversion from local encoding |
|
602 | first character set to which conversion from local encoding | |
603 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
603 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
604 | conversion fails, the text in question is sent as is. |
|
604 | conversion fails, the text in question is sent as is. | |
605 | (default: '') |
|
605 | (default: '') | |
606 |
|
606 | |||
607 | Order of outgoing email character sets: |
|
607 | Order of outgoing email character sets: | |
608 |
|
608 | |||
609 | 1. ``us-ascii``: always first, regardless of settings |
|
609 | 1. ``us-ascii``: always first, regardless of settings | |
610 | 2. ``email.charsets``: in order given by user |
|
610 | 2. ``email.charsets``: in order given by user | |
611 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
611 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
612 | 4. ``$HGENCODING``: if not in email.charsets |
|
612 | 4. ``$HGENCODING``: if not in email.charsets | |
613 | 5. ``utf-8``: always last, regardless of settings |
|
613 | 5. ``utf-8``: always last, regardless of settings | |
614 |
|
614 | |||
615 | Email example:: |
|
615 | Email example:: | |
616 |
|
616 | |||
617 | [email] |
|
617 | [email] | |
618 | from = Joseph User <joe.user@example.com> |
|
618 | from = Joseph User <joe.user@example.com> | |
619 | method = /usr/sbin/sendmail |
|
619 | method = /usr/sbin/sendmail | |
620 | # charsets for western Europeans |
|
620 | # charsets for western Europeans | |
621 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
621 | # us-ascii, utf-8 omitted, as they are tried first and last | |
622 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
622 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
623 |
|
623 | |||
624 |
|
624 | |||
625 | ``extensions`` |
|
625 | ``extensions`` | |
626 | -------------- |
|
626 | -------------- | |
627 |
|
627 | |||
628 | Mercurial has an extension mechanism for adding new features. To |
|
628 | Mercurial has an extension mechanism for adding new features. To | |
629 | enable an extension, create an entry for it in this section. |
|
629 | enable an extension, create an entry for it in this section. | |
630 |
|
630 | |||
631 | If you know that the extension is already in Python's search path, |
|
631 | If you know that the extension is already in Python's search path, | |
632 | you can give the name of the module, followed by ``=``, with nothing |
|
632 | you can give the name of the module, followed by ``=``, with nothing | |
633 | after the ``=``. |
|
633 | after the ``=``. | |
634 |
|
634 | |||
635 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
635 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
636 | the path to the ``.py`` file (including the file name extension) that |
|
636 | the path to the ``.py`` file (including the file name extension) that | |
637 | defines the extension. |
|
637 | defines the extension. | |
638 |
|
638 | |||
639 | To explicitly disable an extension that is enabled in an hgrc of |
|
639 | To explicitly disable an extension that is enabled in an hgrc of | |
640 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
640 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
641 | or ``foo = !`` when path is not supplied. |
|
641 | or ``foo = !`` when path is not supplied. | |
642 |
|
642 | |||
643 | Example for ``~/.hgrc``:: |
|
643 | Example for ``~/.hgrc``:: | |
644 |
|
644 | |||
645 | [extensions] |
|
645 | [extensions] | |
646 | # (the color extension will get loaded from Mercurial's path) |
|
646 | # (the color extension will get loaded from Mercurial's path) | |
647 | color = |
|
647 | color = | |
648 | # (this extension will get loaded from the file specified) |
|
648 | # (this extension will get loaded from the file specified) | |
649 | myfeature = ~/.hgext/myfeature.py |
|
649 | myfeature = ~/.hgext/myfeature.py | |
650 |
|
650 | |||
651 |
|
651 | |||
652 | ``format`` |
|
652 | ``format`` | |
653 | ---------- |
|
653 | ---------- | |
654 |
|
654 | |||
655 | ``usestore`` |
|
655 | ``usestore`` | |
656 | Enable or disable the "store" repository format which improves |
|
656 | Enable or disable the "store" repository format which improves | |
657 | compatibility with systems that fold case or otherwise mangle |
|
657 | compatibility with systems that fold case or otherwise mangle | |
658 | filenames. Enabled by default. Disabling this option will allow |
|
658 | filenames. Enabled by default. Disabling this option will allow | |
659 | you to store longer filenames in some situations at the expense of |
|
659 | you to store longer filenames in some situations at the expense of | |
660 | compatibility and ensures that the on-disk format of newly created |
|
660 | compatibility and ensures that the on-disk format of newly created | |
661 | repositories will be compatible with Mercurial before version 0.9.4. |
|
661 | repositories will be compatible with Mercurial before version 0.9.4. | |
662 |
|
662 | |||
663 | ``usefncache`` |
|
663 | ``usefncache`` | |
664 | Enable or disable the "fncache" repository format which enhances |
|
664 | Enable or disable the "fncache" repository format which enhances | |
665 | the "store" repository format (which has to be enabled to use |
|
665 | the "store" repository format (which has to be enabled to use | |
666 | fncache) to allow longer filenames and avoids using Windows |
|
666 | fncache) to allow longer filenames and avoids using Windows | |
667 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
667 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
668 | option ensures that the on-disk format of newly created |
|
668 | option ensures that the on-disk format of newly created | |
669 | repositories will be compatible with Mercurial before version 1.1. |
|
669 | repositories will be compatible with Mercurial before version 1.1. | |
670 |
|
670 | |||
671 | ``dotencode`` |
|
671 | ``dotencode`` | |
672 | Enable or disable the "dotencode" repository format which enhances |
|
672 | Enable or disable the "dotencode" repository format which enhances | |
673 | the "fncache" repository format (which has to be enabled to use |
|
673 | the "fncache" repository format (which has to be enabled to use | |
674 | dotencode) to avoid issues with filenames starting with ._ on |
|
674 | dotencode) to avoid issues with filenames starting with ._ on | |
675 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
675 | Mac OS X and spaces on Windows. Enabled by default. Disabling this | |
676 | option ensures that the on-disk format of newly created |
|
676 | option ensures that the on-disk format of newly created | |
677 | repositories will be compatible with Mercurial before version 1.7. |
|
677 | repositories will be compatible with Mercurial before version 1.7. | |
678 |
|
678 | |||
679 | ``graph`` |
|
679 | ``graph`` | |
680 | --------- |
|
680 | --------- | |
681 |
|
681 | |||
682 | Web graph view configuration. This section let you change graph |
|
682 | Web graph view configuration. This section let you change graph | |
683 | elements display properties by branches, for instance to make the |
|
683 | elements display properties by branches, for instance to make the | |
684 | ``default`` branch stand out. |
|
684 | ``default`` branch stand out. | |
685 |
|
685 | |||
686 | Each line has the following format:: |
|
686 | Each line has the following format:: | |
687 |
|
687 | |||
688 | <branch>.<argument> = <value> |
|
688 | <branch>.<argument> = <value> | |
689 |
|
689 | |||
690 | where ``<branch>`` is the name of the branch being |
|
690 | where ``<branch>`` is the name of the branch being | |
691 | customized. Example:: |
|
691 | customized. Example:: | |
692 |
|
692 | |||
693 | [graph] |
|
693 | [graph] | |
694 | # 2px width |
|
694 | # 2px width | |
695 | default.width = 2 |
|
695 | default.width = 2 | |
696 | # red color |
|
696 | # red color | |
697 | default.color = FF0000 |
|
697 | default.color = FF0000 | |
698 |
|
698 | |||
699 | Supported arguments: |
|
699 | Supported arguments: | |
700 |
|
700 | |||
701 | ``width`` |
|
701 | ``width`` | |
702 | Set branch edges width in pixels. |
|
702 | Set branch edges width in pixels. | |
703 |
|
703 | |||
704 | ``color`` |
|
704 | ``color`` | |
705 | Set branch edges color in hexadecimal RGB notation. |
|
705 | Set branch edges color in hexadecimal RGB notation. | |
706 |
|
706 | |||
707 | ``hooks`` |
|
707 | ``hooks`` | |
708 | --------- |
|
708 | --------- | |
709 |
|
709 | |||
710 | Commands or Python functions that get automatically executed by |
|
710 | Commands or Python functions that get automatically executed by | |
711 | various actions such as starting or finishing a commit. Multiple |
|
711 | various actions such as starting or finishing a commit. Multiple | |
712 | hooks can be run for the same action by appending a suffix to the |
|
712 | hooks can be run for the same action by appending a suffix to the | |
713 | action. Overriding a site-wide hook can be done by changing its |
|
713 | action. Overriding a site-wide hook can be done by changing its | |
714 | value or setting it to an empty string. Hooks can be prioritized |
|
714 | value or setting it to an empty string. Hooks can be prioritized | |
715 | by adding a prefix of ``priority`` to the hook name on a new line |
|
715 | by adding a prefix of ``priority`` to the hook name on a new line | |
716 | and setting the priority. The default priority is 0. |
|
716 | and setting the priority. The default priority is 0. | |
717 |
|
717 | |||
718 | Example ``.hg/hgrc``:: |
|
718 | Example ``.hg/hgrc``:: | |
719 |
|
719 | |||
720 | [hooks] |
|
720 | [hooks] | |
721 | # update working directory after adding changesets |
|
721 | # update working directory after adding changesets | |
722 | changegroup.update = hg update |
|
722 | changegroup.update = hg update | |
723 | # do not use the site-wide hook |
|
723 | # do not use the site-wide hook | |
724 | incoming = |
|
724 | incoming = | |
725 | incoming.email = /my/email/hook |
|
725 | incoming.email = /my/email/hook | |
726 | incoming.autobuild = /my/build/hook |
|
726 | incoming.autobuild = /my/build/hook | |
727 | # force autobuild hook to run before other incoming hooks |
|
727 | # force autobuild hook to run before other incoming hooks | |
728 | priority.incoming.autobuild = 1 |
|
728 | priority.incoming.autobuild = 1 | |
729 |
|
729 | |||
730 | Most hooks are run with environment variables set that give useful |
|
730 | Most hooks are run with environment variables set that give useful | |
731 | additional information. For each hook below, the environment |
|
731 | additional information. For each hook below, the environment | |
732 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
732 | variables it is passed are listed with names of the form ``$HG_foo``. | |
733 |
|
733 | |||
734 | ``changegroup`` |
|
734 | ``changegroup`` | |
735 | Run after a changegroup has been added via push, pull or unbundle. |
|
735 | Run after a changegroup has been added via push, pull or unbundle. | |
736 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
736 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
737 | changes came is in ``$HG_URL``. |
|
737 | changes came is in ``$HG_URL``. | |
738 |
|
738 | |||
739 | ``commit`` |
|
739 | ``commit`` | |
740 | Run after a changeset has been created in the local repository. ID |
|
740 | Run after a changeset has been created in the local repository. ID | |
741 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
741 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
742 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
742 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
743 |
|
743 | |||
744 | ``incoming`` |
|
744 | ``incoming`` | |
745 | Run after a changeset has been pulled, pushed, or unbundled into |
|
745 | Run after a changeset has been pulled, pushed, or unbundled into | |
746 | the local repository. The ID of the newly arrived changeset is in |
|
746 | the local repository. The ID of the newly arrived changeset is in | |
747 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
747 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
748 |
|
748 | |||
749 | ``outgoing`` |
|
749 | ``outgoing`` | |
750 | Run after sending changes from local repository to another. ID of |
|
750 | Run after sending changes from local repository to another. ID of | |
751 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
751 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
752 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
752 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
753 |
|
753 | |||
754 | ``post-<command>`` |
|
754 | ``post-<command>`` | |
755 | Run after successful invocations of the associated command. The |
|
755 | Run after successful invocations of the associated command. The | |
756 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
756 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
757 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
757 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
758 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
758 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
759 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
759 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
760 | dictionary of options (with unspecified options set to their defaults). |
|
760 | dictionary of options (with unspecified options set to their defaults). | |
761 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
761 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
762 |
|
762 | |||
763 | ``pre-<command>`` |
|
763 | ``pre-<command>`` | |
764 | Run before executing the associated command. The contents of the |
|
764 | Run before executing the associated command. The contents of the | |
765 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
765 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
766 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
766 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
767 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
767 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
768 | is a dictionary of options (with unspecified options set to their |
|
768 | is a dictionary of options (with unspecified options set to their | |
769 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
769 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
770 | failure, the command doesn't execute and Mercurial returns the failure |
|
770 | failure, the command doesn't execute and Mercurial returns the failure | |
771 | code. |
|
771 | code. | |
772 |
|
772 | |||
773 | ``prechangegroup`` |
|
773 | ``prechangegroup`` | |
774 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
774 | Run before a changegroup is added via push, pull or unbundle. Exit | |
775 | status 0 allows the changegroup to proceed. Non-zero status will |
|
775 | status 0 allows the changegroup to proceed. Non-zero status will | |
776 | cause the push, pull or unbundle to fail. URL from which changes |
|
776 | cause the push, pull or unbundle to fail. URL from which changes | |
777 | will come is in ``$HG_URL``. |
|
777 | will come is in ``$HG_URL``. | |
778 |
|
778 | |||
779 | ``precommit`` |
|
779 | ``precommit`` | |
780 | Run before starting a local commit. Exit status 0 allows the |
|
780 | Run before starting a local commit. Exit status 0 allows the | |
781 | commit to proceed. Non-zero status will cause the commit to fail. |
|
781 | commit to proceed. Non-zero status will cause the commit to fail. | |
782 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
782 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
783 |
|
783 | |||
784 | ``prelistkeys`` |
|
784 | ``prelistkeys`` | |
785 | Run before listing pushkeys (like bookmarks) in the |
|
785 | Run before listing pushkeys (like bookmarks) in the | |
786 | repository. Non-zero status will cause failure. The key namespace is |
|
786 | repository. Non-zero status will cause failure. The key namespace is | |
787 | in ``$HG_NAMESPACE``. |
|
787 | in ``$HG_NAMESPACE``. | |
788 |
|
788 | |||
789 | ``preoutgoing`` |
|
789 | ``preoutgoing`` | |
790 | Run before collecting changes to send from the local repository to |
|
790 | Run before collecting changes to send from the local repository to | |
791 | another. Non-zero status will cause failure. This lets you prevent |
|
791 | another. Non-zero status will cause failure. This lets you prevent | |
792 | pull over HTTP or SSH. Also prevents against local pull, push |
|
792 | pull over HTTP or SSH. Also prevents against local pull, push | |
793 | (outbound) or bundle commands, but not effective, since you can |
|
793 | (outbound) or bundle commands, but not effective, since you can | |
794 | just copy files instead then. Source of operation is in |
|
794 | just copy files instead then. Source of operation is in | |
795 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
795 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
796 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
796 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
797 | is happening on behalf of repository on same system. |
|
797 | is happening on behalf of repository on same system. | |
798 |
|
798 | |||
799 | ``prepushkey`` |
|
799 | ``prepushkey`` | |
800 | Run before a pushkey (like a bookmark) is added to the |
|
800 | Run before a pushkey (like a bookmark) is added to the | |
801 | repository. Non-zero status will cause the key to be rejected. The |
|
801 | repository. Non-zero status will cause the key to be rejected. The | |
802 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
802 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
803 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
803 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
804 | ``$HG_NEW``. |
|
804 | ``$HG_NEW``. | |
805 |
|
805 | |||
806 | ``pretag`` |
|
806 | ``pretag`` | |
807 | Run before creating a tag. Exit status 0 allows the tag to be |
|
807 | Run before creating a tag. Exit status 0 allows the tag to be | |
808 | created. Non-zero status will cause the tag to fail. ID of |
|
808 | created. Non-zero status will cause the tag to fail. ID of | |
809 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
809 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
810 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
810 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
811 |
|
811 | |||
812 | ``pretxnopen`` |
|
812 | ``pretxnopen`` | |
813 | Run before any new repository transaction is open. The reason for the |
|
813 | Run before any new repository transaction is open. The reason for the | |
814 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the |
|
814 | transaction will be in ``$HG_TXNNAME`` and a unique identifier for the | |
815 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the |
|
815 | transaction will be in ``HG_TXNID``. A non-zero status will prevent the | |
816 | transaction from being opened. |
|
816 | transaction from being opened. | |
817 |
|
817 | |||
818 | ``pretxnclose`` |
|
818 | ``pretxnclose`` | |
819 | Run right before the transaction is actually finalized. Any |
|
819 | Run right before the transaction is actually finalized. Any | |
820 | repository change will be visible to the hook program. This lets you |
|
820 | repository change will be visible to the hook program. This lets you | |
821 | validate the transaction content or change it. Exit status 0 allows |
|
821 | validate the transaction content or change it. Exit status 0 allows | |
822 | the commit to proceed. Non-zero status will cause the transaction to |
|
822 | the commit to proceed. Non-zero status will cause the transaction to | |
823 | be rolled back. The reason for the transaction opening will be in |
|
823 | be rolled back. The reason for the transaction opening will be in | |
824 | ``$HG_TXNNAME`` and a unique identifier for the transaction will be in |
|
824 | ``$HG_TXNNAME`` and a unique identifier for the transaction will be in | |
825 | ``HG_TXNID``. The rest of the available data will vary according the |
|
825 | ``HG_TXNID``. The rest of the available data will vary according the | |
826 | transaction type. New changesets will add ``$HG_NODE`` (id of the |
|
826 | transaction type. New changesets will add ``$HG_NODE`` (id of the | |
827 | first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, |
|
827 | first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, | |
828 | bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and |
|
828 | bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and | |
829 | ``HG_PHASES_MOVED`` to ``1``, etc. |
|
829 | ``HG_PHASES_MOVED`` to ``1``, etc. | |
830 |
|
830 | |||
831 | ``txnclose`` |
|
831 | ``txnclose`` | |
832 | Run after any repository transaction has been committed. At this |
|
832 | Run after any repository transaction has been committed. At this | |
833 | point, the transaction can no longer be rolled back. The hook will run |
|
833 | point, the transaction can no longer be rolled back. The hook will run | |
834 | after the lock is released. See ``pretxnclose`` docs for details about |
|
834 | after the lock is released. See ``pretxnclose`` docs for details about | |
835 | available variables. |
|
835 | available variables. | |
836 |
|
836 | |||
837 | ``txnabort`` |
|
837 | ``txnabort`` | |
838 | Run when a transaction is aborted. See ``pretxnclose`` docs for details about |
|
838 | Run when a transaction is aborted. See ``pretxnclose`` docs for details about | |
839 | available variables. |
|
839 | available variables. | |
840 |
|
840 | |||
841 | ``pretxnchangegroup`` |
|
841 | ``pretxnchangegroup`` | |
842 | Run after a changegroup has been added via push, pull or unbundle, |
|
842 | Run after a changegroup has been added via push, pull or unbundle, | |
843 | but before the transaction has been committed. Changegroup is |
|
843 | but before the transaction has been committed. Changegroup is | |
844 | visible to hook program. This lets you validate incoming changes |
|
844 | visible to hook program. This lets you validate incoming changes | |
845 | before accepting them. Passed the ID of the first new changeset in |
|
845 | before accepting them. Passed the ID of the first new changeset in | |
846 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
846 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
847 | status will cause the transaction to be rolled back and the push, |
|
847 | status will cause the transaction to be rolled back and the push, | |
848 | pull or unbundle will fail. URL that was source of changes is in |
|
848 | pull or unbundle will fail. URL that was source of changes is in | |
849 | ``$HG_URL``. |
|
849 | ``$HG_URL``. | |
850 |
|
850 | |||
851 | ``pretxncommit`` |
|
851 | ``pretxncommit`` | |
852 | Run after a changeset has been created but the transaction not yet |
|
852 | Run after a changeset has been created but the transaction not yet | |
853 | committed. Changeset is visible to hook program. This lets you |
|
853 | committed. Changeset is visible to hook program. This lets you | |
854 | validate commit message and changes. Exit status 0 allows the |
|
854 | validate commit message and changes. Exit status 0 allows the | |
855 | commit to proceed. Non-zero status will cause the transaction to |
|
855 | commit to proceed. Non-zero status will cause the transaction to | |
856 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
856 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
857 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
857 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
858 |
|
858 | |||
859 | ``preupdate`` |
|
859 | ``preupdate`` | |
860 | Run before updating the working directory. Exit status 0 allows |
|
860 | Run before updating the working directory. Exit status 0 allows | |
861 | the update to proceed. Non-zero status will prevent the update. |
|
861 | the update to proceed. Non-zero status will prevent the update. | |
862 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
862 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
863 | of second new parent is in ``$HG_PARENT2``. |
|
863 | of second new parent is in ``$HG_PARENT2``. | |
864 |
|
864 | |||
865 | ``listkeys`` |
|
865 | ``listkeys`` | |
866 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
866 | Run after listing pushkeys (like bookmarks) in the repository. The | |
867 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
867 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
868 | dictionary containing the keys and values. |
|
868 | dictionary containing the keys and values. | |
869 |
|
869 | |||
870 | ``pushkey`` |
|
870 | ``pushkey`` | |
871 | Run after a pushkey (like a bookmark) is added to the |
|
871 | Run after a pushkey (like a bookmark) is added to the | |
872 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
872 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
873 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
873 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
874 | value is in ``$HG_NEW``. |
|
874 | value is in ``$HG_NEW``. | |
875 |
|
875 | |||
876 | ``tag`` |
|
876 | ``tag`` | |
877 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
877 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
878 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
878 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
879 | repository if ``$HG_LOCAL=0``. |
|
879 | repository if ``$HG_LOCAL=0``. | |
880 |
|
880 | |||
881 | ``update`` |
|
881 | ``update`` | |
882 | Run after updating the working directory. Changeset ID of first |
|
882 | Run after updating the working directory. Changeset ID of first | |
883 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
883 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
884 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
884 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
885 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
885 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
886 |
|
886 | |||
887 | .. note:: |
|
887 | .. note:: | |
888 |
|
888 | |||
889 | It is generally better to use standard hooks rather than the |
|
889 | It is generally better to use standard hooks rather than the | |
890 | generic pre- and post- command hooks as they are guaranteed to be |
|
890 | generic pre- and post- command hooks as they are guaranteed to be | |
891 | called in the appropriate contexts for influencing transactions. |
|
891 | called in the appropriate contexts for influencing transactions. | |
892 | Also, hooks like "commit" will be called in all contexts that |
|
892 | Also, hooks like "commit" will be called in all contexts that | |
893 | generate a commit (e.g. tag) and not just the commit command. |
|
893 | generate a commit (e.g. tag) and not just the commit command. | |
894 |
|
894 | |||
895 | .. note:: |
|
895 | .. note:: | |
896 |
|
896 | |||
897 | Environment variables with empty values may not be passed to |
|
897 | Environment variables with empty values may not be passed to | |
898 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
898 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
899 | will have an empty value under Unix-like platforms for non-merge |
|
899 | will have an empty value under Unix-like platforms for non-merge | |
900 | changesets, while it will not be available at all under Windows. |
|
900 | changesets, while it will not be available at all under Windows. | |
901 |
|
901 | |||
902 | The syntax for Python hooks is as follows:: |
|
902 | The syntax for Python hooks is as follows:: | |
903 |
|
903 | |||
904 | hookname = python:modulename.submodule.callable |
|
904 | hookname = python:modulename.submodule.callable | |
905 | hookname = python:/path/to/python/module.py:callable |
|
905 | hookname = python:/path/to/python/module.py:callable | |
906 |
|
906 | |||
907 | Python hooks are run within the Mercurial process. Each hook is |
|
907 | Python hooks are run within the Mercurial process. Each hook is | |
908 | called with at least three keyword arguments: a ui object (keyword |
|
908 | called with at least three keyword arguments: a ui object (keyword | |
909 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
909 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
910 | keyword that tells what kind of hook is used. Arguments listed as |
|
910 | keyword that tells what kind of hook is used. Arguments listed as | |
911 | environment variables above are passed as keyword arguments, with no |
|
911 | environment variables above are passed as keyword arguments, with no | |
912 | ``HG_`` prefix, and names in lower case. |
|
912 | ``HG_`` prefix, and names in lower case. | |
913 |
|
913 | |||
914 | If a Python hook returns a "true" value or raises an exception, this |
|
914 | If a Python hook returns a "true" value or raises an exception, this | |
915 | is treated as a failure. |
|
915 | is treated as a failure. | |
916 |
|
916 | |||
917 |
|
917 | |||
918 | ``hostfingerprints`` |
|
918 | ``hostfingerprints`` | |
919 | -------------------- |
|
919 | -------------------- | |
920 |
|
920 | |||
921 | Fingerprints of the certificates of known HTTPS servers. |
|
921 | Fingerprints of the certificates of known HTTPS servers. | |
922 | A HTTPS connection to a server with a fingerprint configured here will |
|
922 | A HTTPS connection to a server with a fingerprint configured here will | |
923 | only succeed if the servers certificate matches the fingerprint. |
|
923 | only succeed if the servers certificate matches the fingerprint. | |
924 | This is very similar to how ssh known hosts works. |
|
924 | This is very similar to how ssh known hosts works. | |
925 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
925 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
926 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
926 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
927 |
|
927 | |||
928 | For example:: |
|
928 | For example:: | |
929 |
|
929 | |||
930 | [hostfingerprints] |
|
930 | [hostfingerprints] | |
931 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 |
|
931 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 | |
932 |
|
932 | |||
933 | This feature is only supported when using Python 2.6 or later. |
|
933 | This feature is only supported when using Python 2.6 or later. | |
934 |
|
934 | |||
935 |
|
935 | |||
936 | ``http_proxy`` |
|
936 | ``http_proxy`` | |
937 | -------------- |
|
937 | -------------- | |
938 |
|
938 | |||
939 | Used to access web-based Mercurial repositories through a HTTP |
|
939 | Used to access web-based Mercurial repositories through a HTTP | |
940 | proxy. |
|
940 | proxy. | |
941 |
|
941 | |||
942 | ``host`` |
|
942 | ``host`` | |
943 | Host name and (optional) port of the proxy server, for example |
|
943 | Host name and (optional) port of the proxy server, for example | |
944 | "myproxy:8000". |
|
944 | "myproxy:8000". | |
945 |
|
945 | |||
946 | ``no`` |
|
946 | ``no`` | |
947 | Optional. Comma-separated list of host names that should bypass |
|
947 | Optional. Comma-separated list of host names that should bypass | |
948 | the proxy. |
|
948 | the proxy. | |
949 |
|
949 | |||
950 | ``passwd`` |
|
950 | ``passwd`` | |
951 | Optional. Password to authenticate with at the proxy server. |
|
951 | Optional. Password to authenticate with at the proxy server. | |
952 |
|
952 | |||
953 | ``user`` |
|
953 | ``user`` | |
954 | Optional. User name to authenticate with at the proxy server. |
|
954 | Optional. User name to authenticate with at the proxy server. | |
955 |
|
955 | |||
956 | ``always`` |
|
956 | ``always`` | |
957 | Optional. Always use the proxy, even for localhost and any entries |
|
957 | Optional. Always use the proxy, even for localhost and any entries | |
958 | in ``http_proxy.no``. True or False. (default: False) |
|
958 | in ``http_proxy.no``. True or False. (default: False) | |
959 |
|
959 | |||
960 | ``merge-patterns`` |
|
960 | ``merge-patterns`` | |
961 | ------------------ |
|
961 | ------------------ | |
962 |
|
962 | |||
963 | This section specifies merge tools to associate with particular file |
|
963 | This section specifies merge tools to associate with particular file | |
964 | patterns. Tools matched here will take precedence over the default |
|
964 | patterns. Tools matched here will take precedence over the default | |
965 | merge tool. Patterns are globs by default, rooted at the repository |
|
965 | merge tool. Patterns are globs by default, rooted at the repository | |
966 | root. |
|
966 | root. | |
967 |
|
967 | |||
968 | Example:: |
|
968 | Example:: | |
969 |
|
969 | |||
970 | [merge-patterns] |
|
970 | [merge-patterns] | |
971 | **.c = kdiff3 |
|
971 | **.c = kdiff3 | |
972 | **.jpg = myimgmerge |
|
972 | **.jpg = myimgmerge | |
973 |
|
973 | |||
974 | ``merge-tools`` |
|
974 | ``merge-tools`` | |
975 | --------------- |
|
975 | --------------- | |
976 |
|
976 | |||
977 | This section configures external merge tools to use for file-level |
|
977 | This section configures external merge tools to use for file-level | |
978 | merges. This section has likely been preconfigured at install time. |
|
978 | merges. This section has likely been preconfigured at install time. | |
979 | Use :hg:`config merge-tools` to check the existing configuration. |
|
979 | Use :hg:`config merge-tools` to check the existing configuration. | |
980 | Also see :hg:`help merge-tools` for more details. |
|
980 | Also see :hg:`help merge-tools` for more details. | |
981 |
|
981 | |||
982 | Example ``~/.hgrc``:: |
|
982 | Example ``~/.hgrc``:: | |
983 |
|
983 | |||
984 | [merge-tools] |
|
984 | [merge-tools] | |
985 | # Override stock tool location |
|
985 | # Override stock tool location | |
986 | kdiff3.executable = ~/bin/kdiff3 |
|
986 | kdiff3.executable = ~/bin/kdiff3 | |
987 | # Specify command line |
|
987 | # Specify command line | |
988 | kdiff3.args = $base $local $other -o $output |
|
988 | kdiff3.args = $base $local $other -o $output | |
989 | # Give higher priority |
|
989 | # Give higher priority | |
990 | kdiff3.priority = 1 |
|
990 | kdiff3.priority = 1 | |
991 |
|
991 | |||
992 | # Changing the priority of preconfigured tool |
|
992 | # Changing the priority of preconfigured tool | |
993 | vimdiff.priority = 0 |
|
993 | vimdiff.priority = 0 | |
994 |
|
994 | |||
995 | # Define new tool |
|
995 | # Define new tool | |
996 | myHtmlTool.args = -m $local $other $base $output |
|
996 | myHtmlTool.args = -m $local $other $base $output | |
997 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
997 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
998 | myHtmlTool.priority = 1 |
|
998 | myHtmlTool.priority = 1 | |
999 |
|
999 | |||
1000 | Supported arguments: |
|
1000 | Supported arguments: | |
1001 |
|
1001 | |||
1002 | ``priority`` |
|
1002 | ``priority`` | |
1003 | The priority in which to evaluate this tool. |
|
1003 | The priority in which to evaluate this tool. | |
1004 | (default: 0) |
|
1004 | (default: 0) | |
1005 |
|
1005 | |||
1006 | ``executable`` |
|
1006 | ``executable`` | |
1007 | Either just the name of the executable or its pathname. On Windows, |
|
1007 | Either just the name of the executable or its pathname. On Windows, | |
1008 | the path can use environment variables with ${ProgramFiles} syntax. |
|
1008 | the path can use environment variables with ${ProgramFiles} syntax. | |
1009 | (default: the tool name) |
|
1009 | (default: the tool name) | |
1010 |
|
1010 | |||
1011 | ``args`` |
|
1011 | ``args`` | |
1012 | The arguments to pass to the tool executable. You can refer to the |
|
1012 | The arguments to pass to the tool executable. You can refer to the | |
1013 | files being merged as well as the output file through these |
|
1013 | files being merged as well as the output file through these | |
1014 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
1014 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning | |
1015 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
1015 | of ``$local`` and ``$other`` can vary depending on which action is being | |
1016 | performed. During and update or merge, ``$local`` represents the original |
|
1016 | performed. During and update or merge, ``$local`` represents the original | |
1017 | state of the file, while ``$other`` represents the commit you are updating |
|
1017 | state of the file, while ``$other`` represents the commit you are updating | |
1018 | to or the commit you are merging with. During a rebase ``$local`` |
|
1018 | to or the commit you are merging with. During a rebase ``$local`` | |
1019 | represents the destination of the rebase, and ``$other`` represents the |
|
1019 | represents the destination of the rebase, and ``$other`` represents the | |
1020 | commit being rebased. |
|
1020 | commit being rebased. | |
1021 | (default: ``$local $base $other``) |
|
1021 | (default: ``$local $base $other``) | |
1022 |
|
1022 | |||
1023 | ``premerge`` |
|
1023 | ``premerge`` | |
1024 | Attempt to run internal non-interactive 3-way merge tool before |
|
1024 | Attempt to run internal non-interactive 3-way merge tool before | |
1025 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
1025 | launching external tool. Options are ``true``, ``false``, ``keep`` or | |
1026 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
1026 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the | |
1027 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
1027 | premerge fails. The ``keep-merge3`` will do the same but include information | |
1028 | about the base of the merge in the marker (see internal :merge3 in |
|
1028 | about the base of the merge in the marker (see internal :merge3 in | |
1029 | :hg:`help merge-tools`). |
|
1029 | :hg:`help merge-tools`). | |
1030 | (default: True) |
|
1030 | (default: True) | |
1031 |
|
1031 | |||
1032 | ``binary`` |
|
1032 | ``binary`` | |
1033 | This tool can merge binary files. (default: False, unless tool |
|
1033 | This tool can merge binary files. (default: False, unless tool | |
1034 | was selected by file pattern match) |
|
1034 | was selected by file pattern match) | |
1035 |
|
1035 | |||
1036 | ``symlink`` |
|
1036 | ``symlink`` | |
1037 | This tool can merge symlinks. (default: False) |
|
1037 | This tool can merge symlinks. (default: False) | |
1038 |
|
1038 | |||
1039 | ``check`` |
|
1039 | ``check`` | |
1040 | A list of merge success-checking options: |
|
1040 | A list of merge success-checking options: | |
1041 |
|
1041 | |||
1042 | ``changed`` |
|
1042 | ``changed`` | |
1043 | Ask whether merge was successful when the merged file shows no changes. |
|
1043 | Ask whether merge was successful when the merged file shows no changes. | |
1044 | ``conflicts`` |
|
1044 | ``conflicts`` | |
1045 | Check whether there are conflicts even though the tool reported success. |
|
1045 | Check whether there are conflicts even though the tool reported success. | |
1046 | ``prompt`` |
|
1046 | ``prompt`` | |
1047 | Always prompt for merge success, regardless of success reported by tool. |
|
1047 | Always prompt for merge success, regardless of success reported by tool. | |
1048 |
|
1048 | |||
1049 | ``fixeol`` |
|
1049 | ``fixeol`` | |
1050 | Attempt to fix up EOL changes caused by the merge tool. |
|
1050 | Attempt to fix up EOL changes caused by the merge tool. | |
1051 | (default: False) |
|
1051 | (default: False) | |
1052 |
|
1052 | |||
1053 | ``gui`` |
|
1053 | ``gui`` | |
1054 | This tool requires a graphical interface to run. (default: False) |
|
1054 | This tool requires a graphical interface to run. (default: False) | |
1055 |
|
1055 | |||
1056 | ``regkey`` |
|
1056 | ``regkey`` | |
1057 | Windows registry key which describes install location of this |
|
1057 | Windows registry key which describes install location of this | |
1058 | tool. Mercurial will search for this key first under |
|
1058 | tool. Mercurial will search for this key first under | |
1059 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
1059 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
1060 | (default: None) |
|
1060 | (default: None) | |
1061 |
|
1061 | |||
1062 | ``regkeyalt`` |
|
1062 | ``regkeyalt`` | |
1063 | An alternate Windows registry key to try if the first key is not |
|
1063 | An alternate Windows registry key to try if the first key is not | |
1064 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
1064 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
1065 | semantics of the primary key. The most common use for this key |
|
1065 | semantics of the primary key. The most common use for this key | |
1066 | is to search for 32bit applications on 64bit operating systems. |
|
1066 | is to search for 32bit applications on 64bit operating systems. | |
1067 | (default: None) |
|
1067 | (default: None) | |
1068 |
|
1068 | |||
1069 | ``regname`` |
|
1069 | ``regname`` | |
1070 | Name of value to read from specified registry key. |
|
1070 | Name of value to read from specified registry key. | |
1071 | (default: the unnamed (default) value) |
|
1071 | (default: the unnamed (default) value) | |
1072 |
|
1072 | |||
1073 | ``regappend`` |
|
1073 | ``regappend`` | |
1074 | String to append to the value read from the registry, typically |
|
1074 | String to append to the value read from the registry, typically | |
1075 | the executable name of the tool. |
|
1075 | the executable name of the tool. | |
1076 | (default: None) |
|
1076 | (default: None) | |
1077 |
|
1077 | |||
1078 |
|
1078 | |||
1079 | ``patch`` |
|
1079 | ``patch`` | |
1080 | --------- |
|
1080 | --------- | |
1081 |
|
1081 | |||
1082 | Settings used when applying patches, for instance through the 'import' |
|
1082 | Settings used when applying patches, for instance through the 'import' | |
1083 | command or with Mercurial Queues extension. |
|
1083 | command or with Mercurial Queues extension. | |
1084 |
|
1084 | |||
1085 | ``eol`` |
|
1085 | ``eol`` | |
1086 | When set to 'strict' patch content and patched files end of lines |
|
1086 | When set to 'strict' patch content and patched files end of lines | |
1087 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1087 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
1088 | lines are ignored when patching and the result line endings are |
|
1088 | lines are ignored when patching and the result line endings are | |
1089 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1089 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
1090 | ``auto``, end of lines are again ignored while patching but line |
|
1090 | ``auto``, end of lines are again ignored while patching but line | |
1091 | endings in patched files are normalized to their original setting |
|
1091 | endings in patched files are normalized to their original setting | |
1092 | on a per-file basis. If target file does not exist or has no end |
|
1092 | on a per-file basis. If target file does not exist or has no end | |
1093 | of line, patch line endings are preserved. |
|
1093 | of line, patch line endings are preserved. | |
1094 | (default: strict) |
|
1094 | (default: strict) | |
1095 |
|
1095 | |||
1096 | ``fuzz`` |
|
1096 | ``fuzz`` | |
1097 | The number of lines of 'fuzz' to allow when applying patches. This |
|
1097 | The number of lines of 'fuzz' to allow when applying patches. This | |
1098 | controls how much context the patcher is allowed to ignore when |
|
1098 | controls how much context the patcher is allowed to ignore when | |
1099 | trying to apply a patch. |
|
1099 | trying to apply a patch. | |
1100 | (default: 2) |
|
1100 | (default: 2) | |
1101 |
|
1101 | |||
1102 | ``paths`` |
|
1102 | ``paths`` | |
1103 | --------- |
|
1103 | --------- | |
1104 |
|
1104 | |||
1105 | Assigns symbolic names to repositories. The left side is the |
|
1105 | Assigns symbolic names to repositories. The left side is the | |
1106 | symbolic name, and the right gives the directory or URL that is the |
|
1106 | symbolic name, and the right gives the directory or URL that is the | |
1107 | location of the repository. Default paths can be declared by setting |
|
1107 | location of the repository. Default paths can be declared by setting | |
1108 | the following entries. |
|
1108 | the following entries. | |
1109 |
|
1109 | |||
1110 | ``default`` |
|
1110 | ``default`` | |
1111 | Directory or URL to use when pulling if no source is specified. |
|
1111 | Directory or URL to use when pulling if no source is specified. | |
1112 | (default: repository from which the current repository was cloned) |
|
1112 | (default: repository from which the current repository was cloned) | |
1113 |
|
1113 | |||
1114 | ``default-push`` |
|
1114 | ``default-push`` | |
1115 | Optional. Directory or URL to use when pushing if no destination |
|
1115 | Optional. Directory or URL to use when pushing if no destination | |
1116 | is specified. |
|
1116 | is specified. | |
1117 |
|
1117 | |||
1118 | Custom paths can be defined by assigning the path to a name that later can be |
|
1118 | Custom paths can be defined by assigning the path to a name that later can be | |
1119 | used from the command line. Example:: |
|
1119 | used from the command line. Example:: | |
1120 |
|
1120 | |||
1121 | [paths] |
|
1121 | [paths] | |
1122 | my_path = http://example.com/path |
|
1122 | my_path = http://example.com/path | |
1123 |
|
1123 | |||
1124 | To push to the path defined in ``my_path`` run the command:: |
|
1124 | To push to the path defined in ``my_path`` run the command:: | |
1125 |
|
1125 | |||
1126 | hg push my_path |
|
1126 | hg push my_path | |
1127 |
|
1127 | |||
1128 |
|
1128 | |||
1129 | ``phases`` |
|
1129 | ``phases`` | |
1130 | ---------- |
|
1130 | ---------- | |
1131 |
|
1131 | |||
1132 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1132 | Specifies default handling of phases. See :hg:`help phases` for more | |
1133 | information about working with phases. |
|
1133 | information about working with phases. | |
1134 |
|
1134 | |||
1135 | ``publish`` |
|
1135 | ``publish`` | |
1136 | Controls draft phase behavior when working as a server. When true, |
|
1136 | Controls draft phase behavior when working as a server. When true, | |
1137 | pushed changesets are set to public in both client and server and |
|
1137 | pushed changesets are set to public in both client and server and | |
1138 | pulled or cloned changesets are set to public in the client. |
|
1138 | pulled or cloned changesets are set to public in the client. | |
1139 | (default: True) |
|
1139 | (default: True) | |
1140 |
|
1140 | |||
1141 | ``new-commit`` |
|
1141 | ``new-commit`` | |
1142 | Phase of newly-created commits. |
|
1142 | Phase of newly-created commits. | |
1143 | (default: draft) |
|
1143 | (default: draft) | |
1144 |
|
1144 | |||
1145 | ``checksubrepos`` |
|
1145 | ``checksubrepos`` | |
1146 | Check the phase of the current revision of each subrepository. Allowed |
|
1146 | Check the phase of the current revision of each subrepository. Allowed | |
1147 | values are "ignore", "follow" and "abort". For settings other than |
|
1147 | values are "ignore", "follow" and "abort". For settings other than | |
1148 | "ignore", the phase of the current revision of each subrepository is |
|
1148 | "ignore", the phase of the current revision of each subrepository is | |
1149 | checked before committing the parent repository. If any of those phases is |
|
1149 | checked before committing the parent repository. If any of those phases is | |
1150 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1150 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
1151 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1151 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
1152 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1152 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
1153 | used for the parent repository commit (if set to "follow"). |
|
1153 | used for the parent repository commit (if set to "follow"). | |
1154 | (default: follow) |
|
1154 | (default: follow) | |
1155 |
|
1155 | |||
1156 |
|
1156 | |||
1157 | ``profiling`` |
|
1157 | ``profiling`` | |
1158 | ------------- |
|
1158 | ------------- | |
1159 |
|
1159 | |||
1160 | Specifies profiling type, format, and file output. Two profilers are |
|
1160 | Specifies profiling type, format, and file output. Two profilers are | |
1161 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1161 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
1162 | profiler (named ``stat``). |
|
1162 | profiler (named ``stat``). | |
1163 |
|
1163 | |||
1164 | In this section description, 'profiling data' stands for the raw data |
|
1164 | In this section description, 'profiling data' stands for the raw data | |
1165 | collected during profiling, while 'profiling report' stands for a |
|
1165 | collected during profiling, while 'profiling report' stands for a | |
1166 | statistical text report generated from the profiling data. The |
|
1166 | statistical text report generated from the profiling data. The | |
1167 | profiling is done using lsprof. |
|
1167 | profiling is done using lsprof. | |
1168 |
|
1168 | |||
1169 | ``type`` |
|
1169 | ``type`` | |
1170 | The type of profiler to use. |
|
1170 | The type of profiler to use. | |
1171 | (default: ls) |
|
1171 | (default: ls) | |
1172 |
|
1172 | |||
1173 | ``ls`` |
|
1173 | ``ls`` | |
1174 | Use Python's built-in instrumenting profiler. This profiler |
|
1174 | Use Python's built-in instrumenting profiler. This profiler | |
1175 | works on all platforms, but each line number it reports is the |
|
1175 | works on all platforms, but each line number it reports is the | |
1176 | first line of a function. This restriction makes it difficult to |
|
1176 | first line of a function. This restriction makes it difficult to | |
1177 | identify the expensive parts of a non-trivial function. |
|
1177 | identify the expensive parts of a non-trivial function. | |
1178 | ``stat`` |
|
1178 | ``stat`` | |
1179 | Use a third-party statistical profiler, statprof. This profiler |
|
1179 | Use a third-party statistical profiler, statprof. This profiler | |
1180 | currently runs only on Unix systems, and is most useful for |
|
1180 | currently runs only on Unix systems, and is most useful for | |
1181 | profiling commands that run for longer than about 0.1 seconds. |
|
1181 | profiling commands that run for longer than about 0.1 seconds. | |
1182 |
|
1182 | |||
1183 | ``format`` |
|
1183 | ``format`` | |
1184 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1184 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
1185 | (default: text) |
|
1185 | (default: text) | |
1186 |
|
1186 | |||
1187 | ``text`` |
|
1187 | ``text`` | |
1188 | Generate a profiling report. When saving to a file, it should be |
|
1188 | Generate a profiling report. When saving to a file, it should be | |
1189 | noted that only the report is saved, and the profiling data is |
|
1189 | noted that only the report is saved, and the profiling data is | |
1190 | not kept. |
|
1190 | not kept. | |
1191 | ``kcachegrind`` |
|
1191 | ``kcachegrind`` | |
1192 | Format profiling data for kcachegrind use: when saving to a |
|
1192 | Format profiling data for kcachegrind use: when saving to a | |
1193 | file, the generated file can directly be loaded into |
|
1193 | file, the generated file can directly be loaded into | |
1194 | kcachegrind. |
|
1194 | kcachegrind. | |
1195 |
|
1195 | |||
1196 | ``frequency`` |
|
1196 | ``frequency`` | |
1197 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1197 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1198 | (default: 1000) |
|
1198 | (default: 1000) | |
1199 |
|
1199 | |||
1200 | ``output`` |
|
1200 | ``output`` | |
1201 | File path where profiling data or report should be saved. If the |
|
1201 | File path where profiling data or report should be saved. If the | |
1202 | file exists, it is replaced. (default: None, data is printed on |
|
1202 | file exists, it is replaced. (default: None, data is printed on | |
1203 | stderr) |
|
1203 | stderr) | |
1204 |
|
1204 | |||
1205 | ``sort`` |
|
1205 | ``sort`` | |
1206 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1206 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1207 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1207 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1208 | ``inlinetime``. |
|
1208 | ``inlinetime``. | |
1209 | (default: inlinetime) |
|
1209 | (default: inlinetime) | |
1210 |
|
1210 | |||
1211 | ``limit`` |
|
1211 | ``limit`` | |
1212 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1212 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1213 | (default: 30) |
|
1213 | (default: 30) | |
1214 |
|
1214 | |||
1215 | ``nested`` |
|
1215 | ``nested`` | |
1216 | Show at most this number of lines of drill-down info after each main entry. |
|
1216 | Show at most this number of lines of drill-down info after each main entry. | |
1217 | This can help explain the difference between Total and Inline. |
|
1217 | This can help explain the difference between Total and Inline. | |
1218 | Specific to the ``ls`` instrumenting profiler. |
|
1218 | Specific to the ``ls`` instrumenting profiler. | |
1219 | (default: 5) |
|
1219 | (default: 5) | |
1220 |
|
1220 | |||
1221 | ``progress`` |
|
1221 | ``progress`` | |
1222 | ------------ |
|
1222 | ------------ | |
1223 |
|
1223 | |||
1224 | Mercurial commands can draw progress bars that are as informative as |
|
1224 | Mercurial commands can draw progress bars that are as informative as | |
1225 | possible. Some progress bars only offer indeterminate information, while others |
|
1225 | possible. Some progress bars only offer indeterminate information, while others | |
1226 | have a definite end point. |
|
1226 | have a definite end point. | |
1227 |
|
1227 | |||
1228 | ``delay`` |
|
1228 | ``delay`` | |
1229 | Number of seconds (float) before showing the progress bar. (default: 3) |
|
1229 | Number of seconds (float) before showing the progress bar. (default: 3) | |
1230 |
|
1230 | |||
1231 | ``changedelay`` |
|
1231 | ``changedelay`` | |
1232 | Minimum delay before showing a new topic. When set to less than 3 * refresh, |
|
1232 | Minimum delay before showing a new topic. When set to less than 3 * refresh, | |
1233 | that value will be used instead. (default: 1) |
|
1233 | that value will be used instead. (default: 1) | |
1234 |
|
1234 | |||
1235 | ``refresh`` |
|
1235 | ``refresh`` | |
1236 | Time in seconds between refreshes of the progress bar. (default: 0.1) |
|
1236 | Time in seconds between refreshes of the progress bar. (default: 0.1) | |
1237 |
|
1237 | |||
1238 | ``format`` |
|
1238 | ``format`` | |
1239 | Format of the progress bar. |
|
1239 | Format of the progress bar. | |
1240 |
|
1240 | |||
1241 | Valid entries for the format field are ``topic``, ``bar``, ``number``, |
|
1241 | Valid entries for the format field are ``topic``, ``bar``, ``number``, | |
1242 | ``unit``, ``estimate``, speed, and item. item defaults to the last 20 |
|
1242 | ``unit``, ``estimate``, speed, and item. item defaults to the last 20 | |
1243 | characters of the item, but this can be changed by adding either ``-<num>`` |
|
1243 | characters of the item, but this can be changed by adding either ``-<num>`` | |
1244 | which would take the last num characters, or ``+<num>`` for the first num |
|
1244 | which would take the last num characters, or ``+<num>`` for the first num | |
1245 | characters. |
|
1245 | characters. | |
1246 |
|
1246 | |||
1247 | (default: Topic bar number estimate) |
|
1247 | (default: Topic bar number estimate) | |
1248 |
|
1248 | |||
1249 | ``width`` |
|
1249 | ``width`` | |
1250 | If set, the maximum width of the progress information (that is, min(width, |
|
1250 | If set, the maximum width of the progress information (that is, min(width, | |
1251 | term width) will be used). |
|
1251 | term width) will be used). | |
1252 |
|
1252 | |||
1253 | ``clear-complete`` |
|
1253 | ``clear-complete`` | |
1254 | clear the progress bar after it's done. (default: True) |
|
1254 | clear the progress bar after it's done. (default: True) | |
1255 |
|
1255 | |||
1256 | ``disable`` |
|
1256 | ``disable`` | |
1257 | If true, don't show a progress bar. |
|
1257 | If true, don't show a progress bar. | |
1258 |
|
1258 | |||
1259 | ``assume-tty`` |
|
1259 | ``assume-tty`` | |
1260 | If true, ALWAYS show a progress bar, unless disable is given. |
|
1260 | If true, ALWAYS show a progress bar, unless disable is given. | |
1261 |
|
1261 | |||
1262 | ``revsetalias`` |
|
1262 | ``revsetalias`` | |
1263 | --------------- |
|
1263 | --------------- | |
1264 |
|
1264 | |||
1265 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1265 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1266 |
|
1266 | |||
1267 | ``server`` |
|
1267 | ``server`` | |
1268 | ---------- |
|
1268 | ---------- | |
1269 |
|
1269 | |||
1270 | Controls generic server settings. |
|
1270 | Controls generic server settings. | |
1271 |
|
1271 | |||
1272 | ``uncompressed`` |
|
1272 | ``uncompressed`` | |
1273 | Whether to allow clients to clone a repository using the |
|
1273 | Whether to allow clients to clone a repository using the | |
1274 | uncompressed streaming protocol. This transfers about 40% more |
|
1274 | uncompressed streaming protocol. This transfers about 40% more | |
1275 | data than a regular clone, but uses less memory and CPU on both |
|
1275 | data than a regular clone, but uses less memory and CPU on both | |
1276 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1276 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1277 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1277 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1278 | regular clone. Over most WAN connections (anything slower than |
|
1278 | regular clone. Over most WAN connections (anything slower than | |
1279 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1279 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1280 | extra data transfer overhead. This mode will also temporarily hold |
|
1280 | extra data transfer overhead. This mode will also temporarily hold | |
1281 | the write lock while determining what data to transfer. |
|
1281 | the write lock while determining what data to transfer. | |
1282 | (default: True) |
|
1282 | (default: True) | |
1283 |
|
1283 | |||
1284 | ``preferuncompressed`` |
|
1284 | ``preferuncompressed`` | |
1285 | When set, clients will try to use the uncompressed streaming |
|
1285 | When set, clients will try to use the uncompressed streaming | |
1286 | protocol. (default: False) |
|
1286 | protocol. (default: False) | |
1287 |
|
1287 | |||
1288 | ``validate`` |
|
1288 | ``validate`` | |
1289 | Whether to validate the completeness of pushed changesets by |
|
1289 | Whether to validate the completeness of pushed changesets by | |
1290 | checking that all new file revisions specified in manifests are |
|
1290 | checking that all new file revisions specified in manifests are | |
1291 | present. (default: False) |
|
1291 | present. (default: False) | |
1292 |
|
1292 | |||
1293 | ``maxhttpheaderlen`` |
|
1293 | ``maxhttpheaderlen`` | |
1294 | Instruct HTTP clients not to send request headers longer than this |
|
1294 | Instruct HTTP clients not to send request headers longer than this | |
1295 | many bytes. (default: 1024) |
|
1295 | many bytes. (default: 1024) | |
1296 |
|
1296 | |||
1297 | ``smtp`` |
|
1297 | ``smtp`` | |
1298 | -------- |
|
1298 | -------- | |
1299 |
|
1299 | |||
1300 | Configuration for extensions that need to send email messages. |
|
1300 | Configuration for extensions that need to send email messages. | |
1301 |
|
1301 | |||
1302 | ``host`` |
|
1302 | ``host`` | |
1303 | Host name of mail server, e.g. "mail.example.com". |
|
1303 | Host name of mail server, e.g. "mail.example.com". | |
1304 |
|
1304 | |||
1305 | ``port`` |
|
1305 | ``port`` | |
1306 | Optional. Port to connect to on mail server. (default: 465 if |
|
1306 | Optional. Port to connect to on mail server. (default: 465 if | |
1307 | ``tls`` is smtps; 25 otherwise) |
|
1307 | ``tls`` is smtps; 25 otherwise) | |
1308 |
|
1308 | |||
1309 | ``tls`` |
|
1309 | ``tls`` | |
1310 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1310 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1311 | smtps or none. (default: none) |
|
1311 | smtps or none. (default: none) | |
1312 |
|
1312 | |||
1313 | ``verifycert`` |
|
1313 | ``verifycert`` | |
1314 | Optional. Verification for the certificate of mail server, when |
|
1314 | Optional. Verification for the certificate of mail server, when | |
1315 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
1315 | ``tls`` is starttls or smtps. "strict", "loose" or False. For | |
1316 | "strict" or "loose", the certificate is verified as same as the |
|
1316 | "strict" or "loose", the certificate is verified as same as the | |
1317 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
1317 | verification for HTTPS connections (see ``[hostfingerprints]`` and | |
1318 | ``[web] cacerts`` also). For "strict", sending email is also |
|
1318 | ``[web] cacerts`` also). For "strict", sending email is also | |
1319 | aborted, if there is no configuration for mail server in |
|
1319 | aborted, if there is no configuration for mail server in | |
1320 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
1320 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for | |
1321 | :hg:`email` overwrites this as "loose". (default: strict) |
|
1321 | :hg:`email` overwrites this as "loose". (default: strict) | |
1322 |
|
1322 | |||
1323 | ``username`` |
|
1323 | ``username`` | |
1324 | Optional. User name for authenticating with the SMTP server. |
|
1324 | Optional. User name for authenticating with the SMTP server. | |
1325 | (default: None) |
|
1325 | (default: None) | |
1326 |
|
1326 | |||
1327 | ``password`` |
|
1327 | ``password`` | |
1328 | Optional. Password for authenticating with the SMTP server. If not |
|
1328 | Optional. Password for authenticating with the SMTP server. If not | |
1329 | specified, interactive sessions will prompt the user for a |
|
1329 | specified, interactive sessions will prompt the user for a | |
1330 | password; non-interactive sessions will fail. (default: None) |
|
1330 | password; non-interactive sessions will fail. (default: None) | |
1331 |
|
1331 | |||
1332 | ``local_hostname`` |
|
1332 | ``local_hostname`` | |
1333 | Optional. The hostname that the sender can use to identify |
|
1333 | Optional. The hostname that the sender can use to identify | |
1334 | itself to the MTA. |
|
1334 | itself to the MTA. | |
1335 |
|
1335 | |||
1336 |
|
1336 | |||
1337 | ``subpaths`` |
|
1337 | ``subpaths`` | |
1338 | ------------ |
|
1338 | ------------ | |
1339 |
|
1339 | |||
1340 | Subrepository source URLs can go stale if a remote server changes name |
|
1340 | Subrepository source URLs can go stale if a remote server changes name | |
1341 | or becomes temporarily unavailable. This section lets you define |
|
1341 | or becomes temporarily unavailable. This section lets you define | |
1342 | rewrite rules of the form:: |
|
1342 | rewrite rules of the form:: | |
1343 |
|
1343 | |||
1344 | <pattern> = <replacement> |
|
1344 | <pattern> = <replacement> | |
1345 |
|
1345 | |||
1346 | where ``pattern`` is a regular expression matching a subrepository |
|
1346 | where ``pattern`` is a regular expression matching a subrepository | |
1347 | source URL and ``replacement`` is the replacement string used to |
|
1347 | source URL and ``replacement`` is the replacement string used to | |
1348 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1348 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1349 | ``replacements``. For instance:: |
|
1349 | ``replacements``. For instance:: | |
1350 |
|
1350 | |||
1351 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1351 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1352 |
|
1352 | |||
1353 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1353 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1354 |
|
1354 | |||
1355 | Relative subrepository paths are first made absolute, and the |
|
1355 | Relative subrepository paths are first made absolute, and the | |
1356 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1356 | rewrite rules are then applied on the full (absolute) path. The rules | |
1357 | are applied in definition order. |
|
1357 | are applied in definition order. | |
1358 |
|
1358 | |||
1359 | ``trusted`` |
|
1359 | ``trusted`` | |
1360 | ----------- |
|
1360 | ----------- | |
1361 |
|
1361 | |||
1362 | Mercurial will not use the settings in the |
|
1362 | Mercurial will not use the settings in the | |
1363 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1363 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1364 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1364 | user or to a trusted group, as various hgrc features allow arbitrary | |
1365 | commands to be run. This issue is often encountered when configuring |
|
1365 | commands to be run. This issue is often encountered when configuring | |
1366 | hooks or extensions for shared repositories or servers. However, |
|
1366 | hooks or extensions for shared repositories or servers. However, | |
1367 | the web interface will use some safe settings from the ``[web]`` |
|
1367 | the web interface will use some safe settings from the ``[web]`` | |
1368 | section. |
|
1368 | section. | |
1369 |
|
1369 | |||
1370 | This section specifies what users and groups are trusted. The |
|
1370 | This section specifies what users and groups are trusted. The | |
1371 | current user is always trusted. To trust everybody, list a user or a |
|
1371 | current user is always trusted. To trust everybody, list a user or a | |
1372 | group with name ``*``. These settings must be placed in an |
|
1372 | group with name ``*``. These settings must be placed in an | |
1373 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1373 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1374 | user or service running Mercurial. |
|
1374 | user or service running Mercurial. | |
1375 |
|
1375 | |||
1376 | ``users`` |
|
1376 | ``users`` | |
1377 | Comma-separated list of trusted users. |
|
1377 | Comma-separated list of trusted users. | |
1378 |
|
1378 | |||
1379 | ``groups`` |
|
1379 | ``groups`` | |
1380 | Comma-separated list of trusted groups. |
|
1380 | Comma-separated list of trusted groups. | |
1381 |
|
1381 | |||
1382 |
|
1382 | |||
1383 | ``ui`` |
|
1383 | ``ui`` | |
1384 | ------ |
|
1384 | ------ | |
1385 |
|
1385 | |||
1386 | User interface controls. |
|
1386 | User interface controls. | |
1387 |
|
1387 | |||
1388 | ``archivemeta`` |
|
1388 | ``archivemeta`` | |
1389 | Whether to include the .hg_archival.txt file containing meta data |
|
1389 | Whether to include the .hg_archival.txt file containing meta data | |
1390 | (hashes for the repository base and for tip) in archives created |
|
1390 | (hashes for the repository base and for tip) in archives created | |
1391 | by the :hg:`archive` command or downloaded via hgweb. |
|
1391 | by the :hg:`archive` command or downloaded via hgweb. | |
1392 | (default: True) |
|
1392 | (default: True) | |
1393 |
|
1393 | |||
1394 | ``askusername`` |
|
1394 | ``askusername`` | |
1395 | Whether to prompt for a username when committing. If True, and |
|
1395 | Whether to prompt for a username when committing. If True, and | |
1396 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1396 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1397 | be prompted to enter a username. If no username is entered, the |
|
1397 | be prompted to enter a username. If no username is entered, the | |
1398 | default ``USER@HOST`` is used instead. |
|
1398 | default ``USER@HOST`` is used instead. | |
1399 | (default: False) |
|
1399 | (default: False) | |
1400 |
|
1400 | |||
1401 | ``commitsubrepos`` |
|
1401 | ``commitsubrepos`` | |
1402 | Whether to commit modified subrepositories when committing the |
|
1402 | Whether to commit modified subrepositories when committing the | |
1403 | parent repository. If False and one subrepository has uncommitted |
|
1403 | parent repository. If False and one subrepository has uncommitted | |
1404 | changes, abort the commit. |
|
1404 | changes, abort the commit. | |
1405 | (default: False) |
|
1405 | (default: False) | |
1406 |
|
1406 | |||
1407 | ``debug`` |
|
1407 | ``debug`` | |
1408 | Print debugging information. True or False. (default: False) |
|
1408 | Print debugging information. True or False. (default: False) | |
1409 |
|
1409 | |||
1410 | ``editor`` |
|
1410 | ``editor`` | |
1411 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) |
|
1411 | The editor to use during a commit. (default: ``$EDITOR`` or ``vi``) | |
1412 |
|
1412 | |||
1413 | ``fallbackencoding`` |
|
1413 | ``fallbackencoding`` | |
1414 | Encoding to try if it's not possible to decode the changelog using |
|
1414 | Encoding to try if it's not possible to decode the changelog using | |
1415 | UTF-8. (default: ISO-8859-1) |
|
1415 | UTF-8. (default: ISO-8859-1) | |
1416 |
|
1416 | |||
1417 | ``ignore`` |
|
1417 | ``ignore`` | |
1418 | A file to read per-user ignore patterns from. This file should be |
|
1418 | A file to read per-user ignore patterns from. This file should be | |
1419 | in the same format as a repository-wide .hgignore file. Filenames |
|
1419 | in the same format as a repository-wide .hgignore file. Filenames | |
1420 | are relative to the repository root. This option supports hook syntax, |
|
1420 | are relative to the repository root. This option supports hook syntax, | |
1421 | so if you want to specify multiple ignore files, you can do so by |
|
1421 | so if you want to specify multiple ignore files, you can do so by | |
1422 | setting something like ``ignore.other = ~/.hgignore2``. For details |
|
1422 | setting something like ``ignore.other = ~/.hgignore2``. For details | |
1423 | of the ignore file format, see the ``hgignore(5)`` man page. |
|
1423 | of the ignore file format, see the ``hgignore(5)`` man page. | |
1424 |
|
1424 | |||
1425 | ``interactive`` |
|
1425 | ``interactive`` | |
1426 | Allow to prompt the user. True or False. (default: True) |
|
1426 | Allow to prompt the user. True or False. (default: True) | |
1427 |
|
1427 | |||
1428 | ``logtemplate`` |
|
1428 | ``logtemplate`` | |
1429 | Template string for commands that print changesets. |
|
1429 | Template string for commands that print changesets. | |
1430 |
|
1430 | |||
1431 | ``merge`` |
|
1431 | ``merge`` | |
1432 | The conflict resolution program to use during a manual merge. |
|
1432 | The conflict resolution program to use during a manual merge. | |
1433 | For more information on merge tools see :hg:`help merge-tools`. |
|
1433 | For more information on merge tools see :hg:`help merge-tools`. | |
1434 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1434 | For configuring merge tools see the ``[merge-tools]`` section. | |
1435 |
|
1435 | |||
1436 | ``mergemarkers`` |
|
1436 | ``mergemarkers`` | |
1437 | Sets the merge conflict marker label styling. The ``detailed`` |
|
1437 | Sets the merge conflict marker label styling. The ``detailed`` | |
1438 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
1438 | style uses the ``mergemarkertemplate`` setting to style the labels. | |
1439 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
1439 | The ``basic`` style just uses 'local' and 'other' as the marker label. | |
1440 | One of ``basic`` or ``detailed``. |
|
1440 | One of ``basic`` or ``detailed``. | |
1441 | (default: ``basic``) |
|
1441 | (default: ``basic``) | |
1442 |
|
1442 | |||
1443 | ``mergemarkertemplate`` |
|
1443 | ``mergemarkertemplate`` | |
1444 | The template used to print the commit description next to each conflict |
|
1444 | The template used to print the commit description next to each conflict | |
1445 | marker during merge conflicts. See :hg:`help templates` for the template |
|
1445 | marker during merge conflicts. See :hg:`help templates` for the template | |
1446 | format. |
|
1446 | format. | |
1447 |
|
1447 | |||
1448 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
1448 | Defaults to showing the hash, tags, branches, bookmarks, author, and | |
1449 | the first line of the commit description. |
|
1449 | the first line of the commit description. | |
1450 |
|
1450 | |||
1451 | If you use non-ASCII characters in names for tags, branches, bookmarks, |
|
1451 | If you use non-ASCII characters in names for tags, branches, bookmarks, | |
1452 | authors, and/or commit descriptions, you must pay attention to encodings of |
|
1452 | authors, and/or commit descriptions, you must pay attention to encodings of | |
1453 | managed files. At template expansion, non-ASCII characters use the encoding |
|
1453 | managed files. At template expansion, non-ASCII characters use the encoding | |
1454 | specified by the ``--encoding`` global option, ``HGENCODING`` or other |
|
1454 | specified by the ``--encoding`` global option, ``HGENCODING`` or other | |
1455 | environment variables that govern your locale. If the encoding of the merge |
|
1455 | environment variables that govern your locale. If the encoding of the merge | |
1456 | markers is different from the encoding of the merged files, |
|
1456 | markers is different from the encoding of the merged files, | |
1457 | serious problems may occur. |
|
1457 | serious problems may occur. | |
1458 |
|
1458 | |||
1459 | ``patch`` |
|
1459 | ``patch`` | |
1460 | An optional external tool that ``hg import`` and some extensions |
|
1460 | An optional external tool that ``hg import`` and some extensions | |
1461 | will use for applying patches. By default Mercurial uses an |
|
1461 | will use for applying patches. By default Mercurial uses an | |
1462 | internal patch utility. The external tool must work as the common |
|
1462 | internal patch utility. The external tool must work as the common | |
1463 | Unix ``patch`` program. In particular, it must accept a ``-p`` |
|
1463 | Unix ``patch`` program. In particular, it must accept a ``-p`` | |
1464 | argument to strip patch headers, a ``-d`` argument to specify the |
|
1464 | argument to strip patch headers, a ``-d`` argument to specify the | |
1465 | current directory, a file name to patch, and a patch file to take |
|
1465 | current directory, a file name to patch, and a patch file to take | |
1466 | from stdin. |
|
1466 | from stdin. | |
1467 |
|
1467 | |||
1468 | It is possible to specify a patch tool together with extra |
|
1468 | It is possible to specify a patch tool together with extra | |
1469 | arguments. For example, setting this option to ``patch --merge`` |
|
1469 | arguments. For example, setting this option to ``patch --merge`` | |
1470 | will use the ``patch`` program with its 2-way merge option. |
|
1470 | will use the ``patch`` program with its 2-way merge option. | |
1471 |
|
1471 | |||
1472 | ``portablefilenames`` |
|
1472 | ``portablefilenames`` | |
1473 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1473 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1474 | (default: ``warn``) |
|
1474 | (default: ``warn``) | |
1475 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1475 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX | |
1476 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1476 | platforms, if a file with a non-portable filename is added (e.g. a file | |
1477 | with a name that can't be created on Windows because it contains reserved |
|
1477 | with a name that can't be created on Windows because it contains reserved | |
1478 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1478 | parts like ``AUX``, reserved characters like ``:``, or would cause a case | |
1479 | collision with an existing file). |
|
1479 | collision with an existing file). | |
1480 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1480 | If set to ``ignore`` (or ``false``), no warning is printed. | |
1481 | If set to ``abort``, the command is aborted. |
|
1481 | If set to ``abort``, the command is aborted. | |
1482 | On Windows, this configuration option is ignored and the command aborted. |
|
1482 | On Windows, this configuration option is ignored and the command aborted. | |
1483 |
|
1483 | |||
1484 | ``quiet`` |
|
1484 | ``quiet`` | |
1485 | Reduce the amount of output printed. True or False. (default: False) |
|
1485 | Reduce the amount of output printed. True or False. (default: False) | |
1486 |
|
1486 | |||
1487 | ``remotecmd`` |
|
1487 | ``remotecmd`` | |
1488 | remote command to use for clone/push/pull operations. (default: ``hg``) |
|
1488 | remote command to use for clone/push/pull operations. (default: ``hg``) | |
1489 |
|
1489 | |||
1490 | ``report_untrusted`` |
|
1490 | ``report_untrusted`` | |
1491 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1491 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1492 | trusted user or group. True or False. (default: True) |
|
1492 | trusted user or group. True or False. (default: True) | |
1493 |
|
1493 | |||
1494 | ``slash`` |
|
1494 | ``slash`` | |
1495 | Display paths using a slash (``/``) as the path separator. This |
|
1495 | Display paths using a slash (``/``) as the path separator. This | |
1496 | only makes a difference on systems where the default path |
|
1496 | only makes a difference on systems where the default path | |
1497 | separator is not the slash character (e.g. Windows uses the |
|
1497 | separator is not the slash character (e.g. Windows uses the | |
1498 | backslash character (``\``)). |
|
1498 | backslash character (``\``)). | |
1499 | (default: False) |
|
1499 | (default: False) | |
1500 |
|
1500 | |||
1501 | ``statuscopies`` |
|
1501 | ``statuscopies`` | |
1502 | Display copies in the status command. |
|
1502 | Display copies in the status command. | |
1503 |
|
1503 | |||
1504 | ``ssh`` |
|
1504 | ``ssh`` | |
1505 | command to use for SSH connections. (default: ``ssh``) |
|
1505 | command to use for SSH connections. (default: ``ssh``) | |
1506 |
|
1506 | |||
1507 | ``strict`` |
|
1507 | ``strict`` | |
1508 | Require exact command names, instead of allowing unambiguous |
|
1508 | Require exact command names, instead of allowing unambiguous | |
1509 | abbreviations. True or False. (default: False) |
|
1509 | abbreviations. True or False. (default: False) | |
1510 |
|
1510 | |||
1511 | ``style`` |
|
1511 | ``style`` | |
1512 | Name of style to use for command output. |
|
1512 | Name of style to use for command output. | |
1513 |
|
1513 | |||
|
1514 | ``supportcontact`` | |||
|
1515 | Location pointed at in Mercurial traceback for reporting crash. Use this if | |||
|
1516 | you are a large organisation with it's own Mercurial deployement process and | |||
|
1517 | crash reports should be addressed to your internal support. | |||
|
1518 | ||||
1514 | ``timeout`` |
|
1519 | ``timeout`` | |
1515 | The timeout used when a lock is held (in seconds), a negative value |
|
1520 | The timeout used when a lock is held (in seconds), a negative value | |
1516 | means no timeout. (default: 600) |
|
1521 | means no timeout. (default: 600) | |
1517 |
|
1522 | |||
1518 | ``traceback`` |
|
1523 | ``traceback`` | |
1519 | Mercurial always prints a traceback when an unknown exception |
|
1524 | Mercurial always prints a traceback when an unknown exception | |
1520 | occurs. Setting this to True will make Mercurial print a traceback |
|
1525 | occurs. Setting this to True will make Mercurial print a traceback | |
1521 | on all exceptions, even those recognized by Mercurial (such as |
|
1526 | on all exceptions, even those recognized by Mercurial (such as | |
1522 | IOError or MemoryError). (default: False) |
|
1527 | IOError or MemoryError). (default: False) | |
1523 |
|
1528 | |||
1524 | ``username`` |
|
1529 | ``username`` | |
1525 | The committer of a changeset created when running "commit". |
|
1530 | The committer of a changeset created when running "commit". | |
1526 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1531 | Typically a person's name and email address, e.g. ``Fred Widget | |
1527 | <fred@example.com>``. Environment variables in the |
|
1532 | <fred@example.com>``. Environment variables in the | |
1528 | username are expanded. |
|
1533 | username are expanded. | |
1529 |
|
1534 | |||
1530 | (default: ``$EMAIL`` or ``username@hostname``. If the username in |
|
1535 | (default: ``$EMAIL`` or ``username@hostname``. If the username in | |
1531 | hgrc is empty, e.g. if the system admin set ``username =`` in the |
|
1536 | hgrc is empty, e.g. if the system admin set ``username =`` in the | |
1532 | system hgrc, it has to be specified manually or in a different |
|
1537 | system hgrc, it has to be specified manually or in a different | |
1533 | hgrc file) |
|
1538 | hgrc file) | |
1534 |
|
1539 | |||
1535 | ``verbose`` |
|
1540 | ``verbose`` | |
1536 | Increase the amount of output printed. True or False. (default: False) |
|
1541 | Increase the amount of output printed. True or False. (default: False) | |
1537 |
|
1542 | |||
1538 |
|
1543 | |||
1539 | ``web`` |
|
1544 | ``web`` | |
1540 | ------- |
|
1545 | ------- | |
1541 |
|
1546 | |||
1542 | Web interface configuration. The settings in this section apply to |
|
1547 | Web interface configuration. The settings in this section apply to | |
1543 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1548 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1544 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1549 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1545 | and WSGI). |
|
1550 | and WSGI). | |
1546 |
|
1551 | |||
1547 | The Mercurial webserver does no authentication (it does not prompt for |
|
1552 | The Mercurial webserver does no authentication (it does not prompt for | |
1548 | usernames and passwords to validate *who* users are), but it does do |
|
1553 | usernames and passwords to validate *who* users are), but it does do | |
1549 | authorization (it grants or denies access for *authenticated users* |
|
1554 | authorization (it grants or denies access for *authenticated users* | |
1550 | based on settings in this section). You must either configure your |
|
1555 | based on settings in this section). You must either configure your | |
1551 | webserver to do authentication for you, or disable the authorization |
|
1556 | webserver to do authentication for you, or disable the authorization | |
1552 | checks. |
|
1557 | checks. | |
1553 |
|
1558 | |||
1554 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1559 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1555 | you want it to accept pushes from anybody, you can use the following |
|
1560 | you want it to accept pushes from anybody, you can use the following | |
1556 | command line:: |
|
1561 | command line:: | |
1557 |
|
1562 | |||
1558 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1563 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1559 |
|
1564 | |||
1560 | Note that this will allow anybody to push anything to the server and |
|
1565 | Note that this will allow anybody to push anything to the server and | |
1561 | that this should not be used for public servers. |
|
1566 | that this should not be used for public servers. | |
1562 |
|
1567 | |||
1563 | The full set of options is: |
|
1568 | The full set of options is: | |
1564 |
|
1569 | |||
1565 | ``accesslog`` |
|
1570 | ``accesslog`` | |
1566 | Where to output the access log. (default: stdout) |
|
1571 | Where to output the access log. (default: stdout) | |
1567 |
|
1572 | |||
1568 | ``address`` |
|
1573 | ``address`` | |
1569 | Interface address to bind to. (default: all) |
|
1574 | Interface address to bind to. (default: all) | |
1570 |
|
1575 | |||
1571 | ``allow_archive`` |
|
1576 | ``allow_archive`` | |
1572 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1577 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1573 | (default: empty) |
|
1578 | (default: empty) | |
1574 |
|
1579 | |||
1575 | ``allowbz2`` |
|
1580 | ``allowbz2`` | |
1576 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1581 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1577 | revisions. |
|
1582 | revisions. | |
1578 | (default: False) |
|
1583 | (default: False) | |
1579 |
|
1584 | |||
1580 | ``allowgz`` |
|
1585 | ``allowgz`` | |
1581 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1586 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1582 | revisions. |
|
1587 | revisions. | |
1583 | (default: False) |
|
1588 | (default: False) | |
1584 |
|
1589 | |||
1585 | ``allowpull`` |
|
1590 | ``allowpull`` | |
1586 | Whether to allow pulling from the repository. (default: True) |
|
1591 | Whether to allow pulling from the repository. (default: True) | |
1587 |
|
1592 | |||
1588 | ``allow_push`` |
|
1593 | ``allow_push`` | |
1589 | Whether to allow pushing to the repository. If empty or not set, |
|
1594 | Whether to allow pushing to the repository. If empty or not set, | |
1590 | pushing is not allowed. If the special value ``*``, any remote |
|
1595 | pushing is not allowed. If the special value ``*``, any remote | |
1591 | user can push, including unauthenticated users. Otherwise, the |
|
1596 | user can push, including unauthenticated users. Otherwise, the | |
1592 | remote user must have been authenticated, and the authenticated |
|
1597 | remote user must have been authenticated, and the authenticated | |
1593 | user name must be present in this list. The contents of the |
|
1598 | user name must be present in this list. The contents of the | |
1594 | allow_push list are examined after the deny_push list. |
|
1599 | allow_push list are examined after the deny_push list. | |
1595 |
|
1600 | |||
1596 | ``allow_read`` |
|
1601 | ``allow_read`` | |
1597 | If the user has not already been denied repository access due to |
|
1602 | If the user has not already been denied repository access due to | |
1598 | the contents of deny_read, this list determines whether to grant |
|
1603 | the contents of deny_read, this list determines whether to grant | |
1599 | repository access to the user. If this list is not empty, and the |
|
1604 | repository access to the user. If this list is not empty, and the | |
1600 | user is unauthenticated or not present in the list, then access is |
|
1605 | user is unauthenticated or not present in the list, then access is | |
1601 | denied for the user. If the list is empty or not set, then access |
|
1606 | denied for the user. If the list is empty or not set, then access | |
1602 | is permitted to all users by default. Setting allow_read to the |
|
1607 | is permitted to all users by default. Setting allow_read to the | |
1603 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1608 | special value ``*`` is equivalent to it not being set (i.e. access | |
1604 | is permitted to all users). The contents of the allow_read list are |
|
1609 | is permitted to all users). The contents of the allow_read list are | |
1605 | examined after the deny_read list. |
|
1610 | examined after the deny_read list. | |
1606 |
|
1611 | |||
1607 | ``allowzip`` |
|
1612 | ``allowzip`` | |
1608 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1613 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1609 | revisions. This feature creates temporary files. |
|
1614 | revisions. This feature creates temporary files. | |
1610 | (default: False) |
|
1615 | (default: False) | |
1611 |
|
1616 | |||
1612 | ``archivesubrepos`` |
|
1617 | ``archivesubrepos`` | |
1613 | Whether to recurse into subrepositories when archiving. |
|
1618 | Whether to recurse into subrepositories when archiving. | |
1614 | (default: False) |
|
1619 | (default: False) | |
1615 |
|
1620 | |||
1616 | ``baseurl`` |
|
1621 | ``baseurl`` | |
1617 | Base URL to use when publishing URLs in other locations, so |
|
1622 | Base URL to use when publishing URLs in other locations, so | |
1618 | third-party tools like email notification hooks can construct |
|
1623 | third-party tools like email notification hooks can construct | |
1619 | URLs. Example: ``http://hgserver/repos/``. |
|
1624 | URLs. Example: ``http://hgserver/repos/``. | |
1620 |
|
1625 | |||
1621 | ``cacerts`` |
|
1626 | ``cacerts`` | |
1622 | Path to file containing a list of PEM encoded certificate |
|
1627 | Path to file containing a list of PEM encoded certificate | |
1623 | authority certificates. Environment variables and ``~user`` |
|
1628 | authority certificates. Environment variables and ``~user`` | |
1624 | constructs are expanded in the filename. If specified on the |
|
1629 | constructs are expanded in the filename. If specified on the | |
1625 | client, then it will verify the identity of remote HTTPS servers |
|
1630 | client, then it will verify the identity of remote HTTPS servers | |
1626 | with these certificates. |
|
1631 | with these certificates. | |
1627 |
|
1632 | |||
1628 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1633 | This feature is only supported when using Python 2.6 or later. If you wish | |
1629 | to use it with earlier versions of Python, install the backported |
|
1634 | to use it with earlier versions of Python, install the backported | |
1630 | version of the ssl library that is available from |
|
1635 | version of the ssl library that is available from | |
1631 | ``http://pypi.python.org``. |
|
1636 | ``http://pypi.python.org``. | |
1632 |
|
1637 | |||
1633 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1638 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1634 | command line. |
|
1639 | command line. | |
1635 |
|
1640 | |||
1636 | You can use OpenSSL's CA certificate file if your platform has |
|
1641 | You can use OpenSSL's CA certificate file if your platform has | |
1637 | one. On most Linux systems this will be |
|
1642 | one. On most Linux systems this will be | |
1638 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1643 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1639 | generate this file manually. The form must be as follows:: |
|
1644 | generate this file manually. The form must be as follows:: | |
1640 |
|
1645 | |||
1641 | -----BEGIN CERTIFICATE----- |
|
1646 | -----BEGIN CERTIFICATE----- | |
1642 | ... (certificate in base64 PEM encoding) ... |
|
1647 | ... (certificate in base64 PEM encoding) ... | |
1643 | -----END CERTIFICATE----- |
|
1648 | -----END CERTIFICATE----- | |
1644 | -----BEGIN CERTIFICATE----- |
|
1649 | -----BEGIN CERTIFICATE----- | |
1645 | ... (certificate in base64 PEM encoding) ... |
|
1650 | ... (certificate in base64 PEM encoding) ... | |
1646 | -----END CERTIFICATE----- |
|
1651 | -----END CERTIFICATE----- | |
1647 |
|
1652 | |||
1648 | ``cache`` |
|
1653 | ``cache`` | |
1649 | Whether to support caching in hgweb. (default: True) |
|
1654 | Whether to support caching in hgweb. (default: True) | |
1650 |
|
1655 | |||
1651 | ``certificate`` |
|
1656 | ``certificate`` | |
1652 | Certificate to use when running :hg:`serve`. |
|
1657 | Certificate to use when running :hg:`serve`. | |
1653 |
|
1658 | |||
1654 | ``collapse`` |
|
1659 | ``collapse`` | |
1655 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1660 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1656 | a single level alongside repositories in the current path. With |
|
1661 | a single level alongside repositories in the current path. With | |
1657 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1662 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1658 | the current path are grouped behind navigable directory entries that |
|
1663 | the current path are grouped behind navigable directory entries that | |
1659 | lead to the locations of these repositories. In effect, this setting |
|
1664 | lead to the locations of these repositories. In effect, this setting | |
1660 | collapses each collection of repositories found within a subdirectory |
|
1665 | collapses each collection of repositories found within a subdirectory | |
1661 | into a single entry for that subdirectory. (default: False) |
|
1666 | into a single entry for that subdirectory. (default: False) | |
1662 |
|
1667 | |||
1663 | ``comparisoncontext`` |
|
1668 | ``comparisoncontext`` | |
1664 | Number of lines of context to show in side-by-side file comparison. If |
|
1669 | Number of lines of context to show in side-by-side file comparison. If | |
1665 | negative or the value ``full``, whole files are shown. (default: 5) |
|
1670 | negative or the value ``full``, whole files are shown. (default: 5) | |
1666 |
|
1671 | |||
1667 | This setting can be overridden by a ``context`` request parameter to the |
|
1672 | This setting can be overridden by a ``context`` request parameter to the | |
1668 | ``comparison`` command, taking the same values. |
|
1673 | ``comparison`` command, taking the same values. | |
1669 |
|
1674 | |||
1670 | ``contact`` |
|
1675 | ``contact`` | |
1671 | Name or email address of the person in charge of the repository. |
|
1676 | Name or email address of the person in charge of the repository. | |
1672 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) |
|
1677 | (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty) | |
1673 |
|
1678 | |||
1674 | ``deny_push`` |
|
1679 | ``deny_push`` | |
1675 | Whether to deny pushing to the repository. If empty or not set, |
|
1680 | Whether to deny pushing to the repository. If empty or not set, | |
1676 | push is not denied. If the special value ``*``, all remote users are |
|
1681 | push is not denied. If the special value ``*``, all remote users are | |
1677 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1682 | denied push. Otherwise, unauthenticated users are all denied, and | |
1678 | any authenticated user name present in this list is also denied. The |
|
1683 | any authenticated user name present in this list is also denied. The | |
1679 | contents of the deny_push list are examined before the allow_push list. |
|
1684 | contents of the deny_push list are examined before the allow_push list. | |
1680 |
|
1685 | |||
1681 | ``deny_read`` |
|
1686 | ``deny_read`` | |
1682 | Whether to deny reading/viewing of the repository. If this list is |
|
1687 | Whether to deny reading/viewing of the repository. If this list is | |
1683 | not empty, unauthenticated users are all denied, and any |
|
1688 | not empty, unauthenticated users are all denied, and any | |
1684 | authenticated user name present in this list is also denied access to |
|
1689 | authenticated user name present in this list is also denied access to | |
1685 | the repository. If set to the special value ``*``, all remote users |
|
1690 | the repository. If set to the special value ``*``, all remote users | |
1686 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1691 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1687 | the determination of repository access depends on the presence and |
|
1692 | the determination of repository access depends on the presence and | |
1688 | content of the allow_read list (see description). If both |
|
1693 | content of the allow_read list (see description). If both | |
1689 | deny_read and allow_read are empty or not set, then access is |
|
1694 | deny_read and allow_read are empty or not set, then access is | |
1690 | permitted to all users by default. If the repository is being |
|
1695 | permitted to all users by default. If the repository is being | |
1691 | served via hgwebdir, denied users will not be able to see it in |
|
1696 | served via hgwebdir, denied users will not be able to see it in | |
1692 | the list of repositories. The contents of the deny_read list have |
|
1697 | the list of repositories. The contents of the deny_read list have | |
1693 | priority over (are examined before) the contents of the allow_read |
|
1698 | priority over (are examined before) the contents of the allow_read | |
1694 | list. |
|
1699 | list. | |
1695 |
|
1700 | |||
1696 | ``descend`` |
|
1701 | ``descend`` | |
1697 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1702 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1698 | directly in the current path will be shown (other repositories are still |
|
1703 | directly in the current path will be shown (other repositories are still | |
1699 | available from the index corresponding to their containing path). |
|
1704 | available from the index corresponding to their containing path). | |
1700 |
|
1705 | |||
1701 | ``description`` |
|
1706 | ``description`` | |
1702 | Textual description of the repository's purpose or contents. |
|
1707 | Textual description of the repository's purpose or contents. | |
1703 | (default: "unknown") |
|
1708 | (default: "unknown") | |
1704 |
|
1709 | |||
1705 | ``encoding`` |
|
1710 | ``encoding`` | |
1706 | Character encoding name. (default: the current locale charset) |
|
1711 | Character encoding name. (default: the current locale charset) | |
1707 | Example: "UTF-8". |
|
1712 | Example: "UTF-8". | |
1708 |
|
1713 | |||
1709 | ``errorlog`` |
|
1714 | ``errorlog`` | |
1710 | Where to output the error log. (default: stderr) |
|
1715 | Where to output the error log. (default: stderr) | |
1711 |
|
1716 | |||
1712 | ``guessmime`` |
|
1717 | ``guessmime`` | |
1713 | Control MIME types for raw download of file content. |
|
1718 | Control MIME types for raw download of file content. | |
1714 | Set to True to let hgweb guess the content type from the file |
|
1719 | Set to True to let hgweb guess the content type from the file | |
1715 | extension. This will serve HTML files as ``text/html`` and might |
|
1720 | extension. This will serve HTML files as ``text/html`` and might | |
1716 | allow cross-site scripting attacks when serving untrusted |
|
1721 | allow cross-site scripting attacks when serving untrusted | |
1717 | repositories. (default: False) |
|
1722 | repositories. (default: False) | |
1718 |
|
1723 | |||
1719 | ``hidden`` |
|
1724 | ``hidden`` | |
1720 | Whether to hide the repository in the hgwebdir index. |
|
1725 | Whether to hide the repository in the hgwebdir index. | |
1721 | (default: False) |
|
1726 | (default: False) | |
1722 |
|
1727 | |||
1723 | ``ipv6`` |
|
1728 | ``ipv6`` | |
1724 | Whether to use IPv6. (default: False) |
|
1729 | Whether to use IPv6. (default: False) | |
1725 |
|
1730 | |||
1726 | ``logoimg`` |
|
1731 | ``logoimg`` | |
1727 | File name of the logo image that some templates display on each page. |
|
1732 | File name of the logo image that some templates display on each page. | |
1728 | The file name is relative to ``staticurl``. That is, the full path to |
|
1733 | The file name is relative to ``staticurl``. That is, the full path to | |
1729 | the logo image is "staticurl/logoimg". |
|
1734 | the logo image is "staticurl/logoimg". | |
1730 | If unset, ``hglogo.png`` will be used. |
|
1735 | If unset, ``hglogo.png`` will be used. | |
1731 |
|
1736 | |||
1732 | ``logourl`` |
|
1737 | ``logourl`` | |
1733 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` |
|
1738 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` | |
1734 | will be used. |
|
1739 | will be used. | |
1735 |
|
1740 | |||
1736 | ``maxchanges`` |
|
1741 | ``maxchanges`` | |
1737 | Maximum number of changes to list on the changelog. (default: 10) |
|
1742 | Maximum number of changes to list on the changelog. (default: 10) | |
1738 |
|
1743 | |||
1739 | ``maxfiles`` |
|
1744 | ``maxfiles`` | |
1740 | Maximum number of files to list per changeset. (default: 10) |
|
1745 | Maximum number of files to list per changeset. (default: 10) | |
1741 |
|
1746 | |||
1742 | ``maxshortchanges`` |
|
1747 | ``maxshortchanges`` | |
1743 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1748 | Maximum number of changes to list on the shortlog, graph or filelog | |
1744 | pages. (default: 60) |
|
1749 | pages. (default: 60) | |
1745 |
|
1750 | |||
1746 | ``name`` |
|
1751 | ``name`` | |
1747 | Repository name to use in the web interface. |
|
1752 | Repository name to use in the web interface. | |
1748 | (default: current working directory) |
|
1753 | (default: current working directory) | |
1749 |
|
1754 | |||
1750 | ``port`` |
|
1755 | ``port`` | |
1751 | Port to listen on. (default: 8000) |
|
1756 | Port to listen on. (default: 8000) | |
1752 |
|
1757 | |||
1753 | ``prefix`` |
|
1758 | ``prefix`` | |
1754 | Prefix path to serve from. (default: '' (server root)) |
|
1759 | Prefix path to serve from. (default: '' (server root)) | |
1755 |
|
1760 | |||
1756 | ``push_ssl`` |
|
1761 | ``push_ssl`` | |
1757 | Whether to require that inbound pushes be transported over SSL to |
|
1762 | Whether to require that inbound pushes be transported over SSL to | |
1758 | prevent password sniffing. (default: True) |
|
1763 | prevent password sniffing. (default: True) | |
1759 |
|
1764 | |||
1760 | ``refreshinterval`` |
|
1765 | ``refreshinterval`` | |
1761 | How frequently directory listings re-scan the filesystem for new |
|
1766 | How frequently directory listings re-scan the filesystem for new | |
1762 | repositories, in seconds. This is relevant when wildcards are used |
|
1767 | repositories, in seconds. This is relevant when wildcards are used | |
1763 | to define paths. Depending on how much filesystem traversal is |
|
1768 | to define paths. Depending on how much filesystem traversal is | |
1764 | required, refreshing may negatively impact performance. |
|
1769 | required, refreshing may negatively impact performance. | |
1765 |
|
1770 | |||
1766 | Values less than or equal to 0 always refresh. |
|
1771 | Values less than or equal to 0 always refresh. | |
1767 | (default: 20) |
|
1772 | (default: 20) | |
1768 |
|
1773 | |||
1769 | ``staticurl`` |
|
1774 | ``staticurl`` | |
1770 | Base URL to use for static files. If unset, static files (e.g. the |
|
1775 | Base URL to use for static files. If unset, static files (e.g. the | |
1771 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1776 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1772 | this setting to serve them directly with the HTTP server. |
|
1777 | this setting to serve them directly with the HTTP server. | |
1773 | Example: ``http://hgserver/static/``. |
|
1778 | Example: ``http://hgserver/static/``. | |
1774 |
|
1779 | |||
1775 | ``stripes`` |
|
1780 | ``stripes`` | |
1776 | How many lines a "zebra stripe" should span in multi-line output. |
|
1781 | How many lines a "zebra stripe" should span in multi-line output. | |
1777 | Set to 0 to disable. (default: 1) |
|
1782 | Set to 0 to disable. (default: 1) | |
1778 |
|
1783 | |||
1779 | ``style`` |
|
1784 | ``style`` | |
1780 | Which template map style to use. The available options are the names of |
|
1785 | Which template map style to use. The available options are the names of | |
1781 | subdirectories in the HTML templates path. (default: ``paper``) |
|
1786 | subdirectories in the HTML templates path. (default: ``paper``) | |
1782 | Example: ``monoblue``. |
|
1787 | Example: ``monoblue``. | |
1783 |
|
1788 | |||
1784 | ``templates`` |
|
1789 | ``templates`` | |
1785 | Where to find the HTML templates. The default path to the HTML templates |
|
1790 | Where to find the HTML templates. The default path to the HTML templates | |
1786 | can be obtained from ``hg debuginstall``. |
|
1791 | can be obtained from ``hg debuginstall``. | |
1787 |
|
1792 | |||
1788 | ``websub`` |
|
1793 | ``websub`` | |
1789 | ---------- |
|
1794 | ---------- | |
1790 |
|
1795 | |||
1791 | Web substitution filter definition. You can use this section to |
|
1796 | Web substitution filter definition. You can use this section to | |
1792 | define a set of regular expression substitution patterns which |
|
1797 | define a set of regular expression substitution patterns which | |
1793 | let you automatically modify the hgweb server output. |
|
1798 | let you automatically modify the hgweb server output. | |
1794 |
|
1799 | |||
1795 | The default hgweb templates only apply these substitution patterns |
|
1800 | The default hgweb templates only apply these substitution patterns | |
1796 | on the revision description fields. You can apply them anywhere |
|
1801 | on the revision description fields. You can apply them anywhere | |
1797 | you want when you create your own templates by adding calls to the |
|
1802 | you want when you create your own templates by adding calls to the | |
1798 | "websub" filter (usually after calling the "escape" filter). |
|
1803 | "websub" filter (usually after calling the "escape" filter). | |
1799 |
|
1804 | |||
1800 | This can be used, for example, to convert issue references to links |
|
1805 | This can be used, for example, to convert issue references to links | |
1801 | to your issue tracker, or to convert "markdown-like" syntax into |
|
1806 | to your issue tracker, or to convert "markdown-like" syntax into | |
1802 | HTML (see the examples below). |
|
1807 | HTML (see the examples below). | |
1803 |
|
1808 | |||
1804 | Each entry in this section names a substitution filter. |
|
1809 | Each entry in this section names a substitution filter. | |
1805 | The value of each entry defines the substitution expression itself. |
|
1810 | The value of each entry defines the substitution expression itself. | |
1806 | The websub expressions follow the old interhg extension syntax, |
|
1811 | The websub expressions follow the old interhg extension syntax, | |
1807 | which in turn imitates the Unix sed replacement syntax:: |
|
1812 | which in turn imitates the Unix sed replacement syntax:: | |
1808 |
|
1813 | |||
1809 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
1814 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
1810 |
|
1815 | |||
1811 | You can use any separator other than "/". The final "i" is optional |
|
1816 | You can use any separator other than "/". The final "i" is optional | |
1812 | and indicates that the search must be case insensitive. |
|
1817 | and indicates that the search must be case insensitive. | |
1813 |
|
1818 | |||
1814 | Examples:: |
|
1819 | Examples:: | |
1815 |
|
1820 | |||
1816 | [websub] |
|
1821 | [websub] | |
1817 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
1822 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
1818 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
1823 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
1819 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
1824 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
1820 |
|
1825 | |||
1821 | ``worker`` |
|
1826 | ``worker`` | |
1822 | ---------- |
|
1827 | ---------- | |
1823 |
|
1828 | |||
1824 | Parallel master/worker configuration. We currently perform working |
|
1829 | Parallel master/worker configuration. We currently perform working | |
1825 | directory updates in parallel on Unix-like systems, which greatly |
|
1830 | directory updates in parallel on Unix-like systems, which greatly | |
1826 | helps performance. |
|
1831 | helps performance. | |
1827 |
|
1832 | |||
1828 | ``numcpus`` |
|
1833 | ``numcpus`` | |
1829 | Number of CPUs to use for parallel operations. A zero or |
|
1834 | Number of CPUs to use for parallel operations. A zero or | |
1830 | negative value is treated as ``use the default``. |
|
1835 | negative value is treated as ``use the default``. | |
1831 | (default: 4 or the number of CPUs on the system, whichever is larger) |
|
1836 | (default: 4 or the number of CPUs on the system, whichever is larger) |
@@ -1,1169 +1,1178 b'' | |||||
1 | Test basic extension support |
|
1 | Test basic extension support | |
2 |
|
2 | |||
3 | $ cat > foobar.py <<EOF |
|
3 | $ cat > foobar.py <<EOF | |
4 | > import os |
|
4 | > import os | |
5 | > from mercurial import cmdutil, commands |
|
5 | > from mercurial import cmdutil, commands | |
6 | > cmdtable = {} |
|
6 | > cmdtable = {} | |
7 | > command = cmdutil.command(cmdtable) |
|
7 | > command = cmdutil.command(cmdtable) | |
8 | > def uisetup(ui): |
|
8 | > def uisetup(ui): | |
9 | > ui.write("uisetup called\\n") |
|
9 | > ui.write("uisetup called\\n") | |
10 | > def reposetup(ui, repo): |
|
10 | > def reposetup(ui, repo): | |
11 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
11 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) | |
12 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
|
12 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) | |
13 | > @command('foo', [], 'hg foo') |
|
13 | > @command('foo', [], 'hg foo') | |
14 | > def foo(ui, *args, **kwargs): |
|
14 | > def foo(ui, *args, **kwargs): | |
15 | > ui.write("Foo\\n") |
|
15 | > ui.write("Foo\\n") | |
16 | > @command('bar', [], 'hg bar', norepo=True) |
|
16 | > @command('bar', [], 'hg bar', norepo=True) | |
17 | > def bar(ui, *args, **kwargs): |
|
17 | > def bar(ui, *args, **kwargs): | |
18 | > ui.write("Bar\\n") |
|
18 | > ui.write("Bar\\n") | |
19 | > EOF |
|
19 | > EOF | |
20 | $ abspath=`pwd`/foobar.py |
|
20 | $ abspath=`pwd`/foobar.py | |
21 |
|
21 | |||
22 | $ mkdir barfoo |
|
22 | $ mkdir barfoo | |
23 | $ cp foobar.py barfoo/__init__.py |
|
23 | $ cp foobar.py barfoo/__init__.py | |
24 | $ barfoopath=`pwd`/barfoo |
|
24 | $ barfoopath=`pwd`/barfoo | |
25 |
|
25 | |||
26 | $ hg init a |
|
26 | $ hg init a | |
27 | $ cd a |
|
27 | $ cd a | |
28 | $ echo foo > file |
|
28 | $ echo foo > file | |
29 | $ hg add file |
|
29 | $ hg add file | |
30 | $ hg commit -m 'add file' |
|
30 | $ hg commit -m 'add file' | |
31 |
|
31 | |||
32 | $ echo '[extensions]' >> $HGRCPATH |
|
32 | $ echo '[extensions]' >> $HGRCPATH | |
33 | $ echo "foobar = $abspath" >> $HGRCPATH |
|
33 | $ echo "foobar = $abspath" >> $HGRCPATH | |
34 | $ hg foo |
|
34 | $ hg foo | |
35 | uisetup called |
|
35 | uisetup called | |
36 | reposetup called for a |
|
36 | reposetup called for a | |
37 | ui == repo.ui |
|
37 | ui == repo.ui | |
38 | Foo |
|
38 | Foo | |
39 |
|
39 | |||
40 | $ cd .. |
|
40 | $ cd .. | |
41 | $ hg clone a b |
|
41 | $ hg clone a b | |
42 | uisetup called |
|
42 | uisetup called | |
43 | reposetup called for a |
|
43 | reposetup called for a | |
44 | ui == repo.ui |
|
44 | ui == repo.ui | |
45 | reposetup called for b |
|
45 | reposetup called for b | |
46 | ui == repo.ui |
|
46 | ui == repo.ui | |
47 | updating to branch default |
|
47 | updating to branch default | |
48 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
48 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
49 |
|
49 | |||
50 | $ hg bar |
|
50 | $ hg bar | |
51 | uisetup called |
|
51 | uisetup called | |
52 | Bar |
|
52 | Bar | |
53 | $ echo 'foobar = !' >> $HGRCPATH |
|
53 | $ echo 'foobar = !' >> $HGRCPATH | |
54 |
|
54 | |||
55 | module/__init__.py-style |
|
55 | module/__init__.py-style | |
56 |
|
56 | |||
57 | $ echo "barfoo = $barfoopath" >> $HGRCPATH |
|
57 | $ echo "barfoo = $barfoopath" >> $HGRCPATH | |
58 | $ cd a |
|
58 | $ cd a | |
59 | $ hg foo |
|
59 | $ hg foo | |
60 | uisetup called |
|
60 | uisetup called | |
61 | reposetup called for a |
|
61 | reposetup called for a | |
62 | ui == repo.ui |
|
62 | ui == repo.ui | |
63 | Foo |
|
63 | Foo | |
64 | $ echo 'barfoo = !' >> $HGRCPATH |
|
64 | $ echo 'barfoo = !' >> $HGRCPATH | |
65 |
|
65 | |||
66 | Check that extensions are loaded in phases: |
|
66 | Check that extensions are loaded in phases: | |
67 |
|
67 | |||
68 | $ cat > foo.py <<EOF |
|
68 | $ cat > foo.py <<EOF | |
69 | > import os |
|
69 | > import os | |
70 | > name = os.path.basename(__file__).rsplit('.', 1)[0] |
|
70 | > name = os.path.basename(__file__).rsplit('.', 1)[0] | |
71 | > print "1) %s imported" % name |
|
71 | > print "1) %s imported" % name | |
72 | > def uisetup(ui): |
|
72 | > def uisetup(ui): | |
73 | > print "2) %s uisetup" % name |
|
73 | > print "2) %s uisetup" % name | |
74 | > def extsetup(): |
|
74 | > def extsetup(): | |
75 | > print "3) %s extsetup" % name |
|
75 | > print "3) %s extsetup" % name | |
76 | > def reposetup(ui, repo): |
|
76 | > def reposetup(ui, repo): | |
77 | > print "4) %s reposetup" % name |
|
77 | > print "4) %s reposetup" % name | |
78 | > EOF |
|
78 | > EOF | |
79 |
|
79 | |||
80 | $ cp foo.py bar.py |
|
80 | $ cp foo.py bar.py | |
81 | $ echo 'foo = foo.py' >> $HGRCPATH |
|
81 | $ echo 'foo = foo.py' >> $HGRCPATH | |
82 | $ echo 'bar = bar.py' >> $HGRCPATH |
|
82 | $ echo 'bar = bar.py' >> $HGRCPATH | |
83 |
|
83 | |||
84 | Command with no output, we just want to see the extensions loaded: |
|
84 | Command with no output, we just want to see the extensions loaded: | |
85 |
|
85 | |||
86 | $ hg paths |
|
86 | $ hg paths | |
87 | 1) foo imported |
|
87 | 1) foo imported | |
88 | 1) bar imported |
|
88 | 1) bar imported | |
89 | 2) foo uisetup |
|
89 | 2) foo uisetup | |
90 | 2) bar uisetup |
|
90 | 2) bar uisetup | |
91 | 3) foo extsetup |
|
91 | 3) foo extsetup | |
92 | 3) bar extsetup |
|
92 | 3) bar extsetup | |
93 | 4) foo reposetup |
|
93 | 4) foo reposetup | |
94 | 4) bar reposetup |
|
94 | 4) bar reposetup | |
95 |
|
95 | |||
96 | Check hgweb's load order: |
|
96 | Check hgweb's load order: | |
97 |
|
97 | |||
98 | $ cat > hgweb.cgi <<EOF |
|
98 | $ cat > hgweb.cgi <<EOF | |
99 | > #!/usr/bin/env python |
|
99 | > #!/usr/bin/env python | |
100 | > from mercurial import demandimport; demandimport.enable() |
|
100 | > from mercurial import demandimport; demandimport.enable() | |
101 | > from mercurial.hgweb import hgweb |
|
101 | > from mercurial.hgweb import hgweb | |
102 | > from mercurial.hgweb import wsgicgi |
|
102 | > from mercurial.hgweb import wsgicgi | |
103 | > application = hgweb('.', 'test repo') |
|
103 | > application = hgweb('.', 'test repo') | |
104 | > wsgicgi.launch(application) |
|
104 | > wsgicgi.launch(application) | |
105 | > EOF |
|
105 | > EOF | |
106 |
|
106 | |||
107 | $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \ |
|
107 | $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \ | |
108 | > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \ |
|
108 | > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \ | |
109 | > | grep '^[0-9]) ' # ignores HTML output |
|
109 | > | grep '^[0-9]) ' # ignores HTML output | |
110 | 1) foo imported |
|
110 | 1) foo imported | |
111 | 1) bar imported |
|
111 | 1) bar imported | |
112 | 2) foo uisetup |
|
112 | 2) foo uisetup | |
113 | 2) bar uisetup |
|
113 | 2) bar uisetup | |
114 | 3) foo extsetup |
|
114 | 3) foo extsetup | |
115 | 3) bar extsetup |
|
115 | 3) bar extsetup | |
116 | 4) foo reposetup |
|
116 | 4) foo reposetup | |
117 | 4) bar reposetup |
|
117 | 4) bar reposetup | |
118 |
|
118 | |||
119 | $ echo 'foo = !' >> $HGRCPATH |
|
119 | $ echo 'foo = !' >> $HGRCPATH | |
120 | $ echo 'bar = !' >> $HGRCPATH |
|
120 | $ echo 'bar = !' >> $HGRCPATH | |
121 |
|
121 | |||
122 | Check "from __future__ import absolute_import" support for external libraries |
|
122 | Check "from __future__ import absolute_import" support for external libraries | |
123 |
|
123 | |||
124 | #if windows |
|
124 | #if windows | |
125 | $ PATHSEP=";" |
|
125 | $ PATHSEP=";" | |
126 | #else |
|
126 | #else | |
127 | $ PATHSEP=":" |
|
127 | $ PATHSEP=":" | |
128 | #endif |
|
128 | #endif | |
129 | $ export PATHSEP |
|
129 | $ export PATHSEP | |
130 |
|
130 | |||
131 | $ mkdir $TESTTMP/libroot |
|
131 | $ mkdir $TESTTMP/libroot | |
132 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py |
|
132 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py | |
133 | $ mkdir $TESTTMP/libroot/mod |
|
133 | $ mkdir $TESTTMP/libroot/mod | |
134 | $ touch $TESTTMP/libroot/mod/__init__.py |
|
134 | $ touch $TESTTMP/libroot/mod/__init__.py | |
135 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py |
|
135 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py | |
136 |
|
136 | |||
137 | #if absimport |
|
137 | #if absimport | |
138 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF |
|
138 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF | |
139 | > from __future__ import absolute_import |
|
139 | > from __future__ import absolute_import | |
140 | > import ambig # should load "libroot/ambig.py" |
|
140 | > import ambig # should load "libroot/ambig.py" | |
141 | > s = ambig.s |
|
141 | > s = ambig.s | |
142 | > EOF |
|
142 | > EOF | |
143 | $ cat > loadabs.py <<EOF |
|
143 | $ cat > loadabs.py <<EOF | |
144 | > import mod.ambigabs as ambigabs |
|
144 | > import mod.ambigabs as ambigabs | |
145 | > def extsetup(): |
|
145 | > def extsetup(): | |
146 | > print 'ambigabs.s=%s' % ambigabs.s |
|
146 | > print 'ambigabs.s=%s' % ambigabs.s | |
147 | > EOF |
|
147 | > EOF | |
148 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) |
|
148 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) | |
149 | ambigabs.s=libroot/ambig.py |
|
149 | ambigabs.s=libroot/ambig.py | |
150 | $TESTTMP/a (glob) |
|
150 | $TESTTMP/a (glob) | |
151 | #endif |
|
151 | #endif | |
152 |
|
152 | |||
153 | #if no-py3k |
|
153 | #if no-py3k | |
154 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF |
|
154 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF | |
155 | > import ambig # should load "libroot/mod/ambig.py" |
|
155 | > import ambig # should load "libroot/mod/ambig.py" | |
156 | > s = ambig.s |
|
156 | > s = ambig.s | |
157 | > EOF |
|
157 | > EOF | |
158 | $ cat > loadrel.py <<EOF |
|
158 | $ cat > loadrel.py <<EOF | |
159 | > import mod.ambigrel as ambigrel |
|
159 | > import mod.ambigrel as ambigrel | |
160 | > def extsetup(): |
|
160 | > def extsetup(): | |
161 | > print 'ambigrel.s=%s' % ambigrel.s |
|
161 | > print 'ambigrel.s=%s' % ambigrel.s | |
162 | > EOF |
|
162 | > EOF | |
163 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) |
|
163 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) | |
164 | ambigrel.s=libroot/mod/ambig.py |
|
164 | ambigrel.s=libroot/mod/ambig.py | |
165 | $TESTTMP/a (glob) |
|
165 | $TESTTMP/a (glob) | |
166 | #endif |
|
166 | #endif | |
167 |
|
167 | |||
168 | Check absolute/relative import of extension specific modules |
|
168 | Check absolute/relative import of extension specific modules | |
169 |
|
169 | |||
170 | $ mkdir $TESTTMP/extroot |
|
170 | $ mkdir $TESTTMP/extroot | |
171 | $ cat > $TESTTMP/extroot/bar.py <<EOF |
|
171 | $ cat > $TESTTMP/extroot/bar.py <<EOF | |
172 | > s = 'this is extroot.bar' |
|
172 | > s = 'this is extroot.bar' | |
173 | > EOF |
|
173 | > EOF | |
174 | $ mkdir $TESTTMP/extroot/sub1 |
|
174 | $ mkdir $TESTTMP/extroot/sub1 | |
175 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF |
|
175 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF | |
176 | > s = 'this is extroot.sub1.__init__' |
|
176 | > s = 'this is extroot.sub1.__init__' | |
177 | > EOF |
|
177 | > EOF | |
178 | $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF |
|
178 | $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF | |
179 | > s = 'this is extroot.sub1.baz' |
|
179 | > s = 'this is extroot.sub1.baz' | |
180 | > EOF |
|
180 | > EOF | |
181 | $ cat > $TESTTMP/extroot/__init__.py <<EOF |
|
181 | $ cat > $TESTTMP/extroot/__init__.py <<EOF | |
182 | > s = 'this is extroot.__init__' |
|
182 | > s = 'this is extroot.__init__' | |
183 | > import foo |
|
183 | > import foo | |
184 | > def extsetup(ui): |
|
184 | > def extsetup(ui): | |
185 | > ui.write('(extroot) ', foo.func(), '\n') |
|
185 | > ui.write('(extroot) ', foo.func(), '\n') | |
186 | > EOF |
|
186 | > EOF | |
187 |
|
187 | |||
188 | $ cat > $TESTTMP/extroot/foo.py <<EOF |
|
188 | $ cat > $TESTTMP/extroot/foo.py <<EOF | |
189 | > # test absolute import |
|
189 | > # test absolute import | |
190 | > buf = [] |
|
190 | > buf = [] | |
191 | > def func(): |
|
191 | > def func(): | |
192 | > # "not locals" case |
|
192 | > # "not locals" case | |
193 | > import extroot.bar |
|
193 | > import extroot.bar | |
194 | > buf.append('import extroot.bar in func(): %s' % extroot.bar.s) |
|
194 | > buf.append('import extroot.bar in func(): %s' % extroot.bar.s) | |
195 | > return '\n(extroot) '.join(buf) |
|
195 | > return '\n(extroot) '.join(buf) | |
196 | > # "fromlist == ('*',)" case |
|
196 | > # "fromlist == ('*',)" case | |
197 | > from extroot.bar import * |
|
197 | > from extroot.bar import * | |
198 | > buf.append('from extroot.bar import *: %s' % s) |
|
198 | > buf.append('from extroot.bar import *: %s' % s) | |
199 | > # "not fromlist" and "if '.' in name" case |
|
199 | > # "not fromlist" and "if '.' in name" case | |
200 | > import extroot.sub1.baz |
|
200 | > import extroot.sub1.baz | |
201 | > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s) |
|
201 | > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s) | |
202 | > # "not fromlist" and NOT "if '.' in name" case |
|
202 | > # "not fromlist" and NOT "if '.' in name" case | |
203 | > import extroot |
|
203 | > import extroot | |
204 | > buf.append('import extroot: %s' % extroot.s) |
|
204 | > buf.append('import extroot: %s' % extroot.s) | |
205 | > # NOT "not fromlist" and NOT "level != -1" case |
|
205 | > # NOT "not fromlist" and NOT "level != -1" case | |
206 | > from extroot.bar import s |
|
206 | > from extroot.bar import s | |
207 | > buf.append('from extroot.bar import s: %s' % s) |
|
207 | > buf.append('from extroot.bar import s: %s' % s) | |
208 | > EOF |
|
208 | > EOF | |
209 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
209 | $ hg --config extensions.extroot=$TESTTMP/extroot root | |
210 | (extroot) from extroot.bar import *: this is extroot.bar |
|
210 | (extroot) from extroot.bar import *: this is extroot.bar | |
211 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz |
|
211 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz | |
212 | (extroot) import extroot: this is extroot.__init__ |
|
212 | (extroot) import extroot: this is extroot.__init__ | |
213 | (extroot) from extroot.bar import s: this is extroot.bar |
|
213 | (extroot) from extroot.bar import s: this is extroot.bar | |
214 | (extroot) import extroot.bar in func(): this is extroot.bar |
|
214 | (extroot) import extroot.bar in func(): this is extroot.bar | |
215 | $TESTTMP/a (glob) |
|
215 | $TESTTMP/a (glob) | |
216 |
|
216 | |||
217 | #if no-py3k |
|
217 | #if no-py3k | |
218 | $ rm "$TESTTMP"/extroot/foo.* |
|
218 | $ rm "$TESTTMP"/extroot/foo.* | |
219 | $ cat > $TESTTMP/extroot/foo.py <<EOF |
|
219 | $ cat > $TESTTMP/extroot/foo.py <<EOF | |
220 | > # test relative import |
|
220 | > # test relative import | |
221 | > buf = [] |
|
221 | > buf = [] | |
222 | > def func(): |
|
222 | > def func(): | |
223 | > # "not locals" case |
|
223 | > # "not locals" case | |
224 | > import bar |
|
224 | > import bar | |
225 | > buf.append('import bar in func(): %s' % bar.s) |
|
225 | > buf.append('import bar in func(): %s' % bar.s) | |
226 | > return '\n(extroot) '.join(buf) |
|
226 | > return '\n(extroot) '.join(buf) | |
227 | > # "fromlist == ('*',)" case |
|
227 | > # "fromlist == ('*',)" case | |
228 | > from bar import * |
|
228 | > from bar import * | |
229 | > buf.append('from bar import *: %s' % s) |
|
229 | > buf.append('from bar import *: %s' % s) | |
230 | > # "not fromlist" and "if '.' in name" case |
|
230 | > # "not fromlist" and "if '.' in name" case | |
231 | > import sub1.baz |
|
231 | > import sub1.baz | |
232 | > buf.append('import sub1.baz: %s' % sub1.baz.s) |
|
232 | > buf.append('import sub1.baz: %s' % sub1.baz.s) | |
233 | > # "not fromlist" and NOT "if '.' in name" case |
|
233 | > # "not fromlist" and NOT "if '.' in name" case | |
234 | > import sub1 |
|
234 | > import sub1 | |
235 | > buf.append('import sub1: %s' % sub1.s) |
|
235 | > buf.append('import sub1: %s' % sub1.s) | |
236 | > # NOT "not fromlist" and NOT "level != -1" case |
|
236 | > # NOT "not fromlist" and NOT "level != -1" case | |
237 | > from bar import s |
|
237 | > from bar import s | |
238 | > buf.append('from bar import s: %s' % s) |
|
238 | > buf.append('from bar import s: %s' % s) | |
239 | > EOF |
|
239 | > EOF | |
240 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
240 | $ hg --config extensions.extroot=$TESTTMP/extroot root | |
241 | (extroot) from bar import *: this is extroot.bar |
|
241 | (extroot) from bar import *: this is extroot.bar | |
242 | (extroot) import sub1.baz: this is extroot.sub1.baz |
|
242 | (extroot) import sub1.baz: this is extroot.sub1.baz | |
243 | (extroot) import sub1: this is extroot.sub1.__init__ |
|
243 | (extroot) import sub1: this is extroot.sub1.__init__ | |
244 | (extroot) from bar import s: this is extroot.bar |
|
244 | (extroot) from bar import s: this is extroot.bar | |
245 | (extroot) import bar in func(): this is extroot.bar |
|
245 | (extroot) import bar in func(): this is extroot.bar | |
246 | $TESTTMP/a (glob) |
|
246 | $TESTTMP/a (glob) | |
247 | #endif |
|
247 | #endif | |
248 |
|
248 | |||
249 | $ cd .. |
|
249 | $ cd .. | |
250 |
|
250 | |||
251 | hide outer repo |
|
251 | hide outer repo | |
252 | $ hg init |
|
252 | $ hg init | |
253 |
|
253 | |||
254 | $ cat > empty.py <<EOF |
|
254 | $ cat > empty.py <<EOF | |
255 | > '''empty cmdtable |
|
255 | > '''empty cmdtable | |
256 | > ''' |
|
256 | > ''' | |
257 | > cmdtable = {} |
|
257 | > cmdtable = {} | |
258 | > EOF |
|
258 | > EOF | |
259 | $ emptypath=`pwd`/empty.py |
|
259 | $ emptypath=`pwd`/empty.py | |
260 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
260 | $ echo "empty = $emptypath" >> $HGRCPATH | |
261 | $ hg help empty |
|
261 | $ hg help empty | |
262 | empty extension - empty cmdtable |
|
262 | empty extension - empty cmdtable | |
263 |
|
263 | |||
264 | no commands defined |
|
264 | no commands defined | |
265 |
|
265 | |||
266 |
|
266 | |||
267 | $ echo 'empty = !' >> $HGRCPATH |
|
267 | $ echo 'empty = !' >> $HGRCPATH | |
268 |
|
268 | |||
269 | $ cat > debugextension.py <<EOF |
|
269 | $ cat > debugextension.py <<EOF | |
270 | > '''only debugcommands |
|
270 | > '''only debugcommands | |
271 | > ''' |
|
271 | > ''' | |
272 | > from mercurial import cmdutil |
|
272 | > from mercurial import cmdutil | |
273 | > cmdtable = {} |
|
273 | > cmdtable = {} | |
274 | > command = cmdutil.command(cmdtable) |
|
274 | > command = cmdutil.command(cmdtable) | |
275 | > @command('debugfoobar', [], 'hg debugfoobar') |
|
275 | > @command('debugfoobar', [], 'hg debugfoobar') | |
276 | > def debugfoobar(ui, repo, *args, **opts): |
|
276 | > def debugfoobar(ui, repo, *args, **opts): | |
277 | > "yet another debug command" |
|
277 | > "yet another debug command" | |
278 | > pass |
|
278 | > pass | |
279 | > @command('foo', [], 'hg foo') |
|
279 | > @command('foo', [], 'hg foo') | |
280 | > def foo(ui, repo, *args, **opts): |
|
280 | > def foo(ui, repo, *args, **opts): | |
281 | > """yet another foo command |
|
281 | > """yet another foo command | |
282 | > This command has been DEPRECATED since forever. |
|
282 | > This command has been DEPRECATED since forever. | |
283 | > """ |
|
283 | > """ | |
284 | > pass |
|
284 | > pass | |
285 | > EOF |
|
285 | > EOF | |
286 | $ debugpath=`pwd`/debugextension.py |
|
286 | $ debugpath=`pwd`/debugextension.py | |
287 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
287 | $ echo "debugextension = $debugpath" >> $HGRCPATH | |
288 |
|
288 | |||
289 | $ hg help debugextension |
|
289 | $ hg help debugextension | |
290 | debugextension extension - only debugcommands |
|
290 | debugextension extension - only debugcommands | |
291 |
|
291 | |||
292 | no commands defined |
|
292 | no commands defined | |
293 |
|
293 | |||
294 |
|
294 | |||
295 | $ hg --verbose help debugextension |
|
295 | $ hg --verbose help debugextension | |
296 | debugextension extension - only debugcommands |
|
296 | debugextension extension - only debugcommands | |
297 |
|
297 | |||
298 | list of commands: |
|
298 | list of commands: | |
299 |
|
299 | |||
300 | foo yet another foo command |
|
300 | foo yet another foo command | |
301 |
|
301 | |||
302 | global options ([+] can be repeated): |
|
302 | global options ([+] can be repeated): | |
303 |
|
303 | |||
304 | -R --repository REPO repository root directory or name of overlay bundle |
|
304 | -R --repository REPO repository root directory or name of overlay bundle | |
305 | file |
|
305 | file | |
306 | --cwd DIR change working directory |
|
306 | --cwd DIR change working directory | |
307 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
307 | -y --noninteractive do not prompt, automatically pick the first choice for | |
308 | all prompts |
|
308 | all prompts | |
309 | -q --quiet suppress output |
|
309 | -q --quiet suppress output | |
310 | -v --verbose enable additional output |
|
310 | -v --verbose enable additional output | |
311 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
311 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
312 | --debug enable debugging output |
|
312 | --debug enable debugging output | |
313 | --debugger start debugger |
|
313 | --debugger start debugger | |
314 | --encoding ENCODE set the charset encoding (default: ascii) |
|
314 | --encoding ENCODE set the charset encoding (default: ascii) | |
315 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
315 | --encodingmode MODE set the charset encoding mode (default: strict) | |
316 | --traceback always print a traceback on exception |
|
316 | --traceback always print a traceback on exception | |
317 | --time time how long the command takes |
|
317 | --time time how long the command takes | |
318 | --profile print command execution profile |
|
318 | --profile print command execution profile | |
319 | --version output version information and exit |
|
319 | --version output version information and exit | |
320 | -h --help display help and exit |
|
320 | -h --help display help and exit | |
321 | --hidden consider hidden changesets |
|
321 | --hidden consider hidden changesets | |
322 |
|
322 | |||
323 |
|
323 | |||
324 |
|
324 | |||
325 |
|
325 | |||
326 |
|
326 | |||
327 |
|
327 | |||
328 | $ hg --debug help debugextension |
|
328 | $ hg --debug help debugextension | |
329 | debugextension extension - only debugcommands |
|
329 | debugextension extension - only debugcommands | |
330 |
|
330 | |||
331 | list of commands: |
|
331 | list of commands: | |
332 |
|
332 | |||
333 | debugfoobar yet another debug command |
|
333 | debugfoobar yet another debug command | |
334 | foo yet another foo command |
|
334 | foo yet another foo command | |
335 |
|
335 | |||
336 | global options ([+] can be repeated): |
|
336 | global options ([+] can be repeated): | |
337 |
|
337 | |||
338 | -R --repository REPO repository root directory or name of overlay bundle |
|
338 | -R --repository REPO repository root directory or name of overlay bundle | |
339 | file |
|
339 | file | |
340 | --cwd DIR change working directory |
|
340 | --cwd DIR change working directory | |
341 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
341 | -y --noninteractive do not prompt, automatically pick the first choice for | |
342 | all prompts |
|
342 | all prompts | |
343 | -q --quiet suppress output |
|
343 | -q --quiet suppress output | |
344 | -v --verbose enable additional output |
|
344 | -v --verbose enable additional output | |
345 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
345 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
346 | --debug enable debugging output |
|
346 | --debug enable debugging output | |
347 | --debugger start debugger |
|
347 | --debugger start debugger | |
348 | --encoding ENCODE set the charset encoding (default: ascii) |
|
348 | --encoding ENCODE set the charset encoding (default: ascii) | |
349 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
349 | --encodingmode MODE set the charset encoding mode (default: strict) | |
350 | --traceback always print a traceback on exception |
|
350 | --traceback always print a traceback on exception | |
351 | --time time how long the command takes |
|
351 | --time time how long the command takes | |
352 | --profile print command execution profile |
|
352 | --profile print command execution profile | |
353 | --version output version information and exit |
|
353 | --version output version information and exit | |
354 | -h --help display help and exit |
|
354 | -h --help display help and exit | |
355 | --hidden consider hidden changesets |
|
355 | --hidden consider hidden changesets | |
356 |
|
356 | |||
357 |
|
357 | |||
358 |
|
358 | |||
359 |
|
359 | |||
360 |
|
360 | |||
361 | $ echo 'debugextension = !' >> $HGRCPATH |
|
361 | $ echo 'debugextension = !' >> $HGRCPATH | |
362 |
|
362 | |||
363 | Extension module help vs command help: |
|
363 | Extension module help vs command help: | |
364 |
|
364 | |||
365 | $ echo 'extdiff =' >> $HGRCPATH |
|
365 | $ echo 'extdiff =' >> $HGRCPATH | |
366 | $ hg help extdiff |
|
366 | $ hg help extdiff | |
367 | hg extdiff [OPT]... [FILE]... |
|
367 | hg extdiff [OPT]... [FILE]... | |
368 |
|
368 | |||
369 | use external program to diff repository (or selected files) |
|
369 | use external program to diff repository (or selected files) | |
370 |
|
370 | |||
371 | Show differences between revisions for the specified files, using an |
|
371 | Show differences between revisions for the specified files, using an | |
372 | external program. The default program used is diff, with default options |
|
372 | external program. The default program used is diff, with default options | |
373 | "-Npru". |
|
373 | "-Npru". | |
374 |
|
374 | |||
375 | To select a different program, use the -p/--program option. The program |
|
375 | To select a different program, use the -p/--program option. The program | |
376 | will be passed the names of two directories to compare. To pass additional |
|
376 | will be passed the names of two directories to compare. To pass additional | |
377 | options to the program, use -o/--option. These will be passed before the |
|
377 | options to the program, use -o/--option. These will be passed before the | |
378 | names of the directories to compare. |
|
378 | names of the directories to compare. | |
379 |
|
379 | |||
380 | When two revision arguments are given, then changes are shown between |
|
380 | When two revision arguments are given, then changes are shown between | |
381 | those revisions. If only one revision is specified then that revision is |
|
381 | those revisions. If only one revision is specified then that revision is | |
382 | compared to the working directory, and, when no revisions are specified, |
|
382 | compared to the working directory, and, when no revisions are specified, | |
383 | the working directory files are compared to its parent. |
|
383 | the working directory files are compared to its parent. | |
384 |
|
384 | |||
385 | (use "hg help -e extdiff" to show help for the extdiff extension) |
|
385 | (use "hg help -e extdiff" to show help for the extdiff extension) | |
386 |
|
386 | |||
387 | options ([+] can be repeated): |
|
387 | options ([+] can be repeated): | |
388 |
|
388 | |||
389 | -p --program CMD comparison program to run |
|
389 | -p --program CMD comparison program to run | |
390 | -o --option OPT [+] pass option to comparison program |
|
390 | -o --option OPT [+] pass option to comparison program | |
391 | -r --rev REV [+] revision |
|
391 | -r --rev REV [+] revision | |
392 | -c --change REV change made by revision |
|
392 | -c --change REV change made by revision | |
393 | --patch compare patches for two revisions |
|
393 | --patch compare patches for two revisions | |
394 | -I --include PATTERN [+] include names matching the given patterns |
|
394 | -I --include PATTERN [+] include names matching the given patterns | |
395 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
395 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
396 | -S --subrepos recurse into subrepositories |
|
396 | -S --subrepos recurse into subrepositories | |
397 |
|
397 | |||
398 | (some details hidden, use --verbose to show complete help) |
|
398 | (some details hidden, use --verbose to show complete help) | |
399 |
|
399 | |||
400 |
|
400 | |||
401 |
|
401 | |||
402 |
|
402 | |||
403 |
|
403 | |||
404 |
|
404 | |||
405 |
|
405 | |||
406 |
|
406 | |||
407 |
|
407 | |||
408 |
|
408 | |||
409 | $ hg help --extension extdiff |
|
409 | $ hg help --extension extdiff | |
410 | extdiff extension - command to allow external programs to compare revisions |
|
410 | extdiff extension - command to allow external programs to compare revisions | |
411 |
|
411 | |||
412 | The extdiff Mercurial extension allows you to use external programs to compare |
|
412 | The extdiff Mercurial extension allows you to use external programs to compare | |
413 | revisions, or revision with working directory. The external diff programs are |
|
413 | revisions, or revision with working directory. The external diff programs are | |
414 | called with a configurable set of options and two non-option arguments: paths |
|
414 | called with a configurable set of options and two non-option arguments: paths | |
415 | to directories containing snapshots of files to compare. |
|
415 | to directories containing snapshots of files to compare. | |
416 |
|
416 | |||
417 | The extdiff extension also allows you to configure new diff commands, so you |
|
417 | The extdiff extension also allows you to configure new diff commands, so you | |
418 | do not need to type "hg extdiff -p kdiff3" always. |
|
418 | do not need to type "hg extdiff -p kdiff3" always. | |
419 |
|
419 | |||
420 | [extdiff] |
|
420 | [extdiff] | |
421 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
421 | # add new command that runs GNU diff(1) in 'context diff' mode | |
422 | cdiff = gdiff -Nprc5 |
|
422 | cdiff = gdiff -Nprc5 | |
423 | ## or the old way: |
|
423 | ## or the old way: | |
424 | #cmd.cdiff = gdiff |
|
424 | #cmd.cdiff = gdiff | |
425 | #opts.cdiff = -Nprc5 |
|
425 | #opts.cdiff = -Nprc5 | |
426 |
|
426 | |||
427 | # add new command called meld, runs meld (no need to name twice). If |
|
427 | # add new command called meld, runs meld (no need to name twice). If | |
428 | # the meld executable is not available, the meld tool in [merge-tools] |
|
428 | # the meld executable is not available, the meld tool in [merge-tools] | |
429 | # will be used, if available |
|
429 | # will be used, if available | |
430 | meld = |
|
430 | meld = | |
431 |
|
431 | |||
432 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
432 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin | |
433 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
433 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non | |
434 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
434 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in | |
435 | # your .vimrc |
|
435 | # your .vimrc | |
436 | vimdiff = gvim -f "+next" \ |
|
436 | vimdiff = gvim -f "+next" \ | |
437 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
437 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" | |
438 |
|
438 | |||
439 | Tool arguments can include variables that are expanded at runtime: |
|
439 | Tool arguments can include variables that are expanded at runtime: | |
440 |
|
440 | |||
441 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
441 | $parent1, $plabel1 - filename, descriptive label of first parent | |
442 | $child, $clabel - filename, descriptive label of child revision |
|
442 | $child, $clabel - filename, descriptive label of child revision | |
443 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
443 | $parent2, $plabel2 - filename, descriptive label of second parent | |
444 | $root - repository root |
|
444 | $root - repository root | |
445 | $parent is an alias for $parent1. |
|
445 | $parent is an alias for $parent1. | |
446 |
|
446 | |||
447 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
447 | The extdiff extension will look in your [diff-tools] and [merge-tools] | |
448 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
448 | sections for diff tool arguments, when none are specified in [extdiff]. | |
449 |
|
449 | |||
450 | [extdiff] |
|
450 | [extdiff] | |
451 | kdiff3 = |
|
451 | kdiff3 = | |
452 |
|
452 | |||
453 | [diff-tools] |
|
453 | [diff-tools] | |
454 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
454 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child | |
455 |
|
455 | |||
456 | You can use -I/-X and list of file or directory names like normal "hg diff" |
|
456 | You can use -I/-X and list of file or directory names like normal "hg diff" | |
457 | command. The extdiff extension makes snapshots of only needed files, so |
|
457 | command. The extdiff extension makes snapshots of only needed files, so | |
458 | running the external diff program will actually be pretty fast (at least |
|
458 | running the external diff program will actually be pretty fast (at least | |
459 | faster than having to compare the entire tree). |
|
459 | faster than having to compare the entire tree). | |
460 |
|
460 | |||
461 | list of commands: |
|
461 | list of commands: | |
462 |
|
462 | |||
463 | extdiff use external program to diff repository (or selected files) |
|
463 | extdiff use external program to diff repository (or selected files) | |
464 |
|
464 | |||
465 | (use "hg help -v -e extdiff" to show built-in aliases and global options) |
|
465 | (use "hg help -v -e extdiff" to show built-in aliases and global options) | |
466 |
|
466 | |||
467 |
|
467 | |||
468 |
|
468 | |||
469 |
|
469 | |||
470 |
|
470 | |||
471 |
|
471 | |||
472 |
|
472 | |||
473 |
|
473 | |||
474 |
|
474 | |||
475 |
|
475 | |||
476 |
|
476 | |||
477 |
|
477 | |||
478 |
|
478 | |||
479 |
|
479 | |||
480 |
|
480 | |||
481 |
|
481 | |||
482 | $ echo 'extdiff = !' >> $HGRCPATH |
|
482 | $ echo 'extdiff = !' >> $HGRCPATH | |
483 |
|
483 | |||
484 | Test help topic with same name as extension |
|
484 | Test help topic with same name as extension | |
485 |
|
485 | |||
486 | $ cat > multirevs.py <<EOF |
|
486 | $ cat > multirevs.py <<EOF | |
487 | > from mercurial import cmdutil, commands |
|
487 | > from mercurial import cmdutil, commands | |
488 | > cmdtable = {} |
|
488 | > cmdtable = {} | |
489 | > command = cmdutil.command(cmdtable) |
|
489 | > command = cmdutil.command(cmdtable) | |
490 | > """multirevs extension |
|
490 | > """multirevs extension | |
491 | > Big multi-line module docstring.""" |
|
491 | > Big multi-line module docstring.""" | |
492 | > @command('multirevs', [], 'ARG', norepo=True) |
|
492 | > @command('multirevs', [], 'ARG', norepo=True) | |
493 | > def multirevs(ui, repo, arg, *args, **opts): |
|
493 | > def multirevs(ui, repo, arg, *args, **opts): | |
494 | > """multirevs command""" |
|
494 | > """multirevs command""" | |
495 | > pass |
|
495 | > pass | |
496 | > EOF |
|
496 | > EOF | |
497 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
497 | $ echo "multirevs = multirevs.py" >> $HGRCPATH | |
498 |
|
498 | |||
499 | $ hg help multirevs |
|
499 | $ hg help multirevs | |
500 | Specifying Multiple Revisions |
|
500 | Specifying Multiple Revisions | |
501 | """"""""""""""""""""""""""""" |
|
501 | """"""""""""""""""""""""""""" | |
502 |
|
502 | |||
503 | When Mercurial accepts more than one revision, they may be specified |
|
503 | When Mercurial accepts more than one revision, they may be specified | |
504 | individually, or provided as a topologically continuous range, separated |
|
504 | individually, or provided as a topologically continuous range, separated | |
505 | by the ":" character. |
|
505 | by the ":" character. | |
506 |
|
506 | |||
507 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END are |
|
507 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END are | |
508 | revision identifiers. Both BEGIN and END are optional. If BEGIN is not |
|
508 | revision identifiers. Both BEGIN and END are optional. If BEGIN is not | |
509 | specified, it defaults to revision number 0. If END is not specified, it |
|
509 | specified, it defaults to revision number 0. If END is not specified, it | |
510 | defaults to the tip. The range ":" thus means "all revisions". |
|
510 | defaults to the tip. The range ":" thus means "all revisions". | |
511 |
|
511 | |||
512 | If BEGIN is greater than END, revisions are treated in reverse order. |
|
512 | If BEGIN is greater than END, revisions are treated in reverse order. | |
513 |
|
513 | |||
514 | A range acts as a closed interval. This means that a range of 3:5 gives 3, |
|
514 | A range acts as a closed interval. This means that a range of 3:5 gives 3, | |
515 | 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. |
|
515 | 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. | |
516 |
|
516 | |||
517 | use "hg help -c multirevs" to see help for the multirevs command |
|
517 | use "hg help -c multirevs" to see help for the multirevs command | |
518 |
|
518 | |||
519 |
|
519 | |||
520 |
|
520 | |||
521 |
|
521 | |||
522 |
|
522 | |||
523 |
|
523 | |||
524 | $ hg help -c multirevs |
|
524 | $ hg help -c multirevs | |
525 | hg multirevs ARG |
|
525 | hg multirevs ARG | |
526 |
|
526 | |||
527 | multirevs command |
|
527 | multirevs command | |
528 |
|
528 | |||
529 | (some details hidden, use --verbose to show complete help) |
|
529 | (some details hidden, use --verbose to show complete help) | |
530 |
|
530 | |||
531 |
|
531 | |||
532 |
|
532 | |||
533 | $ hg multirevs |
|
533 | $ hg multirevs | |
534 | hg multirevs: invalid arguments |
|
534 | hg multirevs: invalid arguments | |
535 | hg multirevs ARG |
|
535 | hg multirevs ARG | |
536 |
|
536 | |||
537 | multirevs command |
|
537 | multirevs command | |
538 |
|
538 | |||
539 | (use "hg multirevs -h" to show more help) |
|
539 | (use "hg multirevs -h" to show more help) | |
540 | [255] |
|
540 | [255] | |
541 |
|
541 | |||
542 |
|
542 | |||
543 |
|
543 | |||
544 | $ echo "multirevs = !" >> $HGRCPATH |
|
544 | $ echo "multirevs = !" >> $HGRCPATH | |
545 |
|
545 | |||
546 | Issue811: Problem loading extensions twice (by site and by user) |
|
546 | Issue811: Problem loading extensions twice (by site and by user) | |
547 |
|
547 | |||
548 | $ debugpath=`pwd`/debugissue811.py |
|
548 | $ debugpath=`pwd`/debugissue811.py | |
549 | $ cat > debugissue811.py <<EOF |
|
549 | $ cat > debugissue811.py <<EOF | |
550 | > '''show all loaded extensions |
|
550 | > '''show all loaded extensions | |
551 | > ''' |
|
551 | > ''' | |
552 | > from mercurial import cmdutil, commands, extensions |
|
552 | > from mercurial import cmdutil, commands, extensions | |
553 | > cmdtable = {} |
|
553 | > cmdtable = {} | |
554 | > command = cmdutil.command(cmdtable) |
|
554 | > command = cmdutil.command(cmdtable) | |
555 | > @command('debugextensions', [], 'hg debugextensions', norepo=True) |
|
555 | > @command('debugextensions', [], 'hg debugextensions', norepo=True) | |
556 | > def debugextensions(ui): |
|
556 | > def debugextensions(ui): | |
557 | > "yet another debug command" |
|
557 | > "yet another debug command" | |
558 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) |
|
558 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) | |
559 | > EOF |
|
559 | > EOF | |
560 | $ cat <<EOF >> $HGRCPATH |
|
560 | $ cat <<EOF >> $HGRCPATH | |
561 | > debugissue811 = $debugpath |
|
561 | > debugissue811 = $debugpath | |
562 | > mq = |
|
562 | > mq = | |
563 | > strip = |
|
563 | > strip = | |
564 | > hgext.mq = |
|
564 | > hgext.mq = | |
565 | > hgext/mq = |
|
565 | > hgext/mq = | |
566 | > EOF |
|
566 | > EOF | |
567 |
|
567 | |||
568 | Show extensions: |
|
568 | Show extensions: | |
569 | (note that mq force load strip, also checking it's not loaded twice) |
|
569 | (note that mq force load strip, also checking it's not loaded twice) | |
570 |
|
570 | |||
571 | $ hg debugextensions |
|
571 | $ hg debugextensions | |
572 | debugissue811 |
|
572 | debugissue811 | |
573 | strip |
|
573 | strip | |
574 | mq |
|
574 | mq | |
575 |
|
575 | |||
576 | For extensions, which name matches one of its commands, help |
|
576 | For extensions, which name matches one of its commands, help | |
577 | message should ask '-v -e' to get list of built-in aliases |
|
577 | message should ask '-v -e' to get list of built-in aliases | |
578 | along with extension help itself |
|
578 | along with extension help itself | |
579 |
|
579 | |||
580 | $ mkdir $TESTTMP/d |
|
580 | $ mkdir $TESTTMP/d | |
581 | $ cat > $TESTTMP/d/dodo.py <<EOF |
|
581 | $ cat > $TESTTMP/d/dodo.py <<EOF | |
582 | > """ |
|
582 | > """ | |
583 | > This is an awesome 'dodo' extension. It does nothing and |
|
583 | > This is an awesome 'dodo' extension. It does nothing and | |
584 | > writes 'Foo foo' |
|
584 | > writes 'Foo foo' | |
585 | > """ |
|
585 | > """ | |
586 | > from mercurial import cmdutil, commands |
|
586 | > from mercurial import cmdutil, commands | |
587 | > cmdtable = {} |
|
587 | > cmdtable = {} | |
588 | > command = cmdutil.command(cmdtable) |
|
588 | > command = cmdutil.command(cmdtable) | |
589 | > @command('dodo', [], 'hg dodo') |
|
589 | > @command('dodo', [], 'hg dodo') | |
590 | > def dodo(ui, *args, **kwargs): |
|
590 | > def dodo(ui, *args, **kwargs): | |
591 | > """Does nothing""" |
|
591 | > """Does nothing""" | |
592 | > ui.write("I do nothing. Yay\\n") |
|
592 | > ui.write("I do nothing. Yay\\n") | |
593 | > @command('foofoo', [], 'hg foofoo') |
|
593 | > @command('foofoo', [], 'hg foofoo') | |
594 | > def foofoo(ui, *args, **kwargs): |
|
594 | > def foofoo(ui, *args, **kwargs): | |
595 | > """Writes 'Foo foo'""" |
|
595 | > """Writes 'Foo foo'""" | |
596 | > ui.write("Foo foo\\n") |
|
596 | > ui.write("Foo foo\\n") | |
597 | > EOF |
|
597 | > EOF | |
598 | $ dodopath=$TESTTMP/d/dodo.py |
|
598 | $ dodopath=$TESTTMP/d/dodo.py | |
599 |
|
599 | |||
600 | $ echo "dodo = $dodopath" >> $HGRCPATH |
|
600 | $ echo "dodo = $dodopath" >> $HGRCPATH | |
601 |
|
601 | |||
602 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases |
|
602 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases | |
603 | $ hg help -e dodo |
|
603 | $ hg help -e dodo | |
604 | dodo extension - |
|
604 | dodo extension - | |
605 |
|
605 | |||
606 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
606 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
607 |
|
607 | |||
608 | list of commands: |
|
608 | list of commands: | |
609 |
|
609 | |||
610 | dodo Does nothing |
|
610 | dodo Does nothing | |
611 | foofoo Writes 'Foo foo' |
|
611 | foofoo Writes 'Foo foo' | |
612 |
|
612 | |||
613 | (use "hg help -v -e dodo" to show built-in aliases and global options) |
|
613 | (use "hg help -v -e dodo" to show built-in aliases and global options) | |
614 |
|
614 | |||
615 | Make sure that '-v -e' prints list of built-in aliases along with |
|
615 | Make sure that '-v -e' prints list of built-in aliases along with | |
616 | extension help itself |
|
616 | extension help itself | |
617 | $ hg help -v -e dodo |
|
617 | $ hg help -v -e dodo | |
618 | dodo extension - |
|
618 | dodo extension - | |
619 |
|
619 | |||
620 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
620 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' | |
621 |
|
621 | |||
622 | list of commands: |
|
622 | list of commands: | |
623 |
|
623 | |||
624 | dodo Does nothing |
|
624 | dodo Does nothing | |
625 | foofoo Writes 'Foo foo' |
|
625 | foofoo Writes 'Foo foo' | |
626 |
|
626 | |||
627 | global options ([+] can be repeated): |
|
627 | global options ([+] can be repeated): | |
628 |
|
628 | |||
629 | -R --repository REPO repository root directory or name of overlay bundle |
|
629 | -R --repository REPO repository root directory or name of overlay bundle | |
630 | file |
|
630 | file | |
631 | --cwd DIR change working directory |
|
631 | --cwd DIR change working directory | |
632 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
632 | -y --noninteractive do not prompt, automatically pick the first choice for | |
633 | all prompts |
|
633 | all prompts | |
634 | -q --quiet suppress output |
|
634 | -q --quiet suppress output | |
635 | -v --verbose enable additional output |
|
635 | -v --verbose enable additional output | |
636 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
636 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
637 | --debug enable debugging output |
|
637 | --debug enable debugging output | |
638 | --debugger start debugger |
|
638 | --debugger start debugger | |
639 | --encoding ENCODE set the charset encoding (default: ascii) |
|
639 | --encoding ENCODE set the charset encoding (default: ascii) | |
640 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
640 | --encodingmode MODE set the charset encoding mode (default: strict) | |
641 | --traceback always print a traceback on exception |
|
641 | --traceback always print a traceback on exception | |
642 | --time time how long the command takes |
|
642 | --time time how long the command takes | |
643 | --profile print command execution profile |
|
643 | --profile print command execution profile | |
644 | --version output version information and exit |
|
644 | --version output version information and exit | |
645 | -h --help display help and exit |
|
645 | -h --help display help and exit | |
646 | --hidden consider hidden changesets |
|
646 | --hidden consider hidden changesets | |
647 |
|
647 | |||
648 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command |
|
648 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command | |
649 | $ hg help -v dodo |
|
649 | $ hg help -v dodo | |
650 | hg dodo |
|
650 | hg dodo | |
651 |
|
651 | |||
652 | Does nothing |
|
652 | Does nothing | |
653 |
|
653 | |||
654 | (use "hg help -e dodo" to show help for the dodo extension) |
|
654 | (use "hg help -e dodo" to show help for the dodo extension) | |
655 |
|
655 | |||
656 | options: |
|
656 | options: | |
657 |
|
657 | |||
658 | --mq operate on patch repository |
|
658 | --mq operate on patch repository | |
659 |
|
659 | |||
660 | global options ([+] can be repeated): |
|
660 | global options ([+] can be repeated): | |
661 |
|
661 | |||
662 | -R --repository REPO repository root directory or name of overlay bundle |
|
662 | -R --repository REPO repository root directory or name of overlay bundle | |
663 | file |
|
663 | file | |
664 | --cwd DIR change working directory |
|
664 | --cwd DIR change working directory | |
665 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
665 | -y --noninteractive do not prompt, automatically pick the first choice for | |
666 | all prompts |
|
666 | all prompts | |
667 | -q --quiet suppress output |
|
667 | -q --quiet suppress output | |
668 | -v --verbose enable additional output |
|
668 | -v --verbose enable additional output | |
669 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
669 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
670 | --debug enable debugging output |
|
670 | --debug enable debugging output | |
671 | --debugger start debugger |
|
671 | --debugger start debugger | |
672 | --encoding ENCODE set the charset encoding (default: ascii) |
|
672 | --encoding ENCODE set the charset encoding (default: ascii) | |
673 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
673 | --encodingmode MODE set the charset encoding mode (default: strict) | |
674 | --traceback always print a traceback on exception |
|
674 | --traceback always print a traceback on exception | |
675 | --time time how long the command takes |
|
675 | --time time how long the command takes | |
676 | --profile print command execution profile |
|
676 | --profile print command execution profile | |
677 | --version output version information and exit |
|
677 | --version output version information and exit | |
678 | -h --help display help and exit |
|
678 | -h --help display help and exit | |
679 | --hidden consider hidden changesets |
|
679 | --hidden consider hidden changesets | |
680 |
|
680 | |||
681 | In case when extension name doesn't match any of its commands, |
|
681 | In case when extension name doesn't match any of its commands, | |
682 | help message should ask for '-v' to get list of built-in aliases |
|
682 | help message should ask for '-v' to get list of built-in aliases | |
683 | along with extension help |
|
683 | along with extension help | |
684 | $ cat > $TESTTMP/d/dudu.py <<EOF |
|
684 | $ cat > $TESTTMP/d/dudu.py <<EOF | |
685 | > """ |
|
685 | > """ | |
686 | > This is an awesome 'dudu' extension. It does something and |
|
686 | > This is an awesome 'dudu' extension. It does something and | |
687 | > also writes 'Beep beep' |
|
687 | > also writes 'Beep beep' | |
688 | > """ |
|
688 | > """ | |
689 | > from mercurial import cmdutil, commands |
|
689 | > from mercurial import cmdutil, commands | |
690 | > cmdtable = {} |
|
690 | > cmdtable = {} | |
691 | > command = cmdutil.command(cmdtable) |
|
691 | > command = cmdutil.command(cmdtable) | |
692 | > @command('something', [], 'hg something') |
|
692 | > @command('something', [], 'hg something') | |
693 | > def something(ui, *args, **kwargs): |
|
693 | > def something(ui, *args, **kwargs): | |
694 | > """Does something""" |
|
694 | > """Does something""" | |
695 | > ui.write("I do something. Yaaay\\n") |
|
695 | > ui.write("I do something. Yaaay\\n") | |
696 | > @command('beep', [], 'hg beep') |
|
696 | > @command('beep', [], 'hg beep') | |
697 | > def beep(ui, *args, **kwargs): |
|
697 | > def beep(ui, *args, **kwargs): | |
698 | > """Writes 'Beep beep'""" |
|
698 | > """Writes 'Beep beep'""" | |
699 | > ui.write("Beep beep\\n") |
|
699 | > ui.write("Beep beep\\n") | |
700 | > EOF |
|
700 | > EOF | |
701 | $ dudupath=$TESTTMP/d/dudu.py |
|
701 | $ dudupath=$TESTTMP/d/dudu.py | |
702 |
|
702 | |||
703 | $ echo "dudu = $dudupath" >> $HGRCPATH |
|
703 | $ echo "dudu = $dudupath" >> $HGRCPATH | |
704 |
|
704 | |||
705 | $ hg help -e dudu |
|
705 | $ hg help -e dudu | |
706 | dudu extension - |
|
706 | dudu extension - | |
707 |
|
707 | |||
708 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
708 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
709 | beep' |
|
709 | beep' | |
710 |
|
710 | |||
711 | list of commands: |
|
711 | list of commands: | |
712 |
|
712 | |||
713 | beep Writes 'Beep beep' |
|
713 | beep Writes 'Beep beep' | |
714 | something Does something |
|
714 | something Does something | |
715 |
|
715 | |||
716 | (use "hg help -v dudu" to show built-in aliases and global options) |
|
716 | (use "hg help -v dudu" to show built-in aliases and global options) | |
717 |
|
717 | |||
718 | In case when extension name doesn't match any of its commands, |
|
718 | In case when extension name doesn't match any of its commands, | |
719 | help options '-v' and '-v -e' should be equivalent |
|
719 | help options '-v' and '-v -e' should be equivalent | |
720 | $ hg help -v dudu |
|
720 | $ hg help -v dudu | |
721 | dudu extension - |
|
721 | dudu extension - | |
722 |
|
722 | |||
723 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
723 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
724 | beep' |
|
724 | beep' | |
725 |
|
725 | |||
726 | list of commands: |
|
726 | list of commands: | |
727 |
|
727 | |||
728 | beep Writes 'Beep beep' |
|
728 | beep Writes 'Beep beep' | |
729 | something Does something |
|
729 | something Does something | |
730 |
|
730 | |||
731 | global options ([+] can be repeated): |
|
731 | global options ([+] can be repeated): | |
732 |
|
732 | |||
733 | -R --repository REPO repository root directory or name of overlay bundle |
|
733 | -R --repository REPO repository root directory or name of overlay bundle | |
734 | file |
|
734 | file | |
735 | --cwd DIR change working directory |
|
735 | --cwd DIR change working directory | |
736 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
736 | -y --noninteractive do not prompt, automatically pick the first choice for | |
737 | all prompts |
|
737 | all prompts | |
738 | -q --quiet suppress output |
|
738 | -q --quiet suppress output | |
739 | -v --verbose enable additional output |
|
739 | -v --verbose enable additional output | |
740 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
740 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
741 | --debug enable debugging output |
|
741 | --debug enable debugging output | |
742 | --debugger start debugger |
|
742 | --debugger start debugger | |
743 | --encoding ENCODE set the charset encoding (default: ascii) |
|
743 | --encoding ENCODE set the charset encoding (default: ascii) | |
744 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
744 | --encodingmode MODE set the charset encoding mode (default: strict) | |
745 | --traceback always print a traceback on exception |
|
745 | --traceback always print a traceback on exception | |
746 | --time time how long the command takes |
|
746 | --time time how long the command takes | |
747 | --profile print command execution profile |
|
747 | --profile print command execution profile | |
748 | --version output version information and exit |
|
748 | --version output version information and exit | |
749 | -h --help display help and exit |
|
749 | -h --help display help and exit | |
750 | --hidden consider hidden changesets |
|
750 | --hidden consider hidden changesets | |
751 |
|
751 | |||
752 | $ hg help -v -e dudu |
|
752 | $ hg help -v -e dudu | |
753 | dudu extension - |
|
753 | dudu extension - | |
754 |
|
754 | |||
755 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
755 | This is an awesome 'dudu' extension. It does something and also writes 'Beep | |
756 | beep' |
|
756 | beep' | |
757 |
|
757 | |||
758 | list of commands: |
|
758 | list of commands: | |
759 |
|
759 | |||
760 | beep Writes 'Beep beep' |
|
760 | beep Writes 'Beep beep' | |
761 | something Does something |
|
761 | something Does something | |
762 |
|
762 | |||
763 | global options ([+] can be repeated): |
|
763 | global options ([+] can be repeated): | |
764 |
|
764 | |||
765 | -R --repository REPO repository root directory or name of overlay bundle |
|
765 | -R --repository REPO repository root directory or name of overlay bundle | |
766 | file |
|
766 | file | |
767 | --cwd DIR change working directory |
|
767 | --cwd DIR change working directory | |
768 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
768 | -y --noninteractive do not prompt, automatically pick the first choice for | |
769 | all prompts |
|
769 | all prompts | |
770 | -q --quiet suppress output |
|
770 | -q --quiet suppress output | |
771 | -v --verbose enable additional output |
|
771 | -v --verbose enable additional output | |
772 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
772 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
773 | --debug enable debugging output |
|
773 | --debug enable debugging output | |
774 | --debugger start debugger |
|
774 | --debugger start debugger | |
775 | --encoding ENCODE set the charset encoding (default: ascii) |
|
775 | --encoding ENCODE set the charset encoding (default: ascii) | |
776 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
776 | --encodingmode MODE set the charset encoding mode (default: strict) | |
777 | --traceback always print a traceback on exception |
|
777 | --traceback always print a traceback on exception | |
778 | --time time how long the command takes |
|
778 | --time time how long the command takes | |
779 | --profile print command execution profile |
|
779 | --profile print command execution profile | |
780 | --version output version information and exit |
|
780 | --version output version information and exit | |
781 | -h --help display help and exit |
|
781 | -h --help display help and exit | |
782 | --hidden consider hidden changesets |
|
782 | --hidden consider hidden changesets | |
783 |
|
783 | |||
784 | Disabled extension commands: |
|
784 | Disabled extension commands: | |
785 |
|
785 | |||
786 | $ ORGHGRCPATH=$HGRCPATH |
|
786 | $ ORGHGRCPATH=$HGRCPATH | |
787 | $ HGRCPATH= |
|
787 | $ HGRCPATH= | |
788 | $ export HGRCPATH |
|
788 | $ export HGRCPATH | |
789 | $ hg help email |
|
789 | $ hg help email | |
790 | 'email' is provided by the following extension: |
|
790 | 'email' is provided by the following extension: | |
791 |
|
791 | |||
792 | patchbomb command to send changesets as (a series of) patch emails |
|
792 | patchbomb command to send changesets as (a series of) patch emails | |
793 |
|
793 | |||
794 | (use "hg help extensions" for information on enabling extensions) |
|
794 | (use "hg help extensions" for information on enabling extensions) | |
795 |
|
795 | |||
796 |
|
796 | |||
797 | $ hg qdel |
|
797 | $ hg qdel | |
798 | hg: unknown command 'qdel' |
|
798 | hg: unknown command 'qdel' | |
799 | 'qdelete' is provided by the following extension: |
|
799 | 'qdelete' is provided by the following extension: | |
800 |
|
800 | |||
801 | mq manage a stack of patches |
|
801 | mq manage a stack of patches | |
802 |
|
802 | |||
803 | (use "hg help extensions" for information on enabling extensions) |
|
803 | (use "hg help extensions" for information on enabling extensions) | |
804 | [255] |
|
804 | [255] | |
805 |
|
805 | |||
806 |
|
806 | |||
807 | $ hg churn |
|
807 | $ hg churn | |
808 | hg: unknown command 'churn' |
|
808 | hg: unknown command 'churn' | |
809 | 'churn' is provided by the following extension: |
|
809 | 'churn' is provided by the following extension: | |
810 |
|
810 | |||
811 | churn command to display statistics about repository history |
|
811 | churn command to display statistics about repository history | |
812 |
|
812 | |||
813 | (use "hg help extensions" for information on enabling extensions) |
|
813 | (use "hg help extensions" for information on enabling extensions) | |
814 | [255] |
|
814 | [255] | |
815 |
|
815 | |||
816 |
|
816 | |||
817 |
|
817 | |||
818 | Disabled extensions: |
|
818 | Disabled extensions: | |
819 |
|
819 | |||
820 | $ hg help churn |
|
820 | $ hg help churn | |
821 | churn extension - command to display statistics about repository history |
|
821 | churn extension - command to display statistics about repository history | |
822 |
|
822 | |||
823 | (use "hg help extensions" for information on enabling extensions) |
|
823 | (use "hg help extensions" for information on enabling extensions) | |
824 |
|
824 | |||
825 | $ hg help patchbomb |
|
825 | $ hg help patchbomb | |
826 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
826 | patchbomb extension - command to send changesets as (a series of) patch emails | |
827 |
|
827 | |||
828 | (use "hg help extensions" for information on enabling extensions) |
|
828 | (use "hg help extensions" for information on enabling extensions) | |
829 |
|
829 | |||
830 |
|
830 | |||
831 | Broken disabled extension and command: |
|
831 | Broken disabled extension and command: | |
832 |
|
832 | |||
833 | $ mkdir hgext |
|
833 | $ mkdir hgext | |
834 | $ echo > hgext/__init__.py |
|
834 | $ echo > hgext/__init__.py | |
835 | $ cat > hgext/broken.py <<EOF |
|
835 | $ cat > hgext/broken.py <<EOF | |
836 | > "broken extension' |
|
836 | > "broken extension' | |
837 | > EOF |
|
837 | > EOF | |
838 | $ cat > path.py <<EOF |
|
838 | $ cat > path.py <<EOF | |
839 | > import os, sys |
|
839 | > import os, sys | |
840 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
840 | > sys.path.insert(0, os.environ['HGEXTPATH']) | |
841 | > EOF |
|
841 | > EOF | |
842 | $ HGEXTPATH=`pwd` |
|
842 | $ HGEXTPATH=`pwd` | |
843 | $ export HGEXTPATH |
|
843 | $ export HGEXTPATH | |
844 |
|
844 | |||
845 | $ hg --config extensions.path=./path.py help broken |
|
845 | $ hg --config extensions.path=./path.py help broken | |
846 | broken extension - (no help text available) |
|
846 | broken extension - (no help text available) | |
847 |
|
847 | |||
848 | (use "hg help extensions" for information on enabling extensions) |
|
848 | (use "hg help extensions" for information on enabling extensions) | |
849 |
|
849 | |||
850 |
|
850 | |||
851 | $ cat > hgext/forest.py <<EOF |
|
851 | $ cat > hgext/forest.py <<EOF | |
852 | > cmdtable = None |
|
852 | > cmdtable = None | |
853 | > EOF |
|
853 | > EOF | |
854 | $ hg --config extensions.path=./path.py help foo > /dev/null |
|
854 | $ hg --config extensions.path=./path.py help foo > /dev/null | |
855 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) |
|
855 | warning: error finding commands in $TESTTMP/hgext/forest.py (glob) | |
856 | abort: no such help topic: foo |
|
856 | abort: no such help topic: foo | |
857 | (try "hg help --keyword foo") |
|
857 | (try "hg help --keyword foo") | |
858 | [255] |
|
858 | [255] | |
859 |
|
859 | |||
860 | $ cat > throw.py <<EOF |
|
860 | $ cat > throw.py <<EOF | |
861 | > from mercurial import cmdutil, commands, util |
|
861 | > from mercurial import cmdutil, commands, util | |
862 | > cmdtable = {} |
|
862 | > cmdtable = {} | |
863 | > command = cmdutil.command(cmdtable) |
|
863 | > command = cmdutil.command(cmdtable) | |
864 | > class Bogon(Exception): pass |
|
864 | > class Bogon(Exception): pass | |
865 | > @command('throw', [], 'hg throw', norepo=True) |
|
865 | > @command('throw', [], 'hg throw', norepo=True) | |
866 | > def throw(ui, **opts): |
|
866 | > def throw(ui, **opts): | |
867 | > """throws an exception""" |
|
867 | > """throws an exception""" | |
868 | > raise Bogon() |
|
868 | > raise Bogon() | |
869 | > EOF |
|
869 | > EOF | |
870 |
|
870 | |||
871 | No declared supported version, extension complains: |
|
871 | No declared supported version, extension complains: | |
872 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
872 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
873 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
873 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
874 | ** which supports versions unknown of Mercurial. |
|
874 | ** which supports versions unknown of Mercurial. | |
875 | ** Please disable throw and try your action again. |
|
875 | ** Please disable throw and try your action again. | |
876 | ** If that fixes the bug please report it to the extension author. |
|
876 | ** If that fixes the bug please report it to the extension author. | |
877 | ** Python * (glob) |
|
877 | ** Python * (glob) | |
878 | ** Mercurial Distributed SCM * (glob) |
|
878 | ** Mercurial Distributed SCM * (glob) | |
879 | ** Extensions loaded: throw |
|
879 | ** Extensions loaded: throw | |
880 |
|
880 | |||
881 | empty declaration of supported version, extension complains: |
|
881 | empty declaration of supported version, extension complains: | |
882 | $ echo "testedwith = ''" >> throw.py |
|
882 | $ echo "testedwith = ''" >> throw.py | |
883 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
883 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
884 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
884 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
885 | ** which supports versions unknown of Mercurial. |
|
885 | ** which supports versions unknown of Mercurial. | |
886 | ** Please disable throw and try your action again. |
|
886 | ** Please disable throw and try your action again. | |
887 | ** If that fixes the bug please report it to the extension author. |
|
887 | ** If that fixes the bug please report it to the extension author. | |
888 | ** Python * (glob) |
|
888 | ** Python * (glob) | |
889 | ** Mercurial Distributed SCM (*) (glob) |
|
889 | ** Mercurial Distributed SCM (*) (glob) | |
890 | ** Extensions loaded: throw |
|
890 | ** Extensions loaded: throw | |
891 |
|
891 | |||
892 | If the extension specifies a buglink, show that: |
|
892 | If the extension specifies a buglink, show that: | |
893 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
893 | $ echo 'buglink = "http://example.com/bts"' >> throw.py | |
894 | $ rm -f throw.pyc throw.pyo |
|
894 | $ rm -f throw.pyc throw.pyo | |
895 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
895 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
896 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
896 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
897 | ** which supports versions unknown of Mercurial. |
|
897 | ** which supports versions unknown of Mercurial. | |
898 | ** Please disable throw and try your action again. |
|
898 | ** Please disable throw and try your action again. | |
899 | ** If that fixes the bug please report it to http://example.com/bts |
|
899 | ** If that fixes the bug please report it to http://example.com/bts | |
900 | ** Python * (glob) |
|
900 | ** Python * (glob) | |
901 | ** Mercurial Distributed SCM (*) (glob) |
|
901 | ** Mercurial Distributed SCM (*) (glob) | |
902 | ** Extensions loaded: throw |
|
902 | ** Extensions loaded: throw | |
903 |
|
903 | |||
904 | If the extensions declare outdated versions, accuse the older extension first: |
|
904 | If the extensions declare outdated versions, accuse the older extension first: | |
905 | $ echo "from mercurial import util" >> older.py |
|
905 | $ echo "from mercurial import util" >> older.py | |
906 | $ echo "util.version = lambda:'2.2'" >> older.py |
|
906 | $ echo "util.version = lambda:'2.2'" >> older.py | |
907 | $ echo "testedwith = '1.9.3'" >> older.py |
|
907 | $ echo "testedwith = '1.9.3'" >> older.py | |
908 | $ echo "testedwith = '2.1.1'" >> throw.py |
|
908 | $ echo "testedwith = '2.1.1'" >> throw.py | |
909 | $ rm -f throw.pyc throw.pyo |
|
909 | $ rm -f throw.pyc throw.pyo | |
910 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
910 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
911 | > throw 2>&1 | egrep '^\*\*' |
|
911 | > throw 2>&1 | egrep '^\*\*' | |
912 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
912 | ** Unknown exception encountered with possibly-broken third-party extension older | |
913 | ** which supports versions 1.9 of Mercurial. |
|
913 | ** which supports versions 1.9 of Mercurial. | |
914 | ** Please disable older and try your action again. |
|
914 | ** Please disable older and try your action again. | |
915 | ** If that fixes the bug please report it to the extension author. |
|
915 | ** If that fixes the bug please report it to the extension author. | |
916 | ** Python * (glob) |
|
916 | ** Python * (glob) | |
917 | ** Mercurial Distributed SCM (version 2.2) |
|
917 | ** Mercurial Distributed SCM (version 2.2) | |
918 | ** Extensions loaded: throw, older |
|
918 | ** Extensions loaded: throw, older | |
919 |
|
919 | |||
920 | One extension only tested with older, one only with newer versions: |
|
920 | One extension only tested with older, one only with newer versions: | |
921 | $ echo "util.version = lambda:'2.1'" >> older.py |
|
921 | $ echo "util.version = lambda:'2.1'" >> older.py | |
922 | $ rm -f older.pyc older.pyo |
|
922 | $ rm -f older.pyc older.pyo | |
923 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
923 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
924 | > throw 2>&1 | egrep '^\*\*' |
|
924 | > throw 2>&1 | egrep '^\*\*' | |
925 | ** Unknown exception encountered with possibly-broken third-party extension older |
|
925 | ** Unknown exception encountered with possibly-broken third-party extension older | |
926 | ** which supports versions 1.9 of Mercurial. |
|
926 | ** which supports versions 1.9 of Mercurial. | |
927 | ** Please disable older and try your action again. |
|
927 | ** Please disable older and try your action again. | |
928 | ** If that fixes the bug please report it to the extension author. |
|
928 | ** If that fixes the bug please report it to the extension author. | |
929 | ** Python * (glob) |
|
929 | ** Python * (glob) | |
930 | ** Mercurial Distributed SCM (version 2.1) |
|
930 | ** Mercurial Distributed SCM (version 2.1) | |
931 | ** Extensions loaded: throw, older |
|
931 | ** Extensions loaded: throw, older | |
932 |
|
932 | |||
933 | Older extension is tested with current version, the other only with newer: |
|
933 | Older extension is tested with current version, the other only with newer: | |
934 | $ echo "util.version = lambda:'1.9.3'" >> older.py |
|
934 | $ echo "util.version = lambda:'1.9.3'" >> older.py | |
935 | $ rm -f older.pyc older.pyo |
|
935 | $ rm -f older.pyc older.pyo | |
936 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
936 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |
937 | > throw 2>&1 | egrep '^\*\*' |
|
937 | > throw 2>&1 | egrep '^\*\*' | |
938 | ** Unknown exception encountered with possibly-broken third-party extension throw |
|
938 | ** Unknown exception encountered with possibly-broken third-party extension throw | |
939 | ** which supports versions 2.1 of Mercurial. |
|
939 | ** which supports versions 2.1 of Mercurial. | |
940 | ** Please disable throw and try your action again. |
|
940 | ** Please disable throw and try your action again. | |
941 | ** If that fixes the bug please report it to http://example.com/bts |
|
941 | ** If that fixes the bug please report it to http://example.com/bts | |
942 | ** Python * (glob) |
|
942 | ** Python * (glob) | |
943 | ** Mercurial Distributed SCM (version 1.9.3) |
|
943 | ** Mercurial Distributed SCM (version 1.9.3) | |
944 | ** Extensions loaded: throw, older |
|
944 | ** Extensions loaded: throw, older | |
945 |
|
945 | |||
|
946 | Ability to point to a different point | |||
|
947 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ | |||
|
948 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' | |||
|
949 | ** unknown exception encountered, please report by visiting | |||
|
950 | ** Your Local Goat Lenders | |||
|
951 | ** Python * (glob) | |||
|
952 | ** Mercurial Distributed SCM (*) (glob) | |||
|
953 | ** Extensions loaded: throw, older | |||
|
954 | ||||
946 | Declare the version as supporting this hg version, show regular bts link: |
|
955 | Declare the version as supporting this hg version, show regular bts link: | |
947 | $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'` |
|
956 | $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'` | |
948 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
957 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py | |
949 | $ if [ -z "$hgver" ]; then |
|
958 | $ if [ -z "$hgver" ]; then | |
950 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; |
|
959 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; | |
951 | > fi |
|
960 | > fi | |
952 | $ rm -f throw.pyc throw.pyo |
|
961 | $ rm -f throw.pyc throw.pyo | |
953 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
962 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
954 | ** unknown exception encountered, please report by visiting |
|
963 | ** unknown exception encountered, please report by visiting | |
955 | ** http://mercurial.selenic.com/wiki/BugTracker |
|
964 | ** http://mercurial.selenic.com/wiki/BugTracker | |
956 | ** Python * (glob) |
|
965 | ** Python * (glob) | |
957 | ** Mercurial Distributed SCM (*) (glob) |
|
966 | ** Mercurial Distributed SCM (*) (glob) | |
958 | ** Extensions loaded: throw |
|
967 | ** Extensions loaded: throw | |
959 |
|
968 | |||
960 | Patch version is ignored during compatibility check |
|
969 | Patch version is ignored during compatibility check | |
961 | $ echo "testedwith = '3.2'" >> throw.py |
|
970 | $ echo "testedwith = '3.2'" >> throw.py | |
962 | $ echo "util.version = lambda:'3.2.2'" >> throw.py |
|
971 | $ echo "util.version = lambda:'3.2.2'" >> throw.py | |
963 | $ rm -f throw.pyc throw.pyo |
|
972 | $ rm -f throw.pyc throw.pyo | |
964 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
973 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' | |
965 | ** unknown exception encountered, please report by visiting |
|
974 | ** unknown exception encountered, please report by visiting | |
966 | ** http://mercurial.selenic.com/wiki/BugTracker |
|
975 | ** http://mercurial.selenic.com/wiki/BugTracker | |
967 | ** Python * (glob) |
|
976 | ** Python * (glob) | |
968 | ** Mercurial Distributed SCM (*) (glob) |
|
977 | ** Mercurial Distributed SCM (*) (glob) | |
969 | ** Extensions loaded: throw |
|
978 | ** Extensions loaded: throw | |
970 |
|
979 | |||
971 | Test version number support in 'hg version': |
|
980 | Test version number support in 'hg version': | |
972 | $ echo '__version__ = (1, 2, 3)' >> throw.py |
|
981 | $ echo '__version__ = (1, 2, 3)' >> throw.py | |
973 | $ rm -f throw.pyc throw.pyo |
|
982 | $ rm -f throw.pyc throw.pyo | |
974 | $ hg version -v |
|
983 | $ hg version -v | |
975 | Mercurial Distributed SCM (version *) (glob) |
|
984 | Mercurial Distributed SCM (version *) (glob) | |
976 | (see http://mercurial.selenic.com for more information) |
|
985 | (see http://mercurial.selenic.com for more information) | |
977 |
|
986 | |||
978 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
987 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
979 | This is free software; see the source for copying conditions. There is NO |
|
988 | This is free software; see the source for copying conditions. There is NO | |
980 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
989 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
981 |
|
990 | |||
982 | Enabled extensions: |
|
991 | Enabled extensions: | |
983 |
|
992 | |||
984 |
|
993 | |||
985 | $ hg version -v --config extensions.throw=throw.py |
|
994 | $ hg version -v --config extensions.throw=throw.py | |
986 | Mercurial Distributed SCM (version *) (glob) |
|
995 | Mercurial Distributed SCM (version *) (glob) | |
987 | (see http://mercurial.selenic.com for more information) |
|
996 | (see http://mercurial.selenic.com for more information) | |
988 |
|
997 | |||
989 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
998 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
990 | This is free software; see the source for copying conditions. There is NO |
|
999 | This is free software; see the source for copying conditions. There is NO | |
991 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1000 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
992 |
|
1001 | |||
993 | Enabled extensions: |
|
1002 | Enabled extensions: | |
994 |
|
1003 | |||
995 | throw 1.2.3 |
|
1004 | throw 1.2.3 | |
996 | $ echo 'getversion = lambda: "1.twentythree"' >> throw.py |
|
1005 | $ echo 'getversion = lambda: "1.twentythree"' >> throw.py | |
997 | $ rm -f throw.pyc throw.pyo |
|
1006 | $ rm -f throw.pyc throw.pyo | |
998 | $ hg version -v --config extensions.throw=throw.py |
|
1007 | $ hg version -v --config extensions.throw=throw.py | |
999 | Mercurial Distributed SCM (version *) (glob) |
|
1008 | Mercurial Distributed SCM (version *) (glob) | |
1000 | (see http://mercurial.selenic.com for more information) |
|
1009 | (see http://mercurial.selenic.com for more information) | |
1001 |
|
1010 | |||
1002 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1011 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
1003 | This is free software; see the source for copying conditions. There is NO |
|
1012 | This is free software; see the source for copying conditions. There is NO | |
1004 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1013 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
1005 |
|
1014 | |||
1006 | Enabled extensions: |
|
1015 | Enabled extensions: | |
1007 |
|
1016 | |||
1008 | throw 1.twentythree |
|
1017 | throw 1.twentythree | |
1009 |
|
1018 | |||
1010 | Restore HGRCPATH |
|
1019 | Restore HGRCPATH | |
1011 |
|
1020 | |||
1012 | $ HGRCPATH=$ORGHGRCPATH |
|
1021 | $ HGRCPATH=$ORGHGRCPATH | |
1013 | $ export HGRCPATH |
|
1022 | $ export HGRCPATH | |
1014 |
|
1023 | |||
1015 | Commands handling multiple repositories at a time should invoke only |
|
1024 | Commands handling multiple repositories at a time should invoke only | |
1016 | "reposetup()" of extensions enabling in the target repository. |
|
1025 | "reposetup()" of extensions enabling in the target repository. | |
1017 |
|
1026 | |||
1018 | $ mkdir reposetup-test |
|
1027 | $ mkdir reposetup-test | |
1019 | $ cd reposetup-test |
|
1028 | $ cd reposetup-test | |
1020 |
|
1029 | |||
1021 | $ cat > $TESTTMP/reposetuptest.py <<EOF |
|
1030 | $ cat > $TESTTMP/reposetuptest.py <<EOF | |
1022 | > from mercurial import extensions |
|
1031 | > from mercurial import extensions | |
1023 | > def reposetup(ui, repo): |
|
1032 | > def reposetup(ui, repo): | |
1024 | > ui.write('reposetup() for %s\n' % (repo.root)) |
|
1033 | > ui.write('reposetup() for %s\n' % (repo.root)) | |
1025 | > EOF |
|
1034 | > EOF | |
1026 | $ hg init src |
|
1035 | $ hg init src | |
1027 | $ echo a > src/a |
|
1036 | $ echo a > src/a | |
1028 | $ hg -R src commit -Am '#0 at src/a' |
|
1037 | $ hg -R src commit -Am '#0 at src/a' | |
1029 | adding a |
|
1038 | adding a | |
1030 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1039 | $ echo '[extensions]' >> src/.hg/hgrc | |
1031 | $ echo '# enable extension locally' >> src/.hg/hgrc |
|
1040 | $ echo '# enable extension locally' >> src/.hg/hgrc | |
1032 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc |
|
1041 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc | |
1033 | $ hg -R src status |
|
1042 | $ hg -R src status | |
1034 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1043 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1035 |
|
1044 | |||
1036 | $ hg clone -U src clone-dst1 |
|
1045 | $ hg clone -U src clone-dst1 | |
1037 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1046 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1038 | $ hg init push-dst1 |
|
1047 | $ hg init push-dst1 | |
1039 | $ hg -q -R src push push-dst1 |
|
1048 | $ hg -q -R src push push-dst1 | |
1040 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1049 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1041 | $ hg init pull-src1 |
|
1050 | $ hg init pull-src1 | |
1042 | $ hg -q -R pull-src1 pull src |
|
1051 | $ hg -q -R pull-src1 pull src | |
1043 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1052 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1044 |
|
1053 | |||
1045 | $ cat <<EOF >> $HGRCPATH |
|
1054 | $ cat <<EOF >> $HGRCPATH | |
1046 | > [extensions] |
|
1055 | > [extensions] | |
1047 | > # disable extension globally and explicitly |
|
1056 | > # disable extension globally and explicitly | |
1048 | > reposetuptest = ! |
|
1057 | > reposetuptest = ! | |
1049 | > EOF |
|
1058 | > EOF | |
1050 | $ hg clone -U src clone-dst2 |
|
1059 | $ hg clone -U src clone-dst2 | |
1051 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1060 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1052 | $ hg init push-dst2 |
|
1061 | $ hg init push-dst2 | |
1053 | $ hg -q -R src push push-dst2 |
|
1062 | $ hg -q -R src push push-dst2 | |
1054 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1063 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1055 | $ hg init pull-src2 |
|
1064 | $ hg init pull-src2 | |
1056 | $ hg -q -R pull-src2 pull src |
|
1065 | $ hg -q -R pull-src2 pull src | |
1057 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1066 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1058 |
|
1067 | |||
1059 | $ cat <<EOF >> $HGRCPATH |
|
1068 | $ cat <<EOF >> $HGRCPATH | |
1060 | > [extensions] |
|
1069 | > [extensions] | |
1061 | > # enable extension globally |
|
1070 | > # enable extension globally | |
1062 | > reposetuptest = $TESTTMP/reposetuptest.py |
|
1071 | > reposetuptest = $TESTTMP/reposetuptest.py | |
1063 | > EOF |
|
1072 | > EOF | |
1064 | $ hg clone -U src clone-dst3 |
|
1073 | $ hg clone -U src clone-dst3 | |
1065 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1074 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1066 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob) |
|
1075 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob) | |
1067 | $ hg init push-dst3 |
|
1076 | $ hg init push-dst3 | |
1068 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) |
|
1077 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) | |
1069 | $ hg -q -R src push push-dst3 |
|
1078 | $ hg -q -R src push push-dst3 | |
1070 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1079 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1071 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) |
|
1080 | reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob) | |
1072 | $ hg init pull-src3 |
|
1081 | $ hg init pull-src3 | |
1073 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) |
|
1082 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) | |
1074 | $ hg -q -R pull-src3 pull src |
|
1083 | $ hg -q -R pull-src3 pull src | |
1075 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) |
|
1084 | reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob) | |
1076 | reposetup() for $TESTTMP/reposetup-test/src (glob) |
|
1085 | reposetup() for $TESTTMP/reposetup-test/src (glob) | |
1077 |
|
1086 | |||
1078 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1087 | $ echo '[extensions]' >> src/.hg/hgrc | |
1079 | $ echo '# disable extension locally' >> src/.hg/hgrc |
|
1088 | $ echo '# disable extension locally' >> src/.hg/hgrc | |
1080 | $ echo 'reposetuptest = !' >> src/.hg/hgrc |
|
1089 | $ echo 'reposetuptest = !' >> src/.hg/hgrc | |
1081 | $ hg clone -U src clone-dst4 |
|
1090 | $ hg clone -U src clone-dst4 | |
1082 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob) |
|
1091 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob) | |
1083 | $ hg init push-dst4 |
|
1092 | $ hg init push-dst4 | |
1084 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) |
|
1093 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) | |
1085 | $ hg -q -R src push push-dst4 |
|
1094 | $ hg -q -R src push push-dst4 | |
1086 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) |
|
1095 | reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob) | |
1087 | $ hg init pull-src4 |
|
1096 | $ hg init pull-src4 | |
1088 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) |
|
1097 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) | |
1089 | $ hg -q -R pull-src4 pull src |
|
1098 | $ hg -q -R pull-src4 pull src | |
1090 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) |
|
1099 | reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob) | |
1091 |
|
1100 | |||
1092 | disabling in command line overlays with all configuration |
|
1101 | disabling in command line overlays with all configuration | |
1093 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 |
|
1102 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 | |
1094 | $ hg --config extensions.reposetuptest=! init push-dst5 |
|
1103 | $ hg --config extensions.reposetuptest=! init push-dst5 | |
1095 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 |
|
1104 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 | |
1096 | $ hg --config extensions.reposetuptest=! init pull-src5 |
|
1105 | $ hg --config extensions.reposetuptest=! init pull-src5 | |
1097 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src |
|
1106 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src | |
1098 |
|
1107 | |||
1099 | $ cat <<EOF >> $HGRCPATH |
|
1108 | $ cat <<EOF >> $HGRCPATH | |
1100 | > [extensions] |
|
1109 | > [extensions] | |
1101 | > # disable extension globally and explicitly |
|
1110 | > # disable extension globally and explicitly | |
1102 | > reposetuptest = ! |
|
1111 | > reposetuptest = ! | |
1103 | > EOF |
|
1112 | > EOF | |
1104 | $ hg init parent |
|
1113 | $ hg init parent | |
1105 | $ hg init parent/sub1 |
|
1114 | $ hg init parent/sub1 | |
1106 | $ echo 1 > parent/sub1/1 |
|
1115 | $ echo 1 > parent/sub1/1 | |
1107 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' |
|
1116 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' | |
1108 | adding 1 |
|
1117 | adding 1 | |
1109 | $ hg init parent/sub2 |
|
1118 | $ hg init parent/sub2 | |
1110 | $ hg init parent/sub2/sub21 |
|
1119 | $ hg init parent/sub2/sub21 | |
1111 | $ echo 21 > parent/sub2/sub21/21 |
|
1120 | $ echo 21 > parent/sub2/sub21/21 | |
1112 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' |
|
1121 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' | |
1113 | adding 21 |
|
1122 | adding 21 | |
1114 | $ cat > parent/sub2/.hgsub <<EOF |
|
1123 | $ cat > parent/sub2/.hgsub <<EOF | |
1115 | > sub21 = sub21 |
|
1124 | > sub21 = sub21 | |
1116 | > EOF |
|
1125 | > EOF | |
1117 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' |
|
1126 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' | |
1118 | adding .hgsub |
|
1127 | adding .hgsub | |
1119 | $ hg init parent/sub3 |
|
1128 | $ hg init parent/sub3 | |
1120 | $ echo 3 > parent/sub3/3 |
|
1129 | $ echo 3 > parent/sub3/3 | |
1121 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' |
|
1130 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' | |
1122 | adding 3 |
|
1131 | adding 3 | |
1123 | $ cat > parent/.hgsub <<EOF |
|
1132 | $ cat > parent/.hgsub <<EOF | |
1124 | > sub1 = sub1 |
|
1133 | > sub1 = sub1 | |
1125 | > sub2 = sub2 |
|
1134 | > sub2 = sub2 | |
1126 | > sub3 = sub3 |
|
1135 | > sub3 = sub3 | |
1127 | > EOF |
|
1136 | > EOF | |
1128 | $ hg -R parent commit -Am '#0 at parent' |
|
1137 | $ hg -R parent commit -Am '#0 at parent' | |
1129 | adding .hgsub |
|
1138 | adding .hgsub | |
1130 | $ echo '[extensions]' >> parent/.hg/hgrc |
|
1139 | $ echo '[extensions]' >> parent/.hg/hgrc | |
1131 | $ echo '# enable extension locally' >> parent/.hg/hgrc |
|
1140 | $ echo '# enable extension locally' >> parent/.hg/hgrc | |
1132 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc |
|
1141 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc | |
1133 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc |
|
1142 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc | |
1134 | $ hg -R parent status -S -A |
|
1143 | $ hg -R parent status -S -A | |
1135 | reposetup() for $TESTTMP/reposetup-test/parent (glob) |
|
1144 | reposetup() for $TESTTMP/reposetup-test/parent (glob) | |
1136 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob) |
|
1145 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob) | |
1137 | C .hgsub |
|
1146 | C .hgsub | |
1138 | C .hgsubstate |
|
1147 | C .hgsubstate | |
1139 | C sub1/1 |
|
1148 | C sub1/1 | |
1140 | C sub2/.hgsub |
|
1149 | C sub2/.hgsub | |
1141 | C sub2/.hgsubstate |
|
1150 | C sub2/.hgsubstate | |
1142 | C sub2/sub21/21 |
|
1151 | C sub2/sub21/21 | |
1143 | C sub3/3 |
|
1152 | C sub3/3 | |
1144 |
|
1153 | |||
1145 | $ cd .. |
|
1154 | $ cd .. | |
1146 |
|
1155 | |||
1147 | Test synopsis and docstring extending |
|
1156 | Test synopsis and docstring extending | |
1148 |
|
1157 | |||
1149 | $ hg init exthelp |
|
1158 | $ hg init exthelp | |
1150 | $ cat > exthelp.py <<EOF |
|
1159 | $ cat > exthelp.py <<EOF | |
1151 | > from mercurial import commands, extensions |
|
1160 | > from mercurial import commands, extensions | |
1152 | > def exbookmarks(orig, *args, **opts): |
|
1161 | > def exbookmarks(orig, *args, **opts): | |
1153 | > return orig(*args, **opts) |
|
1162 | > return orig(*args, **opts) | |
1154 | > def uisetup(ui): |
|
1163 | > def uisetup(ui): | |
1155 | > synopsis = ' GREPME [--foo] [-x]' |
|
1164 | > synopsis = ' GREPME [--foo] [-x]' | |
1156 | > docstring = ''' |
|
1165 | > docstring = ''' | |
1157 | > GREPME make sure that this is in the help! |
|
1166 | > GREPME make sure that this is in the help! | |
1158 | > ''' |
|
1167 | > ''' | |
1159 | > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, |
|
1168 | > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks, | |
1160 | > synopsis, docstring) |
|
1169 | > synopsis, docstring) | |
1161 | > EOF |
|
1170 | > EOF | |
1162 | $ abspath=`pwd`/exthelp.py |
|
1171 | $ abspath=`pwd`/exthelp.py | |
1163 | $ echo '[extensions]' >> $HGRCPATH |
|
1172 | $ echo '[extensions]' >> $HGRCPATH | |
1164 | $ echo "exthelp = $abspath" >> $HGRCPATH |
|
1173 | $ echo "exthelp = $abspath" >> $HGRCPATH | |
1165 | $ cd exthelp |
|
1174 | $ cd exthelp | |
1166 | $ hg help bookmarks | grep GREPME |
|
1175 | $ hg help bookmarks | grep GREPME | |
1167 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] |
|
1176 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] | |
1168 | GREPME make sure that this is in the help! |
|
1177 | GREPME make sure that this is in the help! | |
1169 |
|
1178 |
General Comments 0
You need to be logged in to leave comments.
Login now