Show More
@@ -1,911 +1,929 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 i18n import _ |
|
8 | from i18n import _ | |
9 | import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re |
|
9 | import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re | |
10 | import util, commands, hg, fancyopts, extensions, hook, error |
|
10 | import util, commands, hg, fancyopts, extensions, hook, error | |
11 | import cmdutil, encoding |
|
11 | import cmdutil, encoding | |
12 | import ui as uimod |
|
12 | import ui as uimod | |
13 |
|
13 | |||
14 | class request(object): |
|
14 | class request(object): | |
15 | def __init__(self, args, ui=None, repo=None, fin=None, fout=None, |
|
15 | def __init__(self, args, ui=None, repo=None, fin=None, fout=None, | |
16 | ferr=None): |
|
16 | ferr=None): | |
17 | self.args = args |
|
17 | self.args = args | |
18 | self.ui = ui |
|
18 | self.ui = ui | |
19 | self.repo = repo |
|
19 | self.repo = repo | |
20 |
|
20 | |||
21 | # input/output/error streams |
|
21 | # input/output/error streams | |
22 | self.fin = fin |
|
22 | self.fin = fin | |
23 | self.fout = fout |
|
23 | self.fout = fout | |
24 | self.ferr = ferr |
|
24 | self.ferr = ferr | |
25 |
|
25 | |||
26 | def run(): |
|
26 | def run(): | |
27 | "run the command in sys.argv" |
|
27 | "run the command in sys.argv" | |
28 | sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) |
|
28 | sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) | |
29 |
|
29 | |||
30 | def dispatch(req): |
|
30 | def dispatch(req): | |
31 | "run the command specified in req.args" |
|
31 | "run the command specified in req.args" | |
32 | if req.ferr: |
|
32 | if req.ferr: | |
33 | ferr = req.ferr |
|
33 | ferr = req.ferr | |
34 | elif req.ui: |
|
34 | elif req.ui: | |
35 | ferr = req.ui.ferr |
|
35 | ferr = req.ui.ferr | |
36 | else: |
|
36 | else: | |
37 | ferr = sys.stderr |
|
37 | ferr = sys.stderr | |
38 |
|
38 | |||
39 | try: |
|
39 | try: | |
40 | if not req.ui: |
|
40 | if not req.ui: | |
41 | req.ui = uimod.ui() |
|
41 | req.ui = uimod.ui() | |
42 | if '--traceback' in req.args: |
|
42 | if '--traceback' in req.args: | |
43 | req.ui.setconfig('ui', 'traceback', 'on', '--traceback') |
|
43 | req.ui.setconfig('ui', 'traceback', 'on', '--traceback') | |
44 |
|
44 | |||
45 | # set ui streams from the request |
|
45 | # set ui streams from the request | |
46 | if req.fin: |
|
46 | if req.fin: | |
47 | req.ui.fin = req.fin |
|
47 | req.ui.fin = req.fin | |
48 | if req.fout: |
|
48 | if req.fout: | |
49 | req.ui.fout = req.fout |
|
49 | req.ui.fout = req.fout | |
50 | if req.ferr: |
|
50 | if req.ferr: | |
51 | req.ui.ferr = req.ferr |
|
51 | req.ui.ferr = req.ferr | |
52 | except util.Abort, inst: |
|
52 | except util.Abort, inst: | |
53 | ferr.write(_("abort: %s\n") % inst) |
|
53 | ferr.write(_("abort: %s\n") % inst) | |
54 | if inst.hint: |
|
54 | if inst.hint: | |
55 | ferr.write(_("(%s)\n") % inst.hint) |
|
55 | ferr.write(_("(%s)\n") % inst.hint) | |
56 | return -1 |
|
56 | return -1 | |
57 | except error.ParseError, inst: |
|
57 | except error.ParseError, inst: | |
58 | if len(inst.args) > 1: |
|
58 | if len(inst.args) > 1: | |
59 | ferr.write(_("hg: parse error at %s: %s\n") % |
|
59 | ferr.write(_("hg: parse error at %s: %s\n") % | |
60 | (inst.args[1], inst.args[0])) |
|
60 | (inst.args[1], inst.args[0])) | |
61 | else: |
|
61 | else: | |
62 | ferr.write(_("hg: parse error: %s\n") % inst.args[0]) |
|
62 | ferr.write(_("hg: parse error: %s\n") % inst.args[0]) | |
63 | return -1 |
|
63 | return -1 | |
64 |
|
64 | |||
65 | msg = ' '.join(' ' in a and repr(a) or a for a in req.args) |
|
65 | msg = ' '.join(' ' in a and repr(a) or a for a in req.args) | |
66 | starttime = time.time() |
|
66 | starttime = time.time() | |
67 | ret = None |
|
67 | ret = None | |
68 | try: |
|
68 | try: | |
69 | ret = _runcatch(req) |
|
69 | ret = _runcatch(req) | |
70 | return ret |
|
70 | return ret | |
71 | finally: |
|
71 | finally: | |
72 | duration = time.time() - starttime |
|
72 | duration = time.time() - starttime | |
73 | req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", |
|
73 | req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", | |
74 | msg, ret or 0, duration) |
|
74 | msg, ret or 0, duration) | |
75 |
|
75 | |||
76 | def _runcatch(req): |
|
76 | def _runcatch(req): | |
77 | def catchterm(*args): |
|
77 | def catchterm(*args): | |
78 | raise error.SignalInterrupt |
|
78 | raise error.SignalInterrupt | |
79 |
|
79 | |||
80 | ui = req.ui |
|
80 | ui = req.ui | |
81 | try: |
|
81 | try: | |
82 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
|
82 | for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | |
83 | num = getattr(signal, name, None) |
|
83 | num = getattr(signal, name, None) | |
84 | if num: |
|
84 | if num: | |
85 | signal.signal(num, catchterm) |
|
85 | signal.signal(num, catchterm) | |
86 | except ValueError: |
|
86 | except ValueError: | |
87 | pass # happens if called in a thread |
|
87 | pass # happens if called in a thread | |
88 |
|
88 | |||
89 | try: |
|
89 | try: | |
90 | try: |
|
90 | try: | |
91 | debugger = 'pdb' |
|
91 | debugger = 'pdb' | |
92 | debugtrace = { |
|
92 | debugtrace = { | |
93 | 'pdb' : pdb.set_trace |
|
93 | 'pdb' : pdb.set_trace | |
94 | } |
|
94 | } | |
95 | debugmortem = { |
|
95 | debugmortem = { | |
96 | 'pdb' : pdb.post_mortem |
|
96 | 'pdb' : pdb.post_mortem | |
97 | } |
|
97 | } | |
98 |
|
98 | |||
99 | # read --config before doing anything else |
|
99 | # read --config before doing anything else | |
100 | # (e.g. to change trust settings for reading .hg/hgrc) |
|
100 | # (e.g. to change trust settings for reading .hg/hgrc) | |
101 | cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args)) |
|
101 | cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args)) | |
102 |
|
102 | |||
103 | if req.repo: |
|
103 | if req.repo: | |
104 | # copy configs that were passed on the cmdline (--config) to |
|
104 | # copy configs that were passed on the cmdline (--config) to | |
105 | # the repo ui |
|
105 | # the repo ui | |
106 | for sec, name, val in cfgs: |
|
106 | for sec, name, val in cfgs: | |
107 | req.repo.ui.setconfig(sec, name, val, source='--config') |
|
107 | req.repo.ui.setconfig(sec, name, val, source='--config') | |
108 |
|
108 | |||
109 | # if we are in HGPLAIN mode, then disable custom debugging |
|
109 | # if we are in HGPLAIN mode, then disable custom debugging | |
110 | debugger = ui.config("ui", "debugger") |
|
110 | debugger = ui.config("ui", "debugger") | |
111 | debugmod = pdb |
|
111 | debugmod = pdb | |
112 | if not debugger or ui.plain(): |
|
112 | if not debugger or ui.plain(): | |
113 | debugger = 'pdb' |
|
113 | debugger = 'pdb' | |
114 | elif '--debugger' in req.args: |
|
114 | elif '--debugger' in req.args: | |
115 | # This import can be slow for fancy debuggers, so only |
|
115 | # This import can be slow for fancy debuggers, so only | |
116 | # do it when absolutely necessary, i.e. when actual |
|
116 | # do it when absolutely necessary, i.e. when actual | |
117 | # debugging has been requested |
|
117 | # debugging has been requested | |
118 | try: |
|
118 | try: | |
119 | debugmod = __import__(debugger) |
|
119 | debugmod = __import__(debugger) | |
120 | except ImportError: |
|
120 | except ImportError: | |
121 | pass # Leave debugmod = pdb |
|
121 | pass # Leave debugmod = pdb | |
122 |
|
122 | |||
123 | debugtrace[debugger] = debugmod.set_trace |
|
123 | debugtrace[debugger] = debugmod.set_trace | |
124 | debugmortem[debugger] = debugmod.post_mortem |
|
124 | debugmortem[debugger] = debugmod.post_mortem | |
125 |
|
125 | |||
126 | # enter the debugger before command execution |
|
126 | # enter the debugger before command execution | |
127 | if '--debugger' in req.args: |
|
127 | if '--debugger' in req.args: | |
128 | ui.warn(_("entering debugger - " |
|
128 | ui.warn(_("entering debugger - " | |
129 | "type c to continue starting hg or h for help\n")) |
|
129 | "type c to continue starting hg or h for help\n")) | |
130 |
|
130 | |||
131 | if (debugger != 'pdb' and |
|
131 | if (debugger != 'pdb' and | |
132 | debugtrace[debugger] == debugtrace['pdb']): |
|
132 | debugtrace[debugger] == debugtrace['pdb']): | |
133 | ui.warn(_("%s debugger specified " |
|
133 | ui.warn(_("%s debugger specified " | |
134 | "but its module was not found\n") % debugger) |
|
134 | "but its module was not found\n") % debugger) | |
135 |
|
135 | |||
136 | debugtrace[debugger]() |
|
136 | debugtrace[debugger]() | |
137 | try: |
|
137 | try: | |
138 | return _dispatch(req) |
|
138 | return _dispatch(req) | |
139 | finally: |
|
139 | finally: | |
140 | ui.flush() |
|
140 | ui.flush() | |
141 | except: # re-raises |
|
141 | except: # re-raises | |
142 | # enter the debugger when we hit an exception |
|
142 | # enter the debugger when we hit an exception | |
143 | if '--debugger' in req.args: |
|
143 | if '--debugger' in req.args: | |
144 | traceback.print_exc() |
|
144 | traceback.print_exc() | |
145 | debugmortem[debugger](sys.exc_info()[2]) |
|
145 | debugmortem[debugger](sys.exc_info()[2]) | |
146 | ui.traceback() |
|
146 | ui.traceback() | |
147 | raise |
|
147 | raise | |
148 |
|
148 | |||
149 | # Global exception handling, alphabetically |
|
149 | # Global exception handling, alphabetically | |
150 | # Mercurial-specific first, followed by built-in and library exceptions |
|
150 | # Mercurial-specific first, followed by built-in and library exceptions | |
151 | except error.AmbiguousCommand, inst: |
|
151 | except error.AmbiguousCommand, inst: | |
152 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
|
152 | ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") % | |
153 | (inst.args[0], " ".join(inst.args[1]))) |
|
153 | (inst.args[0], " ".join(inst.args[1]))) | |
154 | except error.ParseError, inst: |
|
154 | except error.ParseError, inst: | |
155 | if len(inst.args) > 1: |
|
155 | if len(inst.args) > 1: | |
156 | ui.warn(_("hg: parse error at %s: %s\n") % |
|
156 | ui.warn(_("hg: parse error at %s: %s\n") % | |
157 | (inst.args[1], inst.args[0])) |
|
157 | (inst.args[1], inst.args[0])) | |
158 | else: |
|
158 | else: | |
159 | ui.warn(_("hg: parse error: %s\n") % inst.args[0]) |
|
159 | ui.warn(_("hg: parse error: %s\n") % inst.args[0]) | |
160 | return -1 |
|
160 | return -1 | |
161 | except error.LockHeld, inst: |
|
161 | except error.LockHeld, inst: | |
162 | if inst.errno == errno.ETIMEDOUT: |
|
162 | if inst.errno == errno.ETIMEDOUT: | |
163 | reason = _('timed out waiting for lock held by %s') % inst.locker |
|
163 | reason = _('timed out waiting for lock held by %s') % inst.locker | |
164 | else: |
|
164 | else: | |
165 | reason = _('lock held by %s') % inst.locker |
|
165 | reason = _('lock held by %s') % inst.locker | |
166 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
|
166 | ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) | |
167 | except error.LockUnavailable, inst: |
|
167 | except error.LockUnavailable, inst: | |
168 | ui.warn(_("abort: could not lock %s: %s\n") % |
|
168 | ui.warn(_("abort: could not lock %s: %s\n") % | |
169 | (inst.desc or inst.filename, inst.strerror)) |
|
169 | (inst.desc or inst.filename, inst.strerror)) | |
170 | except error.CommandError, inst: |
|
170 | except error.CommandError, inst: | |
171 | if inst.args[0]: |
|
171 | if inst.args[0]: | |
172 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) |
|
172 | ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) | |
173 | commands.help_(ui, inst.args[0], full=False, command=True) |
|
173 | commands.help_(ui, inst.args[0], full=False, command=True) | |
174 | else: |
|
174 | else: | |
175 | ui.warn(_("hg: %s\n") % inst.args[1]) |
|
175 | ui.warn(_("hg: %s\n") % inst.args[1]) | |
176 | commands.help_(ui, 'shortlist') |
|
176 | commands.help_(ui, 'shortlist') | |
177 | except error.OutOfBandError, inst: |
|
177 | except error.OutOfBandError, inst: | |
178 | ui.warn(_("abort: remote error:\n")) |
|
178 | ui.warn(_("abort: remote error:\n")) | |
179 | ui.warn(''.join(inst.args)) |
|
179 | ui.warn(''.join(inst.args)) | |
180 | except error.RepoError, inst: |
|
180 | except error.RepoError, inst: | |
181 | ui.warn(_("abort: %s!\n") % inst) |
|
181 | ui.warn(_("abort: %s!\n") % inst) | |
182 | if inst.hint: |
|
182 | if inst.hint: | |
183 | ui.warn(_("(%s)\n") % inst.hint) |
|
183 | ui.warn(_("(%s)\n") % inst.hint) | |
184 | except error.ResponseError, inst: |
|
184 | except error.ResponseError, inst: | |
185 | ui.warn(_("abort: %s") % inst.args[0]) |
|
185 | ui.warn(_("abort: %s") % inst.args[0]) | |
186 | if not isinstance(inst.args[1], basestring): |
|
186 | if not isinstance(inst.args[1], basestring): | |
187 | ui.warn(" %r\n" % (inst.args[1],)) |
|
187 | ui.warn(" %r\n" % (inst.args[1],)) | |
188 | elif not inst.args[1]: |
|
188 | elif not inst.args[1]: | |
189 | ui.warn(_(" empty string\n")) |
|
189 | ui.warn(_(" empty string\n")) | |
190 | else: |
|
190 | else: | |
191 | ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) |
|
191 | ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) | |
192 | except error.RevlogError, inst: |
|
192 | except error.RevlogError, inst: | |
193 | ui.warn(_("abort: %s!\n") % inst) |
|
193 | ui.warn(_("abort: %s!\n") % inst) | |
194 | except error.SignalInterrupt: |
|
194 | except error.SignalInterrupt: | |
195 | ui.warn(_("killed!\n")) |
|
195 | ui.warn(_("killed!\n")) | |
196 | except error.UnknownCommand, inst: |
|
196 | except error.UnknownCommand, inst: | |
197 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
|
197 | ui.warn(_("hg: unknown command '%s'\n") % inst.args[0]) | |
198 | try: |
|
198 | try: | |
199 | # check if the command is in a disabled extension |
|
199 | # check if the command is in a disabled extension | |
200 | # (but don't check for extensions themselves) |
|
200 | # (but don't check for extensions themselves) | |
201 | commands.help_(ui, inst.args[0], unknowncmd=True) |
|
201 | commands.help_(ui, inst.args[0], unknowncmd=True) | |
202 | except error.UnknownCommand: |
|
202 | except error.UnknownCommand: | |
203 | commands.help_(ui, 'shortlist') |
|
203 | commands.help_(ui, 'shortlist') | |
204 | except error.InterventionRequired, inst: |
|
204 | except error.InterventionRequired, inst: | |
205 | ui.warn("%s\n" % inst) |
|
205 | ui.warn("%s\n" % inst) | |
206 | return 1 |
|
206 | return 1 | |
207 | except util.Abort, inst: |
|
207 | except util.Abort, inst: | |
208 | ui.warn(_("abort: %s\n") % inst) |
|
208 | ui.warn(_("abort: %s\n") % inst) | |
209 | if inst.hint: |
|
209 | if inst.hint: | |
210 | ui.warn(_("(%s)\n") % inst.hint) |
|
210 | ui.warn(_("(%s)\n") % inst.hint) | |
211 | except ImportError, inst: |
|
211 | except ImportError, inst: | |
212 | ui.warn(_("abort: %s!\n") % inst) |
|
212 | ui.warn(_("abort: %s!\n") % inst) | |
213 | m = str(inst).split()[-1] |
|
213 | m = str(inst).split()[-1] | |
214 | if m in "mpatch bdiff".split(): |
|
214 | if m in "mpatch bdiff".split(): | |
215 | ui.warn(_("(did you forget to compile extensions?)\n")) |
|
215 | ui.warn(_("(did you forget to compile extensions?)\n")) | |
216 | elif m in "zlib".split(): |
|
216 | elif m in "zlib".split(): | |
217 | ui.warn(_("(is your Python install correct?)\n")) |
|
217 | ui.warn(_("(is your Python install correct?)\n")) | |
218 | except IOError, inst: |
|
218 | except IOError, inst: | |
219 | if util.safehasattr(inst, "code"): |
|
219 | if util.safehasattr(inst, "code"): | |
220 | ui.warn(_("abort: %s\n") % inst) |
|
220 | ui.warn(_("abort: %s\n") % inst) | |
221 | elif util.safehasattr(inst, "reason"): |
|
221 | elif util.safehasattr(inst, "reason"): | |
222 | try: # usually it is in the form (errno, strerror) |
|
222 | try: # usually it is in the form (errno, strerror) | |
223 | reason = inst.reason.args[1] |
|
223 | reason = inst.reason.args[1] | |
224 | except (AttributeError, IndexError): |
|
224 | except (AttributeError, IndexError): | |
225 | # it might be anything, for example a string |
|
225 | # it might be anything, for example a string | |
226 | reason = inst.reason |
|
226 | reason = inst.reason | |
227 | ui.warn(_("abort: error: %s\n") % reason) |
|
227 | ui.warn(_("abort: error: %s\n") % reason) | |
228 | elif (util.safehasattr(inst, "args") |
|
228 | elif (util.safehasattr(inst, "args") | |
229 | and inst.args and inst.args[0] == errno.EPIPE): |
|
229 | and inst.args and inst.args[0] == errno.EPIPE): | |
230 | if ui.debugflag: |
|
230 | if ui.debugflag: | |
231 | ui.warn(_("broken pipe\n")) |
|
231 | ui.warn(_("broken pipe\n")) | |
232 | elif getattr(inst, "strerror", None): |
|
232 | elif getattr(inst, "strerror", None): | |
233 | if getattr(inst, "filename", None): |
|
233 | if getattr(inst, "filename", None): | |
234 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
|
234 | ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | |
235 | else: |
|
235 | else: | |
236 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
236 | ui.warn(_("abort: %s\n") % inst.strerror) | |
237 | else: |
|
237 | else: | |
238 | raise |
|
238 | raise | |
239 | except OSError, inst: |
|
239 | except OSError, inst: | |
240 | if getattr(inst, "filename", None) is not None: |
|
240 | if getattr(inst, "filename", None) is not None: | |
241 | ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename)) |
|
241 | ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename)) | |
242 | else: |
|
242 | else: | |
243 | ui.warn(_("abort: %s\n") % inst.strerror) |
|
243 | ui.warn(_("abort: %s\n") % inst.strerror) | |
244 | except KeyboardInterrupt: |
|
244 | except KeyboardInterrupt: | |
245 | try: |
|
245 | try: | |
246 | ui.warn(_("interrupted!\n")) |
|
246 | ui.warn(_("interrupted!\n")) | |
247 | except IOError, inst: |
|
247 | except IOError, inst: | |
248 | if inst.errno == errno.EPIPE: |
|
248 | if inst.errno == errno.EPIPE: | |
249 | if ui.debugflag: |
|
249 | if ui.debugflag: | |
250 | ui.warn(_("\nbroken pipe\n")) |
|
250 | ui.warn(_("\nbroken pipe\n")) | |
251 | else: |
|
251 | else: | |
252 | raise |
|
252 | raise | |
253 | except MemoryError: |
|
253 | except MemoryError: | |
254 | ui.warn(_("abort: out of memory\n")) |
|
254 | ui.warn(_("abort: out of memory\n")) | |
255 | except SystemExit, inst: |
|
255 | except SystemExit, inst: | |
256 | # Commands shouldn't sys.exit directly, but give a return code. |
|
256 | # Commands shouldn't sys.exit directly, but give a return code. | |
257 | # Just in case catch this and and pass exit code to caller. |
|
257 | # Just in case catch this and and pass exit code to caller. | |
258 | return inst.code |
|
258 | return inst.code | |
259 | except socket.error, inst: |
|
259 | except socket.error, inst: | |
260 | ui.warn(_("abort: %s\n") % inst.args[-1]) |
|
260 | ui.warn(_("abort: %s\n") % inst.args[-1]) | |
261 | except: # re-raises |
|
261 | except: # re-raises | |
262 | myver = util.version() |
|
262 | myver = util.version() | |
263 | # For compatibility checking, we discard the portion of the hg |
|
263 | # For compatibility checking, we discard the portion of the hg | |
264 | # version after the + on the assumption that if a "normal |
|
264 | # version after the + on the assumption that if a "normal | |
265 | # user" is running a build with a + in it the packager |
|
265 | # user" is running a build with a + in it the packager | |
266 | # probably built from fairly close to a tag and anyone with a |
|
266 | # probably built from fairly close to a tag and anyone with a | |
267 | # 'make local' copy of hg (where the version number can be out |
|
267 | # 'make local' copy of hg (where the version number can be out | |
268 | # of date) will be clueful enough to notice the implausible |
|
268 | # of date) will be clueful enough to notice the implausible | |
269 | # version number and try updating. |
|
269 | # version number and try updating. | |
270 | compare = myver.split('+')[0] |
|
270 | compare = myver.split('+')[0] | |
271 | ct = tuplever(compare) |
|
271 | ct = tuplever(compare) | |
272 | worst = None, ct, '' |
|
272 | worst = None, ct, '' | |
273 | for name, mod in extensions.extensions(): |
|
273 | for name, mod in extensions.extensions(): | |
274 | testedwith = getattr(mod, 'testedwith', '') |
|
274 | testedwith = getattr(mod, 'testedwith', '') | |
275 | report = getattr(mod, 'buglink', _('the extension author.')) |
|
275 | report = getattr(mod, 'buglink', _('the extension author.')) | |
276 | if not testedwith.strip(): |
|
276 | if not testedwith.strip(): | |
277 | # We found an untested extension. It's likely the culprit. |
|
277 | # We found an untested extension. It's likely the culprit. | |
278 | worst = name, 'unknown', report |
|
278 | worst = name, 'unknown', report | |
279 | break |
|
279 | break | |
280 | if compare not in testedwith.split() and testedwith != 'internal': |
|
280 | if compare not in testedwith.split() and testedwith != 'internal': | |
281 | tested = [tuplever(v) for v in testedwith.split()] |
|
281 | tested = [tuplever(v) for v in testedwith.split()] | |
282 | lower = [t for t in tested if t < ct] |
|
282 | lower = [t for t in tested if t < ct] | |
283 | nearest = max(lower or tested) |
|
283 | nearest = max(lower or tested) | |
284 | if worst[0] is None or nearest < worst[1]: |
|
284 | if worst[0] is None or nearest < worst[1]: | |
285 | worst = name, nearest, report |
|
285 | worst = name, nearest, report | |
286 | if worst[0] is not None: |
|
286 | if worst[0] is not None: | |
287 | name, testedwith, report = worst |
|
287 | name, testedwith, report = worst | |
288 | if not isinstance(testedwith, str): |
|
288 | if not isinstance(testedwith, str): | |
289 | testedwith = '.'.join([str(c) for c in testedwith]) |
|
289 | testedwith = '.'.join([str(c) for c in testedwith]) | |
290 | warning = (_('** Unknown exception encountered with ' |
|
290 | warning = (_('** Unknown exception encountered with ' | |
291 | 'possibly-broken third-party extension %s\n' |
|
291 | 'possibly-broken third-party extension %s\n' | |
292 | '** which supports versions %s of Mercurial.\n' |
|
292 | '** which supports versions %s of Mercurial.\n' | |
293 | '** Please disable %s and try your action again.\n' |
|
293 | '** Please disable %s and try your action again.\n' | |
294 | '** If that fixes the bug please report it to %s\n') |
|
294 | '** If that fixes the bug please report it to %s\n') | |
295 | % (name, testedwith, name, report)) |
|
295 | % (name, testedwith, name, report)) | |
296 | else: |
|
296 | else: | |
297 | warning = (_("** unknown exception encountered, " |
|
297 | warning = (_("** unknown exception encountered, " | |
298 | "please report by visiting\n") + |
|
298 | "please report by visiting\n") + | |
299 | _("** http://mercurial.selenic.com/wiki/BugTracker\n")) |
|
299 | _("** http://mercurial.selenic.com/wiki/BugTracker\n")) | |
300 | warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) + |
|
300 | warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) + | |
301 | (_("** Mercurial Distributed SCM (version %s)\n") % myver) + |
|
301 | (_("** Mercurial Distributed SCM (version %s)\n") % myver) + | |
302 | (_("** Extensions loaded: %s\n") % |
|
302 | (_("** Extensions loaded: %s\n") % | |
303 | ", ".join([x[0] for x in extensions.extensions()]))) |
|
303 | ", ".join([x[0] for x in extensions.extensions()]))) | |
304 | ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc()) |
|
304 | ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc()) | |
305 | ui.warn(warning) |
|
305 | ui.warn(warning) | |
306 | raise |
|
306 | raise | |
307 |
|
307 | |||
308 | return -1 |
|
308 | return -1 | |
309 |
|
309 | |||
310 | def tuplever(v): |
|
310 | def tuplever(v): | |
311 | try: |
|
311 | try: | |
312 | return tuple([int(i) for i in v.split('.')]) |
|
312 | return tuple([int(i) for i in v.split('.')]) | |
313 | except ValueError: |
|
313 | except ValueError: | |
314 | return tuple() |
|
314 | return tuple() | |
315 |
|
315 | |||
316 | def aliasargs(fn, givenargs): |
|
316 | def aliasargs(fn, givenargs): | |
317 | args = getattr(fn, 'args', []) |
|
317 | args = getattr(fn, 'args', []) | |
318 | if args: |
|
318 | if args: | |
319 | cmd = ' '.join(map(util.shellquote, args)) |
|
319 | cmd = ' '.join(map(util.shellquote, args)) | |
320 |
|
320 | |||
321 | nums = [] |
|
321 | nums = [] | |
322 | def replacer(m): |
|
322 | def replacer(m): | |
323 | num = int(m.group(1)) - 1 |
|
323 | num = int(m.group(1)) - 1 | |
324 | nums.append(num) |
|
324 | nums.append(num) | |
325 | if num < len(givenargs): |
|
325 | if num < len(givenargs): | |
326 | return givenargs[num] |
|
326 | return givenargs[num] | |
327 | raise util.Abort(_('too few arguments for command alias')) |
|
327 | raise util.Abort(_('too few arguments for command alias')) | |
328 | cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) |
|
328 | cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) | |
329 | givenargs = [x for i, x in enumerate(givenargs) |
|
329 | givenargs = [x for i, x in enumerate(givenargs) | |
330 | if i not in nums] |
|
330 | if i not in nums] | |
331 | args = shlex.split(cmd) |
|
331 | args = shlex.split(cmd) | |
332 | return args + givenargs |
|
332 | return args + givenargs | |
333 |
|
333 | |||
|
334 | def aliasinterpolate(name, args, cmd): | |||
|
335 | '''interpolate args into cmd for shell aliases | |||
|
336 | ||||
|
337 | This also handles $0, $@ and "$@". | |||
|
338 | ''' | |||
|
339 | # util.interpolate can't deal with "$@" (with quotes) because it's only | |||
|
340 | # built to match prefix + patterns. | |||
|
341 | replacemap = dict(('$%d' % (i + 1), arg) for i, arg in enumerate(args)) | |||
|
342 | replacemap['$0'] = name | |||
|
343 | replacemap['$$'] = '$' | |||
|
344 | replacemap['$@'] = ' '.join(args) | |||
|
345 | # Typical Unix shells interpolate "$@" (with quotes) as all the positional | |||
|
346 | # parameters, separated out into words. Emulate the same behavior here by | |||
|
347 | # quoting the arguments individually. POSIX shells will then typically | |||
|
348 | # tokenize each argument into exactly one word. | |||
|
349 | replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args) | |||
|
350 | # escape '\$' for regex | |||
|
351 | regex = '|'.join(replacemap.keys()).replace('$', r'\$') | |||
|
352 | r = re.compile(regex) | |||
|
353 | return r.sub(lambda x: replacemap[x.group()], cmd) | |||
|
354 | ||||
334 | class cmdalias(object): |
|
355 | class cmdalias(object): | |
335 | def __init__(self, name, definition, cmdtable): |
|
356 | def __init__(self, name, definition, cmdtable): | |
336 | self.name = self.cmd = name |
|
357 | self.name = self.cmd = name | |
337 | self.cmdname = '' |
|
358 | self.cmdname = '' | |
338 | self.definition = definition |
|
359 | self.definition = definition | |
339 | self.args = [] |
|
360 | self.args = [] | |
340 | self.opts = [] |
|
361 | self.opts = [] | |
341 | self.help = '' |
|
362 | self.help = '' | |
342 | self.norepo = True |
|
363 | self.norepo = True | |
343 | self.optionalrepo = False |
|
364 | self.optionalrepo = False | |
344 | self.badalias = False |
|
365 | self.badalias = False | |
345 |
|
366 | |||
346 | try: |
|
367 | try: | |
347 | aliases, entry = cmdutil.findcmd(self.name, cmdtable) |
|
368 | aliases, entry = cmdutil.findcmd(self.name, cmdtable) | |
348 | for alias, e in cmdtable.iteritems(): |
|
369 | for alias, e in cmdtable.iteritems(): | |
349 | if e is entry: |
|
370 | if e is entry: | |
350 | self.cmd = alias |
|
371 | self.cmd = alias | |
351 | break |
|
372 | break | |
352 | self.shadows = True |
|
373 | self.shadows = True | |
353 | except error.UnknownCommand: |
|
374 | except error.UnknownCommand: | |
354 | self.shadows = False |
|
375 | self.shadows = False | |
355 |
|
376 | |||
356 | if not self.definition: |
|
377 | if not self.definition: | |
357 | def fn(ui, *args): |
|
378 | def fn(ui, *args): | |
358 | ui.warn(_("no definition for alias '%s'\n") % self.name) |
|
379 | ui.warn(_("no definition for alias '%s'\n") % self.name) | |
359 | return -1 |
|
380 | return -1 | |
360 | self.fn = fn |
|
381 | self.fn = fn | |
361 | self.badalias = True |
|
382 | self.badalias = True | |
362 | return |
|
383 | return | |
363 |
|
384 | |||
364 | if self.definition.startswith('!'): |
|
385 | if self.definition.startswith('!'): | |
365 | self.shell = True |
|
386 | self.shell = True | |
366 | def fn(ui, *args): |
|
387 | def fn(ui, *args): | |
367 | env = {'HG_ARGS': ' '.join((self.name,) + args)} |
|
388 | env = {'HG_ARGS': ' '.join((self.name,) + args)} | |
368 | def _checkvar(m): |
|
389 | def _checkvar(m): | |
369 | if m.groups()[0] == '$': |
|
390 | if m.groups()[0] == '$': | |
370 | return m.group() |
|
391 | return m.group() | |
371 | elif int(m.groups()[0]) <= len(args): |
|
392 | elif int(m.groups()[0]) <= len(args): | |
372 | return m.group() |
|
393 | return m.group() | |
373 | else: |
|
394 | else: | |
374 | ui.debug("No argument found for substitution " |
|
395 | ui.debug("No argument found for substitution " | |
375 | "of %i variable in alias '%s' definition." |
|
396 | "of %i variable in alias '%s' definition." | |
376 | % (int(m.groups()[0]), self.name)) |
|
397 | % (int(m.groups()[0]), self.name)) | |
377 | return '' |
|
398 | return '' | |
378 | cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:]) |
|
399 | cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:]) | |
379 | replace = dict((str(i + 1), arg) for i, arg in enumerate(args)) |
|
400 | cmd = aliasinterpolate(self.name, args, cmd) | |
380 | replace['0'] = self.name |
|
|||
381 | replace['@'] = ' '.join(args) |
|
|||
382 | cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True) |
|
|||
383 | return util.system(cmd, environ=env, out=ui.fout) |
|
401 | return util.system(cmd, environ=env, out=ui.fout) | |
384 | self.fn = fn |
|
402 | self.fn = fn | |
385 | return |
|
403 | return | |
386 |
|
404 | |||
387 | try: |
|
405 | try: | |
388 | args = shlex.split(self.definition) |
|
406 | args = shlex.split(self.definition) | |
389 | except ValueError, inst: |
|
407 | except ValueError, inst: | |
390 | def fn(ui, *args): |
|
408 | def fn(ui, *args): | |
391 | ui.warn(_("error in definition for alias '%s': %s\n") |
|
409 | ui.warn(_("error in definition for alias '%s': %s\n") | |
392 | % (self.name, inst)) |
|
410 | % (self.name, inst)) | |
393 | return -1 |
|
411 | return -1 | |
394 | self.fn = fn |
|
412 | self.fn = fn | |
395 | self.badalias = True |
|
413 | self.badalias = True | |
396 | return |
|
414 | return | |
397 | self.cmdname = cmd = args.pop(0) |
|
415 | self.cmdname = cmd = args.pop(0) | |
398 | args = map(util.expandpath, args) |
|
416 | args = map(util.expandpath, args) | |
399 |
|
417 | |||
400 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): |
|
418 | for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"): | |
401 | if _earlygetopt([invalidarg], args): |
|
419 | if _earlygetopt([invalidarg], args): | |
402 | def fn(ui, *args): |
|
420 | def fn(ui, *args): | |
403 | ui.warn(_("error in definition for alias '%s': %s may only " |
|
421 | ui.warn(_("error in definition for alias '%s': %s may only " | |
404 | "be given on the command line\n") |
|
422 | "be given on the command line\n") | |
405 | % (self.name, invalidarg)) |
|
423 | % (self.name, invalidarg)) | |
406 | return -1 |
|
424 | return -1 | |
407 |
|
425 | |||
408 | self.fn = fn |
|
426 | self.fn = fn | |
409 | self.badalias = True |
|
427 | self.badalias = True | |
410 | return |
|
428 | return | |
411 |
|
429 | |||
412 | try: |
|
430 | try: | |
413 | tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1] |
|
431 | tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1] | |
414 | if len(tableentry) > 2: |
|
432 | if len(tableentry) > 2: | |
415 | self.fn, self.opts, self.help = tableentry |
|
433 | self.fn, self.opts, self.help = tableentry | |
416 | else: |
|
434 | else: | |
417 | self.fn, self.opts = tableentry |
|
435 | self.fn, self.opts = tableentry | |
418 |
|
436 | |||
419 | self.args = aliasargs(self.fn, args) |
|
437 | self.args = aliasargs(self.fn, args) | |
420 | if cmd not in commands.norepo.split(' '): |
|
438 | if cmd not in commands.norepo.split(' '): | |
421 | self.norepo = False |
|
439 | self.norepo = False | |
422 | if cmd in commands.optionalrepo.split(' '): |
|
440 | if cmd in commands.optionalrepo.split(' '): | |
423 | self.optionalrepo = True |
|
441 | self.optionalrepo = True | |
424 | if self.help.startswith("hg " + cmd): |
|
442 | if self.help.startswith("hg " + cmd): | |
425 | # drop prefix in old-style help lines so hg shows the alias |
|
443 | # drop prefix in old-style help lines so hg shows the alias | |
426 | self.help = self.help[4 + len(cmd):] |
|
444 | self.help = self.help[4 + len(cmd):] | |
427 | self.__doc__ = self.fn.__doc__ |
|
445 | self.__doc__ = self.fn.__doc__ | |
428 |
|
446 | |||
429 | except error.UnknownCommand: |
|
447 | except error.UnknownCommand: | |
430 | def fn(ui, *args): |
|
448 | def fn(ui, *args): | |
431 | ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \ |
|
449 | ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \ | |
432 | % (self.name, cmd)) |
|
450 | % (self.name, cmd)) | |
433 | try: |
|
451 | try: | |
434 | # check if the command is in a disabled extension |
|
452 | # check if the command is in a disabled extension | |
435 | commands.help_(ui, cmd, unknowncmd=True) |
|
453 | commands.help_(ui, cmd, unknowncmd=True) | |
436 | except error.UnknownCommand: |
|
454 | except error.UnknownCommand: | |
437 | pass |
|
455 | pass | |
438 | return -1 |
|
456 | return -1 | |
439 | self.fn = fn |
|
457 | self.fn = fn | |
440 | self.badalias = True |
|
458 | self.badalias = True | |
441 | except error.AmbiguousCommand: |
|
459 | except error.AmbiguousCommand: | |
442 | def fn(ui, *args): |
|
460 | def fn(ui, *args): | |
443 | ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ |
|
461 | ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ | |
444 | % (self.name, cmd)) |
|
462 | % (self.name, cmd)) | |
445 | return -1 |
|
463 | return -1 | |
446 | self.fn = fn |
|
464 | self.fn = fn | |
447 | self.badalias = True |
|
465 | self.badalias = True | |
448 |
|
466 | |||
449 | def __call__(self, ui, *args, **opts): |
|
467 | def __call__(self, ui, *args, **opts): | |
450 | if self.shadows: |
|
468 | if self.shadows: | |
451 | ui.debug("alias '%s' shadows command '%s'\n" % |
|
469 | ui.debug("alias '%s' shadows command '%s'\n" % | |
452 | (self.name, self.cmdname)) |
|
470 | (self.name, self.cmdname)) | |
453 |
|
471 | |||
454 | if util.safehasattr(self, 'shell'): |
|
472 | if util.safehasattr(self, 'shell'): | |
455 | return self.fn(ui, *args, **opts) |
|
473 | return self.fn(ui, *args, **opts) | |
456 | else: |
|
474 | else: | |
457 | try: |
|
475 | try: | |
458 | return util.checksignature(self.fn)(ui, *args, **opts) |
|
476 | return util.checksignature(self.fn)(ui, *args, **opts) | |
459 | except error.SignatureError: |
|
477 | except error.SignatureError: | |
460 | args = ' '.join([self.cmdname] + self.args) |
|
478 | args = ' '.join([self.cmdname] + self.args) | |
461 | ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) |
|
479 | ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) | |
462 | raise |
|
480 | raise | |
463 |
|
481 | |||
464 | def addaliases(ui, cmdtable): |
|
482 | def addaliases(ui, cmdtable): | |
465 | # aliases are processed after extensions have been loaded, so they |
|
483 | # aliases are processed after extensions have been loaded, so they | |
466 | # may use extension commands. Aliases can also use other alias definitions, |
|
484 | # may use extension commands. Aliases can also use other alias definitions, | |
467 | # but only if they have been defined prior to the current definition. |
|
485 | # but only if they have been defined prior to the current definition. | |
468 | for alias, definition in ui.configitems('alias'): |
|
486 | for alias, definition in ui.configitems('alias'): | |
469 | aliasdef = cmdalias(alias, definition, cmdtable) |
|
487 | aliasdef = cmdalias(alias, definition, cmdtable) | |
470 |
|
488 | |||
471 | try: |
|
489 | try: | |
472 | olddef = cmdtable[aliasdef.cmd][0] |
|
490 | olddef = cmdtable[aliasdef.cmd][0] | |
473 | if olddef.definition == aliasdef.definition: |
|
491 | if olddef.definition == aliasdef.definition: | |
474 | continue |
|
492 | continue | |
475 | except (KeyError, AttributeError): |
|
493 | except (KeyError, AttributeError): | |
476 | # definition might not exist or it might not be a cmdalias |
|
494 | # definition might not exist or it might not be a cmdalias | |
477 | pass |
|
495 | pass | |
478 |
|
496 | |||
479 | cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help) |
|
497 | cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help) | |
480 | if aliasdef.norepo: |
|
498 | if aliasdef.norepo: | |
481 | commands.norepo += ' %s' % alias |
|
499 | commands.norepo += ' %s' % alias | |
482 | if aliasdef.optionalrepo: |
|
500 | if aliasdef.optionalrepo: | |
483 | commands.optionalrepo += ' %s' % alias |
|
501 | commands.optionalrepo += ' %s' % alias | |
484 |
|
502 | |||
485 | def _parse(ui, args): |
|
503 | def _parse(ui, args): | |
486 | options = {} |
|
504 | options = {} | |
487 | cmdoptions = {} |
|
505 | cmdoptions = {} | |
488 |
|
506 | |||
489 | try: |
|
507 | try: | |
490 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
508 | args = fancyopts.fancyopts(args, commands.globalopts, options) | |
491 | except fancyopts.getopt.GetoptError, inst: |
|
509 | except fancyopts.getopt.GetoptError, inst: | |
492 | raise error.CommandError(None, inst) |
|
510 | raise error.CommandError(None, inst) | |
493 |
|
511 | |||
494 | if args: |
|
512 | if args: | |
495 | cmd, args = args[0], args[1:] |
|
513 | cmd, args = args[0], args[1:] | |
496 | aliases, entry = cmdutil.findcmd(cmd, commands.table, |
|
514 | aliases, entry = cmdutil.findcmd(cmd, commands.table, | |
497 | ui.configbool("ui", "strict")) |
|
515 | ui.configbool("ui", "strict")) | |
498 | cmd = aliases[0] |
|
516 | cmd = aliases[0] | |
499 | args = aliasargs(entry[0], args) |
|
517 | args = aliasargs(entry[0], args) | |
500 | defaults = ui.config("defaults", cmd) |
|
518 | defaults = ui.config("defaults", cmd) | |
501 | if defaults: |
|
519 | if defaults: | |
502 | args = map(util.expandpath, shlex.split(defaults)) + args |
|
520 | args = map(util.expandpath, shlex.split(defaults)) + args | |
503 | c = list(entry[1]) |
|
521 | c = list(entry[1]) | |
504 | else: |
|
522 | else: | |
505 | cmd = None |
|
523 | cmd = None | |
506 | c = [] |
|
524 | c = [] | |
507 |
|
525 | |||
508 | # combine global options into local |
|
526 | # combine global options into local | |
509 | for o in commands.globalopts: |
|
527 | for o in commands.globalopts: | |
510 | c.append((o[0], o[1], options[o[1]], o[3])) |
|
528 | c.append((o[0], o[1], options[o[1]], o[3])) | |
511 |
|
529 | |||
512 | try: |
|
530 | try: | |
513 | args = fancyopts.fancyopts(args, c, cmdoptions, True) |
|
531 | args = fancyopts.fancyopts(args, c, cmdoptions, True) | |
514 | except fancyopts.getopt.GetoptError, inst: |
|
532 | except fancyopts.getopt.GetoptError, inst: | |
515 | raise error.CommandError(cmd, inst) |
|
533 | raise error.CommandError(cmd, inst) | |
516 |
|
534 | |||
517 | # separate global options back out |
|
535 | # separate global options back out | |
518 | for o in commands.globalopts: |
|
536 | for o in commands.globalopts: | |
519 | n = o[1] |
|
537 | n = o[1] | |
520 | options[n] = cmdoptions[n] |
|
538 | options[n] = cmdoptions[n] | |
521 | del cmdoptions[n] |
|
539 | del cmdoptions[n] | |
522 |
|
540 | |||
523 | return (cmd, cmd and entry[0] or None, args, options, cmdoptions) |
|
541 | return (cmd, cmd and entry[0] or None, args, options, cmdoptions) | |
524 |
|
542 | |||
525 | def _parseconfig(ui, config): |
|
543 | def _parseconfig(ui, config): | |
526 | """parse the --config options from the command line""" |
|
544 | """parse the --config options from the command line""" | |
527 | configs = [] |
|
545 | configs = [] | |
528 |
|
546 | |||
529 | for cfg in config: |
|
547 | for cfg in config: | |
530 | try: |
|
548 | try: | |
531 | name, value = cfg.split('=', 1) |
|
549 | name, value = cfg.split('=', 1) | |
532 | section, name = name.split('.', 1) |
|
550 | section, name = name.split('.', 1) | |
533 | if not section or not name: |
|
551 | if not section or not name: | |
534 | raise IndexError |
|
552 | raise IndexError | |
535 | ui.setconfig(section, name, value, '--config') |
|
553 | ui.setconfig(section, name, value, '--config') | |
536 | configs.append((section, name, value)) |
|
554 | configs.append((section, name, value)) | |
537 | except (IndexError, ValueError): |
|
555 | except (IndexError, ValueError): | |
538 | raise util.Abort(_('malformed --config option: %r ' |
|
556 | raise util.Abort(_('malformed --config option: %r ' | |
539 | '(use --config section.name=value)') % cfg) |
|
557 | '(use --config section.name=value)') % cfg) | |
540 |
|
558 | |||
541 | return configs |
|
559 | return configs | |
542 |
|
560 | |||
543 | def _earlygetopt(aliases, args): |
|
561 | def _earlygetopt(aliases, args): | |
544 | """Return list of values for an option (or aliases). |
|
562 | """Return list of values for an option (or aliases). | |
545 |
|
563 | |||
546 | The values are listed in the order they appear in args. |
|
564 | The values are listed in the order they appear in args. | |
547 | The options and values are removed from args. |
|
565 | The options and values are removed from args. | |
548 |
|
566 | |||
549 | >>> args = ['x', '--cwd', 'foo', 'y'] |
|
567 | >>> args = ['x', '--cwd', 'foo', 'y'] | |
550 | >>> _earlygetopt(['--cwd'], args), args |
|
568 | >>> _earlygetopt(['--cwd'], args), args | |
551 | (['foo'], ['x', 'y']) |
|
569 | (['foo'], ['x', 'y']) | |
552 |
|
570 | |||
553 | >>> args = ['x', '--cwd=bar', 'y'] |
|
571 | >>> args = ['x', '--cwd=bar', 'y'] | |
554 | >>> _earlygetopt(['--cwd'], args), args |
|
572 | >>> _earlygetopt(['--cwd'], args), args | |
555 | (['bar'], ['x', 'y']) |
|
573 | (['bar'], ['x', 'y']) | |
556 |
|
574 | |||
557 | >>> args = ['x', '-R', 'foo', 'y'] |
|
575 | >>> args = ['x', '-R', 'foo', 'y'] | |
558 | >>> _earlygetopt(['-R'], args), args |
|
576 | >>> _earlygetopt(['-R'], args), args | |
559 | (['foo'], ['x', 'y']) |
|
577 | (['foo'], ['x', 'y']) | |
560 |
|
578 | |||
561 | >>> args = ['x', '-Rbar', 'y'] |
|
579 | >>> args = ['x', '-Rbar', 'y'] | |
562 | >>> _earlygetopt(['-R'], args), args |
|
580 | >>> _earlygetopt(['-R'], args), args | |
563 | (['bar'], ['x', 'y']) |
|
581 | (['bar'], ['x', 'y']) | |
564 | """ |
|
582 | """ | |
565 | try: |
|
583 | try: | |
566 | argcount = args.index("--") |
|
584 | argcount = args.index("--") | |
567 | except ValueError: |
|
585 | except ValueError: | |
568 | argcount = len(args) |
|
586 | argcount = len(args) | |
569 | shortopts = [opt for opt in aliases if len(opt) == 2] |
|
587 | shortopts = [opt for opt in aliases if len(opt) == 2] | |
570 | values = [] |
|
588 | values = [] | |
571 | pos = 0 |
|
589 | pos = 0 | |
572 | while pos < argcount: |
|
590 | while pos < argcount: | |
573 | fullarg = arg = args[pos] |
|
591 | fullarg = arg = args[pos] | |
574 | equals = arg.find('=') |
|
592 | equals = arg.find('=') | |
575 | if equals > -1: |
|
593 | if equals > -1: | |
576 | arg = arg[:equals] |
|
594 | arg = arg[:equals] | |
577 | if arg in aliases: |
|
595 | if arg in aliases: | |
578 | del args[pos] |
|
596 | del args[pos] | |
579 | if equals > -1: |
|
597 | if equals > -1: | |
580 | values.append(fullarg[equals + 1:]) |
|
598 | values.append(fullarg[equals + 1:]) | |
581 | argcount -= 1 |
|
599 | argcount -= 1 | |
582 | else: |
|
600 | else: | |
583 | if pos + 1 >= argcount: |
|
601 | if pos + 1 >= argcount: | |
584 | # ignore and let getopt report an error if there is no value |
|
602 | # ignore and let getopt report an error if there is no value | |
585 | break |
|
603 | break | |
586 | values.append(args.pop(pos)) |
|
604 | values.append(args.pop(pos)) | |
587 | argcount -= 2 |
|
605 | argcount -= 2 | |
588 | elif arg[:2] in shortopts: |
|
606 | elif arg[:2] in shortopts: | |
589 | # short option can have no following space, e.g. hg log -Rfoo |
|
607 | # short option can have no following space, e.g. hg log -Rfoo | |
590 | values.append(args.pop(pos)[2:]) |
|
608 | values.append(args.pop(pos)[2:]) | |
591 | argcount -= 1 |
|
609 | argcount -= 1 | |
592 | else: |
|
610 | else: | |
593 | pos += 1 |
|
611 | pos += 1 | |
594 | return values |
|
612 | return values | |
595 |
|
613 | |||
596 | def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
|
614 | def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): | |
597 | # run pre-hook, and abort if it fails |
|
615 | # run pre-hook, and abort if it fails | |
598 | hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
|
616 | hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), | |
599 | pats=cmdpats, opts=cmdoptions) |
|
617 | pats=cmdpats, opts=cmdoptions) | |
600 | ret = _runcommand(ui, options, cmd, d) |
|
618 | ret = _runcommand(ui, options, cmd, d) | |
601 | # run post-hook, passing command result |
|
619 | # run post-hook, passing command result | |
602 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
|
620 | hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), | |
603 | result=ret, pats=cmdpats, opts=cmdoptions) |
|
621 | result=ret, pats=cmdpats, opts=cmdoptions) | |
604 | return ret |
|
622 | return ret | |
605 |
|
623 | |||
606 | def _getlocal(ui, rpath): |
|
624 | def _getlocal(ui, rpath): | |
607 | """Return (path, local ui object) for the given target path. |
|
625 | """Return (path, local ui object) for the given target path. | |
608 |
|
626 | |||
609 | Takes paths in [cwd]/.hg/hgrc into account." |
|
627 | Takes paths in [cwd]/.hg/hgrc into account." | |
610 | """ |
|
628 | """ | |
611 | try: |
|
629 | try: | |
612 | wd = os.getcwd() |
|
630 | wd = os.getcwd() | |
613 | except OSError, e: |
|
631 | except OSError, e: | |
614 | raise util.Abort(_("error getting current working directory: %s") % |
|
632 | raise util.Abort(_("error getting current working directory: %s") % | |
615 | e.strerror) |
|
633 | e.strerror) | |
616 | path = cmdutil.findrepo(wd) or "" |
|
634 | path = cmdutil.findrepo(wd) or "" | |
617 | if not path: |
|
635 | if not path: | |
618 | lui = ui |
|
636 | lui = ui | |
619 | else: |
|
637 | else: | |
620 | lui = ui.copy() |
|
638 | lui = ui.copy() | |
621 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
|
639 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) | |
622 |
|
640 | |||
623 | if rpath and rpath[-1]: |
|
641 | if rpath and rpath[-1]: | |
624 | path = lui.expandpath(rpath[-1]) |
|
642 | path = lui.expandpath(rpath[-1]) | |
625 | lui = ui.copy() |
|
643 | lui = ui.copy() | |
626 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) |
|
644 | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) | |
627 |
|
645 | |||
628 | return path, lui |
|
646 | return path, lui | |
629 |
|
647 | |||
630 | def _checkshellalias(lui, ui, args): |
|
648 | def _checkshellalias(lui, ui, args): | |
631 | options = {} |
|
649 | options = {} | |
632 |
|
650 | |||
633 | try: |
|
651 | try: | |
634 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
652 | args = fancyopts.fancyopts(args, commands.globalopts, options) | |
635 | except fancyopts.getopt.GetoptError: |
|
653 | except fancyopts.getopt.GetoptError: | |
636 | return |
|
654 | return | |
637 |
|
655 | |||
638 | if not args: |
|
656 | if not args: | |
639 | return |
|
657 | return | |
640 |
|
658 | |||
641 | norepo = commands.norepo |
|
659 | norepo = commands.norepo | |
642 | optionalrepo = commands.optionalrepo |
|
660 | optionalrepo = commands.optionalrepo | |
643 | def restorecommands(): |
|
661 | def restorecommands(): | |
644 | commands.norepo = norepo |
|
662 | commands.norepo = norepo | |
645 | commands.optionalrepo = optionalrepo |
|
663 | commands.optionalrepo = optionalrepo | |
646 |
|
664 | |||
647 | cmdtable = commands.table.copy() |
|
665 | cmdtable = commands.table.copy() | |
648 | addaliases(lui, cmdtable) |
|
666 | addaliases(lui, cmdtable) | |
649 |
|
667 | |||
650 | cmd = args[0] |
|
668 | cmd = args[0] | |
651 | try: |
|
669 | try: | |
652 | aliases, entry = cmdutil.findcmd(cmd, cmdtable) |
|
670 | aliases, entry = cmdutil.findcmd(cmd, cmdtable) | |
653 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
671 | except (error.AmbiguousCommand, error.UnknownCommand): | |
654 | restorecommands() |
|
672 | restorecommands() | |
655 | return |
|
673 | return | |
656 |
|
674 | |||
657 | cmd = aliases[0] |
|
675 | cmd = aliases[0] | |
658 | fn = entry[0] |
|
676 | fn = entry[0] | |
659 |
|
677 | |||
660 | if cmd and util.safehasattr(fn, 'shell'): |
|
678 | if cmd and util.safehasattr(fn, 'shell'): | |
661 | d = lambda: fn(ui, *args[1:]) |
|
679 | d = lambda: fn(ui, *args[1:]) | |
662 | return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, |
|
680 | return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, | |
663 | [], {}) |
|
681 | [], {}) | |
664 |
|
682 | |||
665 | restorecommands() |
|
683 | restorecommands() | |
666 |
|
684 | |||
667 | _loaded = set() |
|
685 | _loaded = set() | |
668 | def _dispatch(req): |
|
686 | def _dispatch(req): | |
669 | args = req.args |
|
687 | args = req.args | |
670 | ui = req.ui |
|
688 | ui = req.ui | |
671 |
|
689 | |||
672 | # check for cwd |
|
690 | # check for cwd | |
673 | cwd = _earlygetopt(['--cwd'], args) |
|
691 | cwd = _earlygetopt(['--cwd'], args) | |
674 | if cwd: |
|
692 | if cwd: | |
675 | os.chdir(cwd[-1]) |
|
693 | os.chdir(cwd[-1]) | |
676 |
|
694 | |||
677 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) |
|
695 | rpath = _earlygetopt(["-R", "--repository", "--repo"], args) | |
678 | path, lui = _getlocal(ui, rpath) |
|
696 | path, lui = _getlocal(ui, rpath) | |
679 |
|
697 | |||
680 | # Now that we're operating in the right directory/repository with |
|
698 | # Now that we're operating in the right directory/repository with | |
681 | # the right config settings, check for shell aliases |
|
699 | # the right config settings, check for shell aliases | |
682 | shellaliasfn = _checkshellalias(lui, ui, args) |
|
700 | shellaliasfn = _checkshellalias(lui, ui, args) | |
683 | if shellaliasfn: |
|
701 | if shellaliasfn: | |
684 | return shellaliasfn() |
|
702 | return shellaliasfn() | |
685 |
|
703 | |||
686 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
|
704 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and | |
687 | # reposetup. Programs like TortoiseHg will call _dispatch several |
|
705 | # reposetup. Programs like TortoiseHg will call _dispatch several | |
688 | # times so we keep track of configured extensions in _loaded. |
|
706 | # times so we keep track of configured extensions in _loaded. | |
689 | extensions.loadall(lui) |
|
707 | extensions.loadall(lui) | |
690 | exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] |
|
708 | exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] | |
691 | # Propagate any changes to lui.__class__ by extensions |
|
709 | # Propagate any changes to lui.__class__ by extensions | |
692 | ui.__class__ = lui.__class__ |
|
710 | ui.__class__ = lui.__class__ | |
693 |
|
711 | |||
694 | # (uisetup and extsetup are handled in extensions.loadall) |
|
712 | # (uisetup and extsetup are handled in extensions.loadall) | |
695 |
|
713 | |||
696 | for name, module in exts: |
|
714 | for name, module in exts: | |
697 | cmdtable = getattr(module, 'cmdtable', {}) |
|
715 | cmdtable = getattr(module, 'cmdtable', {}) | |
698 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] |
|
716 | overrides = [cmd for cmd in cmdtable if cmd in commands.table] | |
699 | if overrides: |
|
717 | if overrides: | |
700 | ui.warn(_("extension '%s' overrides commands: %s\n") |
|
718 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
701 | % (name, " ".join(overrides))) |
|
719 | % (name, " ".join(overrides))) | |
702 | commands.table.update(cmdtable) |
|
720 | commands.table.update(cmdtable) | |
703 | _loaded.add(name) |
|
721 | _loaded.add(name) | |
704 |
|
722 | |||
705 | # (reposetup is handled in hg.repository) |
|
723 | # (reposetup is handled in hg.repository) | |
706 |
|
724 | |||
707 | addaliases(lui, commands.table) |
|
725 | addaliases(lui, commands.table) | |
708 |
|
726 | |||
709 | # check for fallback encoding |
|
727 | # check for fallback encoding | |
710 | fallback = lui.config('ui', 'fallbackencoding') |
|
728 | fallback = lui.config('ui', 'fallbackencoding') | |
711 | if fallback: |
|
729 | if fallback: | |
712 | encoding.fallbackencoding = fallback |
|
730 | encoding.fallbackencoding = fallback | |
713 |
|
731 | |||
714 | fullargs = args |
|
732 | fullargs = args | |
715 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
733 | cmd, func, args, options, cmdoptions = _parse(lui, args) | |
716 |
|
734 | |||
717 | if options["config"]: |
|
735 | if options["config"]: | |
718 | raise util.Abort(_("option --config may not be abbreviated!")) |
|
736 | raise util.Abort(_("option --config may not be abbreviated!")) | |
719 | if options["cwd"]: |
|
737 | if options["cwd"]: | |
720 | raise util.Abort(_("option --cwd may not be abbreviated!")) |
|
738 | raise util.Abort(_("option --cwd may not be abbreviated!")) | |
721 | if options["repository"]: |
|
739 | if options["repository"]: | |
722 | raise util.Abort(_( |
|
740 | raise util.Abort(_( | |
723 | "option -R has to be separated from other options (e.g. not -qR) " |
|
741 | "option -R has to be separated from other options (e.g. not -qR) " | |
724 | "and --repository may only be abbreviated as --repo!")) |
|
742 | "and --repository may only be abbreviated as --repo!")) | |
725 |
|
743 | |||
726 | if options["encoding"]: |
|
744 | if options["encoding"]: | |
727 | encoding.encoding = options["encoding"] |
|
745 | encoding.encoding = options["encoding"] | |
728 | if options["encodingmode"]: |
|
746 | if options["encodingmode"]: | |
729 | encoding.encodingmode = options["encodingmode"] |
|
747 | encoding.encodingmode = options["encodingmode"] | |
730 | if options["time"]: |
|
748 | if options["time"]: | |
731 | def get_times(): |
|
749 | def get_times(): | |
732 | t = os.times() |
|
750 | t = os.times() | |
733 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() |
|
751 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() | |
734 | t = (t[0], t[1], t[2], t[3], time.clock()) |
|
752 | t = (t[0], t[1], t[2], t[3], time.clock()) | |
735 | return t |
|
753 | return t | |
736 | s = get_times() |
|
754 | s = get_times() | |
737 | def print_time(): |
|
755 | def print_time(): | |
738 | t = get_times() |
|
756 | t = get_times() | |
739 | ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
|
757 | ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % | |
740 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
|
758 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | |
741 | atexit.register(print_time) |
|
759 | atexit.register(print_time) | |
742 |
|
760 | |||
743 | uis = set([ui, lui]) |
|
761 | uis = set([ui, lui]) | |
744 |
|
762 | |||
745 | if req.repo: |
|
763 | if req.repo: | |
746 | uis.add(req.repo.ui) |
|
764 | uis.add(req.repo.ui) | |
747 |
|
765 | |||
748 | if options['verbose'] or options['debug'] or options['quiet']: |
|
766 | if options['verbose'] or options['debug'] or options['quiet']: | |
749 | for opt in ('verbose', 'debug', 'quiet'): |
|
767 | for opt in ('verbose', 'debug', 'quiet'): | |
750 | val = str(bool(options[opt])) |
|
768 | val = str(bool(options[opt])) | |
751 | for ui_ in uis: |
|
769 | for ui_ in uis: | |
752 | ui_.setconfig('ui', opt, val, '--' + opt) |
|
770 | ui_.setconfig('ui', opt, val, '--' + opt) | |
753 |
|
771 | |||
754 | if options['traceback']: |
|
772 | if options['traceback']: | |
755 | for ui_ in uis: |
|
773 | for ui_ in uis: | |
756 | ui_.setconfig('ui', 'traceback', 'on', '--traceback') |
|
774 | ui_.setconfig('ui', 'traceback', 'on', '--traceback') | |
757 |
|
775 | |||
758 | if options['noninteractive']: |
|
776 | if options['noninteractive']: | |
759 | for ui_ in uis: |
|
777 | for ui_ in uis: | |
760 | ui_.setconfig('ui', 'interactive', 'off', '-y') |
|
778 | ui_.setconfig('ui', 'interactive', 'off', '-y') | |
761 |
|
779 | |||
762 | if cmdoptions.get('insecure', False): |
|
780 | if cmdoptions.get('insecure', False): | |
763 | for ui_ in uis: |
|
781 | for ui_ in uis: | |
764 | ui_.setconfig('web', 'cacerts', '', '--insecure') |
|
782 | ui_.setconfig('web', 'cacerts', '', '--insecure') | |
765 |
|
783 | |||
766 | if options['version']: |
|
784 | if options['version']: | |
767 | return commands.version_(ui) |
|
785 | return commands.version_(ui) | |
768 | if options['help']: |
|
786 | if options['help']: | |
769 | return commands.help_(ui, cmd, command=True) |
|
787 | return commands.help_(ui, cmd, command=True) | |
770 | elif not cmd: |
|
788 | elif not cmd: | |
771 | return commands.help_(ui, 'shortlist') |
|
789 | return commands.help_(ui, 'shortlist') | |
772 |
|
790 | |||
773 | repo = None |
|
791 | repo = None | |
774 | cmdpats = args[:] |
|
792 | cmdpats = args[:] | |
775 | if cmd not in commands.norepo.split(): |
|
793 | if cmd not in commands.norepo.split(): | |
776 | # use the repo from the request only if we don't have -R |
|
794 | # use the repo from the request only if we don't have -R | |
777 | if not rpath and not cwd: |
|
795 | if not rpath and not cwd: | |
778 | repo = req.repo |
|
796 | repo = req.repo | |
779 |
|
797 | |||
780 | if repo: |
|
798 | if repo: | |
781 | # set the descriptors of the repo ui to those of ui |
|
799 | # set the descriptors of the repo ui to those of ui | |
782 | repo.ui.fin = ui.fin |
|
800 | repo.ui.fin = ui.fin | |
783 | repo.ui.fout = ui.fout |
|
801 | repo.ui.fout = ui.fout | |
784 | repo.ui.ferr = ui.ferr |
|
802 | repo.ui.ferr = ui.ferr | |
785 | else: |
|
803 | else: | |
786 | try: |
|
804 | try: | |
787 | repo = hg.repository(ui, path=path) |
|
805 | repo = hg.repository(ui, path=path) | |
788 | if not repo.local(): |
|
806 | if not repo.local(): | |
789 | raise util.Abort(_("repository '%s' is not local") % path) |
|
807 | raise util.Abort(_("repository '%s' is not local") % path) | |
790 | repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') |
|
808 | repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') | |
791 | except error.RequirementError: |
|
809 | except error.RequirementError: | |
792 | raise |
|
810 | raise | |
793 | except error.RepoError: |
|
811 | except error.RepoError: | |
794 | if cmd not in commands.optionalrepo.split(): |
|
812 | if cmd not in commands.optionalrepo.split(): | |
795 | if (cmd in commands.inferrepo.split() and |
|
813 | if (cmd in commands.inferrepo.split() and | |
796 | args and not path): # try to infer -R from command args |
|
814 | args and not path): # try to infer -R from command args | |
797 | repos = map(cmdutil.findrepo, args) |
|
815 | repos = map(cmdutil.findrepo, args) | |
798 | guess = repos[0] |
|
816 | guess = repos[0] | |
799 | if guess and repos.count(guess) == len(repos): |
|
817 | if guess and repos.count(guess) == len(repos): | |
800 | req.args = ['--repository', guess] + fullargs |
|
818 | req.args = ['--repository', guess] + fullargs | |
801 | return _dispatch(req) |
|
819 | return _dispatch(req) | |
802 | if not path: |
|
820 | if not path: | |
803 | raise error.RepoError(_("no repository found in '%s'" |
|
821 | raise error.RepoError(_("no repository found in '%s'" | |
804 | " (.hg not found)") |
|
822 | " (.hg not found)") | |
805 | % os.getcwd()) |
|
823 | % os.getcwd()) | |
806 | raise |
|
824 | raise | |
807 | if repo: |
|
825 | if repo: | |
808 | ui = repo.ui |
|
826 | ui = repo.ui | |
809 | if options['hidden']: |
|
827 | if options['hidden']: | |
810 | repo = repo.unfiltered() |
|
828 | repo = repo.unfiltered() | |
811 | args.insert(0, repo) |
|
829 | args.insert(0, repo) | |
812 | elif rpath: |
|
830 | elif rpath: | |
813 | ui.warn(_("warning: --repository ignored\n")) |
|
831 | ui.warn(_("warning: --repository ignored\n")) | |
814 |
|
832 | |||
815 | msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) |
|
833 | msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) | |
816 | ui.log("command", '%s\n', msg) |
|
834 | ui.log("command", '%s\n', msg) | |
817 | d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) |
|
835 | d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) | |
818 | try: |
|
836 | try: | |
819 | return runcommand(lui, repo, cmd, fullargs, ui, options, d, |
|
837 | return runcommand(lui, repo, cmd, fullargs, ui, options, d, | |
820 | cmdpats, cmdoptions) |
|
838 | cmdpats, cmdoptions) | |
821 | finally: |
|
839 | finally: | |
822 | if repo and repo != req.repo: |
|
840 | if repo and repo != req.repo: | |
823 | repo.close() |
|
841 | repo.close() | |
824 |
|
842 | |||
825 | def lsprofile(ui, func, fp): |
|
843 | def lsprofile(ui, func, fp): | |
826 | format = ui.config('profiling', 'format', default='text') |
|
844 | format = ui.config('profiling', 'format', default='text') | |
827 | field = ui.config('profiling', 'sort', default='inlinetime') |
|
845 | field = ui.config('profiling', 'sort', default='inlinetime') | |
828 | limit = ui.configint('profiling', 'limit', default=30) |
|
846 | limit = ui.configint('profiling', 'limit', default=30) | |
829 | climit = ui.configint('profiling', 'nested', default=5) |
|
847 | climit = ui.configint('profiling', 'nested', default=5) | |
830 |
|
848 | |||
831 | if format not in ['text', 'kcachegrind']: |
|
849 | if format not in ['text', 'kcachegrind']: | |
832 | ui.warn(_("unrecognized profiling format '%s'" |
|
850 | ui.warn(_("unrecognized profiling format '%s'" | |
833 | " - Ignored\n") % format) |
|
851 | " - Ignored\n") % format) | |
834 | format = 'text' |
|
852 | format = 'text' | |
835 |
|
853 | |||
836 | try: |
|
854 | try: | |
837 | from mercurial import lsprof |
|
855 | from mercurial import lsprof | |
838 | except ImportError: |
|
856 | except ImportError: | |
839 | raise util.Abort(_( |
|
857 | raise util.Abort(_( | |
840 | 'lsprof not available - install from ' |
|
858 | 'lsprof not available - install from ' | |
841 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) |
|
859 | 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) | |
842 | p = lsprof.Profiler() |
|
860 | p = lsprof.Profiler() | |
843 | p.enable(subcalls=True) |
|
861 | p.enable(subcalls=True) | |
844 | try: |
|
862 | try: | |
845 | return func() |
|
863 | return func() | |
846 | finally: |
|
864 | finally: | |
847 | p.disable() |
|
865 | p.disable() | |
848 |
|
866 | |||
849 | if format == 'kcachegrind': |
|
867 | if format == 'kcachegrind': | |
850 | import lsprofcalltree |
|
868 | import lsprofcalltree | |
851 | calltree = lsprofcalltree.KCacheGrind(p) |
|
869 | calltree = lsprofcalltree.KCacheGrind(p) | |
852 | calltree.output(fp) |
|
870 | calltree.output(fp) | |
853 | else: |
|
871 | else: | |
854 | # format == 'text' |
|
872 | # format == 'text' | |
855 | stats = lsprof.Stats(p.getstats()) |
|
873 | stats = lsprof.Stats(p.getstats()) | |
856 | stats.sort(field) |
|
874 | stats.sort(field) | |
857 | stats.pprint(limit=limit, file=fp, climit=climit) |
|
875 | stats.pprint(limit=limit, file=fp, climit=climit) | |
858 |
|
876 | |||
859 | def statprofile(ui, func, fp): |
|
877 | def statprofile(ui, func, fp): | |
860 | try: |
|
878 | try: | |
861 | import statprof |
|
879 | import statprof | |
862 | except ImportError: |
|
880 | except ImportError: | |
863 | raise util.Abort(_( |
|
881 | raise util.Abort(_( | |
864 | 'statprof not available - install using "easy_install statprof"')) |
|
882 | 'statprof not available - install using "easy_install statprof"')) | |
865 |
|
883 | |||
866 | freq = ui.configint('profiling', 'freq', default=1000) |
|
884 | freq = ui.configint('profiling', 'freq', default=1000) | |
867 | if freq > 0: |
|
885 | if freq > 0: | |
868 | statprof.reset(freq) |
|
886 | statprof.reset(freq) | |
869 | else: |
|
887 | else: | |
870 | ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq) |
|
888 | ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq) | |
871 |
|
889 | |||
872 | statprof.start() |
|
890 | statprof.start() | |
873 | try: |
|
891 | try: | |
874 | return func() |
|
892 | return func() | |
875 | finally: |
|
893 | finally: | |
876 | statprof.stop() |
|
894 | statprof.stop() | |
877 | statprof.display(fp) |
|
895 | statprof.display(fp) | |
878 |
|
896 | |||
879 | def _runcommand(ui, options, cmd, cmdfunc): |
|
897 | def _runcommand(ui, options, cmd, cmdfunc): | |
880 | def checkargs(): |
|
898 | def checkargs(): | |
881 | try: |
|
899 | try: | |
882 | return cmdfunc() |
|
900 | return cmdfunc() | |
883 | except error.SignatureError: |
|
901 | except error.SignatureError: | |
884 | raise error.CommandError(cmd, _("invalid arguments")) |
|
902 | raise error.CommandError(cmd, _("invalid arguments")) | |
885 |
|
903 | |||
886 | if options['profile']: |
|
904 | if options['profile']: | |
887 | profiler = os.getenv('HGPROF') |
|
905 | profiler = os.getenv('HGPROF') | |
888 | if profiler is None: |
|
906 | if profiler is None: | |
889 | profiler = ui.config('profiling', 'type', default='ls') |
|
907 | profiler = ui.config('profiling', 'type', default='ls') | |
890 | if profiler not in ('ls', 'stat'): |
|
908 | if profiler not in ('ls', 'stat'): | |
891 | ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler) |
|
909 | ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler) | |
892 | profiler = 'ls' |
|
910 | profiler = 'ls' | |
893 |
|
911 | |||
894 | output = ui.config('profiling', 'output') |
|
912 | output = ui.config('profiling', 'output') | |
895 |
|
913 | |||
896 | if output: |
|
914 | if output: | |
897 | path = ui.expandpath(output) |
|
915 | path = ui.expandpath(output) | |
898 | fp = open(path, 'wb') |
|
916 | fp = open(path, 'wb') | |
899 | else: |
|
917 | else: | |
900 | fp = sys.stderr |
|
918 | fp = sys.stderr | |
901 |
|
919 | |||
902 | try: |
|
920 | try: | |
903 | if profiler == 'ls': |
|
921 | if profiler == 'ls': | |
904 | return lsprofile(ui, checkargs, fp) |
|
922 | return lsprofile(ui, checkargs, fp) | |
905 | else: |
|
923 | else: | |
906 | return statprofile(ui, checkargs, fp) |
|
924 | return statprofile(ui, checkargs, fp) | |
907 | finally: |
|
925 | finally: | |
908 | if output: |
|
926 | if output: | |
909 | fp.close() |
|
927 | fp.close() | |
910 | else: |
|
928 | else: | |
911 | return checkargs() |
|
929 | return checkargs() |
@@ -1,1681 +1,1682 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 | | (All) ``<repo>/.hg/hgrc`` |
|
31 | | (All) ``<repo>/.hg/hgrc`` | |
32 |
|
32 | |||
33 | Per-repository configuration options that only apply in a |
|
33 | Per-repository configuration options that only apply in a | |
34 | particular repository. This file is not version-controlled, and |
|
34 | particular repository. This file is not version-controlled, and | |
35 | will not get transferred during a "clone" operation. Options in |
|
35 | will not get transferred during a "clone" operation. Options in | |
36 | this file override options in all other configuration files. On |
|
36 | this file override options in all other configuration files. On | |
37 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
37 | Plan 9 and Unix, most of this file will be ignored if it doesn't | |
38 | belong to a trusted user or to a trusted group. See the documentation |
|
38 | belong to a trusted user or to a trusted group. See the documentation | |
39 | for the ``[trusted]`` section below for more details. |
|
39 | for the ``[trusted]`` section below for more details. | |
40 |
|
40 | |||
41 | | (Plan 9) ``$home/lib/hgrc`` |
|
41 | | (Plan 9) ``$home/lib/hgrc`` | |
42 | | (Unix) ``$HOME/.hgrc`` |
|
42 | | (Unix) ``$HOME/.hgrc`` | |
43 | | (Windows) ``%USERPROFILE%\.hgrc`` |
|
43 | | (Windows) ``%USERPROFILE%\.hgrc`` | |
44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` |
|
44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` | |
45 | | (Windows) ``%HOME%\.hgrc`` |
|
45 | | (Windows) ``%HOME%\.hgrc`` | |
46 | | (Windows) ``%HOME%\Mercurial.ini`` |
|
46 | | (Windows) ``%HOME%\Mercurial.ini`` | |
47 |
|
47 | |||
48 | Per-user configuration file(s), for the user running Mercurial. On |
|
48 | Per-user configuration file(s), for the user running Mercurial. On | |
49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
50 | files apply to all Mercurial commands executed by this user in any |
|
50 | files apply to all Mercurial commands executed by this user in any | |
51 | directory. Options in these files override per-system and per-installation |
|
51 | directory. Options in these files override per-system and per-installation | |
52 | options. |
|
52 | options. | |
53 |
|
53 | |||
54 | | (Plan 9) ``/lib/mercurial/hgrc`` |
|
54 | | (Plan 9) ``/lib/mercurial/hgrc`` | |
55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` |
|
55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` | |
56 | | (Unix) ``/etc/mercurial/hgrc`` |
|
56 | | (Unix) ``/etc/mercurial/hgrc`` | |
57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` |
|
57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` | |
58 |
|
58 | |||
59 | Per-system configuration files, for the system on which Mercurial |
|
59 | Per-system configuration files, for the system on which Mercurial | |
60 | is running. Options in these files apply to all Mercurial commands |
|
60 | is running. Options in these files apply to all Mercurial commands | |
61 | executed by any user in any directory. Options in these files |
|
61 | executed by any user in any directory. Options in these files | |
62 | override per-installation options. |
|
62 | override per-installation options. | |
63 |
|
63 | |||
64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` |
|
64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` | |
65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` |
|
65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` | |
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` |
|
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` | |
67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` | |
68 |
|
68 | |||
69 | Per-installation configuration files, searched for in the |
|
69 | Per-installation configuration files, searched for in the | |
70 | directory where Mercurial is installed. ``<install-root>`` is the |
|
70 | directory where Mercurial is installed. ``<install-root>`` is the | |
71 | parent directory of the **hg** executable (or symlink) being run. For |
|
71 | parent directory of the **hg** executable (or symlink) being run. For | |
72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
74 | to all Mercurial commands executed by any user in any directory. |
|
74 | to all Mercurial commands executed by any user in any directory. | |
75 |
|
75 | |||
76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** |
|
76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** | |
77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** |
|
77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** | |
78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` |
|
78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` | |
79 |
|
79 | |||
80 | Per-installation/system configuration files, for the system on |
|
80 | Per-installation/system configuration files, for the system on | |
81 | which Mercurial is running. Options in these files apply to all |
|
81 | which Mercurial is running. Options in these files apply to all | |
82 | Mercurial commands executed by any user in any directory. Registry |
|
82 | Mercurial commands executed by any user in any directory. Registry | |
83 | keys contain PATH-like strings, every part of which must reference |
|
83 | keys contain PATH-like strings, every part of which must reference | |
84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
85 | be read. Mercurial checks each of these locations in the specified |
|
85 | be read. Mercurial checks each of these locations in the specified | |
86 | order until one or more configuration files are detected. |
|
86 | order until one or more configuration files are detected. | |
87 |
|
87 | |||
88 | .. note:: |
|
88 | .. note:: | |
89 |
|
89 | |||
90 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` |
|
90 | The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial`` | |
91 | is used when running 32-bit Python on 64-bit Windows. |
|
91 | is used when running 32-bit Python on 64-bit Windows. | |
92 |
|
92 | |||
93 | Syntax |
|
93 | Syntax | |
94 | ====== |
|
94 | ====== | |
95 |
|
95 | |||
96 | A configuration file consists of sections, led by a ``[section]`` header |
|
96 | A configuration file consists of sections, led by a ``[section]`` header | |
97 | and followed by ``name = value`` entries (sometimes called |
|
97 | and followed by ``name = value`` entries (sometimes called | |
98 | ``configuration keys``):: |
|
98 | ``configuration keys``):: | |
99 |
|
99 | |||
100 | [spam] |
|
100 | [spam] | |
101 | eggs=ham |
|
101 | eggs=ham | |
102 | green= |
|
102 | green= | |
103 | eggs |
|
103 | eggs | |
104 |
|
104 | |||
105 | Each line contains one entry. If the lines that follow are indented, |
|
105 | Each line contains one entry. If the lines that follow are indented, | |
106 | they are treated as continuations of that entry. Leading whitespace is |
|
106 | they are treated as continuations of that entry. Leading whitespace is | |
107 | removed from values. Empty lines are skipped. Lines beginning with |
|
107 | removed from values. Empty lines are skipped. Lines beginning with | |
108 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
108 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
109 |
|
109 | |||
110 | Configuration keys can be set multiple times, in which case Mercurial |
|
110 | Configuration keys can be set multiple times, in which case Mercurial | |
111 | will use the value that was configured last. As an example:: |
|
111 | will use the value that was configured last. As an example:: | |
112 |
|
112 | |||
113 | [spam] |
|
113 | [spam] | |
114 | eggs=large |
|
114 | eggs=large | |
115 | ham=serrano |
|
115 | ham=serrano | |
116 | eggs=small |
|
116 | eggs=small | |
117 |
|
117 | |||
118 | This would set the configuration key named ``eggs`` to ``small``. |
|
118 | This would set the configuration key named ``eggs`` to ``small``. | |
119 |
|
119 | |||
120 | It is also possible to define a section multiple times. A section can |
|
120 | It is also possible to define a section multiple times. A section can | |
121 | be redefined on the same and/or on different configuration files. For |
|
121 | be redefined on the same and/or on different configuration files. For | |
122 | example:: |
|
122 | example:: | |
123 |
|
123 | |||
124 | [foo] |
|
124 | [foo] | |
125 | eggs=large |
|
125 | eggs=large | |
126 | ham=serrano |
|
126 | ham=serrano | |
127 | eggs=small |
|
127 | eggs=small | |
128 |
|
128 | |||
129 | [bar] |
|
129 | [bar] | |
130 | eggs=ham |
|
130 | eggs=ham | |
131 | green= |
|
131 | green= | |
132 | eggs |
|
132 | eggs | |
133 |
|
133 | |||
134 | [foo] |
|
134 | [foo] | |
135 | ham=prosciutto |
|
135 | ham=prosciutto | |
136 | eggs=medium |
|
136 | eggs=medium | |
137 | bread=toasted |
|
137 | bread=toasted | |
138 |
|
138 | |||
139 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
139 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
140 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
140 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
141 | respectively. As you can see there only thing that matters is the last |
|
141 | respectively. As you can see there only thing that matters is the last | |
142 | value that was set for each of the configuration keys. |
|
142 | value that was set for each of the configuration keys. | |
143 |
|
143 | |||
144 | If a configuration key is set multiple times in different |
|
144 | If a configuration key is set multiple times in different | |
145 | configuration files the final value will depend on the order in which |
|
145 | configuration files the final value will depend on the order in which | |
146 | the different configuration files are read, with settings from earlier |
|
146 | the different configuration files are read, with settings from earlier | |
147 | paths overriding later ones as described on the ``Files`` section |
|
147 | paths overriding later ones as described on the ``Files`` section | |
148 | above. |
|
148 | above. | |
149 |
|
149 | |||
150 | A line of the form ``%include file`` will include ``file`` into the |
|
150 | A line of the form ``%include file`` will include ``file`` into the | |
151 | current configuration file. The inclusion is recursive, which means |
|
151 | current configuration file. The inclusion is recursive, which means | |
152 | that included files can include other files. Filenames are relative to |
|
152 | that included files can include other files. Filenames are relative to | |
153 | the configuration file in which the ``%include`` directive is found. |
|
153 | the configuration file in which the ``%include`` directive is found. | |
154 | Environment variables and ``~user`` constructs are expanded in |
|
154 | Environment variables and ``~user`` constructs are expanded in | |
155 | ``file``. This lets you do something like:: |
|
155 | ``file``. This lets you do something like:: | |
156 |
|
156 | |||
157 | %include ~/.hgrc.d/$HOST.rc |
|
157 | %include ~/.hgrc.d/$HOST.rc | |
158 |
|
158 | |||
159 | to include a different configuration file on each computer you use. |
|
159 | to include a different configuration file on each computer you use. | |
160 |
|
160 | |||
161 | A line with ``%unset name`` will remove ``name`` from the current |
|
161 | A line with ``%unset name`` will remove ``name`` from the current | |
162 | section, if it has been set previously. |
|
162 | section, if it has been set previously. | |
163 |
|
163 | |||
164 | The values are either free-form text strings, lists of text strings, |
|
164 | The values are either free-form text strings, lists of text strings, | |
165 | or Boolean values. Boolean values can be set to true using any of "1", |
|
165 | or Boolean values. Boolean values can be set to true using any of "1", | |
166 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
166 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
167 | (all case insensitive). |
|
167 | (all case insensitive). | |
168 |
|
168 | |||
169 | List values are separated by whitespace or comma, except when values are |
|
169 | List values are separated by whitespace or comma, except when values are | |
170 | placed in double quotation marks:: |
|
170 | placed in double quotation marks:: | |
171 |
|
171 | |||
172 | allow_read = "John Doe, PhD", brian, betty |
|
172 | allow_read = "John Doe, PhD", brian, betty | |
173 |
|
173 | |||
174 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
174 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
175 | quotation marks at the beginning of a word is counted as a quotation |
|
175 | quotation marks at the beginning of a word is counted as a quotation | |
176 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
176 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
177 |
|
177 | |||
178 | Sections |
|
178 | Sections | |
179 | ======== |
|
179 | ======== | |
180 |
|
180 | |||
181 | This section describes the different sections that may appear in a |
|
181 | This section describes the different sections that may appear in a | |
182 | Mercurial configuration file, the purpose of each section, its possible |
|
182 | Mercurial configuration file, the purpose of each section, its possible | |
183 | keys, and their possible values. |
|
183 | keys, and their possible values. | |
184 |
|
184 | |||
185 | ``alias`` |
|
185 | ``alias`` | |
186 | --------- |
|
186 | --------- | |
187 |
|
187 | |||
188 | Defines command aliases. |
|
188 | Defines command aliases. | |
189 | Aliases allow you to define your own commands in terms of other |
|
189 | Aliases allow you to define your own commands in terms of other | |
190 | commands (or aliases), optionally including arguments. Positional |
|
190 | commands (or aliases), optionally including arguments. Positional | |
191 | arguments in the form of ``$1``, ``$2``, etc in the alias definition |
|
191 | arguments in the form of ``$1``, ``$2``, etc in the alias definition | |
192 | are expanded by Mercurial before execution. Positional arguments not |
|
192 | are expanded by Mercurial before execution. Positional arguments not | |
193 | already used by ``$N`` in the definition are put at the end of the |
|
193 | already used by ``$N`` in the definition are put at the end of the | |
194 | command to be executed. |
|
194 | command to be executed. | |
195 |
|
195 | |||
196 | Alias definitions consist of lines of the form:: |
|
196 | Alias definitions consist of lines of the form:: | |
197 |
|
197 | |||
198 | <alias> = <command> [<argument>]... |
|
198 | <alias> = <command> [<argument>]... | |
199 |
|
199 | |||
200 | For example, this definition:: |
|
200 | For example, this definition:: | |
201 |
|
201 | |||
202 | latest = log --limit 5 |
|
202 | latest = log --limit 5 | |
203 |
|
203 | |||
204 | creates a new command ``latest`` that shows only the five most recent |
|
204 | creates a new command ``latest`` that shows only the five most recent | |
205 | changesets. You can define subsequent aliases using earlier ones:: |
|
205 | changesets. You can define subsequent aliases using earlier ones:: | |
206 |
|
206 | |||
207 | stable5 = latest -b stable |
|
207 | stable5 = latest -b stable | |
208 |
|
208 | |||
209 | .. note:: |
|
209 | .. note:: | |
210 |
|
210 | |||
211 | It is possible to create aliases with the same names as |
|
211 | It is possible to create aliases with the same names as | |
212 | existing commands, which will then override the original |
|
212 | existing commands, which will then override the original | |
213 | definitions. This is almost always a bad idea! |
|
213 | definitions. This is almost always a bad idea! | |
214 |
|
214 | |||
215 | An alias can start with an exclamation point (``!``) to make it a |
|
215 | An alias can start with an exclamation point (``!``) to make it a | |
216 | shell alias. A shell alias is executed with the shell and will let you |
|
216 | shell alias. A shell alias is executed with the shell and will let you | |
217 | run arbitrary commands. As an example, :: |
|
217 | run arbitrary commands. As an example, :: | |
218 |
|
218 | |||
219 | echo = !echo $@ |
|
219 | echo = !echo $@ | |
220 |
|
220 | |||
221 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
221 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
222 | terminal. A better example might be:: |
|
222 | terminal. A better example might be:: | |
223 |
|
223 | |||
224 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
224 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm | |
225 |
|
225 | |||
226 | which will make ``hg purge`` delete all unknown files in the |
|
226 | which will make ``hg purge`` delete all unknown files in the | |
227 | repository in the same manner as the purge extension. |
|
227 | repository in the same manner as the purge extension. | |
228 |
|
228 | |||
229 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
229 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
230 | expand to the command arguments. Unmatched arguments are |
|
230 | expand to the command arguments. Unmatched arguments are | |
231 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
231 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
232 |
arguments separated by a space. |
|
232 | arguments separated by a space. ``"$@"`` (with quotes) expands to all | |
233 | command is passed to the shell. |
|
233 | arguments quoted individually and separated by a space. These expansions | |
|
234 | happen before the command is passed to the shell. | |||
234 |
|
235 | |||
235 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
236 | Shell aliases are executed in an environment where ``$HG`` expands to | |
236 | the path of the Mercurial that was used to execute the alias. This is |
|
237 | the path of the Mercurial that was used to execute the alias. This is | |
237 | useful when you want to call further Mercurial commands in a shell |
|
238 | useful when you want to call further Mercurial commands in a shell | |
238 | alias, as was done above for the purge alias. In addition, |
|
239 | alias, as was done above for the purge alias. In addition, | |
239 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
240 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
240 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
241 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
241 |
|
242 | |||
242 | .. note:: |
|
243 | .. note:: | |
243 |
|
244 | |||
244 | Some global configuration options such as ``-R`` are |
|
245 | Some global configuration options such as ``-R`` are | |
245 | processed before shell aliases and will thus not be passed to |
|
246 | processed before shell aliases and will thus not be passed to | |
246 | aliases. |
|
247 | aliases. | |
247 |
|
248 | |||
248 |
|
249 | |||
249 | ``annotate`` |
|
250 | ``annotate`` | |
250 | ------------ |
|
251 | ------------ | |
251 |
|
252 | |||
252 | Settings used when displaying file annotations. All values are |
|
253 | Settings used when displaying file annotations. All values are | |
253 | Booleans and default to False. See ``diff`` section for related |
|
254 | Booleans and default to False. See ``diff`` section for related | |
254 | options for the diff command. |
|
255 | options for the diff command. | |
255 |
|
256 | |||
256 | ``ignorews`` |
|
257 | ``ignorews`` | |
257 | Ignore white space when comparing lines. |
|
258 | Ignore white space when comparing lines. | |
258 |
|
259 | |||
259 | ``ignorewsamount`` |
|
260 | ``ignorewsamount`` | |
260 | Ignore changes in the amount of white space. |
|
261 | Ignore changes in the amount of white space. | |
261 |
|
262 | |||
262 | ``ignoreblanklines`` |
|
263 | ``ignoreblanklines`` | |
263 | Ignore changes whose lines are all blank. |
|
264 | Ignore changes whose lines are all blank. | |
264 |
|
265 | |||
265 |
|
266 | |||
266 | ``auth`` |
|
267 | ``auth`` | |
267 | -------- |
|
268 | -------- | |
268 |
|
269 | |||
269 | Authentication credentials for HTTP authentication. This section |
|
270 | Authentication credentials for HTTP authentication. This section | |
270 | allows you to store usernames and passwords for use when logging |
|
271 | allows you to store usernames and passwords for use when logging | |
271 | *into* HTTP servers. See the ``[web]`` configuration section if |
|
272 | *into* HTTP servers. See the ``[web]`` configuration section if | |
272 | you want to configure *who* can login to your HTTP server. |
|
273 | you want to configure *who* can login to your HTTP server. | |
273 |
|
274 | |||
274 | Each line has the following format:: |
|
275 | Each line has the following format:: | |
275 |
|
276 | |||
276 | <name>.<argument> = <value> |
|
277 | <name>.<argument> = <value> | |
277 |
|
278 | |||
278 | where ``<name>`` is used to group arguments into authentication |
|
279 | where ``<name>`` is used to group arguments into authentication | |
279 | entries. Example:: |
|
280 | entries. Example:: | |
280 |
|
281 | |||
281 | foo.prefix = hg.intevation.org/mercurial |
|
282 | foo.prefix = hg.intevation.org/mercurial | |
282 | foo.username = foo |
|
283 | foo.username = foo | |
283 | foo.password = bar |
|
284 | foo.password = bar | |
284 | foo.schemes = http https |
|
285 | foo.schemes = http https | |
285 |
|
286 | |||
286 | bar.prefix = secure.example.org |
|
287 | bar.prefix = secure.example.org | |
287 | bar.key = path/to/file.key |
|
288 | bar.key = path/to/file.key | |
288 | bar.cert = path/to/file.cert |
|
289 | bar.cert = path/to/file.cert | |
289 | bar.schemes = https |
|
290 | bar.schemes = https | |
290 |
|
291 | |||
291 | Supported arguments: |
|
292 | Supported arguments: | |
292 |
|
293 | |||
293 | ``prefix`` |
|
294 | ``prefix`` | |
294 | Either ``*`` or a URI prefix with or without the scheme part. |
|
295 | Either ``*`` or a URI prefix with or without the scheme part. | |
295 | The authentication entry with the longest matching prefix is used |
|
296 | The authentication entry with the longest matching prefix is used | |
296 | (where ``*`` matches everything and counts as a match of length |
|
297 | (where ``*`` matches everything and counts as a match of length | |
297 | 1). If the prefix doesn't include a scheme, the match is performed |
|
298 | 1). If the prefix doesn't include a scheme, the match is performed | |
298 | against the URI with its scheme stripped as well, and the schemes |
|
299 | against the URI with its scheme stripped as well, and the schemes | |
299 | argument, q.v., is then subsequently consulted. |
|
300 | argument, q.v., is then subsequently consulted. | |
300 |
|
301 | |||
301 | ``username`` |
|
302 | ``username`` | |
302 | Optional. Username to authenticate with. If not given, and the |
|
303 | Optional. Username to authenticate with. If not given, and the | |
303 | remote site requires basic or digest authentication, the user will |
|
304 | remote site requires basic or digest authentication, the user will | |
304 | be prompted for it. Environment variables are expanded in the |
|
305 | be prompted for it. Environment variables are expanded in the | |
305 | username letting you do ``foo.username = $USER``. If the URI |
|
306 | username letting you do ``foo.username = $USER``. If the URI | |
306 | includes a username, only ``[auth]`` entries with a matching |
|
307 | includes a username, only ``[auth]`` entries with a matching | |
307 | username or without a username will be considered. |
|
308 | username or without a username will be considered. | |
308 |
|
309 | |||
309 | ``password`` |
|
310 | ``password`` | |
310 | Optional. Password to authenticate with. If not given, and the |
|
311 | Optional. Password to authenticate with. If not given, and the | |
311 | remote site requires basic or digest authentication, the user |
|
312 | remote site requires basic or digest authentication, the user | |
312 | will be prompted for it. |
|
313 | will be prompted for it. | |
313 |
|
314 | |||
314 | ``key`` |
|
315 | ``key`` | |
315 | Optional. PEM encoded client certificate key file. Environment |
|
316 | Optional. PEM encoded client certificate key file. Environment | |
316 | variables are expanded in the filename. |
|
317 | variables are expanded in the filename. | |
317 |
|
318 | |||
318 | ``cert`` |
|
319 | ``cert`` | |
319 | Optional. PEM encoded client certificate chain file. Environment |
|
320 | Optional. PEM encoded client certificate chain file. Environment | |
320 | variables are expanded in the filename. |
|
321 | variables are expanded in the filename. | |
321 |
|
322 | |||
322 | ``schemes`` |
|
323 | ``schemes`` | |
323 | Optional. Space separated list of URI schemes to use this |
|
324 | Optional. Space separated list of URI schemes to use this | |
324 | authentication entry with. Only used if the prefix doesn't include |
|
325 | authentication entry with. Only used if the prefix doesn't include | |
325 | a scheme. Supported schemes are http and https. They will match |
|
326 | a scheme. Supported schemes are http and https. They will match | |
326 | static-http and static-https respectively, as well. |
|
327 | static-http and static-https respectively, as well. | |
327 | Default: https. |
|
328 | Default: https. | |
328 |
|
329 | |||
329 | If no suitable authentication entry is found, the user is prompted |
|
330 | If no suitable authentication entry is found, the user is prompted | |
330 | for credentials as usual if required by the remote. |
|
331 | for credentials as usual if required by the remote. | |
331 |
|
332 | |||
332 |
|
333 | |||
333 | ``committemplate`` |
|
334 | ``committemplate`` | |
334 | ------------------ |
|
335 | ------------------ | |
335 |
|
336 | |||
336 | ``changeset`` configuration in this section is used as the template to |
|
337 | ``changeset`` configuration in this section is used as the template to | |
337 | customize the text shown in the editor when committing. |
|
338 | customize the text shown in the editor when committing. | |
338 |
|
339 | |||
339 | In addition to pre-defined template keywords, commit log specific one |
|
340 | In addition to pre-defined template keywords, commit log specific one | |
340 | below can be used for customization: |
|
341 | below can be used for customization: | |
341 |
|
342 | |||
342 | ``extramsg`` |
|
343 | ``extramsg`` | |
343 | String: Extra message (typically 'Leave message empty to abort |
|
344 | String: Extra message (typically 'Leave message empty to abort | |
344 | commit.'). This may be changed by some commands or extensions. |
|
345 | commit.'). This may be changed by some commands or extensions. | |
345 |
|
346 | |||
346 | For example, the template configuration below shows as same text as |
|
347 | For example, the template configuration below shows as same text as | |
347 | one shown by default:: |
|
348 | one shown by default:: | |
348 |
|
349 | |||
349 | [committemplate] |
|
350 | [committemplate] | |
350 | changeset = {desc}\n\n |
|
351 | changeset = {desc}\n\n | |
351 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
352 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
352 | HG: {extramsg} |
|
353 | HG: {extramsg} | |
353 | HG: -- |
|
354 | HG: -- | |
354 | HG: user: {author}\n{ifeq(p2rev, "-1", "", |
|
355 | HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
355 | "HG: branch merge\n") |
|
356 | "HG: branch merge\n") | |
356 | }HG: branch '{branch}'\n{if(currentbookmark, |
|
357 | }HG: branch '{branch}'\n{if(currentbookmark, | |
357 | "HG: bookmark '{currentbookmark}'\n") }{subrepos % |
|
358 | "HG: bookmark '{currentbookmark}'\n") }{subrepos % | |
358 | "HG: subrepo {subrepo}\n" }{file_adds % |
|
359 | "HG: subrepo {subrepo}\n" }{file_adds % | |
359 | "HG: added {file}\n" }{file_mods % |
|
360 | "HG: added {file}\n" }{file_mods % | |
360 | "HG: changed {file}\n" }{file_dels % |
|
361 | "HG: changed {file}\n" }{file_dels % | |
361 | "HG: removed {file}\n" }{if(files, "", |
|
362 | "HG: removed {file}\n" }{if(files, "", | |
362 | "HG: no files changed\n")} |
|
363 | "HG: no files changed\n")} | |
363 |
|
364 | |||
364 | .. note:: |
|
365 | .. note:: | |
365 |
|
366 | |||
366 | For some problematic encodings (see :hg:`help win32mbcs` for |
|
367 | For some problematic encodings (see :hg:`help win32mbcs` for | |
367 | detail), this customization should be configured carefully, to |
|
368 | detail), this customization should be configured carefully, to | |
368 | avoid showing broken characters. |
|
369 | avoid showing broken characters. | |
369 |
|
370 | |||
370 | For example, if multibyte character ending with backslash (0x5c) is |
|
371 | For example, if multibyte character ending with backslash (0x5c) is | |
371 | followed by ASCII character 'n' in the customized template, |
|
372 | followed by ASCII character 'n' in the customized template, | |
372 | sequence of backslash and 'n' is treated as line-feed unexpectedly |
|
373 | sequence of backslash and 'n' is treated as line-feed unexpectedly | |
373 | (and multibyte character is broken, too). |
|
374 | (and multibyte character is broken, too). | |
374 |
|
375 | |||
375 | Customized template is used for commands below (``--edit`` may be |
|
376 | Customized template is used for commands below (``--edit`` may be | |
376 | required): |
|
377 | required): | |
377 |
|
378 | |||
378 | - :hg:`backout` |
|
379 | - :hg:`backout` | |
379 | - :hg:`commit` |
|
380 | - :hg:`commit` | |
380 | - :hg:`fetch` (for merge commit only) |
|
381 | - :hg:`fetch` (for merge commit only) | |
381 | - :hg:`graft` |
|
382 | - :hg:`graft` | |
382 | - :hg:`histedit` |
|
383 | - :hg:`histedit` | |
383 | - :hg:`import` |
|
384 | - :hg:`import` | |
384 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` |
|
385 | - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh` | |
385 | - :hg:`rebase` |
|
386 | - :hg:`rebase` | |
386 | - :hg:`shelve` |
|
387 | - :hg:`shelve` | |
387 | - :hg:`sign` |
|
388 | - :hg:`sign` | |
388 | - :hg:`tag` |
|
389 | - :hg:`tag` | |
389 | - :hg:`transplant` |
|
390 | - :hg:`transplant` | |
390 |
|
391 | |||
391 | Configuring items below instead of ``changeset`` allows showing |
|
392 | Configuring items below instead of ``changeset`` allows showing | |
392 | customized message only for specific actions, or showing different |
|
393 | customized message only for specific actions, or showing different | |
393 | messages for each actions. |
|
394 | messages for each actions. | |
394 |
|
395 | |||
395 | - ``changeset.backout`` for :hg:`backout` |
|
396 | - ``changeset.backout`` for :hg:`backout` | |
396 | - ``changeset.commit.amend`` for :hg:`commit --amend` |
|
397 | - ``changeset.commit.amend`` for :hg:`commit --amend` | |
397 | - ``changeset.commit.normal`` for :hg:`commit` without ``--amend`` |
|
398 | - ``changeset.commit.normal`` for :hg:`commit` without ``--amend`` | |
398 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) |
|
399 | - ``changeset.fetch`` for :hg:`fetch` (impling merge commit) | |
399 | - ``changeset.gpg.sign`` for :hg:`sign` |
|
400 | - ``changeset.gpg.sign`` for :hg:`sign` | |
400 | - ``changeset.graft`` for :hg:`graft` |
|
401 | - ``changeset.graft`` for :hg:`graft` | |
401 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` |
|
402 | - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit` | |
402 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` |
|
403 | - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit` | |
403 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` |
|
404 | - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit` | |
404 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` |
|
405 | - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit` | |
405 | - ``changeset.import.bypass`` for :hg:`import --bypass` |
|
406 | - ``changeset.import.bypass`` for :hg:`import --bypass` | |
406 | - ``changeset.import.normal`` for :hg:`import` without ``--bypass`` |
|
407 | - ``changeset.import.normal`` for :hg:`import` without ``--bypass`` | |
407 | - ``changeset.mq.qnew`` for :hg:`qnew` |
|
408 | - ``changeset.mq.qnew`` for :hg:`qnew` | |
408 | - ``changeset.mq.qfold`` for :hg:`qfold` |
|
409 | - ``changeset.mq.qfold`` for :hg:`qfold` | |
409 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` |
|
410 | - ``changeset.mq.qrefresh`` for :hg:`qrefresh` | |
410 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` |
|
411 | - ``changeset.rebase.collapse`` for :hg:`rebase --collapse` | |
411 | - ``changeset.rebase.normal`` for :hg:`rebase` without ``--collapse`` |
|
412 | - ``changeset.rebase.normal`` for :hg:`rebase` without ``--collapse`` | |
412 | - ``changeset.shelve.shelve`` for :hg:`shelve` |
|
413 | - ``changeset.shelve.shelve`` for :hg:`shelve` | |
413 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` |
|
414 | - ``changeset.tag.add`` for :hg:`tag` without ``--remove`` | |
414 | - ``changeset.tag.remove`` for :hg:`tag --remove` |
|
415 | - ``changeset.tag.remove`` for :hg:`tag --remove` | |
415 | - ``changeset.transplant`` for :hg:`transplant` |
|
416 | - ``changeset.transplant`` for :hg:`transplant` | |
416 |
|
417 | |||
417 | These dot-separated lists of names are treated as hierarchical ones. |
|
418 | These dot-separated lists of names are treated as hierarchical ones. | |
418 | For example, ``changeset.tag.remove`` customizes the commit message |
|
419 | For example, ``changeset.tag.remove`` customizes the commit message | |
419 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the |
|
420 | only for :hg:`tag --remove`, but ``changeset.tag`` customizes the | |
420 | commit message for :hg:`tag` regardless of ``--remove`` option. |
|
421 | commit message for :hg:`tag` regardless of ``--remove`` option. | |
421 |
|
422 | |||
422 | In this section, items other than ``changeset`` can be referred from |
|
423 | In this section, items other than ``changeset`` can be referred from | |
423 | others. For example, the configuration to list committed files up |
|
424 | others. For example, the configuration to list committed files up | |
424 | below can be referred as ``{listupfiles}``:: |
|
425 | below can be referred as ``{listupfiles}``:: | |
425 |
|
426 | |||
426 | [committemplate] |
|
427 | [committemplate] | |
427 | listupfiles = {file_adds % |
|
428 | listupfiles = {file_adds % | |
428 | "HG: added {file}\n" }{file_mods % |
|
429 | "HG: added {file}\n" }{file_mods % | |
429 | "HG: changed {file}\n" }{file_dels % |
|
430 | "HG: changed {file}\n" }{file_dels % | |
430 | "HG: removed {file}\n" }{if(files, "", |
|
431 | "HG: removed {file}\n" }{if(files, "", | |
431 | "HG: no files changed\n")} |
|
432 | "HG: no files changed\n")} | |
432 |
|
433 | |||
433 | ``decode/encode`` |
|
434 | ``decode/encode`` | |
434 | ----------------- |
|
435 | ----------------- | |
435 |
|
436 | |||
436 | Filters for transforming files on checkout/checkin. This would |
|
437 | Filters for transforming files on checkout/checkin. This would | |
437 | typically be used for newline processing or other |
|
438 | typically be used for newline processing or other | |
438 | localization/canonicalization of files. |
|
439 | localization/canonicalization of files. | |
439 |
|
440 | |||
440 | Filters consist of a filter pattern followed by a filter command. |
|
441 | Filters consist of a filter pattern followed by a filter command. | |
441 | Filter patterns are globs by default, rooted at the repository root. |
|
442 | Filter patterns are globs by default, rooted at the repository root. | |
442 | For example, to match any file ending in ``.txt`` in the root |
|
443 | For example, to match any file ending in ``.txt`` in the root | |
443 | directory only, use the pattern ``*.txt``. To match any file ending |
|
444 | directory only, use the pattern ``*.txt``. To match any file ending | |
444 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
445 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
445 | For each file only the first matching filter applies. |
|
446 | For each file only the first matching filter applies. | |
446 |
|
447 | |||
447 | The filter command can start with a specifier, either ``pipe:`` or |
|
448 | The filter command can start with a specifier, either ``pipe:`` or | |
448 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
449 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
449 |
|
450 | |||
450 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
451 | A ``pipe:`` command must accept data on stdin and return the transformed | |
451 | data on stdout. |
|
452 | data on stdout. | |
452 |
|
453 | |||
453 | Pipe example:: |
|
454 | Pipe example:: | |
454 |
|
455 | |||
455 | [encode] |
|
456 | [encode] | |
456 | # uncompress gzip files on checkin to improve delta compression |
|
457 | # uncompress gzip files on checkin to improve delta compression | |
457 | # note: not necessarily a good idea, just an example |
|
458 | # note: not necessarily a good idea, just an example | |
458 | *.gz = pipe: gunzip |
|
459 | *.gz = pipe: gunzip | |
459 |
|
460 | |||
460 | [decode] |
|
461 | [decode] | |
461 | # recompress gzip files when writing them to the working dir (we |
|
462 | # recompress gzip files when writing them to the working dir (we | |
462 | # can safely omit "pipe:", because it's the default) |
|
463 | # can safely omit "pipe:", because it's the default) | |
463 | *.gz = gzip |
|
464 | *.gz = gzip | |
464 |
|
465 | |||
465 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
466 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
466 | with the name of a temporary file that contains the data to be |
|
467 | with the name of a temporary file that contains the data to be | |
467 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
468 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
468 | of an empty temporary file, where the filtered data must be written by |
|
469 | of an empty temporary file, where the filtered data must be written by | |
469 | the command. |
|
470 | the command. | |
470 |
|
471 | |||
471 | .. note:: |
|
472 | .. note:: | |
472 |
|
473 | |||
473 | The tempfile mechanism is recommended for Windows systems, |
|
474 | The tempfile mechanism is recommended for Windows systems, | |
474 | where the standard shell I/O redirection operators often have |
|
475 | where the standard shell I/O redirection operators often have | |
475 | strange effects and may corrupt the contents of your files. |
|
476 | strange effects and may corrupt the contents of your files. | |
476 |
|
477 | |||
477 | This filter mechanism is used internally by the ``eol`` extension to |
|
478 | This filter mechanism is used internally by the ``eol`` extension to | |
478 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
479 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
479 | format. We suggest you use the ``eol`` extension for convenience. |
|
480 | format. We suggest you use the ``eol`` extension for convenience. | |
480 |
|
481 | |||
481 |
|
482 | |||
482 | ``defaults`` |
|
483 | ``defaults`` | |
483 | ------------ |
|
484 | ------------ | |
484 |
|
485 | |||
485 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
486 | (defaults are deprecated. Don't use them. Use aliases instead) | |
486 |
|
487 | |||
487 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
488 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
488 | default options/arguments to pass to the specified commands. |
|
489 | default options/arguments to pass to the specified commands. | |
489 |
|
490 | |||
490 | The following example makes :hg:`log` run in verbose mode, and |
|
491 | The following example makes :hg:`log` run in verbose mode, and | |
491 | :hg:`status` show only the modified files, by default:: |
|
492 | :hg:`status` show only the modified files, by default:: | |
492 |
|
493 | |||
493 | [defaults] |
|
494 | [defaults] | |
494 | log = -v |
|
495 | log = -v | |
495 | status = -m |
|
496 | status = -m | |
496 |
|
497 | |||
497 | The actual commands, instead of their aliases, must be used when |
|
498 | The actual commands, instead of their aliases, must be used when | |
498 | defining command defaults. The command defaults will also be applied |
|
499 | defining command defaults. The command defaults will also be applied | |
499 | to the aliases of the commands defined. |
|
500 | to the aliases of the commands defined. | |
500 |
|
501 | |||
501 |
|
502 | |||
502 | ``diff`` |
|
503 | ``diff`` | |
503 | -------- |
|
504 | -------- | |
504 |
|
505 | |||
505 | Settings used when displaying diffs. Everything except for ``unified`` |
|
506 | Settings used when displaying diffs. Everything except for ``unified`` | |
506 | is a Boolean and defaults to False. See ``annotate`` section for |
|
507 | is a Boolean and defaults to False. See ``annotate`` section for | |
507 | related options for the annotate command. |
|
508 | related options for the annotate command. | |
508 |
|
509 | |||
509 | ``git`` |
|
510 | ``git`` | |
510 | Use git extended diff format. |
|
511 | Use git extended diff format. | |
511 |
|
512 | |||
512 | ``nodates`` |
|
513 | ``nodates`` | |
513 | Don't include dates in diff headers. |
|
514 | Don't include dates in diff headers. | |
514 |
|
515 | |||
515 | ``showfunc`` |
|
516 | ``showfunc`` | |
516 | Show which function each change is in. |
|
517 | Show which function each change is in. | |
517 |
|
518 | |||
518 | ``ignorews`` |
|
519 | ``ignorews`` | |
519 | Ignore white space when comparing lines. |
|
520 | Ignore white space when comparing lines. | |
520 |
|
521 | |||
521 | ``ignorewsamount`` |
|
522 | ``ignorewsamount`` | |
522 | Ignore changes in the amount of white space. |
|
523 | Ignore changes in the amount of white space. | |
523 |
|
524 | |||
524 | ``ignoreblanklines`` |
|
525 | ``ignoreblanklines`` | |
525 | Ignore changes whose lines are all blank. |
|
526 | Ignore changes whose lines are all blank. | |
526 |
|
527 | |||
527 | ``unified`` |
|
528 | ``unified`` | |
528 | Number of lines of context to show. |
|
529 | Number of lines of context to show. | |
529 |
|
530 | |||
530 | ``email`` |
|
531 | ``email`` | |
531 | --------- |
|
532 | --------- | |
532 |
|
533 | |||
533 | Settings for extensions that send email messages. |
|
534 | Settings for extensions that send email messages. | |
534 |
|
535 | |||
535 | ``from`` |
|
536 | ``from`` | |
536 | Optional. Email address to use in "From" header and SMTP envelope |
|
537 | Optional. Email address to use in "From" header and SMTP envelope | |
537 | of outgoing messages. |
|
538 | of outgoing messages. | |
538 |
|
539 | |||
539 | ``to`` |
|
540 | ``to`` | |
540 | Optional. Comma-separated list of recipients' email addresses. |
|
541 | Optional. Comma-separated list of recipients' email addresses. | |
541 |
|
542 | |||
542 | ``cc`` |
|
543 | ``cc`` | |
543 | Optional. Comma-separated list of carbon copy recipients' |
|
544 | Optional. Comma-separated list of carbon copy recipients' | |
544 | email addresses. |
|
545 | email addresses. | |
545 |
|
546 | |||
546 | ``bcc`` |
|
547 | ``bcc`` | |
547 | Optional. Comma-separated list of blind carbon copy recipients' |
|
548 | Optional. Comma-separated list of blind carbon copy recipients' | |
548 | email addresses. |
|
549 | email addresses. | |
549 |
|
550 | |||
550 | ``method`` |
|
551 | ``method`` | |
551 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
552 | Optional. Method to use to send email messages. If value is ``smtp`` | |
552 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
553 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
553 | Otherwise, use as name of program to run that acts like sendmail |
|
554 | Otherwise, use as name of program to run that acts like sendmail | |
554 | (takes ``-f`` option for sender, list of recipients on command line, |
|
555 | (takes ``-f`` option for sender, list of recipients on command line, | |
555 | message on stdin). Normally, setting this to ``sendmail`` or |
|
556 | message on stdin). Normally, setting this to ``sendmail`` or | |
556 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
557 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
557 |
|
558 | |||
558 | ``charsets`` |
|
559 | ``charsets`` | |
559 | Optional. Comma-separated list of character sets considered |
|
560 | Optional. Comma-separated list of character sets considered | |
560 | convenient for recipients. Addresses, headers, and parts not |
|
561 | convenient for recipients. Addresses, headers, and parts not | |
561 | containing patches of outgoing messages will be encoded in the |
|
562 | containing patches of outgoing messages will be encoded in the | |
562 | first character set to which conversion from local encoding |
|
563 | first character set to which conversion from local encoding | |
563 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
564 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
564 | conversion fails, the text in question is sent as is. Defaults to |
|
565 | conversion fails, the text in question is sent as is. Defaults to | |
565 | empty (explicit) list. |
|
566 | empty (explicit) list. | |
566 |
|
567 | |||
567 | Order of outgoing email character sets: |
|
568 | Order of outgoing email character sets: | |
568 |
|
569 | |||
569 | 1. ``us-ascii``: always first, regardless of settings |
|
570 | 1. ``us-ascii``: always first, regardless of settings | |
570 | 2. ``email.charsets``: in order given by user |
|
571 | 2. ``email.charsets``: in order given by user | |
571 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
572 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
572 | 4. ``$HGENCODING``: if not in email.charsets |
|
573 | 4. ``$HGENCODING``: if not in email.charsets | |
573 | 5. ``utf-8``: always last, regardless of settings |
|
574 | 5. ``utf-8``: always last, regardless of settings | |
574 |
|
575 | |||
575 | Email example:: |
|
576 | Email example:: | |
576 |
|
577 | |||
577 | [email] |
|
578 | [email] | |
578 | from = Joseph User <joe.user@example.com> |
|
579 | from = Joseph User <joe.user@example.com> | |
579 | method = /usr/sbin/sendmail |
|
580 | method = /usr/sbin/sendmail | |
580 | # charsets for western Europeans |
|
581 | # charsets for western Europeans | |
581 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
582 | # us-ascii, utf-8 omitted, as they are tried first and last | |
582 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
583 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
583 |
|
584 | |||
584 |
|
585 | |||
585 | ``extensions`` |
|
586 | ``extensions`` | |
586 | -------------- |
|
587 | -------------- | |
587 |
|
588 | |||
588 | Mercurial has an extension mechanism for adding new features. To |
|
589 | Mercurial has an extension mechanism for adding new features. To | |
589 | enable an extension, create an entry for it in this section. |
|
590 | enable an extension, create an entry for it in this section. | |
590 |
|
591 | |||
591 | If you know that the extension is already in Python's search path, |
|
592 | If you know that the extension is already in Python's search path, | |
592 | you can give the name of the module, followed by ``=``, with nothing |
|
593 | you can give the name of the module, followed by ``=``, with nothing | |
593 | after the ``=``. |
|
594 | after the ``=``. | |
594 |
|
595 | |||
595 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
596 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
596 | the path to the ``.py`` file (including the file name extension) that |
|
597 | the path to the ``.py`` file (including the file name extension) that | |
597 | defines the extension. |
|
598 | defines the extension. | |
598 |
|
599 | |||
599 | To explicitly disable an extension that is enabled in an hgrc of |
|
600 | To explicitly disable an extension that is enabled in an hgrc of | |
600 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
601 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
601 | or ``foo = !`` when path is not supplied. |
|
602 | or ``foo = !`` when path is not supplied. | |
602 |
|
603 | |||
603 | Example for ``~/.hgrc``:: |
|
604 | Example for ``~/.hgrc``:: | |
604 |
|
605 | |||
605 | [extensions] |
|
606 | [extensions] | |
606 | # (the progress extension will get loaded from Mercurial's path) |
|
607 | # (the progress extension will get loaded from Mercurial's path) | |
607 | progress = |
|
608 | progress = | |
608 | # (this extension will get loaded from the file specified) |
|
609 | # (this extension will get loaded from the file specified) | |
609 | myfeature = ~/.hgext/myfeature.py |
|
610 | myfeature = ~/.hgext/myfeature.py | |
610 |
|
611 | |||
611 |
|
612 | |||
612 | ``format`` |
|
613 | ``format`` | |
613 | ---------- |
|
614 | ---------- | |
614 |
|
615 | |||
615 | ``usestore`` |
|
616 | ``usestore`` | |
616 | Enable or disable the "store" repository format which improves |
|
617 | Enable or disable the "store" repository format which improves | |
617 | compatibility with systems that fold case or otherwise mangle |
|
618 | compatibility with systems that fold case or otherwise mangle | |
618 | filenames. Enabled by default. Disabling this option will allow |
|
619 | filenames. Enabled by default. Disabling this option will allow | |
619 | you to store longer filenames in some situations at the expense of |
|
620 | you to store longer filenames in some situations at the expense of | |
620 | compatibility and ensures that the on-disk format of newly created |
|
621 | compatibility and ensures that the on-disk format of newly created | |
621 | repositories will be compatible with Mercurial before version 0.9.4. |
|
622 | repositories will be compatible with Mercurial before version 0.9.4. | |
622 |
|
623 | |||
623 | ``usefncache`` |
|
624 | ``usefncache`` | |
624 | Enable or disable the "fncache" repository format which enhances |
|
625 | Enable or disable the "fncache" repository format which enhances | |
625 | the "store" repository format (which has to be enabled to use |
|
626 | the "store" repository format (which has to be enabled to use | |
626 | fncache) to allow longer filenames and avoids using Windows |
|
627 | fncache) to allow longer filenames and avoids using Windows | |
627 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
628 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
628 | option ensures that the on-disk format of newly created |
|
629 | option ensures that the on-disk format of newly created | |
629 | repositories will be compatible with Mercurial before version 1.1. |
|
630 | repositories will be compatible with Mercurial before version 1.1. | |
630 |
|
631 | |||
631 | ``dotencode`` |
|
632 | ``dotencode`` | |
632 | Enable or disable the "dotencode" repository format which enhances |
|
633 | Enable or disable the "dotencode" repository format which enhances | |
633 | the "fncache" repository format (which has to be enabled to use |
|
634 | the "fncache" repository format (which has to be enabled to use | |
634 | dotencode) to avoid issues with filenames starting with ._ on |
|
635 | dotencode) to avoid issues with filenames starting with ._ on | |
635 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
636 | Mac OS X and spaces on Windows. Enabled by default. Disabling this | |
636 | option ensures that the on-disk format of newly created |
|
637 | option ensures that the on-disk format of newly created | |
637 | repositories will be compatible with Mercurial before version 1.7. |
|
638 | repositories will be compatible with Mercurial before version 1.7. | |
638 |
|
639 | |||
639 | ``graph`` |
|
640 | ``graph`` | |
640 | --------- |
|
641 | --------- | |
641 |
|
642 | |||
642 | Web graph view configuration. This section let you change graph |
|
643 | Web graph view configuration. This section let you change graph | |
643 | elements display properties by branches, for instance to make the |
|
644 | elements display properties by branches, for instance to make the | |
644 | ``default`` branch stand out. |
|
645 | ``default`` branch stand out. | |
645 |
|
646 | |||
646 | Each line has the following format:: |
|
647 | Each line has the following format:: | |
647 |
|
648 | |||
648 | <branch>.<argument> = <value> |
|
649 | <branch>.<argument> = <value> | |
649 |
|
650 | |||
650 | where ``<branch>`` is the name of the branch being |
|
651 | where ``<branch>`` is the name of the branch being | |
651 | customized. Example:: |
|
652 | customized. Example:: | |
652 |
|
653 | |||
653 | [graph] |
|
654 | [graph] | |
654 | # 2px width |
|
655 | # 2px width | |
655 | default.width = 2 |
|
656 | default.width = 2 | |
656 | # red color |
|
657 | # red color | |
657 | default.color = FF0000 |
|
658 | default.color = FF0000 | |
658 |
|
659 | |||
659 | Supported arguments: |
|
660 | Supported arguments: | |
660 |
|
661 | |||
661 | ``width`` |
|
662 | ``width`` | |
662 | Set branch edges width in pixels. |
|
663 | Set branch edges width in pixels. | |
663 |
|
664 | |||
664 | ``color`` |
|
665 | ``color`` | |
665 | Set branch edges color in hexadecimal RGB notation. |
|
666 | Set branch edges color in hexadecimal RGB notation. | |
666 |
|
667 | |||
667 | ``hooks`` |
|
668 | ``hooks`` | |
668 | --------- |
|
669 | --------- | |
669 |
|
670 | |||
670 | Commands or Python functions that get automatically executed by |
|
671 | Commands or Python functions that get automatically executed by | |
671 | various actions such as starting or finishing a commit. Multiple |
|
672 | various actions such as starting or finishing a commit. Multiple | |
672 | hooks can be run for the same action by appending a suffix to the |
|
673 | hooks can be run for the same action by appending a suffix to the | |
673 | action. Overriding a site-wide hook can be done by changing its |
|
674 | action. Overriding a site-wide hook can be done by changing its | |
674 | value or setting it to an empty string. Hooks can be prioritized |
|
675 | value or setting it to an empty string. Hooks can be prioritized | |
675 | by adding a prefix of ``priority`` to the hook name on a new line |
|
676 | by adding a prefix of ``priority`` to the hook name on a new line | |
676 | and setting the priority. The default priority is 0 if |
|
677 | and setting the priority. The default priority is 0 if | |
677 | not specified. |
|
678 | not specified. | |
678 |
|
679 | |||
679 | Example ``.hg/hgrc``:: |
|
680 | Example ``.hg/hgrc``:: | |
680 |
|
681 | |||
681 | [hooks] |
|
682 | [hooks] | |
682 | # update working directory after adding changesets |
|
683 | # update working directory after adding changesets | |
683 | changegroup.update = hg update |
|
684 | changegroup.update = hg update | |
684 | # do not use the site-wide hook |
|
685 | # do not use the site-wide hook | |
685 | incoming = |
|
686 | incoming = | |
686 | incoming.email = /my/email/hook |
|
687 | incoming.email = /my/email/hook | |
687 | incoming.autobuild = /my/build/hook |
|
688 | incoming.autobuild = /my/build/hook | |
688 | # force autobuild hook to run before other incoming hooks |
|
689 | # force autobuild hook to run before other incoming hooks | |
689 | priority.incoming.autobuild = 1 |
|
690 | priority.incoming.autobuild = 1 | |
690 |
|
691 | |||
691 | Most hooks are run with environment variables set that give useful |
|
692 | Most hooks are run with environment variables set that give useful | |
692 | additional information. For each hook below, the environment |
|
693 | additional information. For each hook below, the environment | |
693 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
694 | variables it is passed are listed with names of the form ``$HG_foo``. | |
694 |
|
695 | |||
695 | ``changegroup`` |
|
696 | ``changegroup`` | |
696 | Run after a changegroup has been added via push, pull or unbundle. |
|
697 | Run after a changegroup has been added via push, pull or unbundle. | |
697 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
698 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
698 | changes came is in ``$HG_URL``. |
|
699 | changes came is in ``$HG_URL``. | |
699 |
|
700 | |||
700 | ``commit`` |
|
701 | ``commit`` | |
701 | Run after a changeset has been created in the local repository. ID |
|
702 | Run after a changeset has been created in the local repository. ID | |
702 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
703 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
703 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
704 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
704 |
|
705 | |||
705 | ``incoming`` |
|
706 | ``incoming`` | |
706 | Run after a changeset has been pulled, pushed, or unbundled into |
|
707 | Run after a changeset has been pulled, pushed, or unbundled into | |
707 | the local repository. The ID of the newly arrived changeset is in |
|
708 | the local repository. The ID of the newly arrived changeset is in | |
708 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
709 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
709 |
|
710 | |||
710 | ``outgoing`` |
|
711 | ``outgoing`` | |
711 | Run after sending changes from local repository to another. ID of |
|
712 | Run after sending changes from local repository to another. ID of | |
712 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
713 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
713 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
714 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
714 |
|
715 | |||
715 | ``post-<command>`` |
|
716 | ``post-<command>`` | |
716 | Run after successful invocations of the associated command. The |
|
717 | Run after successful invocations of the associated command. The | |
717 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
718 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
718 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
719 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
719 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
720 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
720 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
721 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
721 | dictionary of options (with unspecified options set to their defaults). |
|
722 | dictionary of options (with unspecified options set to their defaults). | |
722 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
723 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
723 |
|
724 | |||
724 | ``pre-<command>`` |
|
725 | ``pre-<command>`` | |
725 | Run before executing the associated command. The contents of the |
|
726 | Run before executing the associated command. The contents of the | |
726 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
727 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
727 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
728 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
728 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
729 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
729 | is a dictionary of options (with unspecified options set to their |
|
730 | is a dictionary of options (with unspecified options set to their | |
730 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
731 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
731 | failure, the command doesn't execute and Mercurial returns the failure |
|
732 | failure, the command doesn't execute and Mercurial returns the failure | |
732 | code. |
|
733 | code. | |
733 |
|
734 | |||
734 | ``prechangegroup`` |
|
735 | ``prechangegroup`` | |
735 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
736 | Run before a changegroup is added via push, pull or unbundle. Exit | |
736 | status 0 allows the changegroup to proceed. Non-zero status will |
|
737 | status 0 allows the changegroup to proceed. Non-zero status will | |
737 | cause the push, pull or unbundle to fail. URL from which changes |
|
738 | cause the push, pull or unbundle to fail. URL from which changes | |
738 | will come is in ``$HG_URL``. |
|
739 | will come is in ``$HG_URL``. | |
739 |
|
740 | |||
740 | ``precommit`` |
|
741 | ``precommit`` | |
741 | Run before starting a local commit. Exit status 0 allows the |
|
742 | Run before starting a local commit. Exit status 0 allows the | |
742 | commit to proceed. Non-zero status will cause the commit to fail. |
|
743 | commit to proceed. Non-zero status will cause the commit to fail. | |
743 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
744 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
744 |
|
745 | |||
745 | ``prelistkeys`` |
|
746 | ``prelistkeys`` | |
746 | Run before listing pushkeys (like bookmarks) in the |
|
747 | Run before listing pushkeys (like bookmarks) in the | |
747 | repository. Non-zero status will cause failure. The key namespace is |
|
748 | repository. Non-zero status will cause failure. The key namespace is | |
748 | in ``$HG_NAMESPACE``. |
|
749 | in ``$HG_NAMESPACE``. | |
749 |
|
750 | |||
750 | ``preoutgoing`` |
|
751 | ``preoutgoing`` | |
751 | Run before collecting changes to send from the local repository to |
|
752 | Run before collecting changes to send from the local repository to | |
752 | another. Non-zero status will cause failure. This lets you prevent |
|
753 | another. Non-zero status will cause failure. This lets you prevent | |
753 | pull over HTTP or SSH. Also prevents against local pull, push |
|
754 | pull over HTTP or SSH. Also prevents against local pull, push | |
754 | (outbound) or bundle commands, but not effective, since you can |
|
755 | (outbound) or bundle commands, but not effective, since you can | |
755 | just copy files instead then. Source of operation is in |
|
756 | just copy files instead then. Source of operation is in | |
756 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
757 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
757 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
758 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
758 | is happening on behalf of repository on same system. |
|
759 | is happening on behalf of repository on same system. | |
759 |
|
760 | |||
760 | ``prepushkey`` |
|
761 | ``prepushkey`` | |
761 | Run before a pushkey (like a bookmark) is added to the |
|
762 | Run before a pushkey (like a bookmark) is added to the | |
762 | repository. Non-zero status will cause the key to be rejected. The |
|
763 | repository. Non-zero status will cause the key to be rejected. The | |
763 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
764 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
764 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
765 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
765 | ``$HG_NEW``. |
|
766 | ``$HG_NEW``. | |
766 |
|
767 | |||
767 | ``pretag`` |
|
768 | ``pretag`` | |
768 | Run before creating a tag. Exit status 0 allows the tag to be |
|
769 | Run before creating a tag. Exit status 0 allows the tag to be | |
769 | created. Non-zero status will cause the tag to fail. ID of |
|
770 | created. Non-zero status will cause the tag to fail. ID of | |
770 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
771 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
771 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
772 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
772 |
|
773 | |||
773 | ``pretxnchangegroup`` |
|
774 | ``pretxnchangegroup`` | |
774 | Run after a changegroup has been added via push, pull or unbundle, |
|
775 | Run after a changegroup has been added via push, pull or unbundle, | |
775 | but before the transaction has been committed. Changegroup is |
|
776 | but before the transaction has been committed. Changegroup is | |
776 | visible to hook program. This lets you validate incoming changes |
|
777 | visible to hook program. This lets you validate incoming changes | |
777 | before accepting them. Passed the ID of the first new changeset in |
|
778 | before accepting them. Passed the ID of the first new changeset in | |
778 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
779 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
779 | status will cause the transaction to be rolled back and the push, |
|
780 | status will cause the transaction to be rolled back and the push, | |
780 | pull or unbundle will fail. URL that was source of changes is in |
|
781 | pull or unbundle will fail. URL that was source of changes is in | |
781 | ``$HG_URL``. |
|
782 | ``$HG_URL``. | |
782 |
|
783 | |||
783 | ``pretxncommit`` |
|
784 | ``pretxncommit`` | |
784 | Run after a changeset has been created but the transaction not yet |
|
785 | Run after a changeset has been created but the transaction not yet | |
785 | committed. Changeset is visible to hook program. This lets you |
|
786 | committed. Changeset is visible to hook program. This lets you | |
786 | validate commit message and changes. Exit status 0 allows the |
|
787 | validate commit message and changes. Exit status 0 allows the | |
787 | commit to proceed. Non-zero status will cause the transaction to |
|
788 | commit to proceed. Non-zero status will cause the transaction to | |
788 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
789 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
789 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
790 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
790 |
|
791 | |||
791 | ``preupdate`` |
|
792 | ``preupdate`` | |
792 | Run before updating the working directory. Exit status 0 allows |
|
793 | Run before updating the working directory. Exit status 0 allows | |
793 | the update to proceed. Non-zero status will prevent the update. |
|
794 | the update to proceed. Non-zero status will prevent the update. | |
794 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
795 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
795 | of second new parent is in ``$HG_PARENT2``. |
|
796 | of second new parent is in ``$HG_PARENT2``. | |
796 |
|
797 | |||
797 | ``listkeys`` |
|
798 | ``listkeys`` | |
798 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
799 | Run after listing pushkeys (like bookmarks) in the repository. The | |
799 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
800 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
800 | dictionary containing the keys and values. |
|
801 | dictionary containing the keys and values. | |
801 |
|
802 | |||
802 | ``pushkey`` |
|
803 | ``pushkey`` | |
803 | Run after a pushkey (like a bookmark) is added to the |
|
804 | Run after a pushkey (like a bookmark) is added to the | |
804 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
805 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
805 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
806 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
806 | value is in ``$HG_NEW``. |
|
807 | value is in ``$HG_NEW``. | |
807 |
|
808 | |||
808 | ``tag`` |
|
809 | ``tag`` | |
809 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
810 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
810 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
811 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
811 | repository if ``$HG_LOCAL=0``. |
|
812 | repository if ``$HG_LOCAL=0``. | |
812 |
|
813 | |||
813 | ``update`` |
|
814 | ``update`` | |
814 | Run after updating the working directory. Changeset ID of first |
|
815 | Run after updating the working directory. Changeset ID of first | |
815 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
816 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
816 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
817 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
817 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
818 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
818 |
|
819 | |||
819 | .. note:: |
|
820 | .. note:: | |
820 |
|
821 | |||
821 | It is generally better to use standard hooks rather than the |
|
822 | It is generally better to use standard hooks rather than the | |
822 | generic pre- and post- command hooks as they are guaranteed to be |
|
823 | generic pre- and post- command hooks as they are guaranteed to be | |
823 | called in the appropriate contexts for influencing transactions. |
|
824 | called in the appropriate contexts for influencing transactions. | |
824 | Also, hooks like "commit" will be called in all contexts that |
|
825 | Also, hooks like "commit" will be called in all contexts that | |
825 | generate a commit (e.g. tag) and not just the commit command. |
|
826 | generate a commit (e.g. tag) and not just the commit command. | |
826 |
|
827 | |||
827 | .. note:: |
|
828 | .. note:: | |
828 |
|
829 | |||
829 | Environment variables with empty values may not be passed to |
|
830 | Environment variables with empty values may not be passed to | |
830 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
831 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
831 | will have an empty value under Unix-like platforms for non-merge |
|
832 | will have an empty value under Unix-like platforms for non-merge | |
832 | changesets, while it will not be available at all under Windows. |
|
833 | changesets, while it will not be available at all under Windows. | |
833 |
|
834 | |||
834 | The syntax for Python hooks is as follows:: |
|
835 | The syntax for Python hooks is as follows:: | |
835 |
|
836 | |||
836 | hookname = python:modulename.submodule.callable |
|
837 | hookname = python:modulename.submodule.callable | |
837 | hookname = python:/path/to/python/module.py:callable |
|
838 | hookname = python:/path/to/python/module.py:callable | |
838 |
|
839 | |||
839 | Python hooks are run within the Mercurial process. Each hook is |
|
840 | Python hooks are run within the Mercurial process. Each hook is | |
840 | called with at least three keyword arguments: a ui object (keyword |
|
841 | called with at least three keyword arguments: a ui object (keyword | |
841 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
842 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
842 | keyword that tells what kind of hook is used. Arguments listed as |
|
843 | keyword that tells what kind of hook is used. Arguments listed as | |
843 | environment variables above are passed as keyword arguments, with no |
|
844 | environment variables above are passed as keyword arguments, with no | |
844 | ``HG_`` prefix, and names in lower case. |
|
845 | ``HG_`` prefix, and names in lower case. | |
845 |
|
846 | |||
846 | If a Python hook returns a "true" value or raises an exception, this |
|
847 | If a Python hook returns a "true" value or raises an exception, this | |
847 | is treated as a failure. |
|
848 | is treated as a failure. | |
848 |
|
849 | |||
849 |
|
850 | |||
850 | ``hostfingerprints`` |
|
851 | ``hostfingerprints`` | |
851 | -------------------- |
|
852 | -------------------- | |
852 |
|
853 | |||
853 | Fingerprints of the certificates of known HTTPS servers. |
|
854 | Fingerprints of the certificates of known HTTPS servers. | |
854 | A HTTPS connection to a server with a fingerprint configured here will |
|
855 | A HTTPS connection to a server with a fingerprint configured here will | |
855 | only succeed if the servers certificate matches the fingerprint. |
|
856 | only succeed if the servers certificate matches the fingerprint. | |
856 | This is very similar to how ssh known hosts works. |
|
857 | This is very similar to how ssh known hosts works. | |
857 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
858 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
858 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
859 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
859 |
|
860 | |||
860 | For example:: |
|
861 | For example:: | |
861 |
|
862 | |||
862 | [hostfingerprints] |
|
863 | [hostfingerprints] | |
863 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 |
|
864 | hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0 | |
864 |
|
865 | |||
865 | This feature is only supported when using Python 2.6 or later. |
|
866 | This feature is only supported when using Python 2.6 or later. | |
866 |
|
867 | |||
867 |
|
868 | |||
868 | ``http_proxy`` |
|
869 | ``http_proxy`` | |
869 | -------------- |
|
870 | -------------- | |
870 |
|
871 | |||
871 | Used to access web-based Mercurial repositories through a HTTP |
|
872 | Used to access web-based Mercurial repositories through a HTTP | |
872 | proxy. |
|
873 | proxy. | |
873 |
|
874 | |||
874 | ``host`` |
|
875 | ``host`` | |
875 | Host name and (optional) port of the proxy server, for example |
|
876 | Host name and (optional) port of the proxy server, for example | |
876 | "myproxy:8000". |
|
877 | "myproxy:8000". | |
877 |
|
878 | |||
878 | ``no`` |
|
879 | ``no`` | |
879 | Optional. Comma-separated list of host names that should bypass |
|
880 | Optional. Comma-separated list of host names that should bypass | |
880 | the proxy. |
|
881 | the proxy. | |
881 |
|
882 | |||
882 | ``passwd`` |
|
883 | ``passwd`` | |
883 | Optional. Password to authenticate with at the proxy server. |
|
884 | Optional. Password to authenticate with at the proxy server. | |
884 |
|
885 | |||
885 | ``user`` |
|
886 | ``user`` | |
886 | Optional. User name to authenticate with at the proxy server. |
|
887 | Optional. User name to authenticate with at the proxy server. | |
887 |
|
888 | |||
888 | ``always`` |
|
889 | ``always`` | |
889 | Optional. Always use the proxy, even for localhost and any entries |
|
890 | Optional. Always use the proxy, even for localhost and any entries | |
890 | in ``http_proxy.no``. True or False. Default: False. |
|
891 | in ``http_proxy.no``. True or False. Default: False. | |
891 |
|
892 | |||
892 | ``merge-patterns`` |
|
893 | ``merge-patterns`` | |
893 | ------------------ |
|
894 | ------------------ | |
894 |
|
895 | |||
895 | This section specifies merge tools to associate with particular file |
|
896 | This section specifies merge tools to associate with particular file | |
896 | patterns. Tools matched here will take precedence over the default |
|
897 | patterns. Tools matched here will take precedence over the default | |
897 | merge tool. Patterns are globs by default, rooted at the repository |
|
898 | merge tool. Patterns are globs by default, rooted at the repository | |
898 | root. |
|
899 | root. | |
899 |
|
900 | |||
900 | Example:: |
|
901 | Example:: | |
901 |
|
902 | |||
902 | [merge-patterns] |
|
903 | [merge-patterns] | |
903 | **.c = kdiff3 |
|
904 | **.c = kdiff3 | |
904 | **.jpg = myimgmerge |
|
905 | **.jpg = myimgmerge | |
905 |
|
906 | |||
906 | ``merge-tools`` |
|
907 | ``merge-tools`` | |
907 | --------------- |
|
908 | --------------- | |
908 |
|
909 | |||
909 | This section configures external merge tools to use for file-level |
|
910 | This section configures external merge tools to use for file-level | |
910 | merges. This section has likely been preconfigured at install time. |
|
911 | merges. This section has likely been preconfigured at install time. | |
911 | Use :hg:`config merge-tools` to check the existing configuration. |
|
912 | Use :hg:`config merge-tools` to check the existing configuration. | |
912 | Also see :hg:`help merge-tools` for more details. |
|
913 | Also see :hg:`help merge-tools` for more details. | |
913 |
|
914 | |||
914 | Example ``~/.hgrc``:: |
|
915 | Example ``~/.hgrc``:: | |
915 |
|
916 | |||
916 | [merge-tools] |
|
917 | [merge-tools] | |
917 | # Override stock tool location |
|
918 | # Override stock tool location | |
918 | kdiff3.executable = ~/bin/kdiff3 |
|
919 | kdiff3.executable = ~/bin/kdiff3 | |
919 | # Specify command line |
|
920 | # Specify command line | |
920 | kdiff3.args = $base $local $other -o $output |
|
921 | kdiff3.args = $base $local $other -o $output | |
921 | # Give higher priority |
|
922 | # Give higher priority | |
922 | kdiff3.priority = 1 |
|
923 | kdiff3.priority = 1 | |
923 |
|
924 | |||
924 | # Changing the priority of preconfigured tool |
|
925 | # Changing the priority of preconfigured tool | |
925 | vimdiff.priority = 0 |
|
926 | vimdiff.priority = 0 | |
926 |
|
927 | |||
927 | # Define new tool |
|
928 | # Define new tool | |
928 | myHtmlTool.args = -m $local $other $base $output |
|
929 | myHtmlTool.args = -m $local $other $base $output | |
929 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
930 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
930 | myHtmlTool.priority = 1 |
|
931 | myHtmlTool.priority = 1 | |
931 |
|
932 | |||
932 | Supported arguments: |
|
933 | Supported arguments: | |
933 |
|
934 | |||
934 | ``priority`` |
|
935 | ``priority`` | |
935 | The priority in which to evaluate this tool. |
|
936 | The priority in which to evaluate this tool. | |
936 | Default: 0. |
|
937 | Default: 0. | |
937 |
|
938 | |||
938 | ``executable`` |
|
939 | ``executable`` | |
939 | Either just the name of the executable or its pathname. On Windows, |
|
940 | Either just the name of the executable or its pathname. On Windows, | |
940 | the path can use environment variables with ${ProgramFiles} syntax. |
|
941 | the path can use environment variables with ${ProgramFiles} syntax. | |
941 | Default: the tool name. |
|
942 | Default: the tool name. | |
942 |
|
943 | |||
943 | ``args`` |
|
944 | ``args`` | |
944 | The arguments to pass to the tool executable. You can refer to the |
|
945 | The arguments to pass to the tool executable. You can refer to the | |
945 | files being merged as well as the output file through these |
|
946 | files being merged as well as the output file through these | |
946 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning |
|
947 | variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning | |
947 | of ``$local`` and ``$other`` can vary depending on which action is being |
|
948 | of ``$local`` and ``$other`` can vary depending on which action is being | |
948 | performed. During and update or merge, ``$local`` represents the original |
|
949 | performed. During and update or merge, ``$local`` represents the original | |
949 | state of the file, while ``$other`` represents the commit you are updating |
|
950 | state of the file, while ``$other`` represents the commit you are updating | |
950 | to or the commit you are merging with. During a rebase ``$local`` |
|
951 | to or the commit you are merging with. During a rebase ``$local`` | |
951 | represents the destination of the rebase, and ``$other`` represents the |
|
952 | represents the destination of the rebase, and ``$other`` represents the | |
952 | commit being rebased. |
|
953 | commit being rebased. | |
953 | Default: ``$local $base $other`` |
|
954 | Default: ``$local $base $other`` | |
954 |
|
955 | |||
955 | ``premerge`` |
|
956 | ``premerge`` | |
956 | Attempt to run internal non-interactive 3-way merge tool before |
|
957 | Attempt to run internal non-interactive 3-way merge tool before | |
957 | launching external tool. Options are ``true``, ``false``, ``keep`` or |
|
958 | launching external tool. Options are ``true``, ``false``, ``keep`` or | |
958 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the |
|
959 | ``keep-merge3``. The ``keep`` option will leave markers in the file if the | |
959 | premerge fails. The ``keep-merge3`` will do the same but include information |
|
960 | premerge fails. The ``keep-merge3`` will do the same but include information | |
960 | about the base of the merge in the marker (see internal:merge3). |
|
961 | about the base of the merge in the marker (see internal:merge3). | |
961 | Default: True |
|
962 | Default: True | |
962 |
|
963 | |||
963 | ``binary`` |
|
964 | ``binary`` | |
964 | This tool can merge binary files. Defaults to False, unless tool |
|
965 | This tool can merge binary files. Defaults to False, unless tool | |
965 | was selected by file pattern match. |
|
966 | was selected by file pattern match. | |
966 |
|
967 | |||
967 | ``symlink`` |
|
968 | ``symlink`` | |
968 | This tool can merge symlinks. Defaults to False, even if tool was |
|
969 | This tool can merge symlinks. Defaults to False, even if tool was | |
969 | selected by file pattern match. |
|
970 | selected by file pattern match. | |
970 |
|
971 | |||
971 | ``check`` |
|
972 | ``check`` | |
972 | A list of merge success-checking options: |
|
973 | A list of merge success-checking options: | |
973 |
|
974 | |||
974 | ``changed`` |
|
975 | ``changed`` | |
975 | Ask whether merge was successful when the merged file shows no changes. |
|
976 | Ask whether merge was successful when the merged file shows no changes. | |
976 | ``conflicts`` |
|
977 | ``conflicts`` | |
977 | Check whether there are conflicts even though the tool reported success. |
|
978 | Check whether there are conflicts even though the tool reported success. | |
978 | ``prompt`` |
|
979 | ``prompt`` | |
979 | Always prompt for merge success, regardless of success reported by tool. |
|
980 | Always prompt for merge success, regardless of success reported by tool. | |
980 |
|
981 | |||
981 | ``fixeol`` |
|
982 | ``fixeol`` | |
982 | Attempt to fix up EOL changes caused by the merge tool. |
|
983 | Attempt to fix up EOL changes caused by the merge tool. | |
983 | Default: False |
|
984 | Default: False | |
984 |
|
985 | |||
985 | ``gui`` |
|
986 | ``gui`` | |
986 | This tool requires a graphical interface to run. Default: False |
|
987 | This tool requires a graphical interface to run. Default: False | |
987 |
|
988 | |||
988 | ``regkey`` |
|
989 | ``regkey`` | |
989 | Windows registry key which describes install location of this |
|
990 | Windows registry key which describes install location of this | |
990 | tool. Mercurial will search for this key first under |
|
991 | tool. Mercurial will search for this key first under | |
991 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
992 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
992 | Default: None |
|
993 | Default: None | |
993 |
|
994 | |||
994 | ``regkeyalt`` |
|
995 | ``regkeyalt`` | |
995 | An alternate Windows registry key to try if the first key is not |
|
996 | An alternate Windows registry key to try if the first key is not | |
996 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
997 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
997 | semantics of the primary key. The most common use for this key |
|
998 | semantics of the primary key. The most common use for this key | |
998 | is to search for 32bit applications on 64bit operating systems. |
|
999 | is to search for 32bit applications on 64bit operating systems. | |
999 | Default: None |
|
1000 | Default: None | |
1000 |
|
1001 | |||
1001 | ``regname`` |
|
1002 | ``regname`` | |
1002 | Name of value to read from specified registry key. Defaults to the |
|
1003 | Name of value to read from specified registry key. Defaults to the | |
1003 | unnamed (default) value. |
|
1004 | unnamed (default) value. | |
1004 |
|
1005 | |||
1005 | ``regappend`` |
|
1006 | ``regappend`` | |
1006 | String to append to the value read from the registry, typically |
|
1007 | String to append to the value read from the registry, typically | |
1007 | the executable name of the tool. |
|
1008 | the executable name of the tool. | |
1008 | Default: None |
|
1009 | Default: None | |
1009 |
|
1010 | |||
1010 |
|
1011 | |||
1011 | ``patch`` |
|
1012 | ``patch`` | |
1012 | --------- |
|
1013 | --------- | |
1013 |
|
1014 | |||
1014 | Settings used when applying patches, for instance through the 'import' |
|
1015 | Settings used when applying patches, for instance through the 'import' | |
1015 | command or with Mercurial Queues extension. |
|
1016 | command or with Mercurial Queues extension. | |
1016 |
|
1017 | |||
1017 | ``eol`` |
|
1018 | ``eol`` | |
1018 | When set to 'strict' patch content and patched files end of lines |
|
1019 | When set to 'strict' patch content and patched files end of lines | |
1019 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
1020 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
1020 | lines are ignored when patching and the result line endings are |
|
1021 | lines are ignored when patching and the result line endings are | |
1021 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
1022 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
1022 | ``auto``, end of lines are again ignored while patching but line |
|
1023 | ``auto``, end of lines are again ignored while patching but line | |
1023 | endings in patched files are normalized to their original setting |
|
1024 | endings in patched files are normalized to their original setting | |
1024 | on a per-file basis. If target file does not exist or has no end |
|
1025 | on a per-file basis. If target file does not exist or has no end | |
1025 | of line, patch line endings are preserved. |
|
1026 | of line, patch line endings are preserved. | |
1026 | Default: strict. |
|
1027 | Default: strict. | |
1027 |
|
1028 | |||
1028 |
|
1029 | |||
1029 | ``paths`` |
|
1030 | ``paths`` | |
1030 | --------- |
|
1031 | --------- | |
1031 |
|
1032 | |||
1032 | Assigns symbolic names to repositories. The left side is the |
|
1033 | Assigns symbolic names to repositories. The left side is the | |
1033 | symbolic name, and the right gives the directory or URL that is the |
|
1034 | symbolic name, and the right gives the directory or URL that is the | |
1034 | location of the repository. Default paths can be declared by setting |
|
1035 | location of the repository. Default paths can be declared by setting | |
1035 | the following entries. |
|
1036 | the following entries. | |
1036 |
|
1037 | |||
1037 | ``default`` |
|
1038 | ``default`` | |
1038 | Directory or URL to use when pulling if no source is specified. |
|
1039 | Directory or URL to use when pulling if no source is specified. | |
1039 | Default is set to repository from which the current repository was |
|
1040 | Default is set to repository from which the current repository was | |
1040 | cloned. |
|
1041 | cloned. | |
1041 |
|
1042 | |||
1042 | ``default-push`` |
|
1043 | ``default-push`` | |
1043 | Optional. Directory or URL to use when pushing if no destination |
|
1044 | Optional. Directory or URL to use when pushing if no destination | |
1044 | is specified. |
|
1045 | is specified. | |
1045 |
|
1046 | |||
1046 | Custom paths can be defined by assigning the path to a name that later can be |
|
1047 | Custom paths can be defined by assigning the path to a name that later can be | |
1047 | used from the command line. Example:: |
|
1048 | used from the command line. Example:: | |
1048 |
|
1049 | |||
1049 | [paths] |
|
1050 | [paths] | |
1050 | my_path = http://example.com/path |
|
1051 | my_path = http://example.com/path | |
1051 |
|
1052 | |||
1052 | To push to the path defined in ``my_path`` run the command:: |
|
1053 | To push to the path defined in ``my_path`` run the command:: | |
1053 |
|
1054 | |||
1054 | hg push my_path |
|
1055 | hg push my_path | |
1055 |
|
1056 | |||
1056 |
|
1057 | |||
1057 | ``phases`` |
|
1058 | ``phases`` | |
1058 | ---------- |
|
1059 | ---------- | |
1059 |
|
1060 | |||
1060 | Specifies default handling of phases. See :hg:`help phases` for more |
|
1061 | Specifies default handling of phases. See :hg:`help phases` for more | |
1061 | information about working with phases. |
|
1062 | information about working with phases. | |
1062 |
|
1063 | |||
1063 | ``publish`` |
|
1064 | ``publish`` | |
1064 | Controls draft phase behavior when working as a server. When true, |
|
1065 | Controls draft phase behavior when working as a server. When true, | |
1065 | pushed changesets are set to public in both client and server and |
|
1066 | pushed changesets are set to public in both client and server and | |
1066 | pulled or cloned changesets are set to public in the client. |
|
1067 | pulled or cloned changesets are set to public in the client. | |
1067 | Default: True |
|
1068 | Default: True | |
1068 |
|
1069 | |||
1069 | ``new-commit`` |
|
1070 | ``new-commit`` | |
1070 | Phase of newly-created commits. |
|
1071 | Phase of newly-created commits. | |
1071 | Default: draft |
|
1072 | Default: draft | |
1072 |
|
1073 | |||
1073 | ``checksubrepos`` |
|
1074 | ``checksubrepos`` | |
1074 | Check the phase of the current revision of each subrepository. Allowed |
|
1075 | Check the phase of the current revision of each subrepository. Allowed | |
1075 | values are "ignore", "follow" and "abort". For settings other than |
|
1076 | values are "ignore", "follow" and "abort". For settings other than | |
1076 | "ignore", the phase of the current revision of each subrepository is |
|
1077 | "ignore", the phase of the current revision of each subrepository is | |
1077 | checked before committing the parent repository. If any of those phases is |
|
1078 | checked before committing the parent repository. If any of those phases is | |
1078 | greater than the phase of the parent repository (e.g. if a subrepo is in a |
|
1079 | greater than the phase of the parent repository (e.g. if a subrepo is in a | |
1079 | "secret" phase while the parent repo is in "draft" phase), the commit is |
|
1080 | "secret" phase while the parent repo is in "draft" phase), the commit is | |
1080 | either aborted (if checksubrepos is set to "abort") or the higher phase is |
|
1081 | either aborted (if checksubrepos is set to "abort") or the higher phase is | |
1081 | used for the parent repository commit (if set to "follow"). |
|
1082 | used for the parent repository commit (if set to "follow"). | |
1082 | Default: "follow" |
|
1083 | Default: "follow" | |
1083 |
|
1084 | |||
1084 |
|
1085 | |||
1085 | ``profiling`` |
|
1086 | ``profiling`` | |
1086 | ------------- |
|
1087 | ------------- | |
1087 |
|
1088 | |||
1088 | Specifies profiling type, format, and file output. Two profilers are |
|
1089 | Specifies profiling type, format, and file output. Two profilers are | |
1089 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
1090 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
1090 | profiler (named ``stat``). |
|
1091 | profiler (named ``stat``). | |
1091 |
|
1092 | |||
1092 | In this section description, 'profiling data' stands for the raw data |
|
1093 | In this section description, 'profiling data' stands for the raw data | |
1093 | collected during profiling, while 'profiling report' stands for a |
|
1094 | collected during profiling, while 'profiling report' stands for a | |
1094 | statistical text report generated from the profiling data. The |
|
1095 | statistical text report generated from the profiling data. The | |
1095 | profiling is done using lsprof. |
|
1096 | profiling is done using lsprof. | |
1096 |
|
1097 | |||
1097 | ``type`` |
|
1098 | ``type`` | |
1098 | The type of profiler to use. |
|
1099 | The type of profiler to use. | |
1099 | Default: ls. |
|
1100 | Default: ls. | |
1100 |
|
1101 | |||
1101 | ``ls`` |
|
1102 | ``ls`` | |
1102 | Use Python's built-in instrumenting profiler. This profiler |
|
1103 | Use Python's built-in instrumenting profiler. This profiler | |
1103 | works on all platforms, but each line number it reports is the |
|
1104 | works on all platforms, but each line number it reports is the | |
1104 | first line of a function. This restriction makes it difficult to |
|
1105 | first line of a function. This restriction makes it difficult to | |
1105 | identify the expensive parts of a non-trivial function. |
|
1106 | identify the expensive parts of a non-trivial function. | |
1106 | ``stat`` |
|
1107 | ``stat`` | |
1107 | Use a third-party statistical profiler, statprof. This profiler |
|
1108 | Use a third-party statistical profiler, statprof. This profiler | |
1108 | currently runs only on Unix systems, and is most useful for |
|
1109 | currently runs only on Unix systems, and is most useful for | |
1109 | profiling commands that run for longer than about 0.1 seconds. |
|
1110 | profiling commands that run for longer than about 0.1 seconds. | |
1110 |
|
1111 | |||
1111 | ``format`` |
|
1112 | ``format`` | |
1112 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
1113 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
1113 | Default: text. |
|
1114 | Default: text. | |
1114 |
|
1115 | |||
1115 | ``text`` |
|
1116 | ``text`` | |
1116 | Generate a profiling report. When saving to a file, it should be |
|
1117 | Generate a profiling report. When saving to a file, it should be | |
1117 | noted that only the report is saved, and the profiling data is |
|
1118 | noted that only the report is saved, and the profiling data is | |
1118 | not kept. |
|
1119 | not kept. | |
1119 | ``kcachegrind`` |
|
1120 | ``kcachegrind`` | |
1120 | Format profiling data for kcachegrind use: when saving to a |
|
1121 | Format profiling data for kcachegrind use: when saving to a | |
1121 | file, the generated file can directly be loaded into |
|
1122 | file, the generated file can directly be loaded into | |
1122 | kcachegrind. |
|
1123 | kcachegrind. | |
1123 |
|
1124 | |||
1124 | ``frequency`` |
|
1125 | ``frequency`` | |
1125 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
1126 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
1126 | Default: 1000. |
|
1127 | Default: 1000. | |
1127 |
|
1128 | |||
1128 | ``output`` |
|
1129 | ``output`` | |
1129 | File path where profiling data or report should be saved. If the |
|
1130 | File path where profiling data or report should be saved. If the | |
1130 | file exists, it is replaced. Default: None, data is printed on |
|
1131 | file exists, it is replaced. Default: None, data is printed on | |
1131 | stderr |
|
1132 | stderr | |
1132 |
|
1133 | |||
1133 | ``sort`` |
|
1134 | ``sort`` | |
1134 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
1135 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
1135 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
1136 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
1136 | ``inlinetime``. |
|
1137 | ``inlinetime``. | |
1137 | Default: inlinetime. |
|
1138 | Default: inlinetime. | |
1138 |
|
1139 | |||
1139 | ``limit`` |
|
1140 | ``limit`` | |
1140 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1141 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1141 | Default: 30. |
|
1142 | Default: 30. | |
1142 |
|
1143 | |||
1143 | ``nested`` |
|
1144 | ``nested`` | |
1144 | Show at most this number of lines of drill-down info after each main entry. |
|
1145 | Show at most this number of lines of drill-down info after each main entry. | |
1145 | This can help explain the difference between Total and Inline. |
|
1146 | This can help explain the difference between Total and Inline. | |
1146 | Specific to the ``ls`` instrumenting profiler. |
|
1147 | Specific to the ``ls`` instrumenting profiler. | |
1147 | Default: 5. |
|
1148 | Default: 5. | |
1148 |
|
1149 | |||
1149 | ``revsetalias`` |
|
1150 | ``revsetalias`` | |
1150 | --------------- |
|
1151 | --------------- | |
1151 |
|
1152 | |||
1152 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1153 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1153 |
|
1154 | |||
1154 | ``server`` |
|
1155 | ``server`` | |
1155 | ---------- |
|
1156 | ---------- | |
1156 |
|
1157 | |||
1157 | Controls generic server settings. |
|
1158 | Controls generic server settings. | |
1158 |
|
1159 | |||
1159 | ``uncompressed`` |
|
1160 | ``uncompressed`` | |
1160 | Whether to allow clients to clone a repository using the |
|
1161 | Whether to allow clients to clone a repository using the | |
1161 | uncompressed streaming protocol. This transfers about 40% more |
|
1162 | uncompressed streaming protocol. This transfers about 40% more | |
1162 | data than a regular clone, but uses less memory and CPU on both |
|
1163 | data than a regular clone, but uses less memory and CPU on both | |
1163 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1164 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1164 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1165 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1165 | regular clone. Over most WAN connections (anything slower than |
|
1166 | regular clone. Over most WAN connections (anything slower than | |
1166 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1167 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1167 | extra data transfer overhead. This mode will also temporarily hold |
|
1168 | extra data transfer overhead. This mode will also temporarily hold | |
1168 | the write lock while determining what data to transfer. |
|
1169 | the write lock while determining what data to transfer. | |
1169 | Default is True. |
|
1170 | Default is True. | |
1170 |
|
1171 | |||
1171 | ``preferuncompressed`` |
|
1172 | ``preferuncompressed`` | |
1172 | When set, clients will try to use the uncompressed streaming |
|
1173 | When set, clients will try to use the uncompressed streaming | |
1173 | protocol. Default is False. |
|
1174 | protocol. Default is False. | |
1174 |
|
1175 | |||
1175 | ``validate`` |
|
1176 | ``validate`` | |
1176 | Whether to validate the completeness of pushed changesets by |
|
1177 | Whether to validate the completeness of pushed changesets by | |
1177 | checking that all new file revisions specified in manifests are |
|
1178 | checking that all new file revisions specified in manifests are | |
1178 | present. Default is False. |
|
1179 | present. Default is False. | |
1179 |
|
1180 | |||
1180 | ``smtp`` |
|
1181 | ``smtp`` | |
1181 | -------- |
|
1182 | -------- | |
1182 |
|
1183 | |||
1183 | Configuration for extensions that need to send email messages. |
|
1184 | Configuration for extensions that need to send email messages. | |
1184 |
|
1185 | |||
1185 | ``host`` |
|
1186 | ``host`` | |
1186 | Host name of mail server, e.g. "mail.example.com". |
|
1187 | Host name of mail server, e.g. "mail.example.com". | |
1187 |
|
1188 | |||
1188 | ``port`` |
|
1189 | ``port`` | |
1189 | Optional. Port to connect to on mail server. Default: 465 (if |
|
1190 | Optional. Port to connect to on mail server. Default: 465 (if | |
1190 | ``tls`` is smtps) or 25 (otherwise). |
|
1191 | ``tls`` is smtps) or 25 (otherwise). | |
1191 |
|
1192 | |||
1192 | ``tls`` |
|
1193 | ``tls`` | |
1193 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1194 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1194 | smtps or none. Default: none. |
|
1195 | smtps or none. Default: none. | |
1195 |
|
1196 | |||
1196 | ``verifycert`` |
|
1197 | ``verifycert`` | |
1197 | Optional. Verification for the certificate of mail server, when |
|
1198 | Optional. Verification for the certificate of mail server, when | |
1198 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
1199 | ``tls`` is starttls or smtps. "strict", "loose" or False. For | |
1199 | "strict" or "loose", the certificate is verified as same as the |
|
1200 | "strict" or "loose", the certificate is verified as same as the | |
1200 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
1201 | verification for HTTPS connections (see ``[hostfingerprints]`` and | |
1201 | ``[web] cacerts`` also). For "strict", sending email is also |
|
1202 | ``[web] cacerts`` also). For "strict", sending email is also | |
1202 | aborted, if there is no configuration for mail server in |
|
1203 | aborted, if there is no configuration for mail server in | |
1203 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
1204 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for | |
1204 | :hg:`email` overwrites this as "loose". Default: "strict". |
|
1205 | :hg:`email` overwrites this as "loose". Default: "strict". | |
1205 |
|
1206 | |||
1206 | ``username`` |
|
1207 | ``username`` | |
1207 | Optional. User name for authenticating with the SMTP server. |
|
1208 | Optional. User name for authenticating with the SMTP server. | |
1208 | Default: none. |
|
1209 | Default: none. | |
1209 |
|
1210 | |||
1210 | ``password`` |
|
1211 | ``password`` | |
1211 | Optional. Password for authenticating with the SMTP server. If not |
|
1212 | Optional. Password for authenticating with the SMTP server. If not | |
1212 | specified, interactive sessions will prompt the user for a |
|
1213 | specified, interactive sessions will prompt the user for a | |
1213 | password; non-interactive sessions will fail. Default: none. |
|
1214 | password; non-interactive sessions will fail. Default: none. | |
1214 |
|
1215 | |||
1215 | ``local_hostname`` |
|
1216 | ``local_hostname`` | |
1216 | Optional. It's the hostname that the sender can use to identify |
|
1217 | Optional. It's the hostname that the sender can use to identify | |
1217 | itself to the MTA. |
|
1218 | itself to the MTA. | |
1218 |
|
1219 | |||
1219 |
|
1220 | |||
1220 | ``subpaths`` |
|
1221 | ``subpaths`` | |
1221 | ------------ |
|
1222 | ------------ | |
1222 |
|
1223 | |||
1223 | Subrepository source URLs can go stale if a remote server changes name |
|
1224 | Subrepository source URLs can go stale if a remote server changes name | |
1224 | or becomes temporarily unavailable. This section lets you define |
|
1225 | or becomes temporarily unavailable. This section lets you define | |
1225 | rewrite rules of the form:: |
|
1226 | rewrite rules of the form:: | |
1226 |
|
1227 | |||
1227 | <pattern> = <replacement> |
|
1228 | <pattern> = <replacement> | |
1228 |
|
1229 | |||
1229 | where ``pattern`` is a regular expression matching a subrepository |
|
1230 | where ``pattern`` is a regular expression matching a subrepository | |
1230 | source URL and ``replacement`` is the replacement string used to |
|
1231 | source URL and ``replacement`` is the replacement string used to | |
1231 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1232 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1232 | ``replacements``. For instance:: |
|
1233 | ``replacements``. For instance:: | |
1233 |
|
1234 | |||
1234 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1235 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1235 |
|
1236 | |||
1236 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1237 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1237 |
|
1238 | |||
1238 | Relative subrepository paths are first made absolute, and the |
|
1239 | Relative subrepository paths are first made absolute, and the | |
1239 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1240 | rewrite rules are then applied on the full (absolute) path. The rules | |
1240 | are applied in definition order. |
|
1241 | are applied in definition order. | |
1241 |
|
1242 | |||
1242 | ``trusted`` |
|
1243 | ``trusted`` | |
1243 | ----------- |
|
1244 | ----------- | |
1244 |
|
1245 | |||
1245 | Mercurial will not use the settings in the |
|
1246 | Mercurial will not use the settings in the | |
1246 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1247 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1247 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1248 | user or to a trusted group, as various hgrc features allow arbitrary | |
1248 | commands to be run. This issue is often encountered when configuring |
|
1249 | commands to be run. This issue is often encountered when configuring | |
1249 | hooks or extensions for shared repositories or servers. However, |
|
1250 | hooks or extensions for shared repositories or servers. However, | |
1250 | the web interface will use some safe settings from the ``[web]`` |
|
1251 | the web interface will use some safe settings from the ``[web]`` | |
1251 | section. |
|
1252 | section. | |
1252 |
|
1253 | |||
1253 | This section specifies what users and groups are trusted. The |
|
1254 | This section specifies what users and groups are trusted. The | |
1254 | current user is always trusted. To trust everybody, list a user or a |
|
1255 | current user is always trusted. To trust everybody, list a user or a | |
1255 | group with name ``*``. These settings must be placed in an |
|
1256 | group with name ``*``. These settings must be placed in an | |
1256 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1257 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1257 | user or service running Mercurial. |
|
1258 | user or service running Mercurial. | |
1258 |
|
1259 | |||
1259 | ``users`` |
|
1260 | ``users`` | |
1260 | Comma-separated list of trusted users. |
|
1261 | Comma-separated list of trusted users. | |
1261 |
|
1262 | |||
1262 | ``groups`` |
|
1263 | ``groups`` | |
1263 | Comma-separated list of trusted groups. |
|
1264 | Comma-separated list of trusted groups. | |
1264 |
|
1265 | |||
1265 |
|
1266 | |||
1266 | ``ui`` |
|
1267 | ``ui`` | |
1267 | ------ |
|
1268 | ------ | |
1268 |
|
1269 | |||
1269 | User interface controls. |
|
1270 | User interface controls. | |
1270 |
|
1271 | |||
1271 | ``archivemeta`` |
|
1272 | ``archivemeta`` | |
1272 | Whether to include the .hg_archival.txt file containing meta data |
|
1273 | Whether to include the .hg_archival.txt file containing meta data | |
1273 | (hashes for the repository base and for tip) in archives created |
|
1274 | (hashes for the repository base and for tip) in archives created | |
1274 | by the :hg:`archive` command or downloaded via hgweb. |
|
1275 | by the :hg:`archive` command or downloaded via hgweb. | |
1275 | Default is True. |
|
1276 | Default is True. | |
1276 |
|
1277 | |||
1277 | ``askusername`` |
|
1278 | ``askusername`` | |
1278 | Whether to prompt for a username when committing. If True, and |
|
1279 | Whether to prompt for a username when committing. If True, and | |
1279 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1280 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1280 | be prompted to enter a username. If no username is entered, the |
|
1281 | be prompted to enter a username. If no username is entered, the | |
1281 | default ``USER@HOST`` is used instead. |
|
1282 | default ``USER@HOST`` is used instead. | |
1282 | Default is False. |
|
1283 | Default is False. | |
1283 |
|
1284 | |||
1284 | ``commitsubrepos`` |
|
1285 | ``commitsubrepos`` | |
1285 | Whether to commit modified subrepositories when committing the |
|
1286 | Whether to commit modified subrepositories when committing the | |
1286 | parent repository. If False and one subrepository has uncommitted |
|
1287 | parent repository. If False and one subrepository has uncommitted | |
1287 | changes, abort the commit. |
|
1288 | changes, abort the commit. | |
1288 | Default is False. |
|
1289 | Default is False. | |
1289 |
|
1290 | |||
1290 | ``debug`` |
|
1291 | ``debug`` | |
1291 | Print debugging information. True or False. Default is False. |
|
1292 | Print debugging information. True or False. Default is False. | |
1292 |
|
1293 | |||
1293 | ``editor`` |
|
1294 | ``editor`` | |
1294 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
1295 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. | |
1295 |
|
1296 | |||
1296 | ``fallbackencoding`` |
|
1297 | ``fallbackencoding`` | |
1297 | Encoding to try if it's not possible to decode the changelog using |
|
1298 | Encoding to try if it's not possible to decode the changelog using | |
1298 | UTF-8. Default is ISO-8859-1. |
|
1299 | UTF-8. Default is ISO-8859-1. | |
1299 |
|
1300 | |||
1300 | ``ignore`` |
|
1301 | ``ignore`` | |
1301 | A file to read per-user ignore patterns from. This file should be |
|
1302 | A file to read per-user ignore patterns from. This file should be | |
1302 | in the same format as a repository-wide .hgignore file. This |
|
1303 | in the same format as a repository-wide .hgignore file. This | |
1303 | option supports hook syntax, so if you want to specify multiple |
|
1304 | option supports hook syntax, so if you want to specify multiple | |
1304 | ignore files, you can do so by setting something like |
|
1305 | ignore files, you can do so by setting something like | |
1305 | ``ignore.other = ~/.hgignore2``. For details of the ignore file |
|
1306 | ``ignore.other = ~/.hgignore2``. For details of the ignore file | |
1306 | format, see the ``hgignore(5)`` man page. |
|
1307 | format, see the ``hgignore(5)`` man page. | |
1307 |
|
1308 | |||
1308 | ``interactive`` |
|
1309 | ``interactive`` | |
1309 | Allow to prompt the user. True or False. Default is True. |
|
1310 | Allow to prompt the user. True or False. Default is True. | |
1310 |
|
1311 | |||
1311 | ``logtemplate`` |
|
1312 | ``logtemplate`` | |
1312 | Template string for commands that print changesets. |
|
1313 | Template string for commands that print changesets. | |
1313 |
|
1314 | |||
1314 | ``merge`` |
|
1315 | ``merge`` | |
1315 | The conflict resolution program to use during a manual merge. |
|
1316 | The conflict resolution program to use during a manual merge. | |
1316 | For more information on merge tools see :hg:`help merge-tools`. |
|
1317 | For more information on merge tools see :hg:`help merge-tools`. | |
1317 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1318 | For configuring merge tools see the ``[merge-tools]`` section. | |
1318 |
|
1319 | |||
1319 | ``mergemarkers`` |
|
1320 | ``mergemarkers`` | |
1320 | Sets the merge conflict marker label styling. The ``detailed`` |
|
1321 | Sets the merge conflict marker label styling. The ``detailed`` | |
1321 | style uses the ``mergemarkertemplate`` setting to style the labels. |
|
1322 | style uses the ``mergemarkertemplate`` setting to style the labels. | |
1322 | The ``basic`` style just uses 'local' and 'other' as the marker label. |
|
1323 | The ``basic`` style just uses 'local' and 'other' as the marker label. | |
1323 | One of ``basic`` or ``detailed``. |
|
1324 | One of ``basic`` or ``detailed``. | |
1324 | Default is ``basic``. |
|
1325 | Default is ``basic``. | |
1325 |
|
1326 | |||
1326 | ``mergemarkertemplate`` |
|
1327 | ``mergemarkertemplate`` | |
1327 | The template used to print the commit description next to each conflict |
|
1328 | The template used to print the commit description next to each conflict | |
1328 | marker during merge conflicts. See :hg:`help templates` for the template |
|
1329 | marker during merge conflicts. See :hg:`help templates` for the template | |
1329 | format. |
|
1330 | format. | |
1330 | Defaults to showing the hash, tags, branches, bookmarks, author, and |
|
1331 | Defaults to showing the hash, tags, branches, bookmarks, author, and | |
1331 | the first line of the commit description. |
|
1332 | the first line of the commit description. | |
1332 | You have to pay attention to encodings of managed files, if you |
|
1333 | You have to pay attention to encodings of managed files, if you | |
1333 | use non-ASCII characters in tags, branches, bookmarks, author |
|
1334 | use non-ASCII characters in tags, branches, bookmarks, author | |
1334 | and/or commit descriptions. At template expansion, non-ASCII |
|
1335 | and/or commit descriptions. At template expansion, non-ASCII | |
1335 | characters use the encoding specified by ``--encoding`` global |
|
1336 | characters use the encoding specified by ``--encoding`` global | |
1336 | option, ``HGENCODING`` or other locale setting environment |
|
1337 | option, ``HGENCODING`` or other locale setting environment | |
1337 | variables. The difference of encoding between merged file and |
|
1338 | variables. The difference of encoding between merged file and | |
1338 | conflict markers causes serious problem. |
|
1339 | conflict markers causes serious problem. | |
1339 |
|
1340 | |||
1340 | ``portablefilenames`` |
|
1341 | ``portablefilenames`` | |
1341 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1342 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1342 | Default is ``warn``. |
|
1343 | Default is ``warn``. | |
1343 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1344 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX | |
1344 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1345 | platforms, if a file with a non-portable filename is added (e.g. a file | |
1345 | with a name that can't be created on Windows because it contains reserved |
|
1346 | with a name that can't be created on Windows because it contains reserved | |
1346 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1347 | parts like ``AUX``, reserved characters like ``:``, or would cause a case | |
1347 | collision with an existing file). |
|
1348 | collision with an existing file). | |
1348 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1349 | If set to ``ignore`` (or ``false``), no warning is printed. | |
1349 | If set to ``abort``, the command is aborted. |
|
1350 | If set to ``abort``, the command is aborted. | |
1350 | On Windows, this configuration option is ignored and the command aborted. |
|
1351 | On Windows, this configuration option is ignored and the command aborted. | |
1351 |
|
1352 | |||
1352 | ``quiet`` |
|
1353 | ``quiet`` | |
1353 | Reduce the amount of output printed. True or False. Default is False. |
|
1354 | Reduce the amount of output printed. True or False. Default is False. | |
1354 |
|
1355 | |||
1355 | ``remotecmd`` |
|
1356 | ``remotecmd`` | |
1356 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
1357 | remote command to use for clone/push/pull operations. Default is ``hg``. | |
1357 |
|
1358 | |||
1358 | ``reportoldssl`` |
|
1359 | ``reportoldssl`` | |
1359 | Warn if an SSL certificate is unable to be due to using Python |
|
1360 | Warn if an SSL certificate is unable to be due to using Python | |
1360 | 2.5 or earlier. True or False. Default is True. |
|
1361 | 2.5 or earlier. True or False. Default is True. | |
1361 |
|
1362 | |||
1362 | ``report_untrusted`` |
|
1363 | ``report_untrusted`` | |
1363 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1364 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1364 | trusted user or group. True or False. Default is True. |
|
1365 | trusted user or group. True or False. Default is True. | |
1365 |
|
1366 | |||
1366 | ``slash`` |
|
1367 | ``slash`` | |
1367 | Display paths using a slash (``/``) as the path separator. This |
|
1368 | Display paths using a slash (``/``) as the path separator. This | |
1368 | only makes a difference on systems where the default path |
|
1369 | only makes a difference on systems where the default path | |
1369 | separator is not the slash character (e.g. Windows uses the |
|
1370 | separator is not the slash character (e.g. Windows uses the | |
1370 | backslash character (``\``)). |
|
1371 | backslash character (``\``)). | |
1371 | Default is False. |
|
1372 | Default is False. | |
1372 |
|
1373 | |||
1373 | ``ssh`` |
|
1374 | ``ssh`` | |
1374 | command to use for SSH connections. Default is ``ssh``. |
|
1375 | command to use for SSH connections. Default is ``ssh``. | |
1375 |
|
1376 | |||
1376 | ``strict`` |
|
1377 | ``strict`` | |
1377 | Require exact command names, instead of allowing unambiguous |
|
1378 | Require exact command names, instead of allowing unambiguous | |
1378 | abbreviations. True or False. Default is False. |
|
1379 | abbreviations. True or False. Default is False. | |
1379 |
|
1380 | |||
1380 | ``style`` |
|
1381 | ``style`` | |
1381 | Name of style to use for command output. |
|
1382 | Name of style to use for command output. | |
1382 |
|
1383 | |||
1383 | ``timeout`` |
|
1384 | ``timeout`` | |
1384 | The timeout used when a lock is held (in seconds), a negative value |
|
1385 | The timeout used when a lock is held (in seconds), a negative value | |
1385 | means no timeout. Default is 600. |
|
1386 | means no timeout. Default is 600. | |
1386 |
|
1387 | |||
1387 | ``traceback`` |
|
1388 | ``traceback`` | |
1388 | Mercurial always prints a traceback when an unknown exception |
|
1389 | Mercurial always prints a traceback when an unknown exception | |
1389 | occurs. Setting this to True will make Mercurial print a traceback |
|
1390 | occurs. Setting this to True will make Mercurial print a traceback | |
1390 | on all exceptions, even those recognized by Mercurial (such as |
|
1391 | on all exceptions, even those recognized by Mercurial (such as | |
1391 | IOError or MemoryError). Default is False. |
|
1392 | IOError or MemoryError). Default is False. | |
1392 |
|
1393 | |||
1393 | ``username`` |
|
1394 | ``username`` | |
1394 | The committer of a changeset created when running "commit". |
|
1395 | The committer of a changeset created when running "commit". | |
1395 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1396 | Typically a person's name and email address, e.g. ``Fred Widget | |
1396 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
1397 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If | |
1397 | the username in hgrc is empty, it has to be specified manually or |
|
1398 | the username in hgrc is empty, it has to be specified manually or | |
1398 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
1399 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set | |
1399 | ``username =`` in the system hgrc). Environment variables in the |
|
1400 | ``username =`` in the system hgrc). Environment variables in the | |
1400 | username are expanded. |
|
1401 | username are expanded. | |
1401 |
|
1402 | |||
1402 | ``verbose`` |
|
1403 | ``verbose`` | |
1403 | Increase the amount of output printed. True or False. Default is False. |
|
1404 | Increase the amount of output printed. True or False. Default is False. | |
1404 |
|
1405 | |||
1405 |
|
1406 | |||
1406 | ``web`` |
|
1407 | ``web`` | |
1407 | ------- |
|
1408 | ------- | |
1408 |
|
1409 | |||
1409 | Web interface configuration. The settings in this section apply to |
|
1410 | Web interface configuration. The settings in this section apply to | |
1410 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1411 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1411 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1412 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1412 | and WSGI). |
|
1413 | and WSGI). | |
1413 |
|
1414 | |||
1414 | The Mercurial webserver does no authentication (it does not prompt for |
|
1415 | The Mercurial webserver does no authentication (it does not prompt for | |
1415 | usernames and passwords to validate *who* users are), but it does do |
|
1416 | usernames and passwords to validate *who* users are), but it does do | |
1416 | authorization (it grants or denies access for *authenticated users* |
|
1417 | authorization (it grants or denies access for *authenticated users* | |
1417 | based on settings in this section). You must either configure your |
|
1418 | based on settings in this section). You must either configure your | |
1418 | webserver to do authentication for you, or disable the authorization |
|
1419 | webserver to do authentication for you, or disable the authorization | |
1419 | checks. |
|
1420 | checks. | |
1420 |
|
1421 | |||
1421 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1422 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1422 | you want it to accept pushes from anybody, you can use the following |
|
1423 | you want it to accept pushes from anybody, you can use the following | |
1423 | command line:: |
|
1424 | command line:: | |
1424 |
|
1425 | |||
1425 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1426 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1426 |
|
1427 | |||
1427 | Note that this will allow anybody to push anything to the server and |
|
1428 | Note that this will allow anybody to push anything to the server and | |
1428 | that this should not be used for public servers. |
|
1429 | that this should not be used for public servers. | |
1429 |
|
1430 | |||
1430 | The full set of options is: |
|
1431 | The full set of options is: | |
1431 |
|
1432 | |||
1432 | ``accesslog`` |
|
1433 | ``accesslog`` | |
1433 | Where to output the access log. Default is stdout. |
|
1434 | Where to output the access log. Default is stdout. | |
1434 |
|
1435 | |||
1435 | ``address`` |
|
1436 | ``address`` | |
1436 | Interface address to bind to. Default is all. |
|
1437 | Interface address to bind to. Default is all. | |
1437 |
|
1438 | |||
1438 | ``allow_archive`` |
|
1439 | ``allow_archive`` | |
1439 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1440 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1440 | Default is empty. |
|
1441 | Default is empty. | |
1441 |
|
1442 | |||
1442 | ``allowbz2`` |
|
1443 | ``allowbz2`` | |
1443 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1444 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1444 | revisions. |
|
1445 | revisions. | |
1445 | Default is False. |
|
1446 | Default is False. | |
1446 |
|
1447 | |||
1447 | ``allowgz`` |
|
1448 | ``allowgz`` | |
1448 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1449 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1449 | revisions. |
|
1450 | revisions. | |
1450 | Default is False. |
|
1451 | Default is False. | |
1451 |
|
1452 | |||
1452 | ``allowpull`` |
|
1453 | ``allowpull`` | |
1453 | Whether to allow pulling from the repository. Default is True. |
|
1454 | Whether to allow pulling from the repository. Default is True. | |
1454 |
|
1455 | |||
1455 | ``allow_push`` |
|
1456 | ``allow_push`` | |
1456 | Whether to allow pushing to the repository. If empty or not set, |
|
1457 | Whether to allow pushing to the repository. If empty or not set, | |
1457 | push is not allowed. If the special value ``*``, any remote user can |
|
1458 | push is not allowed. If the special value ``*``, any remote user can | |
1458 | push, including unauthenticated users. Otherwise, the remote user |
|
1459 | push, including unauthenticated users. Otherwise, the remote user | |
1459 | must have been authenticated, and the authenticated user name must |
|
1460 | must have been authenticated, and the authenticated user name must | |
1460 | be present in this list. The contents of the allow_push list are |
|
1461 | be present in this list. The contents of the allow_push list are | |
1461 | examined after the deny_push list. |
|
1462 | examined after the deny_push list. | |
1462 |
|
1463 | |||
1463 | ``allow_read`` |
|
1464 | ``allow_read`` | |
1464 | If the user has not already been denied repository access due to |
|
1465 | If the user has not already been denied repository access due to | |
1465 | the contents of deny_read, this list determines whether to grant |
|
1466 | the contents of deny_read, this list determines whether to grant | |
1466 | repository access to the user. If this list is not empty, and the |
|
1467 | repository access to the user. If this list is not empty, and the | |
1467 | user is unauthenticated or not present in the list, then access is |
|
1468 | user is unauthenticated or not present in the list, then access is | |
1468 | denied for the user. If the list is empty or not set, then access |
|
1469 | denied for the user. If the list is empty or not set, then access | |
1469 | is permitted to all users by default. Setting allow_read to the |
|
1470 | is permitted to all users by default. Setting allow_read to the | |
1470 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1471 | special value ``*`` is equivalent to it not being set (i.e. access | |
1471 | is permitted to all users). The contents of the allow_read list are |
|
1472 | is permitted to all users). The contents of the allow_read list are | |
1472 | examined after the deny_read list. |
|
1473 | examined after the deny_read list. | |
1473 |
|
1474 | |||
1474 | ``allowzip`` |
|
1475 | ``allowzip`` | |
1475 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1476 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1476 | revisions. Default is False. This feature creates temporary files. |
|
1477 | revisions. Default is False. This feature creates temporary files. | |
1477 |
|
1478 | |||
1478 | ``archivesubrepos`` |
|
1479 | ``archivesubrepos`` | |
1479 | Whether to recurse into subrepositories when archiving. Default is |
|
1480 | Whether to recurse into subrepositories when archiving. Default is | |
1480 | False. |
|
1481 | False. | |
1481 |
|
1482 | |||
1482 | ``baseurl`` |
|
1483 | ``baseurl`` | |
1483 | Base URL to use when publishing URLs in other locations, so |
|
1484 | Base URL to use when publishing URLs in other locations, so | |
1484 | third-party tools like email notification hooks can construct |
|
1485 | third-party tools like email notification hooks can construct | |
1485 | URLs. Example: ``http://hgserver/repos/``. |
|
1486 | URLs. Example: ``http://hgserver/repos/``. | |
1486 |
|
1487 | |||
1487 | ``cacerts`` |
|
1488 | ``cacerts`` | |
1488 | Path to file containing a list of PEM encoded certificate |
|
1489 | Path to file containing a list of PEM encoded certificate | |
1489 | authority certificates. Environment variables and ``~user`` |
|
1490 | authority certificates. Environment variables and ``~user`` | |
1490 | constructs are expanded in the filename. If specified on the |
|
1491 | constructs are expanded in the filename. If specified on the | |
1491 | client, then it will verify the identity of remote HTTPS servers |
|
1492 | client, then it will verify the identity of remote HTTPS servers | |
1492 | with these certificates. |
|
1493 | with these certificates. | |
1493 |
|
1494 | |||
1494 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1495 | This feature is only supported when using Python 2.6 or later. If you wish | |
1495 | to use it with earlier versions of Python, install the backported |
|
1496 | to use it with earlier versions of Python, install the backported | |
1496 | version of the ssl library that is available from |
|
1497 | version of the ssl library that is available from | |
1497 | ``http://pypi.python.org``. |
|
1498 | ``http://pypi.python.org``. | |
1498 |
|
1499 | |||
1499 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1500 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1500 | command line. |
|
1501 | command line. | |
1501 |
|
1502 | |||
1502 | You can use OpenSSL's CA certificate file if your platform has |
|
1503 | You can use OpenSSL's CA certificate file if your platform has | |
1503 | one. On most Linux systems this will be |
|
1504 | one. On most Linux systems this will be | |
1504 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1505 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1505 | generate this file manually. The form must be as follows:: |
|
1506 | generate this file manually. The form must be as follows:: | |
1506 |
|
1507 | |||
1507 | -----BEGIN CERTIFICATE----- |
|
1508 | -----BEGIN CERTIFICATE----- | |
1508 | ... (certificate in base64 PEM encoding) ... |
|
1509 | ... (certificate in base64 PEM encoding) ... | |
1509 | -----END CERTIFICATE----- |
|
1510 | -----END CERTIFICATE----- | |
1510 | -----BEGIN CERTIFICATE----- |
|
1511 | -----BEGIN CERTIFICATE----- | |
1511 | ... (certificate in base64 PEM encoding) ... |
|
1512 | ... (certificate in base64 PEM encoding) ... | |
1512 | -----END CERTIFICATE----- |
|
1513 | -----END CERTIFICATE----- | |
1513 |
|
1514 | |||
1514 | ``cache`` |
|
1515 | ``cache`` | |
1515 | Whether to support caching in hgweb. Defaults to True. |
|
1516 | Whether to support caching in hgweb. Defaults to True. | |
1516 |
|
1517 | |||
1517 | ``collapse`` |
|
1518 | ``collapse`` | |
1518 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1519 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1519 | a single level alongside repositories in the current path. With |
|
1520 | a single level alongside repositories in the current path. With | |
1520 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1521 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1521 | the current path are grouped behind navigable directory entries that |
|
1522 | the current path are grouped behind navigable directory entries that | |
1522 | lead to the locations of these repositories. In effect, this setting |
|
1523 | lead to the locations of these repositories. In effect, this setting | |
1523 | collapses each collection of repositories found within a subdirectory |
|
1524 | collapses each collection of repositories found within a subdirectory | |
1524 | into a single entry for that subdirectory. Default is False. |
|
1525 | into a single entry for that subdirectory. Default is False. | |
1525 |
|
1526 | |||
1526 | ``comparisoncontext`` |
|
1527 | ``comparisoncontext`` | |
1527 | Number of lines of context to show in side-by-side file comparison. If |
|
1528 | Number of lines of context to show in side-by-side file comparison. If | |
1528 | negative or the value ``full``, whole files are shown. Default is 5. |
|
1529 | negative or the value ``full``, whole files are shown. Default is 5. | |
1529 | This setting can be overridden by a ``context`` request parameter to the |
|
1530 | This setting can be overridden by a ``context`` request parameter to the | |
1530 | ``comparison`` command, taking the same values. |
|
1531 | ``comparison`` command, taking the same values. | |
1531 |
|
1532 | |||
1532 | ``contact`` |
|
1533 | ``contact`` | |
1533 | Name or email address of the person in charge of the repository. |
|
1534 | Name or email address of the person in charge of the repository. | |
1534 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
1535 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. | |
1535 |
|
1536 | |||
1536 | ``deny_push`` |
|
1537 | ``deny_push`` | |
1537 | Whether to deny pushing to the repository. If empty or not set, |
|
1538 | Whether to deny pushing to the repository. If empty or not set, | |
1538 | push is not denied. If the special value ``*``, all remote users are |
|
1539 | push is not denied. If the special value ``*``, all remote users are | |
1539 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1540 | denied push. Otherwise, unauthenticated users are all denied, and | |
1540 | any authenticated user name present in this list is also denied. The |
|
1541 | any authenticated user name present in this list is also denied. The | |
1541 | contents of the deny_push list are examined before the allow_push list. |
|
1542 | contents of the deny_push list are examined before the allow_push list. | |
1542 |
|
1543 | |||
1543 | ``deny_read`` |
|
1544 | ``deny_read`` | |
1544 | Whether to deny reading/viewing of the repository. If this list is |
|
1545 | Whether to deny reading/viewing of the repository. If this list is | |
1545 | not empty, unauthenticated users are all denied, and any |
|
1546 | not empty, unauthenticated users are all denied, and any | |
1546 | authenticated user name present in this list is also denied access to |
|
1547 | authenticated user name present in this list is also denied access to | |
1547 | the repository. If set to the special value ``*``, all remote users |
|
1548 | the repository. If set to the special value ``*``, all remote users | |
1548 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1549 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1549 | the determination of repository access depends on the presence and |
|
1550 | the determination of repository access depends on the presence and | |
1550 | content of the allow_read list (see description). If both |
|
1551 | content of the allow_read list (see description). If both | |
1551 | deny_read and allow_read are empty or not set, then access is |
|
1552 | deny_read and allow_read are empty or not set, then access is | |
1552 | permitted to all users by default. If the repository is being |
|
1553 | permitted to all users by default. If the repository is being | |
1553 | served via hgwebdir, denied users will not be able to see it in |
|
1554 | served via hgwebdir, denied users will not be able to see it in | |
1554 | the list of repositories. The contents of the deny_read list have |
|
1555 | the list of repositories. The contents of the deny_read list have | |
1555 | priority over (are examined before) the contents of the allow_read |
|
1556 | priority over (are examined before) the contents of the allow_read | |
1556 | list. |
|
1557 | list. | |
1557 |
|
1558 | |||
1558 | ``descend`` |
|
1559 | ``descend`` | |
1559 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1560 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1560 | directly in the current path will be shown (other repositories are still |
|
1561 | directly in the current path will be shown (other repositories are still | |
1561 | available from the index corresponding to their containing path). |
|
1562 | available from the index corresponding to their containing path). | |
1562 |
|
1563 | |||
1563 | ``description`` |
|
1564 | ``description`` | |
1564 | Textual description of the repository's purpose or contents. |
|
1565 | Textual description of the repository's purpose or contents. | |
1565 | Default is "unknown". |
|
1566 | Default is "unknown". | |
1566 |
|
1567 | |||
1567 | ``encoding`` |
|
1568 | ``encoding`` | |
1568 | Character encoding name. Default is the current locale charset. |
|
1569 | Character encoding name. Default is the current locale charset. | |
1569 | Example: "UTF-8" |
|
1570 | Example: "UTF-8" | |
1570 |
|
1571 | |||
1571 | ``errorlog`` |
|
1572 | ``errorlog`` | |
1572 | Where to output the error log. Default is stderr. |
|
1573 | Where to output the error log. Default is stderr. | |
1573 |
|
1574 | |||
1574 | ``guessmime`` |
|
1575 | ``guessmime`` | |
1575 | Control MIME types for raw download of file content. |
|
1576 | Control MIME types for raw download of file content. | |
1576 | Set to True to let hgweb guess the content type from the file |
|
1577 | Set to True to let hgweb guess the content type from the file | |
1577 | extension. This will serve HTML files as ``text/html`` and might |
|
1578 | extension. This will serve HTML files as ``text/html`` and might | |
1578 | allow cross-site scripting attacks when serving untrusted |
|
1579 | allow cross-site scripting attacks when serving untrusted | |
1579 | repositories. Default is False. |
|
1580 | repositories. Default is False. | |
1580 |
|
1581 | |||
1581 | ``hidden`` |
|
1582 | ``hidden`` | |
1582 | Whether to hide the repository in the hgwebdir index. |
|
1583 | Whether to hide the repository in the hgwebdir index. | |
1583 | Default is False. |
|
1584 | Default is False. | |
1584 |
|
1585 | |||
1585 | ``ipv6`` |
|
1586 | ``ipv6`` | |
1586 | Whether to use IPv6. Default is False. |
|
1587 | Whether to use IPv6. Default is False. | |
1587 |
|
1588 | |||
1588 | ``logoimg`` |
|
1589 | ``logoimg`` | |
1589 | File name of the logo image that some templates display on each page. |
|
1590 | File name of the logo image that some templates display on each page. | |
1590 | The file name is relative to ``staticurl``. That is, the full path to |
|
1591 | The file name is relative to ``staticurl``. That is, the full path to | |
1591 | the logo image is "staticurl/logoimg". |
|
1592 | the logo image is "staticurl/logoimg". | |
1592 | If unset, ``hglogo.png`` will be used. |
|
1593 | If unset, ``hglogo.png`` will be used. | |
1593 |
|
1594 | |||
1594 | ``logourl`` |
|
1595 | ``logourl`` | |
1595 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` |
|
1596 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` | |
1596 | will be used. |
|
1597 | will be used. | |
1597 |
|
1598 | |||
1598 | ``maxchanges`` |
|
1599 | ``maxchanges`` | |
1599 | Maximum number of changes to list on the changelog. Default is 10. |
|
1600 | Maximum number of changes to list on the changelog. Default is 10. | |
1600 |
|
1601 | |||
1601 | ``maxfiles`` |
|
1602 | ``maxfiles`` | |
1602 | Maximum number of files to list per changeset. Default is 10. |
|
1603 | Maximum number of files to list per changeset. Default is 10. | |
1603 |
|
1604 | |||
1604 | ``maxshortchanges`` |
|
1605 | ``maxshortchanges`` | |
1605 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1606 | Maximum number of changes to list on the shortlog, graph or filelog | |
1606 | pages. Default is 60. |
|
1607 | pages. Default is 60. | |
1607 |
|
1608 | |||
1608 | ``name`` |
|
1609 | ``name`` | |
1609 | Repository name to use in the web interface. Default is current |
|
1610 | Repository name to use in the web interface. Default is current | |
1610 | working directory. |
|
1611 | working directory. | |
1611 |
|
1612 | |||
1612 | ``port`` |
|
1613 | ``port`` | |
1613 | Port to listen on. Default is 8000. |
|
1614 | Port to listen on. Default is 8000. | |
1614 |
|
1615 | |||
1615 | ``prefix`` |
|
1616 | ``prefix`` | |
1616 | Prefix path to serve from. Default is '' (server root). |
|
1617 | Prefix path to serve from. Default is '' (server root). | |
1617 |
|
1618 | |||
1618 | ``push_ssl`` |
|
1619 | ``push_ssl`` | |
1619 | Whether to require that inbound pushes be transported over SSL to |
|
1620 | Whether to require that inbound pushes be transported over SSL to | |
1620 | prevent password sniffing. Default is True. |
|
1621 | prevent password sniffing. Default is True. | |
1621 |
|
1622 | |||
1622 | ``staticurl`` |
|
1623 | ``staticurl`` | |
1623 | Base URL to use for static files. If unset, static files (e.g. the |
|
1624 | Base URL to use for static files. If unset, static files (e.g. the | |
1624 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1625 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1625 | this setting to serve them directly with the HTTP server. |
|
1626 | this setting to serve them directly with the HTTP server. | |
1626 | Example: ``http://hgserver/static/``. |
|
1627 | Example: ``http://hgserver/static/``. | |
1627 |
|
1628 | |||
1628 | ``stripes`` |
|
1629 | ``stripes`` | |
1629 | How many lines a "zebra stripe" should span in multi-line output. |
|
1630 | How many lines a "zebra stripe" should span in multi-line output. | |
1630 | Default is 1; set to 0 to disable. |
|
1631 | Default is 1; set to 0 to disable. | |
1631 |
|
1632 | |||
1632 | ``style`` |
|
1633 | ``style`` | |
1633 | Which template map style to use. |
|
1634 | Which template map style to use. | |
1634 |
|
1635 | |||
1635 | ``templates`` |
|
1636 | ``templates`` | |
1636 | Where to find the HTML templates. Default is install path. |
|
1637 | Where to find the HTML templates. Default is install path. | |
1637 |
|
1638 | |||
1638 | ``websub`` |
|
1639 | ``websub`` | |
1639 | ---------- |
|
1640 | ---------- | |
1640 |
|
1641 | |||
1641 | Web substitution filter definition. You can use this section to |
|
1642 | Web substitution filter definition. You can use this section to | |
1642 | define a set of regular expression substitution patterns which |
|
1643 | define a set of regular expression substitution patterns which | |
1643 | let you automatically modify the hgweb server output. |
|
1644 | let you automatically modify the hgweb server output. | |
1644 |
|
1645 | |||
1645 | The default hgweb templates only apply these substitution patterns |
|
1646 | The default hgweb templates only apply these substitution patterns | |
1646 | on the revision description fields. You can apply them anywhere |
|
1647 | on the revision description fields. You can apply them anywhere | |
1647 | you want when you create your own templates by adding calls to the |
|
1648 | you want when you create your own templates by adding calls to the | |
1648 | "websub" filter (usually after calling the "escape" filter). |
|
1649 | "websub" filter (usually after calling the "escape" filter). | |
1649 |
|
1650 | |||
1650 | This can be used, for example, to convert issue references to links |
|
1651 | This can be used, for example, to convert issue references to links | |
1651 | to your issue tracker, or to convert "markdown-like" syntax into |
|
1652 | to your issue tracker, or to convert "markdown-like" syntax into | |
1652 | HTML (see the examples below). |
|
1653 | HTML (see the examples below). | |
1653 |
|
1654 | |||
1654 | Each entry in this section names a substitution filter. |
|
1655 | Each entry in this section names a substitution filter. | |
1655 | The value of each entry defines the substitution expression itself. |
|
1656 | The value of each entry defines the substitution expression itself. | |
1656 | The websub expressions follow the old interhg extension syntax, |
|
1657 | The websub expressions follow the old interhg extension syntax, | |
1657 | which in turn imitates the Unix sed replacement syntax:: |
|
1658 | which in turn imitates the Unix sed replacement syntax:: | |
1658 |
|
1659 | |||
1659 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
1660 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
1660 |
|
1661 | |||
1661 | You can use any separator other than "/". The final "i" is optional |
|
1662 | You can use any separator other than "/". The final "i" is optional | |
1662 | and indicates that the search must be case insensitive. |
|
1663 | and indicates that the search must be case insensitive. | |
1663 |
|
1664 | |||
1664 | Examples:: |
|
1665 | Examples:: | |
1665 |
|
1666 | |||
1666 | [websub] |
|
1667 | [websub] | |
1667 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
1668 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
1668 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
1669 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
1669 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
1670 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
1670 |
|
1671 | |||
1671 | ``worker`` |
|
1672 | ``worker`` | |
1672 | ---------- |
|
1673 | ---------- | |
1673 |
|
1674 | |||
1674 | Parallel master/worker configuration. We currently perform working |
|
1675 | Parallel master/worker configuration. We currently perform working | |
1675 | directory updates in parallel on Unix-like systems, which greatly |
|
1676 | directory updates in parallel on Unix-like systems, which greatly | |
1676 | helps performance. |
|
1677 | helps performance. | |
1677 |
|
1678 | |||
1678 | ``numcpus`` |
|
1679 | ``numcpus`` | |
1679 | Number of CPUs to use for parallel operations. Default is 4 or the |
|
1680 | Number of CPUs to use for parallel operations. Default is 4 or the | |
1680 | number of CPUs on the system, whichever is larger. A zero or |
|
1681 | number of CPUs on the system, whichever is larger. A zero or | |
1681 | negative value is treated as ``use the default``. |
|
1682 | negative value is treated as ``use the default``. |
@@ -1,478 +1,495 b'' | |||||
1 | $ HGFOO=BAR; export HGFOO |
|
1 | $ HGFOO=BAR; export HGFOO | |
2 | $ cat >> $HGRCPATH <<EOF |
|
2 | $ cat >> $HGRCPATH <<EOF | |
3 | > [alias] |
|
3 | > [alias] | |
4 | > # should clobber ci but not commit (issue2993) |
|
4 | > # should clobber ci but not commit (issue2993) | |
5 | > ci = version |
|
5 | > ci = version | |
6 | > myinit = init |
|
6 | > myinit = init | |
7 | > mycommit = commit |
|
7 | > mycommit = commit | |
8 | > optionalrepo = showconfig alias.myinit |
|
8 | > optionalrepo = showconfig alias.myinit | |
9 | > cleanstatus = status -c |
|
9 | > cleanstatus = status -c | |
10 | > unknown = bargle |
|
10 | > unknown = bargle | |
11 | > ambiguous = s |
|
11 | > ambiguous = s | |
12 | > recursive = recursive |
|
12 | > recursive = recursive | |
13 | > nodefinition = |
|
13 | > nodefinition = | |
14 | > noclosingquotation = ' |
|
14 | > noclosingquotation = ' | |
15 | > no--cwd = status --cwd elsewhere |
|
15 | > no--cwd = status --cwd elsewhere | |
16 | > no-R = status -R elsewhere |
|
16 | > no-R = status -R elsewhere | |
17 | > no--repo = status --repo elsewhere |
|
17 | > no--repo = status --repo elsewhere | |
18 | > no--repository = status --repository elsewhere |
|
18 | > no--repository = status --repository elsewhere | |
19 | > no--config = status --config a.config=1 |
|
19 | > no--config = status --config a.config=1 | |
20 | > mylog = log |
|
20 | > mylog = log | |
21 | > lognull = log -r null |
|
21 | > lognull = log -r null | |
22 | > shortlog = log --template '{rev} {node|short} | {date|isodate}\n' |
|
22 | > shortlog = log --template '{rev} {node|short} | {date|isodate}\n' | |
23 | > positional = log --template '{\$2} {\$1} | {date|isodate}\n' |
|
23 | > positional = log --template '{\$2} {\$1} | {date|isodate}\n' | |
24 | > dln = lognull --debug |
|
24 | > dln = lognull --debug | |
25 | > nousage = rollback |
|
25 | > nousage = rollback | |
26 | > put = export -r 0 -o "\$FOO/%R.diff" |
|
26 | > put = export -r 0 -o "\$FOO/%R.diff" | |
27 | > blank = !printf '\n' |
|
27 | > blank = !printf '\n' | |
28 | > self = !printf '\$0\n' |
|
28 | > self = !printf '\$0\n' | |
29 | > echoall = !printf '\$@\n' |
|
29 | > echoall = !printf '\$@\n' | |
30 | > echo1 = !printf '\$1\n' |
|
30 | > echo1 = !printf '\$1\n' | |
31 | > echo2 = !printf '\$2\n' |
|
31 | > echo2 = !printf '\$2\n' | |
32 | > echo13 = !printf '\$1 \$3\n' |
|
32 | > echo13 = !printf '\$1 \$3\n' | |
|
33 | > echotokens = !printf "%s\n" "\$@" | |||
33 | > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g' |
|
34 | > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g' | |
34 | > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g' |
|
35 | > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g' | |
35 | > rt = root |
|
36 | > rt = root | |
36 | > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n" |
|
37 | > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n" | |
37 | > idalias = id |
|
38 | > idalias = id | |
38 | > idaliaslong = id |
|
39 | > idaliaslong = id | |
39 | > idaliasshell = !echo test |
|
40 | > idaliasshell = !echo test | |
40 | > parentsshell1 = !echo one |
|
41 | > parentsshell1 = !echo one | |
41 | > parentsshell2 = !echo two |
|
42 | > parentsshell2 = !echo two | |
42 | > escaped1 = !printf 'test\$\$test\n' |
|
43 | > escaped1 = !printf 'test\$\$test\n' | |
43 | > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"' |
|
44 | > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"' | |
44 | > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"' |
|
45 | > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"' | |
45 | > escaped4 = !printf '\$\$0 \$\$@\n' |
|
46 | > escaped4 = !printf '\$\$0 \$\$@\n' | |
46 | > exit1 = !sh -c 'exit 1' |
|
47 | > exit1 = !sh -c 'exit 1' | |
47 | > |
|
48 | > | |
48 | > [defaults] |
|
49 | > [defaults] | |
49 | > mylog = -q |
|
50 | > mylog = -q | |
50 | > lognull = -q |
|
51 | > lognull = -q | |
51 | > log = -v |
|
52 | > log = -v | |
52 | > EOF |
|
53 | > EOF | |
53 |
|
54 | |||
54 |
|
55 | |||
55 | basic |
|
56 | basic | |
56 |
|
57 | |||
57 | $ hg myinit alias |
|
58 | $ hg myinit alias | |
58 |
|
59 | |||
59 |
|
60 | |||
60 | unknown |
|
61 | unknown | |
61 |
|
62 | |||
62 | $ hg unknown |
|
63 | $ hg unknown | |
63 | alias 'unknown' resolves to unknown command 'bargle' |
|
64 | alias 'unknown' resolves to unknown command 'bargle' | |
64 | [255] |
|
65 | [255] | |
65 | $ hg help unknown |
|
66 | $ hg help unknown | |
66 | alias 'unknown' resolves to unknown command 'bargle' |
|
67 | alias 'unknown' resolves to unknown command 'bargle' | |
67 |
|
68 | |||
68 |
|
69 | |||
69 | ambiguous |
|
70 | ambiguous | |
70 |
|
71 | |||
71 | $ hg ambiguous |
|
72 | $ hg ambiguous | |
72 | alias 'ambiguous' resolves to ambiguous command 's' |
|
73 | alias 'ambiguous' resolves to ambiguous command 's' | |
73 | [255] |
|
74 | [255] | |
74 | $ hg help ambiguous |
|
75 | $ hg help ambiguous | |
75 | alias 'ambiguous' resolves to ambiguous command 's' |
|
76 | alias 'ambiguous' resolves to ambiguous command 's' | |
76 |
|
77 | |||
77 |
|
78 | |||
78 | recursive |
|
79 | recursive | |
79 |
|
80 | |||
80 | $ hg recursive |
|
81 | $ hg recursive | |
81 | alias 'recursive' resolves to unknown command 'recursive' |
|
82 | alias 'recursive' resolves to unknown command 'recursive' | |
82 | [255] |
|
83 | [255] | |
83 | $ hg help recursive |
|
84 | $ hg help recursive | |
84 | alias 'recursive' resolves to unknown command 'recursive' |
|
85 | alias 'recursive' resolves to unknown command 'recursive' | |
85 |
|
86 | |||
86 |
|
87 | |||
87 | no definition |
|
88 | no definition | |
88 |
|
89 | |||
89 | $ hg nodef |
|
90 | $ hg nodef | |
90 | no definition for alias 'nodefinition' |
|
91 | no definition for alias 'nodefinition' | |
91 | [255] |
|
92 | [255] | |
92 | $ hg help nodef |
|
93 | $ hg help nodef | |
93 | no definition for alias 'nodefinition' |
|
94 | no definition for alias 'nodefinition' | |
94 |
|
95 | |||
95 |
|
96 | |||
96 | no closing quotation |
|
97 | no closing quotation | |
97 |
|
98 | |||
98 | $ hg noclosing |
|
99 | $ hg noclosing | |
99 | error in definition for alias 'noclosingquotation': No closing quotation |
|
100 | error in definition for alias 'noclosingquotation': No closing quotation | |
100 | [255] |
|
101 | [255] | |
101 | $ hg help noclosing |
|
102 | $ hg help noclosing | |
102 | error in definition for alias 'noclosingquotation': No closing quotation |
|
103 | error in definition for alias 'noclosingquotation': No closing quotation | |
103 |
|
104 | |||
104 |
|
105 | |||
105 | invalid options |
|
106 | invalid options | |
106 |
|
107 | |||
107 | $ hg no--cwd |
|
108 | $ hg no--cwd | |
108 | error in definition for alias 'no--cwd': --cwd may only be given on the command line |
|
109 | error in definition for alias 'no--cwd': --cwd may only be given on the command line | |
109 | [255] |
|
110 | [255] | |
110 | $ hg help no--cwd |
|
111 | $ hg help no--cwd | |
111 | error in definition for alias 'no--cwd': --cwd may only be given on the command line |
|
112 | error in definition for alias 'no--cwd': --cwd may only be given on the command line | |
112 | $ hg no-R |
|
113 | $ hg no-R | |
113 | error in definition for alias 'no-R': -R may only be given on the command line |
|
114 | error in definition for alias 'no-R': -R may only be given on the command line | |
114 | [255] |
|
115 | [255] | |
115 | $ hg help no-R |
|
116 | $ hg help no-R | |
116 | error in definition for alias 'no-R': -R may only be given on the command line |
|
117 | error in definition for alias 'no-R': -R may only be given on the command line | |
117 | $ hg no--repo |
|
118 | $ hg no--repo | |
118 | error in definition for alias 'no--repo': --repo may only be given on the command line |
|
119 | error in definition for alias 'no--repo': --repo may only be given on the command line | |
119 | [255] |
|
120 | [255] | |
120 | $ hg help no--repo |
|
121 | $ hg help no--repo | |
121 | error in definition for alias 'no--repo': --repo may only be given on the command line |
|
122 | error in definition for alias 'no--repo': --repo may only be given on the command line | |
122 | $ hg no--repository |
|
123 | $ hg no--repository | |
123 | error in definition for alias 'no--repository': --repository may only be given on the command line |
|
124 | error in definition for alias 'no--repository': --repository may only be given on the command line | |
124 | [255] |
|
125 | [255] | |
125 | $ hg help no--repository |
|
126 | $ hg help no--repository | |
126 | error in definition for alias 'no--repository': --repository may only be given on the command line |
|
127 | error in definition for alias 'no--repository': --repository may only be given on the command line | |
127 | $ hg no--config |
|
128 | $ hg no--config | |
128 | error in definition for alias 'no--config': --config may only be given on the command line |
|
129 | error in definition for alias 'no--config': --config may only be given on the command line | |
129 | [255] |
|
130 | [255] | |
130 |
|
131 | |||
131 | optional repository |
|
132 | optional repository | |
132 |
|
133 | |||
133 | #if no-outer-repo |
|
134 | #if no-outer-repo | |
134 | $ hg optionalrepo |
|
135 | $ hg optionalrepo | |
135 | init |
|
136 | init | |
136 | #endif |
|
137 | #endif | |
137 | $ cd alias |
|
138 | $ cd alias | |
138 | $ cat > .hg/hgrc <<EOF |
|
139 | $ cat > .hg/hgrc <<EOF | |
139 | > [alias] |
|
140 | > [alias] | |
140 | > myinit = init -q |
|
141 | > myinit = init -q | |
141 | > EOF |
|
142 | > EOF | |
142 | $ hg optionalrepo |
|
143 | $ hg optionalrepo | |
143 | init -q |
|
144 | init -q | |
144 |
|
145 | |||
145 | no usage |
|
146 | no usage | |
146 |
|
147 | |||
147 | $ hg nousage |
|
148 | $ hg nousage | |
148 | no rollback information available |
|
149 | no rollback information available | |
149 | [1] |
|
150 | [1] | |
150 |
|
151 | |||
151 | $ echo foo > foo |
|
152 | $ echo foo > foo | |
152 | $ hg commit -Amfoo |
|
153 | $ hg commit -Amfoo | |
153 | adding foo |
|
154 | adding foo | |
154 |
|
155 | |||
155 |
|
156 | |||
156 | with opts |
|
157 | with opts | |
157 |
|
158 | |||
158 | $ hg cleanst |
|
159 | $ hg cleanst | |
159 | C foo |
|
160 | C foo | |
160 |
|
161 | |||
161 |
|
162 | |||
162 | with opts and whitespace |
|
163 | with opts and whitespace | |
163 |
|
164 | |||
164 | $ hg shortlog |
|
165 | $ hg shortlog | |
165 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
166 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 | |
166 |
|
167 | |||
167 | positional arguments |
|
168 | positional arguments | |
168 |
|
169 | |||
169 | $ hg positional |
|
170 | $ hg positional | |
170 | abort: too few arguments for command alias |
|
171 | abort: too few arguments for command alias | |
171 | [255] |
|
172 | [255] | |
172 | $ hg positional a |
|
173 | $ hg positional a | |
173 | abort: too few arguments for command alias |
|
174 | abort: too few arguments for command alias | |
174 | [255] |
|
175 | [255] | |
175 | $ hg positional 'node|short' rev |
|
176 | $ hg positional 'node|short' rev | |
176 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
177 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 | |
177 |
|
178 | |||
178 | interaction with defaults |
|
179 | interaction with defaults | |
179 |
|
180 | |||
180 | $ hg mylog |
|
181 | $ hg mylog | |
181 | 0:e63c23eaa88a |
|
182 | 0:e63c23eaa88a | |
182 | $ hg lognull |
|
183 | $ hg lognull | |
183 | -1:000000000000 |
|
184 | -1:000000000000 | |
184 |
|
185 | |||
185 |
|
186 | |||
186 | properly recursive |
|
187 | properly recursive | |
187 |
|
188 | |||
188 | $ hg dln |
|
189 | $ hg dln | |
189 | changeset: -1:0000000000000000000000000000000000000000 |
|
190 | changeset: -1:0000000000000000000000000000000000000000 | |
190 | parent: -1:0000000000000000000000000000000000000000 |
|
191 | parent: -1:0000000000000000000000000000000000000000 | |
191 | parent: -1:0000000000000000000000000000000000000000 |
|
192 | parent: -1:0000000000000000000000000000000000000000 | |
192 | manifest: -1:0000000000000000000000000000000000000000 |
|
193 | manifest: -1:0000000000000000000000000000000000000000 | |
193 | user: |
|
194 | user: | |
194 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
195 | date: Thu Jan 01 00:00:00 1970 +0000 | |
195 | extra: branch=default |
|
196 | extra: branch=default | |
196 |
|
197 | |||
197 |
|
198 | |||
198 |
|
199 | |||
199 | path expanding |
|
200 | path expanding | |
200 |
|
201 | |||
201 | $ FOO=`pwd` hg put |
|
202 | $ FOO=`pwd` hg put | |
202 | $ cat 0.diff |
|
203 | $ cat 0.diff | |
203 | # HG changeset patch |
|
204 | # HG changeset patch | |
204 | # User test |
|
205 | # User test | |
205 | # Date 0 0 |
|
206 | # Date 0 0 | |
206 | # Thu Jan 01 00:00:00 1970 +0000 |
|
207 | # Thu Jan 01 00:00:00 1970 +0000 | |
207 | # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0 |
|
208 | # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0 | |
208 | # Parent 0000000000000000000000000000000000000000 |
|
209 | # Parent 0000000000000000000000000000000000000000 | |
209 | foo |
|
210 | foo | |
210 |
|
211 | |||
211 | diff -r 000000000000 -r e63c23eaa88a foo |
|
212 | diff -r 000000000000 -r e63c23eaa88a foo | |
212 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
213 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
213 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
214 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
214 | @@ -0,0 +1,1 @@ |
|
215 | @@ -0,0 +1,1 @@ | |
215 | +foo |
|
216 | +foo | |
216 |
|
217 | |||
217 |
|
218 | |||
218 | simple shell aliases |
|
219 | simple shell aliases | |
219 |
|
220 | |||
220 | $ hg blank |
|
221 | $ hg blank | |
221 |
|
222 | |||
222 | $ hg blank foo |
|
223 | $ hg blank foo | |
223 |
|
224 | |||
224 | $ hg self |
|
225 | $ hg self | |
225 | self |
|
226 | self | |
226 | $ hg echoall |
|
227 | $ hg echoall | |
227 |
|
228 | |||
228 | $ hg echoall foo |
|
229 | $ hg echoall foo | |
229 | foo |
|
230 | foo | |
230 | $ hg echoall 'test $2' foo |
|
231 | $ hg echoall 'test $2' foo | |
231 | test $2 foo |
|
232 | test $2 foo | |
232 | $ hg echoall 'test $@' foo '$@' |
|
233 | $ hg echoall 'test $@' foo '$@' | |
233 | test $@ foo $@ |
|
234 | test $@ foo $@ | |
234 | $ hg echoall 'test "$@"' foo '"$@"' |
|
235 | $ hg echoall 'test "$@"' foo '"$@"' | |
235 | test "$@" foo "$@" |
|
236 | test "$@" foo "$@" | |
236 | $ hg echo1 foo bar baz |
|
237 | $ hg echo1 foo bar baz | |
237 | foo |
|
238 | foo | |
238 | $ hg echo2 foo bar baz |
|
239 | $ hg echo2 foo bar baz | |
239 | bar |
|
240 | bar | |
240 | $ hg echo13 foo bar baz test |
|
241 | $ hg echo13 foo bar baz test | |
241 | foo baz |
|
242 | foo baz | |
242 | $ hg echo2 foo |
|
243 | $ hg echo2 foo | |
243 |
|
244 | |||
|
245 | $ hg echotokens | |||
|
246 | ||||
|
247 | $ hg echotokens foo 'bar $1 baz' | |||
|
248 | foo | |||
|
249 | bar $1 baz | |||
|
250 | $ hg echotokens 'test $2' foo | |||
|
251 | test $2 | |||
|
252 | foo | |||
|
253 | $ hg echotokens 'test $@' foo '$@' | |||
|
254 | test $@ | |||
|
255 | foo | |||
|
256 | $@ | |||
|
257 | $ hg echotokens 'test "$@"' foo '"$@"' | |||
|
258 | test "$@" | |||
|
259 | foo | |||
|
260 | "$@" | |||
244 | $ echo bar > bar |
|
261 | $ echo bar > bar | |
245 | $ hg commit -qA -m bar |
|
262 | $ hg commit -qA -m bar | |
246 | $ hg count . |
|
263 | $ hg count . | |
247 | 1 |
|
264 | 1 | |
248 | $ hg count 'branch(default)' |
|
265 | $ hg count 'branch(default)' | |
249 | 2 |
|
266 | 2 | |
250 | $ hg mcount -r '"branch(default)"' |
|
267 | $ hg mcount -r '"branch(default)"' | |
251 | 2 |
|
268 | 2 | |
252 |
|
269 | |||
253 | $ hg tglog |
|
270 | $ hg tglog | |
254 | @ 1:042423737847: 'bar' |
|
271 | @ 1:042423737847: 'bar' | |
255 | | |
|
272 | | | |
256 | o 0:e63c23eaa88a: 'foo' |
|
273 | o 0:e63c23eaa88a: 'foo' | |
257 |
|
274 | |||
258 |
|
275 | |||
259 |
|
276 | |||
260 | shadowing |
|
277 | shadowing | |
261 |
|
278 | |||
262 | $ hg i |
|
279 | $ hg i | |
263 | hg: command 'i' is ambiguous: |
|
280 | hg: command 'i' is ambiguous: | |
264 | idalias idaliaslong idaliasshell identify import incoming init |
|
281 | idalias idaliaslong idaliasshell identify import incoming init | |
265 | [255] |
|
282 | [255] | |
266 | $ hg id |
|
283 | $ hg id | |
267 | 042423737847 tip |
|
284 | 042423737847 tip | |
268 | $ hg ida |
|
285 | $ hg ida | |
269 | hg: command 'ida' is ambiguous: |
|
286 | hg: command 'ida' is ambiguous: | |
270 | idalias idaliaslong idaliasshell |
|
287 | idalias idaliaslong idaliasshell | |
271 | [255] |
|
288 | [255] | |
272 | $ hg idalias |
|
289 | $ hg idalias | |
273 | 042423737847 tip |
|
290 | 042423737847 tip | |
274 | $ hg idaliasl |
|
291 | $ hg idaliasl | |
275 | 042423737847 tip |
|
292 | 042423737847 tip | |
276 | $ hg idaliass |
|
293 | $ hg idaliass | |
277 | test |
|
294 | test | |
278 | $ hg parentsshell |
|
295 | $ hg parentsshell | |
279 | hg: command 'parentsshell' is ambiguous: |
|
296 | hg: command 'parentsshell' is ambiguous: | |
280 | parentsshell1 parentsshell2 |
|
297 | parentsshell1 parentsshell2 | |
281 | [255] |
|
298 | [255] | |
282 | $ hg parentsshell1 |
|
299 | $ hg parentsshell1 | |
283 | one |
|
300 | one | |
284 | $ hg parentsshell2 |
|
301 | $ hg parentsshell2 | |
285 | two |
|
302 | two | |
286 |
|
303 | |||
287 |
|
304 | |||
288 | shell aliases with global options |
|
305 | shell aliases with global options | |
289 |
|
306 | |||
290 | $ hg init sub |
|
307 | $ hg init sub | |
291 | $ cd sub |
|
308 | $ cd sub | |
292 | $ hg count 'branch(default)' |
|
309 | $ hg count 'branch(default)' | |
293 | abort: unknown revision 'default'! |
|
310 | abort: unknown revision 'default'! | |
294 | 0 |
|
311 | 0 | |
295 | $ hg -v count 'branch(default)' |
|
312 | $ hg -v count 'branch(default)' | |
296 | abort: unknown revision 'default'! |
|
313 | abort: unknown revision 'default'! | |
297 | 0 |
|
314 | 0 | |
298 | $ hg -R .. count 'branch(default)' |
|
315 | $ hg -R .. count 'branch(default)' | |
299 | abort: unknown revision 'default'! |
|
316 | abort: unknown revision 'default'! | |
300 | 0 |
|
317 | 0 | |
301 | $ hg --cwd .. count 'branch(default)' |
|
318 | $ hg --cwd .. count 'branch(default)' | |
302 | 2 |
|
319 | 2 | |
303 | $ hg echoall --cwd .. |
|
320 | $ hg echoall --cwd .. | |
304 |
|
321 | |||
305 |
|
322 | |||
306 |
|
323 | |||
307 | repo specific shell aliases |
|
324 | repo specific shell aliases | |
308 |
|
325 | |||
309 | $ cat >> .hg/hgrc <<EOF |
|
326 | $ cat >> .hg/hgrc <<EOF | |
310 | > [alias] |
|
327 | > [alias] | |
311 | > subalias = !echo sub |
|
328 | > subalias = !echo sub | |
312 | > EOF |
|
329 | > EOF | |
313 | $ cat >> ../.hg/hgrc <<EOF |
|
330 | $ cat >> ../.hg/hgrc <<EOF | |
314 | > [alias] |
|
331 | > [alias] | |
315 | > mainalias = !echo main |
|
332 | > mainalias = !echo main | |
316 | > EOF |
|
333 | > EOF | |
317 |
|
334 | |||
318 |
|
335 | |||
319 | shell alias defined in current repo |
|
336 | shell alias defined in current repo | |
320 |
|
337 | |||
321 | $ hg subalias |
|
338 | $ hg subalias | |
322 | sub |
|
339 | sub | |
323 | $ hg --cwd .. subalias > /dev/null |
|
340 | $ hg --cwd .. subalias > /dev/null | |
324 | hg: unknown command 'subalias' |
|
341 | hg: unknown command 'subalias' | |
325 | [255] |
|
342 | [255] | |
326 | $ hg -R .. subalias > /dev/null |
|
343 | $ hg -R .. subalias > /dev/null | |
327 | hg: unknown command 'subalias' |
|
344 | hg: unknown command 'subalias' | |
328 | [255] |
|
345 | [255] | |
329 |
|
346 | |||
330 |
|
347 | |||
331 | shell alias defined in other repo |
|
348 | shell alias defined in other repo | |
332 |
|
349 | |||
333 | $ hg mainalias > /dev/null |
|
350 | $ hg mainalias > /dev/null | |
334 | hg: unknown command 'mainalias' |
|
351 | hg: unknown command 'mainalias' | |
335 | [255] |
|
352 | [255] | |
336 | $ hg -R .. mainalias |
|
353 | $ hg -R .. mainalias | |
337 | main |
|
354 | main | |
338 | $ hg --cwd .. mainalias |
|
355 | $ hg --cwd .. mainalias | |
339 | main |
|
356 | main | |
340 |
|
357 | |||
341 |
|
358 | |||
342 | shell aliases with escaped $ chars |
|
359 | shell aliases with escaped $ chars | |
343 |
|
360 | |||
344 | $ hg escaped1 |
|
361 | $ hg escaped1 | |
345 | test$test |
|
362 | test$test | |
346 | $ hg escaped2 |
|
363 | $ hg escaped2 | |
347 | HGFOO is BAR |
|
364 | HGFOO is BAR | |
348 | $ hg escaped3 HGFOO |
|
365 | $ hg escaped3 HGFOO | |
349 | HGFOO is BAR |
|
366 | HGFOO is BAR | |
350 | $ hg escaped4 test |
|
367 | $ hg escaped4 test | |
351 | $0 $@ |
|
368 | $0 $@ | |
352 |
|
369 | |||
353 | abbreviated name, which matches against both shell alias and the |
|
370 | abbreviated name, which matches against both shell alias and the | |
354 | command provided extension, should be aborted. |
|
371 | command provided extension, should be aborted. | |
355 |
|
372 | |||
356 | $ cat >> .hg/hgrc <<EOF |
|
373 | $ cat >> .hg/hgrc <<EOF | |
357 | > [extensions] |
|
374 | > [extensions] | |
358 | > hgext.rebase = |
|
375 | > hgext.rebase = | |
359 | > [alias] |
|
376 | > [alias] | |
360 | > rebate = !echo this is rebate |
|
377 | > rebate = !echo this is rebate | |
361 | > EOF |
|
378 | > EOF | |
362 | $ hg reba |
|
379 | $ hg reba | |
363 | hg: command 'reba' is ambiguous: |
|
380 | hg: command 'reba' is ambiguous: | |
364 | rebase rebate |
|
381 | rebase rebate | |
365 | [255] |
|
382 | [255] | |
366 | $ hg rebat |
|
383 | $ hg rebat | |
367 | this is rebate |
|
384 | this is rebate | |
368 |
|
385 | |||
369 | invalid arguments |
|
386 | invalid arguments | |
370 |
|
387 | |||
371 | $ hg rt foo |
|
388 | $ hg rt foo | |
372 | hg rt: invalid arguments |
|
389 | hg rt: invalid arguments | |
373 | hg rt |
|
390 | hg rt | |
374 |
|
391 | |||
375 | alias for: hg root |
|
392 | alias for: hg root | |
376 |
|
393 | |||
377 | (use "hg rt -h" to show more help) |
|
394 | (use "hg rt -h" to show more help) | |
378 | [255] |
|
395 | [255] | |
379 |
|
396 | |||
380 | invalid global arguments for normal commands, aliases, and shell aliases |
|
397 | invalid global arguments for normal commands, aliases, and shell aliases | |
381 |
|
398 | |||
382 | $ hg --invalid root |
|
399 | $ hg --invalid root | |
383 | hg: option --invalid not recognized |
|
400 | hg: option --invalid not recognized | |
384 | Mercurial Distributed SCM |
|
401 | Mercurial Distributed SCM | |
385 |
|
402 | |||
386 | basic commands: |
|
403 | basic commands: | |
387 |
|
404 | |||
388 | add add the specified files on the next commit |
|
405 | add add the specified files on the next commit | |
389 | annotate show changeset information by line for each file |
|
406 | annotate show changeset information by line for each file | |
390 | clone make a copy of an existing repository |
|
407 | clone make a copy of an existing repository | |
391 | commit commit the specified files or all outstanding changes |
|
408 | commit commit the specified files or all outstanding changes | |
392 | diff diff repository (or selected files) |
|
409 | diff diff repository (or selected files) | |
393 | export dump the header and diffs for one or more changesets |
|
410 | export dump the header and diffs for one or more changesets | |
394 | forget forget the specified files on the next commit |
|
411 | forget forget the specified files on the next commit | |
395 | init create a new repository in the given directory |
|
412 | init create a new repository in the given directory | |
396 | log show revision history of entire repository or files |
|
413 | log show revision history of entire repository or files | |
397 | merge merge working directory with another revision |
|
414 | merge merge working directory with another revision | |
398 | pull pull changes from the specified source |
|
415 | pull pull changes from the specified source | |
399 | push push changes to the specified destination |
|
416 | push push changes to the specified destination | |
400 | remove remove the specified files on the next commit |
|
417 | remove remove the specified files on the next commit | |
401 | serve start stand-alone webserver |
|
418 | serve start stand-alone webserver | |
402 | status show changed files in the working directory |
|
419 | status show changed files in the working directory | |
403 | summary summarize working directory state |
|
420 | summary summarize working directory state | |
404 | update update working directory (or switch revisions) |
|
421 | update update working directory (or switch revisions) | |
405 |
|
422 | |||
406 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
423 | (use "hg help" for the full list of commands or "hg -v" for details) | |
407 | [255] |
|
424 | [255] | |
408 | $ hg --invalid mylog |
|
425 | $ hg --invalid mylog | |
409 | hg: option --invalid not recognized |
|
426 | hg: option --invalid not recognized | |
410 | Mercurial Distributed SCM |
|
427 | Mercurial Distributed SCM | |
411 |
|
428 | |||
412 | basic commands: |
|
429 | basic commands: | |
413 |
|
430 | |||
414 | add add the specified files on the next commit |
|
431 | add add the specified files on the next commit | |
415 | annotate show changeset information by line for each file |
|
432 | annotate show changeset information by line for each file | |
416 | clone make a copy of an existing repository |
|
433 | clone make a copy of an existing repository | |
417 | commit commit the specified files or all outstanding changes |
|
434 | commit commit the specified files or all outstanding changes | |
418 | diff diff repository (or selected files) |
|
435 | diff diff repository (or selected files) | |
419 | export dump the header and diffs for one or more changesets |
|
436 | export dump the header and diffs for one or more changesets | |
420 | forget forget the specified files on the next commit |
|
437 | forget forget the specified files on the next commit | |
421 | init create a new repository in the given directory |
|
438 | init create a new repository in the given directory | |
422 | log show revision history of entire repository or files |
|
439 | log show revision history of entire repository or files | |
423 | merge merge working directory with another revision |
|
440 | merge merge working directory with another revision | |
424 | pull pull changes from the specified source |
|
441 | pull pull changes from the specified source | |
425 | push push changes to the specified destination |
|
442 | push push changes to the specified destination | |
426 | remove remove the specified files on the next commit |
|
443 | remove remove the specified files on the next commit | |
427 | serve start stand-alone webserver |
|
444 | serve start stand-alone webserver | |
428 | status show changed files in the working directory |
|
445 | status show changed files in the working directory | |
429 | summary summarize working directory state |
|
446 | summary summarize working directory state | |
430 | update update working directory (or switch revisions) |
|
447 | update update working directory (or switch revisions) | |
431 |
|
448 | |||
432 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
449 | (use "hg help" for the full list of commands or "hg -v" for details) | |
433 | [255] |
|
450 | [255] | |
434 | $ hg --invalid blank |
|
451 | $ hg --invalid blank | |
435 | hg: option --invalid not recognized |
|
452 | hg: option --invalid not recognized | |
436 | Mercurial Distributed SCM |
|
453 | Mercurial Distributed SCM | |
437 |
|
454 | |||
438 | basic commands: |
|
455 | basic commands: | |
439 |
|
456 | |||
440 | add add the specified files on the next commit |
|
457 | add add the specified files on the next commit | |
441 | annotate show changeset information by line for each file |
|
458 | annotate show changeset information by line for each file | |
442 | clone make a copy of an existing repository |
|
459 | clone make a copy of an existing repository | |
443 | commit commit the specified files or all outstanding changes |
|
460 | commit commit the specified files or all outstanding changes | |
444 | diff diff repository (or selected files) |
|
461 | diff diff repository (or selected files) | |
445 | export dump the header and diffs for one or more changesets |
|
462 | export dump the header and diffs for one or more changesets | |
446 | forget forget the specified files on the next commit |
|
463 | forget forget the specified files on the next commit | |
447 | init create a new repository in the given directory |
|
464 | init create a new repository in the given directory | |
448 | log show revision history of entire repository or files |
|
465 | log show revision history of entire repository or files | |
449 | merge merge working directory with another revision |
|
466 | merge merge working directory with another revision | |
450 | pull pull changes from the specified source |
|
467 | pull pull changes from the specified source | |
451 | push push changes to the specified destination |
|
468 | push push changes to the specified destination | |
452 | remove remove the specified files on the next commit |
|
469 | remove remove the specified files on the next commit | |
453 | serve start stand-alone webserver |
|
470 | serve start stand-alone webserver | |
454 | status show changed files in the working directory |
|
471 | status show changed files in the working directory | |
455 | summary summarize working directory state |
|
472 | summary summarize working directory state | |
456 | update update working directory (or switch revisions) |
|
473 | update update working directory (or switch revisions) | |
457 |
|
474 | |||
458 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
475 | (use "hg help" for the full list of commands or "hg -v" for details) | |
459 | [255] |
|
476 | [255] | |
460 |
|
477 | |||
461 | This should show id: |
|
478 | This should show id: | |
462 |
|
479 | |||
463 | $ hg --config alias.log='id' log |
|
480 | $ hg --config alias.log='id' log | |
464 | 000000000000 tip |
|
481 | 000000000000 tip | |
465 |
|
482 | |||
466 | This shouldn't: |
|
483 | This shouldn't: | |
467 |
|
484 | |||
468 | $ hg --config alias.log='id' history |
|
485 | $ hg --config alias.log='id' history | |
469 |
|
486 | |||
470 | $ cd ../.. |
|
487 | $ cd ../.. | |
471 |
|
488 | |||
472 | return code of command and shell aliases: |
|
489 | return code of command and shell aliases: | |
473 |
|
490 | |||
474 | $ hg mycommit -R alias |
|
491 | $ hg mycommit -R alias | |
475 | nothing changed |
|
492 | nothing changed | |
476 | [1] |
|
493 | [1] | |
477 | $ hg exit1 |
|
494 | $ hg exit1 | |
478 | [1] |
|
495 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now