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