##// END OF EJS Templates
minirst: establish leveling for nested definitions
timeless@mozdev.org -
r26237:1c6f7cc5 default
parent child Browse files
Show More
@@ -1,781 +1,795 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 from __future__ import absolute_import
21 from __future__ import absolute_import
22
22
23 import cgi
23 import cgi
24 import re
24 import re
25
25
26 from .i18n import _
26 from .i18n import _
27 from . import (
27 from . import (
28 encoding,
28 encoding,
29 util,
29 util,
30 )
30 )
31
31
32 def section(s):
32 def section(s):
33 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
33 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
34
34
35 def subsection(s):
35 def subsection(s):
36 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
36 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
37
37
38 def subsubsection(s):
38 def subsubsection(s):
39 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
39 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
40
40
41 def subsubsubsection(s):
41 def subsubsubsection(s):
42 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
42 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
43
43
44 def replace(text, substs):
44 def replace(text, substs):
45 '''
45 '''
46 Apply a list of (find, replace) pairs to a text.
46 Apply a list of (find, replace) pairs to a text.
47
47
48 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
48 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
49 'Foo Bar'
49 'Foo Bar'
50 >>> encoding.encoding = 'latin1'
50 >>> encoding.encoding = 'latin1'
51 >>> replace('\\x81\\\\', [('\\\\', '/')])
51 >>> replace('\\x81\\\\', [('\\\\', '/')])
52 '\\x81/'
52 '\\x81/'
53 >>> encoding.encoding = 'shiftjis'
53 >>> encoding.encoding = 'shiftjis'
54 >>> replace('\\x81\\\\', [('\\\\', '/')])
54 >>> replace('\\x81\\\\', [('\\\\', '/')])
55 '\\x81\\\\'
55 '\\x81\\\\'
56 '''
56 '''
57
57
58 # some character encodings (cp932 for Japanese, at least) use
58 # some character encodings (cp932 for Japanese, at least) use
59 # ASCII characters other than control/alphabet/digit as a part of
59 # ASCII characters other than control/alphabet/digit as a part of
60 # multi-bytes characters, so direct replacing with such characters
60 # multi-bytes characters, so direct replacing with such characters
61 # on strings in local encoding causes invalid byte sequences.
61 # on strings in local encoding causes invalid byte sequences.
62 utext = text.decode(encoding.encoding)
62 utext = text.decode(encoding.encoding)
63 for f, t in substs:
63 for f, t in substs:
64 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
64 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
65 return utext.encode(encoding.encoding)
65 return utext.encode(encoding.encoding)
66
66
67 _blockre = re.compile(r"\n(?:\s*\n)+")
67 _blockre = re.compile(r"\n(?:\s*\n)+")
68
68
69 def findblocks(text):
69 def findblocks(text):
70 """Find continuous blocks of lines in text.
70 """Find continuous blocks of lines in text.
71
71
72 Returns a list of dictionaries representing the blocks. Each block
72 Returns a list of dictionaries representing the blocks. Each block
73 has an 'indent' field and a 'lines' field.
73 has an 'indent' field and a 'lines' field.
74 """
74 """
75 blocks = []
75 blocks = []
76 for b in _blockre.split(text.lstrip('\n').rstrip()):
76 for b in _blockre.split(text.lstrip('\n').rstrip()):
77 lines = b.splitlines()
77 lines = b.splitlines()
78 if lines:
78 if lines:
79 indent = min((len(l) - len(l.lstrip())) for l in lines)
79 indent = min((len(l) - len(l.lstrip())) for l in lines)
80 lines = [l[indent:] for l in lines]
80 lines = [l[indent:] for l in lines]
81 blocks.append({'indent': indent, 'lines': lines})
81 blocks.append({'indent': indent, 'lines': lines})
82 return blocks
82 return blocks
83
83
84 def findliteralblocks(blocks):
84 def findliteralblocks(blocks):
85 """Finds literal blocks and adds a 'type' field to the blocks.
85 """Finds literal blocks and adds a 'type' field to the blocks.
86
86
87 Literal blocks are given the type 'literal', all other blocks are
87 Literal blocks are given the type 'literal', all other blocks are
88 given type the 'paragraph'.
88 given type the 'paragraph'.
89 """
89 """
90 i = 0
90 i = 0
91 while i < len(blocks):
91 while i < len(blocks):
92 # Searching for a block that looks like this:
92 # Searching for a block that looks like this:
93 #
93 #
94 # +------------------------------+
94 # +------------------------------+
95 # | paragraph |
95 # | paragraph |
96 # | (ends with "::") |
96 # | (ends with "::") |
97 # +------------------------------+
97 # +------------------------------+
98 # +---------------------------+
98 # +---------------------------+
99 # | indented literal block |
99 # | indented literal block |
100 # +---------------------------+
100 # +---------------------------+
101 blocks[i]['type'] = 'paragraph'
101 blocks[i]['type'] = 'paragraph'
102 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
102 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
103 indent = blocks[i]['indent']
103 indent = blocks[i]['indent']
104 adjustment = blocks[i + 1]['indent'] - indent
104 adjustment = blocks[i + 1]['indent'] - indent
105
105
106 if blocks[i]['lines'] == ['::']:
106 if blocks[i]['lines'] == ['::']:
107 # Expanded form: remove block
107 # Expanded form: remove block
108 del blocks[i]
108 del blocks[i]
109 i -= 1
109 i -= 1
110 elif blocks[i]['lines'][-1].endswith(' ::'):
110 elif blocks[i]['lines'][-1].endswith(' ::'):
111 # Partially minimized form: remove space and both
111 # Partially minimized form: remove space and both
112 # colons.
112 # colons.
113 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
113 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
114 elif len(blocks[i]['lines']) == 1 and \
114 elif len(blocks[i]['lines']) == 1 and \
115 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
115 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
116 blocks[i]['lines'][0].find(' ', 3) == -1:
116 blocks[i]['lines'][0].find(' ', 3) == -1:
117 # directive on its own line, not a literal block
117 # directive on its own line, not a literal block
118 i += 1
118 i += 1
119 continue
119 continue
120 else:
120 else:
121 # Fully minimized form: remove just one colon.
121 # Fully minimized form: remove just one colon.
122 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
122 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
123
123
124 # List items are formatted with a hanging indent. We must
124 # List items are formatted with a hanging indent. We must
125 # correct for this here while we still have the original
125 # correct for this here while we still have the original
126 # information on the indentation of the subsequent literal
126 # information on the indentation of the subsequent literal
127 # blocks available.
127 # blocks available.
128 m = _bulletre.match(blocks[i]['lines'][0])
128 m = _bulletre.match(blocks[i]['lines'][0])
129 if m:
129 if m:
130 indent += m.end()
130 indent += m.end()
131 adjustment -= m.end()
131 adjustment -= m.end()
132
132
133 # Mark the following indented blocks.
133 # Mark the following indented blocks.
134 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
134 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
135 blocks[i + 1]['type'] = 'literal'
135 blocks[i + 1]['type'] = 'literal'
136 blocks[i + 1]['indent'] -= adjustment
136 blocks[i + 1]['indent'] -= adjustment
137 i += 1
137 i += 1
138 i += 1
138 i += 1
139 return blocks
139 return blocks
140
140
141 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
141 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
142 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
142 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
143 r'((.*) +)(.*)$')
143 r'((.*) +)(.*)$')
144 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
144 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
145 _definitionre = re.compile(r'[^ ]')
145 _definitionre = re.compile(r'[^ ]')
146 _tablere = re.compile(r'(=+\s+)*=+')
146 _tablere = re.compile(r'(=+\s+)*=+')
147
147
148 def splitparagraphs(blocks):
148 def splitparagraphs(blocks):
149 """Split paragraphs into lists."""
149 """Split paragraphs into lists."""
150 # Tuples with (list type, item regexp, single line items?). Order
150 # Tuples with (list type, item regexp, single line items?). Order
151 # matters: definition lists has the least specific regexp and must
151 # matters: definition lists has the least specific regexp and must
152 # come last.
152 # come last.
153 listtypes = [('bullet', _bulletre, True),
153 listtypes = [('bullet', _bulletre, True),
154 ('option', _optionre, True),
154 ('option', _optionre, True),
155 ('field', _fieldre, True),
155 ('field', _fieldre, True),
156 ('definition', _definitionre, False)]
156 ('definition', _definitionre, False)]
157
157
158 def match(lines, i, itemre, singleline):
158 def match(lines, i, itemre, singleline):
159 """Does itemre match an item at line i?
159 """Does itemre match an item at line i?
160
160
161 A list item can be followed by an indented line or another list
161 A list item can be followed by an indented line or another list
162 item (but only if singleline is True).
162 item (but only if singleline is True).
163 """
163 """
164 line1 = lines[i]
164 line1 = lines[i]
165 line2 = i + 1 < len(lines) and lines[i + 1] or ''
165 line2 = i + 1 < len(lines) and lines[i + 1] or ''
166 if not itemre.match(line1):
166 if not itemre.match(line1):
167 return False
167 return False
168 if singleline:
168 if singleline:
169 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
169 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
170 else:
170 else:
171 return line2.startswith(' ')
171 return line2.startswith(' ')
172
172
173 i = 0
173 i = 0
174 while i < len(blocks):
174 while i < len(blocks):
175 if blocks[i]['type'] == 'paragraph':
175 if blocks[i]['type'] == 'paragraph':
176 lines = blocks[i]['lines']
176 lines = blocks[i]['lines']
177 for type, itemre, singleline in listtypes:
177 for type, itemre, singleline in listtypes:
178 if match(lines, 0, itemre, singleline):
178 if match(lines, 0, itemre, singleline):
179 items = []
179 items = []
180 for j, line in enumerate(lines):
180 for j, line in enumerate(lines):
181 if match(lines, j, itemre, singleline):
181 if match(lines, j, itemre, singleline):
182 items.append({'type': type, 'lines': [],
182 items.append({'type': type, 'lines': [],
183 'indent': blocks[i]['indent']})
183 'indent': blocks[i]['indent']})
184 items[-1]['lines'].append(line)
184 items[-1]['lines'].append(line)
185 blocks[i:i + 1] = items
185 blocks[i:i + 1] = items
186 break
186 break
187 i += 1
187 i += 1
188 return blocks
188 return blocks
189
189
190 _fieldwidth = 14
190 _fieldwidth = 14
191
191
192 def updatefieldlists(blocks):
192 def updatefieldlists(blocks):
193 """Find key for field lists."""
193 """Find key for field lists."""
194 i = 0
194 i = 0
195 while i < len(blocks):
195 while i < len(blocks):
196 if blocks[i]['type'] != 'field':
196 if blocks[i]['type'] != 'field':
197 i += 1
197 i += 1
198 continue
198 continue
199
199
200 j = i
200 j = i
201 while j < len(blocks) and blocks[j]['type'] == 'field':
201 while j < len(blocks) and blocks[j]['type'] == 'field':
202 m = _fieldre.match(blocks[j]['lines'][0])
202 m = _fieldre.match(blocks[j]['lines'][0])
203 key, rest = m.groups()
203 key, rest = m.groups()
204 blocks[j]['lines'][0] = rest
204 blocks[j]['lines'][0] = rest
205 blocks[j]['key'] = key
205 blocks[j]['key'] = key
206 j += 1
206 j += 1
207
207
208 i = j + 1
208 i = j + 1
209
209
210 return blocks
210 return blocks
211
211
212 def updateoptionlists(blocks):
212 def updateoptionlists(blocks):
213 i = 0
213 i = 0
214 while i < len(blocks):
214 while i < len(blocks):
215 if blocks[i]['type'] != 'option':
215 if blocks[i]['type'] != 'option':
216 i += 1
216 i += 1
217 continue
217 continue
218
218
219 optstrwidth = 0
219 optstrwidth = 0
220 j = i
220 j = i
221 while j < len(blocks) and blocks[j]['type'] == 'option':
221 while j < len(blocks) and blocks[j]['type'] == 'option':
222 m = _optionre.match(blocks[j]['lines'][0])
222 m = _optionre.match(blocks[j]['lines'][0])
223
223
224 shortoption = m.group(2)
224 shortoption = m.group(2)
225 group3 = m.group(3)
225 group3 = m.group(3)
226 longoption = group3[2:].strip()
226 longoption = group3[2:].strip()
227 desc = m.group(6).strip()
227 desc = m.group(6).strip()
228 longoptionarg = m.group(5).strip()
228 longoptionarg = m.group(5).strip()
229 blocks[j]['lines'][0] = desc
229 blocks[j]['lines'][0] = desc
230
230
231 noshortop = ''
231 noshortop = ''
232 if not shortoption:
232 if not shortoption:
233 noshortop = ' '
233 noshortop = ' '
234
234
235 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
235 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
236 ("%s--%s %s") % (noshortop, longoption,
236 ("%s--%s %s") % (noshortop, longoption,
237 longoptionarg))
237 longoptionarg))
238 opt = opt.rstrip()
238 opt = opt.rstrip()
239 blocks[j]['optstr'] = opt
239 blocks[j]['optstr'] = opt
240 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
240 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
241 j += 1
241 j += 1
242
242
243 for block in blocks[i:j]:
243 for block in blocks[i:j]:
244 block['optstrwidth'] = optstrwidth
244 block['optstrwidth'] = optstrwidth
245 i = j + 1
245 i = j + 1
246 return blocks
246 return blocks
247
247
248 def prunecontainers(blocks, keep):
248 def prunecontainers(blocks, keep):
249 """Prune unwanted containers.
249 """Prune unwanted containers.
250
250
251 The blocks must have a 'type' field, i.e., they should have been
251 The blocks must have a 'type' field, i.e., they should have been
252 run through findliteralblocks first.
252 run through findliteralblocks first.
253 """
253 """
254 pruned = []
254 pruned = []
255 i = 0
255 i = 0
256 while i + 1 < len(blocks):
256 while i + 1 < len(blocks):
257 # Searching for a block that looks like this:
257 # Searching for a block that looks like this:
258 #
258 #
259 # +-------+---------------------------+
259 # +-------+---------------------------+
260 # | ".. container ::" type |
260 # | ".. container ::" type |
261 # +---+ |
261 # +---+ |
262 # | blocks |
262 # | blocks |
263 # +-------------------------------+
263 # +-------------------------------+
264 if (blocks[i]['type'] == 'paragraph' and
264 if (blocks[i]['type'] == 'paragraph' and
265 blocks[i]['lines'][0].startswith('.. container::')):
265 blocks[i]['lines'][0].startswith('.. container::')):
266 indent = blocks[i]['indent']
266 indent = blocks[i]['indent']
267 adjustment = blocks[i + 1]['indent'] - indent
267 adjustment = blocks[i + 1]['indent'] - indent
268 containertype = blocks[i]['lines'][0][15:]
268 containertype = blocks[i]['lines'][0][15:]
269 prune = True
269 prune = True
270 for c in keep:
270 for c in keep:
271 if c in containertype.split('.'):
271 if c in containertype.split('.'):
272 prune = False
272 prune = False
273 if prune:
273 if prune:
274 pruned.append(containertype)
274 pruned.append(containertype)
275
275
276 # Always delete "..container:: type" block
276 # Always delete "..container:: type" block
277 del blocks[i]
277 del blocks[i]
278 j = i
278 j = i
279 i -= 1
279 i -= 1
280 while j < len(blocks) and blocks[j]['indent'] > indent:
280 while j < len(blocks) and blocks[j]['indent'] > indent:
281 if prune:
281 if prune:
282 del blocks[j]
282 del blocks[j]
283 else:
283 else:
284 blocks[j]['indent'] -= adjustment
284 blocks[j]['indent'] -= adjustment
285 j += 1
285 j += 1
286 i += 1
286 i += 1
287 return blocks, pruned
287 return blocks, pruned
288
288
289 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
289 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
290
290
291 def findtables(blocks):
291 def findtables(blocks):
292 '''Find simple tables
292 '''Find simple tables
293
293
294 Only simple one-line table elements are supported
294 Only simple one-line table elements are supported
295 '''
295 '''
296
296
297 for block in blocks:
297 for block in blocks:
298 # Searching for a block that looks like this:
298 # Searching for a block that looks like this:
299 #
299 #
300 # === ==== ===
300 # === ==== ===
301 # A B C
301 # A B C
302 # === ==== === <- optional
302 # === ==== === <- optional
303 # 1 2 3
303 # 1 2 3
304 # x y z
304 # x y z
305 # === ==== ===
305 # === ==== ===
306 if (block['type'] == 'paragraph' and
306 if (block['type'] == 'paragraph' and
307 len(block['lines']) > 2 and
307 len(block['lines']) > 2 and
308 _tablere.match(block['lines'][0]) and
308 _tablere.match(block['lines'][0]) and
309 block['lines'][0] == block['lines'][-1]):
309 block['lines'][0] == block['lines'][-1]):
310 block['type'] = 'table'
310 block['type'] = 'table'
311 block['header'] = False
311 block['header'] = False
312 div = block['lines'][0]
312 div = block['lines'][0]
313
313
314 # column markers are ASCII so we can calculate column
314 # column markers are ASCII so we can calculate column
315 # position in bytes
315 # position in bytes
316 columns = [x for x in xrange(len(div))
316 columns = [x for x in xrange(len(div))
317 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
317 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
318 rows = []
318 rows = []
319 for l in block['lines'][1:-1]:
319 for l in block['lines'][1:-1]:
320 if l == div:
320 if l == div:
321 block['header'] = True
321 block['header'] = True
322 continue
322 continue
323 row = []
323 row = []
324 # we measure columns not in bytes or characters but in
324 # we measure columns not in bytes or characters but in
325 # colwidth which makes things tricky
325 # colwidth which makes things tricky
326 pos = columns[0] # leading whitespace is bytes
326 pos = columns[0] # leading whitespace is bytes
327 for n, start in enumerate(columns):
327 for n, start in enumerate(columns):
328 if n + 1 < len(columns):
328 if n + 1 < len(columns):
329 width = columns[n + 1] - start
329 width = columns[n + 1] - start
330 v = encoding.getcols(l, pos, width) # gather columns
330 v = encoding.getcols(l, pos, width) # gather columns
331 pos += len(v) # calculate byte position of end
331 pos += len(v) # calculate byte position of end
332 row.append(v.strip())
332 row.append(v.strip())
333 else:
333 else:
334 row.append(l[pos:].strip())
334 row.append(l[pos:].strip())
335 rows.append(row)
335 rows.append(row)
336
336
337 block['table'] = rows
337 block['table'] = rows
338
338
339 return blocks
339 return blocks
340
340
341 def findsections(blocks):
341 def findsections(blocks):
342 """Finds sections.
342 """Finds sections.
343
343
344 The blocks must have a 'type' field, i.e., they should have been
344 The blocks must have a 'type' field, i.e., they should have been
345 run through findliteralblocks first.
345 run through findliteralblocks first.
346 """
346 """
347 for block in blocks:
347 for block in blocks:
348 # Searching for a block that looks like this:
348 # Searching for a block that looks like this:
349 #
349 #
350 # +------------------------------+
350 # +------------------------------+
351 # | Section title |
351 # | Section title |
352 # | ------------- |
352 # | ------------- |
353 # +------------------------------+
353 # +------------------------------+
354 if (block['type'] == 'paragraph' and
354 if (block['type'] == 'paragraph' and
355 len(block['lines']) == 2 and
355 len(block['lines']) == 2 and
356 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
356 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
357 _sectionre.match(block['lines'][1])):
357 _sectionre.match(block['lines'][1])):
358 block['underline'] = block['lines'][1][0]
358 block['underline'] = block['lines'][1][0]
359 block['type'] = 'section'
359 block['type'] = 'section'
360 del block['lines'][1]
360 del block['lines'][1]
361 return blocks
361 return blocks
362
362
363 def inlineliterals(blocks):
363 def inlineliterals(blocks):
364 substs = [('``', '"')]
364 substs = [('``', '"')]
365 for b in blocks:
365 for b in blocks:
366 if b['type'] in ('paragraph', 'section'):
366 if b['type'] in ('paragraph', 'section'):
367 b['lines'] = [replace(l, substs) for l in b['lines']]
367 b['lines'] = [replace(l, substs) for l in b['lines']]
368 return blocks
368 return blocks
369
369
370 def hgrole(blocks):
370 def hgrole(blocks):
371 substs = [(':hg:`', '"hg '), ('`', '"')]
371 substs = [(':hg:`', '"hg '), ('`', '"')]
372 for b in blocks:
372 for b in blocks:
373 if b['type'] in ('paragraph', 'section'):
373 if b['type'] in ('paragraph', 'section'):
374 # Turn :hg:`command` into "hg command". This also works
374 # Turn :hg:`command` into "hg command". This also works
375 # when there is a line break in the command and relies on
375 # when there is a line break in the command and relies on
376 # the fact that we have no stray back-quotes in the input
376 # the fact that we have no stray back-quotes in the input
377 # (run the blocks through inlineliterals first).
377 # (run the blocks through inlineliterals first).
378 b['lines'] = [replace(l, substs) for l in b['lines']]
378 b['lines'] = [replace(l, substs) for l in b['lines']]
379 return blocks
379 return blocks
380
380
381 def addmargins(blocks):
381 def addmargins(blocks):
382 """Adds empty blocks for vertical spacing.
382 """Adds empty blocks for vertical spacing.
383
383
384 This groups bullets, options, and definitions together with no vertical
384 This groups bullets, options, and definitions together with no vertical
385 space between them, and adds an empty block between all other blocks.
385 space between them, and adds an empty block between all other blocks.
386 """
386 """
387 i = 1
387 i = 1
388 while i < len(blocks):
388 while i < len(blocks):
389 if (blocks[i]['type'] == blocks[i - 1]['type'] and
389 if (blocks[i]['type'] == blocks[i - 1]['type'] and
390 blocks[i]['type'] in ('bullet', 'option', 'field')):
390 blocks[i]['type'] in ('bullet', 'option', 'field')):
391 i += 1
391 i += 1
392 elif not blocks[i - 1]['lines']:
392 elif not blocks[i - 1]['lines']:
393 # no lines in previous block, do not separate
393 # no lines in previous block, do not separate
394 i += 1
394 i += 1
395 else:
395 else:
396 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
396 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
397 i += 2
397 i += 2
398 return blocks
398 return blocks
399
399
400 def prunecomments(blocks):
400 def prunecomments(blocks):
401 """Remove comments."""
401 """Remove comments."""
402 i = 0
402 i = 0
403 while i < len(blocks):
403 while i < len(blocks):
404 b = blocks[i]
404 b = blocks[i]
405 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
405 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
406 b['lines'] == ['..']):
406 b['lines'] == ['..']):
407 del blocks[i]
407 del blocks[i]
408 if i < len(blocks) and blocks[i]['type'] == 'margin':
408 if i < len(blocks) and blocks[i]['type'] == 'margin':
409 del blocks[i]
409 del blocks[i]
410 else:
410 else:
411 i += 1
411 i += 1
412 return blocks
412 return blocks
413
413
414 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
414 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
415 r"error|hint|important|note|tip|warning)::",
415 r"error|hint|important|note|tip|warning)::",
416 flags=re.IGNORECASE)
416 flags=re.IGNORECASE)
417
417
418 def findadmonitions(blocks):
418 def findadmonitions(blocks):
419 """
419 """
420 Makes the type of the block an admonition block if
420 Makes the type of the block an admonition block if
421 the first line is an admonition directive
421 the first line is an admonition directive
422 """
422 """
423 i = 0
423 i = 0
424 while i < len(blocks):
424 while i < len(blocks):
425 m = _admonitionre.match(blocks[i]['lines'][0])
425 m = _admonitionre.match(blocks[i]['lines'][0])
426 if m:
426 if m:
427 blocks[i]['type'] = 'admonition'
427 blocks[i]['type'] = 'admonition'
428 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
428 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
429
429
430 firstline = blocks[i]['lines'][0][m.end() + 1:]
430 firstline = blocks[i]['lines'][0][m.end() + 1:]
431 if firstline:
431 if firstline:
432 blocks[i]['lines'].insert(1, ' ' + firstline)
432 blocks[i]['lines'].insert(1, ' ' + firstline)
433
433
434 blocks[i]['admonitiontitle'] = admonitiontitle
434 blocks[i]['admonitiontitle'] = admonitiontitle
435 del blocks[i]['lines'][0]
435 del blocks[i]['lines'][0]
436 i = i + 1
436 i = i + 1
437 return blocks
437 return blocks
438
438
439 _admonitiontitles = {'attention': _('Attention:'),
439 _admonitiontitles = {'attention': _('Attention:'),
440 'caution': _('Caution:'),
440 'caution': _('Caution:'),
441 'danger': _('!Danger!') ,
441 'danger': _('!Danger!') ,
442 'error': _('Error:'),
442 'error': _('Error:'),
443 'hint': _('Hint:'),
443 'hint': _('Hint:'),
444 'important': _('Important:'),
444 'important': _('Important:'),
445 'note': _('Note:'),
445 'note': _('Note:'),
446 'tip': _('Tip:'),
446 'tip': _('Tip:'),
447 'warning': _('Warning!')}
447 'warning': _('Warning!')}
448
448
449 def formatoption(block, width):
449 def formatoption(block, width):
450 desc = ' '.join(map(str.strip, block['lines']))
450 desc = ' '.join(map(str.strip, block['lines']))
451 colwidth = encoding.colwidth(block['optstr'])
451 colwidth = encoding.colwidth(block['optstr'])
452 usablewidth = width - 1
452 usablewidth = width - 1
453 hanging = block['optstrwidth']
453 hanging = block['optstrwidth']
454 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
454 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
455 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
455 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
456 return ' %s\n' % (util.wrap(desc, usablewidth,
456 return ' %s\n' % (util.wrap(desc, usablewidth,
457 initindent=initindent,
457 initindent=initindent,
458 hangindent=hangindent))
458 hangindent=hangindent))
459
459
460 def formatblock(block, width):
460 def formatblock(block, width):
461 """Format a block according to width."""
461 """Format a block according to width."""
462 if width <= 0:
462 if width <= 0:
463 width = 78
463 width = 78
464 indent = ' ' * block['indent']
464 indent = ' ' * block['indent']
465 if block['type'] == 'admonition':
465 if block['type'] == 'admonition':
466 admonition = _admonitiontitles[block['admonitiontitle']]
466 admonition = _admonitiontitles[block['admonitiontitle']]
467 if not block['lines']:
467 if not block['lines']:
468 return indent + admonition + '\n'
468 return indent + admonition + '\n'
469 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
469 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
470
470
471 defindent = indent + hang * ' '
471 defindent = indent + hang * ' '
472 text = ' '.join(map(str.strip, block['lines']))
472 text = ' '.join(map(str.strip, block['lines']))
473 return '%s\n%s\n' % (indent + admonition,
473 return '%s\n%s\n' % (indent + admonition,
474 util.wrap(text, width=width,
474 util.wrap(text, width=width,
475 initindent=defindent,
475 initindent=defindent,
476 hangindent=defindent))
476 hangindent=defindent))
477 if block['type'] == 'margin':
477 if block['type'] == 'margin':
478 return '\n'
478 return '\n'
479 if block['type'] == 'literal':
479 if block['type'] == 'literal':
480 indent += ' '
480 indent += ' '
481 return indent + ('\n' + indent).join(block['lines']) + '\n'
481 return indent + ('\n' + indent).join(block['lines']) + '\n'
482 if block['type'] == 'section':
482 if block['type'] == 'section':
483 underline = encoding.colwidth(block['lines'][0]) * block['underline']
483 underline = encoding.colwidth(block['lines'][0]) * block['underline']
484 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
484 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
485 if block['type'] == 'table':
485 if block['type'] == 'table':
486 table = block['table']
486 table = block['table']
487 # compute column widths
487 # compute column widths
488 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
488 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
489 text = ''
489 text = ''
490 span = sum(widths) + len(widths) - 1
490 span = sum(widths) + len(widths) - 1
491 indent = ' ' * block['indent']
491 indent = ' ' * block['indent']
492 hang = ' ' * (len(indent) + span - widths[-1])
492 hang = ' ' * (len(indent) + span - widths[-1])
493
493
494 for row in table:
494 for row in table:
495 l = []
495 l = []
496 for w, v in zip(widths, row):
496 for w, v in zip(widths, row):
497 pad = ' ' * (w - encoding.colwidth(v))
497 pad = ' ' * (w - encoding.colwidth(v))
498 l.append(v + pad)
498 l.append(v + pad)
499 l = ' '.join(l)
499 l = ' '.join(l)
500 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
500 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
501 if not text and block['header']:
501 if not text and block['header']:
502 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
502 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
503 else:
503 else:
504 text += l + "\n"
504 text += l + "\n"
505 return text
505 return text
506 if block['type'] == 'definition':
506 if block['type'] == 'definition':
507 term = indent + block['lines'][0]
507 term = indent + block['lines'][0]
508 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
508 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
509 defindent = indent + hang * ' '
509 defindent = indent + hang * ' '
510 text = ' '.join(map(str.strip, block['lines'][1:]))
510 text = ' '.join(map(str.strip, block['lines'][1:]))
511 return '%s\n%s\n' % (term, util.wrap(text, width=width,
511 return '%s\n%s\n' % (term, util.wrap(text, width=width,
512 initindent=defindent,
512 initindent=defindent,
513 hangindent=defindent))
513 hangindent=defindent))
514 subindent = indent
514 subindent = indent
515 if block['type'] == 'bullet':
515 if block['type'] == 'bullet':
516 if block['lines'][0].startswith('| '):
516 if block['lines'][0].startswith('| '):
517 # Remove bullet for line blocks and add no extra
517 # Remove bullet for line blocks and add no extra
518 # indention.
518 # indention.
519 block['lines'][0] = block['lines'][0][2:]
519 block['lines'][0] = block['lines'][0][2:]
520 else:
520 else:
521 m = _bulletre.match(block['lines'][0])
521 m = _bulletre.match(block['lines'][0])
522 subindent = indent + m.end() * ' '
522 subindent = indent + m.end() * ' '
523 elif block['type'] == 'field':
523 elif block['type'] == 'field':
524 key = block['key']
524 key = block['key']
525 subindent = indent + _fieldwidth * ' '
525 subindent = indent + _fieldwidth * ' '
526 if len(key) + 2 > _fieldwidth:
526 if len(key) + 2 > _fieldwidth:
527 # key too large, use full line width
527 # key too large, use full line width
528 key = key.ljust(width)
528 key = key.ljust(width)
529 else:
529 else:
530 # key fits within field width
530 # key fits within field width
531 key = key.ljust(_fieldwidth)
531 key = key.ljust(_fieldwidth)
532 block['lines'][0] = key + block['lines'][0]
532 block['lines'][0] = key + block['lines'][0]
533 elif block['type'] == 'option':
533 elif block['type'] == 'option':
534 return formatoption(block, width)
534 return formatoption(block, width)
535
535
536 text = ' '.join(map(str.strip, block['lines']))
536 text = ' '.join(map(str.strip, block['lines']))
537 return util.wrap(text, width=width,
537 return util.wrap(text, width=width,
538 initindent=indent,
538 initindent=indent,
539 hangindent=subindent) + '\n'
539 hangindent=subindent) + '\n'
540
540
541 def formathtml(blocks):
541 def formathtml(blocks):
542 """Format RST blocks as HTML"""
542 """Format RST blocks as HTML"""
543
543
544 out = []
544 out = []
545 headernest = ''
545 headernest = ''
546 listnest = []
546 listnest = []
547
547
548 def escape(s):
548 def escape(s):
549 return cgi.escape(s, True)
549 return cgi.escape(s, True)
550
550
551 def openlist(start, level):
551 def openlist(start, level):
552 if not listnest or listnest[-1][0] != start:
552 if not listnest or listnest[-1][0] != start:
553 listnest.append((start, level))
553 listnest.append((start, level))
554 out.append('<%s>\n' % start)
554 out.append('<%s>\n' % start)
555
555
556 blocks = [b for b in blocks if b['type'] != 'margin']
556 blocks = [b for b in blocks if b['type'] != 'margin']
557
557
558 for pos, b in enumerate(blocks):
558 for pos, b in enumerate(blocks):
559 btype = b['type']
559 btype = b['type']
560 level = b['indent']
560 level = b['indent']
561 lines = b['lines']
561 lines = b['lines']
562
562
563 if btype == 'admonition':
563 if btype == 'admonition':
564 admonition = escape(_admonitiontitles[b['admonitiontitle']])
564 admonition = escape(_admonitiontitles[b['admonitiontitle']])
565 text = escape(' '.join(map(str.strip, lines)))
565 text = escape(' '.join(map(str.strip, lines)))
566 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
566 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
567 elif btype == 'paragraph':
567 elif btype == 'paragraph':
568 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
568 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
569 elif btype == 'margin':
569 elif btype == 'margin':
570 pass
570 pass
571 elif btype == 'literal':
571 elif btype == 'literal':
572 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
572 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
573 elif btype == 'section':
573 elif btype == 'section':
574 i = b['underline']
574 i = b['underline']
575 if i not in headernest:
575 if i not in headernest:
576 headernest += i
576 headernest += i
577 level = headernest.index(i) + 1
577 level = headernest.index(i) + 1
578 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
578 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
579 elif btype == 'table':
579 elif btype == 'table':
580 table = b['table']
580 table = b['table']
581 out.append('<table>\n')
581 out.append('<table>\n')
582 for row in table:
582 for row in table:
583 out.append('<tr>')
583 out.append('<tr>')
584 for v in row:
584 for v in row:
585 out.append('<td>')
585 out.append('<td>')
586 out.append(escape(v))
586 out.append(escape(v))
587 out.append('</td>')
587 out.append('</td>')
588 out.append('\n')
588 out.append('\n')
589 out.pop()
589 out.pop()
590 out.append('</tr>\n')
590 out.append('</tr>\n')
591 out.append('</table>\n')
591 out.append('</table>\n')
592 elif btype == 'definition':
592 elif btype == 'definition':
593 openlist('dl', level)
593 openlist('dl', level)
594 term = escape(lines[0])
594 term = escape(lines[0])
595 text = escape(' '.join(map(str.strip, lines[1:])))
595 text = escape(' '.join(map(str.strip, lines[1:])))
596 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
596 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
597 elif btype == 'bullet':
597 elif btype == 'bullet':
598 bullet, head = lines[0].split(' ', 1)
598 bullet, head = lines[0].split(' ', 1)
599 if bullet == '-':
599 if bullet == '-':
600 openlist('ul', level)
600 openlist('ul', level)
601 else:
601 else:
602 openlist('ol', level)
602 openlist('ol', level)
603 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
603 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
604 elif btype == 'field':
604 elif btype == 'field':
605 openlist('dl', level)
605 openlist('dl', level)
606 key = escape(b['key'])
606 key = escape(b['key'])
607 text = escape(' '.join(map(str.strip, lines)))
607 text = escape(' '.join(map(str.strip, lines)))
608 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
608 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
609 elif btype == 'option':
609 elif btype == 'option':
610 openlist('dl', level)
610 openlist('dl', level)
611 opt = escape(b['optstr'])
611 opt = escape(b['optstr'])
612 desc = escape(' '.join(map(str.strip, lines)))
612 desc = escape(' '.join(map(str.strip, lines)))
613 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
613 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
614
614
615 # close lists if indent level of next block is lower
615 # close lists if indent level of next block is lower
616 if listnest:
616 if listnest:
617 start, level = listnest[-1]
617 start, level = listnest[-1]
618 if pos == len(blocks) - 1:
618 if pos == len(blocks) - 1:
619 out.append('</%s>\n' % start)
619 out.append('</%s>\n' % start)
620 listnest.pop()
620 listnest.pop()
621 else:
621 else:
622 nb = blocks[pos + 1]
622 nb = blocks[pos + 1]
623 ni = nb['indent']
623 ni = nb['indent']
624 if (ni < level or
624 if (ni < level or
625 (ni == level and
625 (ni == level and
626 nb['type'] not in 'definition bullet field option')):
626 nb['type'] not in 'definition bullet field option')):
627 out.append('</%s>\n' % start)
627 out.append('</%s>\n' % start)
628 listnest.pop()
628 listnest.pop()
629
629
630 return ''.join(out)
630 return ''.join(out)
631
631
632 def parse(text, indent=0, keep=None):
632 def parse(text, indent=0, keep=None):
633 """Parse text into a list of blocks"""
633 """Parse text into a list of blocks"""
634 pruned = []
634 pruned = []
635 blocks = findblocks(text)
635 blocks = findblocks(text)
636 for b in blocks:
636 for b in blocks:
637 b['indent'] += indent
637 b['indent'] += indent
638 blocks = findliteralblocks(blocks)
638 blocks = findliteralblocks(blocks)
639 blocks = findtables(blocks)
639 blocks = findtables(blocks)
640 blocks, pruned = prunecontainers(blocks, keep or [])
640 blocks, pruned = prunecontainers(blocks, keep or [])
641 blocks = findsections(blocks)
641 blocks = findsections(blocks)
642 blocks = inlineliterals(blocks)
642 blocks = inlineliterals(blocks)
643 blocks = hgrole(blocks)
643 blocks = hgrole(blocks)
644 blocks = splitparagraphs(blocks)
644 blocks = splitparagraphs(blocks)
645 blocks = updatefieldlists(blocks)
645 blocks = updatefieldlists(blocks)
646 blocks = updateoptionlists(blocks)
646 blocks = updateoptionlists(blocks)
647 blocks = findadmonitions(blocks)
647 blocks = findadmonitions(blocks)
648 blocks = addmargins(blocks)
648 blocks = addmargins(blocks)
649 blocks = prunecomments(blocks)
649 blocks = prunecomments(blocks)
650 return blocks, pruned
650 return blocks, pruned
651
651
652 def formatblocks(blocks, width):
652 def formatblocks(blocks, width):
653 text = ''.join(formatblock(b, width) for b in blocks)
653 text = ''.join(formatblock(b, width) for b in blocks)
654 return text
654 return text
655
655
656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
657 """Parse and format the text according to width."""
657 """Parse and format the text according to width."""
658 blocks, pruned = parse(text, indent, keep or [])
658 blocks, pruned = parse(text, indent, keep or [])
659 parents = []
659 parents = []
660 if section:
660 if section:
661 sections = getsections(blocks)
661 sections = getsections(blocks)
662 blocks = []
662 blocks = []
663 i = 0
663 i = 0
664 while i < len(sections):
664 while i < len(sections):
665 name, nest, b = sections[i]
665 name, nest, b = sections[i]
666 del parents[nest:]
666 del parents[nest:]
667 parents.append(name)
667 parents.append(name)
668 if name == section:
668 if name == section:
669 b[0]['path'] = parents[3:]
669 b[0]['path'] = parents[3:]
670 blocks.extend(b)
670 blocks.extend(b)
671
671
672 ## Also show all subnested sections
672 ## Also show all subnested sections
673 while i + 1 < len(sections) and sections[i + 1][1] > nest:
673 while i + 1 < len(sections) and sections[i + 1][1] > nest:
674 i += 1
674 i += 1
675 blocks.extend(sections[i][2])
675 blocks.extend(sections[i][2])
676 i += 1
676 i += 1
677
677
678 if style == 'html':
678 if style == 'html':
679 text = formathtml(blocks)
679 text = formathtml(blocks)
680 else:
680 else:
681 if len([b for b in blocks if b['type'] == 'definition']) > 1:
681 if len([b for b in blocks if b['type'] == 'definition']) > 1:
682 i = 0
682 i = 0
683 while i < len(blocks):
683 while i < len(blocks):
684 if blocks[i]['type'] == 'definition':
684 if blocks[i]['type'] == 'definition':
685 if 'path' in blocks[i]:
685 if 'path' in blocks[i]:
686 blocks[i]['lines'][0] = '"%s"' % '.'.join(
686 blocks[i]['lines'][0] = '"%s"' % '.'.join(
687 blocks[i]['path'])
687 blocks[i]['path'])
688 i += 1
688 i += 1
689 text = ''.join(formatblock(b, width) for b in blocks)
689 text = ''.join(formatblock(b, width) for b in blocks)
690 if keep is None:
690 if keep is None:
691 return text
691 return text
692 else:
692 else:
693 return text, pruned
693 return text, pruned
694
694
695 def getsections(blocks):
695 def getsections(blocks):
696 '''return a list of (section name, nesting level, blocks) tuples'''
696 '''return a list of (section name, nesting level, blocks) tuples'''
697 nest = ""
697 nest = ""
698 level = 0
698 level = 0
699 secs = []
699 secs = []
700
700
701 def getname(b):
701 def getname(b):
702 if b['type'] == 'field':
702 if b['type'] == 'field':
703 x = b['key']
703 x = b['key']
704 else:
704 else:
705 x = b['lines'][0]
705 x = b['lines'][0]
706 x = x.lower().strip('"')
706 x = x.lower().strip('"')
707 if '(' in x:
707 if '(' in x:
708 x = x.split('(')[0]
708 x = x.split('(')[0]
709 return x
709 return x
710
710
711 for b in blocks:
711 for b in blocks:
712 if b['type'] == 'section':
712 if b['type'] == 'section':
713 i = b['underline']
713 i = b['underline']
714 if i not in nest:
714 if i not in nest:
715 nest += i
715 nest += i
716 level = nest.index(i) + 1
716 level = nest.index(i) + 1
717 nest = nest[:level]
717 nest = nest[:level]
718 secs.append((getname(b), level, [b]))
718 secs.append((getname(b), level, [b]))
719 elif b['type'] in ('definition', 'field'):
719 elif b['type'] in ('definition', 'field'):
720 i = ' '
720 i = ' '
721 if i not in nest:
721 if i not in nest:
722 nest += i
722 nest += i
723 level = nest.index(i) + 1
723 level = nest.index(i) + 1
724 nest = nest[:level]
724 nest = nest[:level]
725 for i in range(1, len(secs) + 1):
726 sec = secs[-i]
727 if sec[1] < level:
728 break
729 siblings = [a for a in sec[2] if a['type'] == 'definition']
730 if siblings:
731 siblingindent = siblings[-1]['indent']
732 indent = b['indent']
733 if siblingindent < indent:
734 level += 1
735 break
736 elif siblingindent == indent:
737 level = sec[1]
738 break
725 secs.append((getname(b), level, [b]))
739 secs.append((getname(b), level, [b]))
726 else:
740 else:
727 if not secs:
741 if not secs:
728 # add an initial empty section
742 # add an initial empty section
729 secs = [('', 0, [])]
743 secs = [('', 0, [])]
730 if b['type'] != 'margin':
744 if b['type'] != 'margin':
731 pointer = 1
745 pointer = 1
732 bindent = b['indent']
746 bindent = b['indent']
733 while pointer < len(secs):
747 while pointer < len(secs):
734 section = secs[-pointer][2][0]
748 section = secs[-pointer][2][0]
735 if section['type'] != 'margin':
749 if section['type'] != 'margin':
736 sindent = section['indent']
750 sindent = section['indent']
737 if len(section['lines']) > 1:
751 if len(section['lines']) > 1:
738 sindent += len(section['lines'][1]) - \
752 sindent += len(section['lines'][1]) - \
739 len(section['lines'][1].lstrip(' '))
753 len(section['lines'][1].lstrip(' '))
740 if bindent >= sindent:
754 if bindent >= sindent:
741 break
755 break
742 pointer += 1
756 pointer += 1
743 if pointer > 1:
757 if pointer > 1:
744 blevel = secs[-pointer][1]
758 blevel = secs[-pointer][1]
745 if section['type'] != b['type']:
759 if section['type'] != b['type']:
746 blevel += 1
760 blevel += 1
747 secs.append(('', blevel, []))
761 secs.append(('', blevel, []))
748 secs[-1][2].append(b)
762 secs[-1][2].append(b)
749 return secs
763 return secs
750
764
751 def decorateblocks(blocks, width):
765 def decorateblocks(blocks, width):
752 '''generate a list of (section name, line text) pairs for search'''
766 '''generate a list of (section name, line text) pairs for search'''
753 lines = []
767 lines = []
754 for s in getsections(blocks):
768 for s in getsections(blocks):
755 section = s[0]
769 section = s[0]
756 text = formatblocks(s[2], width)
770 text = formatblocks(s[2], width)
757 lines.append([(section, l) for l in text.splitlines(True)])
771 lines.append([(section, l) for l in text.splitlines(True)])
758 return lines
772 return lines
759
773
760 def maketable(data, indent=0, header=False):
774 def maketable(data, indent=0, header=False):
761 '''Generate an RST table for the given table data as a list of lines'''
775 '''Generate an RST table for the given table data as a list of lines'''
762
776
763 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
777 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
764 indent = ' ' * indent
778 indent = ' ' * indent
765 div = indent + ' '.join('=' * w for w in widths) + '\n'
779 div = indent + ' '.join('=' * w for w in widths) + '\n'
766
780
767 out = [div]
781 out = [div]
768 for row in data:
782 for row in data:
769 l = []
783 l = []
770 for w, v in zip(widths, row):
784 for w, v in zip(widths, row):
771 if '\n' in v:
785 if '\n' in v:
772 # only remove line breaks and indentation, long lines are
786 # only remove line breaks and indentation, long lines are
773 # handled by the next tool
787 # handled by the next tool
774 v = ' '.join(e.lstrip() for e in v.split('\n'))
788 v = ' '.join(e.lstrip() for e in v.split('\n'))
775 pad = ' ' * (w - encoding.colwidth(v))
789 pad = ' ' * (w - encoding.colwidth(v))
776 l.append(v + pad)
790 l.append(v + pad)
777 out.append(indent + ' '.join(l) + "\n")
791 out.append(indent + ' '.join(l) + "\n")
778 if header and len(data) > 1:
792 if header and len(data) > 1:
779 out.insert(2, div)
793 out.insert(2, div)
780 out.append(div)
794 out.append(div)
781 return out
795 return out
@@ -1,2317 +1,2323 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 another revision into working directory
17 merge merge another revision into working directory
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 another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a changegroup file
61 bundle create a changegroup file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search for a pattern in specified files and revisions
72 grep search for a pattern in specified files and revisions
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
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 another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more changegroup files
98 unbundle apply one or more changegroup files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 config Configuration Files
105 config Configuration Files
106 dates Date Formats
106 dates Date Formats
107 diffs Diff Formats
107 diffs Diff Formats
108 environment Environment Variables
108 environment Environment Variables
109 extensions Using Additional Features
109 extensions Using Additional Features
110 filesets Specifying File Sets
110 filesets Specifying File Sets
111 glossary Glossary
111 glossary Glossary
112 hgignore Syntax for Mercurial Ignore Files
112 hgignore Syntax for Mercurial Ignore Files
113 hgweb Configuring hgweb
113 hgweb Configuring hgweb
114 merge-tools Merge Tools
114 merge-tools Merge Tools
115 multirevs Specifying Multiple Revisions
115 multirevs Specifying Multiple Revisions
116 patterns File Name Patterns
116 patterns File Name Patterns
117 phases Working with Phases
117 phases Working with Phases
118 revisions Specifying Single Revisions
118 revisions Specifying Single Revisions
119 revsets Specifying Revision Sets
119 revsets Specifying Revision Sets
120 scripting Using Mercurial from scripts and automation
120 scripting Using Mercurial from scripts and automation
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 help -v" to show built-in aliases and global options)
125 (use "hg help -v" to show built-in aliases and global options)
126
126
127 $ hg -q help
127 $ hg -q help
128 add add the specified files on the next commit
128 add add the specified files on the next commit
129 addremove add all new files, delete all missing files
129 addremove add all new files, delete all missing files
130 annotate show changeset information by line for each file
130 annotate show changeset information by line for each file
131 archive create an unversioned archive of a repository revision
131 archive create an unversioned archive of a repository revision
132 backout reverse effect of earlier changeset
132 backout reverse effect of earlier changeset
133 bisect subdivision search of changesets
133 bisect subdivision search of changesets
134 bookmarks create a new bookmark or list existing bookmarks
134 bookmarks create a new bookmark or list existing bookmarks
135 branch set or show the current branch name
135 branch set or show the current branch name
136 branches list repository named branches
136 branches list repository named branches
137 bundle create a changegroup file
137 bundle create a changegroup file
138 cat output the current or given revision of files
138 cat output the current or given revision of files
139 clone make a copy of an existing repository
139 clone make a copy of an existing repository
140 commit commit the specified files or all outstanding changes
140 commit commit the specified files or all outstanding changes
141 config show combined config settings from all hgrc files
141 config show combined config settings from all hgrc files
142 copy mark files as copied for the next commit
142 copy mark files as copied for the next commit
143 diff diff repository (or selected files)
143 diff diff repository (or selected files)
144 export dump the header and diffs for one or more changesets
144 export dump the header and diffs for one or more changesets
145 files list tracked files
145 files list tracked files
146 forget forget the specified files on the next commit
146 forget forget the specified files on the next commit
147 graft copy changes from other branches onto the current branch
147 graft copy changes from other branches onto the current branch
148 grep search for a pattern in specified files and revisions
148 grep search for a pattern in specified files and revisions
149 heads show branch heads
149 heads show branch heads
150 help show help for a given topic or a help overview
150 help show help for a given topic or a help overview
151 identify identify the working directory or specified revision
151 identify identify the working directory or specified revision
152 import import an ordered set of patches
152 import import an ordered set of patches
153 incoming show new changesets found in source
153 incoming show new changesets found in source
154 init create a new repository in the given directory
154 init create a new repository in the given directory
155 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 another revision into working directory
157 merge merge another revision into working directory
158 outgoing show changesets not found in the destination
158 outgoing show changesets not found in the destination
159 paths show aliases for remote repositories
159 paths show aliases for remote repositories
160 phase set or show the current phase name
160 phase set or show the current phase name
161 pull pull changes from the specified source
161 pull pull changes from the specified source
162 push push changes to the specified destination
162 push push changes to the specified destination
163 recover roll back an interrupted transaction
163 recover roll back an interrupted transaction
164 remove remove the specified files on the next commit
164 remove remove the specified files on the next commit
165 rename rename files; equivalent of copy + remove
165 rename rename files; equivalent of copy + remove
166 resolve redo merges or set/view the merge status of files
166 resolve redo merges or set/view the merge status of files
167 revert restore files to their checkout state
167 revert restore files to their checkout state
168 root print the root (top) of the current working directory
168 root print the root (top) of the current working directory
169 serve start stand-alone webserver
169 serve start stand-alone webserver
170 status show changed files in the working directory
170 status show changed files in the working directory
171 summary summarize working directory state
171 summary summarize working directory state
172 tag add one or more tags for the current or given revision
172 tag add one or more tags for the current or given revision
173 tags list repository tags
173 tags list repository tags
174 unbundle apply one or more changegroup files
174 unbundle apply one or more changegroup files
175 update update working directory (or switch revisions)
175 update update working directory (or switch revisions)
176 verify verify the integrity of the repository
176 verify verify the integrity of the repository
177 version output version and copyright information
177 version output version and copyright information
178
178
179 additional help topics:
179 additional help topics:
180
180
181 config Configuration Files
181 config Configuration Files
182 dates Date Formats
182 dates Date Formats
183 diffs Diff Formats
183 diffs Diff Formats
184 environment Environment Variables
184 environment Environment Variables
185 extensions Using Additional Features
185 extensions Using Additional Features
186 filesets Specifying File Sets
186 filesets Specifying File Sets
187 glossary Glossary
187 glossary Glossary
188 hgignore Syntax for Mercurial Ignore Files
188 hgignore Syntax for Mercurial Ignore Files
189 hgweb Configuring hgweb
189 hgweb Configuring hgweb
190 merge-tools Merge Tools
190 merge-tools Merge Tools
191 multirevs Specifying Multiple Revisions
191 multirevs Specifying Multiple Revisions
192 patterns File Name Patterns
192 patterns File Name Patterns
193 phases Working with Phases
193 phases Working with Phases
194 revisions Specifying Single Revisions
194 revisions Specifying Single Revisions
195 revsets Specifying Revision Sets
195 revsets Specifying Revision Sets
196 scripting Using Mercurial from scripts and automation
196 scripting Using Mercurial from scripts and automation
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 censor erase file content at a given revision
250 censor erase file content at a given revision
251 churn command to display statistics about repository history
251 churn command to display statistics about repository history
252 color colorize output from some commands
252 color colorize output from some commands
253 convert import revisions from foreign VCS repositories into
253 convert import revisions from foreign VCS repositories into
254 Mercurial
254 Mercurial
255 eol automatically manage newlines in repository files
255 eol automatically manage newlines in repository files
256 extdiff command to allow external programs to compare revisions
256 extdiff command to allow external programs to compare revisions
257 factotum http authentication with factotum
257 factotum http authentication with factotum
258 gpg commands to sign and verify changesets
258 gpg commands to sign and verify changesets
259 hgcia hooks for integrating with the CIA.vc notification service
259 hgcia hooks for integrating with the CIA.vc notification service
260 hgk browse the repository in a graphical way
260 hgk browse the repository in a graphical way
261 highlight syntax highlighting for hgweb (requires Pygments)
261 highlight syntax highlighting for hgweb (requires Pygments)
262 histedit interactive history editing
262 histedit interactive history editing
263 keyword expand keywords in tracked files
263 keyword expand keywords in tracked files
264 largefiles track large binary files
264 largefiles track large binary files
265 mq manage a stack of patches
265 mq manage a stack of patches
266 notify hooks for sending email push notifications
266 notify hooks for sending email push notifications
267 pager browse command output with an external pager
267 pager browse command output with an external pager
268 patchbomb command to send changesets as (a series of) patch emails
268 patchbomb command to send changesets as (a series of) patch emails
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 descendants from history
277 strip strip changesets and their descendants 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 another revision into working directory
298 merge merge another revision into working directory
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 ([+] can be repeated):
308 global options ([+] can be repeated):
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 (use "hg help" for the full list of commands)
329 (use "hg help" for the full list of commands)
330
330
331 $ hg add -h
331 $ hg add -h
332 hg add [OPTION]... [FILE]...
332 hg add [OPTION]... [FILE]...
333
333
334 add the specified files on the next commit
334 add the specified files on the next commit
335
335
336 Schedule files to be version controlled and added to the repository.
336 Schedule files to be version controlled and added to the repository.
337
337
338 The files will be added to the repository at the next commit. To undo an
338 The files will be added to the repository at the next commit. To undo an
339 add before that, see "hg forget".
339 add before that, see "hg forget".
340
340
341 If no names are given, add all files to the repository.
341 If no names are given, add all files to the repository.
342
342
343 Returns 0 if all files are successfully added.
343 Returns 0 if all files are successfully added.
344
344
345 options ([+] can be repeated):
345 options ([+] can be repeated):
346
346
347 -I --include PATTERN [+] include names matching the given patterns
347 -I --include PATTERN [+] include names matching the given patterns
348 -X --exclude PATTERN [+] exclude names matching the given patterns
348 -X --exclude PATTERN [+] exclude names matching the given patterns
349 -S --subrepos recurse into subrepositories
349 -S --subrepos recurse into subrepositories
350 -n --dry-run do not perform actions, just print output
350 -n --dry-run do not perform actions, just print output
351
351
352 (some details hidden, use --verbose to show complete help)
352 (some details hidden, use --verbose to show complete help)
353
353
354 Verbose help for add
354 Verbose help for add
355
355
356 $ hg add -hv
356 $ hg add -hv
357 hg add [OPTION]... [FILE]...
357 hg add [OPTION]... [FILE]...
358
358
359 add the specified files on the next commit
359 add the specified files on the next commit
360
360
361 Schedule files to be version controlled and added to the repository.
361 Schedule files to be version controlled and added to the repository.
362
362
363 The files will be added to the repository at the next commit. To undo an
363 The files will be added to the repository at the next commit. To undo an
364 add before that, see "hg forget".
364 add before that, see "hg forget".
365
365
366 If no names are given, add all files to the repository.
366 If no names are given, add all files to the repository.
367
367
368 An example showing how new (unknown) files are added automatically by "hg
368 An example showing how new (unknown) files are added automatically by "hg
369 add":
369 add":
370
370
371 $ ls
371 $ ls
372 foo.c
372 foo.c
373 $ hg status
373 $ hg status
374 ? foo.c
374 ? foo.c
375 $ hg add
375 $ hg add
376 adding foo.c
376 adding foo.c
377 $ hg status
377 $ hg status
378 A foo.c
378 A foo.c
379
379
380 Returns 0 if all files are successfully added.
380 Returns 0 if all files are successfully added.
381
381
382 options ([+] can be repeated):
382 options ([+] can be repeated):
383
383
384 -I --include PATTERN [+] include names matching the given patterns
384 -I --include PATTERN [+] include names matching the given patterns
385 -X --exclude PATTERN [+] exclude names matching the given patterns
385 -X --exclude PATTERN [+] exclude names matching the given patterns
386 -S --subrepos recurse into subrepositories
386 -S --subrepos recurse into subrepositories
387 -n --dry-run do not perform actions, just print output
387 -n --dry-run do not perform actions, just print output
388
388
389 global options ([+] can be repeated):
389 global options ([+] can be repeated):
390
390
391 -R --repository REPO repository root directory or name of overlay bundle
391 -R --repository REPO repository root directory or name of overlay bundle
392 file
392 file
393 --cwd DIR change working directory
393 --cwd DIR change working directory
394 -y --noninteractive do not prompt, automatically pick the first choice for
394 -y --noninteractive do not prompt, automatically pick the first choice for
395 all prompts
395 all prompts
396 -q --quiet suppress output
396 -q --quiet suppress output
397 -v --verbose enable additional output
397 -v --verbose enable additional output
398 --config CONFIG [+] set/override config option (use 'section.name=value')
398 --config CONFIG [+] set/override config option (use 'section.name=value')
399 --debug enable debugging output
399 --debug enable debugging output
400 --debugger start debugger
400 --debugger start debugger
401 --encoding ENCODE set the charset encoding (default: ascii)
401 --encoding ENCODE set the charset encoding (default: ascii)
402 --encodingmode MODE set the charset encoding mode (default: strict)
402 --encodingmode MODE set the charset encoding mode (default: strict)
403 --traceback always print a traceback on exception
403 --traceback always print a traceback on exception
404 --time time how long the command takes
404 --time time how long the command takes
405 --profile print command execution profile
405 --profile print command execution profile
406 --version output version information and exit
406 --version output version information and exit
407 -h --help display help and exit
407 -h --help display help and exit
408 --hidden consider hidden changesets
408 --hidden consider hidden changesets
409
409
410 Test help option with version option
410 Test help option with version option
411
411
412 $ hg add -h --version
412 $ hg add -h --version
413 Mercurial Distributed SCM (version *) (glob)
413 Mercurial Distributed SCM (version *) (glob)
414 (see http://mercurial.selenic.com for more information)
414 (see http://mercurial.selenic.com for more information)
415
415
416 Copyright (C) 2005-2015 Matt Mackall and others
416 Copyright (C) 2005-2015 Matt Mackall and others
417 This is free software; see the source for copying conditions. There is NO
417 This is free software; see the source for copying conditions. There is NO
418 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
418 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
419
419
420 $ hg add --skjdfks
420 $ hg add --skjdfks
421 hg add: option --skjdfks not recognized
421 hg add: option --skjdfks not recognized
422 hg add [OPTION]... [FILE]...
422 hg add [OPTION]... [FILE]...
423
423
424 add the specified files on the next commit
424 add the specified files on the next commit
425
425
426 options ([+] can be repeated):
426 options ([+] can be repeated):
427
427
428 -I --include PATTERN [+] include names matching the given patterns
428 -I --include PATTERN [+] include names matching the given patterns
429 -X --exclude PATTERN [+] exclude names matching the given patterns
429 -X --exclude PATTERN [+] exclude names matching the given patterns
430 -S --subrepos recurse into subrepositories
430 -S --subrepos recurse into subrepositories
431 -n --dry-run do not perform actions, just print output
431 -n --dry-run do not perform actions, just print output
432
432
433 (use "hg add -h" to show more help)
433 (use "hg add -h" to show more help)
434 [255]
434 [255]
435
435
436 Test ambiguous command help
436 Test ambiguous command help
437
437
438 $ hg help ad
438 $ hg help ad
439 list of commands:
439 list of commands:
440
440
441 add add the specified files on the next commit
441 add add the specified files on the next commit
442 addremove add all new files, delete all missing files
442 addremove add all new files, delete all missing files
443
443
444 (use "hg help -v ad" to show built-in aliases and global options)
444 (use "hg help -v ad" to show built-in aliases and global options)
445
445
446 Test command without options
446 Test command without options
447
447
448 $ hg help verify
448 $ hg help verify
449 hg verify
449 hg verify
450
450
451 verify the integrity of the repository
451 verify the integrity of the repository
452
452
453 Verify the integrity of the current repository.
453 Verify the integrity of the current repository.
454
454
455 This will perform an extensive check of the repository's integrity,
455 This will perform an extensive check of the repository's integrity,
456 validating the hashes and checksums of each entry in the changelog,
456 validating the hashes and checksums of each entry in the changelog,
457 manifest, and tracked files, as well as the integrity of their crosslinks
457 manifest, and tracked files, as well as the integrity of their crosslinks
458 and indices.
458 and indices.
459
459
460 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
460 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
461 information about recovery from corruption of the repository.
461 information about recovery from corruption of the repository.
462
462
463 Returns 0 on success, 1 if errors are encountered.
463 Returns 0 on success, 1 if errors are encountered.
464
464
465 (some details hidden, use --verbose to show complete help)
465 (some details hidden, use --verbose to show complete help)
466
466
467 $ hg help diff
467 $ hg help diff
468 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
468 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
469
469
470 diff repository (or selected files)
470 diff repository (or selected files)
471
471
472 Show differences between revisions for the specified files.
472 Show differences between revisions for the specified files.
473
473
474 Differences between files are shown using the unified diff format.
474 Differences between files are shown using the unified diff format.
475
475
476 Note:
476 Note:
477 diff may generate unexpected results for merges, as it will default to
477 diff may generate unexpected results for merges, as it will default to
478 comparing against the working directory's first parent changeset if no
478 comparing against the working directory's first parent changeset if no
479 revisions are specified.
479 revisions are specified.
480
480
481 When two revision arguments are given, then changes are shown between
481 When two revision arguments are given, then changes are shown between
482 those revisions. If only one revision is specified then that revision is
482 those revisions. If only one revision is specified then that revision is
483 compared to the working directory, and, when no revisions are specified,
483 compared to the working directory, and, when no revisions are specified,
484 the working directory files are compared to its parent.
484 the working directory files are compared to its parent.
485
485
486 Alternatively you can specify -c/--change with a revision to see the
486 Alternatively you can specify -c/--change with a revision to see the
487 changes in that changeset relative to its first parent.
487 changes in that changeset relative to its first parent.
488
488
489 Without the -a/--text option, diff will avoid generating diffs of files it
489 Without the -a/--text option, diff will avoid generating diffs of files it
490 detects as binary. With -a, diff will generate a diff anyway, probably
490 detects as binary. With -a, diff will generate a diff anyway, probably
491 with undesirable results.
491 with undesirable results.
492
492
493 Use the -g/--git option to generate diffs in the git extended diff format.
493 Use the -g/--git option to generate diffs in the git extended diff format.
494 For more information, read "hg help diffs".
494 For more information, read "hg help diffs".
495
495
496 Returns 0 on success.
496 Returns 0 on success.
497
497
498 options ([+] can be repeated):
498 options ([+] can be repeated):
499
499
500 -r --rev REV [+] revision
500 -r --rev REV [+] revision
501 -c --change REV change made by revision
501 -c --change REV change made by revision
502 -a --text treat all files as text
502 -a --text treat all files as text
503 -g --git use git extended diff format
503 -g --git use git extended diff format
504 --nodates omit dates from diff headers
504 --nodates omit dates from diff headers
505 --noprefix omit a/ and b/ prefixes from filenames
505 --noprefix omit a/ and b/ prefixes from filenames
506 -p --show-function show which function each change is in
506 -p --show-function show which function each change is in
507 --reverse produce a diff that undoes the changes
507 --reverse produce a diff that undoes the changes
508 -w --ignore-all-space ignore white space when comparing lines
508 -w --ignore-all-space ignore white space when comparing lines
509 -b --ignore-space-change ignore changes in the amount of white space
509 -b --ignore-space-change ignore changes in the amount of white space
510 -B --ignore-blank-lines ignore changes whose lines are all blank
510 -B --ignore-blank-lines ignore changes whose lines are all blank
511 -U --unified NUM number of lines of context to show
511 -U --unified NUM number of lines of context to show
512 --stat output diffstat-style summary of changes
512 --stat output diffstat-style summary of changes
513 --root DIR produce diffs relative to subdirectory
513 --root DIR produce diffs relative to subdirectory
514 -I --include PATTERN [+] include names matching the given patterns
514 -I --include PATTERN [+] include names matching the given patterns
515 -X --exclude PATTERN [+] exclude names matching the given patterns
515 -X --exclude PATTERN [+] exclude names matching the given patterns
516 -S --subrepos recurse into subrepositories
516 -S --subrepos recurse into subrepositories
517
517
518 (some details hidden, use --verbose to show complete help)
518 (some details hidden, use --verbose to show complete help)
519
519
520 $ hg help status
520 $ hg help status
521 hg status [OPTION]... [FILE]...
521 hg status [OPTION]... [FILE]...
522
522
523 aliases: st
523 aliases: st
524
524
525 show changed files in the working directory
525 show changed files in the working directory
526
526
527 Show status of files in the repository. If names are given, only files
527 Show status of files in the repository. If names are given, only files
528 that match are shown. Files that are clean or ignored or the source of a
528 that match are shown. Files that are clean or ignored or the source of a
529 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
529 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
530 -C/--copies or -A/--all are given. Unless options described with "show
530 -C/--copies or -A/--all are given. Unless options described with "show
531 only ..." are given, the options -mardu are used.
531 only ..." are given, the options -mardu are used.
532
532
533 Option -q/--quiet hides untracked (unknown and ignored) files unless
533 Option -q/--quiet hides untracked (unknown and ignored) files unless
534 explicitly requested with -u/--unknown or -i/--ignored.
534 explicitly requested with -u/--unknown or -i/--ignored.
535
535
536 Note:
536 Note:
537 status may appear to disagree with diff if permissions have changed or
537 status may appear to disagree with diff if permissions have changed or
538 a merge has occurred. The standard diff format does not report
538 a merge has occurred. The standard diff format does not report
539 permission changes and diff only reports changes relative to one merge
539 permission changes and diff only reports changes relative to one merge
540 parent.
540 parent.
541
541
542 If one revision is given, it is used as the base revision. If two
542 If one revision is given, it is used as the base revision. If two
543 revisions are given, the differences between them are shown. The --change
543 revisions are given, the differences between them are shown. The --change
544 option can also be used as a shortcut to list the changed files of a
544 option can also be used as a shortcut to list the changed files of a
545 revision from its first parent.
545 revision from its first parent.
546
546
547 The codes used to show the status of files are:
547 The codes used to show the status of files are:
548
548
549 M = modified
549 M = modified
550 A = added
550 A = added
551 R = removed
551 R = removed
552 C = clean
552 C = clean
553 ! = missing (deleted by non-hg command, but still tracked)
553 ! = missing (deleted by non-hg command, but still tracked)
554 ? = not tracked
554 ? = not tracked
555 I = ignored
555 I = ignored
556 = origin of the previous file (with --copies)
556 = origin of the previous file (with --copies)
557
557
558 Returns 0 on success.
558 Returns 0 on success.
559
559
560 options ([+] can be repeated):
560 options ([+] can be repeated):
561
561
562 -A --all show status of all files
562 -A --all show status of all files
563 -m --modified show only modified files
563 -m --modified show only modified files
564 -a --added show only added files
564 -a --added show only added files
565 -r --removed show only removed files
565 -r --removed show only removed files
566 -d --deleted show only deleted (but tracked) files
566 -d --deleted show only deleted (but tracked) files
567 -c --clean show only files without changes
567 -c --clean show only files without changes
568 -u --unknown show only unknown (not tracked) files
568 -u --unknown show only unknown (not tracked) files
569 -i --ignored show only ignored files
569 -i --ignored show only ignored files
570 -n --no-status hide status prefix
570 -n --no-status hide status prefix
571 -C --copies show source of copied files
571 -C --copies show source of copied files
572 -0 --print0 end filenames with NUL, for use with xargs
572 -0 --print0 end filenames with NUL, for use with xargs
573 --rev REV [+] show difference from revision
573 --rev REV [+] show difference from revision
574 --change REV list the changed files of a revision
574 --change REV list the changed files of a revision
575 -I --include PATTERN [+] include names matching the given patterns
575 -I --include PATTERN [+] include names matching the given patterns
576 -X --exclude PATTERN [+] exclude names matching the given patterns
576 -X --exclude PATTERN [+] exclude names matching the given patterns
577 -S --subrepos recurse into subrepositories
577 -S --subrepos recurse into subrepositories
578
578
579 (some details hidden, use --verbose to show complete help)
579 (some details hidden, use --verbose to show complete help)
580
580
581 $ hg -q help status
581 $ hg -q help status
582 hg status [OPTION]... [FILE]...
582 hg status [OPTION]... [FILE]...
583
583
584 show changed files in the working directory
584 show changed files in the working directory
585
585
586 $ hg help foo
586 $ hg help foo
587 abort: no such help topic: foo
587 abort: no such help topic: foo
588 (try "hg help --keyword foo")
588 (try "hg help --keyword foo")
589 [255]
589 [255]
590
590
591 $ hg skjdfks
591 $ hg skjdfks
592 hg: unknown command 'skjdfks'
592 hg: unknown command 'skjdfks'
593 Mercurial Distributed SCM
593 Mercurial Distributed SCM
594
594
595 basic commands:
595 basic commands:
596
596
597 add add the specified files on the next commit
597 add add the specified files on the next commit
598 annotate show changeset information by line for each file
598 annotate show changeset information by line for each file
599 clone make a copy of an existing repository
599 clone make a copy of an existing repository
600 commit commit the specified files or all outstanding changes
600 commit commit the specified files or all outstanding changes
601 diff diff repository (or selected files)
601 diff diff repository (or selected files)
602 export dump the header and diffs for one or more changesets
602 export dump the header and diffs for one or more changesets
603 forget forget the specified files on the next commit
603 forget forget the specified files on the next commit
604 init create a new repository in the given directory
604 init create a new repository in the given directory
605 log show revision history of entire repository or files
605 log show revision history of entire repository or files
606 merge merge another revision into working directory
606 merge merge another revision into working directory
607 pull pull changes from the specified source
607 pull pull changes from the specified source
608 push push changes to the specified destination
608 push push changes to the specified destination
609 remove remove the specified files on the next commit
609 remove remove the specified files on the next commit
610 serve start stand-alone webserver
610 serve start stand-alone webserver
611 status show changed files in the working directory
611 status show changed files in the working directory
612 summary summarize working directory state
612 summary summarize working directory state
613 update update working directory (or switch revisions)
613 update update working directory (or switch revisions)
614
614
615 (use "hg help" for the full list of commands or "hg -v" for details)
615 (use "hg help" for the full list of commands or "hg -v" for details)
616 [255]
616 [255]
617
617
618
618
619 $ cat > helpext.py <<EOF
619 $ cat > helpext.py <<EOF
620 > import os
620 > import os
621 > from mercurial import cmdutil, commands
621 > from mercurial import cmdutil, commands
622 >
622 >
623 > cmdtable = {}
623 > cmdtable = {}
624 > command = cmdutil.command(cmdtable)
624 > command = cmdutil.command(cmdtable)
625 >
625 >
626 > @command('nohelp',
626 > @command('nohelp',
627 > [('', 'longdesc', 3, 'x'*90),
627 > [('', 'longdesc', 3, 'x'*90),
628 > ('n', '', None, 'normal desc'),
628 > ('n', '', None, 'normal desc'),
629 > ('', 'newline', '', 'line1\nline2')],
629 > ('', 'newline', '', 'line1\nline2')],
630 > 'hg nohelp',
630 > 'hg nohelp',
631 > norepo=True)
631 > norepo=True)
632 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
632 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
633 > @command('debugoptEXP', [('', 'eopt', None, 'option is EXPERIMENTAL')])
633 > @command('debugoptEXP', [('', 'eopt', None, 'option is EXPERIMENTAL')])
634 > def nohelp(ui, *args, **kwargs):
634 > def nohelp(ui, *args, **kwargs):
635 > pass
635 > pass
636 >
636 >
637 > EOF
637 > EOF
638 $ echo '[extensions]' >> $HGRCPATH
638 $ echo '[extensions]' >> $HGRCPATH
639 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
639 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
640
640
641 Test command with no help text
641 Test command with no help text
642
642
643 $ hg help nohelp
643 $ hg help nohelp
644 hg nohelp
644 hg nohelp
645
645
646 (no help text available)
646 (no help text available)
647
647
648 options:
648 options:
649
649
650 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
650 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
651 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
651 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
652 -n -- normal desc
652 -n -- normal desc
653 --newline VALUE line1 line2
653 --newline VALUE line1 line2
654
654
655 (some details hidden, use --verbose to show complete help)
655 (some details hidden, use --verbose to show complete help)
656
656
657 $ hg help -k nohelp
657 $ hg help -k nohelp
658 Commands:
658 Commands:
659
659
660 nohelp hg nohelp
660 nohelp hg nohelp
661
661
662 Extension Commands:
662 Extension Commands:
663
663
664 nohelp (no help text available)
664 nohelp (no help text available)
665
665
666 Test that default list of commands omits extension commands
666 Test that default list of commands omits extension commands
667
667
668 $ hg help
668 $ hg help
669 Mercurial Distributed SCM
669 Mercurial Distributed SCM
670
670
671 list of commands:
671 list of commands:
672
672
673 add add the specified files on the next commit
673 add add the specified files on the next commit
674 addremove add all new files, delete all missing files
674 addremove add all new files, delete all missing files
675 annotate show changeset information by line for each file
675 annotate show changeset information by line for each file
676 archive create an unversioned archive of a repository revision
676 archive create an unversioned archive of a repository revision
677 backout reverse effect of earlier changeset
677 backout reverse effect of earlier changeset
678 bisect subdivision search of changesets
678 bisect subdivision search of changesets
679 bookmarks create a new bookmark or list existing bookmarks
679 bookmarks create a new bookmark or list existing bookmarks
680 branch set or show the current branch name
680 branch set or show the current branch name
681 branches list repository named branches
681 branches list repository named branches
682 bundle create a changegroup file
682 bundle create a changegroup file
683 cat output the current or given revision of files
683 cat output the current or given revision of files
684 clone make a copy of an existing repository
684 clone make a copy of an existing repository
685 commit commit the specified files or all outstanding changes
685 commit commit the specified files or all outstanding changes
686 config show combined config settings from all hgrc files
686 config show combined config settings from all hgrc files
687 copy mark files as copied for the next commit
687 copy mark files as copied for the next commit
688 diff diff repository (or selected files)
688 diff diff repository (or selected files)
689 export dump the header and diffs for one or more changesets
689 export dump the header and diffs for one or more changesets
690 files list tracked files
690 files list tracked files
691 forget forget the specified files on the next commit
691 forget forget the specified files on the next commit
692 graft copy changes from other branches onto the current branch
692 graft copy changes from other branches onto the current branch
693 grep search for a pattern in specified files and revisions
693 grep search for a pattern in specified files and revisions
694 heads show branch heads
694 heads show branch heads
695 help show help for a given topic or a help overview
695 help show help for a given topic or a help overview
696 identify identify the working directory or specified revision
696 identify identify the working directory or specified revision
697 import import an ordered set of patches
697 import import an ordered set of patches
698 incoming show new changesets found in source
698 incoming show new changesets found in source
699 init create a new repository in the given directory
699 init create a new repository in the given directory
700 log show revision history of entire repository or files
700 log show revision history of entire repository or files
701 manifest output the current or given revision of the project manifest
701 manifest output the current or given revision of the project manifest
702 merge merge another revision into working directory
702 merge merge another revision into working directory
703 outgoing show changesets not found in the destination
703 outgoing show changesets not found in the destination
704 paths show aliases for remote repositories
704 paths show aliases for remote repositories
705 phase set or show the current phase name
705 phase set or show the current phase name
706 pull pull changes from the specified source
706 pull pull changes from the specified source
707 push push changes to the specified destination
707 push push changes to the specified destination
708 recover roll back an interrupted transaction
708 recover roll back an interrupted transaction
709 remove remove the specified files on the next commit
709 remove remove the specified files on the next commit
710 rename rename files; equivalent of copy + remove
710 rename rename files; equivalent of copy + remove
711 resolve redo merges or set/view the merge status of files
711 resolve redo merges or set/view the merge status of files
712 revert restore files to their checkout state
712 revert restore files to their checkout state
713 root print the root (top) of the current working directory
713 root print the root (top) of the current working directory
714 serve start stand-alone webserver
714 serve start stand-alone webserver
715 status show changed files in the working directory
715 status show changed files in the working directory
716 summary summarize working directory state
716 summary summarize working directory state
717 tag add one or more tags for the current or given revision
717 tag add one or more tags for the current or given revision
718 tags list repository tags
718 tags list repository tags
719 unbundle apply one or more changegroup files
719 unbundle apply one or more changegroup files
720 update update working directory (or switch revisions)
720 update update working directory (or switch revisions)
721 verify verify the integrity of the repository
721 verify verify the integrity of the repository
722 version output version and copyright information
722 version output version and copyright information
723
723
724 enabled extensions:
724 enabled extensions:
725
725
726 helpext (no help text available)
726 helpext (no help text available)
727
727
728 additional help topics:
728 additional help topics:
729
729
730 config Configuration Files
730 config Configuration Files
731 dates Date Formats
731 dates Date Formats
732 diffs Diff Formats
732 diffs Diff Formats
733 environment Environment Variables
733 environment Environment Variables
734 extensions Using Additional Features
734 extensions Using Additional Features
735 filesets Specifying File Sets
735 filesets Specifying File Sets
736 glossary Glossary
736 glossary Glossary
737 hgignore Syntax for Mercurial Ignore Files
737 hgignore Syntax for Mercurial Ignore Files
738 hgweb Configuring hgweb
738 hgweb Configuring hgweb
739 merge-tools Merge Tools
739 merge-tools Merge Tools
740 multirevs Specifying Multiple Revisions
740 multirevs Specifying Multiple Revisions
741 patterns File Name Patterns
741 patterns File Name Patterns
742 phases Working with Phases
742 phases Working with Phases
743 revisions Specifying Single Revisions
743 revisions Specifying Single Revisions
744 revsets Specifying Revision Sets
744 revsets Specifying Revision Sets
745 scripting Using Mercurial from scripts and automation
745 scripting Using Mercurial from scripts and automation
746 subrepos Subrepositories
746 subrepos Subrepositories
747 templating Template Usage
747 templating Template Usage
748 urls URL Paths
748 urls URL Paths
749
749
750 (use "hg help -v" to show built-in aliases and global options)
750 (use "hg help -v" to show built-in aliases and global options)
751
751
752
752
753 Test list of internal help commands
753 Test list of internal help commands
754
754
755 $ hg help debug
755 $ hg help debug
756 debug commands (internal and unsupported):
756 debug commands (internal and unsupported):
757
757
758 debugancestor
758 debugancestor
759 find the ancestor revision of two revisions in a given index
759 find the ancestor revision of two revisions in a given index
760 debugbuilddag
760 debugbuilddag
761 builds a repo with a given DAG from scratch in the current
761 builds a repo with a given DAG from scratch in the current
762 empty repo
762 empty repo
763 debugbundle lists the contents of a bundle
763 debugbundle lists the contents of a bundle
764 debugcheckstate
764 debugcheckstate
765 validate the correctness of the current dirstate
765 validate the correctness of the current dirstate
766 debugcommands
766 debugcommands
767 list all available commands and options
767 list all available commands and options
768 debugcomplete
768 debugcomplete
769 returns the completion list associated with the given command
769 returns the completion list associated with the given command
770 debugdag format the changelog or an index DAG as a concise textual
770 debugdag format the changelog or an index DAG as a concise textual
771 description
771 description
772 debugdata dump the contents of a data file revision
772 debugdata dump the contents of a data file revision
773 debugdate parse and display a date
773 debugdate parse and display a date
774 debugdirstate
774 debugdirstate
775 show the contents of the current dirstate
775 show the contents of the current dirstate
776 debugdiscovery
776 debugdiscovery
777 runs the changeset discovery protocol in isolation
777 runs the changeset discovery protocol in isolation
778 debugfileset parse and apply a fileset specification
778 debugfileset parse and apply a fileset specification
779 debugfsinfo show information detected about current filesystem
779 debugfsinfo show information detected about current filesystem
780 debuggetbundle
780 debuggetbundle
781 retrieves a bundle from a repo
781 retrieves a bundle from a repo
782 debugignore display the combined ignore pattern
782 debugignore display the combined ignore pattern
783 debugindex dump the contents of an index file
783 debugindex dump the contents of an index file
784 debugindexdot
784 debugindexdot
785 dump an index DAG as a graphviz dot file
785 dump an index DAG as a graphviz dot file
786 debuginstall test Mercurial installation
786 debuginstall test Mercurial installation
787 debugknown test whether node ids are known to a repo
787 debugknown test whether node ids are known to a repo
788 debuglocks show or modify state of locks
788 debuglocks show or modify state of locks
789 debugnamecomplete
789 debugnamecomplete
790 complete "names" - tags, open branch names, bookmark names
790 complete "names" - tags, open branch names, bookmark names
791 debugobsolete
791 debugobsolete
792 create arbitrary obsolete marker
792 create arbitrary obsolete marker
793 debugoptDEP (no help text available)
793 debugoptDEP (no help text available)
794 debugoptEXP (no help text available)
794 debugoptEXP (no help text available)
795 debugpathcomplete
795 debugpathcomplete
796 complete part or all of a tracked path
796 complete part or all of a tracked path
797 debugpushkey access the pushkey key/value protocol
797 debugpushkey access the pushkey key/value protocol
798 debugpvec (no help text available)
798 debugpvec (no help text available)
799 debugrebuilddirstate
799 debugrebuilddirstate
800 rebuild the dirstate as it would look like for the given
800 rebuild the dirstate as it would look like for the given
801 revision
801 revision
802 debugrebuildfncache
802 debugrebuildfncache
803 rebuild the fncache file
803 rebuild the fncache file
804 debugrename dump rename information
804 debugrename dump rename information
805 debugrevlog show data and statistics about a revlog
805 debugrevlog show data and statistics about a revlog
806 debugrevspec parse and apply a revision specification
806 debugrevspec parse and apply a revision specification
807 debugsetparents
807 debugsetparents
808 manually set the parents of the current working directory
808 manually set the parents of the current working directory
809 debugsub (no help text available)
809 debugsub (no help text available)
810 debugsuccessorssets
810 debugsuccessorssets
811 show set of successors for revision
811 show set of successors for revision
812 debugwalk show how files match on given patterns
812 debugwalk show how files match on given patterns
813 debugwireargs
813 debugwireargs
814 (no help text available)
814 (no help text available)
815
815
816 (use "hg help -v debug" to show built-in aliases and global options)
816 (use "hg help -v debug" to show built-in aliases and global options)
817
817
818
818
819 Test list of commands with command with no help text
819 Test list of commands with command with no help text
820
820
821 $ hg help helpext
821 $ hg help helpext
822 helpext extension - no help text available
822 helpext extension - no help text available
823
823
824 list of commands:
824 list of commands:
825
825
826 nohelp (no help text available)
826 nohelp (no help text available)
827
827
828 (use "hg help -v helpext" to show built-in aliases and global options)
828 (use "hg help -v helpext" to show built-in aliases and global options)
829
829
830
830
831 test deprecated and experimental options are hidden in command help
831 test deprecated and experimental options are hidden in command help
832 $ hg help debugoptDEP
832 $ hg help debugoptDEP
833 hg debugoptDEP
833 hg debugoptDEP
834
834
835 (no help text available)
835 (no help text available)
836
836
837 options:
837 options:
838
838
839 (some details hidden, use --verbose to show complete help)
839 (some details hidden, use --verbose to show complete help)
840
840
841 $ hg help debugoptEXP
841 $ hg help debugoptEXP
842 hg debugoptEXP
842 hg debugoptEXP
843
843
844 (no help text available)
844 (no help text available)
845
845
846 options:
846 options:
847
847
848 (some details hidden, use --verbose to show complete help)
848 (some details hidden, use --verbose to show complete help)
849
849
850 test deprecated and experimental options is shown with -v
850 test deprecated and experimental options is shown with -v
851 $ hg help -v debugoptDEP | grep dopt
851 $ hg help -v debugoptDEP | grep dopt
852 --dopt option is DEPRECATED
852 --dopt option is DEPRECATED
853 $ hg help -v debugoptEXP | grep eopt
853 $ hg help -v debugoptEXP | grep eopt
854 --eopt option is EXPERIMENTAL
854 --eopt option is EXPERIMENTAL
855
855
856 #if gettext
856 #if gettext
857 test deprecated option is hidden with translation with untranslated description
857 test deprecated option is hidden with translation with untranslated description
858 (use many globy for not failing on changed transaction)
858 (use many globy for not failing on changed transaction)
859 $ LANGUAGE=sv hg help debugoptDEP
859 $ LANGUAGE=sv hg help debugoptDEP
860 hg debugoptDEP
860 hg debugoptDEP
861
861
862 (*) (glob)
862 (*) (glob)
863
863
864 options:
864 options:
865
865
866 (some details hidden, use --verbose to show complete help)
866 (some details hidden, use --verbose to show complete help)
867 #endif
867 #endif
868
868
869 Test commands that collide with topics (issue4240)
869 Test commands that collide with topics (issue4240)
870
870
871 $ hg config -hq
871 $ hg config -hq
872 hg config [-u] [NAME]...
872 hg config [-u] [NAME]...
873
873
874 show combined config settings from all hgrc files
874 show combined config settings from all hgrc files
875 $ hg showconfig -hq
875 $ hg showconfig -hq
876 hg config [-u] [NAME]...
876 hg config [-u] [NAME]...
877
877
878 show combined config settings from all hgrc files
878 show combined config settings from all hgrc files
879
879
880 Test a help topic
880 Test a help topic
881
881
882 $ hg help revs
882 $ hg help revs
883 Specifying Single Revisions
883 Specifying Single Revisions
884 """""""""""""""""""""""""""
884 """""""""""""""""""""""""""
885
885
886 Mercurial supports several ways to specify individual revisions.
886 Mercurial supports several ways to specify individual revisions.
887
887
888 A plain integer is treated as a revision number. Negative integers are
888 A plain integer is treated as a revision number. Negative integers are
889 treated as sequential offsets from the tip, with -1 denoting the tip, -2
889 treated as sequential offsets from the tip, with -1 denoting the tip, -2
890 denoting the revision prior to the tip, and so forth.
890 denoting the revision prior to the tip, and so forth.
891
891
892 A 40-digit hexadecimal string is treated as a unique revision identifier.
892 A 40-digit hexadecimal string is treated as a unique revision identifier.
893
893
894 A hexadecimal string less than 40 characters long is treated as a unique
894 A hexadecimal string less than 40 characters long is treated as a unique
895 revision identifier and is referred to as a short-form identifier. A
895 revision identifier and is referred to as a short-form identifier. A
896 short-form identifier is only valid if it is the prefix of exactly one
896 short-form identifier is only valid if it is the prefix of exactly one
897 full-length identifier.
897 full-length identifier.
898
898
899 Any other string is treated as a bookmark, tag, or branch name. A bookmark
899 Any other string is treated as a bookmark, tag, or branch name. A bookmark
900 is a movable pointer to a revision. A tag is a permanent name associated
900 is a movable pointer to a revision. A tag is a permanent name associated
901 with a revision. A branch name denotes the tipmost open branch head of
901 with a revision. A branch name denotes the tipmost open branch head of
902 that branch - or if they are all closed, the tipmost closed head of the
902 that branch - or if they are all closed, the tipmost closed head of the
903 branch. Bookmark, tag, and branch names must not contain the ":"
903 branch. Bookmark, tag, and branch names must not contain the ":"
904 character.
904 character.
905
905
906 The reserved name "tip" always identifies the most recent revision.
906 The reserved name "tip" always identifies the most recent revision.
907
907
908 The reserved name "null" indicates the null revision. This is the revision
908 The reserved name "null" indicates the null revision. This is the revision
909 of an empty repository, and the parent of revision 0.
909 of an empty repository, and the parent of revision 0.
910
910
911 The reserved name "." indicates the working directory parent. If no
911 The reserved name "." indicates the working directory parent. If no
912 working directory is checked out, it is equivalent to null. If an
912 working directory is checked out, it is equivalent to null. If an
913 uncommitted merge is in progress, "." is the revision of the first parent.
913 uncommitted merge is in progress, "." is the revision of the first parent.
914
914
915 Test repeated config section name
915 Test repeated config section name
916
916
917 $ hg help config.host
917 $ hg help config.host
918 "http_proxy.host"
918 "http_proxy.host"
919 Host name and (optional) port of the proxy server, for example
919 Host name and (optional) port of the proxy server, for example
920 "myproxy:8000".
920 "myproxy:8000".
921
921
922 "smtp.host"
922 "smtp.host"
923 Host name of mail server, e.g. "mail.example.com".
923 Host name of mail server, e.g. "mail.example.com".
924
924
925 Unrelated trailing paragraphs shouldn't be included
925 Unrelated trailing paragraphs shouldn't be included
926
926
927 $ hg help config.extramsg | grep '^$'
927 $ hg help config.extramsg | grep '^$'
928
928
929
929
930 Test capitalized section name
930 Test capitalized section name
931
931
932 $ hg help scripting.HGPLAIN > /dev/null
932 $ hg help scripting.HGPLAIN > /dev/null
933
933
934 Help subsection:
934 Help subsection:
935
935
936 $ hg help config.charsets |grep "Email example:" > /dev/null
936 $ hg help config.charsets |grep "Email example:" > /dev/null
937 [1]
937 [1]
938
938
939 Show nested definitions
940 ("profiling.type"[break]"ls"[break]"stat"[break])
941
942 $ hg help config.type | egrep '^$'|wc -l
943 \s*3 (re)
944
939 Last item in help config.*:
945 Last item in help config.*:
940
946
941 $ hg help config.`hg help config|grep '^ "'| \
947 $ hg help config.`hg help config|grep '^ "'| \
942 > tail -1|sed 's![ "]*!!g'`| \
948 > tail -1|sed 's![ "]*!!g'`| \
943 > grep "hg help -c config" > /dev/null
949 > grep "hg help -c config" > /dev/null
944 [1]
950 [1]
945
951
946 note to use help -c for general hg help config:
952 note to use help -c for general hg help config:
947
953
948 $ hg help config |grep "hg help -c config" > /dev/null
954 $ hg help config |grep "hg help -c config" > /dev/null
949
955
950 Test templating help
956 Test templating help
951
957
952 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
958 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
953 desc String. The text of the changeset description.
959 desc String. The text of the changeset description.
954 diffstat String. Statistics of changes with the following format:
960 diffstat String. Statistics of changes with the following format:
955 firstline Any text. Returns the first line of text.
961 firstline Any text. Returns the first line of text.
956 nonempty Any text. Returns '(none)' if the string is empty.
962 nonempty Any text. Returns '(none)' if the string is empty.
957
963
958 Test help hooks
964 Test help hooks
959
965
960 $ cat > helphook1.py <<EOF
966 $ cat > helphook1.py <<EOF
961 > from mercurial import help
967 > from mercurial import help
962 >
968 >
963 > def rewrite(topic, doc):
969 > def rewrite(topic, doc):
964 > return doc + '\nhelphook1\n'
970 > return doc + '\nhelphook1\n'
965 >
971 >
966 > def extsetup(ui):
972 > def extsetup(ui):
967 > help.addtopichook('revsets', rewrite)
973 > help.addtopichook('revsets', rewrite)
968 > EOF
974 > EOF
969 $ cat > helphook2.py <<EOF
975 $ cat > helphook2.py <<EOF
970 > from mercurial import help
976 > from mercurial import help
971 >
977 >
972 > def rewrite(topic, doc):
978 > def rewrite(topic, doc):
973 > return doc + '\nhelphook2\n'
979 > return doc + '\nhelphook2\n'
974 >
980 >
975 > def extsetup(ui):
981 > def extsetup(ui):
976 > help.addtopichook('revsets', rewrite)
982 > help.addtopichook('revsets', rewrite)
977 > EOF
983 > EOF
978 $ echo '[extensions]' >> $HGRCPATH
984 $ echo '[extensions]' >> $HGRCPATH
979 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
985 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
980 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
986 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
981 $ hg help revsets | grep helphook
987 $ hg help revsets | grep helphook
982 helphook1
988 helphook1
983 helphook2
989 helphook2
984
990
985 Test keyword search help
991 Test keyword search help
986
992
987 $ cat > prefixedname.py <<EOF
993 $ cat > prefixedname.py <<EOF
988 > '''matched against word "clone"
994 > '''matched against word "clone"
989 > '''
995 > '''
990 > EOF
996 > EOF
991 $ echo '[extensions]' >> $HGRCPATH
997 $ echo '[extensions]' >> $HGRCPATH
992 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
998 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
993 $ hg help -k clone
999 $ hg help -k clone
994 Topics:
1000 Topics:
995
1001
996 config Configuration Files
1002 config Configuration Files
997 extensions Using Additional Features
1003 extensions Using Additional Features
998 glossary Glossary
1004 glossary Glossary
999 phases Working with Phases
1005 phases Working with Phases
1000 subrepos Subrepositories
1006 subrepos Subrepositories
1001 urls URL Paths
1007 urls URL Paths
1002
1008
1003 Commands:
1009 Commands:
1004
1010
1005 bookmarks create a new bookmark or list existing bookmarks
1011 bookmarks create a new bookmark or list existing bookmarks
1006 clone make a copy of an existing repository
1012 clone make a copy of an existing repository
1007 paths show aliases for remote repositories
1013 paths show aliases for remote repositories
1008 update update working directory (or switch revisions)
1014 update update working directory (or switch revisions)
1009
1015
1010 Extensions:
1016 Extensions:
1011
1017
1012 prefixedname matched against word "clone"
1018 prefixedname matched against word "clone"
1013 relink recreates hardlinks between repository clones
1019 relink recreates hardlinks between repository clones
1014
1020
1015 Extension Commands:
1021 Extension Commands:
1016
1022
1017 qclone clone main and patch repository at same time
1023 qclone clone main and patch repository at same time
1018
1024
1019 Test unfound topic
1025 Test unfound topic
1020
1026
1021 $ hg help nonexistingtopicthatwillneverexisteverever
1027 $ hg help nonexistingtopicthatwillneverexisteverever
1022 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1028 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1023 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1029 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1024 [255]
1030 [255]
1025
1031
1026 Test unfound keyword
1032 Test unfound keyword
1027
1033
1028 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1034 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1029 abort: no matches
1035 abort: no matches
1030 (try "hg help" for a list of topics)
1036 (try "hg help" for a list of topics)
1031 [255]
1037 [255]
1032
1038
1033 Test omit indicating for help
1039 Test omit indicating for help
1034
1040
1035 $ cat > addverboseitems.py <<EOF
1041 $ cat > addverboseitems.py <<EOF
1036 > '''extension to test omit indicating.
1042 > '''extension to test omit indicating.
1037 >
1043 >
1038 > This paragraph is never omitted (for extension)
1044 > This paragraph is never omitted (for extension)
1039 >
1045 >
1040 > .. container:: verbose
1046 > .. container:: verbose
1041 >
1047 >
1042 > This paragraph is omitted,
1048 > This paragraph is omitted,
1043 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1049 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1044 >
1050 >
1045 > This paragraph is never omitted, too (for extension)
1051 > This paragraph is never omitted, too (for extension)
1046 > '''
1052 > '''
1047 >
1053 >
1048 > from mercurial import help, commands
1054 > from mercurial import help, commands
1049 > testtopic = """This paragraph is never omitted (for topic).
1055 > testtopic = """This paragraph is never omitted (for topic).
1050 >
1056 >
1051 > .. container:: verbose
1057 > .. container:: verbose
1052 >
1058 >
1053 > This paragraph is omitted,
1059 > This paragraph is omitted,
1054 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1060 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1055 >
1061 >
1056 > This paragraph is never omitted, too (for topic)
1062 > This paragraph is never omitted, too (for topic)
1057 > """
1063 > """
1058 > def extsetup(ui):
1064 > def extsetup(ui):
1059 > help.helptable.append((["topic-containing-verbose"],
1065 > help.helptable.append((["topic-containing-verbose"],
1060 > "This is the topic to test omit indicating.",
1066 > "This is the topic to test omit indicating.",
1061 > lambda : testtopic))
1067 > lambda : testtopic))
1062 > EOF
1068 > EOF
1063 $ echo '[extensions]' >> $HGRCPATH
1069 $ echo '[extensions]' >> $HGRCPATH
1064 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1070 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1065 $ hg help addverboseitems
1071 $ hg help addverboseitems
1066 addverboseitems extension - extension to test omit indicating.
1072 addverboseitems extension - extension to test omit indicating.
1067
1073
1068 This paragraph is never omitted (for extension)
1074 This paragraph is never omitted (for extension)
1069
1075
1070 This paragraph is never omitted, too (for extension)
1076 This paragraph is never omitted, too (for extension)
1071
1077
1072 (some details hidden, use --verbose to show complete help)
1078 (some details hidden, use --verbose to show complete help)
1073
1079
1074 no commands defined
1080 no commands defined
1075 $ hg help -v addverboseitems
1081 $ hg help -v addverboseitems
1076 addverboseitems extension - extension to test omit indicating.
1082 addverboseitems extension - extension to test omit indicating.
1077
1083
1078 This paragraph is never omitted (for extension)
1084 This paragraph is never omitted (for extension)
1079
1085
1080 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1086 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1081 extension)
1087 extension)
1082
1088
1083 This paragraph is never omitted, too (for extension)
1089 This paragraph is never omitted, too (for extension)
1084
1090
1085 no commands defined
1091 no commands defined
1086 $ hg help topic-containing-verbose
1092 $ hg help topic-containing-verbose
1087 This is the topic to test omit indicating.
1093 This is the topic to test omit indicating.
1088 """"""""""""""""""""""""""""""""""""""""""
1094 """"""""""""""""""""""""""""""""""""""""""
1089
1095
1090 This paragraph is never omitted (for topic).
1096 This paragraph is never omitted (for topic).
1091
1097
1092 This paragraph is never omitted, too (for topic)
1098 This paragraph is never omitted, too (for topic)
1093
1099
1094 (some details hidden, use --verbose to show complete help)
1100 (some details hidden, use --verbose to show complete help)
1095 $ hg help -v topic-containing-verbose
1101 $ hg help -v topic-containing-verbose
1096 This is the topic to test omit indicating.
1102 This is the topic to test omit indicating.
1097 """"""""""""""""""""""""""""""""""""""""""
1103 """"""""""""""""""""""""""""""""""""""""""
1098
1104
1099 This paragraph is never omitted (for topic).
1105 This paragraph is never omitted (for topic).
1100
1106
1101 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1107 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1102 topic)
1108 topic)
1103
1109
1104 This paragraph is never omitted, too (for topic)
1110 This paragraph is never omitted, too (for topic)
1105
1111
1106 Test section lookup
1112 Test section lookup
1107
1113
1108 $ hg help revset.merge
1114 $ hg help revset.merge
1109 "merge()"
1115 "merge()"
1110 Changeset is a merge changeset.
1116 Changeset is a merge changeset.
1111
1117
1112 $ hg help glossary.dag
1118 $ hg help glossary.dag
1113 DAG
1119 DAG
1114 The repository of changesets of a distributed version control system
1120 The repository of changesets of a distributed version control system
1115 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1121 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1116 of nodes and edges, where nodes correspond to changesets and edges
1122 of nodes and edges, where nodes correspond to changesets and edges
1117 imply a parent -> child relation. This graph can be visualized by
1123 imply a parent -> child relation. This graph can be visualized by
1118 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1124 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1119 limited by the requirement for children to have at most two parents.
1125 limited by the requirement for children to have at most two parents.
1120
1126
1121
1127
1122 $ hg help hgrc.paths
1128 $ hg help hgrc.paths
1123 "paths"
1129 "paths"
1124 -------
1130 -------
1125
1131
1126 Assigns symbolic names to repositories. The left side is the symbolic
1132 Assigns symbolic names to repositories. The left side is the symbolic
1127 name, and the right gives the directory or URL that is the location of the
1133 name, and the right gives the directory or URL that is the location of the
1128 repository. Default paths can be declared by setting the following
1134 repository. Default paths can be declared by setting the following
1129 entries.
1135 entries.
1130
1136
1131 "default"
1137 "default"
1132 Directory or URL to use when pulling if no source is specified.
1138 Directory or URL to use when pulling if no source is specified.
1133 (default: repository from which the current repository was cloned)
1139 (default: repository from which the current repository was cloned)
1134
1140
1135 "default-push"
1141 "default-push"
1136 Optional. Directory or URL to use when pushing if no destination is
1142 Optional. Directory or URL to use when pushing if no destination is
1137 specified.
1143 specified.
1138
1144
1139 Custom paths can be defined by assigning the path to a name that later can
1145 Custom paths can be defined by assigning the path to a name that later can
1140 be used from the command line. Example:
1146 be used from the command line. Example:
1141
1147
1142 [paths]
1148 [paths]
1143 my_path = http://example.com/path
1149 my_path = http://example.com/path
1144
1150
1145 To push to the path defined in "my_path" run the command:
1151 To push to the path defined in "my_path" run the command:
1146
1152
1147 hg push my_path
1153 hg push my_path
1148
1154
1149 $ hg help glossary.mcguffin
1155 $ hg help glossary.mcguffin
1150 abort: help section not found
1156 abort: help section not found
1151 [255]
1157 [255]
1152
1158
1153 $ hg help glossary.mc.guffin
1159 $ hg help glossary.mc.guffin
1154 abort: help section not found
1160 abort: help section not found
1155 [255]
1161 [255]
1156
1162
1157 $ hg help template.files
1163 $ hg help template.files
1158 files List of strings. All files modified, added, or removed by
1164 files List of strings. All files modified, added, or removed by
1159 this changeset.
1165 this changeset.
1160
1166
1161 Test dynamic list of merge tools only shows up once
1167 Test dynamic list of merge tools only shows up once
1162 $ hg help merge-tools
1168 $ hg help merge-tools
1163 Merge Tools
1169 Merge Tools
1164 """""""""""
1170 """""""""""
1165
1171
1166 To merge files Mercurial uses merge tools.
1172 To merge files Mercurial uses merge tools.
1167
1173
1168 A merge tool combines two different versions of a file into a merged file.
1174 A merge tool combines two different versions of a file into a merged file.
1169 Merge tools are given the two files and the greatest common ancestor of
1175 Merge tools are given the two files and the greatest common ancestor of
1170 the two file versions, so they can determine the changes made on both
1176 the two file versions, so they can determine the changes made on both
1171 branches.
1177 branches.
1172
1178
1173 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1179 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1174 backout" and in several extensions.
1180 backout" and in several extensions.
1175
1181
1176 Usually, the merge tool tries to automatically reconcile the files by
1182 Usually, the merge tool tries to automatically reconcile the files by
1177 combining all non-overlapping changes that occurred separately in the two
1183 combining all non-overlapping changes that occurred separately in the two
1178 different evolutions of the same initial base file. Furthermore, some
1184 different evolutions of the same initial base file. Furthermore, some
1179 interactive merge programs make it easier to manually resolve conflicting
1185 interactive merge programs make it easier to manually resolve conflicting
1180 merges, either in a graphical way, or by inserting some conflict markers.
1186 merges, either in a graphical way, or by inserting some conflict markers.
1181 Mercurial does not include any interactive merge programs but relies on
1187 Mercurial does not include any interactive merge programs but relies on
1182 external tools for that.
1188 external tools for that.
1183
1189
1184 Available merge tools
1190 Available merge tools
1185 =====================
1191 =====================
1186
1192
1187 External merge tools and their properties are configured in the merge-
1193 External merge tools and their properties are configured in the merge-
1188 tools configuration section - see hgrc(5) - but they can often just be
1194 tools configuration section - see hgrc(5) - but they can often just be
1189 named by their executable.
1195 named by their executable.
1190
1196
1191 A merge tool is generally usable if its executable can be found on the
1197 A merge tool is generally usable if its executable can be found on the
1192 system and if it can handle the merge. The executable is found if it is an
1198 system and if it can handle the merge. The executable is found if it is an
1193 absolute or relative executable path or the name of an application in the
1199 absolute or relative executable path or the name of an application in the
1194 executable search path. The tool is assumed to be able to handle the merge
1200 executable search path. The tool is assumed to be able to handle the merge
1195 if it can handle symlinks if the file is a symlink, if it can handle
1201 if it can handle symlinks if the file is a symlink, if it can handle
1196 binary files if the file is binary, and if a GUI is available if the tool
1202 binary files if the file is binary, and if a GUI is available if the tool
1197 requires a GUI.
1203 requires a GUI.
1198
1204
1199 There are some internal merge tools which can be used. The internal merge
1205 There are some internal merge tools which can be used. The internal merge
1200 tools are:
1206 tools are:
1201
1207
1202 ":dump"
1208 ":dump"
1203 Creates three versions of the files to merge, containing the contents of
1209 Creates three versions of the files to merge, containing the contents of
1204 local, other and base. These files can then be used to perform a merge
1210 local, other and base. These files can then be used to perform a merge
1205 manually. If the file to be merged is named "a.txt", these files will
1211 manually. If the file to be merged is named "a.txt", these files will
1206 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1212 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1207 they will be placed in the same directory as "a.txt".
1213 they will be placed in the same directory as "a.txt".
1208
1214
1209 ":fail"
1215 ":fail"
1210 Rather than attempting to merge files that were modified on both
1216 Rather than attempting to merge files that were modified on both
1211 branches, it marks them as unresolved. The resolve command must be used
1217 branches, it marks them as unresolved. The resolve command must be used
1212 to resolve these conflicts.
1218 to resolve these conflicts.
1213
1219
1214 ":local"
1220 ":local"
1215 Uses the local version of files as the merged version.
1221 Uses the local version of files as the merged version.
1216
1222
1217 ":merge"
1223 ":merge"
1218 Uses the internal non-interactive simple merge algorithm for merging
1224 Uses the internal non-interactive simple merge algorithm for merging
1219 files. It will fail if there are any conflicts and leave markers in the
1225 files. It will fail if there are any conflicts and leave markers in the
1220 partially merged file. Markers will have two sections, one for each side
1226 partially merged file. Markers will have two sections, one for each side
1221 of merge.
1227 of merge.
1222
1228
1223 ":merge-local"
1229 ":merge-local"
1224 Like :merge, but resolve all conflicts non-interactively in favor of the
1230 Like :merge, but resolve all conflicts non-interactively in favor of the
1225 local changes.
1231 local changes.
1226
1232
1227 ":merge-other"
1233 ":merge-other"
1228 Like :merge, but resolve all conflicts non-interactively in favor of the
1234 Like :merge, but resolve all conflicts non-interactively in favor of the
1229 other changes.
1235 other changes.
1230
1236
1231 ":merge3"
1237 ":merge3"
1232 Uses the internal non-interactive simple merge algorithm for merging
1238 Uses the internal non-interactive simple merge algorithm for merging
1233 files. It will fail if there are any conflicts and leave markers in the
1239 files. It will fail if there are any conflicts and leave markers in the
1234 partially merged file. Marker will have three sections, one from each
1240 partially merged file. Marker will have three sections, one from each
1235 side of the merge and one for the base content.
1241 side of the merge and one for the base content.
1236
1242
1237 ":other"
1243 ":other"
1238 Uses the other version of files as the merged version.
1244 Uses the other version of files as the merged version.
1239
1245
1240 ":prompt"
1246 ":prompt"
1241 Asks the user which of the local or the other version to keep as the
1247 Asks the user which of the local or the other version to keep as the
1242 merged version.
1248 merged version.
1243
1249
1244 ":tagmerge"
1250 ":tagmerge"
1245 Uses the internal tag merge algorithm (experimental).
1251 Uses the internal tag merge algorithm (experimental).
1246
1252
1247 ":union"
1253 ":union"
1248 Uses the internal non-interactive simple merge algorithm for merging
1254 Uses the internal non-interactive simple merge algorithm for merging
1249 files. It will use both left and right sides for conflict regions. No
1255 files. It will use both left and right sides for conflict regions. No
1250 markers are inserted.
1256 markers are inserted.
1251
1257
1252 Internal tools are always available and do not require a GUI but will by
1258 Internal tools are always available and do not require a GUI but will by
1253 default not handle symlinks or binary files.
1259 default not handle symlinks or binary files.
1254
1260
1255 Choosing a merge tool
1261 Choosing a merge tool
1256 =====================
1262 =====================
1257
1263
1258 Mercurial uses these rules when deciding which merge tool to use:
1264 Mercurial uses these rules when deciding which merge tool to use:
1259
1265
1260 1. If a tool has been specified with the --tool option to merge or
1266 1. If a tool has been specified with the --tool option to merge or
1261 resolve, it is used. If it is the name of a tool in the merge-tools
1267 resolve, it is used. If it is the name of a tool in the merge-tools
1262 configuration, its configuration is used. Otherwise the specified tool
1268 configuration, its configuration is used. Otherwise the specified tool
1263 must be executable by the shell.
1269 must be executable by the shell.
1264 2. If the "HGMERGE" environment variable is present, its value is used and
1270 2. If the "HGMERGE" environment variable is present, its value is used and
1265 must be executable by the shell.
1271 must be executable by the shell.
1266 3. If the filename of the file to be merged matches any of the patterns in
1272 3. If the filename of the file to be merged matches any of the patterns in
1267 the merge-patterns configuration section, the first usable merge tool
1273 the merge-patterns configuration section, the first usable merge tool
1268 corresponding to a matching pattern is used. Here, binary capabilities
1274 corresponding to a matching pattern is used. Here, binary capabilities
1269 of the merge tool are not considered.
1275 of the merge tool are not considered.
1270 4. If ui.merge is set it will be considered next. If the value is not the
1276 4. If ui.merge is set it will be considered next. If the value is not the
1271 name of a configured tool, the specified value is used and must be
1277 name of a configured tool, the specified value is used and must be
1272 executable by the shell. Otherwise the named tool is used if it is
1278 executable by the shell. Otherwise the named tool is used if it is
1273 usable.
1279 usable.
1274 5. If any usable merge tools are present in the merge-tools configuration
1280 5. If any usable merge tools are present in the merge-tools configuration
1275 section, the one with the highest priority is used.
1281 section, the one with the highest priority is used.
1276 6. If a program named "hgmerge" can be found on the system, it is used -
1282 6. If a program named "hgmerge" can be found on the system, it is used -
1277 but it will by default not be used for symlinks and binary files.
1283 but it will by default not be used for symlinks and binary files.
1278 7. If the file to be merged is not binary and is not a symlink, then
1284 7. If the file to be merged is not binary and is not a symlink, then
1279 internal ":merge" is used.
1285 internal ":merge" is used.
1280 8. The merge of the file fails and must be resolved before commit.
1286 8. The merge of the file fails and must be resolved before commit.
1281
1287
1282 Note:
1288 Note:
1283 After selecting a merge program, Mercurial will by default attempt to
1289 After selecting a merge program, Mercurial will by default attempt to
1284 merge the files using a simple merge algorithm first. Only if it
1290 merge the files using a simple merge algorithm first. Only if it
1285 doesn't succeed because of conflicting changes Mercurial will actually
1291 doesn't succeed because of conflicting changes Mercurial will actually
1286 execute the merge program. Whether to use the simple merge algorithm
1292 execute the merge program. Whether to use the simple merge algorithm
1287 first can be controlled by the premerge setting of the merge tool.
1293 first can be controlled by the premerge setting of the merge tool.
1288 Premerge is enabled by default unless the file is binary or a symlink.
1294 Premerge is enabled by default unless the file is binary or a symlink.
1289
1295
1290 See the merge-tools and ui sections of hgrc(5) for details on the
1296 See the merge-tools and ui sections of hgrc(5) for details on the
1291 configuration of merge tools.
1297 configuration of merge tools.
1292
1298
1293 Test usage of section marks in help documents
1299 Test usage of section marks in help documents
1294
1300
1295 $ cd "$TESTDIR"/../doc
1301 $ cd "$TESTDIR"/../doc
1296 $ python check-seclevel.py
1302 $ python check-seclevel.py
1297 $ cd $TESTTMP
1303 $ cd $TESTTMP
1298
1304
1299 #if serve
1305 #if serve
1300
1306
1301 Test the help pages in hgweb.
1307 Test the help pages in hgweb.
1302
1308
1303 Dish up an empty repo; serve it cold.
1309 Dish up an empty repo; serve it cold.
1304
1310
1305 $ hg init "$TESTTMP/test"
1311 $ hg init "$TESTTMP/test"
1306 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1312 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1307 $ cat hg.pid >> $DAEMON_PIDS
1313 $ cat hg.pid >> $DAEMON_PIDS
1308
1314
1309 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1315 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1310 200 Script output follows
1316 200 Script output follows
1311
1317
1312 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1318 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1313 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1319 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1314 <head>
1320 <head>
1315 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1321 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1316 <meta name="robots" content="index, nofollow" />
1322 <meta name="robots" content="index, nofollow" />
1317 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1323 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1318 <script type="text/javascript" src="/static/mercurial.js"></script>
1324 <script type="text/javascript" src="/static/mercurial.js"></script>
1319
1325
1320 <title>Help: Index</title>
1326 <title>Help: Index</title>
1321 </head>
1327 </head>
1322 <body>
1328 <body>
1323
1329
1324 <div class="container">
1330 <div class="container">
1325 <div class="menu">
1331 <div class="menu">
1326 <div class="logo">
1332 <div class="logo">
1327 <a href="http://mercurial.selenic.com/">
1333 <a href="http://mercurial.selenic.com/">
1328 <img src="/static/hglogo.png" alt="mercurial" /></a>
1334 <img src="/static/hglogo.png" alt="mercurial" /></a>
1329 </div>
1335 </div>
1330 <ul>
1336 <ul>
1331 <li><a href="/shortlog">log</a></li>
1337 <li><a href="/shortlog">log</a></li>
1332 <li><a href="/graph">graph</a></li>
1338 <li><a href="/graph">graph</a></li>
1333 <li><a href="/tags">tags</a></li>
1339 <li><a href="/tags">tags</a></li>
1334 <li><a href="/bookmarks">bookmarks</a></li>
1340 <li><a href="/bookmarks">bookmarks</a></li>
1335 <li><a href="/branches">branches</a></li>
1341 <li><a href="/branches">branches</a></li>
1336 </ul>
1342 </ul>
1337 <ul>
1343 <ul>
1338 <li class="active">help</li>
1344 <li class="active">help</li>
1339 </ul>
1345 </ul>
1340 </div>
1346 </div>
1341
1347
1342 <div class="main">
1348 <div class="main">
1343 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1349 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1344 <form class="search" action="/log">
1350 <form class="search" action="/log">
1345
1351
1346 <p><input name="rev" id="search1" type="text" size="30" /></p>
1352 <p><input name="rev" id="search1" type="text" size="30" /></p>
1347 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1353 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1348 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1354 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1349 </form>
1355 </form>
1350 <table class="bigtable">
1356 <table class="bigtable">
1351 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1357 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1352
1358
1353 <tr><td>
1359 <tr><td>
1354 <a href="/help/config">
1360 <a href="/help/config">
1355 config
1361 config
1356 </a>
1362 </a>
1357 </td><td>
1363 </td><td>
1358 Configuration Files
1364 Configuration Files
1359 </td></tr>
1365 </td></tr>
1360 <tr><td>
1366 <tr><td>
1361 <a href="/help/dates">
1367 <a href="/help/dates">
1362 dates
1368 dates
1363 </a>
1369 </a>
1364 </td><td>
1370 </td><td>
1365 Date Formats
1371 Date Formats
1366 </td></tr>
1372 </td></tr>
1367 <tr><td>
1373 <tr><td>
1368 <a href="/help/diffs">
1374 <a href="/help/diffs">
1369 diffs
1375 diffs
1370 </a>
1376 </a>
1371 </td><td>
1377 </td><td>
1372 Diff Formats
1378 Diff Formats
1373 </td></tr>
1379 </td></tr>
1374 <tr><td>
1380 <tr><td>
1375 <a href="/help/environment">
1381 <a href="/help/environment">
1376 environment
1382 environment
1377 </a>
1383 </a>
1378 </td><td>
1384 </td><td>
1379 Environment Variables
1385 Environment Variables
1380 </td></tr>
1386 </td></tr>
1381 <tr><td>
1387 <tr><td>
1382 <a href="/help/extensions">
1388 <a href="/help/extensions">
1383 extensions
1389 extensions
1384 </a>
1390 </a>
1385 </td><td>
1391 </td><td>
1386 Using Additional Features
1392 Using Additional Features
1387 </td></tr>
1393 </td></tr>
1388 <tr><td>
1394 <tr><td>
1389 <a href="/help/filesets">
1395 <a href="/help/filesets">
1390 filesets
1396 filesets
1391 </a>
1397 </a>
1392 </td><td>
1398 </td><td>
1393 Specifying File Sets
1399 Specifying File Sets
1394 </td></tr>
1400 </td></tr>
1395 <tr><td>
1401 <tr><td>
1396 <a href="/help/glossary">
1402 <a href="/help/glossary">
1397 glossary
1403 glossary
1398 </a>
1404 </a>
1399 </td><td>
1405 </td><td>
1400 Glossary
1406 Glossary
1401 </td></tr>
1407 </td></tr>
1402 <tr><td>
1408 <tr><td>
1403 <a href="/help/hgignore">
1409 <a href="/help/hgignore">
1404 hgignore
1410 hgignore
1405 </a>
1411 </a>
1406 </td><td>
1412 </td><td>
1407 Syntax for Mercurial Ignore Files
1413 Syntax for Mercurial Ignore Files
1408 </td></tr>
1414 </td></tr>
1409 <tr><td>
1415 <tr><td>
1410 <a href="/help/hgweb">
1416 <a href="/help/hgweb">
1411 hgweb
1417 hgweb
1412 </a>
1418 </a>
1413 </td><td>
1419 </td><td>
1414 Configuring hgweb
1420 Configuring hgweb
1415 </td></tr>
1421 </td></tr>
1416 <tr><td>
1422 <tr><td>
1417 <a href="/help/merge-tools">
1423 <a href="/help/merge-tools">
1418 merge-tools
1424 merge-tools
1419 </a>
1425 </a>
1420 </td><td>
1426 </td><td>
1421 Merge Tools
1427 Merge Tools
1422 </td></tr>
1428 </td></tr>
1423 <tr><td>
1429 <tr><td>
1424 <a href="/help/multirevs">
1430 <a href="/help/multirevs">
1425 multirevs
1431 multirevs
1426 </a>
1432 </a>
1427 </td><td>
1433 </td><td>
1428 Specifying Multiple Revisions
1434 Specifying Multiple Revisions
1429 </td></tr>
1435 </td></tr>
1430 <tr><td>
1436 <tr><td>
1431 <a href="/help/patterns">
1437 <a href="/help/patterns">
1432 patterns
1438 patterns
1433 </a>
1439 </a>
1434 </td><td>
1440 </td><td>
1435 File Name Patterns
1441 File Name Patterns
1436 </td></tr>
1442 </td></tr>
1437 <tr><td>
1443 <tr><td>
1438 <a href="/help/phases">
1444 <a href="/help/phases">
1439 phases
1445 phases
1440 </a>
1446 </a>
1441 </td><td>
1447 </td><td>
1442 Working with Phases
1448 Working with Phases
1443 </td></tr>
1449 </td></tr>
1444 <tr><td>
1450 <tr><td>
1445 <a href="/help/revisions">
1451 <a href="/help/revisions">
1446 revisions
1452 revisions
1447 </a>
1453 </a>
1448 </td><td>
1454 </td><td>
1449 Specifying Single Revisions
1455 Specifying Single Revisions
1450 </td></tr>
1456 </td></tr>
1451 <tr><td>
1457 <tr><td>
1452 <a href="/help/revsets">
1458 <a href="/help/revsets">
1453 revsets
1459 revsets
1454 </a>
1460 </a>
1455 </td><td>
1461 </td><td>
1456 Specifying Revision Sets
1462 Specifying Revision Sets
1457 </td></tr>
1463 </td></tr>
1458 <tr><td>
1464 <tr><td>
1459 <a href="/help/scripting">
1465 <a href="/help/scripting">
1460 scripting
1466 scripting
1461 </a>
1467 </a>
1462 </td><td>
1468 </td><td>
1463 Using Mercurial from scripts and automation
1469 Using Mercurial from scripts and automation
1464 </td></tr>
1470 </td></tr>
1465 <tr><td>
1471 <tr><td>
1466 <a href="/help/subrepos">
1472 <a href="/help/subrepos">
1467 subrepos
1473 subrepos
1468 </a>
1474 </a>
1469 </td><td>
1475 </td><td>
1470 Subrepositories
1476 Subrepositories
1471 </td></tr>
1477 </td></tr>
1472 <tr><td>
1478 <tr><td>
1473 <a href="/help/templating">
1479 <a href="/help/templating">
1474 templating
1480 templating
1475 </a>
1481 </a>
1476 </td><td>
1482 </td><td>
1477 Template Usage
1483 Template Usage
1478 </td></tr>
1484 </td></tr>
1479 <tr><td>
1485 <tr><td>
1480 <a href="/help/urls">
1486 <a href="/help/urls">
1481 urls
1487 urls
1482 </a>
1488 </a>
1483 </td><td>
1489 </td><td>
1484 URL Paths
1490 URL Paths
1485 </td></tr>
1491 </td></tr>
1486 <tr><td>
1492 <tr><td>
1487 <a href="/help/topic-containing-verbose">
1493 <a href="/help/topic-containing-verbose">
1488 topic-containing-verbose
1494 topic-containing-verbose
1489 </a>
1495 </a>
1490 </td><td>
1496 </td><td>
1491 This is the topic to test omit indicating.
1497 This is the topic to test omit indicating.
1492 </td></tr>
1498 </td></tr>
1493
1499
1494 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1500 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1495
1501
1496 <tr><td>
1502 <tr><td>
1497 <a href="/help/add">
1503 <a href="/help/add">
1498 add
1504 add
1499 </a>
1505 </a>
1500 </td><td>
1506 </td><td>
1501 add the specified files on the next commit
1507 add the specified files on the next commit
1502 </td></tr>
1508 </td></tr>
1503 <tr><td>
1509 <tr><td>
1504 <a href="/help/annotate">
1510 <a href="/help/annotate">
1505 annotate
1511 annotate
1506 </a>
1512 </a>
1507 </td><td>
1513 </td><td>
1508 show changeset information by line for each file
1514 show changeset information by line for each file
1509 </td></tr>
1515 </td></tr>
1510 <tr><td>
1516 <tr><td>
1511 <a href="/help/clone">
1517 <a href="/help/clone">
1512 clone
1518 clone
1513 </a>
1519 </a>
1514 </td><td>
1520 </td><td>
1515 make a copy of an existing repository
1521 make a copy of an existing repository
1516 </td></tr>
1522 </td></tr>
1517 <tr><td>
1523 <tr><td>
1518 <a href="/help/commit">
1524 <a href="/help/commit">
1519 commit
1525 commit
1520 </a>
1526 </a>
1521 </td><td>
1527 </td><td>
1522 commit the specified files or all outstanding changes
1528 commit the specified files or all outstanding changes
1523 </td></tr>
1529 </td></tr>
1524 <tr><td>
1530 <tr><td>
1525 <a href="/help/diff">
1531 <a href="/help/diff">
1526 diff
1532 diff
1527 </a>
1533 </a>
1528 </td><td>
1534 </td><td>
1529 diff repository (or selected files)
1535 diff repository (or selected files)
1530 </td></tr>
1536 </td></tr>
1531 <tr><td>
1537 <tr><td>
1532 <a href="/help/export">
1538 <a href="/help/export">
1533 export
1539 export
1534 </a>
1540 </a>
1535 </td><td>
1541 </td><td>
1536 dump the header and diffs for one or more changesets
1542 dump the header and diffs for one or more changesets
1537 </td></tr>
1543 </td></tr>
1538 <tr><td>
1544 <tr><td>
1539 <a href="/help/forget">
1545 <a href="/help/forget">
1540 forget
1546 forget
1541 </a>
1547 </a>
1542 </td><td>
1548 </td><td>
1543 forget the specified files on the next commit
1549 forget the specified files on the next commit
1544 </td></tr>
1550 </td></tr>
1545 <tr><td>
1551 <tr><td>
1546 <a href="/help/init">
1552 <a href="/help/init">
1547 init
1553 init
1548 </a>
1554 </a>
1549 </td><td>
1555 </td><td>
1550 create a new repository in the given directory
1556 create a new repository in the given directory
1551 </td></tr>
1557 </td></tr>
1552 <tr><td>
1558 <tr><td>
1553 <a href="/help/log">
1559 <a href="/help/log">
1554 log
1560 log
1555 </a>
1561 </a>
1556 </td><td>
1562 </td><td>
1557 show revision history of entire repository or files
1563 show revision history of entire repository or files
1558 </td></tr>
1564 </td></tr>
1559 <tr><td>
1565 <tr><td>
1560 <a href="/help/merge">
1566 <a href="/help/merge">
1561 merge
1567 merge
1562 </a>
1568 </a>
1563 </td><td>
1569 </td><td>
1564 merge another revision into working directory
1570 merge another revision into working directory
1565 </td></tr>
1571 </td></tr>
1566 <tr><td>
1572 <tr><td>
1567 <a href="/help/pull">
1573 <a href="/help/pull">
1568 pull
1574 pull
1569 </a>
1575 </a>
1570 </td><td>
1576 </td><td>
1571 pull changes from the specified source
1577 pull changes from the specified source
1572 </td></tr>
1578 </td></tr>
1573 <tr><td>
1579 <tr><td>
1574 <a href="/help/push">
1580 <a href="/help/push">
1575 push
1581 push
1576 </a>
1582 </a>
1577 </td><td>
1583 </td><td>
1578 push changes to the specified destination
1584 push changes to the specified destination
1579 </td></tr>
1585 </td></tr>
1580 <tr><td>
1586 <tr><td>
1581 <a href="/help/remove">
1587 <a href="/help/remove">
1582 remove
1588 remove
1583 </a>
1589 </a>
1584 </td><td>
1590 </td><td>
1585 remove the specified files on the next commit
1591 remove the specified files on the next commit
1586 </td></tr>
1592 </td></tr>
1587 <tr><td>
1593 <tr><td>
1588 <a href="/help/serve">
1594 <a href="/help/serve">
1589 serve
1595 serve
1590 </a>
1596 </a>
1591 </td><td>
1597 </td><td>
1592 start stand-alone webserver
1598 start stand-alone webserver
1593 </td></tr>
1599 </td></tr>
1594 <tr><td>
1600 <tr><td>
1595 <a href="/help/status">
1601 <a href="/help/status">
1596 status
1602 status
1597 </a>
1603 </a>
1598 </td><td>
1604 </td><td>
1599 show changed files in the working directory
1605 show changed files in the working directory
1600 </td></tr>
1606 </td></tr>
1601 <tr><td>
1607 <tr><td>
1602 <a href="/help/summary">
1608 <a href="/help/summary">
1603 summary
1609 summary
1604 </a>
1610 </a>
1605 </td><td>
1611 </td><td>
1606 summarize working directory state
1612 summarize working directory state
1607 </td></tr>
1613 </td></tr>
1608 <tr><td>
1614 <tr><td>
1609 <a href="/help/update">
1615 <a href="/help/update">
1610 update
1616 update
1611 </a>
1617 </a>
1612 </td><td>
1618 </td><td>
1613 update working directory (or switch revisions)
1619 update working directory (or switch revisions)
1614 </td></tr>
1620 </td></tr>
1615
1621
1616 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1622 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1617
1623
1618 <tr><td>
1624 <tr><td>
1619 <a href="/help/addremove">
1625 <a href="/help/addremove">
1620 addremove
1626 addremove
1621 </a>
1627 </a>
1622 </td><td>
1628 </td><td>
1623 add all new files, delete all missing files
1629 add all new files, delete all missing files
1624 </td></tr>
1630 </td></tr>
1625 <tr><td>
1631 <tr><td>
1626 <a href="/help/archive">
1632 <a href="/help/archive">
1627 archive
1633 archive
1628 </a>
1634 </a>
1629 </td><td>
1635 </td><td>
1630 create an unversioned archive of a repository revision
1636 create an unversioned archive of a repository revision
1631 </td></tr>
1637 </td></tr>
1632 <tr><td>
1638 <tr><td>
1633 <a href="/help/backout">
1639 <a href="/help/backout">
1634 backout
1640 backout
1635 </a>
1641 </a>
1636 </td><td>
1642 </td><td>
1637 reverse effect of earlier changeset
1643 reverse effect of earlier changeset
1638 </td></tr>
1644 </td></tr>
1639 <tr><td>
1645 <tr><td>
1640 <a href="/help/bisect">
1646 <a href="/help/bisect">
1641 bisect
1647 bisect
1642 </a>
1648 </a>
1643 </td><td>
1649 </td><td>
1644 subdivision search of changesets
1650 subdivision search of changesets
1645 </td></tr>
1651 </td></tr>
1646 <tr><td>
1652 <tr><td>
1647 <a href="/help/bookmarks">
1653 <a href="/help/bookmarks">
1648 bookmarks
1654 bookmarks
1649 </a>
1655 </a>
1650 </td><td>
1656 </td><td>
1651 create a new bookmark or list existing bookmarks
1657 create a new bookmark or list existing bookmarks
1652 </td></tr>
1658 </td></tr>
1653 <tr><td>
1659 <tr><td>
1654 <a href="/help/branch">
1660 <a href="/help/branch">
1655 branch
1661 branch
1656 </a>
1662 </a>
1657 </td><td>
1663 </td><td>
1658 set or show the current branch name
1664 set or show the current branch name
1659 </td></tr>
1665 </td></tr>
1660 <tr><td>
1666 <tr><td>
1661 <a href="/help/branches">
1667 <a href="/help/branches">
1662 branches
1668 branches
1663 </a>
1669 </a>
1664 </td><td>
1670 </td><td>
1665 list repository named branches
1671 list repository named branches
1666 </td></tr>
1672 </td></tr>
1667 <tr><td>
1673 <tr><td>
1668 <a href="/help/bundle">
1674 <a href="/help/bundle">
1669 bundle
1675 bundle
1670 </a>
1676 </a>
1671 </td><td>
1677 </td><td>
1672 create a changegroup file
1678 create a changegroup file
1673 </td></tr>
1679 </td></tr>
1674 <tr><td>
1680 <tr><td>
1675 <a href="/help/cat">
1681 <a href="/help/cat">
1676 cat
1682 cat
1677 </a>
1683 </a>
1678 </td><td>
1684 </td><td>
1679 output the current or given revision of files
1685 output the current or given revision of files
1680 </td></tr>
1686 </td></tr>
1681 <tr><td>
1687 <tr><td>
1682 <a href="/help/config">
1688 <a href="/help/config">
1683 config
1689 config
1684 </a>
1690 </a>
1685 </td><td>
1691 </td><td>
1686 show combined config settings from all hgrc files
1692 show combined config settings from all hgrc files
1687 </td></tr>
1693 </td></tr>
1688 <tr><td>
1694 <tr><td>
1689 <a href="/help/copy">
1695 <a href="/help/copy">
1690 copy
1696 copy
1691 </a>
1697 </a>
1692 </td><td>
1698 </td><td>
1693 mark files as copied for the next commit
1699 mark files as copied for the next commit
1694 </td></tr>
1700 </td></tr>
1695 <tr><td>
1701 <tr><td>
1696 <a href="/help/files">
1702 <a href="/help/files">
1697 files
1703 files
1698 </a>
1704 </a>
1699 </td><td>
1705 </td><td>
1700 list tracked files
1706 list tracked files
1701 </td></tr>
1707 </td></tr>
1702 <tr><td>
1708 <tr><td>
1703 <a href="/help/graft">
1709 <a href="/help/graft">
1704 graft
1710 graft
1705 </a>
1711 </a>
1706 </td><td>
1712 </td><td>
1707 copy changes from other branches onto the current branch
1713 copy changes from other branches onto the current branch
1708 </td></tr>
1714 </td></tr>
1709 <tr><td>
1715 <tr><td>
1710 <a href="/help/grep">
1716 <a href="/help/grep">
1711 grep
1717 grep
1712 </a>
1718 </a>
1713 </td><td>
1719 </td><td>
1714 search for a pattern in specified files and revisions
1720 search for a pattern in specified files and revisions
1715 </td></tr>
1721 </td></tr>
1716 <tr><td>
1722 <tr><td>
1717 <a href="/help/heads">
1723 <a href="/help/heads">
1718 heads
1724 heads
1719 </a>
1725 </a>
1720 </td><td>
1726 </td><td>
1721 show branch heads
1727 show branch heads
1722 </td></tr>
1728 </td></tr>
1723 <tr><td>
1729 <tr><td>
1724 <a href="/help/help">
1730 <a href="/help/help">
1725 help
1731 help
1726 </a>
1732 </a>
1727 </td><td>
1733 </td><td>
1728 show help for a given topic or a help overview
1734 show help for a given topic or a help overview
1729 </td></tr>
1735 </td></tr>
1730 <tr><td>
1736 <tr><td>
1731 <a href="/help/identify">
1737 <a href="/help/identify">
1732 identify
1738 identify
1733 </a>
1739 </a>
1734 </td><td>
1740 </td><td>
1735 identify the working directory or specified revision
1741 identify the working directory or specified revision
1736 </td></tr>
1742 </td></tr>
1737 <tr><td>
1743 <tr><td>
1738 <a href="/help/import">
1744 <a href="/help/import">
1739 import
1745 import
1740 </a>
1746 </a>
1741 </td><td>
1747 </td><td>
1742 import an ordered set of patches
1748 import an ordered set of patches
1743 </td></tr>
1749 </td></tr>
1744 <tr><td>
1750 <tr><td>
1745 <a href="/help/incoming">
1751 <a href="/help/incoming">
1746 incoming
1752 incoming
1747 </a>
1753 </a>
1748 </td><td>
1754 </td><td>
1749 show new changesets found in source
1755 show new changesets found in source
1750 </td></tr>
1756 </td></tr>
1751 <tr><td>
1757 <tr><td>
1752 <a href="/help/manifest">
1758 <a href="/help/manifest">
1753 manifest
1759 manifest
1754 </a>
1760 </a>
1755 </td><td>
1761 </td><td>
1756 output the current or given revision of the project manifest
1762 output the current or given revision of the project manifest
1757 </td></tr>
1763 </td></tr>
1758 <tr><td>
1764 <tr><td>
1759 <a href="/help/nohelp">
1765 <a href="/help/nohelp">
1760 nohelp
1766 nohelp
1761 </a>
1767 </a>
1762 </td><td>
1768 </td><td>
1763 (no help text available)
1769 (no help text available)
1764 </td></tr>
1770 </td></tr>
1765 <tr><td>
1771 <tr><td>
1766 <a href="/help/outgoing">
1772 <a href="/help/outgoing">
1767 outgoing
1773 outgoing
1768 </a>
1774 </a>
1769 </td><td>
1775 </td><td>
1770 show changesets not found in the destination
1776 show changesets not found in the destination
1771 </td></tr>
1777 </td></tr>
1772 <tr><td>
1778 <tr><td>
1773 <a href="/help/paths">
1779 <a href="/help/paths">
1774 paths
1780 paths
1775 </a>
1781 </a>
1776 </td><td>
1782 </td><td>
1777 show aliases for remote repositories
1783 show aliases for remote repositories
1778 </td></tr>
1784 </td></tr>
1779 <tr><td>
1785 <tr><td>
1780 <a href="/help/phase">
1786 <a href="/help/phase">
1781 phase
1787 phase
1782 </a>
1788 </a>
1783 </td><td>
1789 </td><td>
1784 set or show the current phase name
1790 set or show the current phase name
1785 </td></tr>
1791 </td></tr>
1786 <tr><td>
1792 <tr><td>
1787 <a href="/help/recover">
1793 <a href="/help/recover">
1788 recover
1794 recover
1789 </a>
1795 </a>
1790 </td><td>
1796 </td><td>
1791 roll back an interrupted transaction
1797 roll back an interrupted transaction
1792 </td></tr>
1798 </td></tr>
1793 <tr><td>
1799 <tr><td>
1794 <a href="/help/rename">
1800 <a href="/help/rename">
1795 rename
1801 rename
1796 </a>
1802 </a>
1797 </td><td>
1803 </td><td>
1798 rename files; equivalent of copy + remove
1804 rename files; equivalent of copy + remove
1799 </td></tr>
1805 </td></tr>
1800 <tr><td>
1806 <tr><td>
1801 <a href="/help/resolve">
1807 <a href="/help/resolve">
1802 resolve
1808 resolve
1803 </a>
1809 </a>
1804 </td><td>
1810 </td><td>
1805 redo merges or set/view the merge status of files
1811 redo merges or set/view the merge status of files
1806 </td></tr>
1812 </td></tr>
1807 <tr><td>
1813 <tr><td>
1808 <a href="/help/revert">
1814 <a href="/help/revert">
1809 revert
1815 revert
1810 </a>
1816 </a>
1811 </td><td>
1817 </td><td>
1812 restore files to their checkout state
1818 restore files to their checkout state
1813 </td></tr>
1819 </td></tr>
1814 <tr><td>
1820 <tr><td>
1815 <a href="/help/root">
1821 <a href="/help/root">
1816 root
1822 root
1817 </a>
1823 </a>
1818 </td><td>
1824 </td><td>
1819 print the root (top) of the current working directory
1825 print the root (top) of the current working directory
1820 </td></tr>
1826 </td></tr>
1821 <tr><td>
1827 <tr><td>
1822 <a href="/help/tag">
1828 <a href="/help/tag">
1823 tag
1829 tag
1824 </a>
1830 </a>
1825 </td><td>
1831 </td><td>
1826 add one or more tags for the current or given revision
1832 add one or more tags for the current or given revision
1827 </td></tr>
1833 </td></tr>
1828 <tr><td>
1834 <tr><td>
1829 <a href="/help/tags">
1835 <a href="/help/tags">
1830 tags
1836 tags
1831 </a>
1837 </a>
1832 </td><td>
1838 </td><td>
1833 list repository tags
1839 list repository tags
1834 </td></tr>
1840 </td></tr>
1835 <tr><td>
1841 <tr><td>
1836 <a href="/help/unbundle">
1842 <a href="/help/unbundle">
1837 unbundle
1843 unbundle
1838 </a>
1844 </a>
1839 </td><td>
1845 </td><td>
1840 apply one or more changegroup files
1846 apply one or more changegroup files
1841 </td></tr>
1847 </td></tr>
1842 <tr><td>
1848 <tr><td>
1843 <a href="/help/verify">
1849 <a href="/help/verify">
1844 verify
1850 verify
1845 </a>
1851 </a>
1846 </td><td>
1852 </td><td>
1847 verify the integrity of the repository
1853 verify the integrity of the repository
1848 </td></tr>
1854 </td></tr>
1849 <tr><td>
1855 <tr><td>
1850 <a href="/help/version">
1856 <a href="/help/version">
1851 version
1857 version
1852 </a>
1858 </a>
1853 </td><td>
1859 </td><td>
1854 output version and copyright information
1860 output version and copyright information
1855 </td></tr>
1861 </td></tr>
1856 </table>
1862 </table>
1857 </div>
1863 </div>
1858 </div>
1864 </div>
1859
1865
1860 <script type="text/javascript">process_dates()</script>
1866 <script type="text/javascript">process_dates()</script>
1861
1867
1862
1868
1863 </body>
1869 </body>
1864 </html>
1870 </html>
1865
1871
1866
1872
1867 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
1873 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
1868 200 Script output follows
1874 200 Script output follows
1869
1875
1870 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1876 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1871 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1877 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1872 <head>
1878 <head>
1873 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1879 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1874 <meta name="robots" content="index, nofollow" />
1880 <meta name="robots" content="index, nofollow" />
1875 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1881 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1876 <script type="text/javascript" src="/static/mercurial.js"></script>
1882 <script type="text/javascript" src="/static/mercurial.js"></script>
1877
1883
1878 <title>Help: add</title>
1884 <title>Help: add</title>
1879 </head>
1885 </head>
1880 <body>
1886 <body>
1881
1887
1882 <div class="container">
1888 <div class="container">
1883 <div class="menu">
1889 <div class="menu">
1884 <div class="logo">
1890 <div class="logo">
1885 <a href="http://mercurial.selenic.com/">
1891 <a href="http://mercurial.selenic.com/">
1886 <img src="/static/hglogo.png" alt="mercurial" /></a>
1892 <img src="/static/hglogo.png" alt="mercurial" /></a>
1887 </div>
1893 </div>
1888 <ul>
1894 <ul>
1889 <li><a href="/shortlog">log</a></li>
1895 <li><a href="/shortlog">log</a></li>
1890 <li><a href="/graph">graph</a></li>
1896 <li><a href="/graph">graph</a></li>
1891 <li><a href="/tags">tags</a></li>
1897 <li><a href="/tags">tags</a></li>
1892 <li><a href="/bookmarks">bookmarks</a></li>
1898 <li><a href="/bookmarks">bookmarks</a></li>
1893 <li><a href="/branches">branches</a></li>
1899 <li><a href="/branches">branches</a></li>
1894 </ul>
1900 </ul>
1895 <ul>
1901 <ul>
1896 <li class="active"><a href="/help">help</a></li>
1902 <li class="active"><a href="/help">help</a></li>
1897 </ul>
1903 </ul>
1898 </div>
1904 </div>
1899
1905
1900 <div class="main">
1906 <div class="main">
1901 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1907 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1902 <h3>Help: add</h3>
1908 <h3>Help: add</h3>
1903
1909
1904 <form class="search" action="/log">
1910 <form class="search" action="/log">
1905
1911
1906 <p><input name="rev" id="search1" type="text" size="30" /></p>
1912 <p><input name="rev" id="search1" type="text" size="30" /></p>
1907 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1913 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1908 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1914 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1909 </form>
1915 </form>
1910 <div id="doc">
1916 <div id="doc">
1911 <p>
1917 <p>
1912 hg add [OPTION]... [FILE]...
1918 hg add [OPTION]... [FILE]...
1913 </p>
1919 </p>
1914 <p>
1920 <p>
1915 add the specified files on the next commit
1921 add the specified files on the next commit
1916 </p>
1922 </p>
1917 <p>
1923 <p>
1918 Schedule files to be version controlled and added to the
1924 Schedule files to be version controlled and added to the
1919 repository.
1925 repository.
1920 </p>
1926 </p>
1921 <p>
1927 <p>
1922 The files will be added to the repository at the next commit. To
1928 The files will be added to the repository at the next commit. To
1923 undo an add before that, see &quot;hg forget&quot;.
1929 undo an add before that, see &quot;hg forget&quot;.
1924 </p>
1930 </p>
1925 <p>
1931 <p>
1926 If no names are given, add all files to the repository.
1932 If no names are given, add all files to the repository.
1927 </p>
1933 </p>
1928 <p>
1934 <p>
1929 An example showing how new (unknown) files are added
1935 An example showing how new (unknown) files are added
1930 automatically by &quot;hg add&quot;:
1936 automatically by &quot;hg add&quot;:
1931 </p>
1937 </p>
1932 <pre>
1938 <pre>
1933 \$ ls (re)
1939 \$ ls (re)
1934 foo.c
1940 foo.c
1935 \$ hg status (re)
1941 \$ hg status (re)
1936 ? foo.c
1942 ? foo.c
1937 \$ hg add (re)
1943 \$ hg add (re)
1938 adding foo.c
1944 adding foo.c
1939 \$ hg status (re)
1945 \$ hg status (re)
1940 A foo.c
1946 A foo.c
1941 </pre>
1947 </pre>
1942 <p>
1948 <p>
1943 Returns 0 if all files are successfully added.
1949 Returns 0 if all files are successfully added.
1944 </p>
1950 </p>
1945 <p>
1951 <p>
1946 options ([+] can be repeated):
1952 options ([+] can be repeated):
1947 </p>
1953 </p>
1948 <table>
1954 <table>
1949 <tr><td>-I</td>
1955 <tr><td>-I</td>
1950 <td>--include PATTERN [+]</td>
1956 <td>--include PATTERN [+]</td>
1951 <td>include names matching the given patterns</td></tr>
1957 <td>include names matching the given patterns</td></tr>
1952 <tr><td>-X</td>
1958 <tr><td>-X</td>
1953 <td>--exclude PATTERN [+]</td>
1959 <td>--exclude PATTERN [+]</td>
1954 <td>exclude names matching the given patterns</td></tr>
1960 <td>exclude names matching the given patterns</td></tr>
1955 <tr><td>-S</td>
1961 <tr><td>-S</td>
1956 <td>--subrepos</td>
1962 <td>--subrepos</td>
1957 <td>recurse into subrepositories</td></tr>
1963 <td>recurse into subrepositories</td></tr>
1958 <tr><td>-n</td>
1964 <tr><td>-n</td>
1959 <td>--dry-run</td>
1965 <td>--dry-run</td>
1960 <td>do not perform actions, just print output</td></tr>
1966 <td>do not perform actions, just print output</td></tr>
1961 </table>
1967 </table>
1962 <p>
1968 <p>
1963 global options ([+] can be repeated):
1969 global options ([+] can be repeated):
1964 </p>
1970 </p>
1965 <table>
1971 <table>
1966 <tr><td>-R</td>
1972 <tr><td>-R</td>
1967 <td>--repository REPO</td>
1973 <td>--repository REPO</td>
1968 <td>repository root directory or name of overlay bundle file</td></tr>
1974 <td>repository root directory or name of overlay bundle file</td></tr>
1969 <tr><td></td>
1975 <tr><td></td>
1970 <td>--cwd DIR</td>
1976 <td>--cwd DIR</td>
1971 <td>change working directory</td></tr>
1977 <td>change working directory</td></tr>
1972 <tr><td>-y</td>
1978 <tr><td>-y</td>
1973 <td>--noninteractive</td>
1979 <td>--noninteractive</td>
1974 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1980 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1975 <tr><td>-q</td>
1981 <tr><td>-q</td>
1976 <td>--quiet</td>
1982 <td>--quiet</td>
1977 <td>suppress output</td></tr>
1983 <td>suppress output</td></tr>
1978 <tr><td>-v</td>
1984 <tr><td>-v</td>
1979 <td>--verbose</td>
1985 <td>--verbose</td>
1980 <td>enable additional output</td></tr>
1986 <td>enable additional output</td></tr>
1981 <tr><td></td>
1987 <tr><td></td>
1982 <td>--config CONFIG [+]</td>
1988 <td>--config CONFIG [+]</td>
1983 <td>set/override config option (use 'section.name=value')</td></tr>
1989 <td>set/override config option (use 'section.name=value')</td></tr>
1984 <tr><td></td>
1990 <tr><td></td>
1985 <td>--debug</td>
1991 <td>--debug</td>
1986 <td>enable debugging output</td></tr>
1992 <td>enable debugging output</td></tr>
1987 <tr><td></td>
1993 <tr><td></td>
1988 <td>--debugger</td>
1994 <td>--debugger</td>
1989 <td>start debugger</td></tr>
1995 <td>start debugger</td></tr>
1990 <tr><td></td>
1996 <tr><td></td>
1991 <td>--encoding ENCODE</td>
1997 <td>--encoding ENCODE</td>
1992 <td>set the charset encoding (default: ascii)</td></tr>
1998 <td>set the charset encoding (default: ascii)</td></tr>
1993 <tr><td></td>
1999 <tr><td></td>
1994 <td>--encodingmode MODE</td>
2000 <td>--encodingmode MODE</td>
1995 <td>set the charset encoding mode (default: strict)</td></tr>
2001 <td>set the charset encoding mode (default: strict)</td></tr>
1996 <tr><td></td>
2002 <tr><td></td>
1997 <td>--traceback</td>
2003 <td>--traceback</td>
1998 <td>always print a traceback on exception</td></tr>
2004 <td>always print a traceback on exception</td></tr>
1999 <tr><td></td>
2005 <tr><td></td>
2000 <td>--time</td>
2006 <td>--time</td>
2001 <td>time how long the command takes</td></tr>
2007 <td>time how long the command takes</td></tr>
2002 <tr><td></td>
2008 <tr><td></td>
2003 <td>--profile</td>
2009 <td>--profile</td>
2004 <td>print command execution profile</td></tr>
2010 <td>print command execution profile</td></tr>
2005 <tr><td></td>
2011 <tr><td></td>
2006 <td>--version</td>
2012 <td>--version</td>
2007 <td>output version information and exit</td></tr>
2013 <td>output version information and exit</td></tr>
2008 <tr><td>-h</td>
2014 <tr><td>-h</td>
2009 <td>--help</td>
2015 <td>--help</td>
2010 <td>display help and exit</td></tr>
2016 <td>display help and exit</td></tr>
2011 <tr><td></td>
2017 <tr><td></td>
2012 <td>--hidden</td>
2018 <td>--hidden</td>
2013 <td>consider hidden changesets</td></tr>
2019 <td>consider hidden changesets</td></tr>
2014 </table>
2020 </table>
2015
2021
2016 </div>
2022 </div>
2017 </div>
2023 </div>
2018 </div>
2024 </div>
2019
2025
2020 <script type="text/javascript">process_dates()</script>
2026 <script type="text/javascript">process_dates()</script>
2021
2027
2022
2028
2023 </body>
2029 </body>
2024 </html>
2030 </html>
2025
2031
2026
2032
2027 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2033 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2028 200 Script output follows
2034 200 Script output follows
2029
2035
2030 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2036 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2031 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2037 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2032 <head>
2038 <head>
2033 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2039 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2034 <meta name="robots" content="index, nofollow" />
2040 <meta name="robots" content="index, nofollow" />
2035 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2041 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2036 <script type="text/javascript" src="/static/mercurial.js"></script>
2042 <script type="text/javascript" src="/static/mercurial.js"></script>
2037
2043
2038 <title>Help: remove</title>
2044 <title>Help: remove</title>
2039 </head>
2045 </head>
2040 <body>
2046 <body>
2041
2047
2042 <div class="container">
2048 <div class="container">
2043 <div class="menu">
2049 <div class="menu">
2044 <div class="logo">
2050 <div class="logo">
2045 <a href="http://mercurial.selenic.com/">
2051 <a href="http://mercurial.selenic.com/">
2046 <img src="/static/hglogo.png" alt="mercurial" /></a>
2052 <img src="/static/hglogo.png" alt="mercurial" /></a>
2047 </div>
2053 </div>
2048 <ul>
2054 <ul>
2049 <li><a href="/shortlog">log</a></li>
2055 <li><a href="/shortlog">log</a></li>
2050 <li><a href="/graph">graph</a></li>
2056 <li><a href="/graph">graph</a></li>
2051 <li><a href="/tags">tags</a></li>
2057 <li><a href="/tags">tags</a></li>
2052 <li><a href="/bookmarks">bookmarks</a></li>
2058 <li><a href="/bookmarks">bookmarks</a></li>
2053 <li><a href="/branches">branches</a></li>
2059 <li><a href="/branches">branches</a></li>
2054 </ul>
2060 </ul>
2055 <ul>
2061 <ul>
2056 <li class="active"><a href="/help">help</a></li>
2062 <li class="active"><a href="/help">help</a></li>
2057 </ul>
2063 </ul>
2058 </div>
2064 </div>
2059
2065
2060 <div class="main">
2066 <div class="main">
2061 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2067 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2062 <h3>Help: remove</h3>
2068 <h3>Help: remove</h3>
2063
2069
2064 <form class="search" action="/log">
2070 <form class="search" action="/log">
2065
2071
2066 <p><input name="rev" id="search1" type="text" size="30" /></p>
2072 <p><input name="rev" id="search1" type="text" size="30" /></p>
2067 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2073 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2068 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2074 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2069 </form>
2075 </form>
2070 <div id="doc">
2076 <div id="doc">
2071 <p>
2077 <p>
2072 hg remove [OPTION]... FILE...
2078 hg remove [OPTION]... FILE...
2073 </p>
2079 </p>
2074 <p>
2080 <p>
2075 aliases: rm
2081 aliases: rm
2076 </p>
2082 </p>
2077 <p>
2083 <p>
2078 remove the specified files on the next commit
2084 remove the specified files on the next commit
2079 </p>
2085 </p>
2080 <p>
2086 <p>
2081 Schedule the indicated files for removal from the current branch.
2087 Schedule the indicated files for removal from the current branch.
2082 </p>
2088 </p>
2083 <p>
2089 <p>
2084 This command schedules the files to be removed at the next commit.
2090 This command schedules the files to be removed at the next commit.
2085 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2091 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2086 files, see &quot;hg forget&quot;.
2092 files, see &quot;hg forget&quot;.
2087 </p>
2093 </p>
2088 <p>
2094 <p>
2089 -A/--after can be used to remove only files that have already
2095 -A/--after can be used to remove only files that have already
2090 been deleted, -f/--force can be used to force deletion, and -Af
2096 been deleted, -f/--force can be used to force deletion, and -Af
2091 can be used to remove files from the next revision without
2097 can be used to remove files from the next revision without
2092 deleting them from the working directory.
2098 deleting them from the working directory.
2093 </p>
2099 </p>
2094 <p>
2100 <p>
2095 The following table details the behavior of remove for different
2101 The following table details the behavior of remove for different
2096 file states (columns) and option combinations (rows). The file
2102 file states (columns) and option combinations (rows). The file
2097 states are Added [A], Clean [C], Modified [M] and Missing [!]
2103 states are Added [A], Clean [C], Modified [M] and Missing [!]
2098 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2104 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2099 (from branch) and Delete (from disk):
2105 (from branch) and Delete (from disk):
2100 </p>
2106 </p>
2101 <table>
2107 <table>
2102 <tr><td>opt/state</td>
2108 <tr><td>opt/state</td>
2103 <td>A</td>
2109 <td>A</td>
2104 <td>C</td>
2110 <td>C</td>
2105 <td>M</td>
2111 <td>M</td>
2106 <td>!</td></tr>
2112 <td>!</td></tr>
2107 <tr><td>none</td>
2113 <tr><td>none</td>
2108 <td>W</td>
2114 <td>W</td>
2109 <td>RD</td>
2115 <td>RD</td>
2110 <td>W</td>
2116 <td>W</td>
2111 <td>R</td></tr>
2117 <td>R</td></tr>
2112 <tr><td>-f</td>
2118 <tr><td>-f</td>
2113 <td>R</td>
2119 <td>R</td>
2114 <td>RD</td>
2120 <td>RD</td>
2115 <td>RD</td>
2121 <td>RD</td>
2116 <td>R</td></tr>
2122 <td>R</td></tr>
2117 <tr><td>-A</td>
2123 <tr><td>-A</td>
2118 <td>W</td>
2124 <td>W</td>
2119 <td>W</td>
2125 <td>W</td>
2120 <td>W</td>
2126 <td>W</td>
2121 <td>R</td></tr>
2127 <td>R</td></tr>
2122 <tr><td>-Af</td>
2128 <tr><td>-Af</td>
2123 <td>R</td>
2129 <td>R</td>
2124 <td>R</td>
2130 <td>R</td>
2125 <td>R</td>
2131 <td>R</td>
2126 <td>R</td></tr>
2132 <td>R</td></tr>
2127 </table>
2133 </table>
2128 <p>
2134 <p>
2129 Note that remove never deletes files in Added [A] state from the
2135 Note that remove never deletes files in Added [A] state from the
2130 working directory, not even if option --force is specified.
2136 working directory, not even if option --force is specified.
2131 </p>
2137 </p>
2132 <p>
2138 <p>
2133 Returns 0 on success, 1 if any warnings encountered.
2139 Returns 0 on success, 1 if any warnings encountered.
2134 </p>
2140 </p>
2135 <p>
2141 <p>
2136 options ([+] can be repeated):
2142 options ([+] can be repeated):
2137 </p>
2143 </p>
2138 <table>
2144 <table>
2139 <tr><td>-A</td>
2145 <tr><td>-A</td>
2140 <td>--after</td>
2146 <td>--after</td>
2141 <td>record delete for missing files</td></tr>
2147 <td>record delete for missing files</td></tr>
2142 <tr><td>-f</td>
2148 <tr><td>-f</td>
2143 <td>--force</td>
2149 <td>--force</td>
2144 <td>remove (and delete) file even if added or modified</td></tr>
2150 <td>remove (and delete) file even if added or modified</td></tr>
2145 <tr><td>-S</td>
2151 <tr><td>-S</td>
2146 <td>--subrepos</td>
2152 <td>--subrepos</td>
2147 <td>recurse into subrepositories</td></tr>
2153 <td>recurse into subrepositories</td></tr>
2148 <tr><td>-I</td>
2154 <tr><td>-I</td>
2149 <td>--include PATTERN [+]</td>
2155 <td>--include PATTERN [+]</td>
2150 <td>include names matching the given patterns</td></tr>
2156 <td>include names matching the given patterns</td></tr>
2151 <tr><td>-X</td>
2157 <tr><td>-X</td>
2152 <td>--exclude PATTERN [+]</td>
2158 <td>--exclude PATTERN [+]</td>
2153 <td>exclude names matching the given patterns</td></tr>
2159 <td>exclude names matching the given patterns</td></tr>
2154 </table>
2160 </table>
2155 <p>
2161 <p>
2156 global options ([+] can be repeated):
2162 global options ([+] can be repeated):
2157 </p>
2163 </p>
2158 <table>
2164 <table>
2159 <tr><td>-R</td>
2165 <tr><td>-R</td>
2160 <td>--repository REPO</td>
2166 <td>--repository REPO</td>
2161 <td>repository root directory or name of overlay bundle file</td></tr>
2167 <td>repository root directory or name of overlay bundle file</td></tr>
2162 <tr><td></td>
2168 <tr><td></td>
2163 <td>--cwd DIR</td>
2169 <td>--cwd DIR</td>
2164 <td>change working directory</td></tr>
2170 <td>change working directory</td></tr>
2165 <tr><td>-y</td>
2171 <tr><td>-y</td>
2166 <td>--noninteractive</td>
2172 <td>--noninteractive</td>
2167 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2173 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2168 <tr><td>-q</td>
2174 <tr><td>-q</td>
2169 <td>--quiet</td>
2175 <td>--quiet</td>
2170 <td>suppress output</td></tr>
2176 <td>suppress output</td></tr>
2171 <tr><td>-v</td>
2177 <tr><td>-v</td>
2172 <td>--verbose</td>
2178 <td>--verbose</td>
2173 <td>enable additional output</td></tr>
2179 <td>enable additional output</td></tr>
2174 <tr><td></td>
2180 <tr><td></td>
2175 <td>--config CONFIG [+]</td>
2181 <td>--config CONFIG [+]</td>
2176 <td>set/override config option (use 'section.name=value')</td></tr>
2182 <td>set/override config option (use 'section.name=value')</td></tr>
2177 <tr><td></td>
2183 <tr><td></td>
2178 <td>--debug</td>
2184 <td>--debug</td>
2179 <td>enable debugging output</td></tr>
2185 <td>enable debugging output</td></tr>
2180 <tr><td></td>
2186 <tr><td></td>
2181 <td>--debugger</td>
2187 <td>--debugger</td>
2182 <td>start debugger</td></tr>
2188 <td>start debugger</td></tr>
2183 <tr><td></td>
2189 <tr><td></td>
2184 <td>--encoding ENCODE</td>
2190 <td>--encoding ENCODE</td>
2185 <td>set the charset encoding (default: ascii)</td></tr>
2191 <td>set the charset encoding (default: ascii)</td></tr>
2186 <tr><td></td>
2192 <tr><td></td>
2187 <td>--encodingmode MODE</td>
2193 <td>--encodingmode MODE</td>
2188 <td>set the charset encoding mode (default: strict)</td></tr>
2194 <td>set the charset encoding mode (default: strict)</td></tr>
2189 <tr><td></td>
2195 <tr><td></td>
2190 <td>--traceback</td>
2196 <td>--traceback</td>
2191 <td>always print a traceback on exception</td></tr>
2197 <td>always print a traceback on exception</td></tr>
2192 <tr><td></td>
2198 <tr><td></td>
2193 <td>--time</td>
2199 <td>--time</td>
2194 <td>time how long the command takes</td></tr>
2200 <td>time how long the command takes</td></tr>
2195 <tr><td></td>
2201 <tr><td></td>
2196 <td>--profile</td>
2202 <td>--profile</td>
2197 <td>print command execution profile</td></tr>
2203 <td>print command execution profile</td></tr>
2198 <tr><td></td>
2204 <tr><td></td>
2199 <td>--version</td>
2205 <td>--version</td>
2200 <td>output version information and exit</td></tr>
2206 <td>output version information and exit</td></tr>
2201 <tr><td>-h</td>
2207 <tr><td>-h</td>
2202 <td>--help</td>
2208 <td>--help</td>
2203 <td>display help and exit</td></tr>
2209 <td>display help and exit</td></tr>
2204 <tr><td></td>
2210 <tr><td></td>
2205 <td>--hidden</td>
2211 <td>--hidden</td>
2206 <td>consider hidden changesets</td></tr>
2212 <td>consider hidden changesets</td></tr>
2207 </table>
2213 </table>
2208
2214
2209 </div>
2215 </div>
2210 </div>
2216 </div>
2211 </div>
2217 </div>
2212
2218
2213 <script type="text/javascript">process_dates()</script>
2219 <script type="text/javascript">process_dates()</script>
2214
2220
2215
2221
2216 </body>
2222 </body>
2217 </html>
2223 </html>
2218
2224
2219
2225
2220 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2226 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2221 200 Script output follows
2227 200 Script output follows
2222
2228
2223 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2229 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2224 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2230 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2225 <head>
2231 <head>
2226 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2232 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2227 <meta name="robots" content="index, nofollow" />
2233 <meta name="robots" content="index, nofollow" />
2228 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2234 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2229 <script type="text/javascript" src="/static/mercurial.js"></script>
2235 <script type="text/javascript" src="/static/mercurial.js"></script>
2230
2236
2231 <title>Help: revisions</title>
2237 <title>Help: revisions</title>
2232 </head>
2238 </head>
2233 <body>
2239 <body>
2234
2240
2235 <div class="container">
2241 <div class="container">
2236 <div class="menu">
2242 <div class="menu">
2237 <div class="logo">
2243 <div class="logo">
2238 <a href="http://mercurial.selenic.com/">
2244 <a href="http://mercurial.selenic.com/">
2239 <img src="/static/hglogo.png" alt="mercurial" /></a>
2245 <img src="/static/hglogo.png" alt="mercurial" /></a>
2240 </div>
2246 </div>
2241 <ul>
2247 <ul>
2242 <li><a href="/shortlog">log</a></li>
2248 <li><a href="/shortlog">log</a></li>
2243 <li><a href="/graph">graph</a></li>
2249 <li><a href="/graph">graph</a></li>
2244 <li><a href="/tags">tags</a></li>
2250 <li><a href="/tags">tags</a></li>
2245 <li><a href="/bookmarks">bookmarks</a></li>
2251 <li><a href="/bookmarks">bookmarks</a></li>
2246 <li><a href="/branches">branches</a></li>
2252 <li><a href="/branches">branches</a></li>
2247 </ul>
2253 </ul>
2248 <ul>
2254 <ul>
2249 <li class="active"><a href="/help">help</a></li>
2255 <li class="active"><a href="/help">help</a></li>
2250 </ul>
2256 </ul>
2251 </div>
2257 </div>
2252
2258
2253 <div class="main">
2259 <div class="main">
2254 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2260 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2255 <h3>Help: revisions</h3>
2261 <h3>Help: revisions</h3>
2256
2262
2257 <form class="search" action="/log">
2263 <form class="search" action="/log">
2258
2264
2259 <p><input name="rev" id="search1" type="text" size="30" /></p>
2265 <p><input name="rev" id="search1" type="text" size="30" /></p>
2260 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2266 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2261 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2267 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2262 </form>
2268 </form>
2263 <div id="doc">
2269 <div id="doc">
2264 <h1>Specifying Single Revisions</h1>
2270 <h1>Specifying Single Revisions</h1>
2265 <p>
2271 <p>
2266 Mercurial supports several ways to specify individual revisions.
2272 Mercurial supports several ways to specify individual revisions.
2267 </p>
2273 </p>
2268 <p>
2274 <p>
2269 A plain integer is treated as a revision number. Negative integers are
2275 A plain integer is treated as a revision number. Negative integers are
2270 treated as sequential offsets from the tip, with -1 denoting the tip,
2276 treated as sequential offsets from the tip, with -1 denoting the tip,
2271 -2 denoting the revision prior to the tip, and so forth.
2277 -2 denoting the revision prior to the tip, and so forth.
2272 </p>
2278 </p>
2273 <p>
2279 <p>
2274 A 40-digit hexadecimal string is treated as a unique revision
2280 A 40-digit hexadecimal string is treated as a unique revision
2275 identifier.
2281 identifier.
2276 </p>
2282 </p>
2277 <p>
2283 <p>
2278 A hexadecimal string less than 40 characters long is treated as a
2284 A hexadecimal string less than 40 characters long is treated as a
2279 unique revision identifier and is referred to as a short-form
2285 unique revision identifier and is referred to as a short-form
2280 identifier. A short-form identifier is only valid if it is the prefix
2286 identifier. A short-form identifier is only valid if it is the prefix
2281 of exactly one full-length identifier.
2287 of exactly one full-length identifier.
2282 </p>
2288 </p>
2283 <p>
2289 <p>
2284 Any other string is treated as a bookmark, tag, or branch name. A
2290 Any other string is treated as a bookmark, tag, or branch name. A
2285 bookmark is a movable pointer to a revision. A tag is a permanent name
2291 bookmark is a movable pointer to a revision. A tag is a permanent name
2286 associated with a revision. A branch name denotes the tipmost open branch head
2292 associated with a revision. A branch name denotes the tipmost open branch head
2287 of that branch - or if they are all closed, the tipmost closed head of the
2293 of that branch - or if they are all closed, the tipmost closed head of the
2288 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2294 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2289 </p>
2295 </p>
2290 <p>
2296 <p>
2291 The reserved name &quot;tip&quot; always identifies the most recent revision.
2297 The reserved name &quot;tip&quot; always identifies the most recent revision.
2292 </p>
2298 </p>
2293 <p>
2299 <p>
2294 The reserved name &quot;null&quot; indicates the null revision. This is the
2300 The reserved name &quot;null&quot; indicates the null revision. This is the
2295 revision of an empty repository, and the parent of revision 0.
2301 revision of an empty repository, and the parent of revision 0.
2296 </p>
2302 </p>
2297 <p>
2303 <p>
2298 The reserved name &quot;.&quot; indicates the working directory parent. If no
2304 The reserved name &quot;.&quot; indicates the working directory parent. If no
2299 working directory is checked out, it is equivalent to null. If an
2305 working directory is checked out, it is equivalent to null. If an
2300 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2306 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2301 parent.
2307 parent.
2302 </p>
2308 </p>
2303
2309
2304 </div>
2310 </div>
2305 </div>
2311 </div>
2306 </div>
2312 </div>
2307
2313
2308 <script type="text/javascript">process_dates()</script>
2314 <script type="text/javascript">process_dates()</script>
2309
2315
2310
2316
2311 </body>
2317 </body>
2312 </html>
2318 </html>
2313
2319
2314
2320
2315 $ killdaemons.py
2321 $ killdaemons.py
2316
2322
2317 #endif
2323 #endif
General Comments 0
You need to be logged in to leave comments. Login now