##// END OF EJS Templates
help: use full name of extensions to look up them for keyword search...
FUJIWARA Katsunori -
r19769:83d79a00 stable
parent child Browse files
Show More
@@ -1,360 +1,361
1 # extensions.py - extension handling for mercurial
1 # extensions.py - extension handling 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 import imp, os
8 import imp, os
9 import util, cmdutil, error
9 import util, cmdutil, error
10 from i18n import _, gettext
10 from i18n import _, gettext
11
11
12 _extensions = {}
12 _extensions = {}
13 _order = []
13 _order = []
14 _ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg']
14 _ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg']
15
15
16 def extensions():
16 def extensions():
17 for name in _order:
17 for name in _order:
18 module = _extensions[name]
18 module = _extensions[name]
19 if module:
19 if module:
20 yield name, module
20 yield name, module
21
21
22 def find(name):
22 def find(name):
23 '''return module with given extension name'''
23 '''return module with given extension name'''
24 mod = None
24 mod = None
25 try:
25 try:
26 mod = _extensions[name]
26 mod = _extensions[name]
27 except KeyError:
27 except KeyError:
28 for k, v in _extensions.iteritems():
28 for k, v in _extensions.iteritems():
29 if k.endswith('.' + name) or k.endswith('/' + name):
29 if k.endswith('.' + name) or k.endswith('/' + name):
30 mod = v
30 mod = v
31 break
31 break
32 if not mod:
32 if not mod:
33 raise KeyError(name)
33 raise KeyError(name)
34 return mod
34 return mod
35
35
36 def loadpath(path, module_name):
36 def loadpath(path, module_name):
37 module_name = module_name.replace('.', '_')
37 module_name = module_name.replace('.', '_')
38 path = util.expandpath(path)
38 path = util.expandpath(path)
39 if os.path.isdir(path):
39 if os.path.isdir(path):
40 # module/__init__.py style
40 # module/__init__.py style
41 d, f = os.path.split(path.rstrip('/'))
41 d, f = os.path.split(path.rstrip('/'))
42 fd, fpath, desc = imp.find_module(f, [d])
42 fd, fpath, desc = imp.find_module(f, [d])
43 return imp.load_module(module_name, fd, fpath, desc)
43 return imp.load_module(module_name, fd, fpath, desc)
44 else:
44 else:
45 try:
45 try:
46 return imp.load_source(module_name, path)
46 return imp.load_source(module_name, path)
47 except IOError, exc:
47 except IOError, exc:
48 if not exc.filename:
48 if not exc.filename:
49 exc.filename = path # python does not fill this
49 exc.filename = path # python does not fill this
50 raise
50 raise
51
51
52 def load(ui, name, path):
52 def load(ui, name, path):
53 if name.startswith('hgext.') or name.startswith('hgext/'):
53 if name.startswith('hgext.') or name.startswith('hgext/'):
54 shortname = name[6:]
54 shortname = name[6:]
55 else:
55 else:
56 shortname = name
56 shortname = name
57 if shortname in _ignore:
57 if shortname in _ignore:
58 return None
58 return None
59 if shortname in _extensions:
59 if shortname in _extensions:
60 return _extensions[shortname]
60 return _extensions[shortname]
61 _extensions[shortname] = None
61 _extensions[shortname] = None
62 if path:
62 if path:
63 # the module will be loaded in sys.modules
63 # the module will be loaded in sys.modules
64 # choose an unique name so that it doesn't
64 # choose an unique name so that it doesn't
65 # conflicts with other modules
65 # conflicts with other modules
66 mod = loadpath(path, 'hgext.%s' % name)
66 mod = loadpath(path, 'hgext.%s' % name)
67 else:
67 else:
68 def importh(name):
68 def importh(name):
69 mod = __import__(name)
69 mod = __import__(name)
70 components = name.split('.')
70 components = name.split('.')
71 for comp in components[1:]:
71 for comp in components[1:]:
72 mod = getattr(mod, comp)
72 mod = getattr(mod, comp)
73 return mod
73 return mod
74 try:
74 try:
75 mod = importh("hgext.%s" % name)
75 mod = importh("hgext.%s" % name)
76 except ImportError, err:
76 except ImportError, err:
77 ui.debug('could not import hgext.%s (%s): trying %s\n'
77 ui.debug('could not import hgext.%s (%s): trying %s\n'
78 % (name, err, name))
78 % (name, err, name))
79 mod = importh(name)
79 mod = importh(name)
80 _extensions[shortname] = mod
80 _extensions[shortname] = mod
81 _order.append(shortname)
81 _order.append(shortname)
82 return mod
82 return mod
83
83
84 def loadall(ui):
84 def loadall(ui):
85 result = ui.configitems("extensions")
85 result = ui.configitems("extensions")
86 newindex = len(_order)
86 newindex = len(_order)
87 for (name, path) in result:
87 for (name, path) in result:
88 if path:
88 if path:
89 if path[0] == '!':
89 if path[0] == '!':
90 continue
90 continue
91 try:
91 try:
92 load(ui, name, path)
92 load(ui, name, path)
93 except KeyboardInterrupt:
93 except KeyboardInterrupt:
94 raise
94 raise
95 except Exception, inst:
95 except Exception, inst:
96 if path:
96 if path:
97 ui.warn(_("*** failed to import extension %s from %s: %s\n")
97 ui.warn(_("*** failed to import extension %s from %s: %s\n")
98 % (name, path, inst))
98 % (name, path, inst))
99 else:
99 else:
100 ui.warn(_("*** failed to import extension %s: %s\n")
100 ui.warn(_("*** failed to import extension %s: %s\n")
101 % (name, inst))
101 % (name, inst))
102 if ui.traceback():
102 if ui.traceback():
103 return 1
103 return 1
104
104
105 for name in _order[newindex:]:
105 for name in _order[newindex:]:
106 uisetup = getattr(_extensions[name], 'uisetup', None)
106 uisetup = getattr(_extensions[name], 'uisetup', None)
107 if uisetup:
107 if uisetup:
108 uisetup(ui)
108 uisetup(ui)
109
109
110 for name in _order[newindex:]:
110 for name in _order[newindex:]:
111 extsetup = getattr(_extensions[name], 'extsetup', None)
111 extsetup = getattr(_extensions[name], 'extsetup', None)
112 if extsetup:
112 if extsetup:
113 try:
113 try:
114 extsetup(ui)
114 extsetup(ui)
115 except TypeError:
115 except TypeError:
116 if extsetup.func_code.co_argcount != 0:
116 if extsetup.func_code.co_argcount != 0:
117 raise
117 raise
118 extsetup() # old extsetup with no ui argument
118 extsetup() # old extsetup with no ui argument
119
119
120 def wrapcommand(table, command, wrapper):
120 def wrapcommand(table, command, wrapper):
121 '''Wrap the command named `command' in table
121 '''Wrap the command named `command' in table
122
122
123 Replace command in the command table with wrapper. The wrapped command will
123 Replace command in the command table with wrapper. The wrapped command will
124 be inserted into the command table specified by the table argument.
124 be inserted into the command table specified by the table argument.
125
125
126 The wrapper will be called like
126 The wrapper will be called like
127
127
128 wrapper(orig, *args, **kwargs)
128 wrapper(orig, *args, **kwargs)
129
129
130 where orig is the original (wrapped) function, and *args, **kwargs
130 where orig is the original (wrapped) function, and *args, **kwargs
131 are the arguments passed to it.
131 are the arguments passed to it.
132 '''
132 '''
133 assert util.safehasattr(wrapper, '__call__')
133 assert util.safehasattr(wrapper, '__call__')
134 aliases, entry = cmdutil.findcmd(command, table)
134 aliases, entry = cmdutil.findcmd(command, table)
135 for alias, e in table.iteritems():
135 for alias, e in table.iteritems():
136 if e is entry:
136 if e is entry:
137 key = alias
137 key = alias
138 break
138 break
139
139
140 origfn = entry[0]
140 origfn = entry[0]
141 def wrap(*args, **kwargs):
141 def wrap(*args, **kwargs):
142 return util.checksignature(wrapper)(
142 return util.checksignature(wrapper)(
143 util.checksignature(origfn), *args, **kwargs)
143 util.checksignature(origfn), *args, **kwargs)
144
144
145 wrap.__doc__ = getattr(origfn, '__doc__')
145 wrap.__doc__ = getattr(origfn, '__doc__')
146 wrap.__module__ = getattr(origfn, '__module__')
146 wrap.__module__ = getattr(origfn, '__module__')
147
147
148 newentry = list(entry)
148 newentry = list(entry)
149 newentry[0] = wrap
149 newentry[0] = wrap
150 table[key] = tuple(newentry)
150 table[key] = tuple(newentry)
151 return entry
151 return entry
152
152
153 def wrapfunction(container, funcname, wrapper):
153 def wrapfunction(container, funcname, wrapper):
154 '''Wrap the function named funcname in container
154 '''Wrap the function named funcname in container
155
155
156 Replace the funcname member in the given container with the specified
156 Replace the funcname member in the given container with the specified
157 wrapper. The container is typically a module, class, or instance.
157 wrapper. The container is typically a module, class, or instance.
158
158
159 The wrapper will be called like
159 The wrapper will be called like
160
160
161 wrapper(orig, *args, **kwargs)
161 wrapper(orig, *args, **kwargs)
162
162
163 where orig is the original (wrapped) function, and *args, **kwargs
163 where orig is the original (wrapped) function, and *args, **kwargs
164 are the arguments passed to it.
164 are the arguments passed to it.
165
165
166 Wrapping methods of the repository object is not recommended since
166 Wrapping methods of the repository object is not recommended since
167 it conflicts with extensions that extend the repository by
167 it conflicts with extensions that extend the repository by
168 subclassing. All extensions that need to extend methods of
168 subclassing. All extensions that need to extend methods of
169 localrepository should use this subclassing trick: namely,
169 localrepository should use this subclassing trick: namely,
170 reposetup() should look like
170 reposetup() should look like
171
171
172 def reposetup(ui, repo):
172 def reposetup(ui, repo):
173 class myrepo(repo.__class__):
173 class myrepo(repo.__class__):
174 def whatever(self, *args, **kwargs):
174 def whatever(self, *args, **kwargs):
175 [...extension stuff...]
175 [...extension stuff...]
176 super(myrepo, self).whatever(*args, **kwargs)
176 super(myrepo, self).whatever(*args, **kwargs)
177 [...extension stuff...]
177 [...extension stuff...]
178
178
179 repo.__class__ = myrepo
179 repo.__class__ = myrepo
180
180
181 In general, combining wrapfunction() with subclassing does not
181 In general, combining wrapfunction() with subclassing does not
182 work. Since you cannot control what other extensions are loaded by
182 work. Since you cannot control what other extensions are loaded by
183 your end users, you should play nicely with others by using the
183 your end users, you should play nicely with others by using the
184 subclass trick.
184 subclass trick.
185 '''
185 '''
186 assert util.safehasattr(wrapper, '__call__')
186 assert util.safehasattr(wrapper, '__call__')
187 def wrap(*args, **kwargs):
187 def wrap(*args, **kwargs):
188 return wrapper(origfn, *args, **kwargs)
188 return wrapper(origfn, *args, **kwargs)
189
189
190 origfn = getattr(container, funcname)
190 origfn = getattr(container, funcname)
191 assert util.safehasattr(origfn, '__call__')
191 assert util.safehasattr(origfn, '__call__')
192 setattr(container, funcname, wrap)
192 setattr(container, funcname, wrap)
193 return origfn
193 return origfn
194
194
195 def _disabledpaths(strip_init=False):
195 def _disabledpaths(strip_init=False):
196 '''find paths of disabled extensions. returns a dict of {name: path}
196 '''find paths of disabled extensions. returns a dict of {name: path}
197 removes /__init__.py from packages if strip_init is True'''
197 removes /__init__.py from packages if strip_init is True'''
198 import hgext
198 import hgext
199 extpath = os.path.dirname(os.path.abspath(hgext.__file__))
199 extpath = os.path.dirname(os.path.abspath(hgext.__file__))
200 try: # might not be a filesystem path
200 try: # might not be a filesystem path
201 files = os.listdir(extpath)
201 files = os.listdir(extpath)
202 except OSError:
202 except OSError:
203 return {}
203 return {}
204
204
205 exts = {}
205 exts = {}
206 for e in files:
206 for e in files:
207 if e.endswith('.py'):
207 if e.endswith('.py'):
208 name = e.rsplit('.', 1)[0]
208 name = e.rsplit('.', 1)[0]
209 path = os.path.join(extpath, e)
209 path = os.path.join(extpath, e)
210 else:
210 else:
211 name = e
211 name = e
212 path = os.path.join(extpath, e, '__init__.py')
212 path = os.path.join(extpath, e, '__init__.py')
213 if not os.path.exists(path):
213 if not os.path.exists(path):
214 continue
214 continue
215 if strip_init:
215 if strip_init:
216 path = os.path.dirname(path)
216 path = os.path.dirname(path)
217 if name in exts or name in _order or name == '__init__':
217 if name in exts or name in _order or name == '__init__':
218 continue
218 continue
219 exts[name] = path
219 exts[name] = path
220 return exts
220 return exts
221
221
222 def _moduledoc(file):
222 def _moduledoc(file):
223 '''return the top-level python documentation for the given file
223 '''return the top-level python documentation for the given file
224
224
225 Loosely inspired by pydoc.source_synopsis(), but rewritten to
225 Loosely inspired by pydoc.source_synopsis(), but rewritten to
226 handle triple quotes and to return the whole text instead of just
226 handle triple quotes and to return the whole text instead of just
227 the synopsis'''
227 the synopsis'''
228 result = []
228 result = []
229
229
230 line = file.readline()
230 line = file.readline()
231 while line[:1] == '#' or not line.strip():
231 while line[:1] == '#' or not line.strip():
232 line = file.readline()
232 line = file.readline()
233 if not line:
233 if not line:
234 break
234 break
235
235
236 start = line[:3]
236 start = line[:3]
237 if start == '"""' or start == "'''":
237 if start == '"""' or start == "'''":
238 line = line[3:]
238 line = line[3:]
239 while line:
239 while line:
240 if line.rstrip().endswith(start):
240 if line.rstrip().endswith(start):
241 line = line.split(start)[0]
241 line = line.split(start)[0]
242 if line:
242 if line:
243 result.append(line)
243 result.append(line)
244 break
244 break
245 elif not line:
245 elif not line:
246 return None # unmatched delimiter
246 return None # unmatched delimiter
247 result.append(line)
247 result.append(line)
248 line = file.readline()
248 line = file.readline()
249 else:
249 else:
250 return None
250 return None
251
251
252 return ''.join(result)
252 return ''.join(result)
253
253
254 def _disabledhelp(path):
254 def _disabledhelp(path):
255 '''retrieve help synopsis of a disabled extension (without importing)'''
255 '''retrieve help synopsis of a disabled extension (without importing)'''
256 try:
256 try:
257 file = open(path)
257 file = open(path)
258 except IOError:
258 except IOError:
259 return
259 return
260 else:
260 else:
261 doc = _moduledoc(file)
261 doc = _moduledoc(file)
262 file.close()
262 file.close()
263
263
264 if doc: # extracting localized synopsis
264 if doc: # extracting localized synopsis
265 return gettext(doc).splitlines()[0]
265 return gettext(doc).splitlines()[0]
266 else:
266 else:
267 return _('(no help text available)')
267 return _('(no help text available)')
268
268
269 def disabled():
269 def disabled():
270 '''find disabled extensions from hgext. returns a dict of {name: desc}'''
270 '''find disabled extensions from hgext. returns a dict of {name: desc}'''
271 try:
271 try:
272 from hgext import __index__
272 from hgext import __index__
273 return dict((name, gettext(desc))
273 return dict((name, gettext(desc))
274 for name, desc in __index__.docs.iteritems()
274 for name, desc in __index__.docs.iteritems()
275 if name not in _order)
275 if name not in _order)
276 except ImportError:
276 except ImportError:
277 pass
277 pass
278
278
279 paths = _disabledpaths()
279 paths = _disabledpaths()
280 if not paths:
280 if not paths:
281 return {}
281 return {}
282
282
283 exts = {}
283 exts = {}
284 for name, path in paths.iteritems():
284 for name, path in paths.iteritems():
285 doc = _disabledhelp(path)
285 doc = _disabledhelp(path)
286 if doc:
286 if doc:
287 exts[name] = doc
287 exts[name] = doc
288
288
289 return exts
289 return exts
290
290
291 def disabledext(name):
291 def disabledext(name):
292 '''find a specific disabled extension from hgext. returns desc'''
292 '''find a specific disabled extension from hgext. returns desc'''
293 try:
293 try:
294 from hgext import __index__
294 from hgext import __index__
295 if name in _order: # enabled
295 if name in _order: # enabled
296 return
296 return
297 else:
297 else:
298 return gettext(__index__.docs.get(name))
298 return gettext(__index__.docs.get(name))
299 except ImportError:
299 except ImportError:
300 pass
300 pass
301
301
302 paths = _disabledpaths()
302 paths = _disabledpaths()
303 if name in paths:
303 if name in paths:
304 return _disabledhelp(paths[name])
304 return _disabledhelp(paths[name])
305
305
306 def disabledcmd(ui, cmd, strict=False):
306 def disabledcmd(ui, cmd, strict=False):
307 '''import disabled extensions until cmd is found.
307 '''import disabled extensions until cmd is found.
308 returns (cmdname, extname, module)'''
308 returns (cmdname, extname, module)'''
309
309
310 paths = _disabledpaths(strip_init=True)
310 paths = _disabledpaths(strip_init=True)
311 if not paths:
311 if not paths:
312 raise error.UnknownCommand(cmd)
312 raise error.UnknownCommand(cmd)
313
313
314 def findcmd(cmd, name, path):
314 def findcmd(cmd, name, path):
315 try:
315 try:
316 mod = loadpath(path, 'hgext.%s' % name)
316 mod = loadpath(path, 'hgext.%s' % name)
317 except Exception:
317 except Exception:
318 return
318 return
319 try:
319 try:
320 aliases, entry = cmdutil.findcmd(cmd,
320 aliases, entry = cmdutil.findcmd(cmd,
321 getattr(mod, 'cmdtable', {}), strict)
321 getattr(mod, 'cmdtable', {}), strict)
322 except (error.AmbiguousCommand, error.UnknownCommand):
322 except (error.AmbiguousCommand, error.UnknownCommand):
323 return
323 return
324 except Exception:
324 except Exception:
325 ui.warn(_('warning: error finding commands in %s\n') % path)
325 ui.warn(_('warning: error finding commands in %s\n') % path)
326 ui.traceback()
326 ui.traceback()
327 return
327 return
328 for c in aliases:
328 for c in aliases:
329 if c.startswith(cmd):
329 if c.startswith(cmd):
330 cmd = c
330 cmd = c
331 break
331 break
332 else:
332 else:
333 cmd = aliases[0]
333 cmd = aliases[0]
334 return (cmd, name, mod)
334 return (cmd, name, mod)
335
335
336 ext = None
336 ext = None
337 # first, search for an extension with the same name as the command
337 # first, search for an extension with the same name as the command
338 path = paths.pop(cmd, None)
338 path = paths.pop(cmd, None)
339 if path:
339 if path:
340 ext = findcmd(cmd, cmd, path)
340 ext = findcmd(cmd, cmd, path)
341 if not ext:
341 if not ext:
342 # otherwise, interrogate each extension until there's a match
342 # otherwise, interrogate each extension until there's a match
343 for name, path in paths.iteritems():
343 for name, path in paths.iteritems():
344 ext = findcmd(cmd, name, path)
344 ext = findcmd(cmd, name, path)
345 if ext:
345 if ext:
346 break
346 break
347 if ext and 'DEPRECATED' not in ext.__doc__:
347 if ext and 'DEPRECATED' not in ext.__doc__:
348 return ext
348 return ext
349
349
350 raise error.UnknownCommand(cmd)
350 raise error.UnknownCommand(cmd)
351
351
352 def enabled():
352 def enabled(shortname=True):
353 '''return a dict of {name: desc} of extensions'''
353 '''return a dict of {name: desc} of extensions'''
354 exts = {}
354 exts = {}
355 for ename, ext in extensions():
355 for ename, ext in extensions():
356 doc = (gettext(ext.__doc__) or _('(no help text available)'))
356 doc = (gettext(ext.__doc__) or _('(no help text available)'))
357 if shortname:
357 ename = ename.split('.')[-1]
358 ename = ename.split('.')[-1]
358 exts[ename] = doc.splitlines()[0].strip()
359 exts[ename] = doc.splitlines()[0].strip()
359
360
360 return exts
361 return exts
@@ -1,504 +1,505
1 # help.py - help data for mercurial
1 # help.py - help data for mercurial
2 #
2 #
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from i18n import gettext, _
8 from i18n import gettext, _
9 import itertools, sys, os, error
9 import itertools, sys, os, error
10 import extensions, revset, fileset, templatekw, templatefilters, filemerge
10 import extensions, revset, fileset, templatekw, templatefilters, filemerge
11 import encoding, util, minirst
11 import encoding, util, minirst
12 import cmdutil
12 import cmdutil
13
13
14 def listexts(header, exts, indent=1):
14 def listexts(header, exts, indent=1):
15 '''return a text listing of the given extensions'''
15 '''return a text listing of the given extensions'''
16 rst = []
16 rst = []
17 if exts:
17 if exts:
18 rst.append('\n%s\n\n' % header)
18 rst.append('\n%s\n\n' % header)
19 for name, desc in sorted(exts.iteritems()):
19 for name, desc in sorted(exts.iteritems()):
20 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
20 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
21 return rst
21 return rst
22
22
23 def extshelp():
23 def extshelp():
24 rst = loaddoc('extensions')().splitlines(True)
24 rst = loaddoc('extensions')().splitlines(True)
25 rst.extend(listexts(_('enabled extensions:'), extensions.enabled()))
25 rst.extend(listexts(_('enabled extensions:'), extensions.enabled()))
26 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
26 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
27 doc = ''.join(rst)
27 doc = ''.join(rst)
28 return doc
28 return doc
29
29
30 def optrst(options, verbose):
30 def optrst(options, verbose):
31 data = []
31 data = []
32 multioccur = False
32 multioccur = False
33 for option in options:
33 for option in options:
34 if len(option) == 5:
34 if len(option) == 5:
35 shortopt, longopt, default, desc, optlabel = option
35 shortopt, longopt, default, desc, optlabel = option
36 else:
36 else:
37 shortopt, longopt, default, desc = option
37 shortopt, longopt, default, desc = option
38 optlabel = _("VALUE") # default label
38 optlabel = _("VALUE") # default label
39
39
40 if _("DEPRECATED") in desc and not verbose:
40 if _("DEPRECATED") in desc and not verbose:
41 continue
41 continue
42
42
43 so = ''
43 so = ''
44 if shortopt:
44 if shortopt:
45 so = '-' + shortopt
45 so = '-' + shortopt
46 lo = '--' + longopt
46 lo = '--' + longopt
47 if default:
47 if default:
48 desc += _(" (default: %s)") % default
48 desc += _(" (default: %s)") % default
49
49
50 if isinstance(default, list):
50 if isinstance(default, list):
51 lo += " %s [+]" % optlabel
51 lo += " %s [+]" % optlabel
52 multioccur = True
52 multioccur = True
53 elif (default is not None) and not isinstance(default, bool):
53 elif (default is not None) and not isinstance(default, bool):
54 lo += " %s" % optlabel
54 lo += " %s" % optlabel
55
55
56 data.append((so, lo, desc))
56 data.append((so, lo, desc))
57
57
58 rst = minirst.maketable(data, 1)
58 rst = minirst.maketable(data, 1)
59
59
60 if multioccur:
60 if multioccur:
61 rst.append(_("\n[+] marked option can be specified multiple times\n"))
61 rst.append(_("\n[+] marked option can be specified multiple times\n"))
62
62
63 return ''.join(rst)
63 return ''.join(rst)
64
64
65 def indicateomitted(rst, omitted, notomitted=None):
65 def indicateomitted(rst, omitted, notomitted=None):
66 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
66 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
67 if notomitted:
67 if notomitted:
68 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
68 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
69
69
70 def topicmatch(kw):
70 def topicmatch(kw):
71 """Return help topics matching kw.
71 """Return help topics matching kw.
72
72
73 Returns {'section': [(name, summary), ...], ...} where section is
73 Returns {'section': [(name, summary), ...], ...} where section is
74 one of topics, commands, extensions, or extensioncommands.
74 one of topics, commands, extensions, or extensioncommands.
75 """
75 """
76 kw = encoding.lower(kw)
76 kw = encoding.lower(kw)
77 def lowercontains(container):
77 def lowercontains(container):
78 return kw in encoding.lower(container) # translated in helptable
78 return kw in encoding.lower(container) # translated in helptable
79 results = {'topics': [],
79 results = {'topics': [],
80 'commands': [],
80 'commands': [],
81 'extensions': [],
81 'extensions': [],
82 'extensioncommands': [],
82 'extensioncommands': [],
83 }
83 }
84 for names, header, doc in helptable:
84 for names, header, doc in helptable:
85 if (sum(map(lowercontains, names))
85 if (sum(map(lowercontains, names))
86 or lowercontains(header)
86 or lowercontains(header)
87 or lowercontains(doc())):
87 or lowercontains(doc())):
88 results['topics'].append((names[0], header))
88 results['topics'].append((names[0], header))
89 import commands # avoid cycle
89 import commands # avoid cycle
90 for cmd, entry in commands.table.iteritems():
90 for cmd, entry in commands.table.iteritems():
91 if cmd.startswith('debug'):
91 if cmd.startswith('debug'):
92 continue
92 continue
93 if len(entry) == 3:
93 if len(entry) == 3:
94 summary = entry[2]
94 summary = entry[2]
95 else:
95 else:
96 summary = ''
96 summary = ''
97 # translate docs *before* searching there
97 # translate docs *before* searching there
98 docs = _(getattr(entry[0], '__doc__', None)) or ''
98 docs = _(getattr(entry[0], '__doc__', None)) or ''
99 if kw in cmd or lowercontains(summary) or lowercontains(docs):
99 if kw in cmd or lowercontains(summary) or lowercontains(docs):
100 doclines = docs.splitlines()
100 doclines = docs.splitlines()
101 if doclines:
101 if doclines:
102 summary = doclines[0]
102 summary = doclines[0]
103 cmdname = cmd.split('|')[0].lstrip('^')
103 cmdname = cmd.split('|')[0].lstrip('^')
104 results['commands'].append((cmdname, summary))
104 results['commands'].append((cmdname, summary))
105 for name, docs in itertools.chain(
105 for name, docs in itertools.chain(
106 extensions.enabled().iteritems(),
106 extensions.enabled(False).iteritems(),
107 extensions.disabled().iteritems()):
107 extensions.disabled().iteritems()):
108 # extensions.load ignores the UI argument
108 # extensions.load ignores the UI argument
109 mod = extensions.load(None, name, '')
109 mod = extensions.load(None, name, '')
110 name = name.split('.')[-1]
110 if lowercontains(name) or lowercontains(docs):
111 if lowercontains(name) or lowercontains(docs):
111 # extension docs are already translated
112 # extension docs are already translated
112 results['extensions'].append((name, docs.splitlines()[0]))
113 results['extensions'].append((name, docs.splitlines()[0]))
113 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
114 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
114 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
115 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
115 cmdname = cmd.split('|')[0].lstrip('^')
116 cmdname = cmd.split('|')[0].lstrip('^')
116 if entry[0].__doc__:
117 if entry[0].__doc__:
117 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
118 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
118 else:
119 else:
119 cmddoc = _('(no help text available)')
120 cmddoc = _('(no help text available)')
120 results['extensioncommands'].append((cmdname, cmddoc))
121 results['extensioncommands'].append((cmdname, cmddoc))
121 return results
122 return results
122
123
123 def loaddoc(topic):
124 def loaddoc(topic):
124 """Return a delayed loader for help/topic.txt."""
125 """Return a delayed loader for help/topic.txt."""
125
126
126 def loader():
127 def loader():
127 if util.mainfrozen():
128 if util.mainfrozen():
128 module = sys.executable
129 module = sys.executable
129 else:
130 else:
130 module = __file__
131 module = __file__
131 base = os.path.dirname(module)
132 base = os.path.dirname(module)
132
133
133 for dir in ('.', '..'):
134 for dir in ('.', '..'):
134 docdir = os.path.join(base, dir, 'help')
135 docdir = os.path.join(base, dir, 'help')
135 if os.path.isdir(docdir):
136 if os.path.isdir(docdir):
136 break
137 break
137
138
138 path = os.path.join(docdir, topic + ".txt")
139 path = os.path.join(docdir, topic + ".txt")
139 doc = gettext(util.readfile(path))
140 doc = gettext(util.readfile(path))
140 for rewriter in helphooks.get(topic, []):
141 for rewriter in helphooks.get(topic, []):
141 doc = rewriter(topic, doc)
142 doc = rewriter(topic, doc)
142 return doc
143 return doc
143
144
144 return loader
145 return loader
145
146
146 helptable = sorted([
147 helptable = sorted([
147 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
148 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
148 (["dates"], _("Date Formats"), loaddoc('dates')),
149 (["dates"], _("Date Formats"), loaddoc('dates')),
149 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
150 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
150 (['environment', 'env'], _('Environment Variables'),
151 (['environment', 'env'], _('Environment Variables'),
151 loaddoc('environment')),
152 loaddoc('environment')),
152 (['revisions', 'revs'], _('Specifying Single Revisions'),
153 (['revisions', 'revs'], _('Specifying Single Revisions'),
153 loaddoc('revisions')),
154 loaddoc('revisions')),
154 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
155 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
155 loaddoc('multirevs')),
156 loaddoc('multirevs')),
156 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
157 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
157 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
158 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
158 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
159 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
159 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
160 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
160 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
161 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
161 loaddoc('templates')),
162 loaddoc('templates')),
162 (['urls'], _('URL Paths'), loaddoc('urls')),
163 (['urls'], _('URL Paths'), loaddoc('urls')),
163 (["extensions"], _("Using Additional Features"), extshelp),
164 (["extensions"], _("Using Additional Features"), extshelp),
164 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
165 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
165 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
166 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
166 (["glossary"], _("Glossary"), loaddoc('glossary')),
167 (["glossary"], _("Glossary"), loaddoc('glossary')),
167 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
168 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
168 loaddoc('hgignore')),
169 loaddoc('hgignore')),
169 (["phases"], _("Working with Phases"), loaddoc('phases')),
170 (["phases"], _("Working with Phases"), loaddoc('phases')),
170 ])
171 ])
171
172
172 # Map topics to lists of callable taking the current topic help and
173 # Map topics to lists of callable taking the current topic help and
173 # returning the updated version
174 # returning the updated version
174 helphooks = {}
175 helphooks = {}
175
176
176 def addtopichook(topic, rewriter):
177 def addtopichook(topic, rewriter):
177 helphooks.setdefault(topic, []).append(rewriter)
178 helphooks.setdefault(topic, []).append(rewriter)
178
179
179 def makeitemsdoc(topic, doc, marker, items):
180 def makeitemsdoc(topic, doc, marker, items):
180 """Extract docstring from the items key to function mapping, build a
181 """Extract docstring from the items key to function mapping, build a
181 .single documentation block and use it to overwrite the marker in doc
182 .single documentation block and use it to overwrite the marker in doc
182 """
183 """
183 entries = []
184 entries = []
184 for name in sorted(items):
185 for name in sorted(items):
185 text = (items[name].__doc__ or '').rstrip()
186 text = (items[name].__doc__ or '').rstrip()
186 if not text:
187 if not text:
187 continue
188 continue
188 text = gettext(text)
189 text = gettext(text)
189 lines = text.splitlines()
190 lines = text.splitlines()
190 doclines = [(lines[0])]
191 doclines = [(lines[0])]
191 for l in lines[1:]:
192 for l in lines[1:]:
192 # Stop once we find some Python doctest
193 # Stop once we find some Python doctest
193 if l.strip().startswith('>>>'):
194 if l.strip().startswith('>>>'):
194 break
195 break
195 doclines.append(' ' + l.strip())
196 doclines.append(' ' + l.strip())
196 entries.append('\n'.join(doclines))
197 entries.append('\n'.join(doclines))
197 entries = '\n\n'.join(entries)
198 entries = '\n\n'.join(entries)
198 return doc.replace(marker, entries)
199 return doc.replace(marker, entries)
199
200
200 def addtopicsymbols(topic, marker, symbols):
201 def addtopicsymbols(topic, marker, symbols):
201 def add(topic, doc):
202 def add(topic, doc):
202 return makeitemsdoc(topic, doc, marker, symbols)
203 return makeitemsdoc(topic, doc, marker, symbols)
203 addtopichook(topic, add)
204 addtopichook(topic, add)
204
205
205 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
206 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
206 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
207 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
207 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
208 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
208 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
209 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
209 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
210 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
210
211
211 def help_(ui, name, unknowncmd=False, full=True, **opts):
212 def help_(ui, name, unknowncmd=False, full=True, **opts):
212 '''
213 '''
213 Generate the help for 'name' as unformatted restructured text. If
214 Generate the help for 'name' as unformatted restructured text. If
214 'name' is None, describe the commands available.
215 'name' is None, describe the commands available.
215 '''
216 '''
216
217
217 import commands # avoid cycle
218 import commands # avoid cycle
218
219
219 def helpcmd(name):
220 def helpcmd(name):
220 try:
221 try:
221 aliases, entry = cmdutil.findcmd(name, commands.table,
222 aliases, entry = cmdutil.findcmd(name, commands.table,
222 strict=unknowncmd)
223 strict=unknowncmd)
223 except error.AmbiguousCommand, inst:
224 except error.AmbiguousCommand, inst:
224 # py3k fix: except vars can't be used outside the scope of the
225 # py3k fix: except vars can't be used outside the scope of the
225 # except block, nor can be used inside a lambda. python issue4617
226 # except block, nor can be used inside a lambda. python issue4617
226 prefix = inst.args[0]
227 prefix = inst.args[0]
227 select = lambda c: c.lstrip('^').startswith(prefix)
228 select = lambda c: c.lstrip('^').startswith(prefix)
228 rst = helplist(select)
229 rst = helplist(select)
229 return rst
230 return rst
230
231
231 rst = []
232 rst = []
232
233
233 # check if it's an invalid alias and display its error if it is
234 # check if it's an invalid alias and display its error if it is
234 if getattr(entry[0], 'badalias', False):
235 if getattr(entry[0], 'badalias', False):
235 if not unknowncmd:
236 if not unknowncmd:
236 ui.pushbuffer()
237 ui.pushbuffer()
237 entry[0](ui)
238 entry[0](ui)
238 rst.append(ui.popbuffer())
239 rst.append(ui.popbuffer())
239 return rst
240 return rst
240
241
241 # synopsis
242 # synopsis
242 if len(entry) > 2:
243 if len(entry) > 2:
243 if entry[2].startswith('hg'):
244 if entry[2].startswith('hg'):
244 rst.append("%s\n" % entry[2])
245 rst.append("%s\n" % entry[2])
245 else:
246 else:
246 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
247 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
247 else:
248 else:
248 rst.append('hg %s\n' % aliases[0])
249 rst.append('hg %s\n' % aliases[0])
249 # aliases
250 # aliases
250 if full and not ui.quiet and len(aliases) > 1:
251 if full and not ui.quiet and len(aliases) > 1:
251 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
252 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
252 rst.append('\n')
253 rst.append('\n')
253
254
254 # description
255 # description
255 doc = gettext(entry[0].__doc__)
256 doc = gettext(entry[0].__doc__)
256 if not doc:
257 if not doc:
257 doc = _("(no help text available)")
258 doc = _("(no help text available)")
258 if util.safehasattr(entry[0], 'definition'): # aliased command
259 if util.safehasattr(entry[0], 'definition'): # aliased command
259 if entry[0].definition.startswith('!'): # shell alias
260 if entry[0].definition.startswith('!'): # shell alias
260 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
261 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
261 else:
262 else:
262 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
263 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
263 doc = doc.splitlines(True)
264 doc = doc.splitlines(True)
264 if ui.quiet or not full:
265 if ui.quiet or not full:
265 rst.append(doc[0])
266 rst.append(doc[0])
266 else:
267 else:
267 rst.extend(doc)
268 rst.extend(doc)
268 rst.append('\n')
269 rst.append('\n')
269
270
270 # check if this command shadows a non-trivial (multi-line)
271 # check if this command shadows a non-trivial (multi-line)
271 # extension help text
272 # extension help text
272 try:
273 try:
273 mod = extensions.find(name)
274 mod = extensions.find(name)
274 doc = gettext(mod.__doc__) or ''
275 doc = gettext(mod.__doc__) or ''
275 if '\n' in doc.strip():
276 if '\n' in doc.strip():
276 msg = _('use "hg help -e %s" to show help for '
277 msg = _('use "hg help -e %s" to show help for '
277 'the %s extension') % (name, name)
278 'the %s extension') % (name, name)
278 rst.append('\n%s\n' % msg)
279 rst.append('\n%s\n' % msg)
279 except KeyError:
280 except KeyError:
280 pass
281 pass
281
282
282 # options
283 # options
283 if not ui.quiet and entry[1]:
284 if not ui.quiet and entry[1]:
284 rst.append('\n%s\n\n' % _("options:"))
285 rst.append('\n%s\n\n' % _("options:"))
285 rst.append(optrst(entry[1], ui.verbose))
286 rst.append(optrst(entry[1], ui.verbose))
286
287
287 if ui.verbose:
288 if ui.verbose:
288 rst.append('\n%s\n\n' % _("global options:"))
289 rst.append('\n%s\n\n' % _("global options:"))
289 rst.append(optrst(commands.globalopts, ui.verbose))
290 rst.append(optrst(commands.globalopts, ui.verbose))
290
291
291 if not ui.verbose:
292 if not ui.verbose:
292 if not full:
293 if not full:
293 rst.append(_('\nuse "hg help %s" to show the full help text\n')
294 rst.append(_('\nuse "hg help %s" to show the full help text\n')
294 % name)
295 % name)
295 elif not ui.quiet:
296 elif not ui.quiet:
296 omitted = _('use "hg -v help %s" to show more complete'
297 omitted = _('use "hg -v help %s" to show more complete'
297 ' help and the global options') % name
298 ' help and the global options') % name
298 notomitted = _('use "hg -v help %s" to show'
299 notomitted = _('use "hg -v help %s" to show'
299 ' the global options') % name
300 ' the global options') % name
300 indicateomitted(rst, omitted, notomitted)
301 indicateomitted(rst, omitted, notomitted)
301
302
302 return rst
303 return rst
303
304
304
305
305 def helplist(select=None):
306 def helplist(select=None):
306 # list of commands
307 # list of commands
307 if name == "shortlist":
308 if name == "shortlist":
308 header = _('basic commands:\n\n')
309 header = _('basic commands:\n\n')
309 else:
310 else:
310 header = _('list of commands:\n\n')
311 header = _('list of commands:\n\n')
311
312
312 h = {}
313 h = {}
313 cmds = {}
314 cmds = {}
314 for c, e in commands.table.iteritems():
315 for c, e in commands.table.iteritems():
315 f = c.split("|", 1)[0]
316 f = c.split("|", 1)[0]
316 if select and not select(f):
317 if select and not select(f):
317 continue
318 continue
318 if (not select and name != 'shortlist' and
319 if (not select and name != 'shortlist' and
319 e[0].__module__ != commands.__name__):
320 e[0].__module__ != commands.__name__):
320 continue
321 continue
321 if name == "shortlist" and not f.startswith("^"):
322 if name == "shortlist" and not f.startswith("^"):
322 continue
323 continue
323 f = f.lstrip("^")
324 f = f.lstrip("^")
324 if not ui.debugflag and f.startswith("debug"):
325 if not ui.debugflag and f.startswith("debug"):
325 continue
326 continue
326 doc = e[0].__doc__
327 doc = e[0].__doc__
327 if doc and 'DEPRECATED' in doc and not ui.verbose:
328 if doc and 'DEPRECATED' in doc and not ui.verbose:
328 continue
329 continue
329 doc = gettext(doc)
330 doc = gettext(doc)
330 if not doc:
331 if not doc:
331 doc = _("(no help text available)")
332 doc = _("(no help text available)")
332 h[f] = doc.splitlines()[0].rstrip()
333 h[f] = doc.splitlines()[0].rstrip()
333 cmds[f] = c.lstrip("^")
334 cmds[f] = c.lstrip("^")
334
335
335 rst = []
336 rst = []
336 if not h:
337 if not h:
337 if not ui.quiet:
338 if not ui.quiet:
338 rst.append(_('no commands defined\n'))
339 rst.append(_('no commands defined\n'))
339 return rst
340 return rst
340
341
341 if not ui.quiet:
342 if not ui.quiet:
342 rst.append(header)
343 rst.append(header)
343 fns = sorted(h)
344 fns = sorted(h)
344 for f in fns:
345 for f in fns:
345 if ui.verbose:
346 if ui.verbose:
346 commacmds = cmds[f].replace("|",", ")
347 commacmds = cmds[f].replace("|",", ")
347 rst.append(" :%s: %s\n" % (commacmds, h[f]))
348 rst.append(" :%s: %s\n" % (commacmds, h[f]))
348 else:
349 else:
349 rst.append(' :%s: %s\n' % (f, h[f]))
350 rst.append(' :%s: %s\n' % (f, h[f]))
350
351
351 if not name:
352 if not name:
352 exts = listexts(_('enabled extensions:'), extensions.enabled())
353 exts = listexts(_('enabled extensions:'), extensions.enabled())
353 if exts:
354 if exts:
354 rst.append('\n')
355 rst.append('\n')
355 rst.extend(exts)
356 rst.extend(exts)
356
357
357 rst.append(_("\nadditional help topics:\n\n"))
358 rst.append(_("\nadditional help topics:\n\n"))
358 topics = []
359 topics = []
359 for names, header, doc in helptable:
360 for names, header, doc in helptable:
360 topics.append((names[0], header))
361 topics.append((names[0], header))
361 for t, desc in topics:
362 for t, desc in topics:
362 rst.append(" :%s: %s\n" % (t, desc))
363 rst.append(" :%s: %s\n" % (t, desc))
363
364
364 optlist = []
365 optlist = []
365 if not ui.quiet:
366 if not ui.quiet:
366 if ui.verbose:
367 if ui.verbose:
367 optlist.append((_("global options:"), commands.globalopts))
368 optlist.append((_("global options:"), commands.globalopts))
368 if name == 'shortlist':
369 if name == 'shortlist':
369 optlist.append((_('use "hg help" for the full list '
370 optlist.append((_('use "hg help" for the full list '
370 'of commands'), ()))
371 'of commands'), ()))
371 else:
372 else:
372 if name == 'shortlist':
373 if name == 'shortlist':
373 msg = _('use "hg help" for the full list of commands '
374 msg = _('use "hg help" for the full list of commands '
374 'or "hg -v" for details')
375 'or "hg -v" for details')
375 elif name and not full:
376 elif name and not full:
376 msg = _('use "hg help %s" to show the full help '
377 msg = _('use "hg help %s" to show the full help '
377 'text') % name
378 'text') % name
378 else:
379 else:
379 msg = _('use "hg -v help%s" to show builtin aliases and '
380 msg = _('use "hg -v help%s" to show builtin aliases and '
380 'global options') % (name and " " + name or "")
381 'global options') % (name and " " + name or "")
381 optlist.append((msg, ()))
382 optlist.append((msg, ()))
382
383
383 if optlist:
384 if optlist:
384 for title, options in optlist:
385 for title, options in optlist:
385 rst.append('\n%s\n' % title)
386 rst.append('\n%s\n' % title)
386 if options:
387 if options:
387 rst.append('\n%s\n' % optrst(options, ui.verbose))
388 rst.append('\n%s\n' % optrst(options, ui.verbose))
388 return rst
389 return rst
389
390
390 def helptopic(name):
391 def helptopic(name):
391 for names, header, doc in helptable:
392 for names, header, doc in helptable:
392 if name in names:
393 if name in names:
393 break
394 break
394 else:
395 else:
395 raise error.UnknownCommand(name)
396 raise error.UnknownCommand(name)
396
397
397 rst = [minirst.section(header)]
398 rst = [minirst.section(header)]
398
399
399 # description
400 # description
400 if not doc:
401 if not doc:
401 rst.append(" %s\n" % _("(no help text available)"))
402 rst.append(" %s\n" % _("(no help text available)"))
402 if util.safehasattr(doc, '__call__'):
403 if util.safehasattr(doc, '__call__'):
403 rst += [" %s\n" % l for l in doc().splitlines()]
404 rst += [" %s\n" % l for l in doc().splitlines()]
404
405
405 if not ui.verbose:
406 if not ui.verbose:
406 omitted = (_('use "hg help -v %s" to show more complete help') %
407 omitted = (_('use "hg help -v %s" to show more complete help') %
407 name)
408 name)
408 indicateomitted(rst, omitted)
409 indicateomitted(rst, omitted)
409
410
410 try:
411 try:
411 cmdutil.findcmd(name, commands.table)
412 cmdutil.findcmd(name, commands.table)
412 rst.append(_('\nuse "hg help -c %s" to see help for '
413 rst.append(_('\nuse "hg help -c %s" to see help for '
413 'the %s command\n') % (name, name))
414 'the %s command\n') % (name, name))
414 except error.UnknownCommand:
415 except error.UnknownCommand:
415 pass
416 pass
416 return rst
417 return rst
417
418
418 def helpext(name):
419 def helpext(name):
419 try:
420 try:
420 mod = extensions.find(name)
421 mod = extensions.find(name)
421 doc = gettext(mod.__doc__) or _('no help text available')
422 doc = gettext(mod.__doc__) or _('no help text available')
422 except KeyError:
423 except KeyError:
423 mod = None
424 mod = None
424 doc = extensions.disabledext(name)
425 doc = extensions.disabledext(name)
425 if not doc:
426 if not doc:
426 raise error.UnknownCommand(name)
427 raise error.UnknownCommand(name)
427
428
428 if '\n' not in doc:
429 if '\n' not in doc:
429 head, tail = doc, ""
430 head, tail = doc, ""
430 else:
431 else:
431 head, tail = doc.split('\n', 1)
432 head, tail = doc.split('\n', 1)
432 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
433 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
433 if tail:
434 if tail:
434 rst.extend(tail.splitlines(True))
435 rst.extend(tail.splitlines(True))
435 rst.append('\n')
436 rst.append('\n')
436
437
437 if not ui.verbose:
438 if not ui.verbose:
438 omitted = (_('use "hg help -v %s" to show more complete help') %
439 omitted = (_('use "hg help -v %s" to show more complete help') %
439 name)
440 name)
440 indicateomitted(rst, omitted)
441 indicateomitted(rst, omitted)
441
442
442 if mod:
443 if mod:
443 try:
444 try:
444 ct = mod.cmdtable
445 ct = mod.cmdtable
445 except AttributeError:
446 except AttributeError:
446 ct = {}
447 ct = {}
447 modcmds = set([c.split('|', 1)[0] for c in ct])
448 modcmds = set([c.split('|', 1)[0] for c in ct])
448 rst.extend(helplist(modcmds.__contains__))
449 rst.extend(helplist(modcmds.__contains__))
449 else:
450 else:
450 rst.append(_('use "hg help extensions" for information on enabling '
451 rst.append(_('use "hg help extensions" for information on enabling '
451 'extensions\n'))
452 'extensions\n'))
452 return rst
453 return rst
453
454
454 def helpextcmd(name):
455 def helpextcmd(name):
455 cmd, ext, mod = extensions.disabledcmd(ui, name,
456 cmd, ext, mod = extensions.disabledcmd(ui, name,
456 ui.configbool('ui', 'strict'))
457 ui.configbool('ui', 'strict'))
457 doc = gettext(mod.__doc__).splitlines()[0]
458 doc = gettext(mod.__doc__).splitlines()[0]
458
459
459 rst = listexts(_("'%s' is provided by the following "
460 rst = listexts(_("'%s' is provided by the following "
460 "extension:") % cmd, {ext: doc}, indent=4)
461 "extension:") % cmd, {ext: doc}, indent=4)
461 rst.append('\n')
462 rst.append('\n')
462 rst.append(_('use "hg help extensions" for information on enabling '
463 rst.append(_('use "hg help extensions" for information on enabling '
463 'extensions\n'))
464 'extensions\n'))
464 return rst
465 return rst
465
466
466
467
467 rst = []
468 rst = []
468 kw = opts.get('keyword')
469 kw = opts.get('keyword')
469 if kw:
470 if kw:
470 matches = topicmatch(kw)
471 matches = topicmatch(kw)
471 for t, title in (('topics', _('Topics')),
472 for t, title in (('topics', _('Topics')),
472 ('commands', _('Commands')),
473 ('commands', _('Commands')),
473 ('extensions', _('Extensions')),
474 ('extensions', _('Extensions')),
474 ('extensioncommands', _('Extension Commands'))):
475 ('extensioncommands', _('Extension Commands'))):
475 if matches[t]:
476 if matches[t]:
476 rst.append('%s:\n\n' % title)
477 rst.append('%s:\n\n' % title)
477 rst.extend(minirst.maketable(sorted(matches[t]), 1))
478 rst.extend(minirst.maketable(sorted(matches[t]), 1))
478 rst.append('\n')
479 rst.append('\n')
479 elif name and name != 'shortlist':
480 elif name and name != 'shortlist':
480 i = None
481 i = None
481 if unknowncmd:
482 if unknowncmd:
482 queries = (helpextcmd,)
483 queries = (helpextcmd,)
483 elif opts.get('extension'):
484 elif opts.get('extension'):
484 queries = (helpext,)
485 queries = (helpext,)
485 elif opts.get('command'):
486 elif opts.get('command'):
486 queries = (helpcmd,)
487 queries = (helpcmd,)
487 else:
488 else:
488 queries = (helptopic, helpcmd, helpext, helpextcmd)
489 queries = (helptopic, helpcmd, helpext, helpextcmd)
489 for f in queries:
490 for f in queries:
490 try:
491 try:
491 rst = f(name)
492 rst = f(name)
492 i = None
493 i = None
493 break
494 break
494 except error.UnknownCommand, inst:
495 except error.UnknownCommand, inst:
495 i = inst
496 i = inst
496 if i:
497 if i:
497 raise i
498 raise i
498 else:
499 else:
499 # program name
500 # program name
500 if not ui.quiet:
501 if not ui.quiet:
501 rst = [_("Mercurial Distributed SCM\n"), '\n']
502 rst = [_("Mercurial Distributed SCM\n"), '\n']
502 rst.extend(helplist())
503 rst.extend(helplist())
503
504
504 return ''.join(rst)
505 return ''.join(rst)
@@ -1,1905 +1,1912
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 track a line of development with movable markers
58 bookmarks track a line of development with movable markers
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 copy mark files as copied for the next commit
65 copy mark files as copied for the next commit
66 diff diff repository (or selected files)
66 diff diff repository (or selected files)
67 export dump the header and diffs for one or more changesets
67 export dump the header and diffs for one or more changesets
68 forget forget the specified files on the next commit
68 forget forget the specified files on the next commit
69 graft copy changes from other branches onto the current branch
69 graft copy changes from other branches onto the current branch
70 grep search for a pattern in specified files and revisions
70 grep search for a pattern in specified files and revisions
71 heads show branch heads
71 heads show branch heads
72 help show help for a given topic or a help overview
72 help show help for a given topic or a help overview
73 identify identify the working copy or specified revision
73 identify identify the working copy or specified revision
74 import import an ordered set of patches
74 import import an ordered set of patches
75 incoming show new changesets found in source
75 incoming show new changesets found in source
76 init create a new repository in the given directory
76 init create a new repository in the given directory
77 locate locate files matching specific patterns
77 locate locate files matching specific patterns
78 log show revision history of entire repository or files
78 log show revision history of entire repository or files
79 manifest output the current or given revision of the project manifest
79 manifest output the current or given revision of the project manifest
80 merge merge working directory with another revision
80 merge merge working directory with another revision
81 outgoing show changesets not found in the destination
81 outgoing show changesets not found in the destination
82 parents show the parents of the working directory or revision
82 parents show the parents of the working directory or revision
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 showconfig show combined config settings from all hgrc files
94 showconfig show combined config settings from all hgrc files
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 track a line of development with movable markers
134 bookmarks track a line of development with movable markers
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 copy mark files as copied for the next commit
141 copy mark files as copied for the next commit
142 diff diff repository (or selected files)
142 diff diff repository (or selected files)
143 export dump the header and diffs for one or more changesets
143 export dump the header and diffs for one or more changesets
144 forget forget the specified files on the next commit
144 forget forget the specified files on the next commit
145 graft copy changes from other branches onto the current branch
145 graft copy changes from other branches onto the current branch
146 grep search for a pattern in specified files and revisions
146 grep search for a pattern in specified files and revisions
147 heads show branch heads
147 heads show branch heads
148 help show help for a given topic or a help overview
148 help show help for a given topic or a help overview
149 identify identify the working copy or specified revision
149 identify identify the working copy or specified revision
150 import import an ordered set of patches
150 import import an ordered set of patches
151 incoming show new changesets found in source
151 incoming show new changesets found in source
152 init create a new repository in the given directory
152 init create a new repository in the given directory
153 locate locate files matching specific patterns
153 locate locate files matching specific patterns
154 log show revision history of entire repository or files
154 log show revision history of entire repository or files
155 manifest output the current or given revision of the project manifest
155 manifest output the current or given revision of the project manifest
156 merge merge working directory with another revision
156 merge merge working directory with another revision
157 outgoing show changesets not found in the destination
157 outgoing show changesets not found in the destination
158 parents show the parents of the working directory or revision
158 parents show the parents of the working directory or revision
159 paths show aliases for remote repositories
159 paths show aliases for remote repositories
160 phase set or show the current phase name
160 phase set or show the current phase name
161 pull pull changes from the specified source
161 pull pull changes from the specified source
162 push push changes to the specified destination
162 push push changes to the specified destination
163 recover roll back an interrupted transaction
163 recover roll back an interrupted transaction
164 remove remove the specified files on the next commit
164 remove remove the specified files on the next commit
165 rename rename files; equivalent of copy + remove
165 rename rename files; equivalent of copy + remove
166 resolve redo merges or set/view the merge status of files
166 resolve redo merges or set/view the merge status of files
167 revert restore files to their checkout state
167 revert restore files to their checkout state
168 root print the root (top) of the current working directory
168 root print the root (top) of the current working directory
169 serve start stand-alone webserver
169 serve start stand-alone webserver
170 showconfig show combined config settings from all hgrc files
170 showconfig show combined config settings from all hgrc files
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 short command list with verbose option
201 Test short command list with verbose option
202
202
203 $ hg -v help shortlist
203 $ hg -v help shortlist
204 Mercurial Distributed SCM
204 Mercurial Distributed SCM
205
205
206 basic commands:
206 basic commands:
207
207
208 add add the specified files on the next commit
208 add add the specified files on the next commit
209 annotate, blame
209 annotate, blame
210 show changeset information by line for each file
210 show changeset information by line for each file
211 clone make a copy of an existing repository
211 clone make a copy of an existing repository
212 commit, ci commit the specified files or all outstanding changes
212 commit, ci commit the specified files or all outstanding changes
213 diff diff repository (or selected files)
213 diff diff repository (or selected files)
214 export dump the header and diffs for one or more changesets
214 export dump the header and diffs for one or more changesets
215 forget forget the specified files on the next commit
215 forget forget the specified files on the next commit
216 init create a new repository in the given directory
216 init create a new repository in the given directory
217 log, history show revision history of entire repository or files
217 log, history show revision history of entire repository or files
218 merge merge working directory with another revision
218 merge merge working directory with another revision
219 pull pull changes from the specified source
219 pull pull changes from the specified source
220 push push changes to the specified destination
220 push push changes to the specified destination
221 remove, rm remove the specified files on the next commit
221 remove, rm remove the specified files on the next commit
222 serve start stand-alone webserver
222 serve start stand-alone webserver
223 status, st show changed files in the working directory
223 status, st show changed files in the working directory
224 summary, sum summarize working directory state
224 summary, sum summarize working directory state
225 update, up, checkout, co
225 update, up, checkout, co
226 update working directory (or switch revisions)
226 update working directory (or switch revisions)
227
227
228 global options:
228 global options:
229
229
230 -R --repository REPO repository root directory or name of overlay bundle
230 -R --repository REPO repository root directory or name of overlay bundle
231 file
231 file
232 --cwd DIR change working directory
232 --cwd DIR change working directory
233 -y --noninteractive do not prompt, automatically pick the first choice for
233 -y --noninteractive do not prompt, automatically pick the first choice for
234 all prompts
234 all prompts
235 -q --quiet suppress output
235 -q --quiet suppress output
236 -v --verbose enable additional output
236 -v --verbose enable additional output
237 --config CONFIG [+] set/override config option (use 'section.name=value')
237 --config CONFIG [+] set/override config option (use 'section.name=value')
238 --debug enable debugging output
238 --debug enable debugging output
239 --debugger start debugger
239 --debugger start debugger
240 --encoding ENCODE set the charset encoding (default: ascii)
240 --encoding ENCODE set the charset encoding (default: ascii)
241 --encodingmode MODE set the charset encoding mode (default: strict)
241 --encodingmode MODE set the charset encoding mode (default: strict)
242 --traceback always print a traceback on exception
242 --traceback always print a traceback on exception
243 --time time how long the command takes
243 --time time how long the command takes
244 --profile print command execution profile
244 --profile print command execution profile
245 --version output version information and exit
245 --version output version information and exit
246 -h --help display help and exit
246 -h --help display help and exit
247 --hidden consider hidden changesets
247 --hidden consider hidden changesets
248
248
249 [+] marked option can be specified multiple times
249 [+] marked option can be specified multiple times
250
250
251 use "hg help" for the full list of commands
251 use "hg help" for the full list of commands
252
252
253 $ hg add -h
253 $ hg add -h
254 hg add [OPTION]... [FILE]...
254 hg add [OPTION]... [FILE]...
255
255
256 add the specified files on the next commit
256 add the specified files on the next commit
257
257
258 Schedule files to be version controlled and added to the repository.
258 Schedule files to be version controlled and added to the repository.
259
259
260 The files will be added to the repository at the next commit. To undo an
260 The files will be added to the repository at the next commit. To undo an
261 add before that, see "hg forget".
261 add before that, see "hg forget".
262
262
263 If no names are given, add all files to the repository.
263 If no names are given, add all files to the repository.
264
264
265 Returns 0 if all files are successfully added.
265 Returns 0 if all files are successfully added.
266
266
267 options:
267 options:
268
268
269 -I --include PATTERN [+] include names matching the given patterns
269 -I --include PATTERN [+] include names matching the given patterns
270 -X --exclude PATTERN [+] exclude names matching the given patterns
270 -X --exclude PATTERN [+] exclude names matching the given patterns
271 -S --subrepos recurse into subrepositories
271 -S --subrepos recurse into subrepositories
272 -n --dry-run do not perform actions, just print output
272 -n --dry-run do not perform actions, just print output
273
273
274 [+] marked option can be specified multiple times
274 [+] marked option can be specified multiple times
275
275
276 use "hg -v help add" to show more complete help and the global options
276 use "hg -v help add" to show more complete help and the global options
277
277
278 Verbose help for add
278 Verbose help for add
279
279
280 $ hg add -hv
280 $ hg add -hv
281 hg add [OPTION]... [FILE]...
281 hg add [OPTION]... [FILE]...
282
282
283 add the specified files on the next commit
283 add the specified files on the next commit
284
284
285 Schedule files to be version controlled and added to the repository.
285 Schedule files to be version controlled and added to the repository.
286
286
287 The files will be added to the repository at the next commit. To undo an
287 The files will be added to the repository at the next commit. To undo an
288 add before that, see "hg forget".
288 add before that, see "hg forget".
289
289
290 If no names are given, add all files to the repository.
290 If no names are given, add all files to the repository.
291
291
292 An example showing how new (unknown) files are added automatically by "hg
292 An example showing how new (unknown) files are added automatically by "hg
293 add":
293 add":
294
294
295 $ ls
295 $ ls
296 foo.c
296 foo.c
297 $ hg status
297 $ hg status
298 ? foo.c
298 ? foo.c
299 $ hg add
299 $ hg add
300 adding foo.c
300 adding foo.c
301 $ hg status
301 $ hg status
302 A foo.c
302 A foo.c
303
303
304 Returns 0 if all files are successfully added.
304 Returns 0 if all files are successfully added.
305
305
306 options:
306 options:
307
307
308 -I --include PATTERN [+] include names matching the given patterns
308 -I --include PATTERN [+] include names matching the given patterns
309 -X --exclude PATTERN [+] exclude names matching the given patterns
309 -X --exclude PATTERN [+] exclude names matching the given patterns
310 -S --subrepos recurse into subrepositories
310 -S --subrepos recurse into subrepositories
311 -n --dry-run do not perform actions, just print output
311 -n --dry-run do not perform actions, just print output
312
312
313 [+] marked option can be specified multiple times
313 [+] marked option can be specified multiple times
314
314
315 global options:
315 global options:
316
316
317 -R --repository REPO repository root directory or name of overlay bundle
317 -R --repository REPO repository root directory or name of overlay bundle
318 file
318 file
319 --cwd DIR change working directory
319 --cwd DIR change working directory
320 -y --noninteractive do not prompt, automatically pick the first choice for
320 -y --noninteractive do not prompt, automatically pick the first choice for
321 all prompts
321 all prompts
322 -q --quiet suppress output
322 -q --quiet suppress output
323 -v --verbose enable additional output
323 -v --verbose enable additional output
324 --config CONFIG [+] set/override config option (use 'section.name=value')
324 --config CONFIG [+] set/override config option (use 'section.name=value')
325 --debug enable debugging output
325 --debug enable debugging output
326 --debugger start debugger
326 --debugger start debugger
327 --encoding ENCODE set the charset encoding (default: ascii)
327 --encoding ENCODE set the charset encoding (default: ascii)
328 --encodingmode MODE set the charset encoding mode (default: strict)
328 --encodingmode MODE set the charset encoding mode (default: strict)
329 --traceback always print a traceback on exception
329 --traceback always print a traceback on exception
330 --time time how long the command takes
330 --time time how long the command takes
331 --profile print command execution profile
331 --profile print command execution profile
332 --version output version information and exit
332 --version output version information and exit
333 -h --help display help and exit
333 -h --help display help and exit
334 --hidden consider hidden changesets
334 --hidden consider hidden changesets
335
335
336 [+] marked option can be specified multiple times
336 [+] marked option can be specified multiple times
337
337
338 Test help option with version option
338 Test help option with version option
339
339
340 $ hg add -h --version
340 $ hg add -h --version
341 Mercurial Distributed SCM (version *) (glob)
341 Mercurial Distributed SCM (version *) (glob)
342 (see http://mercurial.selenic.com for more information)
342 (see http://mercurial.selenic.com for more information)
343
343
344 Copyright (C) 2005-2013 Matt Mackall and others
344 Copyright (C) 2005-2013 Matt Mackall and others
345 This is free software; see the source for copying conditions. There is NO
345 This is free software; see the source for copying conditions. There is NO
346 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
346 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
347
347
348 $ hg add --skjdfks
348 $ hg add --skjdfks
349 hg add: option --skjdfks not recognized
349 hg add: option --skjdfks not recognized
350 hg add [OPTION]... [FILE]...
350 hg add [OPTION]... [FILE]...
351
351
352 add the specified files on the next commit
352 add the specified files on the next commit
353
353
354 options:
354 options:
355
355
356 -I --include PATTERN [+] include names matching the given patterns
356 -I --include PATTERN [+] include names matching the given patterns
357 -X --exclude PATTERN [+] exclude names matching the given patterns
357 -X --exclude PATTERN [+] exclude names matching the given patterns
358 -S --subrepos recurse into subrepositories
358 -S --subrepos recurse into subrepositories
359 -n --dry-run do not perform actions, just print output
359 -n --dry-run do not perform actions, just print output
360
360
361 [+] marked option can be specified multiple times
361 [+] marked option can be specified multiple times
362
362
363 use "hg help add" to show the full help text
363 use "hg help add" to show the full help text
364 [255]
364 [255]
365
365
366 Test ambiguous command help
366 Test ambiguous command help
367
367
368 $ hg help ad
368 $ hg help ad
369 list of commands:
369 list of commands:
370
370
371 add add the specified files on the next commit
371 add add the specified files on the next commit
372 addremove add all new files, delete all missing files
372 addremove add all new files, delete all missing files
373
373
374 use "hg -v help ad" to show builtin aliases and global options
374 use "hg -v help ad" to show builtin aliases and global options
375
375
376 Test command without options
376 Test command without options
377
377
378 $ hg help verify
378 $ hg help verify
379 hg verify
379 hg verify
380
380
381 verify the integrity of the repository
381 verify the integrity of the repository
382
382
383 Verify the integrity of the current repository.
383 Verify the integrity of the current repository.
384
384
385 This will perform an extensive check of the repository's integrity,
385 This will perform an extensive check of the repository's integrity,
386 validating the hashes and checksums of each entry in the changelog,
386 validating the hashes and checksums of each entry in the changelog,
387 manifest, and tracked files, as well as the integrity of their crosslinks
387 manifest, and tracked files, as well as the integrity of their crosslinks
388 and indices.
388 and indices.
389
389
390 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
390 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
391 information about recovery from corruption of the repository.
391 information about recovery from corruption of the repository.
392
392
393 Returns 0 on success, 1 if errors are encountered.
393 Returns 0 on success, 1 if errors are encountered.
394
394
395 use "hg -v help verify" to show the global options
395 use "hg -v help verify" to show the global options
396
396
397 $ hg help diff
397 $ hg help diff
398 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
398 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
399
399
400 diff repository (or selected files)
400 diff repository (or selected files)
401
401
402 Show differences between revisions for the specified files.
402 Show differences between revisions for the specified files.
403
403
404 Differences between files are shown using the unified diff format.
404 Differences between files are shown using the unified diff format.
405
405
406 Note:
406 Note:
407 diff may generate unexpected results for merges, as it will default to
407 diff may generate unexpected results for merges, as it will default to
408 comparing against the working directory's first parent changeset if no
408 comparing against the working directory's first parent changeset if no
409 revisions are specified.
409 revisions are specified.
410
410
411 When two revision arguments are given, then changes are shown between
411 When two revision arguments are given, then changes are shown between
412 those revisions. If only one revision is specified then that revision is
412 those revisions. If only one revision is specified then that revision is
413 compared to the working directory, and, when no revisions are specified,
413 compared to the working directory, and, when no revisions are specified,
414 the working directory files are compared to its parent.
414 the working directory files are compared to its parent.
415
415
416 Alternatively you can specify -c/--change with a revision to see the
416 Alternatively you can specify -c/--change with a revision to see the
417 changes in that changeset relative to its first parent.
417 changes in that changeset relative to its first parent.
418
418
419 Without the -a/--text option, diff will avoid generating diffs of files it
419 Without the -a/--text option, diff will avoid generating diffs of files it
420 detects as binary. With -a, diff will generate a diff anyway, probably
420 detects as binary. With -a, diff will generate a diff anyway, probably
421 with undesirable results.
421 with undesirable results.
422
422
423 Use the -g/--git option to generate diffs in the git extended diff format.
423 Use the -g/--git option to generate diffs in the git extended diff format.
424 For more information, read "hg help diffs".
424 For more information, read "hg help diffs".
425
425
426 Returns 0 on success.
426 Returns 0 on success.
427
427
428 options:
428 options:
429
429
430 -r --rev REV [+] revision
430 -r --rev REV [+] revision
431 -c --change REV change made by revision
431 -c --change REV change made by revision
432 -a --text treat all files as text
432 -a --text treat all files as text
433 -g --git use git extended diff format
433 -g --git use git extended diff format
434 --nodates omit dates from diff headers
434 --nodates omit dates from diff headers
435 -p --show-function show which function each change is in
435 -p --show-function show which function each change is in
436 --reverse produce a diff that undoes the changes
436 --reverse produce a diff that undoes the changes
437 -w --ignore-all-space ignore white space when comparing lines
437 -w --ignore-all-space ignore white space when comparing lines
438 -b --ignore-space-change ignore changes in the amount of white space
438 -b --ignore-space-change ignore changes in the amount of white space
439 -B --ignore-blank-lines ignore changes whose lines are all blank
439 -B --ignore-blank-lines ignore changes whose lines are all blank
440 -U --unified NUM number of lines of context to show
440 -U --unified NUM number of lines of context to show
441 --stat output diffstat-style summary of changes
441 --stat output diffstat-style summary of changes
442 -I --include PATTERN [+] include names matching the given patterns
442 -I --include PATTERN [+] include names matching the given patterns
443 -X --exclude PATTERN [+] exclude names matching the given patterns
443 -X --exclude PATTERN [+] exclude names matching the given patterns
444 -S --subrepos recurse into subrepositories
444 -S --subrepos recurse into subrepositories
445
445
446 [+] marked option can be specified multiple times
446 [+] marked option can be specified multiple times
447
447
448 use "hg -v help diff" to show more complete help and the global options
448 use "hg -v help diff" to show more complete help and the global options
449
449
450 $ hg help status
450 $ hg help status
451 hg status [OPTION]... [FILE]...
451 hg status [OPTION]... [FILE]...
452
452
453 aliases: st
453 aliases: st
454
454
455 show changed files in the working directory
455 show changed files in the working directory
456
456
457 Show status of files in the repository. If names are given, only files
457 Show status of files in the repository. If names are given, only files
458 that match are shown. Files that are clean or ignored or the source of a
458 that match are shown. Files that are clean or ignored or the source of a
459 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
459 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
460 -C/--copies or -A/--all are given. Unless options described with "show
460 -C/--copies or -A/--all are given. Unless options described with "show
461 only ..." are given, the options -mardu are used.
461 only ..." are given, the options -mardu are used.
462
462
463 Option -q/--quiet hides untracked (unknown and ignored) files unless
463 Option -q/--quiet hides untracked (unknown and ignored) files unless
464 explicitly requested with -u/--unknown or -i/--ignored.
464 explicitly requested with -u/--unknown or -i/--ignored.
465
465
466 Note:
466 Note:
467 status may appear to disagree with diff if permissions have changed or
467 status may appear to disagree with diff if permissions have changed or
468 a merge has occurred. The standard diff format does not report
468 a merge has occurred. The standard diff format does not report
469 permission changes and diff only reports changes relative to one merge
469 permission changes and diff only reports changes relative to one merge
470 parent.
470 parent.
471
471
472 If one revision is given, it is used as the base revision. If two
472 If one revision is given, it is used as the base revision. If two
473 revisions are given, the differences between them are shown. The --change
473 revisions are given, the differences between them are shown. The --change
474 option can also be used as a shortcut to list the changed files of a
474 option can also be used as a shortcut to list the changed files of a
475 revision from its first parent.
475 revision from its first parent.
476
476
477 The codes used to show the status of files are:
477 The codes used to show the status of files are:
478
478
479 M = modified
479 M = modified
480 A = added
480 A = added
481 R = removed
481 R = removed
482 C = clean
482 C = clean
483 ! = missing (deleted by non-hg command, but still tracked)
483 ! = missing (deleted by non-hg command, but still tracked)
484 ? = not tracked
484 ? = not tracked
485 I = ignored
485 I = ignored
486 = origin of the previous file listed as A (added)
486 = origin of the previous file listed as A (added)
487
487
488 Returns 0 on success.
488 Returns 0 on success.
489
489
490 options:
490 options:
491
491
492 -A --all show status of all files
492 -A --all show status of all files
493 -m --modified show only modified files
493 -m --modified show only modified files
494 -a --added show only added files
494 -a --added show only added files
495 -r --removed show only removed files
495 -r --removed show only removed files
496 -d --deleted show only deleted (but tracked) files
496 -d --deleted show only deleted (but tracked) files
497 -c --clean show only files without changes
497 -c --clean show only files without changes
498 -u --unknown show only unknown (not tracked) files
498 -u --unknown show only unknown (not tracked) files
499 -i --ignored show only ignored files
499 -i --ignored show only ignored files
500 -n --no-status hide status prefix
500 -n --no-status hide status prefix
501 -C --copies show source of copied files
501 -C --copies show source of copied files
502 -0 --print0 end filenames with NUL, for use with xargs
502 -0 --print0 end filenames with NUL, for use with xargs
503 --rev REV [+] show difference from revision
503 --rev REV [+] show difference from revision
504 --change REV list the changed files of a revision
504 --change REV list the changed files of a revision
505 -I --include PATTERN [+] include names matching the given patterns
505 -I --include PATTERN [+] include names matching the given patterns
506 -X --exclude PATTERN [+] exclude names matching the given patterns
506 -X --exclude PATTERN [+] exclude names matching the given patterns
507 -S --subrepos recurse into subrepositories
507 -S --subrepos recurse into subrepositories
508
508
509 [+] marked option can be specified multiple times
509 [+] marked option can be specified multiple times
510
510
511 use "hg -v help status" to show more complete help and the global options
511 use "hg -v help status" to show more complete help and the global options
512
512
513 $ hg -q help status
513 $ hg -q help status
514 hg status [OPTION]... [FILE]...
514 hg status [OPTION]... [FILE]...
515
515
516 show changed files in the working directory
516 show changed files in the working directory
517
517
518 $ hg help foo
518 $ hg help foo
519 hg: unknown command 'foo'
519 hg: unknown command 'foo'
520 Mercurial Distributed SCM
520 Mercurial Distributed SCM
521
521
522 basic commands:
522 basic commands:
523
523
524 add add the specified files on the next commit
524 add add the specified files on the next commit
525 annotate show changeset information by line for each file
525 annotate show changeset information by line for each file
526 clone make a copy of an existing repository
526 clone make a copy of an existing repository
527 commit commit the specified files or all outstanding changes
527 commit commit the specified files or all outstanding changes
528 diff diff repository (or selected files)
528 diff diff repository (or selected files)
529 export dump the header and diffs for one or more changesets
529 export dump the header and diffs for one or more changesets
530 forget forget the specified files on the next commit
530 forget forget the specified files on the next commit
531 init create a new repository in the given directory
531 init create a new repository in the given directory
532 log show revision history of entire repository or files
532 log show revision history of entire repository or files
533 merge merge working directory with another revision
533 merge merge working directory with another revision
534 pull pull changes from the specified source
534 pull pull changes from the specified source
535 push push changes to the specified destination
535 push push changes to the specified destination
536 remove remove the specified files on the next commit
536 remove remove the specified files on the next commit
537 serve start stand-alone webserver
537 serve start stand-alone webserver
538 status show changed files in the working directory
538 status show changed files in the working directory
539 summary summarize working directory state
539 summary summarize working directory state
540 update update working directory (or switch revisions)
540 update update working directory (or switch revisions)
541
541
542 use "hg help" for the full list of commands or "hg -v" for details
542 use "hg help" for the full list of commands or "hg -v" for details
543 [255]
543 [255]
544
544
545 $ hg skjdfks
545 $ hg skjdfks
546 hg: unknown command 'skjdfks'
546 hg: unknown command 'skjdfks'
547 Mercurial Distributed SCM
547 Mercurial Distributed SCM
548
548
549 basic commands:
549 basic commands:
550
550
551 add add the specified files on the next commit
551 add add the specified files on the next commit
552 annotate show changeset information by line for each file
552 annotate show changeset information by line for each file
553 clone make a copy of an existing repository
553 clone make a copy of an existing repository
554 commit commit the specified files or all outstanding changes
554 commit commit the specified files or all outstanding changes
555 diff diff repository (or selected files)
555 diff diff repository (or selected files)
556 export dump the header and diffs for one or more changesets
556 export dump the header and diffs for one or more changesets
557 forget forget the specified files on the next commit
557 forget forget the specified files on the next commit
558 init create a new repository in the given directory
558 init create a new repository in the given directory
559 log show revision history of entire repository or files
559 log show revision history of entire repository or files
560 merge merge working directory with another revision
560 merge merge working directory with another revision
561 pull pull changes from the specified source
561 pull pull changes from the specified source
562 push push changes to the specified destination
562 push push changes to the specified destination
563 remove remove the specified files on the next commit
563 remove remove the specified files on the next commit
564 serve start stand-alone webserver
564 serve start stand-alone webserver
565 status show changed files in the working directory
565 status show changed files in the working directory
566 summary summarize working directory state
566 summary summarize working directory state
567 update update working directory (or switch revisions)
567 update update working directory (or switch revisions)
568
568
569 use "hg help" for the full list of commands or "hg -v" for details
569 use "hg help" for the full list of commands or "hg -v" for details
570 [255]
570 [255]
571
571
572 $ cat > helpext.py <<EOF
572 $ cat > helpext.py <<EOF
573 > import os
573 > import os
574 > from mercurial import commands
574 > from mercurial import commands
575 >
575 >
576 > def nohelp(ui, *args, **kwargs):
576 > def nohelp(ui, *args, **kwargs):
577 > pass
577 > pass
578 >
578 >
579 > cmdtable = {
579 > cmdtable = {
580 > "nohelp": (nohelp, [], "hg nohelp"),
580 > "nohelp": (nohelp, [], "hg nohelp"),
581 > }
581 > }
582 >
582 >
583 > commands.norepo += ' nohelp'
583 > commands.norepo += ' nohelp'
584 > EOF
584 > EOF
585 $ echo '[extensions]' >> $HGRCPATH
585 $ echo '[extensions]' >> $HGRCPATH
586 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
586 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
587
587
588 Test command with no help text
588 Test command with no help text
589
589
590 $ hg help nohelp
590 $ hg help nohelp
591 hg nohelp
591 hg nohelp
592
592
593 (no help text available)
593 (no help text available)
594
594
595 use "hg -v help nohelp" to show the global options
595 use "hg -v help nohelp" to show the global options
596
596
597 $ hg help -k nohelp
597 $ hg help -k nohelp
598 Commands:
598 Commands:
599
599
600 nohelp hg nohelp
600 nohelp hg nohelp
601
601
602 Extension Commands:
602 Extension Commands:
603
603
604 nohelp (no help text available)
604 nohelp (no help text available)
605
605
606 Test that default list of commands omits extension commands
606 Test that default list of commands omits extension commands
607
607
608 $ hg help
608 $ hg help
609 Mercurial Distributed SCM
609 Mercurial Distributed SCM
610
610
611 list of commands:
611 list of commands:
612
612
613 add add the specified files on the next commit
613 add add the specified files on the next commit
614 addremove add all new files, delete all missing files
614 addremove add all new files, delete all missing files
615 annotate show changeset information by line for each file
615 annotate show changeset information by line for each file
616 archive create an unversioned archive of a repository revision
616 archive create an unversioned archive of a repository revision
617 backout reverse effect of earlier changeset
617 backout reverse effect of earlier changeset
618 bisect subdivision search of changesets
618 bisect subdivision search of changesets
619 bookmarks track a line of development with movable markers
619 bookmarks track a line of development with movable markers
620 branch set or show the current branch name
620 branch set or show the current branch name
621 branches list repository named branches
621 branches list repository named branches
622 bundle create a changegroup file
622 bundle create a changegroup file
623 cat output the current or given revision of files
623 cat output the current or given revision of files
624 clone make a copy of an existing repository
624 clone make a copy of an existing repository
625 commit commit the specified files or all outstanding changes
625 commit commit the specified files or all outstanding changes
626 copy mark files as copied for the next commit
626 copy mark files as copied for the next commit
627 diff diff repository (or selected files)
627 diff diff repository (or selected files)
628 export dump the header and diffs for one or more changesets
628 export dump the header and diffs for one or more changesets
629 forget forget the specified files on the next commit
629 forget forget the specified files on the next commit
630 graft copy changes from other branches onto the current branch
630 graft copy changes from other branches onto the current branch
631 grep search for a pattern in specified files and revisions
631 grep search for a pattern in specified files and revisions
632 heads show branch heads
632 heads show branch heads
633 help show help for a given topic or a help overview
633 help show help for a given topic or a help overview
634 identify identify the working copy or specified revision
634 identify identify the working copy or specified revision
635 import import an ordered set of patches
635 import import an ordered set of patches
636 incoming show new changesets found in source
636 incoming show new changesets found in source
637 init create a new repository in the given directory
637 init create a new repository in the given directory
638 locate locate files matching specific patterns
638 locate locate files matching specific patterns
639 log show revision history of entire repository or files
639 log show revision history of entire repository or files
640 manifest output the current or given revision of the project manifest
640 manifest output the current or given revision of the project manifest
641 merge merge working directory with another revision
641 merge merge working directory with another revision
642 outgoing show changesets not found in the destination
642 outgoing show changesets not found in the destination
643 parents show the parents of the working directory or revision
643 parents show the parents of the working directory or revision
644 paths show aliases for remote repositories
644 paths show aliases for remote repositories
645 phase set or show the current phase name
645 phase set or show the current phase name
646 pull pull changes from the specified source
646 pull pull changes from the specified source
647 push push changes to the specified destination
647 push push changes to the specified destination
648 recover roll back an interrupted transaction
648 recover roll back an interrupted transaction
649 remove remove the specified files on the next commit
649 remove remove the specified files on the next commit
650 rename rename files; equivalent of copy + remove
650 rename rename files; equivalent of copy + remove
651 resolve redo merges or set/view the merge status of files
651 resolve redo merges or set/view the merge status of files
652 revert restore files to their checkout state
652 revert restore files to their checkout state
653 root print the root (top) of the current working directory
653 root print the root (top) of the current working directory
654 serve start stand-alone webserver
654 serve start stand-alone webserver
655 showconfig show combined config settings from all hgrc files
655 showconfig show combined config settings from all hgrc files
656 status show changed files in the working directory
656 status show changed files in the working directory
657 summary summarize working directory state
657 summary summarize working directory state
658 tag add one or more tags for the current or given revision
658 tag add one or more tags for the current or given revision
659 tags list repository tags
659 tags list repository tags
660 unbundle apply one or more changegroup files
660 unbundle apply one or more changegroup files
661 update update working directory (or switch revisions)
661 update update working directory (or switch revisions)
662 verify verify the integrity of the repository
662 verify verify the integrity of the repository
663 version output version and copyright information
663 version output version and copyright information
664
664
665 enabled extensions:
665 enabled extensions:
666
666
667 helpext (no help text available)
667 helpext (no help text available)
668
668
669 additional help topics:
669 additional help topics:
670
670
671 config Configuration Files
671 config Configuration Files
672 dates Date Formats
672 dates Date Formats
673 diffs Diff Formats
673 diffs Diff Formats
674 environment Environment Variables
674 environment Environment Variables
675 extensions Using Additional Features
675 extensions Using Additional Features
676 filesets Specifying File Sets
676 filesets Specifying File Sets
677 glossary Glossary
677 glossary Glossary
678 hgignore Syntax for Mercurial Ignore Files
678 hgignore Syntax for Mercurial Ignore Files
679 hgweb Configuring hgweb
679 hgweb Configuring hgweb
680 merge-tools Merge Tools
680 merge-tools Merge Tools
681 multirevs Specifying Multiple Revisions
681 multirevs Specifying Multiple Revisions
682 patterns File Name Patterns
682 patterns File Name Patterns
683 phases Working with Phases
683 phases Working with Phases
684 revisions Specifying Single Revisions
684 revisions Specifying Single Revisions
685 revsets Specifying Revision Sets
685 revsets Specifying Revision Sets
686 subrepos Subrepositories
686 subrepos Subrepositories
687 templating Template Usage
687 templating Template Usage
688 urls URL Paths
688 urls URL Paths
689
689
690 use "hg -v help" to show builtin aliases and global options
690 use "hg -v help" to show builtin aliases and global options
691
691
692
692
693
693
694 Test list of commands with command with no help text
694 Test list of commands with command with no help text
695
695
696 $ hg help helpext
696 $ hg help helpext
697 helpext extension - no help text available
697 helpext extension - no help text available
698
698
699 list of commands:
699 list of commands:
700
700
701 nohelp (no help text available)
701 nohelp (no help text available)
702
702
703 use "hg -v help helpext" to show builtin aliases and global options
703 use "hg -v help helpext" to show builtin aliases and global options
704
704
705 Test a help topic
705 Test a help topic
706
706
707 $ hg help revs
707 $ hg help revs
708 Specifying Single Revisions
708 Specifying Single Revisions
709 """""""""""""""""""""""""""
709 """""""""""""""""""""""""""
710
710
711 Mercurial supports several ways to specify individual revisions.
711 Mercurial supports several ways to specify individual revisions.
712
712
713 A plain integer is treated as a revision number. Negative integers are
713 A plain integer is treated as a revision number. Negative integers are
714 treated as sequential offsets from the tip, with -1 denoting the tip, -2
714 treated as sequential offsets from the tip, with -1 denoting the tip, -2
715 denoting the revision prior to the tip, and so forth.
715 denoting the revision prior to the tip, and so forth.
716
716
717 A 40-digit hexadecimal string is treated as a unique revision identifier.
717 A 40-digit hexadecimal string is treated as a unique revision identifier.
718
718
719 A hexadecimal string less than 40 characters long is treated as a unique
719 A hexadecimal string less than 40 characters long is treated as a unique
720 revision identifier and is referred to as a short-form identifier. A
720 revision identifier and is referred to as a short-form identifier. A
721 short-form identifier is only valid if it is the prefix of exactly one
721 short-form identifier is only valid if it is the prefix of exactly one
722 full-length identifier.
722 full-length identifier.
723
723
724 Any other string is treated as a bookmark, tag, or branch name. A bookmark
724 Any other string is treated as a bookmark, tag, or branch name. A bookmark
725 is a movable pointer to a revision. A tag is a permanent name associated
725 is a movable pointer to a revision. A tag is a permanent name associated
726 with a revision. A branch name denotes the tipmost revision of that
726 with a revision. A branch name denotes the tipmost revision of that
727 branch. Bookmark, tag, and branch names must not contain the ":"
727 branch. Bookmark, tag, and branch names must not contain the ":"
728 character.
728 character.
729
729
730 The reserved name "tip" always identifies the most recent revision.
730 The reserved name "tip" always identifies the most recent revision.
731
731
732 The reserved name "null" indicates the null revision. This is the revision
732 The reserved name "null" indicates the null revision. This is the revision
733 of an empty repository, and the parent of revision 0.
733 of an empty repository, and the parent of revision 0.
734
734
735 The reserved name "." indicates the working directory parent. If no
735 The reserved name "." indicates the working directory parent. If no
736 working directory is checked out, it is equivalent to null. If an
736 working directory is checked out, it is equivalent to null. If an
737 uncommitted merge is in progress, "." is the revision of the first parent.
737 uncommitted merge is in progress, "." is the revision of the first parent.
738
738
739 Test templating help
739 Test templating help
740
740
741 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
741 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
742 desc String. The text of the changeset description.
742 desc String. The text of the changeset description.
743 diffstat String. Statistics of changes with the following format:
743 diffstat String. Statistics of changes with the following format:
744 firstline Any text. Returns the first line of text.
744 firstline Any text. Returns the first line of text.
745 nonempty Any text. Returns '(none)' if the string is empty.
745 nonempty Any text. Returns '(none)' if the string is empty.
746
746
747 Test help hooks
747 Test help hooks
748
748
749 $ cat > helphook1.py <<EOF
749 $ cat > helphook1.py <<EOF
750 > from mercurial import help
750 > from mercurial import help
751 >
751 >
752 > def rewrite(topic, doc):
752 > def rewrite(topic, doc):
753 > return doc + '\nhelphook1\n'
753 > return doc + '\nhelphook1\n'
754 >
754 >
755 > def extsetup(ui):
755 > def extsetup(ui):
756 > help.addtopichook('revsets', rewrite)
756 > help.addtopichook('revsets', rewrite)
757 > EOF
757 > EOF
758 $ cat > helphook2.py <<EOF
758 $ cat > helphook2.py <<EOF
759 > from mercurial import help
759 > from mercurial import help
760 >
760 >
761 > def rewrite(topic, doc):
761 > def rewrite(topic, doc):
762 > return doc + '\nhelphook2\n'
762 > return doc + '\nhelphook2\n'
763 >
763 >
764 > def extsetup(ui):
764 > def extsetup(ui):
765 > help.addtopichook('revsets', rewrite)
765 > help.addtopichook('revsets', rewrite)
766 > EOF
766 > EOF
767 $ echo '[extensions]' >> $HGRCPATH
767 $ echo '[extensions]' >> $HGRCPATH
768 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
768 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
769 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
769 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
770 $ hg help revsets | grep helphook
770 $ hg help revsets | grep helphook
771 helphook1
771 helphook1
772 helphook2
772 helphook2
773
773
774 Test keyword search help
774 Test keyword search help
775
775
776 $ cat > prefixedname.py <<EOF
777 > '''matched against word "clone"
778 > '''
779 > EOF
780 $ echo '[extensions]' >> $HGRCPATH
781 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
776 $ hg help -k clone
782 $ hg help -k clone
777 Topics:
783 Topics:
778
784
779 config Configuration Files
785 config Configuration Files
780 extensions Using Additional Features
786 extensions Using Additional Features
781 glossary Glossary
787 glossary Glossary
782 phases Working with Phases
788 phases Working with Phases
783 subrepos Subrepositories
789 subrepos Subrepositories
784 urls URL Paths
790 urls URL Paths
785
791
786 Commands:
792 Commands:
787
793
788 bookmarks track a line of development with movable markers
794 bookmarks track a line of development with movable markers
789 clone make a copy of an existing repository
795 clone make a copy of an existing repository
790 paths show aliases for remote repositories
796 paths show aliases for remote repositories
791 update update working directory (or switch revisions)
797 update update working directory (or switch revisions)
792
798
793 Extensions:
799 Extensions:
794
800
801 prefixedname matched against word "clone"
795 relink recreates hardlinks between repository clones
802 relink recreates hardlinks between repository clones
796
803
797 Extension Commands:
804 Extension Commands:
798
805
799 qclone clone main and patch repository at same time
806 qclone clone main and patch repository at same time
800
807
801 Test omit indicating for help
808 Test omit indicating for help
802
809
803 $ cat > addverboseitems.py <<EOF
810 $ cat > addverboseitems.py <<EOF
804 > '''extension to test omit indicating.
811 > '''extension to test omit indicating.
805 >
812 >
806 > This paragraph is never omitted (for extension)
813 > This paragraph is never omitted (for extension)
807 >
814 >
808 > .. container:: verbose
815 > .. container:: verbose
809 >
816 >
810 > This paragraph is omitted,
817 > This paragraph is omitted,
811 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
818 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
812 >
819 >
813 > This paragraph is never omitted, too (for extension)
820 > This paragraph is never omitted, too (for extension)
814 > '''
821 > '''
815 >
822 >
816 > from mercurial import help, commands
823 > from mercurial import help, commands
817 > testtopic = """This paragraph is never omitted (for topic).
824 > testtopic = """This paragraph is never omitted (for topic).
818 >
825 >
819 > .. container:: verbose
826 > .. container:: verbose
820 >
827 >
821 > This paragraph is omitted,
828 > This paragraph is omitted,
822 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
829 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
823 >
830 >
824 > This paragraph is never omitted, too (for topic)
831 > This paragraph is never omitted, too (for topic)
825 > """
832 > """
826 > def extsetup(ui):
833 > def extsetup(ui):
827 > help.helptable.append((["topic-containing-verbose"],
834 > help.helptable.append((["topic-containing-verbose"],
828 > "This is the topic to test omit indicating.",
835 > "This is the topic to test omit indicating.",
829 > lambda : testtopic))
836 > lambda : testtopic))
830 > EOF
837 > EOF
831 $ echo '[extensions]' >> $HGRCPATH
838 $ echo '[extensions]' >> $HGRCPATH
832 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
839 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
833 $ hg help addverboseitems
840 $ hg help addverboseitems
834 addverboseitems extension - extension to test omit indicating.
841 addverboseitems extension - extension to test omit indicating.
835
842
836 This paragraph is never omitted (for extension)
843 This paragraph is never omitted (for extension)
837
844
838 This paragraph is never omitted, too (for extension)
845 This paragraph is never omitted, too (for extension)
839
846
840 use "hg help -v addverboseitems" to show more complete help
847 use "hg help -v addverboseitems" to show more complete help
841
848
842 no commands defined
849 no commands defined
843 $ hg help -v addverboseitems
850 $ hg help -v addverboseitems
844 addverboseitems extension - extension to test omit indicating.
851 addverboseitems extension - extension to test omit indicating.
845
852
846 This paragraph is never omitted (for extension)
853 This paragraph is never omitted (for extension)
847
854
848 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
855 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
849
856
850 This paragraph is never omitted, too (for extension)
857 This paragraph is never omitted, too (for extension)
851
858
852 no commands defined
859 no commands defined
853 $ hg help topic-containing-verbose
860 $ hg help topic-containing-verbose
854 This is the topic to test omit indicating.
861 This is the topic to test omit indicating.
855 """"""""""""""""""""""""""""""""""""""""""
862 """"""""""""""""""""""""""""""""""""""""""
856
863
857 This paragraph is never omitted (for topic).
864 This paragraph is never omitted (for topic).
858
865
859 This paragraph is never omitted, too (for topic)
866 This paragraph is never omitted, too (for topic)
860
867
861 use "hg help -v topic-containing-verbose" to show more complete help
868 use "hg help -v topic-containing-verbose" to show more complete help
862 $ hg help -v topic-containing-verbose
869 $ hg help -v topic-containing-verbose
863 This is the topic to test omit indicating.
870 This is the topic to test omit indicating.
864 """"""""""""""""""""""""""""""""""""""""""
871 """"""""""""""""""""""""""""""""""""""""""
865
872
866 This paragraph is never omitted (for topic).
873 This paragraph is never omitted (for topic).
867
874
868 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
875 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
869
876
870 This paragraph is never omitted, too (for topic)
877 This paragraph is never omitted, too (for topic)
871
878
872 Test usage of section marks in help documents
879 Test usage of section marks in help documents
873
880
874 $ cd "$TESTDIR"/../doc
881 $ cd "$TESTDIR"/../doc
875 $ python check-seclevel.py
882 $ python check-seclevel.py
876 $ cd $TESTTMP
883 $ cd $TESTTMP
877
884
878 #if serve
885 #if serve
879
886
880 Test the help pages in hgweb.
887 Test the help pages in hgweb.
881
888
882 Dish up an empty repo; serve it cold.
889 Dish up an empty repo; serve it cold.
883
890
884 $ hg init "$TESTTMP/test"
891 $ hg init "$TESTTMP/test"
885 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
892 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
886 $ cat hg.pid >> $DAEMON_PIDS
893 $ cat hg.pid >> $DAEMON_PIDS
887
894
888 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
895 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
889 200 Script output follows
896 200 Script output follows
890
897
891 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
898 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
892 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
899 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
893 <head>
900 <head>
894 <link rel="icon" href="/static/hgicon.png" type="image/png" />
901 <link rel="icon" href="/static/hgicon.png" type="image/png" />
895 <meta name="robots" content="index, nofollow" />
902 <meta name="robots" content="index, nofollow" />
896 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
903 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
897 <script type="text/javascript" src="/static/mercurial.js"></script>
904 <script type="text/javascript" src="/static/mercurial.js"></script>
898
905
899 <title>Help: Index</title>
906 <title>Help: Index</title>
900 </head>
907 </head>
901 <body>
908 <body>
902
909
903 <div class="container">
910 <div class="container">
904 <div class="menu">
911 <div class="menu">
905 <div class="logo">
912 <div class="logo">
906 <a href="http://mercurial.selenic.com/">
913 <a href="http://mercurial.selenic.com/">
907 <img src="/static/hglogo.png" alt="mercurial" /></a>
914 <img src="/static/hglogo.png" alt="mercurial" /></a>
908 </div>
915 </div>
909 <ul>
916 <ul>
910 <li><a href="/shortlog">log</a></li>
917 <li><a href="/shortlog">log</a></li>
911 <li><a href="/graph">graph</a></li>
918 <li><a href="/graph">graph</a></li>
912 <li><a href="/tags">tags</a></li>
919 <li><a href="/tags">tags</a></li>
913 <li><a href="/bookmarks">bookmarks</a></li>
920 <li><a href="/bookmarks">bookmarks</a></li>
914 <li><a href="/branches">branches</a></li>
921 <li><a href="/branches">branches</a></li>
915 </ul>
922 </ul>
916 <ul>
923 <ul>
917 <li class="active">help</li>
924 <li class="active">help</li>
918 </ul>
925 </ul>
919 </div>
926 </div>
920
927
921 <div class="main">
928 <div class="main">
922 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
929 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
923 <form class="search" action="/log">
930 <form class="search" action="/log">
924
931
925 <p><input name="rev" id="search1" type="text" size="30" /></p>
932 <p><input name="rev" id="search1" type="text" size="30" /></p>
926 <div id="hint">find changesets by author, revision,
933 <div id="hint">find changesets by author, revision,
927 files, or words in the commit message</div>
934 files, or words in the commit message</div>
928 </form>
935 </form>
929 <table class="bigtable">
936 <table class="bigtable">
930 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
937 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
931
938
932 <tr><td>
939 <tr><td>
933 <a href="/help/config">
940 <a href="/help/config">
934 config
941 config
935 </a>
942 </a>
936 </td><td>
943 </td><td>
937 Configuration Files
944 Configuration Files
938 </td></tr>
945 </td></tr>
939 <tr><td>
946 <tr><td>
940 <a href="/help/dates">
947 <a href="/help/dates">
941 dates
948 dates
942 </a>
949 </a>
943 </td><td>
950 </td><td>
944 Date Formats
951 Date Formats
945 </td></tr>
952 </td></tr>
946 <tr><td>
953 <tr><td>
947 <a href="/help/diffs">
954 <a href="/help/diffs">
948 diffs
955 diffs
949 </a>
956 </a>
950 </td><td>
957 </td><td>
951 Diff Formats
958 Diff Formats
952 </td></tr>
959 </td></tr>
953 <tr><td>
960 <tr><td>
954 <a href="/help/environment">
961 <a href="/help/environment">
955 environment
962 environment
956 </a>
963 </a>
957 </td><td>
964 </td><td>
958 Environment Variables
965 Environment Variables
959 </td></tr>
966 </td></tr>
960 <tr><td>
967 <tr><td>
961 <a href="/help/extensions">
968 <a href="/help/extensions">
962 extensions
969 extensions
963 </a>
970 </a>
964 </td><td>
971 </td><td>
965 Using Additional Features
972 Using Additional Features
966 </td></tr>
973 </td></tr>
967 <tr><td>
974 <tr><td>
968 <a href="/help/filesets">
975 <a href="/help/filesets">
969 filesets
976 filesets
970 </a>
977 </a>
971 </td><td>
978 </td><td>
972 Specifying File Sets
979 Specifying File Sets
973 </td></tr>
980 </td></tr>
974 <tr><td>
981 <tr><td>
975 <a href="/help/glossary">
982 <a href="/help/glossary">
976 glossary
983 glossary
977 </a>
984 </a>
978 </td><td>
985 </td><td>
979 Glossary
986 Glossary
980 </td></tr>
987 </td></tr>
981 <tr><td>
988 <tr><td>
982 <a href="/help/hgignore">
989 <a href="/help/hgignore">
983 hgignore
990 hgignore
984 </a>
991 </a>
985 </td><td>
992 </td><td>
986 Syntax for Mercurial Ignore Files
993 Syntax for Mercurial Ignore Files
987 </td></tr>
994 </td></tr>
988 <tr><td>
995 <tr><td>
989 <a href="/help/hgweb">
996 <a href="/help/hgweb">
990 hgweb
997 hgweb
991 </a>
998 </a>
992 </td><td>
999 </td><td>
993 Configuring hgweb
1000 Configuring hgweb
994 </td></tr>
1001 </td></tr>
995 <tr><td>
1002 <tr><td>
996 <a href="/help/merge-tools">
1003 <a href="/help/merge-tools">
997 merge-tools
1004 merge-tools
998 </a>
1005 </a>
999 </td><td>
1006 </td><td>
1000 Merge Tools
1007 Merge Tools
1001 </td></tr>
1008 </td></tr>
1002 <tr><td>
1009 <tr><td>
1003 <a href="/help/multirevs">
1010 <a href="/help/multirevs">
1004 multirevs
1011 multirevs
1005 </a>
1012 </a>
1006 </td><td>
1013 </td><td>
1007 Specifying Multiple Revisions
1014 Specifying Multiple Revisions
1008 </td></tr>
1015 </td></tr>
1009 <tr><td>
1016 <tr><td>
1010 <a href="/help/patterns">
1017 <a href="/help/patterns">
1011 patterns
1018 patterns
1012 </a>
1019 </a>
1013 </td><td>
1020 </td><td>
1014 File Name Patterns
1021 File Name Patterns
1015 </td></tr>
1022 </td></tr>
1016 <tr><td>
1023 <tr><td>
1017 <a href="/help/phases">
1024 <a href="/help/phases">
1018 phases
1025 phases
1019 </a>
1026 </a>
1020 </td><td>
1027 </td><td>
1021 Working with Phases
1028 Working with Phases
1022 </td></tr>
1029 </td></tr>
1023 <tr><td>
1030 <tr><td>
1024 <a href="/help/revisions">
1031 <a href="/help/revisions">
1025 revisions
1032 revisions
1026 </a>
1033 </a>
1027 </td><td>
1034 </td><td>
1028 Specifying Single Revisions
1035 Specifying Single Revisions
1029 </td></tr>
1036 </td></tr>
1030 <tr><td>
1037 <tr><td>
1031 <a href="/help/revsets">
1038 <a href="/help/revsets">
1032 revsets
1039 revsets
1033 </a>
1040 </a>
1034 </td><td>
1041 </td><td>
1035 Specifying Revision Sets
1042 Specifying Revision Sets
1036 </td></tr>
1043 </td></tr>
1037 <tr><td>
1044 <tr><td>
1038 <a href="/help/subrepos">
1045 <a href="/help/subrepos">
1039 subrepos
1046 subrepos
1040 </a>
1047 </a>
1041 </td><td>
1048 </td><td>
1042 Subrepositories
1049 Subrepositories
1043 </td></tr>
1050 </td></tr>
1044 <tr><td>
1051 <tr><td>
1045 <a href="/help/templating">
1052 <a href="/help/templating">
1046 templating
1053 templating
1047 </a>
1054 </a>
1048 </td><td>
1055 </td><td>
1049 Template Usage
1056 Template Usage
1050 </td></tr>
1057 </td></tr>
1051 <tr><td>
1058 <tr><td>
1052 <a href="/help/urls">
1059 <a href="/help/urls">
1053 urls
1060 urls
1054 </a>
1061 </a>
1055 </td><td>
1062 </td><td>
1056 URL Paths
1063 URL Paths
1057 </td></tr>
1064 </td></tr>
1058 <tr><td>
1065 <tr><td>
1059 <a href="/help/topic-containing-verbose">
1066 <a href="/help/topic-containing-verbose">
1060 topic-containing-verbose
1067 topic-containing-verbose
1061 </a>
1068 </a>
1062 </td><td>
1069 </td><td>
1063 This is the topic to test omit indicating.
1070 This is the topic to test omit indicating.
1064 </td></tr>
1071 </td></tr>
1065
1072
1066 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1073 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1067
1074
1068 <tr><td>
1075 <tr><td>
1069 <a href="/help/add">
1076 <a href="/help/add">
1070 add
1077 add
1071 </a>
1078 </a>
1072 </td><td>
1079 </td><td>
1073 add the specified files on the next commit
1080 add the specified files on the next commit
1074 </td></tr>
1081 </td></tr>
1075 <tr><td>
1082 <tr><td>
1076 <a href="/help/annotate">
1083 <a href="/help/annotate">
1077 annotate
1084 annotate
1078 </a>
1085 </a>
1079 </td><td>
1086 </td><td>
1080 show changeset information by line for each file
1087 show changeset information by line for each file
1081 </td></tr>
1088 </td></tr>
1082 <tr><td>
1089 <tr><td>
1083 <a href="/help/clone">
1090 <a href="/help/clone">
1084 clone
1091 clone
1085 </a>
1092 </a>
1086 </td><td>
1093 </td><td>
1087 make a copy of an existing repository
1094 make a copy of an existing repository
1088 </td></tr>
1095 </td></tr>
1089 <tr><td>
1096 <tr><td>
1090 <a href="/help/commit">
1097 <a href="/help/commit">
1091 commit
1098 commit
1092 </a>
1099 </a>
1093 </td><td>
1100 </td><td>
1094 commit the specified files or all outstanding changes
1101 commit the specified files or all outstanding changes
1095 </td></tr>
1102 </td></tr>
1096 <tr><td>
1103 <tr><td>
1097 <a href="/help/diff">
1104 <a href="/help/diff">
1098 diff
1105 diff
1099 </a>
1106 </a>
1100 </td><td>
1107 </td><td>
1101 diff repository (or selected files)
1108 diff repository (or selected files)
1102 </td></tr>
1109 </td></tr>
1103 <tr><td>
1110 <tr><td>
1104 <a href="/help/export">
1111 <a href="/help/export">
1105 export
1112 export
1106 </a>
1113 </a>
1107 </td><td>
1114 </td><td>
1108 dump the header and diffs for one or more changesets
1115 dump the header and diffs for one or more changesets
1109 </td></tr>
1116 </td></tr>
1110 <tr><td>
1117 <tr><td>
1111 <a href="/help/forget">
1118 <a href="/help/forget">
1112 forget
1119 forget
1113 </a>
1120 </a>
1114 </td><td>
1121 </td><td>
1115 forget the specified files on the next commit
1122 forget the specified files on the next commit
1116 </td></tr>
1123 </td></tr>
1117 <tr><td>
1124 <tr><td>
1118 <a href="/help/init">
1125 <a href="/help/init">
1119 init
1126 init
1120 </a>
1127 </a>
1121 </td><td>
1128 </td><td>
1122 create a new repository in the given directory
1129 create a new repository in the given directory
1123 </td></tr>
1130 </td></tr>
1124 <tr><td>
1131 <tr><td>
1125 <a href="/help/log">
1132 <a href="/help/log">
1126 log
1133 log
1127 </a>
1134 </a>
1128 </td><td>
1135 </td><td>
1129 show revision history of entire repository or files
1136 show revision history of entire repository or files
1130 </td></tr>
1137 </td></tr>
1131 <tr><td>
1138 <tr><td>
1132 <a href="/help/merge">
1139 <a href="/help/merge">
1133 merge
1140 merge
1134 </a>
1141 </a>
1135 </td><td>
1142 </td><td>
1136 merge working directory with another revision
1143 merge working directory with another revision
1137 </td></tr>
1144 </td></tr>
1138 <tr><td>
1145 <tr><td>
1139 <a href="/help/pull">
1146 <a href="/help/pull">
1140 pull
1147 pull
1141 </a>
1148 </a>
1142 </td><td>
1149 </td><td>
1143 pull changes from the specified source
1150 pull changes from the specified source
1144 </td></tr>
1151 </td></tr>
1145 <tr><td>
1152 <tr><td>
1146 <a href="/help/push">
1153 <a href="/help/push">
1147 push
1154 push
1148 </a>
1155 </a>
1149 </td><td>
1156 </td><td>
1150 push changes to the specified destination
1157 push changes to the specified destination
1151 </td></tr>
1158 </td></tr>
1152 <tr><td>
1159 <tr><td>
1153 <a href="/help/remove">
1160 <a href="/help/remove">
1154 remove
1161 remove
1155 </a>
1162 </a>
1156 </td><td>
1163 </td><td>
1157 remove the specified files on the next commit
1164 remove the specified files on the next commit
1158 </td></tr>
1165 </td></tr>
1159 <tr><td>
1166 <tr><td>
1160 <a href="/help/serve">
1167 <a href="/help/serve">
1161 serve
1168 serve
1162 </a>
1169 </a>
1163 </td><td>
1170 </td><td>
1164 start stand-alone webserver
1171 start stand-alone webserver
1165 </td></tr>
1172 </td></tr>
1166 <tr><td>
1173 <tr><td>
1167 <a href="/help/status">
1174 <a href="/help/status">
1168 status
1175 status
1169 </a>
1176 </a>
1170 </td><td>
1177 </td><td>
1171 show changed files in the working directory
1178 show changed files in the working directory
1172 </td></tr>
1179 </td></tr>
1173 <tr><td>
1180 <tr><td>
1174 <a href="/help/summary">
1181 <a href="/help/summary">
1175 summary
1182 summary
1176 </a>
1183 </a>
1177 </td><td>
1184 </td><td>
1178 summarize working directory state
1185 summarize working directory state
1179 </td></tr>
1186 </td></tr>
1180 <tr><td>
1187 <tr><td>
1181 <a href="/help/update">
1188 <a href="/help/update">
1182 update
1189 update
1183 </a>
1190 </a>
1184 </td><td>
1191 </td><td>
1185 update working directory (or switch revisions)
1192 update working directory (or switch revisions)
1186 </td></tr>
1193 </td></tr>
1187
1194
1188 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1195 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1189
1196
1190 <tr><td>
1197 <tr><td>
1191 <a href="/help/addremove">
1198 <a href="/help/addremove">
1192 addremove
1199 addremove
1193 </a>
1200 </a>
1194 </td><td>
1201 </td><td>
1195 add all new files, delete all missing files
1202 add all new files, delete all missing files
1196 </td></tr>
1203 </td></tr>
1197 <tr><td>
1204 <tr><td>
1198 <a href="/help/archive">
1205 <a href="/help/archive">
1199 archive
1206 archive
1200 </a>
1207 </a>
1201 </td><td>
1208 </td><td>
1202 create an unversioned archive of a repository revision
1209 create an unversioned archive of a repository revision
1203 </td></tr>
1210 </td></tr>
1204 <tr><td>
1211 <tr><td>
1205 <a href="/help/backout">
1212 <a href="/help/backout">
1206 backout
1213 backout
1207 </a>
1214 </a>
1208 </td><td>
1215 </td><td>
1209 reverse effect of earlier changeset
1216 reverse effect of earlier changeset
1210 </td></tr>
1217 </td></tr>
1211 <tr><td>
1218 <tr><td>
1212 <a href="/help/bisect">
1219 <a href="/help/bisect">
1213 bisect
1220 bisect
1214 </a>
1221 </a>
1215 </td><td>
1222 </td><td>
1216 subdivision search of changesets
1223 subdivision search of changesets
1217 </td></tr>
1224 </td></tr>
1218 <tr><td>
1225 <tr><td>
1219 <a href="/help/bookmarks">
1226 <a href="/help/bookmarks">
1220 bookmarks
1227 bookmarks
1221 </a>
1228 </a>
1222 </td><td>
1229 </td><td>
1223 track a line of development with movable markers
1230 track a line of development with movable markers
1224 </td></tr>
1231 </td></tr>
1225 <tr><td>
1232 <tr><td>
1226 <a href="/help/branch">
1233 <a href="/help/branch">
1227 branch
1234 branch
1228 </a>
1235 </a>
1229 </td><td>
1236 </td><td>
1230 set or show the current branch name
1237 set or show the current branch name
1231 </td></tr>
1238 </td></tr>
1232 <tr><td>
1239 <tr><td>
1233 <a href="/help/branches">
1240 <a href="/help/branches">
1234 branches
1241 branches
1235 </a>
1242 </a>
1236 </td><td>
1243 </td><td>
1237 list repository named branches
1244 list repository named branches
1238 </td></tr>
1245 </td></tr>
1239 <tr><td>
1246 <tr><td>
1240 <a href="/help/bundle">
1247 <a href="/help/bundle">
1241 bundle
1248 bundle
1242 </a>
1249 </a>
1243 </td><td>
1250 </td><td>
1244 create a changegroup file
1251 create a changegroup file
1245 </td></tr>
1252 </td></tr>
1246 <tr><td>
1253 <tr><td>
1247 <a href="/help/cat">
1254 <a href="/help/cat">
1248 cat
1255 cat
1249 </a>
1256 </a>
1250 </td><td>
1257 </td><td>
1251 output the current or given revision of files
1258 output the current or given revision of files
1252 </td></tr>
1259 </td></tr>
1253 <tr><td>
1260 <tr><td>
1254 <a href="/help/copy">
1261 <a href="/help/copy">
1255 copy
1262 copy
1256 </a>
1263 </a>
1257 </td><td>
1264 </td><td>
1258 mark files as copied for the next commit
1265 mark files as copied for the next commit
1259 </td></tr>
1266 </td></tr>
1260 <tr><td>
1267 <tr><td>
1261 <a href="/help/graft">
1268 <a href="/help/graft">
1262 graft
1269 graft
1263 </a>
1270 </a>
1264 </td><td>
1271 </td><td>
1265 copy changes from other branches onto the current branch
1272 copy changes from other branches onto the current branch
1266 </td></tr>
1273 </td></tr>
1267 <tr><td>
1274 <tr><td>
1268 <a href="/help/grep">
1275 <a href="/help/grep">
1269 grep
1276 grep
1270 </a>
1277 </a>
1271 </td><td>
1278 </td><td>
1272 search for a pattern in specified files and revisions
1279 search for a pattern in specified files and revisions
1273 </td></tr>
1280 </td></tr>
1274 <tr><td>
1281 <tr><td>
1275 <a href="/help/heads">
1282 <a href="/help/heads">
1276 heads
1283 heads
1277 </a>
1284 </a>
1278 </td><td>
1285 </td><td>
1279 show branch heads
1286 show branch heads
1280 </td></tr>
1287 </td></tr>
1281 <tr><td>
1288 <tr><td>
1282 <a href="/help/help">
1289 <a href="/help/help">
1283 help
1290 help
1284 </a>
1291 </a>
1285 </td><td>
1292 </td><td>
1286 show help for a given topic or a help overview
1293 show help for a given topic or a help overview
1287 </td></tr>
1294 </td></tr>
1288 <tr><td>
1295 <tr><td>
1289 <a href="/help/identify">
1296 <a href="/help/identify">
1290 identify
1297 identify
1291 </a>
1298 </a>
1292 </td><td>
1299 </td><td>
1293 identify the working copy or specified revision
1300 identify the working copy or specified revision
1294 </td></tr>
1301 </td></tr>
1295 <tr><td>
1302 <tr><td>
1296 <a href="/help/import">
1303 <a href="/help/import">
1297 import
1304 import
1298 </a>
1305 </a>
1299 </td><td>
1306 </td><td>
1300 import an ordered set of patches
1307 import an ordered set of patches
1301 </td></tr>
1308 </td></tr>
1302 <tr><td>
1309 <tr><td>
1303 <a href="/help/incoming">
1310 <a href="/help/incoming">
1304 incoming
1311 incoming
1305 </a>
1312 </a>
1306 </td><td>
1313 </td><td>
1307 show new changesets found in source
1314 show new changesets found in source
1308 </td></tr>
1315 </td></tr>
1309 <tr><td>
1316 <tr><td>
1310 <a href="/help/locate">
1317 <a href="/help/locate">
1311 locate
1318 locate
1312 </a>
1319 </a>
1313 </td><td>
1320 </td><td>
1314 locate files matching specific patterns
1321 locate files matching specific patterns
1315 </td></tr>
1322 </td></tr>
1316 <tr><td>
1323 <tr><td>
1317 <a href="/help/manifest">
1324 <a href="/help/manifest">
1318 manifest
1325 manifest
1319 </a>
1326 </a>
1320 </td><td>
1327 </td><td>
1321 output the current or given revision of the project manifest
1328 output the current or given revision of the project manifest
1322 </td></tr>
1329 </td></tr>
1323 <tr><td>
1330 <tr><td>
1324 <a href="/help/nohelp">
1331 <a href="/help/nohelp">
1325 nohelp
1332 nohelp
1326 </a>
1333 </a>
1327 </td><td>
1334 </td><td>
1328 (no help text available)
1335 (no help text available)
1329 </td></tr>
1336 </td></tr>
1330 <tr><td>
1337 <tr><td>
1331 <a href="/help/outgoing">
1338 <a href="/help/outgoing">
1332 outgoing
1339 outgoing
1333 </a>
1340 </a>
1334 </td><td>
1341 </td><td>
1335 show changesets not found in the destination
1342 show changesets not found in the destination
1336 </td></tr>
1343 </td></tr>
1337 <tr><td>
1344 <tr><td>
1338 <a href="/help/parents">
1345 <a href="/help/parents">
1339 parents
1346 parents
1340 </a>
1347 </a>
1341 </td><td>
1348 </td><td>
1342 show the parents of the working directory or revision
1349 show the parents of the working directory or revision
1343 </td></tr>
1350 </td></tr>
1344 <tr><td>
1351 <tr><td>
1345 <a href="/help/paths">
1352 <a href="/help/paths">
1346 paths
1353 paths
1347 </a>
1354 </a>
1348 </td><td>
1355 </td><td>
1349 show aliases for remote repositories
1356 show aliases for remote repositories
1350 </td></tr>
1357 </td></tr>
1351 <tr><td>
1358 <tr><td>
1352 <a href="/help/phase">
1359 <a href="/help/phase">
1353 phase
1360 phase
1354 </a>
1361 </a>
1355 </td><td>
1362 </td><td>
1356 set or show the current phase name
1363 set or show the current phase name
1357 </td></tr>
1364 </td></tr>
1358 <tr><td>
1365 <tr><td>
1359 <a href="/help/recover">
1366 <a href="/help/recover">
1360 recover
1367 recover
1361 </a>
1368 </a>
1362 </td><td>
1369 </td><td>
1363 roll back an interrupted transaction
1370 roll back an interrupted transaction
1364 </td></tr>
1371 </td></tr>
1365 <tr><td>
1372 <tr><td>
1366 <a href="/help/rename">
1373 <a href="/help/rename">
1367 rename
1374 rename
1368 </a>
1375 </a>
1369 </td><td>
1376 </td><td>
1370 rename files; equivalent of copy + remove
1377 rename files; equivalent of copy + remove
1371 </td></tr>
1378 </td></tr>
1372 <tr><td>
1379 <tr><td>
1373 <a href="/help/resolve">
1380 <a href="/help/resolve">
1374 resolve
1381 resolve
1375 </a>
1382 </a>
1376 </td><td>
1383 </td><td>
1377 redo merges or set/view the merge status of files
1384 redo merges or set/view the merge status of files
1378 </td></tr>
1385 </td></tr>
1379 <tr><td>
1386 <tr><td>
1380 <a href="/help/revert">
1387 <a href="/help/revert">
1381 revert
1388 revert
1382 </a>
1389 </a>
1383 </td><td>
1390 </td><td>
1384 restore files to their checkout state
1391 restore files to their checkout state
1385 </td></tr>
1392 </td></tr>
1386 <tr><td>
1393 <tr><td>
1387 <a href="/help/root">
1394 <a href="/help/root">
1388 root
1395 root
1389 </a>
1396 </a>
1390 </td><td>
1397 </td><td>
1391 print the root (top) of the current working directory
1398 print the root (top) of the current working directory
1392 </td></tr>
1399 </td></tr>
1393 <tr><td>
1400 <tr><td>
1394 <a href="/help/showconfig">
1401 <a href="/help/showconfig">
1395 showconfig
1402 showconfig
1396 </a>
1403 </a>
1397 </td><td>
1404 </td><td>
1398 show combined config settings from all hgrc files
1405 show combined config settings from all hgrc files
1399 </td></tr>
1406 </td></tr>
1400 <tr><td>
1407 <tr><td>
1401 <a href="/help/tag">
1408 <a href="/help/tag">
1402 tag
1409 tag
1403 </a>
1410 </a>
1404 </td><td>
1411 </td><td>
1405 add one or more tags for the current or given revision
1412 add one or more tags for the current or given revision
1406 </td></tr>
1413 </td></tr>
1407 <tr><td>
1414 <tr><td>
1408 <a href="/help/tags">
1415 <a href="/help/tags">
1409 tags
1416 tags
1410 </a>
1417 </a>
1411 </td><td>
1418 </td><td>
1412 list repository tags
1419 list repository tags
1413 </td></tr>
1420 </td></tr>
1414 <tr><td>
1421 <tr><td>
1415 <a href="/help/unbundle">
1422 <a href="/help/unbundle">
1416 unbundle
1423 unbundle
1417 </a>
1424 </a>
1418 </td><td>
1425 </td><td>
1419 apply one or more changegroup files
1426 apply one or more changegroup files
1420 </td></tr>
1427 </td></tr>
1421 <tr><td>
1428 <tr><td>
1422 <a href="/help/verify">
1429 <a href="/help/verify">
1423 verify
1430 verify
1424 </a>
1431 </a>
1425 </td><td>
1432 </td><td>
1426 verify the integrity of the repository
1433 verify the integrity of the repository
1427 </td></tr>
1434 </td></tr>
1428 <tr><td>
1435 <tr><td>
1429 <a href="/help/version">
1436 <a href="/help/version">
1430 version
1437 version
1431 </a>
1438 </a>
1432 </td><td>
1439 </td><td>
1433 output version and copyright information
1440 output version and copyright information
1434 </td></tr>
1441 </td></tr>
1435 </table>
1442 </table>
1436 </div>
1443 </div>
1437 </div>
1444 </div>
1438
1445
1439 <script type="text/javascript">process_dates()</script>
1446 <script type="text/javascript">process_dates()</script>
1440
1447
1441
1448
1442 </body>
1449 </body>
1443 </html>
1450 </html>
1444
1451
1445
1452
1446 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1453 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1447 200 Script output follows
1454 200 Script output follows
1448
1455
1449 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1456 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1450 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1457 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1451 <head>
1458 <head>
1452 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1459 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1453 <meta name="robots" content="index, nofollow" />
1460 <meta name="robots" content="index, nofollow" />
1454 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1461 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1455 <script type="text/javascript" src="/static/mercurial.js"></script>
1462 <script type="text/javascript" src="/static/mercurial.js"></script>
1456
1463
1457 <title>Help: add</title>
1464 <title>Help: add</title>
1458 </head>
1465 </head>
1459 <body>
1466 <body>
1460
1467
1461 <div class="container">
1468 <div class="container">
1462 <div class="menu">
1469 <div class="menu">
1463 <div class="logo">
1470 <div class="logo">
1464 <a href="http://mercurial.selenic.com/">
1471 <a href="http://mercurial.selenic.com/">
1465 <img src="/static/hglogo.png" alt="mercurial" /></a>
1472 <img src="/static/hglogo.png" alt="mercurial" /></a>
1466 </div>
1473 </div>
1467 <ul>
1474 <ul>
1468 <li><a href="/shortlog">log</a></li>
1475 <li><a href="/shortlog">log</a></li>
1469 <li><a href="/graph">graph</a></li>
1476 <li><a href="/graph">graph</a></li>
1470 <li><a href="/tags">tags</a></li>
1477 <li><a href="/tags">tags</a></li>
1471 <li><a href="/bookmarks">bookmarks</a></li>
1478 <li><a href="/bookmarks">bookmarks</a></li>
1472 <li><a href="/branches">branches</a></li>
1479 <li><a href="/branches">branches</a></li>
1473 </ul>
1480 </ul>
1474 <ul>
1481 <ul>
1475 <li class="active"><a href="/help">help</a></li>
1482 <li class="active"><a href="/help">help</a></li>
1476 </ul>
1483 </ul>
1477 </div>
1484 </div>
1478
1485
1479 <div class="main">
1486 <div class="main">
1480 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1487 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1481 <h3>Help: add</h3>
1488 <h3>Help: add</h3>
1482
1489
1483 <form class="search" action="/log">
1490 <form class="search" action="/log">
1484
1491
1485 <p><input name="rev" id="search1" type="text" size="30" /></p>
1492 <p><input name="rev" id="search1" type="text" size="30" /></p>
1486 <div id="hint">find changesets by author, revision,
1493 <div id="hint">find changesets by author, revision,
1487 files, or words in the commit message</div>
1494 files, or words in the commit message</div>
1488 </form>
1495 </form>
1489 <div id="doc">
1496 <div id="doc">
1490 <p>
1497 <p>
1491 hg add [OPTION]... [FILE]...
1498 hg add [OPTION]... [FILE]...
1492 </p>
1499 </p>
1493 <p>
1500 <p>
1494 add the specified files on the next commit
1501 add the specified files on the next commit
1495 </p>
1502 </p>
1496 <p>
1503 <p>
1497 Schedule files to be version controlled and added to the
1504 Schedule files to be version controlled and added to the
1498 repository.
1505 repository.
1499 </p>
1506 </p>
1500 <p>
1507 <p>
1501 The files will be added to the repository at the next commit. To
1508 The files will be added to the repository at the next commit. To
1502 undo an add before that, see &quot;hg forget&quot;.
1509 undo an add before that, see &quot;hg forget&quot;.
1503 </p>
1510 </p>
1504 <p>
1511 <p>
1505 If no names are given, add all files to the repository.
1512 If no names are given, add all files to the repository.
1506 </p>
1513 </p>
1507 <p>
1514 <p>
1508 An example showing how new (unknown) files are added
1515 An example showing how new (unknown) files are added
1509 automatically by &quot;hg add&quot;:
1516 automatically by &quot;hg add&quot;:
1510 </p>
1517 </p>
1511 <pre>
1518 <pre>
1512 \$ ls (re)
1519 \$ ls (re)
1513 foo.c
1520 foo.c
1514 \$ hg status (re)
1521 \$ hg status (re)
1515 ? foo.c
1522 ? foo.c
1516 \$ hg add (re)
1523 \$ hg add (re)
1517 adding foo.c
1524 adding foo.c
1518 \$ hg status (re)
1525 \$ hg status (re)
1519 A foo.c
1526 A foo.c
1520 </pre>
1527 </pre>
1521 <p>
1528 <p>
1522 Returns 0 if all files are successfully added.
1529 Returns 0 if all files are successfully added.
1523 </p>
1530 </p>
1524 <p>
1531 <p>
1525 options:
1532 options:
1526 </p>
1533 </p>
1527 <table>
1534 <table>
1528 <tr><td>-I</td>
1535 <tr><td>-I</td>
1529 <td>--include PATTERN [+]</td>
1536 <td>--include PATTERN [+]</td>
1530 <td>include names matching the given patterns</td></tr>
1537 <td>include names matching the given patterns</td></tr>
1531 <tr><td>-X</td>
1538 <tr><td>-X</td>
1532 <td>--exclude PATTERN [+]</td>
1539 <td>--exclude PATTERN [+]</td>
1533 <td>exclude names matching the given patterns</td></tr>
1540 <td>exclude names matching the given patterns</td></tr>
1534 <tr><td>-S</td>
1541 <tr><td>-S</td>
1535 <td>--subrepos</td>
1542 <td>--subrepos</td>
1536 <td>recurse into subrepositories</td></tr>
1543 <td>recurse into subrepositories</td></tr>
1537 <tr><td>-n</td>
1544 <tr><td>-n</td>
1538 <td>--dry-run</td>
1545 <td>--dry-run</td>
1539 <td>do not perform actions, just print output</td></tr>
1546 <td>do not perform actions, just print output</td></tr>
1540 </table>
1547 </table>
1541 <p>
1548 <p>
1542 [+] marked option can be specified multiple times
1549 [+] marked option can be specified multiple times
1543 </p>
1550 </p>
1544 <p>
1551 <p>
1545 global options:
1552 global options:
1546 </p>
1553 </p>
1547 <table>
1554 <table>
1548 <tr><td>-R</td>
1555 <tr><td>-R</td>
1549 <td>--repository REPO</td>
1556 <td>--repository REPO</td>
1550 <td>repository root directory or name of overlay bundle file</td></tr>
1557 <td>repository root directory or name of overlay bundle file</td></tr>
1551 <tr><td></td>
1558 <tr><td></td>
1552 <td>--cwd DIR</td>
1559 <td>--cwd DIR</td>
1553 <td>change working directory</td></tr>
1560 <td>change working directory</td></tr>
1554 <tr><td>-y</td>
1561 <tr><td>-y</td>
1555 <td>--noninteractive</td>
1562 <td>--noninteractive</td>
1556 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1563 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1557 <tr><td>-q</td>
1564 <tr><td>-q</td>
1558 <td>--quiet</td>
1565 <td>--quiet</td>
1559 <td>suppress output</td></tr>
1566 <td>suppress output</td></tr>
1560 <tr><td>-v</td>
1567 <tr><td>-v</td>
1561 <td>--verbose</td>
1568 <td>--verbose</td>
1562 <td>enable additional output</td></tr>
1569 <td>enable additional output</td></tr>
1563 <tr><td></td>
1570 <tr><td></td>
1564 <td>--config CONFIG [+]</td>
1571 <td>--config CONFIG [+]</td>
1565 <td>set/override config option (use 'section.name=value')</td></tr>
1572 <td>set/override config option (use 'section.name=value')</td></tr>
1566 <tr><td></td>
1573 <tr><td></td>
1567 <td>--debug</td>
1574 <td>--debug</td>
1568 <td>enable debugging output</td></tr>
1575 <td>enable debugging output</td></tr>
1569 <tr><td></td>
1576 <tr><td></td>
1570 <td>--debugger</td>
1577 <td>--debugger</td>
1571 <td>start debugger</td></tr>
1578 <td>start debugger</td></tr>
1572 <tr><td></td>
1579 <tr><td></td>
1573 <td>--encoding ENCODE</td>
1580 <td>--encoding ENCODE</td>
1574 <td>set the charset encoding (default: ascii)</td></tr>
1581 <td>set the charset encoding (default: ascii)</td></tr>
1575 <tr><td></td>
1582 <tr><td></td>
1576 <td>--encodingmode MODE</td>
1583 <td>--encodingmode MODE</td>
1577 <td>set the charset encoding mode (default: strict)</td></tr>
1584 <td>set the charset encoding mode (default: strict)</td></tr>
1578 <tr><td></td>
1585 <tr><td></td>
1579 <td>--traceback</td>
1586 <td>--traceback</td>
1580 <td>always print a traceback on exception</td></tr>
1587 <td>always print a traceback on exception</td></tr>
1581 <tr><td></td>
1588 <tr><td></td>
1582 <td>--time</td>
1589 <td>--time</td>
1583 <td>time how long the command takes</td></tr>
1590 <td>time how long the command takes</td></tr>
1584 <tr><td></td>
1591 <tr><td></td>
1585 <td>--profile</td>
1592 <td>--profile</td>
1586 <td>print command execution profile</td></tr>
1593 <td>print command execution profile</td></tr>
1587 <tr><td></td>
1594 <tr><td></td>
1588 <td>--version</td>
1595 <td>--version</td>
1589 <td>output version information and exit</td></tr>
1596 <td>output version information and exit</td></tr>
1590 <tr><td>-h</td>
1597 <tr><td>-h</td>
1591 <td>--help</td>
1598 <td>--help</td>
1592 <td>display help and exit</td></tr>
1599 <td>display help and exit</td></tr>
1593 <tr><td></td>
1600 <tr><td></td>
1594 <td>--hidden</td>
1601 <td>--hidden</td>
1595 <td>consider hidden changesets</td></tr>
1602 <td>consider hidden changesets</td></tr>
1596 </table>
1603 </table>
1597 <p>
1604 <p>
1598 [+] marked option can be specified multiple times
1605 [+] marked option can be specified multiple times
1599 </p>
1606 </p>
1600
1607
1601 </div>
1608 </div>
1602 </div>
1609 </div>
1603 </div>
1610 </div>
1604
1611
1605 <script type="text/javascript">process_dates()</script>
1612 <script type="text/javascript">process_dates()</script>
1606
1613
1607
1614
1608 </body>
1615 </body>
1609 </html>
1616 </html>
1610
1617
1611
1618
1612 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1619 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1613 200 Script output follows
1620 200 Script output follows
1614
1621
1615 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1622 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1616 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1623 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1617 <head>
1624 <head>
1618 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1625 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1619 <meta name="robots" content="index, nofollow" />
1626 <meta name="robots" content="index, nofollow" />
1620 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1627 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1621 <script type="text/javascript" src="/static/mercurial.js"></script>
1628 <script type="text/javascript" src="/static/mercurial.js"></script>
1622
1629
1623 <title>Help: remove</title>
1630 <title>Help: remove</title>
1624 </head>
1631 </head>
1625 <body>
1632 <body>
1626
1633
1627 <div class="container">
1634 <div class="container">
1628 <div class="menu">
1635 <div class="menu">
1629 <div class="logo">
1636 <div class="logo">
1630 <a href="http://mercurial.selenic.com/">
1637 <a href="http://mercurial.selenic.com/">
1631 <img src="/static/hglogo.png" alt="mercurial" /></a>
1638 <img src="/static/hglogo.png" alt="mercurial" /></a>
1632 </div>
1639 </div>
1633 <ul>
1640 <ul>
1634 <li><a href="/shortlog">log</a></li>
1641 <li><a href="/shortlog">log</a></li>
1635 <li><a href="/graph">graph</a></li>
1642 <li><a href="/graph">graph</a></li>
1636 <li><a href="/tags">tags</a></li>
1643 <li><a href="/tags">tags</a></li>
1637 <li><a href="/bookmarks">bookmarks</a></li>
1644 <li><a href="/bookmarks">bookmarks</a></li>
1638 <li><a href="/branches">branches</a></li>
1645 <li><a href="/branches">branches</a></li>
1639 </ul>
1646 </ul>
1640 <ul>
1647 <ul>
1641 <li class="active"><a href="/help">help</a></li>
1648 <li class="active"><a href="/help">help</a></li>
1642 </ul>
1649 </ul>
1643 </div>
1650 </div>
1644
1651
1645 <div class="main">
1652 <div class="main">
1646 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1653 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1647 <h3>Help: remove</h3>
1654 <h3>Help: remove</h3>
1648
1655
1649 <form class="search" action="/log">
1656 <form class="search" action="/log">
1650
1657
1651 <p><input name="rev" id="search1" type="text" size="30" /></p>
1658 <p><input name="rev" id="search1" type="text" size="30" /></p>
1652 <div id="hint">find changesets by author, revision,
1659 <div id="hint">find changesets by author, revision,
1653 files, or words in the commit message</div>
1660 files, or words in the commit message</div>
1654 </form>
1661 </form>
1655 <div id="doc">
1662 <div id="doc">
1656 <p>
1663 <p>
1657 hg remove [OPTION]... FILE...
1664 hg remove [OPTION]... FILE...
1658 </p>
1665 </p>
1659 <p>
1666 <p>
1660 aliases: rm
1667 aliases: rm
1661 </p>
1668 </p>
1662 <p>
1669 <p>
1663 remove the specified files on the next commit
1670 remove the specified files on the next commit
1664 </p>
1671 </p>
1665 <p>
1672 <p>
1666 Schedule the indicated files for removal from the current branch.
1673 Schedule the indicated files for removal from the current branch.
1667 </p>
1674 </p>
1668 <p>
1675 <p>
1669 This command schedules the files to be removed at the next commit.
1676 This command schedules the files to be removed at the next commit.
1670 To undo a remove before that, see &quot;hg revert&quot;. To undo added
1677 To undo a remove before that, see &quot;hg revert&quot;. To undo added
1671 files, see &quot;hg forget&quot;.
1678 files, see &quot;hg forget&quot;.
1672 </p>
1679 </p>
1673 <p>
1680 <p>
1674 -A/--after can be used to remove only files that have already
1681 -A/--after can be used to remove only files that have already
1675 been deleted, -f/--force can be used to force deletion, and -Af
1682 been deleted, -f/--force can be used to force deletion, and -Af
1676 can be used to remove files from the next revision without
1683 can be used to remove files from the next revision without
1677 deleting them from the working directory.
1684 deleting them from the working directory.
1678 </p>
1685 </p>
1679 <p>
1686 <p>
1680 The following table details the behavior of remove for different
1687 The following table details the behavior of remove for different
1681 file states (columns) and option combinations (rows). The file
1688 file states (columns) and option combinations (rows). The file
1682 states are Added [A], Clean [C], Modified [M] and Missing [!]
1689 states are Added [A], Clean [C], Modified [M] and Missing [!]
1683 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
1690 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
1684 (from branch) and Delete (from disk):
1691 (from branch) and Delete (from disk):
1685 </p>
1692 </p>
1686 <table>
1693 <table>
1687 <tr><td></td>
1694 <tr><td></td>
1688 <td>A</td>
1695 <td>A</td>
1689 <td>C</td>
1696 <td>C</td>
1690 <td>M</td>
1697 <td>M</td>
1691 <td>!</td></tr>
1698 <td>!</td></tr>
1692 <tr><td>none</td>
1699 <tr><td>none</td>
1693 <td>W</td>
1700 <td>W</td>
1694 <td>RD</td>
1701 <td>RD</td>
1695 <td>W</td>
1702 <td>W</td>
1696 <td>R</td></tr>
1703 <td>R</td></tr>
1697 <tr><td>-f</td>
1704 <tr><td>-f</td>
1698 <td>R</td>
1705 <td>R</td>
1699 <td>RD</td>
1706 <td>RD</td>
1700 <td>RD</td>
1707 <td>RD</td>
1701 <td>R</td></tr>
1708 <td>R</td></tr>
1702 <tr><td>-A</td>
1709 <tr><td>-A</td>
1703 <td>W</td>
1710 <td>W</td>
1704 <td>W</td>
1711 <td>W</td>
1705 <td>W</td>
1712 <td>W</td>
1706 <td>R</td></tr>
1713 <td>R</td></tr>
1707 <tr><td>-Af</td>
1714 <tr><td>-Af</td>
1708 <td>R</td>
1715 <td>R</td>
1709 <td>R</td>
1716 <td>R</td>
1710 <td>R</td>
1717 <td>R</td>
1711 <td>R</td></tr>
1718 <td>R</td></tr>
1712 </table>
1719 </table>
1713 <p>
1720 <p>
1714 Note that remove never deletes files in Added [A] state from the
1721 Note that remove never deletes files in Added [A] state from the
1715 working directory, not even if option --force is specified.
1722 working directory, not even if option --force is specified.
1716 </p>
1723 </p>
1717 <p>
1724 <p>
1718 Returns 0 on success, 1 if any warnings encountered.
1725 Returns 0 on success, 1 if any warnings encountered.
1719 </p>
1726 </p>
1720 <p>
1727 <p>
1721 options:
1728 options:
1722 </p>
1729 </p>
1723 <table>
1730 <table>
1724 <tr><td>-A</td>
1731 <tr><td>-A</td>
1725 <td>--after</td>
1732 <td>--after</td>
1726 <td>record delete for missing files</td></tr>
1733 <td>record delete for missing files</td></tr>
1727 <tr><td>-f</td>
1734 <tr><td>-f</td>
1728 <td>--force</td>
1735 <td>--force</td>
1729 <td>remove (and delete) file even if added or modified</td></tr>
1736 <td>remove (and delete) file even if added or modified</td></tr>
1730 <tr><td>-I</td>
1737 <tr><td>-I</td>
1731 <td>--include PATTERN [+]</td>
1738 <td>--include PATTERN [+]</td>
1732 <td>include names matching the given patterns</td></tr>
1739 <td>include names matching the given patterns</td></tr>
1733 <tr><td>-X</td>
1740 <tr><td>-X</td>
1734 <td>--exclude PATTERN [+]</td>
1741 <td>--exclude PATTERN [+]</td>
1735 <td>exclude names matching the given patterns</td></tr>
1742 <td>exclude names matching the given patterns</td></tr>
1736 </table>
1743 </table>
1737 <p>
1744 <p>
1738 [+] marked option can be specified multiple times
1745 [+] marked option can be specified multiple times
1739 </p>
1746 </p>
1740 <p>
1747 <p>
1741 global options:
1748 global options:
1742 </p>
1749 </p>
1743 <table>
1750 <table>
1744 <tr><td>-R</td>
1751 <tr><td>-R</td>
1745 <td>--repository REPO</td>
1752 <td>--repository REPO</td>
1746 <td>repository root directory or name of overlay bundle file</td></tr>
1753 <td>repository root directory or name of overlay bundle file</td></tr>
1747 <tr><td></td>
1754 <tr><td></td>
1748 <td>--cwd DIR</td>
1755 <td>--cwd DIR</td>
1749 <td>change working directory</td></tr>
1756 <td>change working directory</td></tr>
1750 <tr><td>-y</td>
1757 <tr><td>-y</td>
1751 <td>--noninteractive</td>
1758 <td>--noninteractive</td>
1752 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1759 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1753 <tr><td>-q</td>
1760 <tr><td>-q</td>
1754 <td>--quiet</td>
1761 <td>--quiet</td>
1755 <td>suppress output</td></tr>
1762 <td>suppress output</td></tr>
1756 <tr><td>-v</td>
1763 <tr><td>-v</td>
1757 <td>--verbose</td>
1764 <td>--verbose</td>
1758 <td>enable additional output</td></tr>
1765 <td>enable additional output</td></tr>
1759 <tr><td></td>
1766 <tr><td></td>
1760 <td>--config CONFIG [+]</td>
1767 <td>--config CONFIG [+]</td>
1761 <td>set/override config option (use 'section.name=value')</td></tr>
1768 <td>set/override config option (use 'section.name=value')</td></tr>
1762 <tr><td></td>
1769 <tr><td></td>
1763 <td>--debug</td>
1770 <td>--debug</td>
1764 <td>enable debugging output</td></tr>
1771 <td>enable debugging output</td></tr>
1765 <tr><td></td>
1772 <tr><td></td>
1766 <td>--debugger</td>
1773 <td>--debugger</td>
1767 <td>start debugger</td></tr>
1774 <td>start debugger</td></tr>
1768 <tr><td></td>
1775 <tr><td></td>
1769 <td>--encoding ENCODE</td>
1776 <td>--encoding ENCODE</td>
1770 <td>set the charset encoding (default: ascii)</td></tr>
1777 <td>set the charset encoding (default: ascii)</td></tr>
1771 <tr><td></td>
1778 <tr><td></td>
1772 <td>--encodingmode MODE</td>
1779 <td>--encodingmode MODE</td>
1773 <td>set the charset encoding mode (default: strict)</td></tr>
1780 <td>set the charset encoding mode (default: strict)</td></tr>
1774 <tr><td></td>
1781 <tr><td></td>
1775 <td>--traceback</td>
1782 <td>--traceback</td>
1776 <td>always print a traceback on exception</td></tr>
1783 <td>always print a traceback on exception</td></tr>
1777 <tr><td></td>
1784 <tr><td></td>
1778 <td>--time</td>
1785 <td>--time</td>
1779 <td>time how long the command takes</td></tr>
1786 <td>time how long the command takes</td></tr>
1780 <tr><td></td>
1787 <tr><td></td>
1781 <td>--profile</td>
1788 <td>--profile</td>
1782 <td>print command execution profile</td></tr>
1789 <td>print command execution profile</td></tr>
1783 <tr><td></td>
1790 <tr><td></td>
1784 <td>--version</td>
1791 <td>--version</td>
1785 <td>output version information and exit</td></tr>
1792 <td>output version information and exit</td></tr>
1786 <tr><td>-h</td>
1793 <tr><td>-h</td>
1787 <td>--help</td>
1794 <td>--help</td>
1788 <td>display help and exit</td></tr>
1795 <td>display help and exit</td></tr>
1789 <tr><td></td>
1796 <tr><td></td>
1790 <td>--hidden</td>
1797 <td>--hidden</td>
1791 <td>consider hidden changesets</td></tr>
1798 <td>consider hidden changesets</td></tr>
1792 </table>
1799 </table>
1793 <p>
1800 <p>
1794 [+] marked option can be specified multiple times
1801 [+] marked option can be specified multiple times
1795 </p>
1802 </p>
1796
1803
1797 </div>
1804 </div>
1798 </div>
1805 </div>
1799 </div>
1806 </div>
1800
1807
1801 <script type="text/javascript">process_dates()</script>
1808 <script type="text/javascript">process_dates()</script>
1802
1809
1803
1810
1804 </body>
1811 </body>
1805 </html>
1812 </html>
1806
1813
1807
1814
1808 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1815 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1809 200 Script output follows
1816 200 Script output follows
1810
1817
1811 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1818 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1812 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1819 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1813 <head>
1820 <head>
1814 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1821 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1815 <meta name="robots" content="index, nofollow" />
1822 <meta name="robots" content="index, nofollow" />
1816 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1823 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1817 <script type="text/javascript" src="/static/mercurial.js"></script>
1824 <script type="text/javascript" src="/static/mercurial.js"></script>
1818
1825
1819 <title>Help: revisions</title>
1826 <title>Help: revisions</title>
1820 </head>
1827 </head>
1821 <body>
1828 <body>
1822
1829
1823 <div class="container">
1830 <div class="container">
1824 <div class="menu">
1831 <div class="menu">
1825 <div class="logo">
1832 <div class="logo">
1826 <a href="http://mercurial.selenic.com/">
1833 <a href="http://mercurial.selenic.com/">
1827 <img src="/static/hglogo.png" alt="mercurial" /></a>
1834 <img src="/static/hglogo.png" alt="mercurial" /></a>
1828 </div>
1835 </div>
1829 <ul>
1836 <ul>
1830 <li><a href="/shortlog">log</a></li>
1837 <li><a href="/shortlog">log</a></li>
1831 <li><a href="/graph">graph</a></li>
1838 <li><a href="/graph">graph</a></li>
1832 <li><a href="/tags">tags</a></li>
1839 <li><a href="/tags">tags</a></li>
1833 <li><a href="/bookmarks">bookmarks</a></li>
1840 <li><a href="/bookmarks">bookmarks</a></li>
1834 <li><a href="/branches">branches</a></li>
1841 <li><a href="/branches">branches</a></li>
1835 </ul>
1842 </ul>
1836 <ul>
1843 <ul>
1837 <li class="active"><a href="/help">help</a></li>
1844 <li class="active"><a href="/help">help</a></li>
1838 </ul>
1845 </ul>
1839 </div>
1846 </div>
1840
1847
1841 <div class="main">
1848 <div class="main">
1842 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1849 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1843 <h3>Help: revisions</h3>
1850 <h3>Help: revisions</h3>
1844
1851
1845 <form class="search" action="/log">
1852 <form class="search" action="/log">
1846
1853
1847 <p><input name="rev" id="search1" type="text" size="30" /></p>
1854 <p><input name="rev" id="search1" type="text" size="30" /></p>
1848 <div id="hint">find changesets by author, revision,
1855 <div id="hint">find changesets by author, revision,
1849 files, or words in the commit message</div>
1856 files, or words in the commit message</div>
1850 </form>
1857 </form>
1851 <div id="doc">
1858 <div id="doc">
1852 <h1>Specifying Single Revisions</h1>
1859 <h1>Specifying Single Revisions</h1>
1853 <p>
1860 <p>
1854 Mercurial supports several ways to specify individual revisions.
1861 Mercurial supports several ways to specify individual revisions.
1855 </p>
1862 </p>
1856 <p>
1863 <p>
1857 A plain integer is treated as a revision number. Negative integers are
1864 A plain integer is treated as a revision number. Negative integers are
1858 treated as sequential offsets from the tip, with -1 denoting the tip,
1865 treated as sequential offsets from the tip, with -1 denoting the tip,
1859 -2 denoting the revision prior to the tip, and so forth.
1866 -2 denoting the revision prior to the tip, and so forth.
1860 </p>
1867 </p>
1861 <p>
1868 <p>
1862 A 40-digit hexadecimal string is treated as a unique revision
1869 A 40-digit hexadecimal string is treated as a unique revision
1863 identifier.
1870 identifier.
1864 </p>
1871 </p>
1865 <p>
1872 <p>
1866 A hexadecimal string less than 40 characters long is treated as a
1873 A hexadecimal string less than 40 characters long is treated as a
1867 unique revision identifier and is referred to as a short-form
1874 unique revision identifier and is referred to as a short-form
1868 identifier. A short-form identifier is only valid if it is the prefix
1875 identifier. A short-form identifier is only valid if it is the prefix
1869 of exactly one full-length identifier.
1876 of exactly one full-length identifier.
1870 </p>
1877 </p>
1871 <p>
1878 <p>
1872 Any other string is treated as a bookmark, tag, or branch name. A
1879 Any other string is treated as a bookmark, tag, or branch name. A
1873 bookmark is a movable pointer to a revision. A tag is a permanent name
1880 bookmark is a movable pointer to a revision. A tag is a permanent name
1874 associated with a revision. A branch name denotes the tipmost revision
1881 associated with a revision. A branch name denotes the tipmost revision
1875 of that branch. Bookmark, tag, and branch names must not contain the &quot;:&quot;
1882 of that branch. Bookmark, tag, and branch names must not contain the &quot;:&quot;
1876 character.
1883 character.
1877 </p>
1884 </p>
1878 <p>
1885 <p>
1879 The reserved name &quot;tip&quot; always identifies the most recent revision.
1886 The reserved name &quot;tip&quot; always identifies the most recent revision.
1880 </p>
1887 </p>
1881 <p>
1888 <p>
1882 The reserved name &quot;null&quot; indicates the null revision. This is the
1889 The reserved name &quot;null&quot; indicates the null revision. This is the
1883 revision of an empty repository, and the parent of revision 0.
1890 revision of an empty repository, and the parent of revision 0.
1884 </p>
1891 </p>
1885 <p>
1892 <p>
1886 The reserved name &quot;.&quot; indicates the working directory parent. If no
1893 The reserved name &quot;.&quot; indicates the working directory parent. If no
1887 working directory is checked out, it is equivalent to null. If an
1894 working directory is checked out, it is equivalent to null. If an
1888 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
1895 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
1889 parent.
1896 parent.
1890 </p>
1897 </p>
1891
1898
1892 </div>
1899 </div>
1893 </div>
1900 </div>
1894 </div>
1901 </div>
1895
1902
1896 <script type="text/javascript">process_dates()</script>
1903 <script type="text/javascript">process_dates()</script>
1897
1904
1898
1905
1899 </body>
1906 </body>
1900 </html>
1907 </html>
1901
1908
1902
1909
1903 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1910 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1904
1911
1905 #endif
1912 #endif
General Comments 0
You need to be logged in to leave comments. Login now