##// END OF EJS Templates
help: use a full header for topic titles...
Dan Villiom Podlaski Christiansen -
r18748:6e676fb6 default
parent child Browse files
Show More
@@ -1,168 +1,156
1 import os, sys, textwrap
1 import os, sys, textwrap
2 # import from the live mercurial repo
2 # import from the live mercurial repo
3 sys.path.insert(0, "..")
3 sys.path.insert(0, "..")
4 # fall back to pure modules if required C extensions are not available
4 # fall back to pure modules if required C extensions are not available
5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
6 from mercurial import demandimport; demandimport.enable()
6 from mercurial import demandimport; demandimport.enable()
7 from mercurial import encoding
7 from mercurial import encoding
8 from mercurial import minirst
8 from mercurial.commands import table, globalopts
9 from mercurial.commands import table, globalopts
9 from mercurial.i18n import _
10 from mercurial.i18n import _
10 from mercurial.help import helptable
11 from mercurial.help import helptable
11 from mercurial import extensions
12 from mercurial import extensions
12 from mercurial import util
13 from mercurial import util
13
14
14 def get_desc(docstr):
15 def get_desc(docstr):
15 if not docstr:
16 if not docstr:
16 return "", ""
17 return "", ""
17 # sanitize
18 # sanitize
18 docstr = docstr.strip("\n")
19 docstr = docstr.strip("\n")
19 docstr = docstr.rstrip()
20 docstr = docstr.rstrip()
20 shortdesc = docstr.splitlines()[0].strip()
21 shortdesc = docstr.splitlines()[0].strip()
21
22
22 i = docstr.find("\n")
23 i = docstr.find("\n")
23 if i != -1:
24 if i != -1:
24 desc = docstr[i + 2:]
25 desc = docstr[i + 2:]
25 else:
26 else:
26 desc = shortdesc
27 desc = shortdesc
27
28
28 desc = textwrap.dedent(desc)
29 desc = textwrap.dedent(desc)
29
30
30 return (shortdesc, desc)
31 return (shortdesc, desc)
31
32
32 def get_opts(opts):
33 def get_opts(opts):
33 for opt in opts:
34 for opt in opts:
34 if len(opt) == 5:
35 if len(opt) == 5:
35 shortopt, longopt, default, desc, optlabel = opt
36 shortopt, longopt, default, desc, optlabel = opt
36 else:
37 else:
37 shortopt, longopt, default, desc = opt
38 shortopt, longopt, default, desc = opt
38 allopts = []
39 allopts = []
39 if shortopt:
40 if shortopt:
40 allopts.append("-%s" % shortopt)
41 allopts.append("-%s" % shortopt)
41 if longopt:
42 if longopt:
42 allopts.append("--%s" % longopt)
43 allopts.append("--%s" % longopt)
43 desc += default and _(" (default: %s)") % default or ""
44 desc += default and _(" (default: %s)") % default or ""
44 yield (", ".join(allopts), desc)
45 yield (", ".join(allopts), desc)
45
46
46 def get_cmd(cmd, cmdtable):
47 def get_cmd(cmd, cmdtable):
47 d = {}
48 d = {}
48 attr = cmdtable[cmd]
49 attr = cmdtable[cmd]
49 cmds = cmd.lstrip("^").split("|")
50 cmds = cmd.lstrip("^").split("|")
50
51
51 d['cmd'] = cmds[0]
52 d['cmd'] = cmds[0]
52 d['aliases'] = cmd.split("|")[1:]
53 d['aliases'] = cmd.split("|")[1:]
53 d['desc'] = get_desc(attr[0].__doc__)
54 d['desc'] = get_desc(attr[0].__doc__)
54 d['opts'] = list(get_opts(attr[1]))
55 d['opts'] = list(get_opts(attr[1]))
55
56
56 s = 'hg ' + cmds[0]
57 s = 'hg ' + cmds[0]
57 if len(attr) > 2:
58 if len(attr) > 2:
58 if not attr[2].startswith('hg'):
59 if not attr[2].startswith('hg'):
59 s += ' ' + attr[2]
60 s += ' ' + attr[2]
60 else:
61 else:
61 s = attr[2]
62 s = attr[2]
62 d['synopsis'] = s.strip()
63 d['synopsis'] = s.strip()
63
64
64 return d
65 return d
65
66
66 def section(ui, s):
67 ui.write("%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s)))
68
69 def subsection(ui, s):
70 ui.write("%s\n%s\n\n" % (s, '=' * encoding.colwidth(s)))
71
72 def subsubsection(ui, s):
73 ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s)))
74
75 def subsubsubsection(ui, s):
76 ui.write("%s\n%s\n\n" % (s, "." * encoding.colwidth(s)))
77
78
79 def show_doc(ui):
67 def show_doc(ui):
80 # print options
68 # print options
81 section(ui, _("Options"))
69 ui.write(minirst.section(_("Options")))
82 for optstr, desc in get_opts(globalopts):
70 for optstr, desc in get_opts(globalopts):
83 ui.write("%s\n %s\n\n" % (optstr, desc))
71 ui.write("%s\n %s\n\n" % (optstr, desc))
84
72
85 # print cmds
73 # print cmds
86 section(ui, _("Commands"))
74 ui.write(minirst.section(_("Commands")))
87 commandprinter(ui, table, subsection)
75 commandprinter(ui, table, minirst.subsection)
88
76
89 # print topics
77 # print topics
90 for names, sec, doc in helptable:
78 for names, sec, doc in helptable:
91 if names[0] == "config":
79 if names[0] == "config":
92 # The config help topic is included in the hgrc.5 man
80 # The config help topic is included in the hgrc.5 man
93 # page.
81 # page.
94 continue
82 continue
95 for name in names:
83 for name in names:
96 ui.write(".. _%s:\n" % name)
84 ui.write(".. _%s:\n" % name)
97 ui.write("\n")
85 ui.write("\n")
98 section(ui, sec)
86 ui.write(minirst.section(sec))
99 if util.safehasattr(doc, '__call__'):
87 if util.safehasattr(doc, '__call__'):
100 doc = doc()
88 doc = doc()
101 ui.write(doc)
89 ui.write(doc)
102 ui.write("\n")
90 ui.write("\n")
103
91
104 section(ui, _("Extensions"))
92 ui.write(minirst.section(_("Extensions")))
105 ui.write(_("This section contains help for extensions that are "
93 ui.write(_("This section contains help for extensions that are "
106 "distributed together with Mercurial. Help for other "
94 "distributed together with Mercurial. Help for other "
107 "extensions is available in the help system."))
95 "extensions is available in the help system."))
108 ui.write("\n\n"
96 ui.write("\n\n"
109 ".. contents::\n"
97 ".. contents::\n"
110 " :class: htmlonly\n"
98 " :class: htmlonly\n"
111 " :local:\n"
99 " :local:\n"
112 " :depth: 1\n\n")
100 " :depth: 1\n\n")
113
101
114 for extensionname in sorted(allextensionnames()):
102 for extensionname in sorted(allextensionnames()):
115 mod = extensions.load(None, extensionname, None)
103 mod = extensions.load(None, extensionname, None)
116 subsection(ui, extensionname)
104 ui.write(minirst.subsection(extensionname))
117 ui.write("%s\n\n" % mod.__doc__)
105 ui.write("%s\n\n" % mod.__doc__)
118 cmdtable = getattr(mod, 'cmdtable', None)
106 cmdtable = getattr(mod, 'cmdtable', None)
119 if cmdtable:
107 if cmdtable:
120 subsubsection(ui, _('Commands'))
108 ui.write(minirst.subsubsection(_('Commands')))
121 commandprinter(ui, cmdtable, subsubsubsection)
109 commandprinter(ui, cmdtable, minirst.subsubsubsection)
122
110
123 def commandprinter(ui, cmdtable, sectionfunc):
111 def commandprinter(ui, cmdtable, sectionfunc):
124 h = {}
112 h = {}
125 for c, attr in cmdtable.items():
113 for c, attr in cmdtable.items():
126 f = c.split("|")[0]
114 f = c.split("|")[0]
127 f = f.lstrip("^")
115 f = f.lstrip("^")
128 h[f] = c
116 h[f] = c
129 cmds = h.keys()
117 cmds = h.keys()
130 cmds.sort()
118 cmds.sort()
131
119
132 for f in cmds:
120 for f in cmds:
133 if f.startswith("debug"):
121 if f.startswith("debug"):
134 continue
122 continue
135 d = get_cmd(h[f], cmdtable)
123 d = get_cmd(h[f], cmdtable)
136 sectionfunc(ui, d['cmd'])
124 ui.write(sectionfunc(d['cmd']))
137 # synopsis
125 # synopsis
138 ui.write("::\n\n")
126 ui.write("::\n\n")
139 synopsislines = d['synopsis'].splitlines()
127 synopsislines = d['synopsis'].splitlines()
140 for line in synopsislines:
128 for line in synopsislines:
141 # some commands (such as rebase) have a multi-line
129 # some commands (such as rebase) have a multi-line
142 # synopsis
130 # synopsis
143 ui.write(" %s\n" % line)
131 ui.write(" %s\n" % line)
144 ui.write('\n')
132 ui.write('\n')
145 # description
133 # description
146 ui.write("%s\n\n" % d['desc'][1])
134 ui.write("%s\n\n" % d['desc'][1])
147 # options
135 # options
148 opt_output = list(d['opts'])
136 opt_output = list(d['opts'])
149 if opt_output:
137 if opt_output:
150 opts_len = max([len(line[0]) for line in opt_output])
138 opts_len = max([len(line[0]) for line in opt_output])
151 ui.write(_("Options:\n\n"))
139 ui.write(_("Options:\n\n"))
152 for optstr, desc in opt_output:
140 for optstr, desc in opt_output:
153 if desc:
141 if desc:
154 s = "%-*s %s" % (opts_len, optstr, desc)
142 s = "%-*s %s" % (opts_len, optstr, desc)
155 else:
143 else:
156 s = optstr
144 s = optstr
157 ui.write("%s\n" % s)
145 ui.write("%s\n" % s)
158 ui.write("\n")
146 ui.write("\n")
159 # aliases
147 # aliases
160 if d['aliases']:
148 if d['aliases']:
161 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
149 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
162
150
163
151
164 def allextensionnames():
152 def allextensionnames():
165 return extensions.enabled().keys() + extensions.disabled().keys()
153 return extensions.enabled().keys() + extensions.disabled().keys()
166
154
167 if __name__ == "__main__":
155 if __name__ == "__main__":
168 show_doc(sys.stdout)
156 show_doc(sys.stdout)
@@ -1,503 +1,504
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().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 if lowercontains(name) or lowercontains(docs):
110 if lowercontains(name) or lowercontains(docs):
111 # extension docs are already translated
111 # extension docs are already translated
112 results['extensions'].append((name, docs.splitlines()[0]))
112 results['extensions'].append((name, docs.splitlines()[0]))
113 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
113 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
114 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
114 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
115 cmdname = cmd.split('|')[0].lstrip('^')
115 cmdname = cmd.split('|')[0].lstrip('^')
116 if entry[0].__doc__:
116 if entry[0].__doc__:
117 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
117 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
118 else:
118 else:
119 cmddoc = _('(no help text available)')
119 cmddoc = _('(no help text available)')
120 results['extensioncommands'].append((cmdname, cmddoc))
120 results['extensioncommands'].append((cmdname, cmddoc))
121 return results
121 return results
122
122
123 def loaddoc(topic):
123 def loaddoc(topic):
124 """Return a delayed loader for help/topic.txt."""
124 """Return a delayed loader for help/topic.txt."""
125
125
126 def loader():
126 def loader():
127 if util.mainfrozen():
127 if util.mainfrozen():
128 module = sys.executable
128 module = sys.executable
129 else:
129 else:
130 module = __file__
130 module = __file__
131 base = os.path.dirname(module)
131 base = os.path.dirname(module)
132
132
133 for dir in ('.', '..'):
133 for dir in ('.', '..'):
134 docdir = os.path.join(base, dir, 'help')
134 docdir = os.path.join(base, dir, 'help')
135 if os.path.isdir(docdir):
135 if os.path.isdir(docdir):
136 break
136 break
137
137
138 path = os.path.join(docdir, topic + ".txt")
138 path = os.path.join(docdir, topic + ".txt")
139 doc = gettext(util.readfile(path))
139 doc = gettext(util.readfile(path))
140 for rewriter in helphooks.get(topic, []):
140 for rewriter in helphooks.get(topic, []):
141 doc = rewriter(topic, doc)
141 doc = rewriter(topic, doc)
142 return doc
142 return doc
143
143
144 return loader
144 return loader
145
145
146 helptable = sorted([
146 helptable = sorted([
147 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
147 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
148 (["dates"], _("Date Formats"), loaddoc('dates')),
148 (["dates"], _("Date Formats"), loaddoc('dates')),
149 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
149 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
150 (['environment', 'env'], _('Environment Variables'),
150 (['environment', 'env'], _('Environment Variables'),
151 loaddoc('environment')),
151 loaddoc('environment')),
152 (['revisions', 'revs'], _('Specifying Single Revisions'),
152 (['revisions', 'revs'], _('Specifying Single Revisions'),
153 loaddoc('revisions')),
153 loaddoc('revisions')),
154 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
154 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
155 loaddoc('multirevs')),
155 loaddoc('multirevs')),
156 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
156 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
157 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
157 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
158 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
158 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
159 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
159 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
160 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
160 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
161 loaddoc('templates')),
161 loaddoc('templates')),
162 (['urls'], _('URL Paths'), loaddoc('urls')),
162 (['urls'], _('URL Paths'), loaddoc('urls')),
163 (["extensions"], _("Using Additional Features"), extshelp),
163 (["extensions"], _("Using Additional Features"), extshelp),
164 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
164 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
165 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
165 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
166 (["glossary"], _("Glossary"), loaddoc('glossary')),
166 (["glossary"], _("Glossary"), loaddoc('glossary')),
167 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
167 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
168 loaddoc('hgignore')),
168 loaddoc('hgignore')),
169 (["phases"], _("Working with Phases"), loaddoc('phases')),
169 (["phases"], _("Working with Phases"), loaddoc('phases')),
170 ])
170 ])
171
171
172 # Map topics to lists of callable taking the current topic help and
172 # Map topics to lists of callable taking the current topic help and
173 # returning the updated version
173 # returning the updated version
174 helphooks = {}
174 helphooks = {}
175
175
176 def addtopichook(topic, rewriter):
176 def addtopichook(topic, rewriter):
177 helphooks.setdefault(topic, []).append(rewriter)
177 helphooks.setdefault(topic, []).append(rewriter)
178
178
179 def makeitemsdoc(topic, doc, marker, items):
179 def makeitemsdoc(topic, doc, marker, items):
180 """Extract docstring from the items key to function mapping, build a
180 """Extract docstring from the items key to function mapping, build a
181 .single documentation block and use it to overwrite the marker in doc
181 .single documentation block and use it to overwrite the marker in doc
182 """
182 """
183 entries = []
183 entries = []
184 for name in sorted(items):
184 for name in sorted(items):
185 text = (items[name].__doc__ or '').rstrip()
185 text = (items[name].__doc__ or '').rstrip()
186 if not text:
186 if not text:
187 continue
187 continue
188 text = gettext(text)
188 text = gettext(text)
189 lines = text.splitlines()
189 lines = text.splitlines()
190 doclines = [(lines[0])]
190 doclines = [(lines[0])]
191 for l in lines[1:]:
191 for l in lines[1:]:
192 # Stop once we find some Python doctest
192 # Stop once we find some Python doctest
193 if l.strip().startswith('>>>'):
193 if l.strip().startswith('>>>'):
194 break
194 break
195 doclines.append(' ' + l.strip())
195 doclines.append(' ' + l.strip())
196 entries.append('\n'.join(doclines))
196 entries.append('\n'.join(doclines))
197 entries = '\n\n'.join(entries)
197 entries = '\n\n'.join(entries)
198 return doc.replace(marker, entries)
198 return doc.replace(marker, entries)
199
199
200 def addtopicsymbols(topic, marker, symbols):
200 def addtopicsymbols(topic, marker, symbols):
201 def add(topic, doc):
201 def add(topic, doc):
202 return makeitemsdoc(topic, doc, marker, symbols)
202 return makeitemsdoc(topic, doc, marker, symbols)
203 addtopichook(topic, add)
203 addtopichook(topic, add)
204
204
205 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
205 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
206 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
206 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
207 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
207 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
208 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
208 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
209 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
209 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
210
210
211 def help_(ui, name, unknowncmd=False, full=True, **opts):
211 def help_(ui, name, unknowncmd=False, full=True, **opts):
212 '''
212 '''
213 Generate the help for 'name' as unformatted restructured text. If
213 Generate the help for 'name' as unformatted restructured text. If
214 'name' is None, describe the commands available.
214 'name' is None, describe the commands available.
215 '''
215 '''
216
216
217 import commands # avoid cycle
217 import commands # avoid cycle
218
218
219 def helpcmd(name):
219 def helpcmd(name):
220 try:
220 try:
221 aliases, entry = cmdutil.findcmd(name, commands.table,
221 aliases, entry = cmdutil.findcmd(name, commands.table,
222 strict=unknowncmd)
222 strict=unknowncmd)
223 except error.AmbiguousCommand, inst:
223 except error.AmbiguousCommand, inst:
224 # py3k fix: except vars can't be used outside the scope of the
224 # 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
225 # except block, nor can be used inside a lambda. python issue4617
226 prefix = inst.args[0]
226 prefix = inst.args[0]
227 select = lambda c: c.lstrip('^').startswith(prefix)
227 select = lambda c: c.lstrip('^').startswith(prefix)
228 rst = helplist(select)
228 rst = helplist(select)
229 return rst
229 return rst
230
230
231 rst = []
231 rst = []
232
232
233 # check if it's an invalid alias and display its error if it is
233 # check if it's an invalid alias and display its error if it is
234 if getattr(entry[0], 'badalias', False):
234 if getattr(entry[0], 'badalias', False):
235 if not unknowncmd:
235 if not unknowncmd:
236 ui.pushbuffer()
236 ui.pushbuffer()
237 entry[0](ui)
237 entry[0](ui)
238 rst.append(ui.popbuffer())
238 rst.append(ui.popbuffer())
239 return rst
239 return rst
240
240
241 # synopsis
241 # synopsis
242 if len(entry) > 2:
242 if len(entry) > 2:
243 if entry[2].startswith('hg'):
243 if entry[2].startswith('hg'):
244 rst.append("%s\n" % entry[2])
244 rst.append("%s\n" % entry[2])
245 else:
245 else:
246 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
246 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
247 else:
247 else:
248 rst.append('hg %s\n' % aliases[0])
248 rst.append('hg %s\n' % aliases[0])
249 # aliases
249 # aliases
250 if full and not ui.quiet and len(aliases) > 1:
250 if full and not ui.quiet and len(aliases) > 1:
251 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
251 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
252 rst.append('\n')
252 rst.append('\n')
253
253
254 # description
254 # description
255 doc = gettext(entry[0].__doc__)
255 doc = gettext(entry[0].__doc__)
256 if not doc:
256 if not doc:
257 doc = _("(no help text available)")
257 doc = _("(no help text available)")
258 if util.safehasattr(entry[0], 'definition'): # aliased command
258 if util.safehasattr(entry[0], 'definition'): # aliased command
259 if entry[0].definition.startswith('!'): # shell alias
259 if entry[0].definition.startswith('!'): # shell alias
260 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
260 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
261 else:
261 else:
262 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
262 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
263 doc = doc.splitlines(True)
263 doc = doc.splitlines(True)
264 if ui.quiet or not full:
264 if ui.quiet or not full:
265 rst.append(doc[0])
265 rst.append(doc[0])
266 else:
266 else:
267 rst.extend(doc)
267 rst.extend(doc)
268 rst.append('\n')
268 rst.append('\n')
269
269
270 # check if this command shadows a non-trivial (multi-line)
270 # check if this command shadows a non-trivial (multi-line)
271 # extension help text
271 # extension help text
272 try:
272 try:
273 mod = extensions.find(name)
273 mod = extensions.find(name)
274 doc = gettext(mod.__doc__) or ''
274 doc = gettext(mod.__doc__) or ''
275 if '\n' in doc.strip():
275 if '\n' in doc.strip():
276 msg = _('use "hg help -e %s" to show help for '
276 msg = _('use "hg help -e %s" to show help for '
277 'the %s extension') % (name, name)
277 'the %s extension') % (name, name)
278 rst.append('\n%s\n' % msg)
278 rst.append('\n%s\n' % msg)
279 except KeyError:
279 except KeyError:
280 pass
280 pass
281
281
282 # options
282 # options
283 if not ui.quiet and entry[1]:
283 if not ui.quiet and entry[1]:
284 rst.append('\n%s\n\n' % _("options:"))
284 rst.append('\n%s\n\n' % _("options:"))
285 rst.append(optrst(entry[1], ui.verbose))
285 rst.append(optrst(entry[1], ui.verbose))
286
286
287 if ui.verbose:
287 if ui.verbose:
288 rst.append('\n%s\n\n' % _("global options:"))
288 rst.append('\n%s\n\n' % _("global options:"))
289 rst.append(optrst(commands.globalopts, ui.verbose))
289 rst.append(optrst(commands.globalopts, ui.verbose))
290
290
291 if not ui.verbose:
291 if not ui.verbose:
292 if not full:
292 if not full:
293 rst.append(_('\nuse "hg help %s" to show the full help text\n')
293 rst.append(_('\nuse "hg help %s" to show the full help text\n')
294 % name)
294 % name)
295 elif not ui.quiet:
295 elif not ui.quiet:
296 omitted = _('use "hg -v help %s" to show more complete'
296 omitted = _('use "hg -v help %s" to show more complete'
297 ' help and the global options') % name
297 ' help and the global options') % name
298 notomitted = _('use "hg -v help %s" to show'
298 notomitted = _('use "hg -v help %s" to show'
299 ' the global options') % name
299 ' the global options') % name
300 indicateomitted(rst, omitted, notomitted)
300 indicateomitted(rst, omitted, notomitted)
301
301
302 return rst
302 return rst
303
303
304
304
305 def helplist(select=None):
305 def helplist(select=None):
306 # list of commands
306 # list of commands
307 if name == "shortlist":
307 if name == "shortlist":
308 header = _('basic commands:\n\n')
308 header = _('basic commands:\n\n')
309 else:
309 else:
310 header = _('list of commands:\n\n')
310 header = _('list of commands:\n\n')
311
311
312 h = {}
312 h = {}
313 cmds = {}
313 cmds = {}
314 for c, e in commands.table.iteritems():
314 for c, e in commands.table.iteritems():
315 f = c.split("|", 1)[0]
315 f = c.split("|", 1)[0]
316 if select and not select(f):
316 if select and not select(f):
317 continue
317 continue
318 if (not select and name != 'shortlist' and
318 if (not select and name != 'shortlist' and
319 e[0].__module__ != commands.__name__):
319 e[0].__module__ != commands.__name__):
320 continue
320 continue
321 if name == "shortlist" and not f.startswith("^"):
321 if name == "shortlist" and not f.startswith("^"):
322 continue
322 continue
323 f = f.lstrip("^")
323 f = f.lstrip("^")
324 if not ui.debugflag and f.startswith("debug"):
324 if not ui.debugflag and f.startswith("debug"):
325 continue
325 continue
326 doc = e[0].__doc__
326 doc = e[0].__doc__
327 if doc and 'DEPRECATED' in doc and not ui.verbose:
327 if doc and 'DEPRECATED' in doc and not ui.verbose:
328 continue
328 continue
329 doc = gettext(doc)
329 doc = gettext(doc)
330 if not doc:
330 if not doc:
331 doc = _("(no help text available)")
331 doc = _("(no help text available)")
332 h[f] = doc.splitlines()[0].rstrip()
332 h[f] = doc.splitlines()[0].rstrip()
333 cmds[f] = c.lstrip("^")
333 cmds[f] = c.lstrip("^")
334
334
335 rst = []
335 rst = []
336 if not h:
336 if not h:
337 if not ui.quiet:
337 if not ui.quiet:
338 rst.append(_('no commands defined\n'))
338 rst.append(_('no commands defined\n'))
339 return rst
339 return rst
340
340
341 if not ui.quiet:
341 if not ui.quiet:
342 rst.append(header)
342 rst.append(header)
343 fns = sorted(h)
343 fns = sorted(h)
344 for f in fns:
344 for f in fns:
345 if ui.verbose:
345 if ui.verbose:
346 commacmds = cmds[f].replace("|",", ")
346 commacmds = cmds[f].replace("|",", ")
347 rst.append(" :%s: %s\n" % (commacmds, h[f]))
347 rst.append(" :%s: %s\n" % (commacmds, h[f]))
348 else:
348 else:
349 rst.append(' :%s: %s\n' % (f, h[f]))
349 rst.append(' :%s: %s\n' % (f, h[f]))
350
350
351 if not name:
351 if not name:
352 exts = listexts(_('enabled extensions:'), extensions.enabled())
352 exts = listexts(_('enabled extensions:'), extensions.enabled())
353 if exts:
353 if exts:
354 rst.append('\n')
354 rst.append('\n')
355 rst.extend(exts)
355 rst.extend(exts)
356
356
357 rst.append(_("\nadditional help topics:\n\n"))
357 rst.append(_("\nadditional help topics:\n\n"))
358 topics = []
358 topics = []
359 for names, header, doc in helptable:
359 for names, header, doc in helptable:
360 topics.append((names[0], header))
360 topics.append((names[0], header))
361 for t, desc in topics:
361 for t, desc in topics:
362 rst.append(" :%s: %s\n" % (t, desc))
362 rst.append(" :%s: %s\n" % (t, desc))
363
363
364 optlist = []
364 optlist = []
365 if not ui.quiet:
365 if not ui.quiet:
366 if ui.verbose:
366 if ui.verbose:
367 optlist.append((_("global options:"), commands.globalopts))
367 optlist.append((_("global options:"), commands.globalopts))
368 if name == 'shortlist':
368 if name == 'shortlist':
369 optlist.append((_('use "hg help" for the full list '
369 optlist.append((_('use "hg help" for the full list '
370 'of commands'), ()))
370 'of commands'), ()))
371 else:
371 else:
372 if name == 'shortlist':
372 if name == 'shortlist':
373 msg = _('use "hg help" for the full list of commands '
373 msg = _('use "hg help" for the full list of commands '
374 'or "hg -v" for details')
374 'or "hg -v" for details')
375 elif name and not full:
375 elif name and not full:
376 msg = _('use "hg help %s" to show the full help '
376 msg = _('use "hg help %s" to show the full help '
377 'text') % name
377 'text') % name
378 else:
378 else:
379 msg = _('use "hg -v help%s" to show builtin aliases and '
379 msg = _('use "hg -v help%s" to show builtin aliases and '
380 'global options') % (name and " " + name or "")
380 'global options') % (name and " " + name or "")
381 optlist.append((msg, ()))
381 optlist.append((msg, ()))
382
382
383 if optlist:
383 if optlist:
384 for title, options in optlist:
384 for title, options in optlist:
385 rst.append('\n%s\n' % title)
385 rst.append('\n%s\n' % title)
386 if options:
386 if options:
387 rst.append('\n%s\n' % optrst(options, ui.verbose))
387 rst.append('\n%s\n' % optrst(options, ui.verbose))
388 return rst
388 return rst
389
389
390 def helptopic(name):
390 def helptopic(name):
391 for names, header, doc in helptable:
391 for names, header, doc in helptable:
392 if name in names:
392 if name in names:
393 break
393 break
394 else:
394 else:
395 raise error.UnknownCommand(name)
395 raise error.UnknownCommand(name)
396
396
397 rst = ["%s\n\n" % header]
397 rst = [minirst.section(header)]
398
398 # description
399 # description
399 if not doc:
400 if not doc:
400 rst.append(" %s\n" % _("(no help text available)"))
401 rst.append(" %s\n" % _("(no help text available)"))
401 if util.safehasattr(doc, '__call__'):
402 if util.safehasattr(doc, '__call__'):
402 rst += [" %s\n" % l for l in doc().splitlines()]
403 rst += [" %s\n" % l for l in doc().splitlines()]
403
404
404 if not ui.verbose:
405 if not ui.verbose:
405 omitted = (_('use "hg help -v %s" to show more complete help') %
406 omitted = (_('use "hg help -v %s" to show more complete help') %
406 name)
407 name)
407 indicateomitted(rst, omitted)
408 indicateomitted(rst, omitted)
408
409
409 try:
410 try:
410 cmdutil.findcmd(name, commands.table)
411 cmdutil.findcmd(name, commands.table)
411 rst.append(_('\nuse "hg help -c %s" to see help for '
412 rst.append(_('\nuse "hg help -c %s" to see help for '
412 'the %s command\n') % (name, name))
413 'the %s command\n') % (name, name))
413 except error.UnknownCommand:
414 except error.UnknownCommand:
414 pass
415 pass
415 return rst
416 return rst
416
417
417 def helpext(name):
418 def helpext(name):
418 try:
419 try:
419 mod = extensions.find(name)
420 mod = extensions.find(name)
420 doc = gettext(mod.__doc__) or _('no help text available')
421 doc = gettext(mod.__doc__) or _('no help text available')
421 except KeyError:
422 except KeyError:
422 mod = None
423 mod = None
423 doc = extensions.disabledext(name)
424 doc = extensions.disabledext(name)
424 if not doc:
425 if not doc:
425 raise error.UnknownCommand(name)
426 raise error.UnknownCommand(name)
426
427
427 if '\n' not in doc:
428 if '\n' not in doc:
428 head, tail = doc, ""
429 head, tail = doc, ""
429 else:
430 else:
430 head, tail = doc.split('\n', 1)
431 head, tail = doc.split('\n', 1)
431 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
432 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
432 if tail:
433 if tail:
433 rst.extend(tail.splitlines(True))
434 rst.extend(tail.splitlines(True))
434 rst.append('\n')
435 rst.append('\n')
435
436
436 if not ui.verbose:
437 if not ui.verbose:
437 omitted = (_('use "hg help -v %s" to show more complete help') %
438 omitted = (_('use "hg help -v %s" to show more complete help') %
438 name)
439 name)
439 indicateomitted(rst, omitted)
440 indicateomitted(rst, omitted)
440
441
441 if mod:
442 if mod:
442 try:
443 try:
443 ct = mod.cmdtable
444 ct = mod.cmdtable
444 except AttributeError:
445 except AttributeError:
445 ct = {}
446 ct = {}
446 modcmds = set([c.split('|', 1)[0] for c in ct])
447 modcmds = set([c.split('|', 1)[0] for c in ct])
447 rst.extend(helplist(modcmds.__contains__))
448 rst.extend(helplist(modcmds.__contains__))
448 else:
449 else:
449 rst.append(_('use "hg help extensions" for information on enabling '
450 rst.append(_('use "hg help extensions" for information on enabling '
450 'extensions\n'))
451 'extensions\n'))
451 return rst
452 return rst
452
453
453 def helpextcmd(name):
454 def helpextcmd(name):
454 cmd, ext, mod = extensions.disabledcmd(ui, name,
455 cmd, ext, mod = extensions.disabledcmd(ui, name,
455 ui.configbool('ui', 'strict'))
456 ui.configbool('ui', 'strict'))
456 doc = gettext(mod.__doc__).splitlines()[0]
457 doc = gettext(mod.__doc__).splitlines()[0]
457
458
458 rst = listexts(_("'%s' is provided by the following "
459 rst = listexts(_("'%s' is provided by the following "
459 "extension:") % cmd, {ext: doc}, indent=4)
460 "extension:") % cmd, {ext: doc}, indent=4)
460 rst.append('\n')
461 rst.append('\n')
461 rst.append(_('use "hg help extensions" for information on enabling '
462 rst.append(_('use "hg help extensions" for information on enabling '
462 'extensions\n'))
463 'extensions\n'))
463 return rst
464 return rst
464
465
465
466
466 rst = []
467 rst = []
467 kw = opts.get('keyword')
468 kw = opts.get('keyword')
468 if kw:
469 if kw:
469 matches = topicmatch(kw)
470 matches = topicmatch(kw)
470 for t, title in (('topics', _('Topics')),
471 for t, title in (('topics', _('Topics')),
471 ('commands', _('Commands')),
472 ('commands', _('Commands')),
472 ('extensions', _('Extensions')),
473 ('extensions', _('Extensions')),
473 ('extensioncommands', _('Extension Commands'))):
474 ('extensioncommands', _('Extension Commands'))):
474 if matches[t]:
475 if matches[t]:
475 rst.append('%s:\n\n' % title)
476 rst.append('%s:\n\n' % title)
476 rst.extend(minirst.maketable(sorted(matches[t]), 1))
477 rst.extend(minirst.maketable(sorted(matches[t]), 1))
477 rst.append('\n')
478 rst.append('\n')
478 elif name and name != 'shortlist':
479 elif name and name != 'shortlist':
479 i = None
480 i = None
480 if unknowncmd:
481 if unknowncmd:
481 queries = (helpextcmd,)
482 queries = (helpextcmd,)
482 elif opts.get('extension'):
483 elif opts.get('extension'):
483 queries = (helpext,)
484 queries = (helpext,)
484 elif opts.get('command'):
485 elif opts.get('command'):
485 queries = (helpcmd,)
486 queries = (helpcmd,)
486 else:
487 else:
487 queries = (helptopic, helpcmd, helpext, helpextcmd)
488 queries = (helptopic, helpcmd, helpext, helpextcmd)
488 for f in queries:
489 for f in queries:
489 try:
490 try:
490 rst = f(name)
491 rst = f(name)
491 i = None
492 i = None
492 break
493 break
493 except error.UnknownCommand, inst:
494 except error.UnknownCommand, inst:
494 i = inst
495 i = inst
495 if i:
496 if i:
496 raise i
497 raise i
497 else:
498 else:
498 # program name
499 # program name
499 if not ui.quiet:
500 if not ui.quiet:
500 rst = [_("Mercurial Distributed SCM\n"), '\n']
501 rst = [_("Mercurial Distributed SCM\n"), '\n']
501 rst.extend(helplist())
502 rst.extend(helplist())
502
503
503 return ''.join(rst)
504 return ''.join(rst)
@@ -1,677 +1,689
1 # minirst.py - minimal reStructuredText parser
1 # minirst.py - minimal reStructuredText parser
2 #
2 #
3 # Copyright 2009, 2010 Matt Mackall <mpm@selenic.com> and others
3 # Copyright 2009, 2010 Matt Mackall <mpm@selenic.com> and others
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 """simplified reStructuredText parser.
8 """simplified reStructuredText parser.
9
9
10 This parser knows just enough about reStructuredText to parse the
10 This parser knows just enough about reStructuredText to parse the
11 Mercurial docstrings.
11 Mercurial docstrings.
12
12
13 It cheats in a major way: nested blocks are not really nested. They
13 It cheats in a major way: nested blocks are not really nested. They
14 are just indented blocks that look like they are nested. This relies
14 are just indented blocks that look like they are nested. This relies
15 on the user to keep the right indentation for the blocks.
15 on the user to keep the right indentation for the blocks.
16
16
17 Remember to update http://mercurial.selenic.com/wiki/HelpStyleGuide
17 Remember to update http://mercurial.selenic.com/wiki/HelpStyleGuide
18 when adding support for new constructs.
18 when adding support for new constructs.
19 """
19 """
20
20
21 import re
21 import re
22 import util, encoding
22 import util, encoding
23 from i18n import _
23 from i18n import _
24
24
25 def section(s):
26 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
27
28 def subsection(s):
29 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
30
31 def subsubsection(s):
32 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
33
34 def subsubsubsection(s):
35 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
36
25 def replace(text, substs):
37 def replace(text, substs):
26 '''
38 '''
27 Apply a list of (find, replace) pairs to a text.
39 Apply a list of (find, replace) pairs to a text.
28
40
29 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
41 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
30 'Foo Bar'
42 'Foo Bar'
31 >>> encoding.encoding = 'latin1'
43 >>> encoding.encoding = 'latin1'
32 >>> replace('\\x81\\\\', [('\\\\', '/')])
44 >>> replace('\\x81\\\\', [('\\\\', '/')])
33 '\\x81/'
45 '\\x81/'
34 >>> encoding.encoding = 'shiftjis'
46 >>> encoding.encoding = 'shiftjis'
35 >>> replace('\\x81\\\\', [('\\\\', '/')])
47 >>> replace('\\x81\\\\', [('\\\\', '/')])
36 '\\x81\\\\'
48 '\\x81\\\\'
37 '''
49 '''
38
50
39 # some character encodings (cp932 for Japanese, at least) use
51 # some character encodings (cp932 for Japanese, at least) use
40 # ASCII characters other than control/alphabet/digit as a part of
52 # ASCII characters other than control/alphabet/digit as a part of
41 # multi-bytes characters, so direct replacing with such characters
53 # multi-bytes characters, so direct replacing with such characters
42 # on strings in local encoding causes invalid byte sequences.
54 # on strings in local encoding causes invalid byte sequences.
43 utext = text.decode(encoding.encoding)
55 utext = text.decode(encoding.encoding)
44 for f, t in substs:
56 for f, t in substs:
45 utext = utext.replace(f, t)
57 utext = utext.replace(f, t)
46 return utext.encode(encoding.encoding)
58 return utext.encode(encoding.encoding)
47
59
48 _blockre = re.compile(r"\n(?:\s*\n)+")
60 _blockre = re.compile(r"\n(?:\s*\n)+")
49
61
50 def findblocks(text):
62 def findblocks(text):
51 """Find continuous blocks of lines in text.
63 """Find continuous blocks of lines in text.
52
64
53 Returns a list of dictionaries representing the blocks. Each block
65 Returns a list of dictionaries representing the blocks. Each block
54 has an 'indent' field and a 'lines' field.
66 has an 'indent' field and a 'lines' field.
55 """
67 """
56 blocks = []
68 blocks = []
57 for b in _blockre.split(text.lstrip('\n').rstrip()):
69 for b in _blockre.split(text.lstrip('\n').rstrip()):
58 lines = b.splitlines()
70 lines = b.splitlines()
59 if lines:
71 if lines:
60 indent = min((len(l) - len(l.lstrip())) for l in lines)
72 indent = min((len(l) - len(l.lstrip())) for l in lines)
61 lines = [l[indent:] for l in lines]
73 lines = [l[indent:] for l in lines]
62 blocks.append(dict(indent=indent, lines=lines))
74 blocks.append(dict(indent=indent, lines=lines))
63 return blocks
75 return blocks
64
76
65 def findliteralblocks(blocks):
77 def findliteralblocks(blocks):
66 """Finds literal blocks and adds a 'type' field to the blocks.
78 """Finds literal blocks and adds a 'type' field to the blocks.
67
79
68 Literal blocks are given the type 'literal', all other blocks are
80 Literal blocks are given the type 'literal', all other blocks are
69 given type the 'paragraph'.
81 given type the 'paragraph'.
70 """
82 """
71 i = 0
83 i = 0
72 while i < len(blocks):
84 while i < len(blocks):
73 # Searching for a block that looks like this:
85 # Searching for a block that looks like this:
74 #
86 #
75 # +------------------------------+
87 # +------------------------------+
76 # | paragraph |
88 # | paragraph |
77 # | (ends with "::") |
89 # | (ends with "::") |
78 # +------------------------------+
90 # +------------------------------+
79 # +---------------------------+
91 # +---------------------------+
80 # | indented literal block |
92 # | indented literal block |
81 # +---------------------------+
93 # +---------------------------+
82 blocks[i]['type'] = 'paragraph'
94 blocks[i]['type'] = 'paragraph'
83 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
95 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
84 indent = blocks[i]['indent']
96 indent = blocks[i]['indent']
85 adjustment = blocks[i + 1]['indent'] - indent
97 adjustment = blocks[i + 1]['indent'] - indent
86
98
87 if blocks[i]['lines'] == ['::']:
99 if blocks[i]['lines'] == ['::']:
88 # Expanded form: remove block
100 # Expanded form: remove block
89 del blocks[i]
101 del blocks[i]
90 i -= 1
102 i -= 1
91 elif blocks[i]['lines'][-1].endswith(' ::'):
103 elif blocks[i]['lines'][-1].endswith(' ::'):
92 # Partially minimized form: remove space and both
104 # Partially minimized form: remove space and both
93 # colons.
105 # colons.
94 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
106 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
95 else:
107 else:
96 # Fully minimized form: remove just one colon.
108 # Fully minimized form: remove just one colon.
97 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
109 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
98
110
99 # List items are formatted with a hanging indent. We must
111 # List items are formatted with a hanging indent. We must
100 # correct for this here while we still have the original
112 # correct for this here while we still have the original
101 # information on the indentation of the subsequent literal
113 # information on the indentation of the subsequent literal
102 # blocks available.
114 # blocks available.
103 m = _bulletre.match(blocks[i]['lines'][0])
115 m = _bulletre.match(blocks[i]['lines'][0])
104 if m:
116 if m:
105 indent += m.end()
117 indent += m.end()
106 adjustment -= m.end()
118 adjustment -= m.end()
107
119
108 # Mark the following indented blocks.
120 # Mark the following indented blocks.
109 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
121 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
110 blocks[i + 1]['type'] = 'literal'
122 blocks[i + 1]['type'] = 'literal'
111 blocks[i + 1]['indent'] -= adjustment
123 blocks[i + 1]['indent'] -= adjustment
112 i += 1
124 i += 1
113 i += 1
125 i += 1
114 return blocks
126 return blocks
115
127
116 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
128 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
117 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
129 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
118 r'((.*) +)(.*)$')
130 r'((.*) +)(.*)$')
119 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
131 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
120 _definitionre = re.compile(r'[^ ]')
132 _definitionre = re.compile(r'[^ ]')
121 _tablere = re.compile(r'(=+\s+)*=+')
133 _tablere = re.compile(r'(=+\s+)*=+')
122
134
123 def splitparagraphs(blocks):
135 def splitparagraphs(blocks):
124 """Split paragraphs into lists."""
136 """Split paragraphs into lists."""
125 # Tuples with (list type, item regexp, single line items?). Order
137 # Tuples with (list type, item regexp, single line items?). Order
126 # matters: definition lists has the least specific regexp and must
138 # matters: definition lists has the least specific regexp and must
127 # come last.
139 # come last.
128 listtypes = [('bullet', _bulletre, True),
140 listtypes = [('bullet', _bulletre, True),
129 ('option', _optionre, True),
141 ('option', _optionre, True),
130 ('field', _fieldre, True),
142 ('field', _fieldre, True),
131 ('definition', _definitionre, False)]
143 ('definition', _definitionre, False)]
132
144
133 def match(lines, i, itemre, singleline):
145 def match(lines, i, itemre, singleline):
134 """Does itemre match an item at line i?
146 """Does itemre match an item at line i?
135
147
136 A list item can be followed by an indented line or another list
148 A list item can be followed by an indented line or another list
137 item (but only if singleline is True).
149 item (but only if singleline is True).
138 """
150 """
139 line1 = lines[i]
151 line1 = lines[i]
140 line2 = i + 1 < len(lines) and lines[i + 1] or ''
152 line2 = i + 1 < len(lines) and lines[i + 1] or ''
141 if not itemre.match(line1):
153 if not itemre.match(line1):
142 return False
154 return False
143 if singleline:
155 if singleline:
144 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
156 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
145 else:
157 else:
146 return line2.startswith(' ')
158 return line2.startswith(' ')
147
159
148 i = 0
160 i = 0
149 while i < len(blocks):
161 while i < len(blocks):
150 if blocks[i]['type'] == 'paragraph':
162 if blocks[i]['type'] == 'paragraph':
151 lines = blocks[i]['lines']
163 lines = blocks[i]['lines']
152 for type, itemre, singleline in listtypes:
164 for type, itemre, singleline in listtypes:
153 if match(lines, 0, itemre, singleline):
165 if match(lines, 0, itemre, singleline):
154 items = []
166 items = []
155 for j, line in enumerate(lines):
167 for j, line in enumerate(lines):
156 if match(lines, j, itemre, singleline):
168 if match(lines, j, itemre, singleline):
157 items.append(dict(type=type, lines=[],
169 items.append(dict(type=type, lines=[],
158 indent=blocks[i]['indent']))
170 indent=blocks[i]['indent']))
159 items[-1]['lines'].append(line)
171 items[-1]['lines'].append(line)
160 blocks[i:i + 1] = items
172 blocks[i:i + 1] = items
161 break
173 break
162 i += 1
174 i += 1
163 return blocks
175 return blocks
164
176
165 _fieldwidth = 14
177 _fieldwidth = 14
166
178
167 def updatefieldlists(blocks):
179 def updatefieldlists(blocks):
168 """Find key for field lists."""
180 """Find key for field lists."""
169 i = 0
181 i = 0
170 while i < len(blocks):
182 while i < len(blocks):
171 if blocks[i]['type'] != 'field':
183 if blocks[i]['type'] != 'field':
172 i += 1
184 i += 1
173 continue
185 continue
174
186
175 j = i
187 j = i
176 while j < len(blocks) and blocks[j]['type'] == 'field':
188 while j < len(blocks) and blocks[j]['type'] == 'field':
177 m = _fieldre.match(blocks[j]['lines'][0])
189 m = _fieldre.match(blocks[j]['lines'][0])
178 key, rest = m.groups()
190 key, rest = m.groups()
179 blocks[j]['lines'][0] = rest
191 blocks[j]['lines'][0] = rest
180 blocks[j]['key'] = key
192 blocks[j]['key'] = key
181 j += 1
193 j += 1
182
194
183 i = j + 1
195 i = j + 1
184
196
185 return blocks
197 return blocks
186
198
187 def updateoptionlists(blocks):
199 def updateoptionlists(blocks):
188 i = 0
200 i = 0
189 while i < len(blocks):
201 while i < len(blocks):
190 if blocks[i]['type'] != 'option':
202 if blocks[i]['type'] != 'option':
191 i += 1
203 i += 1
192 continue
204 continue
193
205
194 optstrwidth = 0
206 optstrwidth = 0
195 j = i
207 j = i
196 while j < len(blocks) and blocks[j]['type'] == 'option':
208 while j < len(blocks) and blocks[j]['type'] == 'option':
197 m = _optionre.match(blocks[j]['lines'][0])
209 m = _optionre.match(blocks[j]['lines'][0])
198
210
199 shortoption = m.group(2)
211 shortoption = m.group(2)
200 group3 = m.group(3)
212 group3 = m.group(3)
201 longoption = group3[2:].strip()
213 longoption = group3[2:].strip()
202 desc = m.group(6).strip()
214 desc = m.group(6).strip()
203 longoptionarg = m.group(5).strip()
215 longoptionarg = m.group(5).strip()
204 blocks[j]['lines'][0] = desc
216 blocks[j]['lines'][0] = desc
205
217
206 noshortop = ''
218 noshortop = ''
207 if not shortoption:
219 if not shortoption:
208 noshortop = ' '
220 noshortop = ' '
209
221
210 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
222 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
211 ("%s--%s %s") % (noshortop, longoption,
223 ("%s--%s %s") % (noshortop, longoption,
212 longoptionarg))
224 longoptionarg))
213 opt = opt.rstrip()
225 opt = opt.rstrip()
214 blocks[j]['optstr'] = opt
226 blocks[j]['optstr'] = opt
215 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
227 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
216 j += 1
228 j += 1
217
229
218 for block in blocks[i:j]:
230 for block in blocks[i:j]:
219 block['optstrwidth'] = optstrwidth
231 block['optstrwidth'] = optstrwidth
220 i = j + 1
232 i = j + 1
221 return blocks
233 return blocks
222
234
223 def prunecontainers(blocks, keep):
235 def prunecontainers(blocks, keep):
224 """Prune unwanted containers.
236 """Prune unwanted containers.
225
237
226 The blocks must have a 'type' field, i.e., they should have been
238 The blocks must have a 'type' field, i.e., they should have been
227 run through findliteralblocks first.
239 run through findliteralblocks first.
228 """
240 """
229 pruned = []
241 pruned = []
230 i = 0
242 i = 0
231 while i + 1 < len(blocks):
243 while i + 1 < len(blocks):
232 # Searching for a block that looks like this:
244 # Searching for a block that looks like this:
233 #
245 #
234 # +-------+---------------------------+
246 # +-------+---------------------------+
235 # | ".. container ::" type |
247 # | ".. container ::" type |
236 # +---+ |
248 # +---+ |
237 # | blocks |
249 # | blocks |
238 # +-------------------------------+
250 # +-------------------------------+
239 if (blocks[i]['type'] == 'paragraph' and
251 if (blocks[i]['type'] == 'paragraph' and
240 blocks[i]['lines'][0].startswith('.. container::')):
252 blocks[i]['lines'][0].startswith('.. container::')):
241 indent = blocks[i]['indent']
253 indent = blocks[i]['indent']
242 adjustment = blocks[i + 1]['indent'] - indent
254 adjustment = blocks[i + 1]['indent'] - indent
243 containertype = blocks[i]['lines'][0][15:]
255 containertype = blocks[i]['lines'][0][15:]
244 prune = containertype not in keep
256 prune = containertype not in keep
245 if prune:
257 if prune:
246 pruned.append(containertype)
258 pruned.append(containertype)
247
259
248 # Always delete "..container:: type" block
260 # Always delete "..container:: type" block
249 del blocks[i]
261 del blocks[i]
250 j = i
262 j = i
251 i -= 1
263 i -= 1
252 while j < len(blocks) and blocks[j]['indent'] > indent:
264 while j < len(blocks) and blocks[j]['indent'] > indent:
253 if prune:
265 if prune:
254 del blocks[j]
266 del blocks[j]
255 else:
267 else:
256 blocks[j]['indent'] -= adjustment
268 blocks[j]['indent'] -= adjustment
257 j += 1
269 j += 1
258 i += 1
270 i += 1
259 return blocks, pruned
271 return blocks, pruned
260
272
261 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
273 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
262
274
263 def findtables(blocks):
275 def findtables(blocks):
264 '''Find simple tables
276 '''Find simple tables
265
277
266 Only simple one-line table elements are supported
278 Only simple one-line table elements are supported
267 '''
279 '''
268
280
269 for block in blocks:
281 for block in blocks:
270 # Searching for a block that looks like this:
282 # Searching for a block that looks like this:
271 #
283 #
272 # === ==== ===
284 # === ==== ===
273 # A B C
285 # A B C
274 # === ==== === <- optional
286 # === ==== === <- optional
275 # 1 2 3
287 # 1 2 3
276 # x y z
288 # x y z
277 # === ==== ===
289 # === ==== ===
278 if (block['type'] == 'paragraph' and
290 if (block['type'] == 'paragraph' and
279 len(block['lines']) > 2 and
291 len(block['lines']) > 2 and
280 _tablere.match(block['lines'][0]) and
292 _tablere.match(block['lines'][0]) and
281 block['lines'][0] == block['lines'][-1]):
293 block['lines'][0] == block['lines'][-1]):
282 block['type'] = 'table'
294 block['type'] = 'table'
283 block['header'] = False
295 block['header'] = False
284 div = block['lines'][0]
296 div = block['lines'][0]
285
297
286 # column markers are ASCII so we can calculate column
298 # column markers are ASCII so we can calculate column
287 # position in bytes
299 # position in bytes
288 columns = [x for x in xrange(len(div))
300 columns = [x for x in xrange(len(div))
289 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
301 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
290 rows = []
302 rows = []
291 for l in block['lines'][1:-1]:
303 for l in block['lines'][1:-1]:
292 if l == div:
304 if l == div:
293 block['header'] = True
305 block['header'] = True
294 continue
306 continue
295 row = []
307 row = []
296 # we measure columns not in bytes or characters but in
308 # we measure columns not in bytes or characters but in
297 # colwidth which makes things tricky
309 # colwidth which makes things tricky
298 pos = columns[0] # leading whitespace is bytes
310 pos = columns[0] # leading whitespace is bytes
299 for n, start in enumerate(columns):
311 for n, start in enumerate(columns):
300 if n + 1 < len(columns):
312 if n + 1 < len(columns):
301 width = columns[n + 1] - start
313 width = columns[n + 1] - start
302 v = encoding.getcols(l, pos, width) # gather columns
314 v = encoding.getcols(l, pos, width) # gather columns
303 pos += len(v) # calculate byte position of end
315 pos += len(v) # calculate byte position of end
304 row.append(v.strip())
316 row.append(v.strip())
305 else:
317 else:
306 row.append(l[pos:].strip())
318 row.append(l[pos:].strip())
307 rows.append(row)
319 rows.append(row)
308
320
309 block['table'] = rows
321 block['table'] = rows
310
322
311 return blocks
323 return blocks
312
324
313 def findsections(blocks):
325 def findsections(blocks):
314 """Finds sections.
326 """Finds sections.
315
327
316 The blocks must have a 'type' field, i.e., they should have been
328 The blocks must have a 'type' field, i.e., they should have been
317 run through findliteralblocks first.
329 run through findliteralblocks first.
318 """
330 """
319 for block in blocks:
331 for block in blocks:
320 # Searching for a block that looks like this:
332 # Searching for a block that looks like this:
321 #
333 #
322 # +------------------------------+
334 # +------------------------------+
323 # | Section title |
335 # | Section title |
324 # | ------------- |
336 # | ------------- |
325 # +------------------------------+
337 # +------------------------------+
326 if (block['type'] == 'paragraph' and
338 if (block['type'] == 'paragraph' and
327 len(block['lines']) == 2 and
339 len(block['lines']) == 2 and
328 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
340 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
329 _sectionre.match(block['lines'][1])):
341 _sectionre.match(block['lines'][1])):
330 block['underline'] = block['lines'][1][0]
342 block['underline'] = block['lines'][1][0]
331 block['type'] = 'section'
343 block['type'] = 'section'
332 del block['lines'][1]
344 del block['lines'][1]
333 return blocks
345 return blocks
334
346
335 def inlineliterals(blocks):
347 def inlineliterals(blocks):
336 substs = [('``', '"')]
348 substs = [('``', '"')]
337 for b in blocks:
349 for b in blocks:
338 if b['type'] in ('paragraph', 'section'):
350 if b['type'] in ('paragraph', 'section'):
339 b['lines'] = [replace(l, substs) for l in b['lines']]
351 b['lines'] = [replace(l, substs) for l in b['lines']]
340 return blocks
352 return blocks
341
353
342 def hgrole(blocks):
354 def hgrole(blocks):
343 substs = [(':hg:`', '"hg '), ('`', '"')]
355 substs = [(':hg:`', '"hg '), ('`', '"')]
344 for b in blocks:
356 for b in blocks:
345 if b['type'] in ('paragraph', 'section'):
357 if b['type'] in ('paragraph', 'section'):
346 # Turn :hg:`command` into "hg command". This also works
358 # Turn :hg:`command` into "hg command". This also works
347 # when there is a line break in the command and relies on
359 # when there is a line break in the command and relies on
348 # the fact that we have no stray back-quotes in the input
360 # the fact that we have no stray back-quotes in the input
349 # (run the blocks through inlineliterals first).
361 # (run the blocks through inlineliterals first).
350 b['lines'] = [replace(l, substs) for l in b['lines']]
362 b['lines'] = [replace(l, substs) for l in b['lines']]
351 return blocks
363 return blocks
352
364
353 def addmargins(blocks):
365 def addmargins(blocks):
354 """Adds empty blocks for vertical spacing.
366 """Adds empty blocks for vertical spacing.
355
367
356 This groups bullets, options, and definitions together with no vertical
368 This groups bullets, options, and definitions together with no vertical
357 space between them, and adds an empty block between all other blocks.
369 space between them, and adds an empty block between all other blocks.
358 """
370 """
359 i = 1
371 i = 1
360 while i < len(blocks):
372 while i < len(blocks):
361 if (blocks[i]['type'] == blocks[i - 1]['type'] and
373 if (blocks[i]['type'] == blocks[i - 1]['type'] and
362 blocks[i]['type'] in ('bullet', 'option', 'field')):
374 blocks[i]['type'] in ('bullet', 'option', 'field')):
363 i += 1
375 i += 1
364 else:
376 else:
365 blocks.insert(i, dict(lines=[''], indent=0, type='margin'))
377 blocks.insert(i, dict(lines=[''], indent=0, type='margin'))
366 i += 2
378 i += 2
367 return blocks
379 return blocks
368
380
369 def prunecomments(blocks):
381 def prunecomments(blocks):
370 """Remove comments."""
382 """Remove comments."""
371 i = 0
383 i = 0
372 while i < len(blocks):
384 while i < len(blocks):
373 b = blocks[i]
385 b = blocks[i]
374 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
386 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
375 b['lines'] == ['..']):
387 b['lines'] == ['..']):
376 del blocks[i]
388 del blocks[i]
377 if i < len(blocks) and blocks[i]['type'] == 'margin':
389 if i < len(blocks) and blocks[i]['type'] == 'margin':
378 del blocks[i]
390 del blocks[i]
379 else:
391 else:
380 i += 1
392 i += 1
381 return blocks
393 return blocks
382
394
383 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
395 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
384 r"error|hint|important|note|tip|warning)::",
396 r"error|hint|important|note|tip|warning)::",
385 flags=re.IGNORECASE)
397 flags=re.IGNORECASE)
386
398
387 def findadmonitions(blocks):
399 def findadmonitions(blocks):
388 """
400 """
389 Makes the type of the block an admonition block if
401 Makes the type of the block an admonition block if
390 the first line is an admonition directive
402 the first line is an admonition directive
391 """
403 """
392 i = 0
404 i = 0
393 while i < len(blocks):
405 while i < len(blocks):
394 m = _admonitionre.match(blocks[i]['lines'][0])
406 m = _admonitionre.match(blocks[i]['lines'][0])
395 if m:
407 if m:
396 blocks[i]['type'] = 'admonition'
408 blocks[i]['type'] = 'admonition'
397 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
409 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
398
410
399 firstline = blocks[i]['lines'][0][m.end() + 1:]
411 firstline = blocks[i]['lines'][0][m.end() + 1:]
400 if firstline:
412 if firstline:
401 blocks[i]['lines'].insert(1, ' ' + firstline)
413 blocks[i]['lines'].insert(1, ' ' + firstline)
402
414
403 blocks[i]['admonitiontitle'] = admonitiontitle
415 blocks[i]['admonitiontitle'] = admonitiontitle
404 del blocks[i]['lines'][0]
416 del blocks[i]['lines'][0]
405 i = i + 1
417 i = i + 1
406 return blocks
418 return blocks
407
419
408 _admonitiontitles = {'attention': _('Attention:'),
420 _admonitiontitles = {'attention': _('Attention:'),
409 'caution': _('Caution:'),
421 'caution': _('Caution:'),
410 'danger': _('!Danger!') ,
422 'danger': _('!Danger!') ,
411 'error': _('Error:'),
423 'error': _('Error:'),
412 'hint': _('Hint:'),
424 'hint': _('Hint:'),
413 'important': _('Important:'),
425 'important': _('Important:'),
414 'note': _('Note:'),
426 'note': _('Note:'),
415 'tip': _('Tip:'),
427 'tip': _('Tip:'),
416 'warning': _('Warning!')}
428 'warning': _('Warning!')}
417
429
418 def formatoption(block, width):
430 def formatoption(block, width):
419 desc = ' '.join(map(str.strip, block['lines']))
431 desc = ' '.join(map(str.strip, block['lines']))
420 colwidth = encoding.colwidth(block['optstr'])
432 colwidth = encoding.colwidth(block['optstr'])
421 usablewidth = width - 1
433 usablewidth = width - 1
422 hanging = block['optstrwidth']
434 hanging = block['optstrwidth']
423 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
435 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
424 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
436 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
425 return ' %s\n' % (util.wrap(desc, usablewidth,
437 return ' %s\n' % (util.wrap(desc, usablewidth,
426 initindent=initindent,
438 initindent=initindent,
427 hangindent=hangindent))
439 hangindent=hangindent))
428
440
429 def formatblock(block, width):
441 def formatblock(block, width):
430 """Format a block according to width."""
442 """Format a block according to width."""
431 if width <= 0:
443 if width <= 0:
432 width = 78
444 width = 78
433 indent = ' ' * block['indent']
445 indent = ' ' * block['indent']
434 if block['type'] == 'admonition':
446 if block['type'] == 'admonition':
435 admonition = _admonitiontitles[block['admonitiontitle']]
447 admonition = _admonitiontitles[block['admonitiontitle']]
436 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
448 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
437
449
438 defindent = indent + hang * ' '
450 defindent = indent + hang * ' '
439 text = ' '.join(map(str.strip, block['lines']))
451 text = ' '.join(map(str.strip, block['lines']))
440 return '%s\n%s\n' % (indent + admonition,
452 return '%s\n%s\n' % (indent + admonition,
441 util.wrap(text, width=width,
453 util.wrap(text, width=width,
442 initindent=defindent,
454 initindent=defindent,
443 hangindent=defindent))
455 hangindent=defindent))
444 if block['type'] == 'margin':
456 if block['type'] == 'margin':
445 return '\n'
457 return '\n'
446 if block['type'] == 'literal':
458 if block['type'] == 'literal':
447 indent += ' '
459 indent += ' '
448 return indent + ('\n' + indent).join(block['lines']) + '\n'
460 return indent + ('\n' + indent).join(block['lines']) + '\n'
449 if block['type'] == 'section':
461 if block['type'] == 'section':
450 underline = encoding.colwidth(block['lines'][0]) * block['underline']
462 underline = encoding.colwidth(block['lines'][0]) * block['underline']
451 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
463 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
452 if block['type'] == 'table':
464 if block['type'] == 'table':
453 table = block['table']
465 table = block['table']
454 # compute column widths
466 # compute column widths
455 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
467 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
456 text = ''
468 text = ''
457 span = sum(widths) + len(widths) - 1
469 span = sum(widths) + len(widths) - 1
458 indent = ' ' * block['indent']
470 indent = ' ' * block['indent']
459 hang = ' ' * (len(indent) + span - widths[-1])
471 hang = ' ' * (len(indent) + span - widths[-1])
460
472
461 for row in table:
473 for row in table:
462 l = []
474 l = []
463 for w, v in zip(widths, row):
475 for w, v in zip(widths, row):
464 pad = ' ' * (w - encoding.colwidth(v))
476 pad = ' ' * (w - encoding.colwidth(v))
465 l.append(v + pad)
477 l.append(v + pad)
466 l = ' '.join(l)
478 l = ' '.join(l)
467 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
479 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
468 if not text and block['header']:
480 if not text and block['header']:
469 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
481 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
470 else:
482 else:
471 text += l + "\n"
483 text += l + "\n"
472 return text
484 return text
473 if block['type'] == 'definition':
485 if block['type'] == 'definition':
474 term = indent + block['lines'][0]
486 term = indent + block['lines'][0]
475 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
487 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
476 defindent = indent + hang * ' '
488 defindent = indent + hang * ' '
477 text = ' '.join(map(str.strip, block['lines'][1:]))
489 text = ' '.join(map(str.strip, block['lines'][1:]))
478 return '%s\n%s\n' % (term, util.wrap(text, width=width,
490 return '%s\n%s\n' % (term, util.wrap(text, width=width,
479 initindent=defindent,
491 initindent=defindent,
480 hangindent=defindent))
492 hangindent=defindent))
481 subindent = indent
493 subindent = indent
482 if block['type'] == 'bullet':
494 if block['type'] == 'bullet':
483 if block['lines'][0].startswith('| '):
495 if block['lines'][0].startswith('| '):
484 # Remove bullet for line blocks and add no extra
496 # Remove bullet for line blocks and add no extra
485 # indention.
497 # indention.
486 block['lines'][0] = block['lines'][0][2:]
498 block['lines'][0] = block['lines'][0][2:]
487 else:
499 else:
488 m = _bulletre.match(block['lines'][0])
500 m = _bulletre.match(block['lines'][0])
489 subindent = indent + m.end() * ' '
501 subindent = indent + m.end() * ' '
490 elif block['type'] == 'field':
502 elif block['type'] == 'field':
491 key = block['key']
503 key = block['key']
492 subindent = indent + _fieldwidth * ' '
504 subindent = indent + _fieldwidth * ' '
493 if len(key) + 2 > _fieldwidth:
505 if len(key) + 2 > _fieldwidth:
494 # key too large, use full line width
506 # key too large, use full line width
495 key = key.ljust(width)
507 key = key.ljust(width)
496 else:
508 else:
497 # key fits within field width
509 # key fits within field width
498 key = key.ljust(_fieldwidth)
510 key = key.ljust(_fieldwidth)
499 block['lines'][0] = key + block['lines'][0]
511 block['lines'][0] = key + block['lines'][0]
500 elif block['type'] == 'option':
512 elif block['type'] == 'option':
501 return formatoption(block, width)
513 return formatoption(block, width)
502
514
503 text = ' '.join(map(str.strip, block['lines']))
515 text = ' '.join(map(str.strip, block['lines']))
504 return util.wrap(text, width=width,
516 return util.wrap(text, width=width,
505 initindent=indent,
517 initindent=indent,
506 hangindent=subindent) + '\n'
518 hangindent=subindent) + '\n'
507
519
508 def formathtml(blocks):
520 def formathtml(blocks):
509 """Format RST blocks as HTML"""
521 """Format RST blocks as HTML"""
510
522
511 out = []
523 out = []
512 headernest = ''
524 headernest = ''
513 listnest = []
525 listnest = []
514
526
515 def openlist(start, level):
527 def openlist(start, level):
516 if not listnest or listnest[-1][0] != start:
528 if not listnest or listnest[-1][0] != start:
517 listnest.append((start, level))
529 listnest.append((start, level))
518 out.append('<%s>\n' % start)
530 out.append('<%s>\n' % start)
519
531
520 blocks = [b for b in blocks if b['type'] != 'margin']
532 blocks = [b for b in blocks if b['type'] != 'margin']
521
533
522 for pos, b in enumerate(blocks):
534 for pos, b in enumerate(blocks):
523 btype = b['type']
535 btype = b['type']
524 level = b['indent']
536 level = b['indent']
525 lines = b['lines']
537 lines = b['lines']
526
538
527 if btype == 'admonition':
539 if btype == 'admonition':
528 admonition = _admonitiontitles[b['admonitiontitle']]
540 admonition = _admonitiontitles[b['admonitiontitle']]
529 text = ' '.join(map(str.strip, lines))
541 text = ' '.join(map(str.strip, lines))
530 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
542 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
531 elif btype == 'paragraph':
543 elif btype == 'paragraph':
532 out.append('<p>\n%s\n</p>\n' % '\n'.join(lines))
544 out.append('<p>\n%s\n</p>\n' % '\n'.join(lines))
533 elif btype == 'margin':
545 elif btype == 'margin':
534 pass
546 pass
535 elif btype == 'literal':
547 elif btype == 'literal':
536 out.append('<pre>\n%s\n</pre>\n' % '\n'.join(lines))
548 out.append('<pre>\n%s\n</pre>\n' % '\n'.join(lines))
537 elif btype == 'section':
549 elif btype == 'section':
538 i = b['underline']
550 i = b['underline']
539 if i not in headernest:
551 if i not in headernest:
540 headernest += i
552 headernest += i
541 level = headernest.index(i) + 1
553 level = headernest.index(i) + 1
542 out.append('<h%d>%s</h%d>\n' % (level, lines[0], level))
554 out.append('<h%d>%s</h%d>\n' % (level, lines[0], level))
543 elif btype == 'table':
555 elif btype == 'table':
544 table = b['table']
556 table = b['table']
545 t = []
557 t = []
546 for row in table:
558 for row in table:
547 l = []
559 l = []
548 for v in zip(row):
560 for v in zip(row):
549 if not t:
561 if not t:
550 l.append('<th>%s</th>' % v)
562 l.append('<th>%s</th>' % v)
551 else:
563 else:
552 l.append('<td>%s</td>' % v)
564 l.append('<td>%s</td>' % v)
553 t.append(' <tr>%s</tr>\n' % ''.join(l))
565 t.append(' <tr>%s</tr>\n' % ''.join(l))
554 out.append('<table>\n%s</table>\n' % ''.join(t))
566 out.append('<table>\n%s</table>\n' % ''.join(t))
555 elif btype == 'definition':
567 elif btype == 'definition':
556 openlist('dl', level)
568 openlist('dl', level)
557 term = lines[0]
569 term = lines[0]
558 text = ' '.join(map(str.strip, lines[1:]))
570 text = ' '.join(map(str.strip, lines[1:]))
559 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
571 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
560 elif btype == 'bullet':
572 elif btype == 'bullet':
561 bullet, head = lines[0].split(' ', 1)
573 bullet, head = lines[0].split(' ', 1)
562 if bullet == '-':
574 if bullet == '-':
563 openlist('ul', level)
575 openlist('ul', level)
564 else:
576 else:
565 openlist('ol', level)
577 openlist('ol', level)
566 out.append(' <li> %s\n' % ' '.join([head] + lines[1:]))
578 out.append(' <li> %s\n' % ' '.join([head] + lines[1:]))
567 elif btype == 'field':
579 elif btype == 'field':
568 openlist('dl', level)
580 openlist('dl', level)
569 key = b['key']
581 key = b['key']
570 text = ' '.join(map(str.strip, lines))
582 text = ' '.join(map(str.strip, lines))
571 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
583 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
572 elif btype == 'option':
584 elif btype == 'option':
573 openlist('dl', level)
585 openlist('dl', level)
574 opt = b['optstr']
586 opt = b['optstr']
575 desc = ' '.join(map(str.strip, lines))
587 desc = ' '.join(map(str.strip, lines))
576 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
588 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
577
589
578 # close lists if indent level of next block is lower
590 # close lists if indent level of next block is lower
579 if listnest:
591 if listnest:
580 start, level = listnest[-1]
592 start, level = listnest[-1]
581 if pos == len(blocks) - 1:
593 if pos == len(blocks) - 1:
582 out.append('</%s>\n' % start)
594 out.append('</%s>\n' % start)
583 listnest.pop()
595 listnest.pop()
584 else:
596 else:
585 nb = blocks[pos + 1]
597 nb = blocks[pos + 1]
586 ni = nb['indent']
598 ni = nb['indent']
587 if (ni < level or
599 if (ni < level or
588 (ni == level and
600 (ni == level and
589 nb['type'] not in 'definition bullet field option')):
601 nb['type'] not in 'definition bullet field option')):
590 out.append('</%s>\n' % start)
602 out.append('</%s>\n' % start)
591 listnest.pop()
603 listnest.pop()
592
604
593 return ''.join(out)
605 return ''.join(out)
594
606
595 def parse(text, indent=0, keep=None):
607 def parse(text, indent=0, keep=None):
596 """Parse text into a list of blocks"""
608 """Parse text into a list of blocks"""
597 pruned = []
609 pruned = []
598 blocks = findblocks(text)
610 blocks = findblocks(text)
599 for b in blocks:
611 for b in blocks:
600 b['indent'] += indent
612 b['indent'] += indent
601 blocks = findliteralblocks(blocks)
613 blocks = findliteralblocks(blocks)
602 blocks = findtables(blocks)
614 blocks = findtables(blocks)
603 blocks, pruned = prunecontainers(blocks, keep or [])
615 blocks, pruned = prunecontainers(blocks, keep or [])
604 blocks = findsections(blocks)
616 blocks = findsections(blocks)
605 blocks = inlineliterals(blocks)
617 blocks = inlineliterals(blocks)
606 blocks = hgrole(blocks)
618 blocks = hgrole(blocks)
607 blocks = splitparagraphs(blocks)
619 blocks = splitparagraphs(blocks)
608 blocks = updatefieldlists(blocks)
620 blocks = updatefieldlists(blocks)
609 blocks = updateoptionlists(blocks)
621 blocks = updateoptionlists(blocks)
610 blocks = addmargins(blocks)
622 blocks = addmargins(blocks)
611 blocks = prunecomments(blocks)
623 blocks = prunecomments(blocks)
612 blocks = findadmonitions(blocks)
624 blocks = findadmonitions(blocks)
613 return blocks, pruned
625 return blocks, pruned
614
626
615 def formatblocks(blocks, width):
627 def formatblocks(blocks, width):
616 text = ''.join(formatblock(b, width) for b in blocks)
628 text = ''.join(formatblock(b, width) for b in blocks)
617 return text
629 return text
618
630
619 def format(text, width=80, indent=0, keep=None, style='plain'):
631 def format(text, width=80, indent=0, keep=None, style='plain'):
620 """Parse and format the text according to width."""
632 """Parse and format the text according to width."""
621 blocks, pruned = parse(text, indent, keep or [])
633 blocks, pruned = parse(text, indent, keep or [])
622 if style == 'html':
634 if style == 'html':
623 text = formathtml(blocks)
635 text = formathtml(blocks)
624 else:
636 else:
625 text = ''.join(formatblock(b, width) for b in blocks)
637 text = ''.join(formatblock(b, width) for b in blocks)
626 if keep is None:
638 if keep is None:
627 return text
639 return text
628 else:
640 else:
629 return text, pruned
641 return text, pruned
630
642
631 def getsections(blocks):
643 def getsections(blocks):
632 '''return a list of (section name, nesting level, blocks) tuples'''
644 '''return a list of (section name, nesting level, blocks) tuples'''
633 nest = ""
645 nest = ""
634 level = 0
646 level = 0
635 secs = []
647 secs = []
636 for b in blocks:
648 for b in blocks:
637 if b['type'] == 'section':
649 if b['type'] == 'section':
638 i = b['underline']
650 i = b['underline']
639 if i not in nest:
651 if i not in nest:
640 nest += i
652 nest += i
641 level = nest.index(i) + 1
653 level = nest.index(i) + 1
642 nest = nest[:level]
654 nest = nest[:level]
643 secs.append((b['lines'][0], level, [b]))
655 secs.append((b['lines'][0], level, [b]))
644 else:
656 else:
645 if not secs:
657 if not secs:
646 # add an initial empty section
658 # add an initial empty section
647 secs = [('', 0, [])]
659 secs = [('', 0, [])]
648 secs[-1][2].append(b)
660 secs[-1][2].append(b)
649 return secs
661 return secs
650
662
651 def decorateblocks(blocks, width):
663 def decorateblocks(blocks, width):
652 '''generate a list of (section name, line text) pairs for search'''
664 '''generate a list of (section name, line text) pairs for search'''
653 lines = []
665 lines = []
654 for s in getsections(blocks):
666 for s in getsections(blocks):
655 section = s[0]
667 section = s[0]
656 text = formatblocks(s[2], width)
668 text = formatblocks(s[2], width)
657 lines.append([(section, l) for l in text.splitlines(True)])
669 lines.append([(section, l) for l in text.splitlines(True)])
658 return lines
670 return lines
659
671
660 def maketable(data, indent=0, header=False):
672 def maketable(data, indent=0, header=False):
661 '''Generate an RST table for the given table data as a list of lines'''
673 '''Generate an RST table for the given table data as a list of lines'''
662
674
663 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
675 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
664 indent = ' ' * indent
676 indent = ' ' * indent
665 div = indent + ' '.join('=' * w for w in widths) + '\n'
677 div = indent + ' '.join('=' * w for w in widths) + '\n'
666
678
667 out = [div]
679 out = [div]
668 for row in data:
680 for row in data:
669 l = []
681 l = []
670 for w, v in zip(widths, row):
682 for w, v in zip(widths, row):
671 pad = ' ' * (w - encoding.colwidth(v))
683 pad = ' ' * (w - encoding.colwidth(v))
672 l.append(v + pad)
684 l.append(v + pad)
673 out.append(indent + ' '.join(l) + "\n")
685 out.append(indent + ' '.join(l) + "\n")
674 if header and len(data) > 1:
686 if header and len(data) > 1:
675 out.insert(2, div)
687 out.insert(2, div)
676 out.append(div)
688 out.append(div)
677 return out
689 return out
@@ -1,574 +1,575
1 Test basic extension support
1 Test basic extension support
2
2
3 $ cat > foobar.py <<EOF
3 $ cat > foobar.py <<EOF
4 > import os
4 > import os
5 > from mercurial import commands
5 > from mercurial import commands
6 >
6 >
7 > def uisetup(ui):
7 > def uisetup(ui):
8 > ui.write("uisetup called\\n")
8 > ui.write("uisetup called\\n")
9 >
9 >
10 > def reposetup(ui, repo):
10 > def reposetup(ui, repo):
11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
13 >
13 >
14 > def foo(ui, *args, **kwargs):
14 > def foo(ui, *args, **kwargs):
15 > ui.write("Foo\\n")
15 > ui.write("Foo\\n")
16 >
16 >
17 > def bar(ui, *args, **kwargs):
17 > def bar(ui, *args, **kwargs):
18 > ui.write("Bar\\n")
18 > ui.write("Bar\\n")
19 >
19 >
20 > cmdtable = {
20 > cmdtable = {
21 > "foo": (foo, [], "hg foo"),
21 > "foo": (foo, [], "hg foo"),
22 > "bar": (bar, [], "hg bar"),
22 > "bar": (bar, [], "hg bar"),
23 > }
23 > }
24 >
24 >
25 > commands.norepo += ' bar'
25 > commands.norepo += ' bar'
26 > EOF
26 > EOF
27 $ abspath=`pwd`/foobar.py
27 $ abspath=`pwd`/foobar.py
28
28
29 $ mkdir barfoo
29 $ mkdir barfoo
30 $ cp foobar.py barfoo/__init__.py
30 $ cp foobar.py barfoo/__init__.py
31 $ barfoopath=`pwd`/barfoo
31 $ barfoopath=`pwd`/barfoo
32
32
33 $ hg init a
33 $ hg init a
34 $ cd a
34 $ cd a
35 $ echo foo > file
35 $ echo foo > file
36 $ hg add file
36 $ hg add file
37 $ hg commit -m 'add file'
37 $ hg commit -m 'add file'
38
38
39 $ echo '[extensions]' >> $HGRCPATH
39 $ echo '[extensions]' >> $HGRCPATH
40 $ echo "foobar = $abspath" >> $HGRCPATH
40 $ echo "foobar = $abspath" >> $HGRCPATH
41 $ hg foo
41 $ hg foo
42 uisetup called
42 uisetup called
43 reposetup called for a
43 reposetup called for a
44 ui == repo.ui
44 ui == repo.ui
45 Foo
45 Foo
46
46
47 $ cd ..
47 $ cd ..
48 $ hg clone a b
48 $ hg clone a b
49 uisetup called
49 uisetup called
50 reposetup called for a
50 reposetup called for a
51 ui == repo.ui
51 ui == repo.ui
52 reposetup called for b
52 reposetup called for b
53 ui == repo.ui
53 ui == repo.ui
54 updating to branch default
54 updating to branch default
55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
56
56
57 $ hg bar
57 $ hg bar
58 uisetup called
58 uisetup called
59 Bar
59 Bar
60 $ echo 'foobar = !' >> $HGRCPATH
60 $ echo 'foobar = !' >> $HGRCPATH
61
61
62 module/__init__.py-style
62 module/__init__.py-style
63
63
64 $ echo "barfoo = $barfoopath" >> $HGRCPATH
64 $ echo "barfoo = $barfoopath" >> $HGRCPATH
65 $ cd a
65 $ cd a
66 $ hg foo
66 $ hg foo
67 uisetup called
67 uisetup called
68 reposetup called for a
68 reposetup called for a
69 ui == repo.ui
69 ui == repo.ui
70 Foo
70 Foo
71 $ echo 'barfoo = !' >> $HGRCPATH
71 $ echo 'barfoo = !' >> $HGRCPATH
72
72
73 Check that extensions are loaded in phases:
73 Check that extensions are loaded in phases:
74
74
75 $ cat > foo.py <<EOF
75 $ cat > foo.py <<EOF
76 > import os
76 > import os
77 > name = os.path.basename(__file__).rsplit('.', 1)[0]
77 > name = os.path.basename(__file__).rsplit('.', 1)[0]
78 > print "1) %s imported" % name
78 > print "1) %s imported" % name
79 > def uisetup(ui):
79 > def uisetup(ui):
80 > print "2) %s uisetup" % name
80 > print "2) %s uisetup" % name
81 > def extsetup():
81 > def extsetup():
82 > print "3) %s extsetup" % name
82 > print "3) %s extsetup" % name
83 > def reposetup(ui, repo):
83 > def reposetup(ui, repo):
84 > print "4) %s reposetup" % name
84 > print "4) %s reposetup" % name
85 > EOF
85 > EOF
86
86
87 $ cp foo.py bar.py
87 $ cp foo.py bar.py
88 $ echo 'foo = foo.py' >> $HGRCPATH
88 $ echo 'foo = foo.py' >> $HGRCPATH
89 $ echo 'bar = bar.py' >> $HGRCPATH
89 $ echo 'bar = bar.py' >> $HGRCPATH
90
90
91 Command with no output, we just want to see the extensions loaded:
91 Command with no output, we just want to see the extensions loaded:
92
92
93 $ hg paths
93 $ hg paths
94 1) foo imported
94 1) foo imported
95 1) bar imported
95 1) bar imported
96 2) foo uisetup
96 2) foo uisetup
97 2) bar uisetup
97 2) bar uisetup
98 3) foo extsetup
98 3) foo extsetup
99 3) bar extsetup
99 3) bar extsetup
100 4) foo reposetup
100 4) foo reposetup
101 4) bar reposetup
101 4) bar reposetup
102
102
103 Check hgweb's load order:
103 Check hgweb's load order:
104
104
105 $ cat > hgweb.cgi <<EOF
105 $ cat > hgweb.cgi <<EOF
106 > #!/usr/bin/env python
106 > #!/usr/bin/env python
107 > from mercurial import demandimport; demandimport.enable()
107 > from mercurial import demandimport; demandimport.enable()
108 > from mercurial.hgweb import hgweb
108 > from mercurial.hgweb import hgweb
109 > from mercurial.hgweb import wsgicgi
109 > from mercurial.hgweb import wsgicgi
110 >
110 >
111 > application = hgweb('.', 'test repo')
111 > application = hgweb('.', 'test repo')
112 > wsgicgi.launch(application)
112 > wsgicgi.launch(application)
113 > EOF
113 > EOF
114
114
115 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
115 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
116 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
116 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
117 > | grep '^[0-9]) ' # ignores HTML output
117 > | grep '^[0-9]) ' # ignores HTML output
118 1) foo imported
118 1) foo imported
119 1) bar imported
119 1) bar imported
120 2) foo uisetup
120 2) foo uisetup
121 2) bar uisetup
121 2) bar uisetup
122 3) foo extsetup
122 3) foo extsetup
123 3) bar extsetup
123 3) bar extsetup
124 4) foo reposetup
124 4) foo reposetup
125 4) bar reposetup
125 4) bar reposetup
126 4) foo reposetup
126 4) foo reposetup
127 4) bar reposetup
127 4) bar reposetup
128
128
129 $ echo 'foo = !' >> $HGRCPATH
129 $ echo 'foo = !' >> $HGRCPATH
130 $ echo 'bar = !' >> $HGRCPATH
130 $ echo 'bar = !' >> $HGRCPATH
131
131
132 $ cd ..
132 $ cd ..
133
133
134 hide outer repo
134 hide outer repo
135 $ hg init
135 $ hg init
136
136
137 $ cat > empty.py <<EOF
137 $ cat > empty.py <<EOF
138 > '''empty cmdtable
138 > '''empty cmdtable
139 > '''
139 > '''
140 > cmdtable = {}
140 > cmdtable = {}
141 > EOF
141 > EOF
142 $ emptypath=`pwd`/empty.py
142 $ emptypath=`pwd`/empty.py
143 $ echo "empty = $emptypath" >> $HGRCPATH
143 $ echo "empty = $emptypath" >> $HGRCPATH
144 $ hg help empty
144 $ hg help empty
145 empty extension - empty cmdtable
145 empty extension - empty cmdtable
146
146
147 no commands defined
147 no commands defined
148
148
149 $ echo 'empty = !' >> $HGRCPATH
149 $ echo 'empty = !' >> $HGRCPATH
150
150
151 $ cat > debugextension.py <<EOF
151 $ cat > debugextension.py <<EOF
152 > '''only debugcommands
152 > '''only debugcommands
153 > '''
153 > '''
154 > def debugfoobar(ui, repo, *args, **opts):
154 > def debugfoobar(ui, repo, *args, **opts):
155 > "yet another debug command"
155 > "yet another debug command"
156 > pass
156 > pass
157 >
157 >
158 > def foo(ui, repo, *args, **opts):
158 > def foo(ui, repo, *args, **opts):
159 > """yet another foo command
159 > """yet another foo command
160 >
160 >
161 > This command has been DEPRECATED since forever.
161 > This command has been DEPRECATED since forever.
162 > """
162 > """
163 > pass
163 > pass
164 >
164 >
165 > cmdtable = {
165 > cmdtable = {
166 > "debugfoobar": (debugfoobar, (), "hg debugfoobar"),
166 > "debugfoobar": (debugfoobar, (), "hg debugfoobar"),
167 > "foo": (foo, (), "hg foo")
167 > "foo": (foo, (), "hg foo")
168 > }
168 > }
169 > EOF
169 > EOF
170 $ debugpath=`pwd`/debugextension.py
170 $ debugpath=`pwd`/debugextension.py
171 $ echo "debugextension = $debugpath" >> $HGRCPATH
171 $ echo "debugextension = $debugpath" >> $HGRCPATH
172
172
173 $ hg help debugextension
173 $ hg help debugextension
174 debugextension extension - only debugcommands
174 debugextension extension - only debugcommands
175
175
176 no commands defined
176 no commands defined
177
177
178 $ hg --verbose help debugextension
178 $ hg --verbose help debugextension
179 debugextension extension - only debugcommands
179 debugextension extension - only debugcommands
180
180
181 list of commands:
181 list of commands:
182
182
183 foo yet another foo command
183 foo yet another foo command
184
184
185 global options:
185 global options:
186
186
187 -R --repository REPO repository root directory or name of overlay bundle
187 -R --repository REPO repository root directory or name of overlay bundle
188 file
188 file
189 --cwd DIR change working directory
189 --cwd DIR change working directory
190 -y --noninteractive do not prompt, automatically pick the first choice for
190 -y --noninteractive do not prompt, automatically pick the first choice for
191 all prompts
191 all prompts
192 -q --quiet suppress output
192 -q --quiet suppress output
193 -v --verbose enable additional output
193 -v --verbose enable additional output
194 --config CONFIG [+] set/override config option (use 'section.name=value')
194 --config CONFIG [+] set/override config option (use 'section.name=value')
195 --debug enable debugging output
195 --debug enable debugging output
196 --debugger start debugger
196 --debugger start debugger
197 --encoding ENCODE set the charset encoding (default: ascii)
197 --encoding ENCODE set the charset encoding (default: ascii)
198 --encodingmode MODE set the charset encoding mode (default: strict)
198 --encodingmode MODE set the charset encoding mode (default: strict)
199 --traceback always print a traceback on exception
199 --traceback always print a traceback on exception
200 --time time how long the command takes
200 --time time how long the command takes
201 --profile print command execution profile
201 --profile print command execution profile
202 --version output version information and exit
202 --version output version information and exit
203 -h --help display help and exit
203 -h --help display help and exit
204 --hidden consider hidden changesets
204 --hidden consider hidden changesets
205
205
206 [+] marked option can be specified multiple times
206 [+] marked option can be specified multiple times
207
207
208 $ hg --debug help debugextension
208 $ hg --debug help debugextension
209 debugextension extension - only debugcommands
209 debugextension extension - only debugcommands
210
210
211 list of commands:
211 list of commands:
212
212
213 debugfoobar yet another debug command
213 debugfoobar yet another debug command
214 foo yet another foo command
214 foo yet another foo command
215
215
216 global options:
216 global options:
217
217
218 -R --repository REPO repository root directory or name of overlay bundle
218 -R --repository REPO repository root directory or name of overlay bundle
219 file
219 file
220 --cwd DIR change working directory
220 --cwd DIR change working directory
221 -y --noninteractive do not prompt, automatically pick the first choice for
221 -y --noninteractive do not prompt, automatically pick the first choice for
222 all prompts
222 all prompts
223 -q --quiet suppress output
223 -q --quiet suppress output
224 -v --verbose enable additional output
224 -v --verbose enable additional output
225 --config CONFIG [+] set/override config option (use 'section.name=value')
225 --config CONFIG [+] set/override config option (use 'section.name=value')
226 --debug enable debugging output
226 --debug enable debugging output
227 --debugger start debugger
227 --debugger start debugger
228 --encoding ENCODE set the charset encoding (default: ascii)
228 --encoding ENCODE set the charset encoding (default: ascii)
229 --encodingmode MODE set the charset encoding mode (default: strict)
229 --encodingmode MODE set the charset encoding mode (default: strict)
230 --traceback always print a traceback on exception
230 --traceback always print a traceback on exception
231 --time time how long the command takes
231 --time time how long the command takes
232 --profile print command execution profile
232 --profile print command execution profile
233 --version output version information and exit
233 --version output version information and exit
234 -h --help display help and exit
234 -h --help display help and exit
235 --hidden consider hidden changesets
235 --hidden consider hidden changesets
236
236
237 [+] marked option can be specified multiple times
237 [+] marked option can be specified multiple times
238 $ echo 'debugextension = !' >> $HGRCPATH
238 $ echo 'debugextension = !' >> $HGRCPATH
239
239
240 Extension module help vs command help:
240 Extension module help vs command help:
241
241
242 $ echo 'extdiff =' >> $HGRCPATH
242 $ echo 'extdiff =' >> $HGRCPATH
243 $ hg help extdiff
243 $ hg help extdiff
244 hg extdiff [OPT]... [FILE]...
244 hg extdiff [OPT]... [FILE]...
245
245
246 use external program to diff repository (or selected files)
246 use external program to diff repository (or selected files)
247
247
248 Show differences between revisions for the specified files, using an
248 Show differences between revisions for the specified files, using an
249 external program. The default program used is diff, with default options
249 external program. The default program used is diff, with default options
250 "-Npru".
250 "-Npru".
251
251
252 To select a different program, use the -p/--program option. The program
252 To select a different program, use the -p/--program option. The program
253 will be passed the names of two directories to compare. To pass additional
253 will be passed the names of two directories to compare. To pass additional
254 options to the program, use -o/--option. These will be passed before the
254 options to the program, use -o/--option. These will be passed before the
255 names of the directories to compare.
255 names of the directories to compare.
256
256
257 When two revision arguments are given, then changes are shown between
257 When two revision arguments are given, then changes are shown between
258 those revisions. If only one revision is specified then that revision is
258 those revisions. If only one revision is specified then that revision is
259 compared to the working directory, and, when no revisions are specified,
259 compared to the working directory, and, when no revisions are specified,
260 the working directory files are compared to its parent.
260 the working directory files are compared to its parent.
261
261
262 use "hg help -e extdiff" to show help for the extdiff extension
262 use "hg help -e extdiff" to show help for the extdiff extension
263
263
264 options:
264 options:
265
265
266 -p --program CMD comparison program to run
266 -p --program CMD comparison program to run
267 -o --option OPT [+] pass option to comparison program
267 -o --option OPT [+] pass option to comparison program
268 -r --rev REV [+] revision
268 -r --rev REV [+] revision
269 -c --change REV change made by revision
269 -c --change REV change made by revision
270 -I --include PATTERN [+] include names matching the given patterns
270 -I --include PATTERN [+] include names matching the given patterns
271 -X --exclude PATTERN [+] exclude names matching the given patterns
271 -X --exclude PATTERN [+] exclude names matching the given patterns
272
272
273 [+] marked option can be specified multiple times
273 [+] marked option can be specified multiple times
274
274
275 use "hg -v help extdiff" to show the global options
275 use "hg -v help extdiff" to show the global options
276
276
277 $ hg help --extension extdiff
277 $ hg help --extension extdiff
278 extdiff extension - command to allow external programs to compare revisions
278 extdiff extension - command to allow external programs to compare revisions
279
279
280 The extdiff Mercurial extension allows you to use external programs to compare
280 The extdiff Mercurial extension allows you to use external programs to compare
281 revisions, or revision with working directory. The external diff programs are
281 revisions, or revision with working directory. The external diff programs are
282 called with a configurable set of options and two non-option arguments: paths
282 called with a configurable set of options and two non-option arguments: paths
283 to directories containing snapshots of files to compare.
283 to directories containing snapshots of files to compare.
284
284
285 The extdiff extension also allows you to configure new diff commands, so you
285 The extdiff extension also allows you to configure new diff commands, so you
286 do not need to type "hg extdiff -p kdiff3" always.
286 do not need to type "hg extdiff -p kdiff3" always.
287
287
288 [extdiff]
288 [extdiff]
289 # add new command that runs GNU diff(1) in 'context diff' mode
289 # add new command that runs GNU diff(1) in 'context diff' mode
290 cdiff = gdiff -Nprc5
290 cdiff = gdiff -Nprc5
291 ## or the old way:
291 ## or the old way:
292 #cmd.cdiff = gdiff
292 #cmd.cdiff = gdiff
293 #opts.cdiff = -Nprc5
293 #opts.cdiff = -Nprc5
294
294
295 # add new command called vdiff, runs kdiff3
295 # add new command called vdiff, runs kdiff3
296 vdiff = kdiff3
296 vdiff = kdiff3
297
297
298 # add new command called meld, runs meld (no need to name twice)
298 # add new command called meld, runs meld (no need to name twice)
299 meld =
299 meld =
300
300
301 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
301 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
302 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
302 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
303 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
303 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
304 # your .vimrc
304 # your .vimrc
305 vimdiff = gvim -f "+next" \
305 vimdiff = gvim -f "+next" \
306 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
306 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
307
307
308 Tool arguments can include variables that are expanded at runtime:
308 Tool arguments can include variables that are expanded at runtime:
309
309
310 $parent1, $plabel1 - filename, descriptive label of first parent
310 $parent1, $plabel1 - filename, descriptive label of first parent
311 $child, $clabel - filename, descriptive label of child revision
311 $child, $clabel - filename, descriptive label of child revision
312 $parent2, $plabel2 - filename, descriptive label of second parent
312 $parent2, $plabel2 - filename, descriptive label of second parent
313 $root - repository root
313 $root - repository root
314 $parent is an alias for $parent1.
314 $parent is an alias for $parent1.
315
315
316 The extdiff extension will look in your [diff-tools] and [merge-tools]
316 The extdiff extension will look in your [diff-tools] and [merge-tools]
317 sections for diff tool arguments, when none are specified in [extdiff].
317 sections for diff tool arguments, when none are specified in [extdiff].
318
318
319 [extdiff]
319 [extdiff]
320 kdiff3 =
320 kdiff3 =
321
321
322 [diff-tools]
322 [diff-tools]
323 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
323 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
324
324
325 You can use -I/-X and list of file or directory names like normal "hg diff"
325 You can use -I/-X and list of file or directory names like normal "hg diff"
326 command. The extdiff extension makes snapshots of only needed files, so
326 command. The extdiff extension makes snapshots of only needed files, so
327 running the external diff program will actually be pretty fast (at least
327 running the external diff program will actually be pretty fast (at least
328 faster than having to compare the entire tree).
328 faster than having to compare the entire tree).
329
329
330 list of commands:
330 list of commands:
331
331
332 extdiff use external program to diff repository (or selected files)
332 extdiff use external program to diff repository (or selected files)
333
333
334 use "hg -v help extdiff" to show builtin aliases and global options
334 use "hg -v help extdiff" to show builtin aliases and global options
335
335
336 $ echo 'extdiff = !' >> $HGRCPATH
336 $ echo 'extdiff = !' >> $HGRCPATH
337
337
338 Test help topic with same name as extension
338 Test help topic with same name as extension
339
339
340 $ cat > multirevs.py <<EOF
340 $ cat > multirevs.py <<EOF
341 > from mercurial import commands
341 > from mercurial import commands
342 > """multirevs extension
342 > """multirevs extension
343 > Big multi-line module docstring."""
343 > Big multi-line module docstring."""
344 > def multirevs(ui, repo, arg, *args, **opts):
344 > def multirevs(ui, repo, arg, *args, **opts):
345 > """multirevs command"""
345 > """multirevs command"""
346 > pass
346 > pass
347 > cmdtable = {
347 > cmdtable = {
348 > "multirevs": (multirevs, [], 'ARG')
348 > "multirevs": (multirevs, [], 'ARG')
349 > }
349 > }
350 > commands.norepo += ' multirevs'
350 > commands.norepo += ' multirevs'
351 > EOF
351 > EOF
352 $ echo "multirevs = multirevs.py" >> $HGRCPATH
352 $ echo "multirevs = multirevs.py" >> $HGRCPATH
353
353
354 $ hg help multirevs
354 $ hg help multirevs
355 Specifying Multiple Revisions
355 Specifying Multiple Revisions
356 """""""""""""""""""""""""""""
356
357
357 When Mercurial accepts more than one revision, they may be specified
358 When Mercurial accepts more than one revision, they may be specified
358 individually, or provided as a topologically continuous range, separated
359 individually, or provided as a topologically continuous range, separated
359 by the ":" character.
360 by the ":" character.
360
361
361 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
362 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
362 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
363 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
363 specified, it defaults to revision number 0. If END is not specified, it
364 specified, it defaults to revision number 0. If END is not specified, it
364 defaults to the tip. The range ":" thus means "all revisions".
365 defaults to the tip. The range ":" thus means "all revisions".
365
366
366 If BEGIN is greater than END, revisions are treated in reverse order.
367 If BEGIN is greater than END, revisions are treated in reverse order.
367
368
368 A range acts as a closed interval. This means that a range of 3:5 gives 3,
369 A range acts as a closed interval. This means that a range of 3:5 gives 3,
369 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
370 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
370
371
371 use "hg help -c multirevs" to see help for the multirevs command
372 use "hg help -c multirevs" to see help for the multirevs command
372
373
373 $ hg help -c multirevs
374 $ hg help -c multirevs
374 hg multirevs ARG
375 hg multirevs ARG
375
376
376 multirevs command
377 multirevs command
377
378
378 use "hg -v help multirevs" to show the global options
379 use "hg -v help multirevs" to show the global options
379
380
380 $ hg multirevs
381 $ hg multirevs
381 hg multirevs: invalid arguments
382 hg multirevs: invalid arguments
382 hg multirevs ARG
383 hg multirevs ARG
383
384
384 multirevs command
385 multirevs command
385
386
386 use "hg help multirevs" to show the full help text
387 use "hg help multirevs" to show the full help text
387 [255]
388 [255]
388
389
389 $ echo "multirevs = !" >> $HGRCPATH
390 $ echo "multirevs = !" >> $HGRCPATH
390
391
391 Issue811: Problem loading extensions twice (by site and by user)
392 Issue811: Problem loading extensions twice (by site and by user)
392
393
393 $ debugpath=`pwd`/debugissue811.py
394 $ debugpath=`pwd`/debugissue811.py
394 $ cat > debugissue811.py <<EOF
395 $ cat > debugissue811.py <<EOF
395 > '''show all loaded extensions
396 > '''show all loaded extensions
396 > '''
397 > '''
397 > from mercurial import extensions, commands
398 > from mercurial import extensions, commands
398 >
399 >
399 > def debugextensions(ui):
400 > def debugextensions(ui):
400 > "yet another debug command"
401 > "yet another debug command"
401 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
402 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
402 >
403 >
403 > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
404 > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
404 > commands.norepo += " debugextensions"
405 > commands.norepo += " debugextensions"
405 > EOF
406 > EOF
406 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
407 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
407 $ echo "mq=" >> $HGRCPATH
408 $ echo "mq=" >> $HGRCPATH
408 $ echo "hgext.mq=" >> $HGRCPATH
409 $ echo "hgext.mq=" >> $HGRCPATH
409 $ echo "hgext/mq=" >> $HGRCPATH
410 $ echo "hgext/mq=" >> $HGRCPATH
410
411
411 Show extensions:
412 Show extensions:
412
413
413 $ hg debugextensions
414 $ hg debugextensions
414 debugissue811
415 debugissue811
415 mq
416 mq
416
417
417 Disabled extension commands:
418 Disabled extension commands:
418
419
419 $ HGRCPATH=
420 $ HGRCPATH=
420 $ export HGRCPATH
421 $ export HGRCPATH
421 $ hg help email
422 $ hg help email
422 'email' is provided by the following extension:
423 'email' is provided by the following extension:
423
424
424 patchbomb command to send changesets as (a series of) patch emails
425 patchbomb command to send changesets as (a series of) patch emails
425
426
426 use "hg help extensions" for information on enabling extensions
427 use "hg help extensions" for information on enabling extensions
427 $ hg qdel
428 $ hg qdel
428 hg: unknown command 'qdel'
429 hg: unknown command 'qdel'
429 'qdelete' is provided by the following extension:
430 'qdelete' is provided by the following extension:
430
431
431 mq manage a stack of patches
432 mq manage a stack of patches
432
433
433 use "hg help extensions" for information on enabling extensions
434 use "hg help extensions" for information on enabling extensions
434 [255]
435 [255]
435 $ hg churn
436 $ hg churn
436 hg: unknown command 'churn'
437 hg: unknown command 'churn'
437 'churn' is provided by the following extension:
438 'churn' is provided by the following extension:
438
439
439 churn command to display statistics about repository history
440 churn command to display statistics about repository history
440
441
441 use "hg help extensions" for information on enabling extensions
442 use "hg help extensions" for information on enabling extensions
442 [255]
443 [255]
443
444
444 Disabled extensions:
445 Disabled extensions:
445
446
446 $ hg help churn
447 $ hg help churn
447 churn extension - command to display statistics about repository history
448 churn extension - command to display statistics about repository history
448
449
449 use "hg help extensions" for information on enabling extensions
450 use "hg help extensions" for information on enabling extensions
450 $ hg help patchbomb
451 $ hg help patchbomb
451 patchbomb extension - command to send changesets as (a series of) patch emails
452 patchbomb extension - command to send changesets as (a series of) patch emails
452
453
453 use "hg help extensions" for information on enabling extensions
454 use "hg help extensions" for information on enabling extensions
454
455
455 Broken disabled extension and command:
456 Broken disabled extension and command:
456
457
457 $ mkdir hgext
458 $ mkdir hgext
458 $ echo > hgext/__init__.py
459 $ echo > hgext/__init__.py
459 $ cat > hgext/broken.py <<EOF
460 $ cat > hgext/broken.py <<EOF
460 > "broken extension'
461 > "broken extension'
461 > EOF
462 > EOF
462 $ cat > path.py <<EOF
463 $ cat > path.py <<EOF
463 > import os, sys
464 > import os, sys
464 > sys.path.insert(0, os.environ['HGEXTPATH'])
465 > sys.path.insert(0, os.environ['HGEXTPATH'])
465 > EOF
466 > EOF
466 $ HGEXTPATH=`pwd`
467 $ HGEXTPATH=`pwd`
467 $ export HGEXTPATH
468 $ export HGEXTPATH
468
469
469 $ hg --config extensions.path=./path.py help broken
470 $ hg --config extensions.path=./path.py help broken
470 broken extension - (no help text available)
471 broken extension - (no help text available)
471
472
472 use "hg help extensions" for information on enabling extensions
473 use "hg help extensions" for information on enabling extensions
473
474
474 $ cat > hgext/forest.py <<EOF
475 $ cat > hgext/forest.py <<EOF
475 > cmdtable = None
476 > cmdtable = None
476 > EOF
477 > EOF
477 $ hg --config extensions.path=./path.py help foo > /dev/null
478 $ hg --config extensions.path=./path.py help foo > /dev/null
478 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
479 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
479 hg: unknown command 'foo'
480 hg: unknown command 'foo'
480 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
481 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
481 [255]
482 [255]
482
483
483 $ cat > throw.py <<EOF
484 $ cat > throw.py <<EOF
484 > from mercurial import cmdutil, commands
485 > from mercurial import cmdutil, commands
485 > cmdtable = {}
486 > cmdtable = {}
486 > command = cmdutil.command(cmdtable)
487 > command = cmdutil.command(cmdtable)
487 > class Bogon(Exception): pass
488 > class Bogon(Exception): pass
488 >
489 >
489 > @command('throw', [], 'hg throw')
490 > @command('throw', [], 'hg throw')
490 > def throw(ui, **opts):
491 > def throw(ui, **opts):
491 > """throws an exception"""
492 > """throws an exception"""
492 > raise Bogon()
493 > raise Bogon()
493 > commands.norepo += " throw"
494 > commands.norepo += " throw"
494 > EOF
495 > EOF
495 No declared supported version, extension complains:
496 No declared supported version, extension complains:
496 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
497 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
497 ** Unknown exception encountered with possibly-broken third-party extension throw
498 ** Unknown exception encountered with possibly-broken third-party extension throw
498 ** which supports versions unknown of Mercurial.
499 ** which supports versions unknown of Mercurial.
499 ** Please disable throw and try your action again.
500 ** Please disable throw and try your action again.
500 ** If that fixes the bug please report it to the extension author.
501 ** If that fixes the bug please report it to the extension author.
501 ** Python * (glob)
502 ** Python * (glob)
502 ** Mercurial Distributed SCM * (glob)
503 ** Mercurial Distributed SCM * (glob)
503 ** Extensions loaded: throw
504 ** Extensions loaded: throw
504 empty declaration of supported version, extension complains:
505 empty declaration of supported version, extension complains:
505 $ echo "testedwith = ''" >> throw.py
506 $ echo "testedwith = ''" >> throw.py
506 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
507 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
507 ** Unknown exception encountered with possibly-broken third-party extension throw
508 ** Unknown exception encountered with possibly-broken third-party extension throw
508 ** which supports versions unknown of Mercurial.
509 ** which supports versions unknown of Mercurial.
509 ** Please disable throw and try your action again.
510 ** Please disable throw and try your action again.
510 ** If that fixes the bug please report it to the extension author.
511 ** If that fixes the bug please report it to the extension author.
511 ** Python * (glob)
512 ** Python * (glob)
512 ** Mercurial Distributed SCM (*) (glob)
513 ** Mercurial Distributed SCM (*) (glob)
513 ** Extensions loaded: throw
514 ** Extensions loaded: throw
514 If the extension specifies a buglink, show that:
515 If the extension specifies a buglink, show that:
515 $ echo 'buglink = "http://example.com/bts"' >> throw.py
516 $ echo 'buglink = "http://example.com/bts"' >> throw.py
516 $ rm -f throw.pyc throw.pyo
517 $ rm -f throw.pyc throw.pyo
517 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
518 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
518 ** Unknown exception encountered with possibly-broken third-party extension throw
519 ** Unknown exception encountered with possibly-broken third-party extension throw
519 ** which supports versions unknown of Mercurial.
520 ** which supports versions unknown of Mercurial.
520 ** Please disable throw and try your action again.
521 ** Please disable throw and try your action again.
521 ** If that fixes the bug please report it to http://example.com/bts
522 ** If that fixes the bug please report it to http://example.com/bts
522 ** Python * (glob)
523 ** Python * (glob)
523 ** Mercurial Distributed SCM (*) (glob)
524 ** Mercurial Distributed SCM (*) (glob)
524 ** Extensions loaded: throw
525 ** Extensions loaded: throw
525 If the extensions declare outdated versions, accuse the older extension first:
526 If the extensions declare outdated versions, accuse the older extension first:
526 $ echo "from mercurial import util" >> older.py
527 $ echo "from mercurial import util" >> older.py
527 $ echo "util.version = lambda:'2.2'" >> older.py
528 $ echo "util.version = lambda:'2.2'" >> older.py
528 $ echo "testedwith = '1.9.3'" >> older.py
529 $ echo "testedwith = '1.9.3'" >> older.py
529 $ echo "testedwith = '2.1.1'" >> throw.py
530 $ echo "testedwith = '2.1.1'" >> throw.py
530 $ rm -f throw.pyc throw.pyo
531 $ rm -f throw.pyc throw.pyo
531 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
532 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
532 > throw 2>&1 | egrep '^\*\*'
533 > throw 2>&1 | egrep '^\*\*'
533 ** Unknown exception encountered with possibly-broken third-party extension older
534 ** Unknown exception encountered with possibly-broken third-party extension older
534 ** which supports versions 1.9.3 of Mercurial.
535 ** which supports versions 1.9.3 of Mercurial.
535 ** Please disable older and try your action again.
536 ** Please disable older and try your action again.
536 ** If that fixes the bug please report it to the extension author.
537 ** If that fixes the bug please report it to the extension author.
537 ** Python * (glob)
538 ** Python * (glob)
538 ** Mercurial Distributed SCM (version 2.2)
539 ** Mercurial Distributed SCM (version 2.2)
539 ** Extensions loaded: throw, older
540 ** Extensions loaded: throw, older
540 One extension only tested with older, one only with newer versions:
541 One extension only tested with older, one only with newer versions:
541 $ echo "util.version = lambda:'2.1.0'" >> older.py
542 $ echo "util.version = lambda:'2.1.0'" >> older.py
542 $ rm -f older.pyc older.pyo
543 $ rm -f older.pyc older.pyo
543 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
544 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
544 > throw 2>&1 | egrep '^\*\*'
545 > throw 2>&1 | egrep '^\*\*'
545 ** Unknown exception encountered with possibly-broken third-party extension older
546 ** Unknown exception encountered with possibly-broken third-party extension older
546 ** which supports versions 1.9.3 of Mercurial.
547 ** which supports versions 1.9.3 of Mercurial.
547 ** Please disable older and try your action again.
548 ** Please disable older and try your action again.
548 ** If that fixes the bug please report it to the extension author.
549 ** If that fixes the bug please report it to the extension author.
549 ** Python * (glob)
550 ** Python * (glob)
550 ** Mercurial Distributed SCM (version 2.1.0)
551 ** Mercurial Distributed SCM (version 2.1.0)
551 ** Extensions loaded: throw, older
552 ** Extensions loaded: throw, older
552 Older extension is tested with current version, the other only with newer:
553 Older extension is tested with current version, the other only with newer:
553 $ echo "util.version = lambda:'1.9.3'" >> older.py
554 $ echo "util.version = lambda:'1.9.3'" >> older.py
554 $ rm -f older.pyc older.pyo
555 $ rm -f older.pyc older.pyo
555 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
556 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
556 > throw 2>&1 | egrep '^\*\*'
557 > throw 2>&1 | egrep '^\*\*'
557 ** Unknown exception encountered with possibly-broken third-party extension throw
558 ** Unknown exception encountered with possibly-broken third-party extension throw
558 ** which supports versions 2.1.1 of Mercurial.
559 ** which supports versions 2.1.1 of Mercurial.
559 ** Please disable throw and try your action again.
560 ** Please disable throw and try your action again.
560 ** If that fixes the bug please report it to http://example.com/bts
561 ** If that fixes the bug please report it to http://example.com/bts
561 ** Python * (glob)
562 ** Python * (glob)
562 ** Mercurial Distributed SCM (version 1.9.3)
563 ** Mercurial Distributed SCM (version 1.9.3)
563 ** Extensions loaded: throw, older
564 ** Extensions loaded: throw, older
564
565
565 Declare the version as supporting this hg version, show regular bts link:
566 Declare the version as supporting this hg version, show regular bts link:
566 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
567 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
567 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
568 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
568 $ rm -f throw.pyc throw.pyo
569 $ rm -f throw.pyc throw.pyo
569 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
570 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
570 ** unknown exception encountered, please report by visiting
571 ** unknown exception encountered, please report by visiting
571 ** http://mercurial.selenic.com/wiki/BugTracker
572 ** http://mercurial.selenic.com/wiki/BugTracker
572 ** Python * (glob)
573 ** Python * (glob)
573 ** Mercurial Distributed SCM (*) (glob)
574 ** Mercurial Distributed SCM (*) (glob)
574 ** Extensions loaded: throw
575 ** Extensions loaded: throw
@@ -1,1786 +1,1787
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 current repository heads or show branch heads
71 heads show current repository heads or 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 rollback roll back the last transaction (dangerous)
92 rollback roll back the last transaction (dangerous)
93 root print the root (top) of the current working directory
93 root print the root (top) of the current working directory
94 serve start stand-alone webserver
94 serve start stand-alone webserver
95 showconfig show combined config settings from all hgrc files
95 showconfig show combined config settings from all hgrc files
96 status show changed files in the working directory
96 status show changed files in the working directory
97 summary summarize working directory state
97 summary summarize working directory state
98 tag add one or more tags for the current or given revision
98 tag add one or more tags for the current or given revision
99 tags list repository tags
99 tags list repository tags
100 tip show the tip revision
100 tip show the tip revision
101 unbundle apply one or more changegroup files
101 unbundle apply one or more changegroup files
102 update update working directory (or switch revisions)
102 update update working directory (or switch revisions)
103 verify verify the integrity of the repository
103 verify verify the integrity of the repository
104 version output version and copyright information
104 version output version and copyright information
105
105
106 additional help topics:
106 additional help topics:
107
107
108 config Configuration Files
108 config Configuration Files
109 dates Date Formats
109 dates Date Formats
110 diffs Diff Formats
110 diffs Diff Formats
111 environment Environment Variables
111 environment Environment Variables
112 extensions Using Additional Features
112 extensions Using Additional Features
113 filesets Specifying File Sets
113 filesets Specifying File Sets
114 glossary Glossary
114 glossary Glossary
115 hgignore Syntax for Mercurial Ignore Files
115 hgignore Syntax for Mercurial Ignore Files
116 hgweb Configuring hgweb
116 hgweb Configuring hgweb
117 merge-tools Merge Tools
117 merge-tools Merge Tools
118 multirevs Specifying Multiple Revisions
118 multirevs Specifying Multiple Revisions
119 patterns File Name Patterns
119 patterns File Name Patterns
120 phases Working with Phases
120 phases Working with Phases
121 revisions Specifying Single Revisions
121 revisions Specifying Single Revisions
122 revsets Specifying Revision Sets
122 revsets Specifying Revision Sets
123 subrepos Subrepositories
123 subrepos Subrepositories
124 templating Template Usage
124 templating Template Usage
125 urls URL Paths
125 urls URL Paths
126
126
127 use "hg -v help" to show builtin aliases and global options
127 use "hg -v help" to show builtin aliases and global options
128
128
129 $ hg -q help
129 $ hg -q help
130 add add the specified files on the next commit
130 add add the specified files on the next commit
131 addremove add all new files, delete all missing files
131 addremove add all new files, delete all missing files
132 annotate show changeset information by line for each file
132 annotate show changeset information by line for each file
133 archive create an unversioned archive of a repository revision
133 archive create an unversioned archive of a repository revision
134 backout reverse effect of earlier changeset
134 backout reverse effect of earlier changeset
135 bisect subdivision search of changesets
135 bisect subdivision search of changesets
136 bookmarks track a line of development with movable markers
136 bookmarks track a line of development with movable markers
137 branch set or show the current branch name
137 branch set or show the current branch name
138 branches list repository named branches
138 branches list repository named branches
139 bundle create a changegroup file
139 bundle create a changegroup file
140 cat output the current or given revision of files
140 cat output the current or given revision of files
141 clone make a copy of an existing repository
141 clone make a copy of an existing repository
142 commit commit the specified files or all outstanding changes
142 commit commit the specified files or all outstanding changes
143 copy mark files as copied for the next commit
143 copy mark files as copied for the next commit
144 diff diff repository (or selected files)
144 diff diff repository (or selected files)
145 export dump the header and diffs for one or more changesets
145 export dump the header and diffs for one or more changesets
146 forget forget the specified files on the next commit
146 forget forget the specified files on the next commit
147 graft copy changes from other branches onto the current branch
147 graft copy changes from other branches onto the current branch
148 grep search for a pattern in specified files and revisions
148 grep search for a pattern in specified files and revisions
149 heads show current repository heads or show branch heads
149 heads show current repository heads or show branch heads
150 help show help for a given topic or a help overview
150 help show help for a given topic or a help overview
151 identify identify the working copy or specified revision
151 identify identify the working copy or specified revision
152 import import an ordered set of patches
152 import import an ordered set of patches
153 incoming show new changesets found in source
153 incoming show new changesets found in source
154 init create a new repository in the given directory
154 init create a new repository in the given directory
155 locate locate files matching specific patterns
155 locate locate files matching specific patterns
156 log show revision history of entire repository or files
156 log show revision history of entire repository or files
157 manifest output the current or given revision of the project manifest
157 manifest output the current or given revision of the project manifest
158 merge merge working directory with another revision
158 merge merge working directory with another revision
159 outgoing show changesets not found in the destination
159 outgoing show changesets not found in the destination
160 parents show the parents of the working directory or revision
160 parents show the parents of the working directory or revision
161 paths show aliases for remote repositories
161 paths show aliases for remote repositories
162 phase set or show the current phase name
162 phase set or show the current phase name
163 pull pull changes from the specified source
163 pull pull changes from the specified source
164 push push changes to the specified destination
164 push push changes to the specified destination
165 recover roll back an interrupted transaction
165 recover roll back an interrupted transaction
166 remove remove the specified files on the next commit
166 remove remove the specified files on the next commit
167 rename rename files; equivalent of copy + remove
167 rename rename files; equivalent of copy + remove
168 resolve redo merges or set/view the merge status of files
168 resolve redo merges or set/view the merge status of files
169 revert restore files to their checkout state
169 revert restore files to their checkout state
170 rollback roll back the last transaction (dangerous)
170 rollback roll back the last transaction (dangerous)
171 root print the root (top) of the current working directory
171 root print the root (top) of the current working directory
172 serve start stand-alone webserver
172 serve start stand-alone webserver
173 showconfig show combined config settings from all hgrc files
173 showconfig show combined config settings from all hgrc files
174 status show changed files in the working directory
174 status show changed files in the working directory
175 summary summarize working directory state
175 summary summarize working directory state
176 tag add one or more tags for the current or given revision
176 tag add one or more tags for the current or given revision
177 tags list repository tags
177 tags list repository tags
178 tip show the tip revision
178 tip show the tip revision
179 unbundle apply one or more changegroup files
179 unbundle apply one or more changegroup files
180 update update working directory (or switch revisions)
180 update update working directory (or switch revisions)
181 verify verify the integrity of the repository
181 verify verify the integrity of the repository
182 version output version and copyright information
182 version output version and copyright information
183
183
184 additional help topics:
184 additional help topics:
185
185
186 config Configuration Files
186 config Configuration Files
187 dates Date Formats
187 dates Date Formats
188 diffs Diff Formats
188 diffs Diff Formats
189 environment Environment Variables
189 environment Environment Variables
190 extensions Using Additional Features
190 extensions Using Additional Features
191 filesets Specifying File Sets
191 filesets Specifying File Sets
192 glossary Glossary
192 glossary Glossary
193 hgignore Syntax for Mercurial Ignore Files
193 hgignore Syntax for Mercurial Ignore Files
194 hgweb Configuring hgweb
194 hgweb Configuring hgweb
195 merge-tools Merge Tools
195 merge-tools Merge Tools
196 multirevs Specifying Multiple Revisions
196 multirevs Specifying Multiple Revisions
197 patterns File Name Patterns
197 patterns File Name Patterns
198 phases Working with Phases
198 phases Working with Phases
199 revisions Specifying Single Revisions
199 revisions Specifying Single Revisions
200 revsets Specifying Revision Sets
200 revsets Specifying Revision Sets
201 subrepos Subrepositories
201 subrepos Subrepositories
202 templating Template Usage
202 templating Template Usage
203 urls URL Paths
203 urls URL Paths
204
204
205 Test short command list with verbose option
205 Test short command list with verbose option
206
206
207 $ hg -v help shortlist
207 $ hg -v help shortlist
208 Mercurial Distributed SCM
208 Mercurial Distributed SCM
209
209
210 basic commands:
210 basic commands:
211
211
212 add add the specified files on the next commit
212 add add the specified files on the next commit
213 annotate, blame
213 annotate, blame
214 show changeset information by line for each file
214 show changeset information by line for each file
215 clone make a copy of an existing repository
215 clone make a copy of an existing repository
216 commit, ci commit the specified files or all outstanding changes
216 commit, ci commit the specified files or all outstanding changes
217 diff diff repository (or selected files)
217 diff diff repository (or selected files)
218 export dump the header and diffs for one or more changesets
218 export dump the header and diffs for one or more changesets
219 forget forget the specified files on the next commit
219 forget forget the specified files on the next commit
220 init create a new repository in the given directory
220 init create a new repository in the given directory
221 log, history show revision history of entire repository or files
221 log, history show revision history of entire repository or files
222 merge merge working directory with another revision
222 merge merge working directory with another revision
223 pull pull changes from the specified source
223 pull pull changes from the specified source
224 push push changes to the specified destination
224 push push changes to the specified destination
225 remove, rm remove the specified files on the next commit
225 remove, rm remove the specified files on the next commit
226 serve start stand-alone webserver
226 serve start stand-alone webserver
227 status, st show changed files in the working directory
227 status, st show changed files in the working directory
228 summary, sum summarize working directory state
228 summary, sum summarize working directory state
229 update, up, checkout, co
229 update, up, checkout, co
230 update working directory (or switch revisions)
230 update working directory (or switch revisions)
231
231
232 global options:
232 global options:
233
233
234 -R --repository REPO repository root directory or name of overlay bundle
234 -R --repository REPO repository root directory or name of overlay bundle
235 file
235 file
236 --cwd DIR change working directory
236 --cwd DIR change working directory
237 -y --noninteractive do not prompt, automatically pick the first choice for
237 -y --noninteractive do not prompt, automatically pick the first choice for
238 all prompts
238 all prompts
239 -q --quiet suppress output
239 -q --quiet suppress output
240 -v --verbose enable additional output
240 -v --verbose enable additional output
241 --config CONFIG [+] set/override config option (use 'section.name=value')
241 --config CONFIG [+] set/override config option (use 'section.name=value')
242 --debug enable debugging output
242 --debug enable debugging output
243 --debugger start debugger
243 --debugger start debugger
244 --encoding ENCODE set the charset encoding (default: ascii)
244 --encoding ENCODE set the charset encoding (default: ascii)
245 --encodingmode MODE set the charset encoding mode (default: strict)
245 --encodingmode MODE set the charset encoding mode (default: strict)
246 --traceback always print a traceback on exception
246 --traceback always print a traceback on exception
247 --time time how long the command takes
247 --time time how long the command takes
248 --profile print command execution profile
248 --profile print command execution profile
249 --version output version information and exit
249 --version output version information and exit
250 -h --help display help and exit
250 -h --help display help and exit
251 --hidden consider hidden changesets
251 --hidden consider hidden changesets
252
252
253 [+] marked option can be specified multiple times
253 [+] marked option can be specified multiple times
254
254
255 use "hg help" for the full list of commands
255 use "hg help" for the full list of commands
256
256
257 $ hg add -h
257 $ hg add -h
258 hg add [OPTION]... [FILE]...
258 hg add [OPTION]... [FILE]...
259
259
260 add the specified files on the next commit
260 add the specified files on the next commit
261
261
262 Schedule files to be version controlled and added to the repository.
262 Schedule files to be version controlled and added to the repository.
263
263
264 The files will be added to the repository at the next commit. To undo an
264 The files will be added to the repository at the next commit. To undo an
265 add before that, see "hg forget".
265 add before that, see "hg forget".
266
266
267 If no names are given, add all files to the repository.
267 If no names are given, add all files to the repository.
268
268
269 Returns 0 if all files are successfully added.
269 Returns 0 if all files are successfully added.
270
270
271 options:
271 options:
272
272
273 -I --include PATTERN [+] include names matching the given patterns
273 -I --include PATTERN [+] include names matching the given patterns
274 -X --exclude PATTERN [+] exclude names matching the given patterns
274 -X --exclude PATTERN [+] exclude names matching the given patterns
275 -S --subrepos recurse into subrepositories
275 -S --subrepos recurse into subrepositories
276 -n --dry-run do not perform actions, just print output
276 -n --dry-run do not perform actions, just print output
277
277
278 [+] marked option can be specified multiple times
278 [+] marked option can be specified multiple times
279
279
280 use "hg -v help add" to show more complete help and the global options
280 use "hg -v help add" to show more complete help and the global options
281
281
282 Verbose help for add
282 Verbose help for add
283
283
284 $ hg add -hv
284 $ hg add -hv
285 hg add [OPTION]... [FILE]...
285 hg add [OPTION]... [FILE]...
286
286
287 add the specified files on the next commit
287 add the specified files on the next commit
288
288
289 Schedule files to be version controlled and added to the repository.
289 Schedule files to be version controlled and added to the repository.
290
290
291 The files will be added to the repository at the next commit. To undo an
291 The files will be added to the repository at the next commit. To undo an
292 add before that, see "hg forget".
292 add before that, see "hg forget".
293
293
294 If no names are given, add all files to the repository.
294 If no names are given, add all files to the repository.
295
295
296 An example showing how new (unknown) files are added automatically by "hg
296 An example showing how new (unknown) files are added automatically by "hg
297 add":
297 add":
298
298
299 $ ls
299 $ ls
300 foo.c
300 foo.c
301 $ hg status
301 $ hg status
302 ? foo.c
302 ? foo.c
303 $ hg add
303 $ hg add
304 adding foo.c
304 adding foo.c
305 $ hg status
305 $ hg status
306 A foo.c
306 A foo.c
307
307
308 Returns 0 if all files are successfully added.
308 Returns 0 if all files are successfully added.
309
309
310 options:
310 options:
311
311
312 -I --include PATTERN [+] include names matching the given patterns
312 -I --include PATTERN [+] include names matching the given patterns
313 -X --exclude PATTERN [+] exclude names matching the given patterns
313 -X --exclude PATTERN [+] exclude names matching the given patterns
314 -S --subrepos recurse into subrepositories
314 -S --subrepos recurse into subrepositories
315 -n --dry-run do not perform actions, just print output
315 -n --dry-run do not perform actions, just print output
316
316
317 [+] marked option can be specified multiple times
317 [+] marked option can be specified multiple times
318
318
319 global options:
319 global options:
320
320
321 -R --repository REPO repository root directory or name of overlay bundle
321 -R --repository REPO repository root directory or name of overlay bundle
322 file
322 file
323 --cwd DIR change working directory
323 --cwd DIR change working directory
324 -y --noninteractive do not prompt, automatically pick the first choice for
324 -y --noninteractive do not prompt, automatically pick the first choice for
325 all prompts
325 all prompts
326 -q --quiet suppress output
326 -q --quiet suppress output
327 -v --verbose enable additional output
327 -v --verbose enable additional output
328 --config CONFIG [+] set/override config option (use 'section.name=value')
328 --config CONFIG [+] set/override config option (use 'section.name=value')
329 --debug enable debugging output
329 --debug enable debugging output
330 --debugger start debugger
330 --debugger start debugger
331 --encoding ENCODE set the charset encoding (default: ascii)
331 --encoding ENCODE set the charset encoding (default: ascii)
332 --encodingmode MODE set the charset encoding mode (default: strict)
332 --encodingmode MODE set the charset encoding mode (default: strict)
333 --traceback always print a traceback on exception
333 --traceback always print a traceback on exception
334 --time time how long the command takes
334 --time time how long the command takes
335 --profile print command execution profile
335 --profile print command execution profile
336 --version output version information and exit
336 --version output version information and exit
337 -h --help display help and exit
337 -h --help display help and exit
338 --hidden consider hidden changesets
338 --hidden consider hidden changesets
339
339
340 [+] marked option can be specified multiple times
340 [+] marked option can be specified multiple times
341
341
342 Test help option with version option
342 Test help option with version option
343
343
344 $ hg add -h --version
344 $ hg add -h --version
345 Mercurial Distributed SCM (version *) (glob)
345 Mercurial Distributed SCM (version *) (glob)
346 (see http://mercurial.selenic.com for more information)
346 (see http://mercurial.selenic.com for more information)
347
347
348 Copyright (C) 2005-2012 Matt Mackall and others
348 Copyright (C) 2005-2012 Matt Mackall and others
349 This is free software; see the source for copying conditions. There is NO
349 This is free software; see the source for copying conditions. There is NO
350 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
350 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
351
351
352 $ hg add --skjdfks
352 $ hg add --skjdfks
353 hg add: option --skjdfks not recognized
353 hg add: option --skjdfks not recognized
354 hg add [OPTION]... [FILE]...
354 hg add [OPTION]... [FILE]...
355
355
356 add the specified files on the next commit
356 add the specified files on the next commit
357
357
358 options:
358 options:
359
359
360 -I --include PATTERN [+] include names matching the given patterns
360 -I --include PATTERN [+] include names matching the given patterns
361 -X --exclude PATTERN [+] exclude names matching the given patterns
361 -X --exclude PATTERN [+] exclude names matching the given patterns
362 -S --subrepos recurse into subrepositories
362 -S --subrepos recurse into subrepositories
363 -n --dry-run do not perform actions, just print output
363 -n --dry-run do not perform actions, just print output
364
364
365 [+] marked option can be specified multiple times
365 [+] marked option can be specified multiple times
366
366
367 use "hg help add" to show the full help text
367 use "hg help add" to show the full help text
368 [255]
368 [255]
369
369
370 Test ambiguous command help
370 Test ambiguous command help
371
371
372 $ hg help ad
372 $ hg help ad
373 list of commands:
373 list of commands:
374
374
375 add add the specified files on the next commit
375 add add the specified files on the next commit
376 addremove add all new files, delete all missing files
376 addremove add all new files, delete all missing files
377
377
378 use "hg -v help ad" to show builtin aliases and global options
378 use "hg -v help ad" to show builtin aliases and global options
379
379
380 Test command without options
380 Test command without options
381
381
382 $ hg help verify
382 $ hg help verify
383 hg verify
383 hg verify
384
384
385 verify the integrity of the repository
385 verify the integrity of the repository
386
386
387 Verify the integrity of the current repository.
387 Verify the integrity of the current repository.
388
388
389 This will perform an extensive check of the repository's integrity,
389 This will perform an extensive check of the repository's integrity,
390 validating the hashes and checksums of each entry in the changelog,
390 validating the hashes and checksums of each entry in the changelog,
391 manifest, and tracked files, as well as the integrity of their crosslinks
391 manifest, and tracked files, as well as the integrity of their crosslinks
392 and indices.
392 and indices.
393
393
394 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
394 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
395 information about recovery from corruption of the repository.
395 information about recovery from corruption of the repository.
396
396
397 Returns 0 on success, 1 if errors are encountered.
397 Returns 0 on success, 1 if errors are encountered.
398
398
399 use "hg -v help verify" to show the global options
399 use "hg -v help verify" to show the global options
400
400
401 $ hg help diff
401 $ hg help diff
402 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
402 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
403
403
404 diff repository (or selected files)
404 diff repository (or selected files)
405
405
406 Show differences between revisions for the specified files.
406 Show differences between revisions for the specified files.
407
407
408 Differences between files are shown using the unified diff format.
408 Differences between files are shown using the unified diff format.
409
409
410 Note:
410 Note:
411 diff may generate unexpected results for merges, as it will default to
411 diff may generate unexpected results for merges, as it will default to
412 comparing against the working directory's first parent changeset if no
412 comparing against the working directory's first parent changeset if no
413 revisions are specified.
413 revisions are specified.
414
414
415 When two revision arguments are given, then changes are shown between
415 When two revision arguments are given, then changes are shown between
416 those revisions. If only one revision is specified then that revision is
416 those revisions. If only one revision is specified then that revision is
417 compared to the working directory, and, when no revisions are specified,
417 compared to the working directory, and, when no revisions are specified,
418 the working directory files are compared to its parent.
418 the working directory files are compared to its parent.
419
419
420 Alternatively you can specify -c/--change with a revision to see the
420 Alternatively you can specify -c/--change with a revision to see the
421 changes in that changeset relative to its first parent.
421 changes in that changeset relative to its first parent.
422
422
423 Without the -a/--text option, diff will avoid generating diffs of files it
423 Without the -a/--text option, diff will avoid generating diffs of files it
424 detects as binary. With -a, diff will generate a diff anyway, probably
424 detects as binary. With -a, diff will generate a diff anyway, probably
425 with undesirable results.
425 with undesirable results.
426
426
427 Use the -g/--git option to generate diffs in the git extended diff format.
427 Use the -g/--git option to generate diffs in the git extended diff format.
428 For more information, read "hg help diffs".
428 For more information, read "hg help diffs".
429
429
430 Returns 0 on success.
430 Returns 0 on success.
431
431
432 options:
432 options:
433
433
434 -r --rev REV [+] revision
434 -r --rev REV [+] revision
435 -c --change REV change made by revision
435 -c --change REV change made by revision
436 -a --text treat all files as text
436 -a --text treat all files as text
437 -g --git use git extended diff format
437 -g --git use git extended diff format
438 --nodates omit dates from diff headers
438 --nodates omit dates from diff headers
439 -p --show-function show which function each change is in
439 -p --show-function show which function each change is in
440 --reverse produce a diff that undoes the changes
440 --reverse produce a diff that undoes the changes
441 -w --ignore-all-space ignore white space when comparing lines
441 -w --ignore-all-space ignore white space when comparing lines
442 -b --ignore-space-change ignore changes in the amount of white space
442 -b --ignore-space-change ignore changes in the amount of white space
443 -B --ignore-blank-lines ignore changes whose lines are all blank
443 -B --ignore-blank-lines ignore changes whose lines are all blank
444 -U --unified NUM number of lines of context to show
444 -U --unified NUM number of lines of context to show
445 --stat output diffstat-style summary of changes
445 --stat output diffstat-style summary of changes
446 -I --include PATTERN [+] include names matching the given patterns
446 -I --include PATTERN [+] include names matching the given patterns
447 -X --exclude PATTERN [+] exclude names matching the given patterns
447 -X --exclude PATTERN [+] exclude names matching the given patterns
448 -S --subrepos recurse into subrepositories
448 -S --subrepos recurse into subrepositories
449
449
450 [+] marked option can be specified multiple times
450 [+] marked option can be specified multiple times
451
451
452 use "hg -v help diff" to show more complete help and the global options
452 use "hg -v help diff" to show more complete help and the global options
453
453
454 $ hg help status
454 $ hg help status
455 hg status [OPTION]... [FILE]...
455 hg status [OPTION]... [FILE]...
456
456
457 aliases: st
457 aliases: st
458
458
459 show changed files in the working directory
459 show changed files in the working directory
460
460
461 Show status of files in the repository. If names are given, only files
461 Show status of files in the repository. If names are given, only files
462 that match are shown. Files that are clean or ignored or the source of a
462 that match are shown. Files that are clean or ignored or the source of a
463 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
463 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
464 -C/--copies or -A/--all are given. Unless options described with "show
464 -C/--copies or -A/--all are given. Unless options described with "show
465 only ..." are given, the options -mardu are used.
465 only ..." are given, the options -mardu are used.
466
466
467 Option -q/--quiet hides untracked (unknown and ignored) files unless
467 Option -q/--quiet hides untracked (unknown and ignored) files unless
468 explicitly requested with -u/--unknown or -i/--ignored.
468 explicitly requested with -u/--unknown or -i/--ignored.
469
469
470 Note:
470 Note:
471 status may appear to disagree with diff if permissions have changed or
471 status may appear to disagree with diff if permissions have changed or
472 a merge has occurred. The standard diff format does not report
472 a merge has occurred. The standard diff format does not report
473 permission changes and diff only reports changes relative to one merge
473 permission changes and diff only reports changes relative to one merge
474 parent.
474 parent.
475
475
476 If one revision is given, it is used as the base revision. If two
476 If one revision is given, it is used as the base revision. If two
477 revisions are given, the differences between them are shown. The --change
477 revisions are given, the differences between them are shown. The --change
478 option can also be used as a shortcut to list the changed files of a
478 option can also be used as a shortcut to list the changed files of a
479 revision from its first parent.
479 revision from its first parent.
480
480
481 The codes used to show the status of files are:
481 The codes used to show the status of files are:
482
482
483 M = modified
483 M = modified
484 A = added
484 A = added
485 R = removed
485 R = removed
486 C = clean
486 C = clean
487 ! = missing (deleted by non-hg command, but still tracked)
487 ! = missing (deleted by non-hg command, but still tracked)
488 ? = not tracked
488 ? = not tracked
489 I = ignored
489 I = ignored
490 = origin of the previous file listed as A (added)
490 = origin of the previous file listed as A (added)
491
491
492 Returns 0 on success.
492 Returns 0 on success.
493
493
494 options:
494 options:
495
495
496 -A --all show status of all files
496 -A --all show status of all files
497 -m --modified show only modified files
497 -m --modified show only modified files
498 -a --added show only added files
498 -a --added show only added files
499 -r --removed show only removed files
499 -r --removed show only removed files
500 -d --deleted show only deleted (but tracked) files
500 -d --deleted show only deleted (but tracked) files
501 -c --clean show only files without changes
501 -c --clean show only files without changes
502 -u --unknown show only unknown (not tracked) files
502 -u --unknown show only unknown (not tracked) files
503 -i --ignored show only ignored files
503 -i --ignored show only ignored files
504 -n --no-status hide status prefix
504 -n --no-status hide status prefix
505 -C --copies show source of copied files
505 -C --copies show source of copied files
506 -0 --print0 end filenames with NUL, for use with xargs
506 -0 --print0 end filenames with NUL, for use with xargs
507 --rev REV [+] show difference from revision
507 --rev REV [+] show difference from revision
508 --change REV list the changed files of a revision
508 --change REV list the changed files of a revision
509 -I --include PATTERN [+] include names matching the given patterns
509 -I --include PATTERN [+] include names matching the given patterns
510 -X --exclude PATTERN [+] exclude names matching the given patterns
510 -X --exclude PATTERN [+] exclude names matching the given patterns
511 -S --subrepos recurse into subrepositories
511 -S --subrepos recurse into subrepositories
512
512
513 [+] marked option can be specified multiple times
513 [+] marked option can be specified multiple times
514
514
515 use "hg -v help status" to show more complete help and the global options
515 use "hg -v help status" to show more complete help and the global options
516
516
517 $ hg -q help status
517 $ hg -q help status
518 hg status [OPTION]... [FILE]...
518 hg status [OPTION]... [FILE]...
519
519
520 show changed files in the working directory
520 show changed files in the working directory
521
521
522 $ hg help foo
522 $ hg help foo
523 hg: unknown command 'foo'
523 hg: unknown command 'foo'
524 Mercurial Distributed SCM
524 Mercurial Distributed SCM
525
525
526 basic commands:
526 basic commands:
527
527
528 add add the specified files on the next commit
528 add add the specified files on the next commit
529 annotate show changeset information by line for each file
529 annotate show changeset information by line for each file
530 clone make a copy of an existing repository
530 clone make a copy of an existing repository
531 commit commit the specified files or all outstanding changes
531 commit commit the specified files or all outstanding changes
532 diff diff repository (or selected files)
532 diff diff repository (or selected files)
533 export dump the header and diffs for one or more changesets
533 export dump the header and diffs for one or more changesets
534 forget forget the specified files on the next commit
534 forget forget the specified files on the next commit
535 init create a new repository in the given directory
535 init create a new repository in the given directory
536 log show revision history of entire repository or files
536 log show revision history of entire repository or files
537 merge merge working directory with another revision
537 merge merge working directory with another revision
538 pull pull changes from the specified source
538 pull pull changes from the specified source
539 push push changes to the specified destination
539 push push changes to the specified destination
540 remove remove the specified files on the next commit
540 remove remove the specified files on the next commit
541 serve start stand-alone webserver
541 serve start stand-alone webserver
542 status show changed files in the working directory
542 status show changed files in the working directory
543 summary summarize working directory state
543 summary summarize working directory state
544 update update working directory (or switch revisions)
544 update update working directory (or switch revisions)
545
545
546 use "hg help" for the full list of commands or "hg -v" for details
546 use "hg help" for the full list of commands or "hg -v" for details
547 [255]
547 [255]
548
548
549 $ hg skjdfks
549 $ hg skjdfks
550 hg: unknown command 'skjdfks'
550 hg: unknown command 'skjdfks'
551 Mercurial Distributed SCM
551 Mercurial Distributed SCM
552
552
553 basic commands:
553 basic commands:
554
554
555 add add the specified files on the next commit
555 add add the specified files on the next commit
556 annotate show changeset information by line for each file
556 annotate show changeset information by line for each file
557 clone make a copy of an existing repository
557 clone make a copy of an existing repository
558 commit commit the specified files or all outstanding changes
558 commit commit the specified files or all outstanding changes
559 diff diff repository (or selected files)
559 diff diff repository (or selected files)
560 export dump the header and diffs for one or more changesets
560 export dump the header and diffs for one or more changesets
561 forget forget the specified files on the next commit
561 forget forget the specified files on the next commit
562 init create a new repository in the given directory
562 init create a new repository in the given directory
563 log show revision history of entire repository or files
563 log show revision history of entire repository or files
564 merge merge working directory with another revision
564 merge merge working directory with another revision
565 pull pull changes from the specified source
565 pull pull changes from the specified source
566 push push changes to the specified destination
566 push push changes to the specified destination
567 remove remove the specified files on the next commit
567 remove remove the specified files on the next commit
568 serve start stand-alone webserver
568 serve start stand-alone webserver
569 status show changed files in the working directory
569 status show changed files in the working directory
570 summary summarize working directory state
570 summary summarize working directory state
571 update update working directory (or switch revisions)
571 update update working directory (or switch revisions)
572
572
573 use "hg help" for the full list of commands or "hg -v" for details
573 use "hg help" for the full list of commands or "hg -v" for details
574 [255]
574 [255]
575
575
576 $ cat > helpext.py <<EOF
576 $ cat > helpext.py <<EOF
577 > import os
577 > import os
578 > from mercurial import commands
578 > from mercurial import commands
579 >
579 >
580 > def nohelp(ui, *args, **kwargs):
580 > def nohelp(ui, *args, **kwargs):
581 > pass
581 > pass
582 >
582 >
583 > cmdtable = {
583 > cmdtable = {
584 > "nohelp": (nohelp, [], "hg nohelp"),
584 > "nohelp": (nohelp, [], "hg nohelp"),
585 > }
585 > }
586 >
586 >
587 > commands.norepo += ' nohelp'
587 > commands.norepo += ' nohelp'
588 > EOF
588 > EOF
589 $ echo '[extensions]' >> $HGRCPATH
589 $ echo '[extensions]' >> $HGRCPATH
590 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
590 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
591
591
592 Test command with no help text
592 Test command with no help text
593
593
594 $ hg help nohelp
594 $ hg help nohelp
595 hg nohelp
595 hg nohelp
596
596
597 (no help text available)
597 (no help text available)
598
598
599 use "hg -v help nohelp" to show the global options
599 use "hg -v help nohelp" to show the global options
600
600
601 $ hg help -k nohelp
601 $ hg help -k nohelp
602 Commands:
602 Commands:
603
603
604 nohelp hg nohelp
604 nohelp hg nohelp
605
605
606 Extension Commands:
606 Extension Commands:
607
607
608 nohelp (no help text available)
608 nohelp (no help text available)
609
609
610 Test that default list of commands omits extension commands
610 Test that default list of commands omits extension commands
611
611
612 $ hg help
612 $ hg help
613 Mercurial Distributed SCM
613 Mercurial Distributed SCM
614
614
615 list of commands:
615 list of commands:
616
616
617 add add the specified files on the next commit
617 add add the specified files on the next commit
618 addremove add all new files, delete all missing files
618 addremove add all new files, delete all missing files
619 annotate show changeset information by line for each file
619 annotate show changeset information by line for each file
620 archive create an unversioned archive of a repository revision
620 archive create an unversioned archive of a repository revision
621 backout reverse effect of earlier changeset
621 backout reverse effect of earlier changeset
622 bisect subdivision search of changesets
622 bisect subdivision search of changesets
623 bookmarks track a line of development with movable markers
623 bookmarks track a line of development with movable markers
624 branch set or show the current branch name
624 branch set or show the current branch name
625 branches list repository named branches
625 branches list repository named branches
626 bundle create a changegroup file
626 bundle create a changegroup file
627 cat output the current or given revision of files
627 cat output the current or given revision of files
628 clone make a copy of an existing repository
628 clone make a copy of an existing repository
629 commit commit the specified files or all outstanding changes
629 commit commit the specified files or all outstanding changes
630 copy mark files as copied for the next commit
630 copy mark files as copied for the next commit
631 diff diff repository (or selected files)
631 diff diff repository (or selected files)
632 export dump the header and diffs for one or more changesets
632 export dump the header and diffs for one or more changesets
633 forget forget the specified files on the next commit
633 forget forget the specified files on the next commit
634 graft copy changes from other branches onto the current branch
634 graft copy changes from other branches onto the current branch
635 grep search for a pattern in specified files and revisions
635 grep search for a pattern in specified files and revisions
636 heads show current repository heads or show branch heads
636 heads show current repository heads or show branch heads
637 help show help for a given topic or a help overview
637 help show help for a given topic or a help overview
638 identify identify the working copy or specified revision
638 identify identify the working copy or specified revision
639 import import an ordered set of patches
639 import import an ordered set of patches
640 incoming show new changesets found in source
640 incoming show new changesets found in source
641 init create a new repository in the given directory
641 init create a new repository in the given directory
642 locate locate files matching specific patterns
642 locate locate files matching specific patterns
643 log show revision history of entire repository or files
643 log show revision history of entire repository or files
644 manifest output the current or given revision of the project manifest
644 manifest output the current or given revision of the project manifest
645 merge merge working directory with another revision
645 merge merge working directory with another revision
646 outgoing show changesets not found in the destination
646 outgoing show changesets not found in the destination
647 parents show the parents of the working directory or revision
647 parents show the parents of the working directory or revision
648 paths show aliases for remote repositories
648 paths show aliases for remote repositories
649 phase set or show the current phase name
649 phase set or show the current phase name
650 pull pull changes from the specified source
650 pull pull changes from the specified source
651 push push changes to the specified destination
651 push push changes to the specified destination
652 recover roll back an interrupted transaction
652 recover roll back an interrupted transaction
653 remove remove the specified files on the next commit
653 remove remove the specified files on the next commit
654 rename rename files; equivalent of copy + remove
654 rename rename files; equivalent of copy + remove
655 resolve redo merges or set/view the merge status of files
655 resolve redo merges or set/view the merge status of files
656 revert restore files to their checkout state
656 revert restore files to their checkout state
657 rollback roll back the last transaction (dangerous)
657 rollback roll back the last transaction (dangerous)
658 root print the root (top) of the current working directory
658 root print the root (top) of the current working directory
659 serve start stand-alone webserver
659 serve start stand-alone webserver
660 showconfig show combined config settings from all hgrc files
660 showconfig show combined config settings from all hgrc files
661 status show changed files in the working directory
661 status show changed files in the working directory
662 summary summarize working directory state
662 summary summarize working directory state
663 tag add one or more tags for the current or given revision
663 tag add one or more tags for the current or given revision
664 tags list repository tags
664 tags list repository tags
665 tip show the tip revision
665 tip show the tip revision
666 unbundle apply one or more changegroup files
666 unbundle apply one or more changegroup files
667 update update working directory (or switch revisions)
667 update update working directory (or switch revisions)
668 verify verify the integrity of the repository
668 verify verify the integrity of the repository
669 version output version and copyright information
669 version output version and copyright information
670
670
671 enabled extensions:
671 enabled extensions:
672
672
673 helpext (no help text available)
673 helpext (no help text available)
674
674
675 additional help topics:
675 additional help topics:
676
676
677 config Configuration Files
677 config Configuration Files
678 dates Date Formats
678 dates Date Formats
679 diffs Diff Formats
679 diffs Diff Formats
680 environment Environment Variables
680 environment Environment Variables
681 extensions Using Additional Features
681 extensions Using Additional Features
682 filesets Specifying File Sets
682 filesets Specifying File Sets
683 glossary Glossary
683 glossary Glossary
684 hgignore Syntax for Mercurial Ignore Files
684 hgignore Syntax for Mercurial Ignore Files
685 hgweb Configuring hgweb
685 hgweb Configuring hgweb
686 merge-tools Merge Tools
686 merge-tools Merge Tools
687 multirevs Specifying Multiple Revisions
687 multirevs Specifying Multiple Revisions
688 patterns File Name Patterns
688 patterns File Name Patterns
689 phases Working with Phases
689 phases Working with Phases
690 revisions Specifying Single Revisions
690 revisions Specifying Single Revisions
691 revsets Specifying Revision Sets
691 revsets Specifying Revision Sets
692 subrepos Subrepositories
692 subrepos Subrepositories
693 templating Template Usage
693 templating Template Usage
694 urls URL Paths
694 urls URL Paths
695
695
696 use "hg -v help" to show builtin aliases and global options
696 use "hg -v help" to show builtin aliases and global options
697
697
698
698
699
699
700 Test list of commands with command with no help text
700 Test list of commands with command with no help text
701
701
702 $ hg help helpext
702 $ hg help helpext
703 helpext extension - no help text available
703 helpext extension - no help text available
704
704
705 list of commands:
705 list of commands:
706
706
707 nohelp (no help text available)
707 nohelp (no help text available)
708
708
709 use "hg -v help helpext" to show builtin aliases and global options
709 use "hg -v help helpext" to show builtin aliases and global options
710
710
711 Test a help topic
711 Test a help topic
712
712
713 $ hg help revs
713 $ hg help revs
714 Specifying Single Revisions
714 Specifying Single Revisions
715 """""""""""""""""""""""""""
715
716
716 Mercurial supports several ways to specify individual revisions.
717 Mercurial supports several ways to specify individual revisions.
717
718
718 A plain integer is treated as a revision number. Negative integers are
719 A plain integer is treated as a revision number. Negative integers are
719 treated as sequential offsets from the tip, with -1 denoting the tip, -2
720 treated as sequential offsets from the tip, with -1 denoting the tip, -2
720 denoting the revision prior to the tip, and so forth.
721 denoting the revision prior to the tip, and so forth.
721
722
722 A 40-digit hexadecimal string is treated as a unique revision identifier.
723 A 40-digit hexadecimal string is treated as a unique revision identifier.
723
724
724 A hexadecimal string less than 40 characters long is treated as a unique
725 A hexadecimal string less than 40 characters long is treated as a unique
725 revision identifier and is referred to as a short-form identifier. A
726 revision identifier and is referred to as a short-form identifier. A
726 short-form identifier is only valid if it is the prefix of exactly one
727 short-form identifier is only valid if it is the prefix of exactly one
727 full-length identifier.
728 full-length identifier.
728
729
729 Any other string is treated as a bookmark, tag, or branch name. A bookmark
730 Any other string is treated as a bookmark, tag, or branch name. A bookmark
730 is a movable pointer to a revision. A tag is a permanent name associated
731 is a movable pointer to a revision. A tag is a permanent name associated
731 with a revision. A branch name denotes the tipmost revision of that
732 with a revision. A branch name denotes the tipmost revision of that
732 branch. Bookmark, tag, and branch names must not contain the ":"
733 branch. Bookmark, tag, and branch names must not contain the ":"
733 character.
734 character.
734
735
735 The reserved name "tip" always identifies the most recent revision.
736 The reserved name "tip" always identifies the most recent revision.
736
737
737 The reserved name "null" indicates the null revision. This is the revision
738 The reserved name "null" indicates the null revision. This is the revision
738 of an empty repository, and the parent of revision 0.
739 of an empty repository, and the parent of revision 0.
739
740
740 The reserved name "." indicates the working directory parent. If no
741 The reserved name "." indicates the working directory parent. If no
741 working directory is checked out, it is equivalent to null. If an
742 working directory is checked out, it is equivalent to null. If an
742 uncommitted merge is in progress, "." is the revision of the first parent.
743 uncommitted merge is in progress, "." is the revision of the first parent.
743
744
744 Test templating help
745 Test templating help
745
746
746 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
747 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
747 desc String. The text of the changeset description.
748 desc String. The text of the changeset description.
748 diffstat String. Statistics of changes with the following format:
749 diffstat String. Statistics of changes with the following format:
749 firstline Any text. Returns the first line of text.
750 firstline Any text. Returns the first line of text.
750 nonempty Any text. Returns '(none)' if the string is empty.
751 nonempty Any text. Returns '(none)' if the string is empty.
751
752
752 Test help hooks
753 Test help hooks
753
754
754 $ cat > helphook1.py <<EOF
755 $ cat > helphook1.py <<EOF
755 > from mercurial import help
756 > from mercurial import help
756 >
757 >
757 > def rewrite(topic, doc):
758 > def rewrite(topic, doc):
758 > return doc + '\nhelphook1\n'
759 > return doc + '\nhelphook1\n'
759 >
760 >
760 > def extsetup(ui):
761 > def extsetup(ui):
761 > help.addtopichook('revsets', rewrite)
762 > help.addtopichook('revsets', rewrite)
762 > EOF
763 > EOF
763 $ cat > helphook2.py <<EOF
764 $ cat > helphook2.py <<EOF
764 > from mercurial import help
765 > from mercurial import help
765 >
766 >
766 > def rewrite(topic, doc):
767 > def rewrite(topic, doc):
767 > return doc + '\nhelphook2\n'
768 > return doc + '\nhelphook2\n'
768 >
769 >
769 > def extsetup(ui):
770 > def extsetup(ui):
770 > help.addtopichook('revsets', rewrite)
771 > help.addtopichook('revsets', rewrite)
771 > EOF
772 > EOF
772 $ echo '[extensions]' >> $HGRCPATH
773 $ echo '[extensions]' >> $HGRCPATH
773 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
774 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
774 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
775 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
775 $ hg help revsets | grep helphook
776 $ hg help revsets | grep helphook
776 helphook1
777 helphook1
777 helphook2
778 helphook2
778
779
779 Test keyword search help
780 Test keyword search help
780
781
781 $ hg help -k clone
782 $ hg help -k clone
782 Topics:
783 Topics:
783
784
784 config Configuration Files
785 config Configuration Files
785 extensions Using Additional Features
786 extensions Using Additional Features
786 glossary Glossary
787 glossary Glossary
787 phases Working with Phases
788 phases Working with Phases
788 subrepos Subrepositories
789 subrepos Subrepositories
789 urls URL Paths
790 urls URL Paths
790
791
791 Commands:
792 Commands:
792
793
793 bookmarks track a line of development with movable markers
794 bookmarks track a line of development with movable markers
794 clone make a copy of an existing repository
795 clone make a copy of an existing repository
795 paths show aliases for remote repositories
796 paths show aliases for remote repositories
796 update update working directory (or switch revisions)
797 update update working directory (or switch revisions)
797
798
798 Extensions:
799 Extensions:
799
800
800 relink recreates hardlinks between repository clones
801 relink recreates hardlinks between repository clones
801
802
802 Extension Commands:
803 Extension Commands:
803
804
804 qclone clone main and patch repository at same time
805 qclone clone main and patch repository at same time
805
806
806 Test omit indicating for help
807 Test omit indicating for help
807
808
808 $ cat > addverboseitems.py <<EOF
809 $ cat > addverboseitems.py <<EOF
809 > '''extension to test omit indicating.
810 > '''extension to test omit indicating.
810 >
811 >
811 > This paragraph is never omitted (for extension)
812 > This paragraph is never omitted (for extension)
812 >
813 >
813 > .. container:: verbose
814 > .. container:: verbose
814 >
815 >
815 > This paragraph is omitted,
816 > This paragraph is omitted,
816 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
817 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
817 >
818 >
818 > This paragraph is never omitted, too (for extension)
819 > This paragraph is never omitted, too (for extension)
819 > '''
820 > '''
820 >
821 >
821 > from mercurial import help, commands
822 > from mercurial import help, commands
822 > testtopic = """This paragraph is never omitted (for topic).
823 > testtopic = """This paragraph is never omitted (for topic).
823 >
824 >
824 > .. container:: verbose
825 > .. container:: verbose
825 >
826 >
826 > This paragraph is omitted,
827 > This paragraph is omitted,
827 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
828 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
828 >
829 >
829 > This paragraph is never omitted, too (for topic)
830 > This paragraph is never omitted, too (for topic)
830 > """
831 > """
831 > def extsetup(ui):
832 > def extsetup(ui):
832 > help.helptable.append((["topic-containing-verbose"],
833 > help.helptable.append((["topic-containing-verbose"],
833 > "This is the topic to test omit indicating.",
834 > "This is the topic to test omit indicating.",
834 > lambda : testtopic))
835 > lambda : testtopic))
835 > EOF
836 > EOF
836 $ echo '[extensions]' >> $HGRCPATH
837 $ echo '[extensions]' >> $HGRCPATH
837 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
838 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
838 $ hg help addverboseitems
839 $ hg help addverboseitems
839 addverboseitems extension - extension to test omit indicating.
840 addverboseitems extension - extension to test omit indicating.
840
841
841 This paragraph is never omitted (for extension)
842 This paragraph is never omitted (for extension)
842
843
843 This paragraph is never omitted, too (for extension)
844 This paragraph is never omitted, too (for extension)
844
845
845 use "hg help -v addverboseitems" to show more complete help
846 use "hg help -v addverboseitems" to show more complete help
846
847
847 no commands defined
848 no commands defined
848 $ hg help -v addverboseitems
849 $ hg help -v addverboseitems
849 addverboseitems extension - extension to test omit indicating.
850 addverboseitems extension - extension to test omit indicating.
850
851
851 This paragraph is never omitted (for extension)
852 This paragraph is never omitted (for extension)
852
853
853 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
854 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
854
855
855 This paragraph is never omitted, too (for extension)
856 This paragraph is never omitted, too (for extension)
856
857
857 no commands defined
858 no commands defined
858 $ hg help topic-containing-verbose
859 $ hg help topic-containing-verbose
859 This is the topic to test omit indicating.
860 This is the topic to test omit indicating.
861 """"""""""""""""""""""""""""""""""""""""""
860
862
861 This paragraph is never omitted (for topic).
863 This paragraph is never omitted (for topic).
862
864
863 This paragraph is never omitted, too (for topic)
865 This paragraph is never omitted, too (for topic)
864
866
865 use "hg help -v topic-containing-verbose" to show more complete help
867 use "hg help -v topic-containing-verbose" to show more complete help
866 $ hg help -v topic-containing-verbose
868 $ hg help -v topic-containing-verbose
867 This is the topic to test omit indicating.
869 This is the topic to test omit indicating.
870 """"""""""""""""""""""""""""""""""""""""""
868
871
869 This paragraph is never omitted (for topic).
872 This paragraph is never omitted (for topic).
870
873
871 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
874 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
872
875
873 This paragraph is never omitted, too (for topic)
876 This paragraph is never omitted, too (for topic)
874
877
875 Test usage of section marks in help documents
878 Test usage of section marks in help documents
876
879
877 $ cd "$TESTDIR"/../doc
880 $ cd "$TESTDIR"/../doc
878 $ python check-seclevel.py
881 $ python check-seclevel.py
879 $ cd $TESTTMP
882 $ cd $TESTTMP
880
883
881 #if serve
884 #if serve
882
885
883 Test the help pages in hgweb.
886 Test the help pages in hgweb.
884
887
885 Dish up an empty repo; serve it cold.
888 Dish up an empty repo; serve it cold.
886
889
887 $ hg init "$TESTTMP/test"
890 $ hg init "$TESTTMP/test"
888 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
891 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
889 $ cat hg.pid >> $DAEMON_PIDS
892 $ cat hg.pid >> $DAEMON_PIDS
890
893
891 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
894 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
892 200 Script output follows
895 200 Script output follows
893
896
894 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
897 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
895 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
898 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
896 <head>
899 <head>
897 <link rel="icon" href="/static/hgicon.png" type="image/png" />
900 <link rel="icon" href="/static/hgicon.png" type="image/png" />
898 <meta name="robots" content="index, nofollow" />
901 <meta name="robots" content="index, nofollow" />
899 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
902 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
900 <script type="text/javascript" src="/static/mercurial.js"></script>
903 <script type="text/javascript" src="/static/mercurial.js"></script>
901
904
902 <title>Help: Index</title>
905 <title>Help: Index</title>
903 </head>
906 </head>
904 <body>
907 <body>
905
908
906 <div class="container">
909 <div class="container">
907 <div class="menu">
910 <div class="menu">
908 <div class="logo">
911 <div class="logo">
909 <a href="http://mercurial.selenic.com/">
912 <a href="http://mercurial.selenic.com/">
910 <img src="/static/hglogo.png" alt="mercurial" /></a>
913 <img src="/static/hglogo.png" alt="mercurial" /></a>
911 </div>
914 </div>
912 <ul>
915 <ul>
913 <li><a href="/shortlog">log</a></li>
916 <li><a href="/shortlog">log</a></li>
914 <li><a href="/graph">graph</a></li>
917 <li><a href="/graph">graph</a></li>
915 <li><a href="/tags">tags</a></li>
918 <li><a href="/tags">tags</a></li>
916 <li><a href="/bookmarks">bookmarks</a></li>
919 <li><a href="/bookmarks">bookmarks</a></li>
917 <li><a href="/branches">branches</a></li>
920 <li><a href="/branches">branches</a></li>
918 </ul>
921 </ul>
919 <ul>
922 <ul>
920 <li class="active">help</li>
923 <li class="active">help</li>
921 </ul>
924 </ul>
922 </div>
925 </div>
923
926
924 <div class="main">
927 <div class="main">
925 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
928 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
926 <form class="search" action="/log">
929 <form class="search" action="/log">
927
930
928 <p><input name="rev" id="search1" type="text" size="30" /></p>
931 <p><input name="rev" id="search1" type="text" size="30" /></p>
929 <div id="hint">find changesets by author, revision,
932 <div id="hint">find changesets by author, revision,
930 files, or words in the commit message</div>
933 files, or words in the commit message</div>
931 </form>
934 </form>
932 <table class="bigtable">
935 <table class="bigtable">
933 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
936 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
934
937
935 <tr><td>
938 <tr><td>
936 <a href="/help/config">
939 <a href="/help/config">
937 config
940 config
938 </a>
941 </a>
939 </td><td>
942 </td><td>
940 Configuration Files
943 Configuration Files
941 </td></tr>
944 </td></tr>
942 <tr><td>
945 <tr><td>
943 <a href="/help/dates">
946 <a href="/help/dates">
944 dates
947 dates
945 </a>
948 </a>
946 </td><td>
949 </td><td>
947 Date Formats
950 Date Formats
948 </td></tr>
951 </td></tr>
949 <tr><td>
952 <tr><td>
950 <a href="/help/diffs">
953 <a href="/help/diffs">
951 diffs
954 diffs
952 </a>
955 </a>
953 </td><td>
956 </td><td>
954 Diff Formats
957 Diff Formats
955 </td></tr>
958 </td></tr>
956 <tr><td>
959 <tr><td>
957 <a href="/help/environment">
960 <a href="/help/environment">
958 environment
961 environment
959 </a>
962 </a>
960 </td><td>
963 </td><td>
961 Environment Variables
964 Environment Variables
962 </td></tr>
965 </td></tr>
963 <tr><td>
966 <tr><td>
964 <a href="/help/extensions">
967 <a href="/help/extensions">
965 extensions
968 extensions
966 </a>
969 </a>
967 </td><td>
970 </td><td>
968 Using Additional Features
971 Using Additional Features
969 </td></tr>
972 </td></tr>
970 <tr><td>
973 <tr><td>
971 <a href="/help/filesets">
974 <a href="/help/filesets">
972 filesets
975 filesets
973 </a>
976 </a>
974 </td><td>
977 </td><td>
975 Specifying File Sets
978 Specifying File Sets
976 </td></tr>
979 </td></tr>
977 <tr><td>
980 <tr><td>
978 <a href="/help/glossary">
981 <a href="/help/glossary">
979 glossary
982 glossary
980 </a>
983 </a>
981 </td><td>
984 </td><td>
982 Glossary
985 Glossary
983 </td></tr>
986 </td></tr>
984 <tr><td>
987 <tr><td>
985 <a href="/help/hgignore">
988 <a href="/help/hgignore">
986 hgignore
989 hgignore
987 </a>
990 </a>
988 </td><td>
991 </td><td>
989 Syntax for Mercurial Ignore Files
992 Syntax for Mercurial Ignore Files
990 </td></tr>
993 </td></tr>
991 <tr><td>
994 <tr><td>
992 <a href="/help/hgweb">
995 <a href="/help/hgweb">
993 hgweb
996 hgweb
994 </a>
997 </a>
995 </td><td>
998 </td><td>
996 Configuring hgweb
999 Configuring hgweb
997 </td></tr>
1000 </td></tr>
998 <tr><td>
1001 <tr><td>
999 <a href="/help/merge-tools">
1002 <a href="/help/merge-tools">
1000 merge-tools
1003 merge-tools
1001 </a>
1004 </a>
1002 </td><td>
1005 </td><td>
1003 Merge Tools
1006 Merge Tools
1004 </td></tr>
1007 </td></tr>
1005 <tr><td>
1008 <tr><td>
1006 <a href="/help/multirevs">
1009 <a href="/help/multirevs">
1007 multirevs
1010 multirevs
1008 </a>
1011 </a>
1009 </td><td>
1012 </td><td>
1010 Specifying Multiple Revisions
1013 Specifying Multiple Revisions
1011 </td></tr>
1014 </td></tr>
1012 <tr><td>
1015 <tr><td>
1013 <a href="/help/patterns">
1016 <a href="/help/patterns">
1014 patterns
1017 patterns
1015 </a>
1018 </a>
1016 </td><td>
1019 </td><td>
1017 File Name Patterns
1020 File Name Patterns
1018 </td></tr>
1021 </td></tr>
1019 <tr><td>
1022 <tr><td>
1020 <a href="/help/phases">
1023 <a href="/help/phases">
1021 phases
1024 phases
1022 </a>
1025 </a>
1023 </td><td>
1026 </td><td>
1024 Working with Phases
1027 Working with Phases
1025 </td></tr>
1028 </td></tr>
1026 <tr><td>
1029 <tr><td>
1027 <a href="/help/revisions">
1030 <a href="/help/revisions">
1028 revisions
1031 revisions
1029 </a>
1032 </a>
1030 </td><td>
1033 </td><td>
1031 Specifying Single Revisions
1034 Specifying Single Revisions
1032 </td></tr>
1035 </td></tr>
1033 <tr><td>
1036 <tr><td>
1034 <a href="/help/revsets">
1037 <a href="/help/revsets">
1035 revsets
1038 revsets
1036 </a>
1039 </a>
1037 </td><td>
1040 </td><td>
1038 Specifying Revision Sets
1041 Specifying Revision Sets
1039 </td></tr>
1042 </td></tr>
1040 <tr><td>
1043 <tr><td>
1041 <a href="/help/subrepos">
1044 <a href="/help/subrepos">
1042 subrepos
1045 subrepos
1043 </a>
1046 </a>
1044 </td><td>
1047 </td><td>
1045 Subrepositories
1048 Subrepositories
1046 </td></tr>
1049 </td></tr>
1047 <tr><td>
1050 <tr><td>
1048 <a href="/help/templating">
1051 <a href="/help/templating">
1049 templating
1052 templating
1050 </a>
1053 </a>
1051 </td><td>
1054 </td><td>
1052 Template Usage
1055 Template Usage
1053 </td></tr>
1056 </td></tr>
1054 <tr><td>
1057 <tr><td>
1055 <a href="/help/urls">
1058 <a href="/help/urls">
1056 urls
1059 urls
1057 </a>
1060 </a>
1058 </td><td>
1061 </td><td>
1059 URL Paths
1062 URL Paths
1060 </td></tr>
1063 </td></tr>
1061 <tr><td>
1064 <tr><td>
1062 <a href="/help/topic-containing-verbose">
1065 <a href="/help/topic-containing-verbose">
1063 topic-containing-verbose
1066 topic-containing-verbose
1064 </a>
1067 </a>
1065 </td><td>
1068 </td><td>
1066 This is the topic to test omit indicating.
1069 This is the topic to test omit indicating.
1067 </td></tr>
1070 </td></tr>
1068
1071
1069 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1072 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1070
1073
1071 <tr><td>
1074 <tr><td>
1072 <a href="/help/add">
1075 <a href="/help/add">
1073 add
1076 add
1074 </a>
1077 </a>
1075 </td><td>
1078 </td><td>
1076 add the specified files on the next commit
1079 add the specified files on the next commit
1077 </td></tr>
1080 </td></tr>
1078 <tr><td>
1081 <tr><td>
1079 <a href="/help/annotate">
1082 <a href="/help/annotate">
1080 annotate
1083 annotate
1081 </a>
1084 </a>
1082 </td><td>
1085 </td><td>
1083 show changeset information by line for each file
1086 show changeset information by line for each file
1084 </td></tr>
1087 </td></tr>
1085 <tr><td>
1088 <tr><td>
1086 <a href="/help/clone">
1089 <a href="/help/clone">
1087 clone
1090 clone
1088 </a>
1091 </a>
1089 </td><td>
1092 </td><td>
1090 make a copy of an existing repository
1093 make a copy of an existing repository
1091 </td></tr>
1094 </td></tr>
1092 <tr><td>
1095 <tr><td>
1093 <a href="/help/commit">
1096 <a href="/help/commit">
1094 commit
1097 commit
1095 </a>
1098 </a>
1096 </td><td>
1099 </td><td>
1097 commit the specified files or all outstanding changes
1100 commit the specified files or all outstanding changes
1098 </td></tr>
1101 </td></tr>
1099 <tr><td>
1102 <tr><td>
1100 <a href="/help/diff">
1103 <a href="/help/diff">
1101 diff
1104 diff
1102 </a>
1105 </a>
1103 </td><td>
1106 </td><td>
1104 diff repository (or selected files)
1107 diff repository (or selected files)
1105 </td></tr>
1108 </td></tr>
1106 <tr><td>
1109 <tr><td>
1107 <a href="/help/export">
1110 <a href="/help/export">
1108 export
1111 export
1109 </a>
1112 </a>
1110 </td><td>
1113 </td><td>
1111 dump the header and diffs for one or more changesets
1114 dump the header and diffs for one or more changesets
1112 </td></tr>
1115 </td></tr>
1113 <tr><td>
1116 <tr><td>
1114 <a href="/help/forget">
1117 <a href="/help/forget">
1115 forget
1118 forget
1116 </a>
1119 </a>
1117 </td><td>
1120 </td><td>
1118 forget the specified files on the next commit
1121 forget the specified files on the next commit
1119 </td></tr>
1122 </td></tr>
1120 <tr><td>
1123 <tr><td>
1121 <a href="/help/init">
1124 <a href="/help/init">
1122 init
1125 init
1123 </a>
1126 </a>
1124 </td><td>
1127 </td><td>
1125 create a new repository in the given directory
1128 create a new repository in the given directory
1126 </td></tr>
1129 </td></tr>
1127 <tr><td>
1130 <tr><td>
1128 <a href="/help/log">
1131 <a href="/help/log">
1129 log
1132 log
1130 </a>
1133 </a>
1131 </td><td>
1134 </td><td>
1132 show revision history of entire repository or files
1135 show revision history of entire repository or files
1133 </td></tr>
1136 </td></tr>
1134 <tr><td>
1137 <tr><td>
1135 <a href="/help/merge">
1138 <a href="/help/merge">
1136 merge
1139 merge
1137 </a>
1140 </a>
1138 </td><td>
1141 </td><td>
1139 merge working directory with another revision
1142 merge working directory with another revision
1140 </td></tr>
1143 </td></tr>
1141 <tr><td>
1144 <tr><td>
1142 <a href="/help/pull">
1145 <a href="/help/pull">
1143 pull
1146 pull
1144 </a>
1147 </a>
1145 </td><td>
1148 </td><td>
1146 pull changes from the specified source
1149 pull changes from the specified source
1147 </td></tr>
1150 </td></tr>
1148 <tr><td>
1151 <tr><td>
1149 <a href="/help/push">
1152 <a href="/help/push">
1150 push
1153 push
1151 </a>
1154 </a>
1152 </td><td>
1155 </td><td>
1153 push changes to the specified destination
1156 push changes to the specified destination
1154 </td></tr>
1157 </td></tr>
1155 <tr><td>
1158 <tr><td>
1156 <a href="/help/remove">
1159 <a href="/help/remove">
1157 remove
1160 remove
1158 </a>
1161 </a>
1159 </td><td>
1162 </td><td>
1160 remove the specified files on the next commit
1163 remove the specified files on the next commit
1161 </td></tr>
1164 </td></tr>
1162 <tr><td>
1165 <tr><td>
1163 <a href="/help/serve">
1166 <a href="/help/serve">
1164 serve
1167 serve
1165 </a>
1168 </a>
1166 </td><td>
1169 </td><td>
1167 start stand-alone webserver
1170 start stand-alone webserver
1168 </td></tr>
1171 </td></tr>
1169 <tr><td>
1172 <tr><td>
1170 <a href="/help/status">
1173 <a href="/help/status">
1171 status
1174 status
1172 </a>
1175 </a>
1173 </td><td>
1176 </td><td>
1174 show changed files in the working directory
1177 show changed files in the working directory
1175 </td></tr>
1178 </td></tr>
1176 <tr><td>
1179 <tr><td>
1177 <a href="/help/summary">
1180 <a href="/help/summary">
1178 summary
1181 summary
1179 </a>
1182 </a>
1180 </td><td>
1183 </td><td>
1181 summarize working directory state
1184 summarize working directory state
1182 </td></tr>
1185 </td></tr>
1183 <tr><td>
1186 <tr><td>
1184 <a href="/help/update">
1187 <a href="/help/update">
1185 update
1188 update
1186 </a>
1189 </a>
1187 </td><td>
1190 </td><td>
1188 update working directory (or switch revisions)
1191 update working directory (or switch revisions)
1189 </td></tr>
1192 </td></tr>
1190
1193
1191 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1194 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1192
1195
1193 <tr><td>
1196 <tr><td>
1194 <a href="/help/addremove">
1197 <a href="/help/addremove">
1195 addremove
1198 addremove
1196 </a>
1199 </a>
1197 </td><td>
1200 </td><td>
1198 add all new files, delete all missing files
1201 add all new files, delete all missing files
1199 </td></tr>
1202 </td></tr>
1200 <tr><td>
1203 <tr><td>
1201 <a href="/help/archive">
1204 <a href="/help/archive">
1202 archive
1205 archive
1203 </a>
1206 </a>
1204 </td><td>
1207 </td><td>
1205 create an unversioned archive of a repository revision
1208 create an unversioned archive of a repository revision
1206 </td></tr>
1209 </td></tr>
1207 <tr><td>
1210 <tr><td>
1208 <a href="/help/backout">
1211 <a href="/help/backout">
1209 backout
1212 backout
1210 </a>
1213 </a>
1211 </td><td>
1214 </td><td>
1212 reverse effect of earlier changeset
1215 reverse effect of earlier changeset
1213 </td></tr>
1216 </td></tr>
1214 <tr><td>
1217 <tr><td>
1215 <a href="/help/bisect">
1218 <a href="/help/bisect">
1216 bisect
1219 bisect
1217 </a>
1220 </a>
1218 </td><td>
1221 </td><td>
1219 subdivision search of changesets
1222 subdivision search of changesets
1220 </td></tr>
1223 </td></tr>
1221 <tr><td>
1224 <tr><td>
1222 <a href="/help/bookmarks">
1225 <a href="/help/bookmarks">
1223 bookmarks
1226 bookmarks
1224 </a>
1227 </a>
1225 </td><td>
1228 </td><td>
1226 track a line of development with movable markers
1229 track a line of development with movable markers
1227 </td></tr>
1230 </td></tr>
1228 <tr><td>
1231 <tr><td>
1229 <a href="/help/branch">
1232 <a href="/help/branch">
1230 branch
1233 branch
1231 </a>
1234 </a>
1232 </td><td>
1235 </td><td>
1233 set or show the current branch name
1236 set or show the current branch name
1234 </td></tr>
1237 </td></tr>
1235 <tr><td>
1238 <tr><td>
1236 <a href="/help/branches">
1239 <a href="/help/branches">
1237 branches
1240 branches
1238 </a>
1241 </a>
1239 </td><td>
1242 </td><td>
1240 list repository named branches
1243 list repository named branches
1241 </td></tr>
1244 </td></tr>
1242 <tr><td>
1245 <tr><td>
1243 <a href="/help/bundle">
1246 <a href="/help/bundle">
1244 bundle
1247 bundle
1245 </a>
1248 </a>
1246 </td><td>
1249 </td><td>
1247 create a changegroup file
1250 create a changegroup file
1248 </td></tr>
1251 </td></tr>
1249 <tr><td>
1252 <tr><td>
1250 <a href="/help/cat">
1253 <a href="/help/cat">
1251 cat
1254 cat
1252 </a>
1255 </a>
1253 </td><td>
1256 </td><td>
1254 output the current or given revision of files
1257 output the current or given revision of files
1255 </td></tr>
1258 </td></tr>
1256 <tr><td>
1259 <tr><td>
1257 <a href="/help/copy">
1260 <a href="/help/copy">
1258 copy
1261 copy
1259 </a>
1262 </a>
1260 </td><td>
1263 </td><td>
1261 mark files as copied for the next commit
1264 mark files as copied for the next commit
1262 </td></tr>
1265 </td></tr>
1263 <tr><td>
1266 <tr><td>
1264 <a href="/help/graft">
1267 <a href="/help/graft">
1265 graft
1268 graft
1266 </a>
1269 </a>
1267 </td><td>
1270 </td><td>
1268 copy changes from other branches onto the current branch
1271 copy changes from other branches onto the current branch
1269 </td></tr>
1272 </td></tr>
1270 <tr><td>
1273 <tr><td>
1271 <a href="/help/grep">
1274 <a href="/help/grep">
1272 grep
1275 grep
1273 </a>
1276 </a>
1274 </td><td>
1277 </td><td>
1275 search for a pattern in specified files and revisions
1278 search for a pattern in specified files and revisions
1276 </td></tr>
1279 </td></tr>
1277 <tr><td>
1280 <tr><td>
1278 <a href="/help/heads">
1281 <a href="/help/heads">
1279 heads
1282 heads
1280 </a>
1283 </a>
1281 </td><td>
1284 </td><td>
1282 show current repository heads or show branch heads
1285 show current repository heads or show branch heads
1283 </td></tr>
1286 </td></tr>
1284 <tr><td>
1287 <tr><td>
1285 <a href="/help/help">
1288 <a href="/help/help">
1286 help
1289 help
1287 </a>
1290 </a>
1288 </td><td>
1291 </td><td>
1289 show help for a given topic or a help overview
1292 show help for a given topic or a help overview
1290 </td></tr>
1293 </td></tr>
1291 <tr><td>
1294 <tr><td>
1292 <a href="/help/identify">
1295 <a href="/help/identify">
1293 identify
1296 identify
1294 </a>
1297 </a>
1295 </td><td>
1298 </td><td>
1296 identify the working copy or specified revision
1299 identify the working copy or specified revision
1297 </td></tr>
1300 </td></tr>
1298 <tr><td>
1301 <tr><td>
1299 <a href="/help/import">
1302 <a href="/help/import">
1300 import
1303 import
1301 </a>
1304 </a>
1302 </td><td>
1305 </td><td>
1303 import an ordered set of patches
1306 import an ordered set of patches
1304 </td></tr>
1307 </td></tr>
1305 <tr><td>
1308 <tr><td>
1306 <a href="/help/incoming">
1309 <a href="/help/incoming">
1307 incoming
1310 incoming
1308 </a>
1311 </a>
1309 </td><td>
1312 </td><td>
1310 show new changesets found in source
1313 show new changesets found in source
1311 </td></tr>
1314 </td></tr>
1312 <tr><td>
1315 <tr><td>
1313 <a href="/help/locate">
1316 <a href="/help/locate">
1314 locate
1317 locate
1315 </a>
1318 </a>
1316 </td><td>
1319 </td><td>
1317 locate files matching specific patterns
1320 locate files matching specific patterns
1318 </td></tr>
1321 </td></tr>
1319 <tr><td>
1322 <tr><td>
1320 <a href="/help/manifest">
1323 <a href="/help/manifest">
1321 manifest
1324 manifest
1322 </a>
1325 </a>
1323 </td><td>
1326 </td><td>
1324 output the current or given revision of the project manifest
1327 output the current or given revision of the project manifest
1325 </td></tr>
1328 </td></tr>
1326 <tr><td>
1329 <tr><td>
1327 <a href="/help/nohelp">
1330 <a href="/help/nohelp">
1328 nohelp
1331 nohelp
1329 </a>
1332 </a>
1330 </td><td>
1333 </td><td>
1331 (no help text available)
1334 (no help text available)
1332 </td></tr>
1335 </td></tr>
1333 <tr><td>
1336 <tr><td>
1334 <a href="/help/outgoing">
1337 <a href="/help/outgoing">
1335 outgoing
1338 outgoing
1336 </a>
1339 </a>
1337 </td><td>
1340 </td><td>
1338 show changesets not found in the destination
1341 show changesets not found in the destination
1339 </td></tr>
1342 </td></tr>
1340 <tr><td>
1343 <tr><td>
1341 <a href="/help/parents">
1344 <a href="/help/parents">
1342 parents
1345 parents
1343 </a>
1346 </a>
1344 </td><td>
1347 </td><td>
1345 show the parents of the working directory or revision
1348 show the parents of the working directory or revision
1346 </td></tr>
1349 </td></tr>
1347 <tr><td>
1350 <tr><td>
1348 <a href="/help/paths">
1351 <a href="/help/paths">
1349 paths
1352 paths
1350 </a>
1353 </a>
1351 </td><td>
1354 </td><td>
1352 show aliases for remote repositories
1355 show aliases for remote repositories
1353 </td></tr>
1356 </td></tr>
1354 <tr><td>
1357 <tr><td>
1355 <a href="/help/phase">
1358 <a href="/help/phase">
1356 phase
1359 phase
1357 </a>
1360 </a>
1358 </td><td>
1361 </td><td>
1359 set or show the current phase name
1362 set or show the current phase name
1360 </td></tr>
1363 </td></tr>
1361 <tr><td>
1364 <tr><td>
1362 <a href="/help/recover">
1365 <a href="/help/recover">
1363 recover
1366 recover
1364 </a>
1367 </a>
1365 </td><td>
1368 </td><td>
1366 roll back an interrupted transaction
1369 roll back an interrupted transaction
1367 </td></tr>
1370 </td></tr>
1368 <tr><td>
1371 <tr><td>
1369 <a href="/help/rename">
1372 <a href="/help/rename">
1370 rename
1373 rename
1371 </a>
1374 </a>
1372 </td><td>
1375 </td><td>
1373 rename files; equivalent of copy + remove
1376 rename files; equivalent of copy + remove
1374 </td></tr>
1377 </td></tr>
1375 <tr><td>
1378 <tr><td>
1376 <a href="/help/resolve">
1379 <a href="/help/resolve">
1377 resolve
1380 resolve
1378 </a>
1381 </a>
1379 </td><td>
1382 </td><td>
1380 redo merges or set/view the merge status of files
1383 redo merges or set/view the merge status of files
1381 </td></tr>
1384 </td></tr>
1382 <tr><td>
1385 <tr><td>
1383 <a href="/help/revert">
1386 <a href="/help/revert">
1384 revert
1387 revert
1385 </a>
1388 </a>
1386 </td><td>
1389 </td><td>
1387 restore files to their checkout state
1390 restore files to their checkout state
1388 </td></tr>
1391 </td></tr>
1389 <tr><td>
1392 <tr><td>
1390 <a href="/help/rollback">
1393 <a href="/help/rollback">
1391 rollback
1394 rollback
1392 </a>
1395 </a>
1393 </td><td>
1396 </td><td>
1394 roll back the last transaction (dangerous)
1397 roll back the last transaction (dangerous)
1395 </td></tr>
1398 </td></tr>
1396 <tr><td>
1399 <tr><td>
1397 <a href="/help/root">
1400 <a href="/help/root">
1398 root
1401 root
1399 </a>
1402 </a>
1400 </td><td>
1403 </td><td>
1401 print the root (top) of the current working directory
1404 print the root (top) of the current working directory
1402 </td></tr>
1405 </td></tr>
1403 <tr><td>
1406 <tr><td>
1404 <a href="/help/showconfig">
1407 <a href="/help/showconfig">
1405 showconfig
1408 showconfig
1406 </a>
1409 </a>
1407 </td><td>
1410 </td><td>
1408 show combined config settings from all hgrc files
1411 show combined config settings from all hgrc files
1409 </td></tr>
1412 </td></tr>
1410 <tr><td>
1413 <tr><td>
1411 <a href="/help/tag">
1414 <a href="/help/tag">
1412 tag
1415 tag
1413 </a>
1416 </a>
1414 </td><td>
1417 </td><td>
1415 add one or more tags for the current or given revision
1418 add one or more tags for the current or given revision
1416 </td></tr>
1419 </td></tr>
1417 <tr><td>
1420 <tr><td>
1418 <a href="/help/tags">
1421 <a href="/help/tags">
1419 tags
1422 tags
1420 </a>
1423 </a>
1421 </td><td>
1424 </td><td>
1422 list repository tags
1425 list repository tags
1423 </td></tr>
1426 </td></tr>
1424 <tr><td>
1427 <tr><td>
1425 <a href="/help/tip">
1428 <a href="/help/tip">
1426 tip
1429 tip
1427 </a>
1430 </a>
1428 </td><td>
1431 </td><td>
1429 show the tip revision
1432 show the tip revision
1430 </td></tr>
1433 </td></tr>
1431 <tr><td>
1434 <tr><td>
1432 <a href="/help/unbundle">
1435 <a href="/help/unbundle">
1433 unbundle
1436 unbundle
1434 </a>
1437 </a>
1435 </td><td>
1438 </td><td>
1436 apply one or more changegroup files
1439 apply one or more changegroup files
1437 </td></tr>
1440 </td></tr>
1438 <tr><td>
1441 <tr><td>
1439 <a href="/help/verify">
1442 <a href="/help/verify">
1440 verify
1443 verify
1441 </a>
1444 </a>
1442 </td><td>
1445 </td><td>
1443 verify the integrity of the repository
1446 verify the integrity of the repository
1444 </td></tr>
1447 </td></tr>
1445 <tr><td>
1448 <tr><td>
1446 <a href="/help/version">
1449 <a href="/help/version">
1447 version
1450 version
1448 </a>
1451 </a>
1449 </td><td>
1452 </td><td>
1450 output version and copyright information
1453 output version and copyright information
1451 </td></tr>
1454 </td></tr>
1452 </table>
1455 </table>
1453 </div>
1456 </div>
1454 </div>
1457 </div>
1455
1458
1456 <script type="text/javascript">process_dates()</script>
1459 <script type="text/javascript">process_dates()</script>
1457
1460
1458
1461
1459 </body>
1462 </body>
1460 </html>
1463 </html>
1461
1464
1462
1465
1463 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1466 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1464 200 Script output follows
1467 200 Script output follows
1465
1468
1466 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1469 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1467 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1470 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1468 <head>
1471 <head>
1469 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1472 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1470 <meta name="robots" content="index, nofollow" />
1473 <meta name="robots" content="index, nofollow" />
1471 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1474 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1472 <script type="text/javascript" src="/static/mercurial.js"></script>
1475 <script type="text/javascript" src="/static/mercurial.js"></script>
1473
1476
1474 <title>Help: add</title>
1477 <title>Help: add</title>
1475 </head>
1478 </head>
1476 <body>
1479 <body>
1477
1480
1478 <div class="container">
1481 <div class="container">
1479 <div class="menu">
1482 <div class="menu">
1480 <div class="logo">
1483 <div class="logo">
1481 <a href="http://mercurial.selenic.com/">
1484 <a href="http://mercurial.selenic.com/">
1482 <img src="/static/hglogo.png" alt="mercurial" /></a>
1485 <img src="/static/hglogo.png" alt="mercurial" /></a>
1483 </div>
1486 </div>
1484 <ul>
1487 <ul>
1485 <li><a href="/shortlog">log</a></li>
1488 <li><a href="/shortlog">log</a></li>
1486 <li><a href="/graph">graph</a></li>
1489 <li><a href="/graph">graph</a></li>
1487 <li><a href="/tags">tags</a></li>
1490 <li><a href="/tags">tags</a></li>
1488 <li><a href="/bookmarks">bookmarks</a></li>
1491 <li><a href="/bookmarks">bookmarks</a></li>
1489 <li><a href="/branches">branches</a></li>
1492 <li><a href="/branches">branches</a></li>
1490 </ul>
1493 </ul>
1491 <ul>
1494 <ul>
1492 <li class="active"><a href="/help">help</a></li>
1495 <li class="active"><a href="/help">help</a></li>
1493 </ul>
1496 </ul>
1494 </div>
1497 </div>
1495
1498
1496 <div class="main">
1499 <div class="main">
1497 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1500 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1498 <h3>Help: add</h3>
1501 <h3>Help: add</h3>
1499
1502
1500 <form class="search" action="/log">
1503 <form class="search" action="/log">
1501
1504
1502 <p><input name="rev" id="search1" type="text" size="30" /></p>
1505 <p><input name="rev" id="search1" type="text" size="30" /></p>
1503 <div id="hint">find changesets by author, revision,
1506 <div id="hint">find changesets by author, revision,
1504 files, or words in the commit message</div>
1507 files, or words in the commit message</div>
1505 </form>
1508 </form>
1506 <div id="doc">
1509 <div id="doc">
1507 <p>
1510 <p>
1508 hg add [OPTION]... [FILE]...
1511 hg add [OPTION]... [FILE]...
1509 </p>
1512 </p>
1510 <p>
1513 <p>
1511 add the specified files on the next commit
1514 add the specified files on the next commit
1512 </p>
1515 </p>
1513 <p>
1516 <p>
1514 Schedule files to be version controlled and added to the
1517 Schedule files to be version controlled and added to the
1515 repository.
1518 repository.
1516 </p>
1519 </p>
1517 <p>
1520 <p>
1518 The files will be added to the repository at the next commit. To
1521 The files will be added to the repository at the next commit. To
1519 undo an add before that, see "hg forget".
1522 undo an add before that, see "hg forget".
1520 </p>
1523 </p>
1521 <p>
1524 <p>
1522 If no names are given, add all files to the repository.
1525 If no names are given, add all files to the repository.
1523 </p>
1526 </p>
1524 <p>
1527 <p>
1525 Returns 0 if all files are successfully added.
1528 Returns 0 if all files are successfully added.
1526 </p>
1529 </p>
1527 <p>
1530 <p>
1528 options:
1531 options:
1529 </p>
1532 </p>
1530 <table>
1533 <table>
1531 <tr><th>-I</th><th>--include PATTERN [+]</th><th>include names matching the given patterns</th></tr>
1534 <tr><th>-I</th><th>--include PATTERN [+]</th><th>include names matching the given patterns</th></tr>
1532 <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
1535 <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
1533 <tr><td>-S</td><td>--subrepos</td><td>recurse into subrepositories</td></tr>
1536 <tr><td>-S</td><td>--subrepos</td><td>recurse into subrepositories</td></tr>
1534 <tr><td>-n</td><td>--dry-run</td><td>do not perform actions, just print output</td></tr>
1537 <tr><td>-n</td><td>--dry-run</td><td>do not perform actions, just print output</td></tr>
1535 </table>
1538 </table>
1536 <p>
1539 <p>
1537 [+] marked option can be specified multiple times
1540 [+] marked option can be specified multiple times
1538 </p>
1541 </p>
1539 <p>
1542 <p>
1540 global options:
1543 global options:
1541 </p>
1544 </p>
1542 <table>
1545 <table>
1543 <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
1546 <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
1544 <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
1547 <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
1545 <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1548 <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1546 <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
1549 <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
1547 <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
1550 <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
1548 <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
1551 <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
1549 <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
1552 <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
1550 <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
1553 <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
1551 <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
1554 <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
1552 <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
1555 <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
1553 <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
1556 <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
1554 <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
1557 <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
1555 <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
1558 <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
1556 <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
1559 <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
1557 <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
1560 <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
1558 <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></tr>
1561 <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></tr>
1559 </table>
1562 </table>
1560 <p>
1563 <p>
1561 [+] marked option can be specified multiple times
1564 [+] marked option can be specified multiple times
1562 </p>
1565 </p>
1563
1566
1564 </div>
1567 </div>
1565 </div>
1568 </div>
1566 </div>
1569 </div>
1567
1570
1568 <script type="text/javascript">process_dates()</script>
1571 <script type="text/javascript">process_dates()</script>
1569
1572
1570
1573
1571 </body>
1574 </body>
1572 </html>
1575 </html>
1573
1576
1574
1577
1575 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1578 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1576 200 Script output follows
1579 200 Script output follows
1577
1580
1578 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1581 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1579 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1582 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1580 <head>
1583 <head>
1581 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1584 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1582 <meta name="robots" content="index, nofollow" />
1585 <meta name="robots" content="index, nofollow" />
1583 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1586 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1584 <script type="text/javascript" src="/static/mercurial.js"></script>
1587 <script type="text/javascript" src="/static/mercurial.js"></script>
1585
1588
1586 <title>Help: remove</title>
1589 <title>Help: remove</title>
1587 </head>
1590 </head>
1588 <body>
1591 <body>
1589
1592
1590 <div class="container">
1593 <div class="container">
1591 <div class="menu">
1594 <div class="menu">
1592 <div class="logo">
1595 <div class="logo">
1593 <a href="http://mercurial.selenic.com/">
1596 <a href="http://mercurial.selenic.com/">
1594 <img src="/static/hglogo.png" alt="mercurial" /></a>
1597 <img src="/static/hglogo.png" alt="mercurial" /></a>
1595 </div>
1598 </div>
1596 <ul>
1599 <ul>
1597 <li><a href="/shortlog">log</a></li>
1600 <li><a href="/shortlog">log</a></li>
1598 <li><a href="/graph">graph</a></li>
1601 <li><a href="/graph">graph</a></li>
1599 <li><a href="/tags">tags</a></li>
1602 <li><a href="/tags">tags</a></li>
1600 <li><a href="/bookmarks">bookmarks</a></li>
1603 <li><a href="/bookmarks">bookmarks</a></li>
1601 <li><a href="/branches">branches</a></li>
1604 <li><a href="/branches">branches</a></li>
1602 </ul>
1605 </ul>
1603 <ul>
1606 <ul>
1604 <li class="active"><a href="/help">help</a></li>
1607 <li class="active"><a href="/help">help</a></li>
1605 </ul>
1608 </ul>
1606 </div>
1609 </div>
1607
1610
1608 <div class="main">
1611 <div class="main">
1609 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1612 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1610 <h3>Help: remove</h3>
1613 <h3>Help: remove</h3>
1611
1614
1612 <form class="search" action="/log">
1615 <form class="search" action="/log">
1613
1616
1614 <p><input name="rev" id="search1" type="text" size="30" /></p>
1617 <p><input name="rev" id="search1" type="text" size="30" /></p>
1615 <div id="hint">find changesets by author, revision,
1618 <div id="hint">find changesets by author, revision,
1616 files, or words in the commit message</div>
1619 files, or words in the commit message</div>
1617 </form>
1620 </form>
1618 <div id="doc">
1621 <div id="doc">
1619 <p>
1622 <p>
1620 hg remove [OPTION]... FILE...
1623 hg remove [OPTION]... FILE...
1621 </p>
1624 </p>
1622 <p>
1625 <p>
1623 aliases: rm
1626 aliases: rm
1624 </p>
1627 </p>
1625 <p>
1628 <p>
1626 remove the specified files on the next commit
1629 remove the specified files on the next commit
1627 </p>
1630 </p>
1628 <p>
1631 <p>
1629 Schedule the indicated files for removal from the current branch.
1632 Schedule the indicated files for removal from the current branch.
1630 </p>
1633 </p>
1631 <p>
1634 <p>
1632 This command schedules the files to be removed at the next commit.
1635 This command schedules the files to be removed at the next commit.
1633 To undo a remove before that, see "hg revert". To undo added
1636 To undo a remove before that, see "hg revert". To undo added
1634 files, see "hg forget".
1637 files, see "hg forget".
1635 </p>
1638 </p>
1636 <p>
1639 <p>
1637 Returns 0 on success, 1 if any warnings encountered.
1640 Returns 0 on success, 1 if any warnings encountered.
1638 </p>
1641 </p>
1639 <p>
1642 <p>
1640 options:
1643 options:
1641 </p>
1644 </p>
1642 <table>
1645 <table>
1643 <tr><th>-A</th><th>--after</th><th>record delete for missing files</th></tr>
1646 <tr><th>-A</th><th>--after</th><th>record delete for missing files</th></tr>
1644 <tr><td>-f</td><td>--force</td><td>remove (and delete) file even if added or modified</td></tr>
1647 <tr><td>-f</td><td>--force</td><td>remove (and delete) file even if added or modified</td></tr>
1645 <tr><td>-I</td><td>--include PATTERN [+]</td><td>include names matching the given patterns</td></tr>
1648 <tr><td>-I</td><td>--include PATTERN [+]</td><td>include names matching the given patterns</td></tr>
1646 <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
1649 <tr><td>-X</td><td>--exclude PATTERN [+]</td><td>exclude names matching the given patterns</td></tr>
1647 </table>
1650 </table>
1648 <p>
1651 <p>
1649 [+] marked option can be specified multiple times
1652 [+] marked option can be specified multiple times
1650 </p>
1653 </p>
1651 <p>
1654 <p>
1652 global options:
1655 global options:
1653 </p>
1656 </p>
1654 <table>
1657 <table>
1655 <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
1658 <tr><th>-R</th><th>--repository REPO</th><th>repository root directory or name of overlay bundle file</th></tr>
1656 <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
1659 <tr><td></td><td>--cwd DIR</td><td>change working directory</td></tr>
1657 <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1660 <tr><td>-y</td><td>--noninteractive</td><td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1658 <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
1661 <tr><td>-q</td><td>--quiet</td><td>suppress output</td></tr>
1659 <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
1662 <tr><td>-v</td><td>--verbose</td><td>enable additional output</td></tr>
1660 <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
1663 <tr><td></td><td>--config CONFIG [+]</td><td>set/override config option (use 'section.name=value')</td></tr>
1661 <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
1664 <tr><td></td><td>--debug</td><td>enable debugging output</td></tr>
1662 <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
1665 <tr><td></td><td>--debugger</td><td>start debugger</td></tr>
1663 <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
1666 <tr><td></td><td>--encoding ENCODE</td><td>set the charset encoding (default: ascii)</td></tr>
1664 <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
1667 <tr><td></td><td>--encodingmode MODE</td><td>set the charset encoding mode (default: strict)</td></tr>
1665 <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
1668 <tr><td></td><td>--traceback</td><td>always print a traceback on exception</td></tr>
1666 <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
1669 <tr><td></td><td>--time</td><td>time how long the command takes</td></tr>
1667 <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
1670 <tr><td></td><td>--profile</td><td>print command execution profile</td></tr>
1668 <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
1671 <tr><td></td><td>--version</td><td>output version information and exit</td></tr>
1669 <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
1672 <tr><td>-h</td><td>--help</td><td>display help and exit</td></tr>
1670 <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></tr>
1673 <tr><td></td><td>--hidden</td><td>consider hidden changesets</td></tr>
1671 </table>
1674 </table>
1672 <p>
1675 <p>
1673 [+] marked option can be specified multiple times
1676 [+] marked option can be specified multiple times
1674 </p>
1677 </p>
1675
1678
1676 </div>
1679 </div>
1677 </div>
1680 </div>
1678 </div>
1681 </div>
1679
1682
1680 <script type="text/javascript">process_dates()</script>
1683 <script type="text/javascript">process_dates()</script>
1681
1684
1682
1685
1683 </body>
1686 </body>
1684 </html>
1687 </html>
1685
1688
1686
1689
1687 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1690 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1688 200 Script output follows
1691 200 Script output follows
1689
1692
1690 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1693 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1691 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1694 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1692 <head>
1695 <head>
1693 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1696 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1694 <meta name="robots" content="index, nofollow" />
1697 <meta name="robots" content="index, nofollow" />
1695 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1698 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1696 <script type="text/javascript" src="/static/mercurial.js"></script>
1699 <script type="text/javascript" src="/static/mercurial.js"></script>
1697
1700
1698 <title>Help: revisions</title>
1701 <title>Help: revisions</title>
1699 </head>
1702 </head>
1700 <body>
1703 <body>
1701
1704
1702 <div class="container">
1705 <div class="container">
1703 <div class="menu">
1706 <div class="menu">
1704 <div class="logo">
1707 <div class="logo">
1705 <a href="http://mercurial.selenic.com/">
1708 <a href="http://mercurial.selenic.com/">
1706 <img src="/static/hglogo.png" alt="mercurial" /></a>
1709 <img src="/static/hglogo.png" alt="mercurial" /></a>
1707 </div>
1710 </div>
1708 <ul>
1711 <ul>
1709 <li><a href="/shortlog">log</a></li>
1712 <li><a href="/shortlog">log</a></li>
1710 <li><a href="/graph">graph</a></li>
1713 <li><a href="/graph">graph</a></li>
1711 <li><a href="/tags">tags</a></li>
1714 <li><a href="/tags">tags</a></li>
1712 <li><a href="/bookmarks">bookmarks</a></li>
1715 <li><a href="/bookmarks">bookmarks</a></li>
1713 <li><a href="/branches">branches</a></li>
1716 <li><a href="/branches">branches</a></li>
1714 </ul>
1717 </ul>
1715 <ul>
1718 <ul>
1716 <li class="active"><a href="/help">help</a></li>
1719 <li class="active"><a href="/help">help</a></li>
1717 </ul>
1720 </ul>
1718 </div>
1721 </div>
1719
1722
1720 <div class="main">
1723 <div class="main">
1721 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1724 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1722 <h3>Help: revisions</h3>
1725 <h3>Help: revisions</h3>
1723
1726
1724 <form class="search" action="/log">
1727 <form class="search" action="/log">
1725
1728
1726 <p><input name="rev" id="search1" type="text" size="30" /></p>
1729 <p><input name="rev" id="search1" type="text" size="30" /></p>
1727 <div id="hint">find changesets by author, revision,
1730 <div id="hint">find changesets by author, revision,
1728 files, or words in the commit message</div>
1731 files, or words in the commit message</div>
1729 </form>
1732 </form>
1730 <div id="doc">
1733 <div id="doc">
1731 <p>
1734 <h1>Specifying Single Revisions</h1>
1732 Specifying Single Revisions
1733 </p>
1734 <p>
1735 <p>
1735 Mercurial supports several ways to specify individual revisions.
1736 Mercurial supports several ways to specify individual revisions.
1736 </p>
1737 </p>
1737 <p>
1738 <p>
1738 A plain integer is treated as a revision number. Negative integers are
1739 A plain integer is treated as a revision number. Negative integers are
1739 treated as sequential offsets from the tip, with -1 denoting the tip,
1740 treated as sequential offsets from the tip, with -1 denoting the tip,
1740 -2 denoting the revision prior to the tip, and so forth.
1741 -2 denoting the revision prior to the tip, and so forth.
1741 </p>
1742 </p>
1742 <p>
1743 <p>
1743 A 40-digit hexadecimal string is treated as a unique revision
1744 A 40-digit hexadecimal string is treated as a unique revision
1744 identifier.
1745 identifier.
1745 </p>
1746 </p>
1746 <p>
1747 <p>
1747 A hexadecimal string less than 40 characters long is treated as a
1748 A hexadecimal string less than 40 characters long is treated as a
1748 unique revision identifier and is referred to as a short-form
1749 unique revision identifier and is referred to as a short-form
1749 identifier. A short-form identifier is only valid if it is the prefix
1750 identifier. A short-form identifier is only valid if it is the prefix
1750 of exactly one full-length identifier.
1751 of exactly one full-length identifier.
1751 </p>
1752 </p>
1752 <p>
1753 <p>
1753 Any other string is treated as a bookmark, tag, or branch name. A
1754 Any other string is treated as a bookmark, tag, or branch name. A
1754 bookmark is a movable pointer to a revision. A tag is a permanent name
1755 bookmark is a movable pointer to a revision. A tag is a permanent name
1755 associated with a revision. A branch name denotes the tipmost revision
1756 associated with a revision. A branch name denotes the tipmost revision
1756 of that branch. Bookmark, tag, and branch names must not contain the ":"
1757 of that branch. Bookmark, tag, and branch names must not contain the ":"
1757 character.
1758 character.
1758 </p>
1759 </p>
1759 <p>
1760 <p>
1760 The reserved name "tip" always identifies the most recent revision.
1761 The reserved name "tip" always identifies the most recent revision.
1761 </p>
1762 </p>
1762 <p>
1763 <p>
1763 The reserved name "null" indicates the null revision. This is the
1764 The reserved name "null" indicates the null revision. This is the
1764 revision of an empty repository, and the parent of revision 0.
1765 revision of an empty repository, and the parent of revision 0.
1765 </p>
1766 </p>
1766 <p>
1767 <p>
1767 The reserved name "." indicates the working directory parent. If no
1768 The reserved name "." indicates the working directory parent. If no
1768 working directory is checked out, it is equivalent to null. If an
1769 working directory is checked out, it is equivalent to null. If an
1769 uncommitted merge is in progress, "." is the revision of the first
1770 uncommitted merge is in progress, "." is the revision of the first
1770 parent.
1771 parent.
1771 </p>
1772 </p>
1772
1773
1773 </div>
1774 </div>
1774 </div>
1775 </div>
1775 </div>
1776 </div>
1776
1777
1777 <script type="text/javascript">process_dates()</script>
1778 <script type="text/javascript">process_dates()</script>
1778
1779
1779
1780
1780 </body>
1781 </body>
1781 </html>
1782 </html>
1782
1783
1783
1784
1784 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1785 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1785
1786
1786 #endif
1787 #endif
General Comments 0
You need to be logged in to leave comments. Login now