##// END OF EJS Templates
help: always show command help with -h (issue4240)...
Matt Mackall -
r21961:af15de67 stable
parent child Browse files
Show More
@@ -1,911 +1,911 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 class cmdalias(object):
334 class cmdalias(object):
335 def __init__(self, name, definition, cmdtable):
335 def __init__(self, name, definition, cmdtable):
336 self.name = self.cmd = name
336 self.name = self.cmd = name
337 self.cmdname = ''
337 self.cmdname = ''
338 self.definition = definition
338 self.definition = definition
339 self.args = []
339 self.args = []
340 self.opts = []
340 self.opts = []
341 self.help = ''
341 self.help = ''
342 self.norepo = True
342 self.norepo = True
343 self.optionalrepo = False
343 self.optionalrepo = False
344 self.badalias = False
344 self.badalias = False
345
345
346 try:
346 try:
347 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
347 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
348 for alias, e in cmdtable.iteritems():
348 for alias, e in cmdtable.iteritems():
349 if e is entry:
349 if e is entry:
350 self.cmd = alias
350 self.cmd = alias
351 break
351 break
352 self.shadows = True
352 self.shadows = True
353 except error.UnknownCommand:
353 except error.UnknownCommand:
354 self.shadows = False
354 self.shadows = False
355
355
356 if not self.definition:
356 if not self.definition:
357 def fn(ui, *args):
357 def fn(ui, *args):
358 ui.warn(_("no definition for alias '%s'\n") % self.name)
358 ui.warn(_("no definition for alias '%s'\n") % self.name)
359 return -1
359 return -1
360 self.fn = fn
360 self.fn = fn
361 self.badalias = True
361 self.badalias = True
362 return
362 return
363
363
364 if self.definition.startswith('!'):
364 if self.definition.startswith('!'):
365 self.shell = True
365 self.shell = True
366 def fn(ui, *args):
366 def fn(ui, *args):
367 env = {'HG_ARGS': ' '.join((self.name,) + args)}
367 env = {'HG_ARGS': ' '.join((self.name,) + args)}
368 def _checkvar(m):
368 def _checkvar(m):
369 if m.groups()[0] == '$':
369 if m.groups()[0] == '$':
370 return m.group()
370 return m.group()
371 elif int(m.groups()[0]) <= len(args):
371 elif int(m.groups()[0]) <= len(args):
372 return m.group()
372 return m.group()
373 else:
373 else:
374 ui.debug("No argument found for substitution "
374 ui.debug("No argument found for substitution "
375 "of %i variable in alias '%s' definition."
375 "of %i variable in alias '%s' definition."
376 % (int(m.groups()[0]), self.name))
376 % (int(m.groups()[0]), self.name))
377 return ''
377 return ''
378 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
378 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
379 replace = dict((str(i + 1), arg) for i, arg in enumerate(args))
379 replace = dict((str(i + 1), arg) for i, arg in enumerate(args))
380 replace['0'] = self.name
380 replace['0'] = self.name
381 replace['@'] = ' '.join(args)
381 replace['@'] = ' '.join(args)
382 cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True)
382 cmd = util.interpolate(r'\$', replace, cmd, escape_prefix=True)
383 return util.system(cmd, environ=env, out=ui.fout)
383 return util.system(cmd, environ=env, out=ui.fout)
384 self.fn = fn
384 self.fn = fn
385 return
385 return
386
386
387 try:
387 try:
388 args = shlex.split(self.definition)
388 args = shlex.split(self.definition)
389 except ValueError, inst:
389 except ValueError, inst:
390 def fn(ui, *args):
390 def fn(ui, *args):
391 ui.warn(_("error in definition for alias '%s': %s\n")
391 ui.warn(_("error in definition for alias '%s': %s\n")
392 % (self.name, inst))
392 % (self.name, inst))
393 return -1
393 return -1
394 self.fn = fn
394 self.fn = fn
395 self.badalias = True
395 self.badalias = True
396 return
396 return
397 self.cmdname = cmd = args.pop(0)
397 self.cmdname = cmd = args.pop(0)
398 args = map(util.expandpath, args)
398 args = map(util.expandpath, args)
399
399
400 for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"):
400 for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"):
401 if _earlygetopt([invalidarg], args):
401 if _earlygetopt([invalidarg], args):
402 def fn(ui, *args):
402 def fn(ui, *args):
403 ui.warn(_("error in definition for alias '%s': %s may only "
403 ui.warn(_("error in definition for alias '%s': %s may only "
404 "be given on the command line\n")
404 "be given on the command line\n")
405 % (self.name, invalidarg))
405 % (self.name, invalidarg))
406 return -1
406 return -1
407
407
408 self.fn = fn
408 self.fn = fn
409 self.badalias = True
409 self.badalias = True
410 return
410 return
411
411
412 try:
412 try:
413 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
413 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
414 if len(tableentry) > 2:
414 if len(tableentry) > 2:
415 self.fn, self.opts, self.help = tableentry
415 self.fn, self.opts, self.help = tableentry
416 else:
416 else:
417 self.fn, self.opts = tableentry
417 self.fn, self.opts = tableentry
418
418
419 self.args = aliasargs(self.fn, args)
419 self.args = aliasargs(self.fn, args)
420 if cmd not in commands.norepo.split(' '):
420 if cmd not in commands.norepo.split(' '):
421 self.norepo = False
421 self.norepo = False
422 if cmd in commands.optionalrepo.split(' '):
422 if cmd in commands.optionalrepo.split(' '):
423 self.optionalrepo = True
423 self.optionalrepo = True
424 if self.help.startswith("hg " + cmd):
424 if self.help.startswith("hg " + cmd):
425 # drop prefix in old-style help lines so hg shows the alias
425 # drop prefix in old-style help lines so hg shows the alias
426 self.help = self.help[4 + len(cmd):]
426 self.help = self.help[4 + len(cmd):]
427 self.__doc__ = self.fn.__doc__
427 self.__doc__ = self.fn.__doc__
428
428
429 except error.UnknownCommand:
429 except error.UnknownCommand:
430 def fn(ui, *args):
430 def fn(ui, *args):
431 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
431 ui.warn(_("alias '%s' resolves to unknown command '%s'\n") \
432 % (self.name, cmd))
432 % (self.name, cmd))
433 try:
433 try:
434 # check if the command is in a disabled extension
434 # check if the command is in a disabled extension
435 commands.help_(ui, cmd, unknowncmd=True)
435 commands.help_(ui, cmd, unknowncmd=True)
436 except error.UnknownCommand:
436 except error.UnknownCommand:
437 pass
437 pass
438 return -1
438 return -1
439 self.fn = fn
439 self.fn = fn
440 self.badalias = True
440 self.badalias = True
441 except error.AmbiguousCommand:
441 except error.AmbiguousCommand:
442 def fn(ui, *args):
442 def fn(ui, *args):
443 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
443 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
444 % (self.name, cmd))
444 % (self.name, cmd))
445 return -1
445 return -1
446 self.fn = fn
446 self.fn = fn
447 self.badalias = True
447 self.badalias = True
448
448
449 def __call__(self, ui, *args, **opts):
449 def __call__(self, ui, *args, **opts):
450 if self.shadows:
450 if self.shadows:
451 ui.debug("alias '%s' shadows command '%s'\n" %
451 ui.debug("alias '%s' shadows command '%s'\n" %
452 (self.name, self.cmdname))
452 (self.name, self.cmdname))
453
453
454 if util.safehasattr(self, 'shell'):
454 if util.safehasattr(self, 'shell'):
455 return self.fn(ui, *args, **opts)
455 return self.fn(ui, *args, **opts)
456 else:
456 else:
457 try:
457 try:
458 return util.checksignature(self.fn)(ui, *args, **opts)
458 return util.checksignature(self.fn)(ui, *args, **opts)
459 except error.SignatureError:
459 except error.SignatureError:
460 args = ' '.join([self.cmdname] + self.args)
460 args = ' '.join([self.cmdname] + self.args)
461 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
461 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
462 raise
462 raise
463
463
464 def addaliases(ui, cmdtable):
464 def addaliases(ui, cmdtable):
465 # aliases are processed after extensions have been loaded, so they
465 # aliases are processed after extensions have been loaded, so they
466 # may use extension commands. Aliases can also use other alias definitions,
466 # may use extension commands. Aliases can also use other alias definitions,
467 # but only if they have been defined prior to the current definition.
467 # but only if they have been defined prior to the current definition.
468 for alias, definition in ui.configitems('alias'):
468 for alias, definition in ui.configitems('alias'):
469 aliasdef = cmdalias(alias, definition, cmdtable)
469 aliasdef = cmdalias(alias, definition, cmdtable)
470
470
471 try:
471 try:
472 olddef = cmdtable[aliasdef.cmd][0]
472 olddef = cmdtable[aliasdef.cmd][0]
473 if olddef.definition == aliasdef.definition:
473 if olddef.definition == aliasdef.definition:
474 continue
474 continue
475 except (KeyError, AttributeError):
475 except (KeyError, AttributeError):
476 # definition might not exist or it might not be a cmdalias
476 # definition might not exist or it might not be a cmdalias
477 pass
477 pass
478
478
479 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
479 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
480 if aliasdef.norepo:
480 if aliasdef.norepo:
481 commands.norepo += ' %s' % alias
481 commands.norepo += ' %s' % alias
482 if aliasdef.optionalrepo:
482 if aliasdef.optionalrepo:
483 commands.optionalrepo += ' %s' % alias
483 commands.optionalrepo += ' %s' % alias
484
484
485 def _parse(ui, args):
485 def _parse(ui, args):
486 options = {}
486 options = {}
487 cmdoptions = {}
487 cmdoptions = {}
488
488
489 try:
489 try:
490 args = fancyopts.fancyopts(args, commands.globalopts, options)
490 args = fancyopts.fancyopts(args, commands.globalopts, options)
491 except fancyopts.getopt.GetoptError, inst:
491 except fancyopts.getopt.GetoptError, inst:
492 raise error.CommandError(None, inst)
492 raise error.CommandError(None, inst)
493
493
494 if args:
494 if args:
495 cmd, args = args[0], args[1:]
495 cmd, args = args[0], args[1:]
496 aliases, entry = cmdutil.findcmd(cmd, commands.table,
496 aliases, entry = cmdutil.findcmd(cmd, commands.table,
497 ui.configbool("ui", "strict"))
497 ui.configbool("ui", "strict"))
498 cmd = aliases[0]
498 cmd = aliases[0]
499 args = aliasargs(entry[0], args)
499 args = aliasargs(entry[0], args)
500 defaults = ui.config("defaults", cmd)
500 defaults = ui.config("defaults", cmd)
501 if defaults:
501 if defaults:
502 args = map(util.expandpath, shlex.split(defaults)) + args
502 args = map(util.expandpath, shlex.split(defaults)) + args
503 c = list(entry[1])
503 c = list(entry[1])
504 else:
504 else:
505 cmd = None
505 cmd = None
506 c = []
506 c = []
507
507
508 # combine global options into local
508 # combine global options into local
509 for o in commands.globalopts:
509 for o in commands.globalopts:
510 c.append((o[0], o[1], options[o[1]], o[3]))
510 c.append((o[0], o[1], options[o[1]], o[3]))
511
511
512 try:
512 try:
513 args = fancyopts.fancyopts(args, c, cmdoptions, True)
513 args = fancyopts.fancyopts(args, c, cmdoptions, True)
514 except fancyopts.getopt.GetoptError, inst:
514 except fancyopts.getopt.GetoptError, inst:
515 raise error.CommandError(cmd, inst)
515 raise error.CommandError(cmd, inst)
516
516
517 # separate global options back out
517 # separate global options back out
518 for o in commands.globalopts:
518 for o in commands.globalopts:
519 n = o[1]
519 n = o[1]
520 options[n] = cmdoptions[n]
520 options[n] = cmdoptions[n]
521 del cmdoptions[n]
521 del cmdoptions[n]
522
522
523 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
523 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
524
524
525 def _parseconfig(ui, config):
525 def _parseconfig(ui, config):
526 """parse the --config options from the command line"""
526 """parse the --config options from the command line"""
527 configs = []
527 configs = []
528
528
529 for cfg in config:
529 for cfg in config:
530 try:
530 try:
531 name, value = cfg.split('=', 1)
531 name, value = cfg.split('=', 1)
532 section, name = name.split('.', 1)
532 section, name = name.split('.', 1)
533 if not section or not name:
533 if not section or not name:
534 raise IndexError
534 raise IndexError
535 ui.setconfig(section, name, value, '--config')
535 ui.setconfig(section, name, value, '--config')
536 configs.append((section, name, value))
536 configs.append((section, name, value))
537 except (IndexError, ValueError):
537 except (IndexError, ValueError):
538 raise util.Abort(_('malformed --config option: %r '
538 raise util.Abort(_('malformed --config option: %r '
539 '(use --config section.name=value)') % cfg)
539 '(use --config section.name=value)') % cfg)
540
540
541 return configs
541 return configs
542
542
543 def _earlygetopt(aliases, args):
543 def _earlygetopt(aliases, args):
544 """Return list of values for an option (or aliases).
544 """Return list of values for an option (or aliases).
545
545
546 The values are listed in the order they appear in args.
546 The values are listed in the order they appear in args.
547 The options and values are removed from args.
547 The options and values are removed from args.
548
548
549 >>> args = ['x', '--cwd', 'foo', 'y']
549 >>> args = ['x', '--cwd', 'foo', 'y']
550 >>> _earlygetopt(['--cwd'], args), args
550 >>> _earlygetopt(['--cwd'], args), args
551 (['foo'], ['x', 'y'])
551 (['foo'], ['x', 'y'])
552
552
553 >>> args = ['x', '--cwd=bar', 'y']
553 >>> args = ['x', '--cwd=bar', 'y']
554 >>> _earlygetopt(['--cwd'], args), args
554 >>> _earlygetopt(['--cwd'], args), args
555 (['bar'], ['x', 'y'])
555 (['bar'], ['x', 'y'])
556
556
557 >>> args = ['x', '-R', 'foo', 'y']
557 >>> args = ['x', '-R', 'foo', 'y']
558 >>> _earlygetopt(['-R'], args), args
558 >>> _earlygetopt(['-R'], args), args
559 (['foo'], ['x', 'y'])
559 (['foo'], ['x', 'y'])
560
560
561 >>> args = ['x', '-Rbar', 'y']
561 >>> args = ['x', '-Rbar', 'y']
562 >>> _earlygetopt(['-R'], args), args
562 >>> _earlygetopt(['-R'], args), args
563 (['bar'], ['x', 'y'])
563 (['bar'], ['x', 'y'])
564 """
564 """
565 try:
565 try:
566 argcount = args.index("--")
566 argcount = args.index("--")
567 except ValueError:
567 except ValueError:
568 argcount = len(args)
568 argcount = len(args)
569 shortopts = [opt for opt in aliases if len(opt) == 2]
569 shortopts = [opt for opt in aliases if len(opt) == 2]
570 values = []
570 values = []
571 pos = 0
571 pos = 0
572 while pos < argcount:
572 while pos < argcount:
573 fullarg = arg = args[pos]
573 fullarg = arg = args[pos]
574 equals = arg.find('=')
574 equals = arg.find('=')
575 if equals > -1:
575 if equals > -1:
576 arg = arg[:equals]
576 arg = arg[:equals]
577 if arg in aliases:
577 if arg in aliases:
578 del args[pos]
578 del args[pos]
579 if equals > -1:
579 if equals > -1:
580 values.append(fullarg[equals + 1:])
580 values.append(fullarg[equals + 1:])
581 argcount -= 1
581 argcount -= 1
582 else:
582 else:
583 if pos + 1 >= argcount:
583 if pos + 1 >= argcount:
584 # ignore and let getopt report an error if there is no value
584 # ignore and let getopt report an error if there is no value
585 break
585 break
586 values.append(args.pop(pos))
586 values.append(args.pop(pos))
587 argcount -= 2
587 argcount -= 2
588 elif arg[:2] in shortopts:
588 elif arg[:2] in shortopts:
589 # short option can have no following space, e.g. hg log -Rfoo
589 # short option can have no following space, e.g. hg log -Rfoo
590 values.append(args.pop(pos)[2:])
590 values.append(args.pop(pos)[2:])
591 argcount -= 1
591 argcount -= 1
592 else:
592 else:
593 pos += 1
593 pos += 1
594 return values
594 return values
595
595
596 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
596 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
597 # run pre-hook, and abort if it fails
597 # run pre-hook, and abort if it fails
598 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs),
598 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs),
599 pats=cmdpats, opts=cmdoptions)
599 pats=cmdpats, opts=cmdoptions)
600 ret = _runcommand(ui, options, cmd, d)
600 ret = _runcommand(ui, options, cmd, d)
601 # run post-hook, passing command result
601 # run post-hook, passing command result
602 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
602 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
603 result=ret, pats=cmdpats, opts=cmdoptions)
603 result=ret, pats=cmdpats, opts=cmdoptions)
604 return ret
604 return ret
605
605
606 def _getlocal(ui, rpath):
606 def _getlocal(ui, rpath):
607 """Return (path, local ui object) for the given target path.
607 """Return (path, local ui object) for the given target path.
608
608
609 Takes paths in [cwd]/.hg/hgrc into account."
609 Takes paths in [cwd]/.hg/hgrc into account."
610 """
610 """
611 try:
611 try:
612 wd = os.getcwd()
612 wd = os.getcwd()
613 except OSError, e:
613 except OSError, e:
614 raise util.Abort(_("error getting current working directory: %s") %
614 raise util.Abort(_("error getting current working directory: %s") %
615 e.strerror)
615 e.strerror)
616 path = cmdutil.findrepo(wd) or ""
616 path = cmdutil.findrepo(wd) or ""
617 if not path:
617 if not path:
618 lui = ui
618 lui = ui
619 else:
619 else:
620 lui = ui.copy()
620 lui = ui.copy()
621 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
621 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
622
622
623 if rpath and rpath[-1]:
623 if rpath and rpath[-1]:
624 path = lui.expandpath(rpath[-1])
624 path = lui.expandpath(rpath[-1])
625 lui = ui.copy()
625 lui = ui.copy()
626 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
626 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
627
627
628 return path, lui
628 return path, lui
629
629
630 def _checkshellalias(lui, ui, args):
630 def _checkshellalias(lui, ui, args):
631 options = {}
631 options = {}
632
632
633 try:
633 try:
634 args = fancyopts.fancyopts(args, commands.globalopts, options)
634 args = fancyopts.fancyopts(args, commands.globalopts, options)
635 except fancyopts.getopt.GetoptError:
635 except fancyopts.getopt.GetoptError:
636 return
636 return
637
637
638 if not args:
638 if not args:
639 return
639 return
640
640
641 norepo = commands.norepo
641 norepo = commands.norepo
642 optionalrepo = commands.optionalrepo
642 optionalrepo = commands.optionalrepo
643 def restorecommands():
643 def restorecommands():
644 commands.norepo = norepo
644 commands.norepo = norepo
645 commands.optionalrepo = optionalrepo
645 commands.optionalrepo = optionalrepo
646
646
647 cmdtable = commands.table.copy()
647 cmdtable = commands.table.copy()
648 addaliases(lui, cmdtable)
648 addaliases(lui, cmdtable)
649
649
650 cmd = args[0]
650 cmd = args[0]
651 try:
651 try:
652 aliases, entry = cmdutil.findcmd(cmd, cmdtable)
652 aliases, entry = cmdutil.findcmd(cmd, cmdtable)
653 except (error.AmbiguousCommand, error.UnknownCommand):
653 except (error.AmbiguousCommand, error.UnknownCommand):
654 restorecommands()
654 restorecommands()
655 return
655 return
656
656
657 cmd = aliases[0]
657 cmd = aliases[0]
658 fn = entry[0]
658 fn = entry[0]
659
659
660 if cmd and util.safehasattr(fn, 'shell'):
660 if cmd and util.safehasattr(fn, 'shell'):
661 d = lambda: fn(ui, *args[1:])
661 d = lambda: fn(ui, *args[1:])
662 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
662 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
663 [], {})
663 [], {})
664
664
665 restorecommands()
665 restorecommands()
666
666
667 _loaded = set()
667 _loaded = set()
668 def _dispatch(req):
668 def _dispatch(req):
669 args = req.args
669 args = req.args
670 ui = req.ui
670 ui = req.ui
671
671
672 # check for cwd
672 # check for cwd
673 cwd = _earlygetopt(['--cwd'], args)
673 cwd = _earlygetopt(['--cwd'], args)
674 if cwd:
674 if cwd:
675 os.chdir(cwd[-1])
675 os.chdir(cwd[-1])
676
676
677 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
677 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
678 path, lui = _getlocal(ui, rpath)
678 path, lui = _getlocal(ui, rpath)
679
679
680 # Now that we're operating in the right directory/repository with
680 # Now that we're operating in the right directory/repository with
681 # the right config settings, check for shell aliases
681 # the right config settings, check for shell aliases
682 shellaliasfn = _checkshellalias(lui, ui, args)
682 shellaliasfn = _checkshellalias(lui, ui, args)
683 if shellaliasfn:
683 if shellaliasfn:
684 return shellaliasfn()
684 return shellaliasfn()
685
685
686 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
686 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
687 # reposetup. Programs like TortoiseHg will call _dispatch several
687 # reposetup. Programs like TortoiseHg will call _dispatch several
688 # times so we keep track of configured extensions in _loaded.
688 # times so we keep track of configured extensions in _loaded.
689 extensions.loadall(lui)
689 extensions.loadall(lui)
690 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
690 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
691 # Propagate any changes to lui.__class__ by extensions
691 # Propagate any changes to lui.__class__ by extensions
692 ui.__class__ = lui.__class__
692 ui.__class__ = lui.__class__
693
693
694 # (uisetup and extsetup are handled in extensions.loadall)
694 # (uisetup and extsetup are handled in extensions.loadall)
695
695
696 for name, module in exts:
696 for name, module in exts:
697 cmdtable = getattr(module, 'cmdtable', {})
697 cmdtable = getattr(module, 'cmdtable', {})
698 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
698 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
699 if overrides:
699 if overrides:
700 ui.warn(_("extension '%s' overrides commands: %s\n")
700 ui.warn(_("extension '%s' overrides commands: %s\n")
701 % (name, " ".join(overrides)))
701 % (name, " ".join(overrides)))
702 commands.table.update(cmdtable)
702 commands.table.update(cmdtable)
703 _loaded.add(name)
703 _loaded.add(name)
704
704
705 # (reposetup is handled in hg.repository)
705 # (reposetup is handled in hg.repository)
706
706
707 addaliases(lui, commands.table)
707 addaliases(lui, commands.table)
708
708
709 # check for fallback encoding
709 # check for fallback encoding
710 fallback = lui.config('ui', 'fallbackencoding')
710 fallback = lui.config('ui', 'fallbackencoding')
711 if fallback:
711 if fallback:
712 encoding.fallbackencoding = fallback
712 encoding.fallbackencoding = fallback
713
713
714 fullargs = args
714 fullargs = args
715 cmd, func, args, options, cmdoptions = _parse(lui, args)
715 cmd, func, args, options, cmdoptions = _parse(lui, args)
716
716
717 if options["config"]:
717 if options["config"]:
718 raise util.Abort(_("option --config may not be abbreviated!"))
718 raise util.Abort(_("option --config may not be abbreviated!"))
719 if options["cwd"]:
719 if options["cwd"]:
720 raise util.Abort(_("option --cwd may not be abbreviated!"))
720 raise util.Abort(_("option --cwd may not be abbreviated!"))
721 if options["repository"]:
721 if options["repository"]:
722 raise util.Abort(_(
722 raise util.Abort(_(
723 "option -R has to be separated from other options (e.g. not -qR) "
723 "option -R has to be separated from other options (e.g. not -qR) "
724 "and --repository may only be abbreviated as --repo!"))
724 "and --repository may only be abbreviated as --repo!"))
725
725
726 if options["encoding"]:
726 if options["encoding"]:
727 encoding.encoding = options["encoding"]
727 encoding.encoding = options["encoding"]
728 if options["encodingmode"]:
728 if options["encodingmode"]:
729 encoding.encodingmode = options["encodingmode"]
729 encoding.encodingmode = options["encodingmode"]
730 if options["time"]:
730 if options["time"]:
731 def get_times():
731 def get_times():
732 t = os.times()
732 t = os.times()
733 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
733 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())
734 t = (t[0], t[1], t[2], t[3], time.clock())
735 return t
735 return t
736 s = get_times()
736 s = get_times()
737 def print_time():
737 def print_time():
738 t = get_times()
738 t = get_times()
739 ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
739 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]))
740 (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)
741 atexit.register(print_time)
742
742
743 uis = set([ui, lui])
743 uis = set([ui, lui])
744
744
745 if req.repo:
745 if req.repo:
746 uis.add(req.repo.ui)
746 uis.add(req.repo.ui)
747
747
748 if options['verbose'] or options['debug'] or options['quiet']:
748 if options['verbose'] or options['debug'] or options['quiet']:
749 for opt in ('verbose', 'debug', 'quiet'):
749 for opt in ('verbose', 'debug', 'quiet'):
750 val = str(bool(options[opt]))
750 val = str(bool(options[opt]))
751 for ui_ in uis:
751 for ui_ in uis:
752 ui_.setconfig('ui', opt, val, '--' + opt)
752 ui_.setconfig('ui', opt, val, '--' + opt)
753
753
754 if options['traceback']:
754 if options['traceback']:
755 for ui_ in uis:
755 for ui_ in uis:
756 ui_.setconfig('ui', 'traceback', 'on', '--traceback')
756 ui_.setconfig('ui', 'traceback', 'on', '--traceback')
757
757
758 if options['noninteractive']:
758 if options['noninteractive']:
759 for ui_ in uis:
759 for ui_ in uis:
760 ui_.setconfig('ui', 'interactive', 'off', '-y')
760 ui_.setconfig('ui', 'interactive', 'off', '-y')
761
761
762 if cmdoptions.get('insecure', False):
762 if cmdoptions.get('insecure', False):
763 for ui_ in uis:
763 for ui_ in uis:
764 ui_.setconfig('web', 'cacerts', '', '--insecure')
764 ui_.setconfig('web', 'cacerts', '', '--insecure')
765
765
766 if options['version']:
766 if options['version']:
767 return commands.version_(ui)
767 return commands.version_(ui)
768 if options['help']:
768 if options['help']:
769 return commands.help_(ui, cmd)
769 return commands.help_(ui, cmd, command=True)
770 elif not cmd:
770 elif not cmd:
771 return commands.help_(ui, 'shortlist')
771 return commands.help_(ui, 'shortlist')
772
772
773 repo = None
773 repo = None
774 cmdpats = args[:]
774 cmdpats = args[:]
775 if cmd not in commands.norepo.split():
775 if cmd not in commands.norepo.split():
776 # use the repo from the request only if we don't have -R
776 # use the repo from the request only if we don't have -R
777 if not rpath and not cwd:
777 if not rpath and not cwd:
778 repo = req.repo
778 repo = req.repo
779
779
780 if repo:
780 if repo:
781 # set the descriptors of the repo ui to those of ui
781 # set the descriptors of the repo ui to those of ui
782 repo.ui.fin = ui.fin
782 repo.ui.fin = ui.fin
783 repo.ui.fout = ui.fout
783 repo.ui.fout = ui.fout
784 repo.ui.ferr = ui.ferr
784 repo.ui.ferr = ui.ferr
785 else:
785 else:
786 try:
786 try:
787 repo = hg.repository(ui, path=path)
787 repo = hg.repository(ui, path=path)
788 if not repo.local():
788 if not repo.local():
789 raise util.Abort(_("repository '%s' is not local") % path)
789 raise util.Abort(_("repository '%s' is not local") % path)
790 repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
790 repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
791 except error.RequirementError:
791 except error.RequirementError:
792 raise
792 raise
793 except error.RepoError:
793 except error.RepoError:
794 if cmd not in commands.optionalrepo.split():
794 if cmd not in commands.optionalrepo.split():
795 if (cmd in commands.inferrepo.split() and
795 if (cmd in commands.inferrepo.split() and
796 args and not path): # try to infer -R from command args
796 args and not path): # try to infer -R from command args
797 repos = map(cmdutil.findrepo, args)
797 repos = map(cmdutil.findrepo, args)
798 guess = repos[0]
798 guess = repos[0]
799 if guess and repos.count(guess) == len(repos):
799 if guess and repos.count(guess) == len(repos):
800 req.args = ['--repository', guess] + fullargs
800 req.args = ['--repository', guess] + fullargs
801 return _dispatch(req)
801 return _dispatch(req)
802 if not path:
802 if not path:
803 raise error.RepoError(_("no repository found in '%s'"
803 raise error.RepoError(_("no repository found in '%s'"
804 " (.hg not found)")
804 " (.hg not found)")
805 % os.getcwd())
805 % os.getcwd())
806 raise
806 raise
807 if repo:
807 if repo:
808 ui = repo.ui
808 ui = repo.ui
809 if options['hidden']:
809 if options['hidden']:
810 repo = repo.unfiltered()
810 repo = repo.unfiltered()
811 args.insert(0, repo)
811 args.insert(0, repo)
812 elif rpath:
812 elif rpath:
813 ui.warn(_("warning: --repository ignored\n"))
813 ui.warn(_("warning: --repository ignored\n"))
814
814
815 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
815 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
816 ui.log("command", '%s\n', msg)
816 ui.log("command", '%s\n', msg)
817 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
817 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
818 try:
818 try:
819 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
819 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
820 cmdpats, cmdoptions)
820 cmdpats, cmdoptions)
821 finally:
821 finally:
822 if repo and repo != req.repo:
822 if repo and repo != req.repo:
823 repo.close()
823 repo.close()
824
824
825 def lsprofile(ui, func, fp):
825 def lsprofile(ui, func, fp):
826 format = ui.config('profiling', 'format', default='text')
826 format = ui.config('profiling', 'format', default='text')
827 field = ui.config('profiling', 'sort', default='inlinetime')
827 field = ui.config('profiling', 'sort', default='inlinetime')
828 limit = ui.configint('profiling', 'limit', default=30)
828 limit = ui.configint('profiling', 'limit', default=30)
829 climit = ui.configint('profiling', 'nested', default=5)
829 climit = ui.configint('profiling', 'nested', default=5)
830
830
831 if format not in ['text', 'kcachegrind']:
831 if format not in ['text', 'kcachegrind']:
832 ui.warn(_("unrecognized profiling format '%s'"
832 ui.warn(_("unrecognized profiling format '%s'"
833 " - Ignored\n") % format)
833 " - Ignored\n") % format)
834 format = 'text'
834 format = 'text'
835
835
836 try:
836 try:
837 from mercurial import lsprof
837 from mercurial import lsprof
838 except ImportError:
838 except ImportError:
839 raise util.Abort(_(
839 raise util.Abort(_(
840 'lsprof not available - install from '
840 'lsprof not available - install from '
841 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
841 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
842 p = lsprof.Profiler()
842 p = lsprof.Profiler()
843 p.enable(subcalls=True)
843 p.enable(subcalls=True)
844 try:
844 try:
845 return func()
845 return func()
846 finally:
846 finally:
847 p.disable()
847 p.disable()
848
848
849 if format == 'kcachegrind':
849 if format == 'kcachegrind':
850 import lsprofcalltree
850 import lsprofcalltree
851 calltree = lsprofcalltree.KCacheGrind(p)
851 calltree = lsprofcalltree.KCacheGrind(p)
852 calltree.output(fp)
852 calltree.output(fp)
853 else:
853 else:
854 # format == 'text'
854 # format == 'text'
855 stats = lsprof.Stats(p.getstats())
855 stats = lsprof.Stats(p.getstats())
856 stats.sort(field)
856 stats.sort(field)
857 stats.pprint(limit=limit, file=fp, climit=climit)
857 stats.pprint(limit=limit, file=fp, climit=climit)
858
858
859 def statprofile(ui, func, fp):
859 def statprofile(ui, func, fp):
860 try:
860 try:
861 import statprof
861 import statprof
862 except ImportError:
862 except ImportError:
863 raise util.Abort(_(
863 raise util.Abort(_(
864 'statprof not available - install using "easy_install statprof"'))
864 'statprof not available - install using "easy_install statprof"'))
865
865
866 freq = ui.configint('profiling', 'freq', default=1000)
866 freq = ui.configint('profiling', 'freq', default=1000)
867 if freq > 0:
867 if freq > 0:
868 statprof.reset(freq)
868 statprof.reset(freq)
869 else:
869 else:
870 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
870 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
871
871
872 statprof.start()
872 statprof.start()
873 try:
873 try:
874 return func()
874 return func()
875 finally:
875 finally:
876 statprof.stop()
876 statprof.stop()
877 statprof.display(fp)
877 statprof.display(fp)
878
878
879 def _runcommand(ui, options, cmd, cmdfunc):
879 def _runcommand(ui, options, cmd, cmdfunc):
880 def checkargs():
880 def checkargs():
881 try:
881 try:
882 return cmdfunc()
882 return cmdfunc()
883 except error.SignatureError:
883 except error.SignatureError:
884 raise error.CommandError(cmd, _("invalid arguments"))
884 raise error.CommandError(cmd, _("invalid arguments"))
885
885
886 if options['profile']:
886 if options['profile']:
887 profiler = os.getenv('HGPROF')
887 profiler = os.getenv('HGPROF')
888 if profiler is None:
888 if profiler is None:
889 profiler = ui.config('profiling', 'type', default='ls')
889 profiler = ui.config('profiling', 'type', default='ls')
890 if profiler not in ('ls', 'stat'):
890 if profiler not in ('ls', 'stat'):
891 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
891 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
892 profiler = 'ls'
892 profiler = 'ls'
893
893
894 output = ui.config('profiling', 'output')
894 output = ui.config('profiling', 'output')
895
895
896 if output:
896 if output:
897 path = ui.expandpath(output)
897 path = ui.expandpath(output)
898 fp = open(path, 'wb')
898 fp = open(path, 'wb')
899 else:
899 else:
900 fp = sys.stderr
900 fp = sys.stderr
901
901
902 try:
902 try:
903 if profiler == 'ls':
903 if profiler == 'ls':
904 return lsprofile(ui, checkargs, fp)
904 return lsprofile(ui, checkargs, fp)
905 else:
905 else:
906 return statprofile(ui, checkargs, fp)
906 return statprofile(ui, checkargs, fp)
907 finally:
907 finally:
908 if output:
908 if output:
909 fp.close()
909 fp.close()
910 else:
910 else:
911 return checkargs()
911 return checkargs()
@@ -1,2087 +1,2098 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge working directory with another revision
17 merge merge working directory with another revision
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 use "hg help" for the full list of commands or "hg -v" for details
26 use "hg help" for the full list of commands or "hg -v" for details
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge working directory with another revision
38 merge merge working directory with another revision
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a changegroup file
61 bundle create a changegroup file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 forget forget the specified files on the next commit
69 forget forget the specified files on the next commit
70 graft copy changes from other branches onto the current branch
70 graft copy changes from other branches onto the current branch
71 grep search for a pattern in specified files and revisions
71 grep search for a pattern in specified files and revisions
72 heads show branch heads
72 heads show branch heads
73 help show help for a given topic or a help overview
73 help show help for a given topic or a help overview
74 identify identify the working copy or specified revision
74 identify identify the working copy or specified revision
75 import import an ordered set of patches
75 import import an ordered set of patches
76 incoming show new changesets found in source
76 incoming show new changesets found in source
77 init create a new repository in the given directory
77 init create a new repository in the given directory
78 locate locate files matching specific patterns
78 locate locate files matching specific patterns
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge working directory with another revision
81 merge merge working directory with another revision
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 parents show the parents of the working directory or revision
83 parents show the parents of the working directory or revision
84 paths show aliases for remote repositories
84 paths show aliases for remote repositories
85 phase set or show the current phase name
85 phase set or show the current phase name
86 pull pull changes from the specified source
86 pull pull changes from the specified source
87 push push changes to the specified destination
87 push push changes to the specified destination
88 recover roll back an interrupted transaction
88 recover roll back an interrupted transaction
89 remove remove the specified files on the next commit
89 remove remove the specified files on the next commit
90 rename rename files; equivalent of copy + remove
90 rename rename files; equivalent of copy + remove
91 resolve redo merges or set/view the merge status of files
91 resolve redo merges or set/view the merge status of files
92 revert restore files to their checkout state
92 revert restore files to their checkout state
93 root print the root (top) of the current working directory
93 root print the root (top) of the current working directory
94 serve start stand-alone webserver
94 serve start stand-alone webserver
95 status show changed files in the working directory
95 status show changed files in the working directory
96 summary summarize working directory state
96 summary summarize working directory state
97 tag add one or more tags for the current or given revision
97 tag add one or more tags for the current or given revision
98 tags list repository tags
98 tags list repository tags
99 unbundle apply one or more changegroup files
99 unbundle apply one or more changegroup files
100 update update working directory (or switch revisions)
100 update update working directory (or switch revisions)
101 verify verify the integrity of the repository
101 verify verify the integrity of the repository
102 version output version and copyright information
102 version output version and copyright information
103
103
104 additional help topics:
104 additional help topics:
105
105
106 config Configuration Files
106 config Configuration Files
107 dates Date Formats
107 dates Date Formats
108 diffs Diff Formats
108 diffs Diff Formats
109 environment Environment Variables
109 environment Environment Variables
110 extensions Using Additional Features
110 extensions Using Additional Features
111 filesets Specifying File Sets
111 filesets Specifying File Sets
112 glossary Glossary
112 glossary Glossary
113 hgignore Syntax for Mercurial Ignore Files
113 hgignore Syntax for Mercurial Ignore Files
114 hgweb Configuring hgweb
114 hgweb Configuring hgweb
115 merge-tools Merge Tools
115 merge-tools Merge Tools
116 multirevs Specifying Multiple Revisions
116 multirevs Specifying Multiple Revisions
117 patterns File Name Patterns
117 patterns File Name Patterns
118 phases Working with Phases
118 phases Working with Phases
119 revisions Specifying Single Revisions
119 revisions Specifying Single Revisions
120 revsets Specifying Revision Sets
120 revsets Specifying Revision Sets
121 subrepos Subrepositories
121 subrepos Subrepositories
122 templating Template Usage
122 templating Template Usage
123 urls URL Paths
123 urls URL Paths
124
124
125 use "hg -v help" to show builtin aliases and global options
125 use "hg -v help" to show builtin aliases and global options
126
126
127 $ hg -q help
127 $ hg -q help
128 add add the specified files on the next commit
128 add add the specified files on the next commit
129 addremove add all new files, delete all missing files
129 addremove add all new files, delete all missing files
130 annotate show changeset information by line for each file
130 annotate show changeset information by line for each file
131 archive create an unversioned archive of a repository revision
131 archive create an unversioned archive of a repository revision
132 backout reverse effect of earlier changeset
132 backout reverse effect of earlier changeset
133 bisect subdivision search of changesets
133 bisect subdivision search of changesets
134 bookmarks create a new bookmark or list existing bookmarks
134 bookmarks create a new bookmark or list existing bookmarks
135 branch set or show the current branch name
135 branch set or show the current branch name
136 branches list repository named branches
136 branches list repository named branches
137 bundle create a changegroup file
137 bundle create a changegroup file
138 cat output the current or given revision of files
138 cat output the current or given revision of files
139 clone make a copy of an existing repository
139 clone make a copy of an existing repository
140 commit commit the specified files or all outstanding changes
140 commit commit the specified files or all outstanding changes
141 config show combined config settings from all hgrc files
141 config show combined config settings from all hgrc files
142 copy mark files as copied for the next commit
142 copy mark files as copied for the next commit
143 diff diff repository (or selected files)
143 diff diff repository (or selected files)
144 export dump the header and diffs for one or more changesets
144 export dump the header and diffs for one or more changesets
145 forget forget the specified files on the next commit
145 forget forget the specified files on the next commit
146 graft copy changes from other branches onto the current branch
146 graft copy changes from other branches onto the current branch
147 grep search for a pattern in specified files and revisions
147 grep search for a pattern in specified files and revisions
148 heads show branch heads
148 heads show branch heads
149 help show help for a given topic or a help overview
149 help show help for a given topic or a help overview
150 identify identify the working copy or specified revision
150 identify identify the working copy or specified revision
151 import import an ordered set of patches
151 import import an ordered set of patches
152 incoming show new changesets found in source
152 incoming show new changesets found in source
153 init create a new repository in the given directory
153 init create a new repository in the given directory
154 locate locate files matching specific patterns
154 locate locate files matching specific patterns
155 log show revision history of entire repository or files
155 log show revision history of entire repository or files
156 manifest output the current or given revision of the project manifest
156 manifest output the current or given revision of the project manifest
157 merge merge working directory with another revision
157 merge merge working directory with another revision
158 outgoing show changesets not found in the destination
158 outgoing show changesets not found in the destination
159 parents show the parents of the working directory or revision
159 parents show the parents of the working directory or revision
160 paths show aliases for remote repositories
160 paths show aliases for remote repositories
161 phase set or show the current phase name
161 phase set or show the current phase name
162 pull pull changes from the specified source
162 pull pull changes from the specified source
163 push push changes to the specified destination
163 push push changes to the specified destination
164 recover roll back an interrupted transaction
164 recover roll back an interrupted transaction
165 remove remove the specified files on the next commit
165 remove remove the specified files on the next commit
166 rename rename files; equivalent of copy + remove
166 rename rename files; equivalent of copy + remove
167 resolve redo merges or set/view the merge status of files
167 resolve redo merges or set/view the merge status of files
168 revert restore files to their checkout state
168 revert restore files to their checkout state
169 root print the root (top) of the current working directory
169 root print the root (top) of the current working directory
170 serve start stand-alone webserver
170 serve start stand-alone webserver
171 status show changed files in the working directory
171 status show changed files in the working directory
172 summary summarize working directory state
172 summary summarize working directory state
173 tag add one or more tags for the current or given revision
173 tag add one or more tags for the current or given revision
174 tags list repository tags
174 tags list repository tags
175 unbundle apply one or more changegroup files
175 unbundle apply one or more changegroup files
176 update update working directory (or switch revisions)
176 update update working directory (or switch revisions)
177 verify verify the integrity of the repository
177 verify verify the integrity of the repository
178 version output version and copyright information
178 version output version and copyright information
179
179
180 additional help topics:
180 additional help topics:
181
181
182 config Configuration Files
182 config Configuration Files
183 dates Date Formats
183 dates Date Formats
184 diffs Diff Formats
184 diffs Diff Formats
185 environment Environment Variables
185 environment Environment Variables
186 extensions Using Additional Features
186 extensions Using Additional Features
187 filesets Specifying File Sets
187 filesets Specifying File Sets
188 glossary Glossary
188 glossary Glossary
189 hgignore Syntax for Mercurial Ignore Files
189 hgignore Syntax for Mercurial Ignore Files
190 hgweb Configuring hgweb
190 hgweb Configuring hgweb
191 merge-tools Merge Tools
191 merge-tools Merge Tools
192 multirevs Specifying Multiple Revisions
192 multirevs Specifying Multiple Revisions
193 patterns File Name Patterns
193 patterns File Name Patterns
194 phases Working with Phases
194 phases Working with Phases
195 revisions Specifying Single Revisions
195 revisions Specifying Single Revisions
196 revsets Specifying Revision Sets
196 revsets Specifying Revision Sets
197 subrepos Subrepositories
197 subrepos Subrepositories
198 templating Template Usage
198 templating Template Usage
199 urls URL Paths
199 urls URL Paths
200
200
201 Test extension help:
201 Test extension help:
202 $ hg help extensions --config extensions.rebase= --config extensions.children=
202 $ hg help extensions --config extensions.rebase= --config extensions.children=
203 Using Additional Features
203 Using Additional Features
204 """""""""""""""""""""""""
204 """""""""""""""""""""""""
205
205
206 Mercurial has the ability to add new features through the use of
206 Mercurial has the ability to add new features through the use of
207 extensions. Extensions may add new commands, add options to existing
207 extensions. Extensions may add new commands, add options to existing
208 commands, change the default behavior of commands, or implement hooks.
208 commands, change the default behavior of commands, or implement hooks.
209
209
210 To enable the "foo" extension, either shipped with Mercurial or in the
210 To enable the "foo" extension, either shipped with Mercurial or in the
211 Python search path, create an entry for it in your configuration file,
211 Python search path, create an entry for it in your configuration file,
212 like this:
212 like this:
213
213
214 [extensions]
214 [extensions]
215 foo =
215 foo =
216
216
217 You may also specify the full path to an extension:
217 You may also specify the full path to an extension:
218
218
219 [extensions]
219 [extensions]
220 myfeature = ~/.hgext/myfeature.py
220 myfeature = ~/.hgext/myfeature.py
221
221
222 See "hg help config" for more information on configuration files.
222 See "hg help config" for more information on configuration files.
223
223
224 Extensions are not loaded by default for a variety of reasons: they can
224 Extensions are not loaded by default for a variety of reasons: they can
225 increase startup overhead; they may be meant for advanced usage only; they
225 increase startup overhead; they may be meant for advanced usage only; they
226 may provide potentially dangerous abilities (such as letting you destroy
226 may provide potentially dangerous abilities (such as letting you destroy
227 or modify history); they might not be ready for prime time; or they may
227 or modify history); they might not be ready for prime time; or they may
228 alter some usual behaviors of stock Mercurial. It is thus up to the user
228 alter some usual behaviors of stock Mercurial. It is thus up to the user
229 to activate extensions as needed.
229 to activate extensions as needed.
230
230
231 To explicitly disable an extension enabled in a configuration file of
231 To explicitly disable an extension enabled in a configuration file of
232 broader scope, prepend its path with !:
232 broader scope, prepend its path with !:
233
233
234 [extensions]
234 [extensions]
235 # disabling extension bar residing in /path/to/extension/bar.py
235 # disabling extension bar residing in /path/to/extension/bar.py
236 bar = !/path/to/extension/bar.py
236 bar = !/path/to/extension/bar.py
237 # ditto, but no path was supplied for extension baz
237 # ditto, but no path was supplied for extension baz
238 baz = !
238 baz = !
239
239
240 enabled extensions:
240 enabled extensions:
241
241
242 children command to display child changesets (DEPRECATED)
242 children command to display child changesets (DEPRECATED)
243 rebase command to move sets of revisions to a different ancestor
243 rebase command to move sets of revisions to a different ancestor
244
244
245 disabled extensions:
245 disabled extensions:
246
246
247 acl hooks for controlling repository access
247 acl hooks for controlling repository access
248 blackbox log repository events to a blackbox for debugging
248 blackbox log repository events to a blackbox for debugging
249 bugzilla hooks for integrating with the Bugzilla bug tracker
249 bugzilla hooks for integrating with the Bugzilla bug tracker
250 churn command to display statistics about repository history
250 churn command to display statistics about repository history
251 color colorize output from some commands
251 color colorize output from some commands
252 convert import revisions from foreign VCS repositories into
252 convert import revisions from foreign VCS repositories into
253 Mercurial
253 Mercurial
254 eol automatically manage newlines in repository files
254 eol automatically manage newlines in repository files
255 extdiff command to allow external programs to compare revisions
255 extdiff command to allow external programs to compare revisions
256 factotum http authentication with factotum
256 factotum http authentication with factotum
257 gpg commands to sign and verify changesets
257 gpg commands to sign and verify changesets
258 hgcia hooks for integrating with the CIA.vc notification service
258 hgcia hooks for integrating with the CIA.vc notification service
259 hgk browse the repository in a graphical way
259 hgk browse the repository in a graphical way
260 highlight syntax highlighting for hgweb (requires Pygments)
260 highlight syntax highlighting for hgweb (requires Pygments)
261 histedit interactive history editing
261 histedit interactive history editing
262 keyword expand keywords in tracked files
262 keyword expand keywords in tracked files
263 largefiles track large binary files
263 largefiles track large binary files
264 mq manage a stack of patches
264 mq manage a stack of patches
265 notify hooks for sending email push notifications
265 notify hooks for sending email push notifications
266 pager browse command output with an external pager
266 pager browse command output with an external pager
267 patchbomb command to send changesets as (a series of) patch emails
267 patchbomb command to send changesets as (a series of) patch emails
268 progress show progress bars for some actions
268 progress show progress bars for some actions
269 purge command to delete untracked files from the working
269 purge command to delete untracked files from the working
270 directory
270 directory
271 record commands to interactively select changes for
271 record commands to interactively select changes for
272 commit/qrefresh
272 commit/qrefresh
273 relink recreates hardlinks between repository clones
273 relink recreates hardlinks between repository clones
274 schemes extend schemes with shortcuts to repository swarms
274 schemes extend schemes with shortcuts to repository swarms
275 share share a common history between several working directories
275 share share a common history between several working directories
276 shelve save and restore changes to the working directory
276 shelve save and restore changes to the working directory
277 strip strip changesets and their descendents from history
277 strip strip changesets and their descendents from history
278 transplant command to transplant changesets from another branch
278 transplant command to transplant changesets from another branch
279 win32mbcs allow the use of MBCS paths with problematic encodings
279 win32mbcs allow the use of MBCS paths with problematic encodings
280 zeroconf discover and advertise repositories on the local network
280 zeroconf discover and advertise repositories on the local network
281 Test short command list with verbose option
281 Test short command list with verbose option
282
282
283 $ hg -v help shortlist
283 $ hg -v help shortlist
284 Mercurial Distributed SCM
284 Mercurial Distributed SCM
285
285
286 basic commands:
286 basic commands:
287
287
288 add add the specified files on the next commit
288 add add the specified files on the next commit
289 annotate, blame
289 annotate, blame
290 show changeset information by line for each file
290 show changeset information by line for each file
291 clone make a copy of an existing repository
291 clone make a copy of an existing repository
292 commit, ci commit the specified files or all outstanding changes
292 commit, ci commit the specified files or all outstanding changes
293 diff diff repository (or selected files)
293 diff diff repository (or selected files)
294 export dump the header and diffs for one or more changesets
294 export dump the header and diffs for one or more changesets
295 forget forget the specified files on the next commit
295 forget forget the specified files on the next commit
296 init create a new repository in the given directory
296 init create a new repository in the given directory
297 log, history show revision history of entire repository or files
297 log, history show revision history of entire repository or files
298 merge merge working directory with another revision
298 merge merge working directory with another revision
299 pull pull changes from the specified source
299 pull pull changes from the specified source
300 push push changes to the specified destination
300 push push changes to the specified destination
301 remove, rm remove the specified files on the next commit
301 remove, rm remove the specified files on the next commit
302 serve start stand-alone webserver
302 serve start stand-alone webserver
303 status, st show changed files in the working directory
303 status, st show changed files in the working directory
304 summary, sum summarize working directory state
304 summary, sum summarize working directory state
305 update, up, checkout, co
305 update, up, checkout, co
306 update working directory (or switch revisions)
306 update working directory (or switch revisions)
307
307
308 global options:
308 global options:
309
309
310 -R --repository REPO repository root directory or name of overlay bundle
310 -R --repository REPO repository root directory or name of overlay bundle
311 file
311 file
312 --cwd DIR change working directory
312 --cwd DIR change working directory
313 -y --noninteractive do not prompt, automatically pick the first choice for
313 -y --noninteractive do not prompt, automatically pick the first choice for
314 all prompts
314 all prompts
315 -q --quiet suppress output
315 -q --quiet suppress output
316 -v --verbose enable additional output
316 -v --verbose enable additional output
317 --config CONFIG [+] set/override config option (use 'section.name=value')
317 --config CONFIG [+] set/override config option (use 'section.name=value')
318 --debug enable debugging output
318 --debug enable debugging output
319 --debugger start debugger
319 --debugger start debugger
320 --encoding ENCODE set the charset encoding (default: ascii)
320 --encoding ENCODE set the charset encoding (default: ascii)
321 --encodingmode MODE set the charset encoding mode (default: strict)
321 --encodingmode MODE set the charset encoding mode (default: strict)
322 --traceback always print a traceback on exception
322 --traceback always print a traceback on exception
323 --time time how long the command takes
323 --time time how long the command takes
324 --profile print command execution profile
324 --profile print command execution profile
325 --version output version information and exit
325 --version output version information and exit
326 -h --help display help and exit
326 -h --help display help and exit
327 --hidden consider hidden changesets
327 --hidden consider hidden changesets
328
328
329 [+] marked option can be specified multiple times
329 [+] marked option can be specified multiple times
330
330
331 use "hg help" for the full list of commands
331 use "hg help" for the full list of commands
332
332
333 $ hg add -h
333 $ hg add -h
334 hg add [OPTION]... [FILE]...
334 hg add [OPTION]... [FILE]...
335
335
336 add the specified files on the next commit
336 add the specified files on the next commit
337
337
338 Schedule files to be version controlled and added to the repository.
338 Schedule files to be version controlled and added to the repository.
339
339
340 The files will be added to the repository at the next commit. To undo an
340 The files will be added to the repository at the next commit. To undo an
341 add before that, see "hg forget".
341 add before that, see "hg forget".
342
342
343 If no names are given, add all files to the repository.
343 If no names are given, add all files to the repository.
344
344
345 Returns 0 if all files are successfully added.
345 Returns 0 if all files are successfully added.
346
346
347 options:
347 options:
348
348
349 -I --include PATTERN [+] include names matching the given patterns
349 -I --include PATTERN [+] include names matching the given patterns
350 -X --exclude PATTERN [+] exclude names matching the given patterns
350 -X --exclude PATTERN [+] exclude names matching the given patterns
351 -S --subrepos recurse into subrepositories
351 -S --subrepos recurse into subrepositories
352 -n --dry-run do not perform actions, just print output
352 -n --dry-run do not perform actions, just print output
353
353
354 [+] marked option can be specified multiple times
354 [+] marked option can be specified multiple times
355
355
356 use "hg -v help add" to show more complete help and the global options
356 use "hg -v help add" to show more complete help and the global options
357
357
358 Verbose help for add
358 Verbose help for add
359
359
360 $ hg add -hv
360 $ hg add -hv
361 hg add [OPTION]... [FILE]...
361 hg add [OPTION]... [FILE]...
362
362
363 add the specified files on the next commit
363 add the specified files on the next commit
364
364
365 Schedule files to be version controlled and added to the repository.
365 Schedule files to be version controlled and added to the repository.
366
366
367 The files will be added to the repository at the next commit. To undo an
367 The files will be added to the repository at the next commit. To undo an
368 add before that, see "hg forget".
368 add before that, see "hg forget".
369
369
370 If no names are given, add all files to the repository.
370 If no names are given, add all files to the repository.
371
371
372 An example showing how new (unknown) files are added automatically by "hg
372 An example showing how new (unknown) files are added automatically by "hg
373 add":
373 add":
374
374
375 $ ls
375 $ ls
376 foo.c
376 foo.c
377 $ hg status
377 $ hg status
378 ? foo.c
378 ? foo.c
379 $ hg add
379 $ hg add
380 adding foo.c
380 adding foo.c
381 $ hg status
381 $ hg status
382 A foo.c
382 A foo.c
383
383
384 Returns 0 if all files are successfully added.
384 Returns 0 if all files are successfully added.
385
385
386 options:
386 options:
387
387
388 -I --include PATTERN [+] include names matching the given patterns
388 -I --include PATTERN [+] include names matching the given patterns
389 -X --exclude PATTERN [+] exclude names matching the given patterns
389 -X --exclude PATTERN [+] exclude names matching the given patterns
390 -S --subrepos recurse into subrepositories
390 -S --subrepos recurse into subrepositories
391 -n --dry-run do not perform actions, just print output
391 -n --dry-run do not perform actions, just print output
392
392
393 [+] marked option can be specified multiple times
393 [+] marked option can be specified multiple times
394
394
395 global options:
395 global options:
396
396
397 -R --repository REPO repository root directory or name of overlay bundle
397 -R --repository REPO repository root directory or name of overlay bundle
398 file
398 file
399 --cwd DIR change working directory
399 --cwd DIR change working directory
400 -y --noninteractive do not prompt, automatically pick the first choice for
400 -y --noninteractive do not prompt, automatically pick the first choice for
401 all prompts
401 all prompts
402 -q --quiet suppress output
402 -q --quiet suppress output
403 -v --verbose enable additional output
403 -v --verbose enable additional output
404 --config CONFIG [+] set/override config option (use 'section.name=value')
404 --config CONFIG [+] set/override config option (use 'section.name=value')
405 --debug enable debugging output
405 --debug enable debugging output
406 --debugger start debugger
406 --debugger start debugger
407 --encoding ENCODE set the charset encoding (default: ascii)
407 --encoding ENCODE set the charset encoding (default: ascii)
408 --encodingmode MODE set the charset encoding mode (default: strict)
408 --encodingmode MODE set the charset encoding mode (default: strict)
409 --traceback always print a traceback on exception
409 --traceback always print a traceback on exception
410 --time time how long the command takes
410 --time time how long the command takes
411 --profile print command execution profile
411 --profile print command execution profile
412 --version output version information and exit
412 --version output version information and exit
413 -h --help display help and exit
413 -h --help display help and exit
414 --hidden consider hidden changesets
414 --hidden consider hidden changesets
415
415
416 [+] marked option can be specified multiple times
416 [+] marked option can be specified multiple times
417
417
418 Test help option with version option
418 Test help option with version option
419
419
420 $ hg add -h --version
420 $ hg add -h --version
421 Mercurial Distributed SCM (version *) (glob)
421 Mercurial Distributed SCM (version *) (glob)
422 (see http://mercurial.selenic.com for more information)
422 (see http://mercurial.selenic.com for more information)
423
423
424 Copyright (C) 2005-2014 Matt Mackall and others
424 Copyright (C) 2005-2014 Matt Mackall and others
425 This is free software; see the source for copying conditions. There is NO
425 This is free software; see the source for copying conditions. There is NO
426 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
426 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
427
427
428 $ hg add --skjdfks
428 $ hg add --skjdfks
429 hg add: option --skjdfks not recognized
429 hg add: option --skjdfks not recognized
430 hg add [OPTION]... [FILE]...
430 hg add [OPTION]... [FILE]...
431
431
432 add the specified files on the next commit
432 add the specified files on the next commit
433
433
434 options:
434 options:
435
435
436 -I --include PATTERN [+] include names matching the given patterns
436 -I --include PATTERN [+] include names matching the given patterns
437 -X --exclude PATTERN [+] exclude names matching the given patterns
437 -X --exclude PATTERN [+] exclude names matching the given patterns
438 -S --subrepos recurse into subrepositories
438 -S --subrepos recurse into subrepositories
439 -n --dry-run do not perform actions, just print output
439 -n --dry-run do not perform actions, just print output
440
440
441 [+] marked option can be specified multiple times
441 [+] marked option can be specified multiple times
442
442
443 use "hg help add" to show the full help text
443 use "hg help add" to show the full help text
444 [255]
444 [255]
445
445
446 Test ambiguous command help
446 Test ambiguous command help
447
447
448 $ hg help ad
448 $ hg help ad
449 list of commands:
449 list of commands:
450
450
451 add add the specified files on the next commit
451 add add the specified files on the next commit
452 addremove add all new files, delete all missing files
452 addremove add all new files, delete all missing files
453
453
454 use "hg -v help ad" to show builtin aliases and global options
454 use "hg -v help ad" to show builtin aliases and global options
455
455
456 Test command without options
456 Test command without options
457
457
458 $ hg help verify
458 $ hg help verify
459 hg verify
459 hg verify
460
460
461 verify the integrity of the repository
461 verify the integrity of the repository
462
462
463 Verify the integrity of the current repository.
463 Verify the integrity of the current repository.
464
464
465 This will perform an extensive check of the repository's integrity,
465 This will perform an extensive check of the repository's integrity,
466 validating the hashes and checksums of each entry in the changelog,
466 validating the hashes and checksums of each entry in the changelog,
467 manifest, and tracked files, as well as the integrity of their crosslinks
467 manifest, and tracked files, as well as the integrity of their crosslinks
468 and indices.
468 and indices.
469
469
470 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
470 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
471 information about recovery from corruption of the repository.
471 information about recovery from corruption of the repository.
472
472
473 Returns 0 on success, 1 if errors are encountered.
473 Returns 0 on success, 1 if errors are encountered.
474
474
475 use "hg -v help verify" to show the global options
475 use "hg -v help verify" to show the global options
476
476
477 $ hg help diff
477 $ hg help diff
478 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
478 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
479
479
480 diff repository (or selected files)
480 diff repository (or selected files)
481
481
482 Show differences between revisions for the specified files.
482 Show differences between revisions for the specified files.
483
483
484 Differences between files are shown using the unified diff format.
484 Differences between files are shown using the unified diff format.
485
485
486 Note:
486 Note:
487 diff may generate unexpected results for merges, as it will default to
487 diff may generate unexpected results for merges, as it will default to
488 comparing against the working directory's first parent changeset if no
488 comparing against the working directory's first parent changeset if no
489 revisions are specified.
489 revisions are specified.
490
490
491 When two revision arguments are given, then changes are shown between
491 When two revision arguments are given, then changes are shown between
492 those revisions. If only one revision is specified then that revision is
492 those revisions. If only one revision is specified then that revision is
493 compared to the working directory, and, when no revisions are specified,
493 compared to the working directory, and, when no revisions are specified,
494 the working directory files are compared to its parent.
494 the working directory files are compared to its parent.
495
495
496 Alternatively you can specify -c/--change with a revision to see the
496 Alternatively you can specify -c/--change with a revision to see the
497 changes in that changeset relative to its first parent.
497 changes in that changeset relative to its first parent.
498
498
499 Without the -a/--text option, diff will avoid generating diffs of files it
499 Without the -a/--text option, diff will avoid generating diffs of files it
500 detects as binary. With -a, diff will generate a diff anyway, probably
500 detects as binary. With -a, diff will generate a diff anyway, probably
501 with undesirable results.
501 with undesirable results.
502
502
503 Use the -g/--git option to generate diffs in the git extended diff format.
503 Use the -g/--git option to generate diffs in the git extended diff format.
504 For more information, read "hg help diffs".
504 For more information, read "hg help diffs".
505
505
506 Returns 0 on success.
506 Returns 0 on success.
507
507
508 options:
508 options:
509
509
510 -r --rev REV [+] revision
510 -r --rev REV [+] revision
511 -c --change REV change made by revision
511 -c --change REV change made by revision
512 -a --text treat all files as text
512 -a --text treat all files as text
513 -g --git use git extended diff format
513 -g --git use git extended diff format
514 --nodates omit dates from diff headers
514 --nodates omit dates from diff headers
515 -p --show-function show which function each change is in
515 -p --show-function show which function each change is in
516 --reverse produce a diff that undoes the changes
516 --reverse produce a diff that undoes the changes
517 -w --ignore-all-space ignore white space when comparing lines
517 -w --ignore-all-space ignore white space when comparing lines
518 -b --ignore-space-change ignore changes in the amount of white space
518 -b --ignore-space-change ignore changes in the amount of white space
519 -B --ignore-blank-lines ignore changes whose lines are all blank
519 -B --ignore-blank-lines ignore changes whose lines are all blank
520 -U --unified NUM number of lines of context to show
520 -U --unified NUM number of lines of context to show
521 --stat output diffstat-style summary of changes
521 --stat output diffstat-style summary of changes
522 -I --include PATTERN [+] include names matching the given patterns
522 -I --include PATTERN [+] include names matching the given patterns
523 -X --exclude PATTERN [+] exclude names matching the given patterns
523 -X --exclude PATTERN [+] exclude names matching the given patterns
524 -S --subrepos recurse into subrepositories
524 -S --subrepos recurse into subrepositories
525
525
526 [+] marked option can be specified multiple times
526 [+] marked option can be specified multiple times
527
527
528 use "hg -v help diff" to show more complete help and the global options
528 use "hg -v help diff" to show more complete help and the global options
529
529
530 $ hg help status
530 $ hg help status
531 hg status [OPTION]... [FILE]...
531 hg status [OPTION]... [FILE]...
532
532
533 aliases: st
533 aliases: st
534
534
535 show changed files in the working directory
535 show changed files in the working directory
536
536
537 Show status of files in the repository. If names are given, only files
537 Show status of files in the repository. If names are given, only files
538 that match are shown. Files that are clean or ignored or the source of a
538 that match are shown. Files that are clean or ignored or the source of a
539 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
539 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
540 -C/--copies or -A/--all are given. Unless options described with "show
540 -C/--copies or -A/--all are given. Unless options described with "show
541 only ..." are given, the options -mardu are used.
541 only ..." are given, the options -mardu are used.
542
542
543 Option -q/--quiet hides untracked (unknown and ignored) files unless
543 Option -q/--quiet hides untracked (unknown and ignored) files unless
544 explicitly requested with -u/--unknown or -i/--ignored.
544 explicitly requested with -u/--unknown or -i/--ignored.
545
545
546 Note:
546 Note:
547 status may appear to disagree with diff if permissions have changed or
547 status may appear to disagree with diff if permissions have changed or
548 a merge has occurred. The standard diff format does not report
548 a merge has occurred. The standard diff format does not report
549 permission changes and diff only reports changes relative to one merge
549 permission changes and diff only reports changes relative to one merge
550 parent.
550 parent.
551
551
552 If one revision is given, it is used as the base revision. If two
552 If one revision is given, it is used as the base revision. If two
553 revisions are given, the differences between them are shown. The --change
553 revisions are given, the differences between them are shown. The --change
554 option can also be used as a shortcut to list the changed files of a
554 option can also be used as a shortcut to list the changed files of a
555 revision from its first parent.
555 revision from its first parent.
556
556
557 The codes used to show the status of files are:
557 The codes used to show the status of files are:
558
558
559 M = modified
559 M = modified
560 A = added
560 A = added
561 R = removed
561 R = removed
562 C = clean
562 C = clean
563 ! = missing (deleted by non-hg command, but still tracked)
563 ! = missing (deleted by non-hg command, but still tracked)
564 ? = not tracked
564 ? = not tracked
565 I = ignored
565 I = ignored
566 = origin of the previous file (with --copies)
566 = origin of the previous file (with --copies)
567
567
568 Returns 0 on success.
568 Returns 0 on success.
569
569
570 options:
570 options:
571
571
572 -A --all show status of all files
572 -A --all show status of all files
573 -m --modified show only modified files
573 -m --modified show only modified files
574 -a --added show only added files
574 -a --added show only added files
575 -r --removed show only removed files
575 -r --removed show only removed files
576 -d --deleted show only deleted (but tracked) files
576 -d --deleted show only deleted (but tracked) files
577 -c --clean show only files without changes
577 -c --clean show only files without changes
578 -u --unknown show only unknown (not tracked) files
578 -u --unknown show only unknown (not tracked) files
579 -i --ignored show only ignored files
579 -i --ignored show only ignored files
580 -n --no-status hide status prefix
580 -n --no-status hide status prefix
581 -C --copies show source of copied files
581 -C --copies show source of copied files
582 -0 --print0 end filenames with NUL, for use with xargs
582 -0 --print0 end filenames with NUL, for use with xargs
583 --rev REV [+] show difference from revision
583 --rev REV [+] show difference from revision
584 --change REV list the changed files of a revision
584 --change REV list the changed files of a revision
585 -I --include PATTERN [+] include names matching the given patterns
585 -I --include PATTERN [+] include names matching the given patterns
586 -X --exclude PATTERN [+] exclude names matching the given patterns
586 -X --exclude PATTERN [+] exclude names matching the given patterns
587 -S --subrepos recurse into subrepositories
587 -S --subrepos recurse into subrepositories
588
588
589 [+] marked option can be specified multiple times
589 [+] marked option can be specified multiple times
590
590
591 use "hg -v help status" to show more complete help and the global options
591 use "hg -v help status" to show more complete help and the global options
592
592
593 $ hg -q help status
593 $ hg -q help status
594 hg status [OPTION]... [FILE]...
594 hg status [OPTION]... [FILE]...
595
595
596 show changed files in the working directory
596 show changed files in the working directory
597
597
598 $ hg help foo
598 $ hg help foo
599 abort: no such help topic: foo
599 abort: no such help topic: foo
600 (try "hg help --keyword foo")
600 (try "hg help --keyword foo")
601 [255]
601 [255]
602
602
603 $ hg skjdfks
603 $ hg skjdfks
604 hg: unknown command 'skjdfks'
604 hg: unknown command 'skjdfks'
605 Mercurial Distributed SCM
605 Mercurial Distributed SCM
606
606
607 basic commands:
607 basic commands:
608
608
609 add add the specified files on the next commit
609 add add the specified files on the next commit
610 annotate show changeset information by line for each file
610 annotate show changeset information by line for each file
611 clone make a copy of an existing repository
611 clone make a copy of an existing repository
612 commit commit the specified files or all outstanding changes
612 commit commit the specified files or all outstanding changes
613 diff diff repository (or selected files)
613 diff diff repository (or selected files)
614 export dump the header and diffs for one or more changesets
614 export dump the header and diffs for one or more changesets
615 forget forget the specified files on the next commit
615 forget forget the specified files on the next commit
616 init create a new repository in the given directory
616 init create a new repository in the given directory
617 log show revision history of entire repository or files
617 log show revision history of entire repository or files
618 merge merge working directory with another revision
618 merge merge working directory with another revision
619 pull pull changes from the specified source
619 pull pull changes from the specified source
620 push push changes to the specified destination
620 push push changes to the specified destination
621 remove remove the specified files on the next commit
621 remove remove the specified files on the next commit
622 serve start stand-alone webserver
622 serve start stand-alone webserver
623 status show changed files in the working directory
623 status show changed files in the working directory
624 summary summarize working directory state
624 summary summarize working directory state
625 update update working directory (or switch revisions)
625 update update working directory (or switch revisions)
626
626
627 use "hg help" for the full list of commands or "hg -v" for details
627 use "hg help" for the full list of commands or "hg -v" for details
628 [255]
628 [255]
629
629
630
630
631 $ cat > helpext.py <<EOF
631 $ cat > helpext.py <<EOF
632 > import os
632 > import os
633 > from mercurial import cmdutil, commands
633 > from mercurial import cmdutil, commands
634 >
634 >
635 > cmdtable = {}
635 > cmdtable = {}
636 > command = cmdutil.command(cmdtable)
636 > command = cmdutil.command(cmdtable)
637 >
637 >
638 > @command('nohelp',
638 > @command('nohelp',
639 > [('', 'longdesc', 3, 'x'*90),
639 > [('', 'longdesc', 3, 'x'*90),
640 > ('n', '', None, 'normal desc'),
640 > ('n', '', None, 'normal desc'),
641 > ('', 'newline', '', 'line1\nline2')],
641 > ('', 'newline', '', 'line1\nline2')],
642 > 'hg nohelp',
642 > 'hg nohelp',
643 > norepo=True)
643 > norepo=True)
644 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
644 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
645 > def nohelp(ui, *args, **kwargs):
645 > def nohelp(ui, *args, **kwargs):
646 > pass
646 > pass
647 >
647 >
648 > EOF
648 > EOF
649 $ echo '[extensions]' >> $HGRCPATH
649 $ echo '[extensions]' >> $HGRCPATH
650 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
650 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
651
651
652 Test command with no help text
652 Test command with no help text
653
653
654 $ hg help nohelp
654 $ hg help nohelp
655 hg nohelp
655 hg nohelp
656
656
657 (no help text available)
657 (no help text available)
658
658
659 options:
659 options:
660
660
661 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
661 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
662 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
662 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
663 -n -- normal desc
663 -n -- normal desc
664 --newline VALUE line1 line2
664 --newline VALUE line1 line2
665
665
666 use "hg -v help nohelp" to show the global options
666 use "hg -v help nohelp" to show the global options
667
667
668 $ hg help -k nohelp
668 $ hg help -k nohelp
669 Commands:
669 Commands:
670
670
671 nohelp hg nohelp
671 nohelp hg nohelp
672
672
673 Extension Commands:
673 Extension Commands:
674
674
675 nohelp (no help text available)
675 nohelp (no help text available)
676
676
677 Test that default list of commands omits extension commands
677 Test that default list of commands omits extension commands
678
678
679 $ hg help
679 $ hg help
680 Mercurial Distributed SCM
680 Mercurial Distributed SCM
681
681
682 list of commands:
682 list of commands:
683
683
684 add add the specified files on the next commit
684 add add the specified files on the next commit
685 addremove add all new files, delete all missing files
685 addremove add all new files, delete all missing files
686 annotate show changeset information by line for each file
686 annotate show changeset information by line for each file
687 archive create an unversioned archive of a repository revision
687 archive create an unversioned archive of a repository revision
688 backout reverse effect of earlier changeset
688 backout reverse effect of earlier changeset
689 bisect subdivision search of changesets
689 bisect subdivision search of changesets
690 bookmarks create a new bookmark or list existing bookmarks
690 bookmarks create a new bookmark or list existing bookmarks
691 branch set or show the current branch name
691 branch set or show the current branch name
692 branches list repository named branches
692 branches list repository named branches
693 bundle create a changegroup file
693 bundle create a changegroup file
694 cat output the current or given revision of files
694 cat output the current or given revision of files
695 clone make a copy of an existing repository
695 clone make a copy of an existing repository
696 commit commit the specified files or all outstanding changes
696 commit commit the specified files or all outstanding changes
697 config show combined config settings from all hgrc files
697 config show combined config settings from all hgrc files
698 copy mark files as copied for the next commit
698 copy mark files as copied for the next commit
699 diff diff repository (or selected files)
699 diff diff repository (or selected files)
700 export dump the header and diffs for one or more changesets
700 export dump the header and diffs for one or more changesets
701 forget forget the specified files on the next commit
701 forget forget the specified files on the next commit
702 graft copy changes from other branches onto the current branch
702 graft copy changes from other branches onto the current branch
703 grep search for a pattern in specified files and revisions
703 grep search for a pattern in specified files and revisions
704 heads show branch heads
704 heads show branch heads
705 help show help for a given topic or a help overview
705 help show help for a given topic or a help overview
706 identify identify the working copy or specified revision
706 identify identify the working copy or specified revision
707 import import an ordered set of patches
707 import import an ordered set of patches
708 incoming show new changesets found in source
708 incoming show new changesets found in source
709 init create a new repository in the given directory
709 init create a new repository in the given directory
710 locate locate files matching specific patterns
710 locate locate files matching specific patterns
711 log show revision history of entire repository or files
711 log show revision history of entire repository or files
712 manifest output the current or given revision of the project manifest
712 manifest output the current or given revision of the project manifest
713 merge merge working directory with another revision
713 merge merge working directory with another revision
714 outgoing show changesets not found in the destination
714 outgoing show changesets not found in the destination
715 parents show the parents of the working directory or revision
715 parents show the parents of the working directory or revision
716 paths show aliases for remote repositories
716 paths show aliases for remote repositories
717 phase set or show the current phase name
717 phase set or show the current phase name
718 pull pull changes from the specified source
718 pull pull changes from the specified source
719 push push changes to the specified destination
719 push push changes to the specified destination
720 recover roll back an interrupted transaction
720 recover roll back an interrupted transaction
721 remove remove the specified files on the next commit
721 remove remove the specified files on the next commit
722 rename rename files; equivalent of copy + remove
722 rename rename files; equivalent of copy + remove
723 resolve redo merges or set/view the merge status of files
723 resolve redo merges or set/view the merge status of files
724 revert restore files to their checkout state
724 revert restore files to their checkout state
725 root print the root (top) of the current working directory
725 root print the root (top) of the current working directory
726 serve start stand-alone webserver
726 serve start stand-alone webserver
727 status show changed files in the working directory
727 status show changed files in the working directory
728 summary summarize working directory state
728 summary summarize working directory state
729 tag add one or more tags for the current or given revision
729 tag add one or more tags for the current or given revision
730 tags list repository tags
730 tags list repository tags
731 unbundle apply one or more changegroup files
731 unbundle apply one or more changegroup files
732 update update working directory (or switch revisions)
732 update update working directory (or switch revisions)
733 verify verify the integrity of the repository
733 verify verify the integrity of the repository
734 version output version and copyright information
734 version output version and copyright information
735
735
736 enabled extensions:
736 enabled extensions:
737
737
738 helpext (no help text available)
738 helpext (no help text available)
739
739
740 additional help topics:
740 additional help topics:
741
741
742 config Configuration Files
742 config Configuration Files
743 dates Date Formats
743 dates Date Formats
744 diffs Diff Formats
744 diffs Diff Formats
745 environment Environment Variables
745 environment Environment Variables
746 extensions Using Additional Features
746 extensions Using Additional Features
747 filesets Specifying File Sets
747 filesets Specifying File Sets
748 glossary Glossary
748 glossary Glossary
749 hgignore Syntax for Mercurial Ignore Files
749 hgignore Syntax for Mercurial Ignore Files
750 hgweb Configuring hgweb
750 hgweb Configuring hgweb
751 merge-tools Merge Tools
751 merge-tools Merge Tools
752 multirevs Specifying Multiple Revisions
752 multirevs Specifying Multiple Revisions
753 patterns File Name Patterns
753 patterns File Name Patterns
754 phases Working with Phases
754 phases Working with Phases
755 revisions Specifying Single Revisions
755 revisions Specifying Single Revisions
756 revsets Specifying Revision Sets
756 revsets Specifying Revision Sets
757 subrepos Subrepositories
757 subrepos Subrepositories
758 templating Template Usage
758 templating Template Usage
759 urls URL Paths
759 urls URL Paths
760
760
761 use "hg -v help" to show builtin aliases and global options
761 use "hg -v help" to show builtin aliases and global options
762
762
763
763
764 Test list of internal help commands
764 Test list of internal help commands
765
765
766 $ hg help debug
766 $ hg help debug
767 debug commands (internal and unsupported):
767 debug commands (internal and unsupported):
768
768
769 debugancestor
769 debugancestor
770 find the ancestor revision of two revisions in a given index
770 find the ancestor revision of two revisions in a given index
771 debugbuilddag
771 debugbuilddag
772 builds a repo with a given DAG from scratch in the current
772 builds a repo with a given DAG from scratch in the current
773 empty repo
773 empty repo
774 debugbundle lists the contents of a bundle
774 debugbundle lists the contents of a bundle
775 debugcheckstate
775 debugcheckstate
776 validate the correctness of the current dirstate
776 validate the correctness of the current dirstate
777 debugcommands
777 debugcommands
778 list all available commands and options
778 list all available commands and options
779 debugcomplete
779 debugcomplete
780 returns the completion list associated with the given command
780 returns the completion list associated with the given command
781 debugdag format the changelog or an index DAG as a concise textual
781 debugdag format the changelog or an index DAG as a concise textual
782 description
782 description
783 debugdata dump the contents of a data file revision
783 debugdata dump the contents of a data file revision
784 debugdate parse and display a date
784 debugdate parse and display a date
785 debugdirstate
785 debugdirstate
786 show the contents of the current dirstate
786 show the contents of the current dirstate
787 debugdiscovery
787 debugdiscovery
788 runs the changeset discovery protocol in isolation
788 runs the changeset discovery protocol in isolation
789 debugfileset parse and apply a fileset specification
789 debugfileset parse and apply a fileset specification
790 debugfsinfo show information detected about current filesystem
790 debugfsinfo show information detected about current filesystem
791 debuggetbundle
791 debuggetbundle
792 retrieves a bundle from a repo
792 retrieves a bundle from a repo
793 debugignore display the combined ignore pattern
793 debugignore display the combined ignore pattern
794 debugindex dump the contents of an index file
794 debugindex dump the contents of an index file
795 debugindexdot
795 debugindexdot
796 dump an index DAG as a graphviz dot file
796 dump an index DAG as a graphviz dot file
797 debuginstall test Mercurial installation
797 debuginstall test Mercurial installation
798 debugknown test whether node ids are known to a repo
798 debugknown test whether node ids are known to a repo
799 debuglabelcomplete
799 debuglabelcomplete
800 complete "labels" - tags, open branch names, bookmark names
800 complete "labels" - tags, open branch names, bookmark names
801 debugobsolete
801 debugobsolete
802 create arbitrary obsolete marker
802 create arbitrary obsolete marker
803 debugoptDEP (no help text available)
803 debugoptDEP (no help text available)
804 debugpathcomplete
804 debugpathcomplete
805 complete part or all of a tracked path
805 complete part or all of a tracked path
806 debugpushkey access the pushkey key/value protocol
806 debugpushkey access the pushkey key/value protocol
807 debugpvec (no help text available)
807 debugpvec (no help text available)
808 debugrebuilddirstate
808 debugrebuilddirstate
809 rebuild the dirstate as it would look like for the given
809 rebuild the dirstate as it would look like for the given
810 revision
810 revision
811 debugrename dump rename information
811 debugrename dump rename information
812 debugrevlog show data and statistics about a revlog
812 debugrevlog show data and statistics about a revlog
813 debugrevspec parse and apply a revision specification
813 debugrevspec parse and apply a revision specification
814 debugsetparents
814 debugsetparents
815 manually set the parents of the current working directory
815 manually set the parents of the current working directory
816 debugsub (no help text available)
816 debugsub (no help text available)
817 debugsuccessorssets
817 debugsuccessorssets
818 show set of successors for revision
818 show set of successors for revision
819 debugwalk show how files match on given patterns
819 debugwalk show how files match on given patterns
820 debugwireargs
820 debugwireargs
821 (no help text available)
821 (no help text available)
822
822
823 use "hg -v help debug" to show builtin aliases and global options
823 use "hg -v help debug" to show builtin aliases and global options
824
824
825
825
826 Test list of commands with command with no help text
826 Test list of commands with command with no help text
827
827
828 $ hg help helpext
828 $ hg help helpext
829 helpext extension - no help text available
829 helpext extension - no help text available
830
830
831 list of commands:
831 list of commands:
832
832
833 nohelp (no help text available)
833 nohelp (no help text available)
834
834
835 use "hg -v help helpext" to show builtin aliases and global options
835 use "hg -v help helpext" to show builtin aliases and global options
836
836
837
837
838 test deprecated option is hidden in command help
838 test deprecated option is hidden in command help
839 $ hg help debugoptDEP
839 $ hg help debugoptDEP
840 hg debugoptDEP
840 hg debugoptDEP
841
841
842 (no help text available)
842 (no help text available)
843
843
844 options:
844 options:
845
845
846 use "hg -v help debugoptDEP" to show the global options
846 use "hg -v help debugoptDEP" to show the global options
847
847
848 test deprecated option is shown with -v
848 test deprecated option is shown with -v
849 $ hg help -v debugoptDEP | grep dopt
849 $ hg help -v debugoptDEP | grep dopt
850 --dopt option is DEPRECATED
850 --dopt option is DEPRECATED
851
851
852 #if gettext
852 #if gettext
853 test deprecated option is hidden with translation with untranslated description
853 test deprecated option is hidden with translation with untranslated description
854 (use many globy for not failing on changed transaction)
854 (use many globy for not failing on changed transaction)
855 $ LANGUAGE=sv hg help debugoptDEP
855 $ LANGUAGE=sv hg help debugoptDEP
856 hg debugoptDEP
856 hg debugoptDEP
857
857
858 (*) (glob)
858 (*) (glob)
859
859
860 flaggor:
860 flaggor:
861
861
862 *"hg -v help debugoptDEP"* (glob)
862 *"hg -v help debugoptDEP"* (glob)
863 #endif
863 #endif
864
864
865 Test commands that collide with topics (issue4240)
866
867 $ hg config -hq
868 hg config [-u] [NAME]...
869
870 show combined config settings from all hgrc files
871 $ hg showconfig -hq
872 hg config [-u] [NAME]...
873
874 show combined config settings from all hgrc files
875
865 Test a help topic
876 Test a help topic
866
877
867 $ hg help revs
878 $ hg help revs
868 Specifying Single Revisions
879 Specifying Single Revisions
869 """""""""""""""""""""""""""
880 """""""""""""""""""""""""""
870
881
871 Mercurial supports several ways to specify individual revisions.
882 Mercurial supports several ways to specify individual revisions.
872
883
873 A plain integer is treated as a revision number. Negative integers are
884 A plain integer is treated as a revision number. Negative integers are
874 treated as sequential offsets from the tip, with -1 denoting the tip, -2
885 treated as sequential offsets from the tip, with -1 denoting the tip, -2
875 denoting the revision prior to the tip, and so forth.
886 denoting the revision prior to the tip, and so forth.
876
887
877 A 40-digit hexadecimal string is treated as a unique revision identifier.
888 A 40-digit hexadecimal string is treated as a unique revision identifier.
878
889
879 A hexadecimal string less than 40 characters long is treated as a unique
890 A hexadecimal string less than 40 characters long is treated as a unique
880 revision identifier and is referred to as a short-form identifier. A
891 revision identifier and is referred to as a short-form identifier. A
881 short-form identifier is only valid if it is the prefix of exactly one
892 short-form identifier is only valid if it is the prefix of exactly one
882 full-length identifier.
893 full-length identifier.
883
894
884 Any other string is treated as a bookmark, tag, or branch name. A bookmark
895 Any other string is treated as a bookmark, tag, or branch name. A bookmark
885 is a movable pointer to a revision. A tag is a permanent name associated
896 is a movable pointer to a revision. A tag is a permanent name associated
886 with a revision. A branch name denotes the tipmost open branch head of
897 with a revision. A branch name denotes the tipmost open branch head of
887 that branch - or if they are all closed, the tipmost closed head of the
898 that branch - or if they are all closed, the tipmost closed head of the
888 branch. Bookmark, tag, and branch names must not contain the ":"
899 branch. Bookmark, tag, and branch names must not contain the ":"
889 character.
900 character.
890
901
891 The reserved name "tip" always identifies the most recent revision.
902 The reserved name "tip" always identifies the most recent revision.
892
903
893 The reserved name "null" indicates the null revision. This is the revision
904 The reserved name "null" indicates the null revision. This is the revision
894 of an empty repository, and the parent of revision 0.
905 of an empty repository, and the parent of revision 0.
895
906
896 The reserved name "." indicates the working directory parent. If no
907 The reserved name "." indicates the working directory parent. If no
897 working directory is checked out, it is equivalent to null. If an
908 working directory is checked out, it is equivalent to null. If an
898 uncommitted merge is in progress, "." is the revision of the first parent.
909 uncommitted merge is in progress, "." is the revision of the first parent.
899
910
900 Test templating help
911 Test templating help
901
912
902 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
913 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
903 desc String. The text of the changeset description.
914 desc String. The text of the changeset description.
904 diffstat String. Statistics of changes with the following format:
915 diffstat String. Statistics of changes with the following format:
905 firstline Any text. Returns the first line of text.
916 firstline Any text. Returns the first line of text.
906 nonempty Any text. Returns '(none)' if the string is empty.
917 nonempty Any text. Returns '(none)' if the string is empty.
907
918
908 Test help hooks
919 Test help hooks
909
920
910 $ cat > helphook1.py <<EOF
921 $ cat > helphook1.py <<EOF
911 > from mercurial import help
922 > from mercurial import help
912 >
923 >
913 > def rewrite(topic, doc):
924 > def rewrite(topic, doc):
914 > return doc + '\nhelphook1\n'
925 > return doc + '\nhelphook1\n'
915 >
926 >
916 > def extsetup(ui):
927 > def extsetup(ui):
917 > help.addtopichook('revsets', rewrite)
928 > help.addtopichook('revsets', rewrite)
918 > EOF
929 > EOF
919 $ cat > helphook2.py <<EOF
930 $ cat > helphook2.py <<EOF
920 > from mercurial import help
931 > from mercurial import help
921 >
932 >
922 > def rewrite(topic, doc):
933 > def rewrite(topic, doc):
923 > return doc + '\nhelphook2\n'
934 > return doc + '\nhelphook2\n'
924 >
935 >
925 > def extsetup(ui):
936 > def extsetup(ui):
926 > help.addtopichook('revsets', rewrite)
937 > help.addtopichook('revsets', rewrite)
927 > EOF
938 > EOF
928 $ echo '[extensions]' >> $HGRCPATH
939 $ echo '[extensions]' >> $HGRCPATH
929 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
940 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
930 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
941 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
931 $ hg help revsets | grep helphook
942 $ hg help revsets | grep helphook
932 helphook1
943 helphook1
933 helphook2
944 helphook2
934
945
935 Test keyword search help
946 Test keyword search help
936
947
937 $ cat > prefixedname.py <<EOF
948 $ cat > prefixedname.py <<EOF
938 > '''matched against word "clone"
949 > '''matched against word "clone"
939 > '''
950 > '''
940 > EOF
951 > EOF
941 $ echo '[extensions]' >> $HGRCPATH
952 $ echo '[extensions]' >> $HGRCPATH
942 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
953 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
943 $ hg help -k clone
954 $ hg help -k clone
944 Topics:
955 Topics:
945
956
946 config Configuration Files
957 config Configuration Files
947 extensions Using Additional Features
958 extensions Using Additional Features
948 glossary Glossary
959 glossary Glossary
949 phases Working with Phases
960 phases Working with Phases
950 subrepos Subrepositories
961 subrepos Subrepositories
951 urls URL Paths
962 urls URL Paths
952
963
953 Commands:
964 Commands:
954
965
955 bookmarks create a new bookmark or list existing bookmarks
966 bookmarks create a new bookmark or list existing bookmarks
956 clone make a copy of an existing repository
967 clone make a copy of an existing repository
957 paths show aliases for remote repositories
968 paths show aliases for remote repositories
958 update update working directory (or switch revisions)
969 update update working directory (or switch revisions)
959
970
960 Extensions:
971 Extensions:
961
972
962 prefixedname matched against word "clone"
973 prefixedname matched against word "clone"
963 relink recreates hardlinks between repository clones
974 relink recreates hardlinks between repository clones
964
975
965 Extension Commands:
976 Extension Commands:
966
977
967 qclone clone main and patch repository at same time
978 qclone clone main and patch repository at same time
968
979
969 Test unfound topic
980 Test unfound topic
970
981
971 $ hg help nonexistingtopicthatwillneverexisteverever
982 $ hg help nonexistingtopicthatwillneverexisteverever
972 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
983 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
973 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
984 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
974 [255]
985 [255]
975
986
976 Test unfound keyword
987 Test unfound keyword
977
988
978 $ hg help --keyword nonexistingwordthatwillneverexisteverever
989 $ hg help --keyword nonexistingwordthatwillneverexisteverever
979 abort: no matches
990 abort: no matches
980 (try "hg help" for a list of topics)
991 (try "hg help" for a list of topics)
981 [255]
992 [255]
982
993
983 Test omit indicating for help
994 Test omit indicating for help
984
995
985 $ cat > addverboseitems.py <<EOF
996 $ cat > addverboseitems.py <<EOF
986 > '''extension to test omit indicating.
997 > '''extension to test omit indicating.
987 >
998 >
988 > This paragraph is never omitted (for extension)
999 > This paragraph is never omitted (for extension)
989 >
1000 >
990 > .. container:: verbose
1001 > .. container:: verbose
991 >
1002 >
992 > This paragraph is omitted,
1003 > This paragraph is omitted,
993 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
1004 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
994 >
1005 >
995 > This paragraph is never omitted, too (for extension)
1006 > This paragraph is never omitted, too (for extension)
996 > '''
1007 > '''
997 >
1008 >
998 > from mercurial import help, commands
1009 > from mercurial import help, commands
999 > testtopic = """This paragraph is never omitted (for topic).
1010 > testtopic = """This paragraph is never omitted (for topic).
1000 >
1011 >
1001 > .. container:: verbose
1012 > .. container:: verbose
1002 >
1013 >
1003 > This paragraph is omitted,
1014 > This paragraph is omitted,
1004 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
1015 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
1005 >
1016 >
1006 > This paragraph is never omitted, too (for topic)
1017 > This paragraph is never omitted, too (for topic)
1007 > """
1018 > """
1008 > def extsetup(ui):
1019 > def extsetup(ui):
1009 > help.helptable.append((["topic-containing-verbose"],
1020 > help.helptable.append((["topic-containing-verbose"],
1010 > "This is the topic to test omit indicating.",
1021 > "This is the topic to test omit indicating.",
1011 > lambda : testtopic))
1022 > lambda : testtopic))
1012 > EOF
1023 > EOF
1013 $ echo '[extensions]' >> $HGRCPATH
1024 $ echo '[extensions]' >> $HGRCPATH
1014 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1025 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1015 $ hg help addverboseitems
1026 $ hg help addverboseitems
1016 addverboseitems extension - extension to test omit indicating.
1027 addverboseitems extension - extension to test omit indicating.
1017
1028
1018 This paragraph is never omitted (for extension)
1029 This paragraph is never omitted (for extension)
1019
1030
1020 This paragraph is never omitted, too (for extension)
1031 This paragraph is never omitted, too (for extension)
1021
1032
1022 use "hg help -v addverboseitems" to show more complete help
1033 use "hg help -v addverboseitems" to show more complete help
1023
1034
1024 no commands defined
1035 no commands defined
1025 $ hg help -v addverboseitems
1036 $ hg help -v addverboseitems
1026 addverboseitems extension - extension to test omit indicating.
1037 addverboseitems extension - extension to test omit indicating.
1027
1038
1028 This paragraph is never omitted (for extension)
1039 This paragraph is never omitted (for extension)
1029
1040
1030 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
1041 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
1031
1042
1032 This paragraph is never omitted, too (for extension)
1043 This paragraph is never omitted, too (for extension)
1033
1044
1034 no commands defined
1045 no commands defined
1035 $ hg help topic-containing-verbose
1046 $ hg help topic-containing-verbose
1036 This is the topic to test omit indicating.
1047 This is the topic to test omit indicating.
1037 """"""""""""""""""""""""""""""""""""""""""
1048 """"""""""""""""""""""""""""""""""""""""""
1038
1049
1039 This paragraph is never omitted (for topic).
1050 This paragraph is never omitted (for topic).
1040
1051
1041 This paragraph is never omitted, too (for topic)
1052 This paragraph is never omitted, too (for topic)
1042
1053
1043 use "hg help -v topic-containing-verbose" to show more complete help
1054 use "hg help -v topic-containing-verbose" to show more complete help
1044 $ hg help -v topic-containing-verbose
1055 $ hg help -v topic-containing-verbose
1045 This is the topic to test omit indicating.
1056 This is the topic to test omit indicating.
1046 """"""""""""""""""""""""""""""""""""""""""
1057 """"""""""""""""""""""""""""""""""""""""""
1047
1058
1048 This paragraph is never omitted (for topic).
1059 This paragraph is never omitted (for topic).
1049
1060
1050 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
1061 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
1051
1062
1052 This paragraph is never omitted, too (for topic)
1063 This paragraph is never omitted, too (for topic)
1053
1064
1054 Test usage of section marks in help documents
1065 Test usage of section marks in help documents
1055
1066
1056 $ cd "$TESTDIR"/../doc
1067 $ cd "$TESTDIR"/../doc
1057 $ python check-seclevel.py
1068 $ python check-seclevel.py
1058 $ cd $TESTTMP
1069 $ cd $TESTTMP
1059
1070
1060 #if serve
1071 #if serve
1061
1072
1062 Test the help pages in hgweb.
1073 Test the help pages in hgweb.
1063
1074
1064 Dish up an empty repo; serve it cold.
1075 Dish up an empty repo; serve it cold.
1065
1076
1066 $ hg init "$TESTTMP/test"
1077 $ hg init "$TESTTMP/test"
1067 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1078 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1068 $ cat hg.pid >> $DAEMON_PIDS
1079 $ cat hg.pid >> $DAEMON_PIDS
1069
1080
1070 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
1081 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
1071 200 Script output follows
1082 200 Script output follows
1072
1083
1073 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1084 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1074 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1085 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1075 <head>
1086 <head>
1076 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1087 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1077 <meta name="robots" content="index, nofollow" />
1088 <meta name="robots" content="index, nofollow" />
1078 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1089 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1079 <script type="text/javascript" src="/static/mercurial.js"></script>
1090 <script type="text/javascript" src="/static/mercurial.js"></script>
1080
1091
1081 <title>Help: Index</title>
1092 <title>Help: Index</title>
1082 </head>
1093 </head>
1083 <body>
1094 <body>
1084
1095
1085 <div class="container">
1096 <div class="container">
1086 <div class="menu">
1097 <div class="menu">
1087 <div class="logo">
1098 <div class="logo">
1088 <a href="http://mercurial.selenic.com/">
1099 <a href="http://mercurial.selenic.com/">
1089 <img src="/static/hglogo.png" alt="mercurial" /></a>
1100 <img src="/static/hglogo.png" alt="mercurial" /></a>
1090 </div>
1101 </div>
1091 <ul>
1102 <ul>
1092 <li><a href="/shortlog">log</a></li>
1103 <li><a href="/shortlog">log</a></li>
1093 <li><a href="/graph">graph</a></li>
1104 <li><a href="/graph">graph</a></li>
1094 <li><a href="/tags">tags</a></li>
1105 <li><a href="/tags">tags</a></li>
1095 <li><a href="/bookmarks">bookmarks</a></li>
1106 <li><a href="/bookmarks">bookmarks</a></li>
1096 <li><a href="/branches">branches</a></li>
1107 <li><a href="/branches">branches</a></li>
1097 </ul>
1108 </ul>
1098 <ul>
1109 <ul>
1099 <li class="active">help</li>
1110 <li class="active">help</li>
1100 </ul>
1111 </ul>
1101 </div>
1112 </div>
1102
1113
1103 <div class="main">
1114 <div class="main">
1104 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1115 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1105 <form class="search" action="/log">
1116 <form class="search" action="/log">
1106
1117
1107 <p><input name="rev" id="search1" type="text" size="30" /></p>
1118 <p><input name="rev" id="search1" type="text" size="30" /></p>
1108 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1119 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1109 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1120 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1110 </form>
1121 </form>
1111 <table class="bigtable">
1122 <table class="bigtable">
1112 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1123 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1113
1124
1114 <tr><td>
1125 <tr><td>
1115 <a href="/help/config">
1126 <a href="/help/config">
1116 config
1127 config
1117 </a>
1128 </a>
1118 </td><td>
1129 </td><td>
1119 Configuration Files
1130 Configuration Files
1120 </td></tr>
1131 </td></tr>
1121 <tr><td>
1132 <tr><td>
1122 <a href="/help/dates">
1133 <a href="/help/dates">
1123 dates
1134 dates
1124 </a>
1135 </a>
1125 </td><td>
1136 </td><td>
1126 Date Formats
1137 Date Formats
1127 </td></tr>
1138 </td></tr>
1128 <tr><td>
1139 <tr><td>
1129 <a href="/help/diffs">
1140 <a href="/help/diffs">
1130 diffs
1141 diffs
1131 </a>
1142 </a>
1132 </td><td>
1143 </td><td>
1133 Diff Formats
1144 Diff Formats
1134 </td></tr>
1145 </td></tr>
1135 <tr><td>
1146 <tr><td>
1136 <a href="/help/environment">
1147 <a href="/help/environment">
1137 environment
1148 environment
1138 </a>
1149 </a>
1139 </td><td>
1150 </td><td>
1140 Environment Variables
1151 Environment Variables
1141 </td></tr>
1152 </td></tr>
1142 <tr><td>
1153 <tr><td>
1143 <a href="/help/extensions">
1154 <a href="/help/extensions">
1144 extensions
1155 extensions
1145 </a>
1156 </a>
1146 </td><td>
1157 </td><td>
1147 Using Additional Features
1158 Using Additional Features
1148 </td></tr>
1159 </td></tr>
1149 <tr><td>
1160 <tr><td>
1150 <a href="/help/filesets">
1161 <a href="/help/filesets">
1151 filesets
1162 filesets
1152 </a>
1163 </a>
1153 </td><td>
1164 </td><td>
1154 Specifying File Sets
1165 Specifying File Sets
1155 </td></tr>
1166 </td></tr>
1156 <tr><td>
1167 <tr><td>
1157 <a href="/help/glossary">
1168 <a href="/help/glossary">
1158 glossary
1169 glossary
1159 </a>
1170 </a>
1160 </td><td>
1171 </td><td>
1161 Glossary
1172 Glossary
1162 </td></tr>
1173 </td></tr>
1163 <tr><td>
1174 <tr><td>
1164 <a href="/help/hgignore">
1175 <a href="/help/hgignore">
1165 hgignore
1176 hgignore
1166 </a>
1177 </a>
1167 </td><td>
1178 </td><td>
1168 Syntax for Mercurial Ignore Files
1179 Syntax for Mercurial Ignore Files
1169 </td></tr>
1180 </td></tr>
1170 <tr><td>
1181 <tr><td>
1171 <a href="/help/hgweb">
1182 <a href="/help/hgweb">
1172 hgweb
1183 hgweb
1173 </a>
1184 </a>
1174 </td><td>
1185 </td><td>
1175 Configuring hgweb
1186 Configuring hgweb
1176 </td></tr>
1187 </td></tr>
1177 <tr><td>
1188 <tr><td>
1178 <a href="/help/merge-tools">
1189 <a href="/help/merge-tools">
1179 merge-tools
1190 merge-tools
1180 </a>
1191 </a>
1181 </td><td>
1192 </td><td>
1182 Merge Tools
1193 Merge Tools
1183 </td></tr>
1194 </td></tr>
1184 <tr><td>
1195 <tr><td>
1185 <a href="/help/multirevs">
1196 <a href="/help/multirevs">
1186 multirevs
1197 multirevs
1187 </a>
1198 </a>
1188 </td><td>
1199 </td><td>
1189 Specifying Multiple Revisions
1200 Specifying Multiple Revisions
1190 </td></tr>
1201 </td></tr>
1191 <tr><td>
1202 <tr><td>
1192 <a href="/help/patterns">
1203 <a href="/help/patterns">
1193 patterns
1204 patterns
1194 </a>
1205 </a>
1195 </td><td>
1206 </td><td>
1196 File Name Patterns
1207 File Name Patterns
1197 </td></tr>
1208 </td></tr>
1198 <tr><td>
1209 <tr><td>
1199 <a href="/help/phases">
1210 <a href="/help/phases">
1200 phases
1211 phases
1201 </a>
1212 </a>
1202 </td><td>
1213 </td><td>
1203 Working with Phases
1214 Working with Phases
1204 </td></tr>
1215 </td></tr>
1205 <tr><td>
1216 <tr><td>
1206 <a href="/help/revisions">
1217 <a href="/help/revisions">
1207 revisions
1218 revisions
1208 </a>
1219 </a>
1209 </td><td>
1220 </td><td>
1210 Specifying Single Revisions
1221 Specifying Single Revisions
1211 </td></tr>
1222 </td></tr>
1212 <tr><td>
1223 <tr><td>
1213 <a href="/help/revsets">
1224 <a href="/help/revsets">
1214 revsets
1225 revsets
1215 </a>
1226 </a>
1216 </td><td>
1227 </td><td>
1217 Specifying Revision Sets
1228 Specifying Revision Sets
1218 </td></tr>
1229 </td></tr>
1219 <tr><td>
1230 <tr><td>
1220 <a href="/help/subrepos">
1231 <a href="/help/subrepos">
1221 subrepos
1232 subrepos
1222 </a>
1233 </a>
1223 </td><td>
1234 </td><td>
1224 Subrepositories
1235 Subrepositories
1225 </td></tr>
1236 </td></tr>
1226 <tr><td>
1237 <tr><td>
1227 <a href="/help/templating">
1238 <a href="/help/templating">
1228 templating
1239 templating
1229 </a>
1240 </a>
1230 </td><td>
1241 </td><td>
1231 Template Usage
1242 Template Usage
1232 </td></tr>
1243 </td></tr>
1233 <tr><td>
1244 <tr><td>
1234 <a href="/help/urls">
1245 <a href="/help/urls">
1235 urls
1246 urls
1236 </a>
1247 </a>
1237 </td><td>
1248 </td><td>
1238 URL Paths
1249 URL Paths
1239 </td></tr>
1250 </td></tr>
1240 <tr><td>
1251 <tr><td>
1241 <a href="/help/topic-containing-verbose">
1252 <a href="/help/topic-containing-verbose">
1242 topic-containing-verbose
1253 topic-containing-verbose
1243 </a>
1254 </a>
1244 </td><td>
1255 </td><td>
1245 This is the topic to test omit indicating.
1256 This is the topic to test omit indicating.
1246 </td></tr>
1257 </td></tr>
1247
1258
1248 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1259 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1249
1260
1250 <tr><td>
1261 <tr><td>
1251 <a href="/help/add">
1262 <a href="/help/add">
1252 add
1263 add
1253 </a>
1264 </a>
1254 </td><td>
1265 </td><td>
1255 add the specified files on the next commit
1266 add the specified files on the next commit
1256 </td></tr>
1267 </td></tr>
1257 <tr><td>
1268 <tr><td>
1258 <a href="/help/annotate">
1269 <a href="/help/annotate">
1259 annotate
1270 annotate
1260 </a>
1271 </a>
1261 </td><td>
1272 </td><td>
1262 show changeset information by line for each file
1273 show changeset information by line for each file
1263 </td></tr>
1274 </td></tr>
1264 <tr><td>
1275 <tr><td>
1265 <a href="/help/clone">
1276 <a href="/help/clone">
1266 clone
1277 clone
1267 </a>
1278 </a>
1268 </td><td>
1279 </td><td>
1269 make a copy of an existing repository
1280 make a copy of an existing repository
1270 </td></tr>
1281 </td></tr>
1271 <tr><td>
1282 <tr><td>
1272 <a href="/help/commit">
1283 <a href="/help/commit">
1273 commit
1284 commit
1274 </a>
1285 </a>
1275 </td><td>
1286 </td><td>
1276 commit the specified files or all outstanding changes
1287 commit the specified files or all outstanding changes
1277 </td></tr>
1288 </td></tr>
1278 <tr><td>
1289 <tr><td>
1279 <a href="/help/diff">
1290 <a href="/help/diff">
1280 diff
1291 diff
1281 </a>
1292 </a>
1282 </td><td>
1293 </td><td>
1283 diff repository (or selected files)
1294 diff repository (or selected files)
1284 </td></tr>
1295 </td></tr>
1285 <tr><td>
1296 <tr><td>
1286 <a href="/help/export">
1297 <a href="/help/export">
1287 export
1298 export
1288 </a>
1299 </a>
1289 </td><td>
1300 </td><td>
1290 dump the header and diffs for one or more changesets
1301 dump the header and diffs for one or more changesets
1291 </td></tr>
1302 </td></tr>
1292 <tr><td>
1303 <tr><td>
1293 <a href="/help/forget">
1304 <a href="/help/forget">
1294 forget
1305 forget
1295 </a>
1306 </a>
1296 </td><td>
1307 </td><td>
1297 forget the specified files on the next commit
1308 forget the specified files on the next commit
1298 </td></tr>
1309 </td></tr>
1299 <tr><td>
1310 <tr><td>
1300 <a href="/help/init">
1311 <a href="/help/init">
1301 init
1312 init
1302 </a>
1313 </a>
1303 </td><td>
1314 </td><td>
1304 create a new repository in the given directory
1315 create a new repository in the given directory
1305 </td></tr>
1316 </td></tr>
1306 <tr><td>
1317 <tr><td>
1307 <a href="/help/log">
1318 <a href="/help/log">
1308 log
1319 log
1309 </a>
1320 </a>
1310 </td><td>
1321 </td><td>
1311 show revision history of entire repository or files
1322 show revision history of entire repository or files
1312 </td></tr>
1323 </td></tr>
1313 <tr><td>
1324 <tr><td>
1314 <a href="/help/merge">
1325 <a href="/help/merge">
1315 merge
1326 merge
1316 </a>
1327 </a>
1317 </td><td>
1328 </td><td>
1318 merge working directory with another revision
1329 merge working directory with another revision
1319 </td></tr>
1330 </td></tr>
1320 <tr><td>
1331 <tr><td>
1321 <a href="/help/pull">
1332 <a href="/help/pull">
1322 pull
1333 pull
1323 </a>
1334 </a>
1324 </td><td>
1335 </td><td>
1325 pull changes from the specified source
1336 pull changes from the specified source
1326 </td></tr>
1337 </td></tr>
1327 <tr><td>
1338 <tr><td>
1328 <a href="/help/push">
1339 <a href="/help/push">
1329 push
1340 push
1330 </a>
1341 </a>
1331 </td><td>
1342 </td><td>
1332 push changes to the specified destination
1343 push changes to the specified destination
1333 </td></tr>
1344 </td></tr>
1334 <tr><td>
1345 <tr><td>
1335 <a href="/help/remove">
1346 <a href="/help/remove">
1336 remove
1347 remove
1337 </a>
1348 </a>
1338 </td><td>
1349 </td><td>
1339 remove the specified files on the next commit
1350 remove the specified files on the next commit
1340 </td></tr>
1351 </td></tr>
1341 <tr><td>
1352 <tr><td>
1342 <a href="/help/serve">
1353 <a href="/help/serve">
1343 serve
1354 serve
1344 </a>
1355 </a>
1345 </td><td>
1356 </td><td>
1346 start stand-alone webserver
1357 start stand-alone webserver
1347 </td></tr>
1358 </td></tr>
1348 <tr><td>
1359 <tr><td>
1349 <a href="/help/status">
1360 <a href="/help/status">
1350 status
1361 status
1351 </a>
1362 </a>
1352 </td><td>
1363 </td><td>
1353 show changed files in the working directory
1364 show changed files in the working directory
1354 </td></tr>
1365 </td></tr>
1355 <tr><td>
1366 <tr><td>
1356 <a href="/help/summary">
1367 <a href="/help/summary">
1357 summary
1368 summary
1358 </a>
1369 </a>
1359 </td><td>
1370 </td><td>
1360 summarize working directory state
1371 summarize working directory state
1361 </td></tr>
1372 </td></tr>
1362 <tr><td>
1373 <tr><td>
1363 <a href="/help/update">
1374 <a href="/help/update">
1364 update
1375 update
1365 </a>
1376 </a>
1366 </td><td>
1377 </td><td>
1367 update working directory (or switch revisions)
1378 update working directory (or switch revisions)
1368 </td></tr>
1379 </td></tr>
1369
1380
1370 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1381 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1371
1382
1372 <tr><td>
1383 <tr><td>
1373 <a href="/help/addremove">
1384 <a href="/help/addremove">
1374 addremove
1385 addremove
1375 </a>
1386 </a>
1376 </td><td>
1387 </td><td>
1377 add all new files, delete all missing files
1388 add all new files, delete all missing files
1378 </td></tr>
1389 </td></tr>
1379 <tr><td>
1390 <tr><td>
1380 <a href="/help/archive">
1391 <a href="/help/archive">
1381 archive
1392 archive
1382 </a>
1393 </a>
1383 </td><td>
1394 </td><td>
1384 create an unversioned archive of a repository revision
1395 create an unversioned archive of a repository revision
1385 </td></tr>
1396 </td></tr>
1386 <tr><td>
1397 <tr><td>
1387 <a href="/help/backout">
1398 <a href="/help/backout">
1388 backout
1399 backout
1389 </a>
1400 </a>
1390 </td><td>
1401 </td><td>
1391 reverse effect of earlier changeset
1402 reverse effect of earlier changeset
1392 </td></tr>
1403 </td></tr>
1393 <tr><td>
1404 <tr><td>
1394 <a href="/help/bisect">
1405 <a href="/help/bisect">
1395 bisect
1406 bisect
1396 </a>
1407 </a>
1397 </td><td>
1408 </td><td>
1398 subdivision search of changesets
1409 subdivision search of changesets
1399 </td></tr>
1410 </td></tr>
1400 <tr><td>
1411 <tr><td>
1401 <a href="/help/bookmarks">
1412 <a href="/help/bookmarks">
1402 bookmarks
1413 bookmarks
1403 </a>
1414 </a>
1404 </td><td>
1415 </td><td>
1405 create a new bookmark or list existing bookmarks
1416 create a new bookmark or list existing bookmarks
1406 </td></tr>
1417 </td></tr>
1407 <tr><td>
1418 <tr><td>
1408 <a href="/help/branch">
1419 <a href="/help/branch">
1409 branch
1420 branch
1410 </a>
1421 </a>
1411 </td><td>
1422 </td><td>
1412 set or show the current branch name
1423 set or show the current branch name
1413 </td></tr>
1424 </td></tr>
1414 <tr><td>
1425 <tr><td>
1415 <a href="/help/branches">
1426 <a href="/help/branches">
1416 branches
1427 branches
1417 </a>
1428 </a>
1418 </td><td>
1429 </td><td>
1419 list repository named branches
1430 list repository named branches
1420 </td></tr>
1431 </td></tr>
1421 <tr><td>
1432 <tr><td>
1422 <a href="/help/bundle">
1433 <a href="/help/bundle">
1423 bundle
1434 bundle
1424 </a>
1435 </a>
1425 </td><td>
1436 </td><td>
1426 create a changegroup file
1437 create a changegroup file
1427 </td></tr>
1438 </td></tr>
1428 <tr><td>
1439 <tr><td>
1429 <a href="/help/cat">
1440 <a href="/help/cat">
1430 cat
1441 cat
1431 </a>
1442 </a>
1432 </td><td>
1443 </td><td>
1433 output the current or given revision of files
1444 output the current or given revision of files
1434 </td></tr>
1445 </td></tr>
1435 <tr><td>
1446 <tr><td>
1436 <a href="/help/config">
1447 <a href="/help/config">
1437 config
1448 config
1438 </a>
1449 </a>
1439 </td><td>
1450 </td><td>
1440 show combined config settings from all hgrc files
1451 show combined config settings from all hgrc files
1441 </td></tr>
1452 </td></tr>
1442 <tr><td>
1453 <tr><td>
1443 <a href="/help/copy">
1454 <a href="/help/copy">
1444 copy
1455 copy
1445 </a>
1456 </a>
1446 </td><td>
1457 </td><td>
1447 mark files as copied for the next commit
1458 mark files as copied for the next commit
1448 </td></tr>
1459 </td></tr>
1449 <tr><td>
1460 <tr><td>
1450 <a href="/help/graft">
1461 <a href="/help/graft">
1451 graft
1462 graft
1452 </a>
1463 </a>
1453 </td><td>
1464 </td><td>
1454 copy changes from other branches onto the current branch
1465 copy changes from other branches onto the current branch
1455 </td></tr>
1466 </td></tr>
1456 <tr><td>
1467 <tr><td>
1457 <a href="/help/grep">
1468 <a href="/help/grep">
1458 grep
1469 grep
1459 </a>
1470 </a>
1460 </td><td>
1471 </td><td>
1461 search for a pattern in specified files and revisions
1472 search for a pattern in specified files and revisions
1462 </td></tr>
1473 </td></tr>
1463 <tr><td>
1474 <tr><td>
1464 <a href="/help/heads">
1475 <a href="/help/heads">
1465 heads
1476 heads
1466 </a>
1477 </a>
1467 </td><td>
1478 </td><td>
1468 show branch heads
1479 show branch heads
1469 </td></tr>
1480 </td></tr>
1470 <tr><td>
1481 <tr><td>
1471 <a href="/help/help">
1482 <a href="/help/help">
1472 help
1483 help
1473 </a>
1484 </a>
1474 </td><td>
1485 </td><td>
1475 show help for a given topic or a help overview
1486 show help for a given topic or a help overview
1476 </td></tr>
1487 </td></tr>
1477 <tr><td>
1488 <tr><td>
1478 <a href="/help/identify">
1489 <a href="/help/identify">
1479 identify
1490 identify
1480 </a>
1491 </a>
1481 </td><td>
1492 </td><td>
1482 identify the working copy or specified revision
1493 identify the working copy or specified revision
1483 </td></tr>
1494 </td></tr>
1484 <tr><td>
1495 <tr><td>
1485 <a href="/help/import">
1496 <a href="/help/import">
1486 import
1497 import
1487 </a>
1498 </a>
1488 </td><td>
1499 </td><td>
1489 import an ordered set of patches
1500 import an ordered set of patches
1490 </td></tr>
1501 </td></tr>
1491 <tr><td>
1502 <tr><td>
1492 <a href="/help/incoming">
1503 <a href="/help/incoming">
1493 incoming
1504 incoming
1494 </a>
1505 </a>
1495 </td><td>
1506 </td><td>
1496 show new changesets found in source
1507 show new changesets found in source
1497 </td></tr>
1508 </td></tr>
1498 <tr><td>
1509 <tr><td>
1499 <a href="/help/locate">
1510 <a href="/help/locate">
1500 locate
1511 locate
1501 </a>
1512 </a>
1502 </td><td>
1513 </td><td>
1503 locate files matching specific patterns
1514 locate files matching specific patterns
1504 </td></tr>
1515 </td></tr>
1505 <tr><td>
1516 <tr><td>
1506 <a href="/help/manifest">
1517 <a href="/help/manifest">
1507 manifest
1518 manifest
1508 </a>
1519 </a>
1509 </td><td>
1520 </td><td>
1510 output the current or given revision of the project manifest
1521 output the current or given revision of the project manifest
1511 </td></tr>
1522 </td></tr>
1512 <tr><td>
1523 <tr><td>
1513 <a href="/help/nohelp">
1524 <a href="/help/nohelp">
1514 nohelp
1525 nohelp
1515 </a>
1526 </a>
1516 </td><td>
1527 </td><td>
1517 (no help text available)
1528 (no help text available)
1518 </td></tr>
1529 </td></tr>
1519 <tr><td>
1530 <tr><td>
1520 <a href="/help/outgoing">
1531 <a href="/help/outgoing">
1521 outgoing
1532 outgoing
1522 </a>
1533 </a>
1523 </td><td>
1534 </td><td>
1524 show changesets not found in the destination
1535 show changesets not found in the destination
1525 </td></tr>
1536 </td></tr>
1526 <tr><td>
1537 <tr><td>
1527 <a href="/help/parents">
1538 <a href="/help/parents">
1528 parents
1539 parents
1529 </a>
1540 </a>
1530 </td><td>
1541 </td><td>
1531 show the parents of the working directory or revision
1542 show the parents of the working directory or revision
1532 </td></tr>
1543 </td></tr>
1533 <tr><td>
1544 <tr><td>
1534 <a href="/help/paths">
1545 <a href="/help/paths">
1535 paths
1546 paths
1536 </a>
1547 </a>
1537 </td><td>
1548 </td><td>
1538 show aliases for remote repositories
1549 show aliases for remote repositories
1539 </td></tr>
1550 </td></tr>
1540 <tr><td>
1551 <tr><td>
1541 <a href="/help/phase">
1552 <a href="/help/phase">
1542 phase
1553 phase
1543 </a>
1554 </a>
1544 </td><td>
1555 </td><td>
1545 set or show the current phase name
1556 set or show the current phase name
1546 </td></tr>
1557 </td></tr>
1547 <tr><td>
1558 <tr><td>
1548 <a href="/help/recover">
1559 <a href="/help/recover">
1549 recover
1560 recover
1550 </a>
1561 </a>
1551 </td><td>
1562 </td><td>
1552 roll back an interrupted transaction
1563 roll back an interrupted transaction
1553 </td></tr>
1564 </td></tr>
1554 <tr><td>
1565 <tr><td>
1555 <a href="/help/rename">
1566 <a href="/help/rename">
1556 rename
1567 rename
1557 </a>
1568 </a>
1558 </td><td>
1569 </td><td>
1559 rename files; equivalent of copy + remove
1570 rename files; equivalent of copy + remove
1560 </td></tr>
1571 </td></tr>
1561 <tr><td>
1572 <tr><td>
1562 <a href="/help/resolve">
1573 <a href="/help/resolve">
1563 resolve
1574 resolve
1564 </a>
1575 </a>
1565 </td><td>
1576 </td><td>
1566 redo merges or set/view the merge status of files
1577 redo merges or set/view the merge status of files
1567 </td></tr>
1578 </td></tr>
1568 <tr><td>
1579 <tr><td>
1569 <a href="/help/revert">
1580 <a href="/help/revert">
1570 revert
1581 revert
1571 </a>
1582 </a>
1572 </td><td>
1583 </td><td>
1573 restore files to their checkout state
1584 restore files to their checkout state
1574 </td></tr>
1585 </td></tr>
1575 <tr><td>
1586 <tr><td>
1576 <a href="/help/root">
1587 <a href="/help/root">
1577 root
1588 root
1578 </a>
1589 </a>
1579 </td><td>
1590 </td><td>
1580 print the root (top) of the current working directory
1591 print the root (top) of the current working directory
1581 </td></tr>
1592 </td></tr>
1582 <tr><td>
1593 <tr><td>
1583 <a href="/help/tag">
1594 <a href="/help/tag">
1584 tag
1595 tag
1585 </a>
1596 </a>
1586 </td><td>
1597 </td><td>
1587 add one or more tags for the current or given revision
1598 add one or more tags for the current or given revision
1588 </td></tr>
1599 </td></tr>
1589 <tr><td>
1600 <tr><td>
1590 <a href="/help/tags">
1601 <a href="/help/tags">
1591 tags
1602 tags
1592 </a>
1603 </a>
1593 </td><td>
1604 </td><td>
1594 list repository tags
1605 list repository tags
1595 </td></tr>
1606 </td></tr>
1596 <tr><td>
1607 <tr><td>
1597 <a href="/help/unbundle">
1608 <a href="/help/unbundle">
1598 unbundle
1609 unbundle
1599 </a>
1610 </a>
1600 </td><td>
1611 </td><td>
1601 apply one or more changegroup files
1612 apply one or more changegroup files
1602 </td></tr>
1613 </td></tr>
1603 <tr><td>
1614 <tr><td>
1604 <a href="/help/verify">
1615 <a href="/help/verify">
1605 verify
1616 verify
1606 </a>
1617 </a>
1607 </td><td>
1618 </td><td>
1608 verify the integrity of the repository
1619 verify the integrity of the repository
1609 </td></tr>
1620 </td></tr>
1610 <tr><td>
1621 <tr><td>
1611 <a href="/help/version">
1622 <a href="/help/version">
1612 version
1623 version
1613 </a>
1624 </a>
1614 </td><td>
1625 </td><td>
1615 output version and copyright information
1626 output version and copyright information
1616 </td></tr>
1627 </td></tr>
1617 </table>
1628 </table>
1618 </div>
1629 </div>
1619 </div>
1630 </div>
1620
1631
1621 <script type="text/javascript">process_dates()</script>
1632 <script type="text/javascript">process_dates()</script>
1622
1633
1623
1634
1624 </body>
1635 </body>
1625 </html>
1636 </html>
1626
1637
1627
1638
1628 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1639 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1629 200 Script output follows
1640 200 Script output follows
1630
1641
1631 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1642 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1632 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1643 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1633 <head>
1644 <head>
1634 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1645 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1635 <meta name="robots" content="index, nofollow" />
1646 <meta name="robots" content="index, nofollow" />
1636 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1647 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1637 <script type="text/javascript" src="/static/mercurial.js"></script>
1648 <script type="text/javascript" src="/static/mercurial.js"></script>
1638
1649
1639 <title>Help: add</title>
1650 <title>Help: add</title>
1640 </head>
1651 </head>
1641 <body>
1652 <body>
1642
1653
1643 <div class="container">
1654 <div class="container">
1644 <div class="menu">
1655 <div class="menu">
1645 <div class="logo">
1656 <div class="logo">
1646 <a href="http://mercurial.selenic.com/">
1657 <a href="http://mercurial.selenic.com/">
1647 <img src="/static/hglogo.png" alt="mercurial" /></a>
1658 <img src="/static/hglogo.png" alt="mercurial" /></a>
1648 </div>
1659 </div>
1649 <ul>
1660 <ul>
1650 <li><a href="/shortlog">log</a></li>
1661 <li><a href="/shortlog">log</a></li>
1651 <li><a href="/graph">graph</a></li>
1662 <li><a href="/graph">graph</a></li>
1652 <li><a href="/tags">tags</a></li>
1663 <li><a href="/tags">tags</a></li>
1653 <li><a href="/bookmarks">bookmarks</a></li>
1664 <li><a href="/bookmarks">bookmarks</a></li>
1654 <li><a href="/branches">branches</a></li>
1665 <li><a href="/branches">branches</a></li>
1655 </ul>
1666 </ul>
1656 <ul>
1667 <ul>
1657 <li class="active"><a href="/help">help</a></li>
1668 <li class="active"><a href="/help">help</a></li>
1658 </ul>
1669 </ul>
1659 </div>
1670 </div>
1660
1671
1661 <div class="main">
1672 <div class="main">
1662 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1673 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1663 <h3>Help: add</h3>
1674 <h3>Help: add</h3>
1664
1675
1665 <form class="search" action="/log">
1676 <form class="search" action="/log">
1666
1677
1667 <p><input name="rev" id="search1" type="text" size="30" /></p>
1678 <p><input name="rev" id="search1" type="text" size="30" /></p>
1668 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1679 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1669 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1680 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1670 </form>
1681 </form>
1671 <div id="doc">
1682 <div id="doc">
1672 <p>
1683 <p>
1673 hg add [OPTION]... [FILE]...
1684 hg add [OPTION]... [FILE]...
1674 </p>
1685 </p>
1675 <p>
1686 <p>
1676 add the specified files on the next commit
1687 add the specified files on the next commit
1677 </p>
1688 </p>
1678 <p>
1689 <p>
1679 Schedule files to be version controlled and added to the
1690 Schedule files to be version controlled and added to the
1680 repository.
1691 repository.
1681 </p>
1692 </p>
1682 <p>
1693 <p>
1683 The files will be added to the repository at the next commit. To
1694 The files will be added to the repository at the next commit. To
1684 undo an add before that, see &quot;hg forget&quot;.
1695 undo an add before that, see &quot;hg forget&quot;.
1685 </p>
1696 </p>
1686 <p>
1697 <p>
1687 If no names are given, add all files to the repository.
1698 If no names are given, add all files to the repository.
1688 </p>
1699 </p>
1689 <p>
1700 <p>
1690 An example showing how new (unknown) files are added
1701 An example showing how new (unknown) files are added
1691 automatically by &quot;hg add&quot;:
1702 automatically by &quot;hg add&quot;:
1692 </p>
1703 </p>
1693 <pre>
1704 <pre>
1694 \$ ls (re)
1705 \$ ls (re)
1695 foo.c
1706 foo.c
1696 \$ hg status (re)
1707 \$ hg status (re)
1697 ? foo.c
1708 ? foo.c
1698 \$ hg add (re)
1709 \$ hg add (re)
1699 adding foo.c
1710 adding foo.c
1700 \$ hg status (re)
1711 \$ hg status (re)
1701 A foo.c
1712 A foo.c
1702 </pre>
1713 </pre>
1703 <p>
1714 <p>
1704 Returns 0 if all files are successfully added.
1715 Returns 0 if all files are successfully added.
1705 </p>
1716 </p>
1706 <p>
1717 <p>
1707 options:
1718 options:
1708 </p>
1719 </p>
1709 <table>
1720 <table>
1710 <tr><td>-I</td>
1721 <tr><td>-I</td>
1711 <td>--include PATTERN [+]</td>
1722 <td>--include PATTERN [+]</td>
1712 <td>include names matching the given patterns</td></tr>
1723 <td>include names matching the given patterns</td></tr>
1713 <tr><td>-X</td>
1724 <tr><td>-X</td>
1714 <td>--exclude PATTERN [+]</td>
1725 <td>--exclude PATTERN [+]</td>
1715 <td>exclude names matching the given patterns</td></tr>
1726 <td>exclude names matching the given patterns</td></tr>
1716 <tr><td>-S</td>
1727 <tr><td>-S</td>
1717 <td>--subrepos</td>
1728 <td>--subrepos</td>
1718 <td>recurse into subrepositories</td></tr>
1729 <td>recurse into subrepositories</td></tr>
1719 <tr><td>-n</td>
1730 <tr><td>-n</td>
1720 <td>--dry-run</td>
1731 <td>--dry-run</td>
1721 <td>do not perform actions, just print output</td></tr>
1732 <td>do not perform actions, just print output</td></tr>
1722 </table>
1733 </table>
1723 <p>
1734 <p>
1724 [+] marked option can be specified multiple times
1735 [+] marked option can be specified multiple times
1725 </p>
1736 </p>
1726 <p>
1737 <p>
1727 global options:
1738 global options:
1728 </p>
1739 </p>
1729 <table>
1740 <table>
1730 <tr><td>-R</td>
1741 <tr><td>-R</td>
1731 <td>--repository REPO</td>
1742 <td>--repository REPO</td>
1732 <td>repository root directory or name of overlay bundle file</td></tr>
1743 <td>repository root directory or name of overlay bundle file</td></tr>
1733 <tr><td></td>
1744 <tr><td></td>
1734 <td>--cwd DIR</td>
1745 <td>--cwd DIR</td>
1735 <td>change working directory</td></tr>
1746 <td>change working directory</td></tr>
1736 <tr><td>-y</td>
1747 <tr><td>-y</td>
1737 <td>--noninteractive</td>
1748 <td>--noninteractive</td>
1738 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1749 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1739 <tr><td>-q</td>
1750 <tr><td>-q</td>
1740 <td>--quiet</td>
1751 <td>--quiet</td>
1741 <td>suppress output</td></tr>
1752 <td>suppress output</td></tr>
1742 <tr><td>-v</td>
1753 <tr><td>-v</td>
1743 <td>--verbose</td>
1754 <td>--verbose</td>
1744 <td>enable additional output</td></tr>
1755 <td>enable additional output</td></tr>
1745 <tr><td></td>
1756 <tr><td></td>
1746 <td>--config CONFIG [+]</td>
1757 <td>--config CONFIG [+]</td>
1747 <td>set/override config option (use 'section.name=value')</td></tr>
1758 <td>set/override config option (use 'section.name=value')</td></tr>
1748 <tr><td></td>
1759 <tr><td></td>
1749 <td>--debug</td>
1760 <td>--debug</td>
1750 <td>enable debugging output</td></tr>
1761 <td>enable debugging output</td></tr>
1751 <tr><td></td>
1762 <tr><td></td>
1752 <td>--debugger</td>
1763 <td>--debugger</td>
1753 <td>start debugger</td></tr>
1764 <td>start debugger</td></tr>
1754 <tr><td></td>
1765 <tr><td></td>
1755 <td>--encoding ENCODE</td>
1766 <td>--encoding ENCODE</td>
1756 <td>set the charset encoding (default: ascii)</td></tr>
1767 <td>set the charset encoding (default: ascii)</td></tr>
1757 <tr><td></td>
1768 <tr><td></td>
1758 <td>--encodingmode MODE</td>
1769 <td>--encodingmode MODE</td>
1759 <td>set the charset encoding mode (default: strict)</td></tr>
1770 <td>set the charset encoding mode (default: strict)</td></tr>
1760 <tr><td></td>
1771 <tr><td></td>
1761 <td>--traceback</td>
1772 <td>--traceback</td>
1762 <td>always print a traceback on exception</td></tr>
1773 <td>always print a traceback on exception</td></tr>
1763 <tr><td></td>
1774 <tr><td></td>
1764 <td>--time</td>
1775 <td>--time</td>
1765 <td>time how long the command takes</td></tr>
1776 <td>time how long the command takes</td></tr>
1766 <tr><td></td>
1777 <tr><td></td>
1767 <td>--profile</td>
1778 <td>--profile</td>
1768 <td>print command execution profile</td></tr>
1779 <td>print command execution profile</td></tr>
1769 <tr><td></td>
1780 <tr><td></td>
1770 <td>--version</td>
1781 <td>--version</td>
1771 <td>output version information and exit</td></tr>
1782 <td>output version information and exit</td></tr>
1772 <tr><td>-h</td>
1783 <tr><td>-h</td>
1773 <td>--help</td>
1784 <td>--help</td>
1774 <td>display help and exit</td></tr>
1785 <td>display help and exit</td></tr>
1775 <tr><td></td>
1786 <tr><td></td>
1776 <td>--hidden</td>
1787 <td>--hidden</td>
1777 <td>consider hidden changesets</td></tr>
1788 <td>consider hidden changesets</td></tr>
1778 </table>
1789 </table>
1779 <p>
1790 <p>
1780 [+] marked option can be specified multiple times
1791 [+] marked option can be specified multiple times
1781 </p>
1792 </p>
1782
1793
1783 </div>
1794 </div>
1784 </div>
1795 </div>
1785 </div>
1796 </div>
1786
1797
1787 <script type="text/javascript">process_dates()</script>
1798 <script type="text/javascript">process_dates()</script>
1788
1799
1789
1800
1790 </body>
1801 </body>
1791 </html>
1802 </html>
1792
1803
1793
1804
1794 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1805 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1795 200 Script output follows
1806 200 Script output follows
1796
1807
1797 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1808 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1798 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1809 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1799 <head>
1810 <head>
1800 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1811 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1801 <meta name="robots" content="index, nofollow" />
1812 <meta name="robots" content="index, nofollow" />
1802 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1813 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1803 <script type="text/javascript" src="/static/mercurial.js"></script>
1814 <script type="text/javascript" src="/static/mercurial.js"></script>
1804
1815
1805 <title>Help: remove</title>
1816 <title>Help: remove</title>
1806 </head>
1817 </head>
1807 <body>
1818 <body>
1808
1819
1809 <div class="container">
1820 <div class="container">
1810 <div class="menu">
1821 <div class="menu">
1811 <div class="logo">
1822 <div class="logo">
1812 <a href="http://mercurial.selenic.com/">
1823 <a href="http://mercurial.selenic.com/">
1813 <img src="/static/hglogo.png" alt="mercurial" /></a>
1824 <img src="/static/hglogo.png" alt="mercurial" /></a>
1814 </div>
1825 </div>
1815 <ul>
1826 <ul>
1816 <li><a href="/shortlog">log</a></li>
1827 <li><a href="/shortlog">log</a></li>
1817 <li><a href="/graph">graph</a></li>
1828 <li><a href="/graph">graph</a></li>
1818 <li><a href="/tags">tags</a></li>
1829 <li><a href="/tags">tags</a></li>
1819 <li><a href="/bookmarks">bookmarks</a></li>
1830 <li><a href="/bookmarks">bookmarks</a></li>
1820 <li><a href="/branches">branches</a></li>
1831 <li><a href="/branches">branches</a></li>
1821 </ul>
1832 </ul>
1822 <ul>
1833 <ul>
1823 <li class="active"><a href="/help">help</a></li>
1834 <li class="active"><a href="/help">help</a></li>
1824 </ul>
1835 </ul>
1825 </div>
1836 </div>
1826
1837
1827 <div class="main">
1838 <div class="main">
1828 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1839 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1829 <h3>Help: remove</h3>
1840 <h3>Help: remove</h3>
1830
1841
1831 <form class="search" action="/log">
1842 <form class="search" action="/log">
1832
1843
1833 <p><input name="rev" id="search1" type="text" size="30" /></p>
1844 <p><input name="rev" id="search1" type="text" size="30" /></p>
1834 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1845 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1835 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1846 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1836 </form>
1847 </form>
1837 <div id="doc">
1848 <div id="doc">
1838 <p>
1849 <p>
1839 hg remove [OPTION]... FILE...
1850 hg remove [OPTION]... FILE...
1840 </p>
1851 </p>
1841 <p>
1852 <p>
1842 aliases: rm
1853 aliases: rm
1843 </p>
1854 </p>
1844 <p>
1855 <p>
1845 remove the specified files on the next commit
1856 remove the specified files on the next commit
1846 </p>
1857 </p>
1847 <p>
1858 <p>
1848 Schedule the indicated files for removal from the current branch.
1859 Schedule the indicated files for removal from the current branch.
1849 </p>
1860 </p>
1850 <p>
1861 <p>
1851 This command schedules the files to be removed at the next commit.
1862 This command schedules the files to be removed at the next commit.
1852 To undo a remove before that, see &quot;hg revert&quot;. To undo added
1863 To undo a remove before that, see &quot;hg revert&quot;. To undo added
1853 files, see &quot;hg forget&quot;.
1864 files, see &quot;hg forget&quot;.
1854 </p>
1865 </p>
1855 <p>
1866 <p>
1856 -A/--after can be used to remove only files that have already
1867 -A/--after can be used to remove only files that have already
1857 been deleted, -f/--force can be used to force deletion, and -Af
1868 been deleted, -f/--force can be used to force deletion, and -Af
1858 can be used to remove files from the next revision without
1869 can be used to remove files from the next revision without
1859 deleting them from the working directory.
1870 deleting them from the working directory.
1860 </p>
1871 </p>
1861 <p>
1872 <p>
1862 The following table details the behavior of remove for different
1873 The following table details the behavior of remove for different
1863 file states (columns) and option combinations (rows). The file
1874 file states (columns) and option combinations (rows). The file
1864 states are Added [A], Clean [C], Modified [M] and Missing [!]
1875 states are Added [A], Clean [C], Modified [M] and Missing [!]
1865 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
1876 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
1866 (from branch) and Delete (from disk):
1877 (from branch) and Delete (from disk):
1867 </p>
1878 </p>
1868 <table>
1879 <table>
1869 <tr><td>opt/state</td>
1880 <tr><td>opt/state</td>
1870 <td>A</td>
1881 <td>A</td>
1871 <td>C</td>
1882 <td>C</td>
1872 <td>M</td>
1883 <td>M</td>
1873 <td>!</td></tr>
1884 <td>!</td></tr>
1874 <tr><td>none</td>
1885 <tr><td>none</td>
1875 <td>W</td>
1886 <td>W</td>
1876 <td>RD</td>
1887 <td>RD</td>
1877 <td>W</td>
1888 <td>W</td>
1878 <td>R</td></tr>
1889 <td>R</td></tr>
1879 <tr><td>-f</td>
1890 <tr><td>-f</td>
1880 <td>R</td>
1891 <td>R</td>
1881 <td>RD</td>
1892 <td>RD</td>
1882 <td>RD</td>
1893 <td>RD</td>
1883 <td>R</td></tr>
1894 <td>R</td></tr>
1884 <tr><td>-A</td>
1895 <tr><td>-A</td>
1885 <td>W</td>
1896 <td>W</td>
1886 <td>W</td>
1897 <td>W</td>
1887 <td>W</td>
1898 <td>W</td>
1888 <td>R</td></tr>
1899 <td>R</td></tr>
1889 <tr><td>-Af</td>
1900 <tr><td>-Af</td>
1890 <td>R</td>
1901 <td>R</td>
1891 <td>R</td>
1902 <td>R</td>
1892 <td>R</td>
1903 <td>R</td>
1893 <td>R</td></tr>
1904 <td>R</td></tr>
1894 </table>
1905 </table>
1895 <p>
1906 <p>
1896 Note that remove never deletes files in Added [A] state from the
1907 Note that remove never deletes files in Added [A] state from the
1897 working directory, not even if option --force is specified.
1908 working directory, not even if option --force is specified.
1898 </p>
1909 </p>
1899 <p>
1910 <p>
1900 Returns 0 on success, 1 if any warnings encountered.
1911 Returns 0 on success, 1 if any warnings encountered.
1901 </p>
1912 </p>
1902 <p>
1913 <p>
1903 options:
1914 options:
1904 </p>
1915 </p>
1905 <table>
1916 <table>
1906 <tr><td>-A</td>
1917 <tr><td>-A</td>
1907 <td>--after</td>
1918 <td>--after</td>
1908 <td>record delete for missing files</td></tr>
1919 <td>record delete for missing files</td></tr>
1909 <tr><td>-f</td>
1920 <tr><td>-f</td>
1910 <td>--force</td>
1921 <td>--force</td>
1911 <td>remove (and delete) file even if added or modified</td></tr>
1922 <td>remove (and delete) file even if added or modified</td></tr>
1912 <tr><td>-I</td>
1923 <tr><td>-I</td>
1913 <td>--include PATTERN [+]</td>
1924 <td>--include PATTERN [+]</td>
1914 <td>include names matching the given patterns</td></tr>
1925 <td>include names matching the given patterns</td></tr>
1915 <tr><td>-X</td>
1926 <tr><td>-X</td>
1916 <td>--exclude PATTERN [+]</td>
1927 <td>--exclude PATTERN [+]</td>
1917 <td>exclude names matching the given patterns</td></tr>
1928 <td>exclude names matching the given patterns</td></tr>
1918 </table>
1929 </table>
1919 <p>
1930 <p>
1920 [+] marked option can be specified multiple times
1931 [+] marked option can be specified multiple times
1921 </p>
1932 </p>
1922 <p>
1933 <p>
1923 global options:
1934 global options:
1924 </p>
1935 </p>
1925 <table>
1936 <table>
1926 <tr><td>-R</td>
1937 <tr><td>-R</td>
1927 <td>--repository REPO</td>
1938 <td>--repository REPO</td>
1928 <td>repository root directory or name of overlay bundle file</td></tr>
1939 <td>repository root directory or name of overlay bundle file</td></tr>
1929 <tr><td></td>
1940 <tr><td></td>
1930 <td>--cwd DIR</td>
1941 <td>--cwd DIR</td>
1931 <td>change working directory</td></tr>
1942 <td>change working directory</td></tr>
1932 <tr><td>-y</td>
1943 <tr><td>-y</td>
1933 <td>--noninteractive</td>
1944 <td>--noninteractive</td>
1934 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1945 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1935 <tr><td>-q</td>
1946 <tr><td>-q</td>
1936 <td>--quiet</td>
1947 <td>--quiet</td>
1937 <td>suppress output</td></tr>
1948 <td>suppress output</td></tr>
1938 <tr><td>-v</td>
1949 <tr><td>-v</td>
1939 <td>--verbose</td>
1950 <td>--verbose</td>
1940 <td>enable additional output</td></tr>
1951 <td>enable additional output</td></tr>
1941 <tr><td></td>
1952 <tr><td></td>
1942 <td>--config CONFIG [+]</td>
1953 <td>--config CONFIG [+]</td>
1943 <td>set/override config option (use 'section.name=value')</td></tr>
1954 <td>set/override config option (use 'section.name=value')</td></tr>
1944 <tr><td></td>
1955 <tr><td></td>
1945 <td>--debug</td>
1956 <td>--debug</td>
1946 <td>enable debugging output</td></tr>
1957 <td>enable debugging output</td></tr>
1947 <tr><td></td>
1958 <tr><td></td>
1948 <td>--debugger</td>
1959 <td>--debugger</td>
1949 <td>start debugger</td></tr>
1960 <td>start debugger</td></tr>
1950 <tr><td></td>
1961 <tr><td></td>
1951 <td>--encoding ENCODE</td>
1962 <td>--encoding ENCODE</td>
1952 <td>set the charset encoding (default: ascii)</td></tr>
1963 <td>set the charset encoding (default: ascii)</td></tr>
1953 <tr><td></td>
1964 <tr><td></td>
1954 <td>--encodingmode MODE</td>
1965 <td>--encodingmode MODE</td>
1955 <td>set the charset encoding mode (default: strict)</td></tr>
1966 <td>set the charset encoding mode (default: strict)</td></tr>
1956 <tr><td></td>
1967 <tr><td></td>
1957 <td>--traceback</td>
1968 <td>--traceback</td>
1958 <td>always print a traceback on exception</td></tr>
1969 <td>always print a traceback on exception</td></tr>
1959 <tr><td></td>
1970 <tr><td></td>
1960 <td>--time</td>
1971 <td>--time</td>
1961 <td>time how long the command takes</td></tr>
1972 <td>time how long the command takes</td></tr>
1962 <tr><td></td>
1973 <tr><td></td>
1963 <td>--profile</td>
1974 <td>--profile</td>
1964 <td>print command execution profile</td></tr>
1975 <td>print command execution profile</td></tr>
1965 <tr><td></td>
1976 <tr><td></td>
1966 <td>--version</td>
1977 <td>--version</td>
1967 <td>output version information and exit</td></tr>
1978 <td>output version information and exit</td></tr>
1968 <tr><td>-h</td>
1979 <tr><td>-h</td>
1969 <td>--help</td>
1980 <td>--help</td>
1970 <td>display help and exit</td></tr>
1981 <td>display help and exit</td></tr>
1971 <tr><td></td>
1982 <tr><td></td>
1972 <td>--hidden</td>
1983 <td>--hidden</td>
1973 <td>consider hidden changesets</td></tr>
1984 <td>consider hidden changesets</td></tr>
1974 </table>
1985 </table>
1975 <p>
1986 <p>
1976 [+] marked option can be specified multiple times
1987 [+] marked option can be specified multiple times
1977 </p>
1988 </p>
1978
1989
1979 </div>
1990 </div>
1980 </div>
1991 </div>
1981 </div>
1992 </div>
1982
1993
1983 <script type="text/javascript">process_dates()</script>
1994 <script type="text/javascript">process_dates()</script>
1984
1995
1985
1996
1986 </body>
1997 </body>
1987 </html>
1998 </html>
1988
1999
1989
2000
1990 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
2001 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1991 200 Script output follows
2002 200 Script output follows
1992
2003
1993 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2004 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1994 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2005 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1995 <head>
2006 <head>
1996 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2007 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1997 <meta name="robots" content="index, nofollow" />
2008 <meta name="robots" content="index, nofollow" />
1998 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2009 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1999 <script type="text/javascript" src="/static/mercurial.js"></script>
2010 <script type="text/javascript" src="/static/mercurial.js"></script>
2000
2011
2001 <title>Help: revisions</title>
2012 <title>Help: revisions</title>
2002 </head>
2013 </head>
2003 <body>
2014 <body>
2004
2015
2005 <div class="container">
2016 <div class="container">
2006 <div class="menu">
2017 <div class="menu">
2007 <div class="logo">
2018 <div class="logo">
2008 <a href="http://mercurial.selenic.com/">
2019 <a href="http://mercurial.selenic.com/">
2009 <img src="/static/hglogo.png" alt="mercurial" /></a>
2020 <img src="/static/hglogo.png" alt="mercurial" /></a>
2010 </div>
2021 </div>
2011 <ul>
2022 <ul>
2012 <li><a href="/shortlog">log</a></li>
2023 <li><a href="/shortlog">log</a></li>
2013 <li><a href="/graph">graph</a></li>
2024 <li><a href="/graph">graph</a></li>
2014 <li><a href="/tags">tags</a></li>
2025 <li><a href="/tags">tags</a></li>
2015 <li><a href="/bookmarks">bookmarks</a></li>
2026 <li><a href="/bookmarks">bookmarks</a></li>
2016 <li><a href="/branches">branches</a></li>
2027 <li><a href="/branches">branches</a></li>
2017 </ul>
2028 </ul>
2018 <ul>
2029 <ul>
2019 <li class="active"><a href="/help">help</a></li>
2030 <li class="active"><a href="/help">help</a></li>
2020 </ul>
2031 </ul>
2021 </div>
2032 </div>
2022
2033
2023 <div class="main">
2034 <div class="main">
2024 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2035 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2025 <h3>Help: revisions</h3>
2036 <h3>Help: revisions</h3>
2026
2037
2027 <form class="search" action="/log">
2038 <form class="search" action="/log">
2028
2039
2029 <p><input name="rev" id="search1" type="text" size="30" /></p>
2040 <p><input name="rev" id="search1" type="text" size="30" /></p>
2030 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2041 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2031 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2042 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2032 </form>
2043 </form>
2033 <div id="doc">
2044 <div id="doc">
2034 <h1>Specifying Single Revisions</h1>
2045 <h1>Specifying Single Revisions</h1>
2035 <p>
2046 <p>
2036 Mercurial supports several ways to specify individual revisions.
2047 Mercurial supports several ways to specify individual revisions.
2037 </p>
2048 </p>
2038 <p>
2049 <p>
2039 A plain integer is treated as a revision number. Negative integers are
2050 A plain integer is treated as a revision number. Negative integers are
2040 treated as sequential offsets from the tip, with -1 denoting the tip,
2051 treated as sequential offsets from the tip, with -1 denoting the tip,
2041 -2 denoting the revision prior to the tip, and so forth.
2052 -2 denoting the revision prior to the tip, and so forth.
2042 </p>
2053 </p>
2043 <p>
2054 <p>
2044 A 40-digit hexadecimal string is treated as a unique revision
2055 A 40-digit hexadecimal string is treated as a unique revision
2045 identifier.
2056 identifier.
2046 </p>
2057 </p>
2047 <p>
2058 <p>
2048 A hexadecimal string less than 40 characters long is treated as a
2059 A hexadecimal string less than 40 characters long is treated as a
2049 unique revision identifier and is referred to as a short-form
2060 unique revision identifier and is referred to as a short-form
2050 identifier. A short-form identifier is only valid if it is the prefix
2061 identifier. A short-form identifier is only valid if it is the prefix
2051 of exactly one full-length identifier.
2062 of exactly one full-length identifier.
2052 </p>
2063 </p>
2053 <p>
2064 <p>
2054 Any other string is treated as a bookmark, tag, or branch name. A
2065 Any other string is treated as a bookmark, tag, or branch name. A
2055 bookmark is a movable pointer to a revision. A tag is a permanent name
2066 bookmark is a movable pointer to a revision. A tag is a permanent name
2056 associated with a revision. A branch name denotes the tipmost open branch head
2067 associated with a revision. A branch name denotes the tipmost open branch head
2057 of that branch - or if they are all closed, the tipmost closed head of the
2068 of that branch - or if they are all closed, the tipmost closed head of the
2058 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2069 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2059 </p>
2070 </p>
2060 <p>
2071 <p>
2061 The reserved name &quot;tip&quot; always identifies the most recent revision.
2072 The reserved name &quot;tip&quot; always identifies the most recent revision.
2062 </p>
2073 </p>
2063 <p>
2074 <p>
2064 The reserved name &quot;null&quot; indicates the null revision. This is the
2075 The reserved name &quot;null&quot; indicates the null revision. This is the
2065 revision of an empty repository, and the parent of revision 0.
2076 revision of an empty repository, and the parent of revision 0.
2066 </p>
2077 </p>
2067 <p>
2078 <p>
2068 The reserved name &quot;.&quot; indicates the working directory parent. If no
2079 The reserved name &quot;.&quot; indicates the working directory parent. If no
2069 working directory is checked out, it is equivalent to null. If an
2080 working directory is checked out, it is equivalent to null. If an
2070 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2081 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2071 parent.
2082 parent.
2072 </p>
2083 </p>
2073
2084
2074 </div>
2085 </div>
2075 </div>
2086 </div>
2076 </div>
2087 </div>
2077
2088
2078 <script type="text/javascript">process_dates()</script>
2089 <script type="text/javascript">process_dates()</script>
2079
2090
2080
2091
2081 </body>
2092 </body>
2082 </html>
2093 </html>
2083
2094
2084
2095
2085 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2096 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2086
2097
2087 #endif
2098 #endif
General Comments 0
You need to be logged in to leave comments. Login now