##// END OF EJS Templates
help: search section of help topic by translated section name correctly...
FUJIWARA Katsunori -
r29155:aaabed77 3.8.2 stable
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,816 +1,816 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 https://mercurial-scm.org/wiki/HelpStyleGuide
17 Remember to update https://mercurial-scm.org/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 # indentation.
518 # indentation.
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 lastparents = []
664 lastparents = []
665 synthetic = []
665 synthetic = []
666 collapse = True
666 collapse = True
667 while i < len(sections):
667 while i < len(sections):
668 name, nest, b = sections[i]
668 name, nest, b = sections[i]
669 del parents[nest:]
669 del parents[nest:]
670 parents.append(i)
670 parents.append(i)
671 if name == section:
671 if name == section:
672 if lastparents != parents:
672 if lastparents != parents:
673 llen = len(lastparents)
673 llen = len(lastparents)
674 plen = len(parents)
674 plen = len(parents)
675 if llen and llen != plen:
675 if llen and llen != plen:
676 collapse = False
676 collapse = False
677 s = []
677 s = []
678 for j in xrange(3, plen - 1):
678 for j in xrange(3, plen - 1):
679 parent = parents[j]
679 parent = parents[j]
680 if (j >= llen or
680 if (j >= llen or
681 lastparents[j] != parent):
681 lastparents[j] != parent):
682 s.append(len(blocks))
682 s.append(len(blocks))
683 sec = sections[parent][2]
683 sec = sections[parent][2]
684 blocks.append(sec[0])
684 blocks.append(sec[0])
685 blocks.append(sec[-1])
685 blocks.append(sec[-1])
686 if s:
686 if s:
687 synthetic.append(s)
687 synthetic.append(s)
688
688
689 lastparents = parents[:]
689 lastparents = parents[:]
690 blocks.extend(b)
690 blocks.extend(b)
691
691
692 ## Also show all subnested sections
692 ## Also show all subnested sections
693 while i + 1 < len(sections) and sections[i + 1][1] > nest:
693 while i + 1 < len(sections) and sections[i + 1][1] > nest:
694 i += 1
694 i += 1
695 blocks.extend(sections[i][2])
695 blocks.extend(sections[i][2])
696 i += 1
696 i += 1
697 if collapse:
697 if collapse:
698 synthetic.reverse()
698 synthetic.reverse()
699 for s in synthetic:
699 for s in synthetic:
700 path = [blocks[i]['lines'][0] for i in s]
700 path = [blocks[i]['lines'][0] for i in s]
701 real = s[-1] + 2
701 real = s[-1] + 2
702 realline = blocks[real]['lines']
702 realline = blocks[real]['lines']
703 realline[0] = ('"%s"' %
703 realline[0] = ('"%s"' %
704 '.'.join(path + [realline[0]]).replace('"', ''))
704 '.'.join(path + [realline[0]]).replace('"', ''))
705 del blocks[s[0]:real]
705 del blocks[s[0]:real]
706
706
707 if style == 'html':
707 if style == 'html':
708 text = formathtml(blocks)
708 text = formathtml(blocks)
709 else:
709 else:
710 text = ''.join(formatblock(b, width) for b in blocks)
710 text = ''.join(formatblock(b, width) for b in blocks)
711 if keep is None:
711 if keep is None:
712 return text
712 return text
713 else:
713 else:
714 return text, pruned
714 return text, pruned
715
715
716 def getsections(blocks):
716 def getsections(blocks):
717 '''return a list of (section name, nesting level, blocks) tuples'''
717 '''return a list of (section name, nesting level, blocks) tuples'''
718 nest = ""
718 nest = ""
719 level = 0
719 level = 0
720 secs = []
720 secs = []
721
721
722 def getname(b):
722 def getname(b):
723 if b['type'] == 'field':
723 if b['type'] == 'field':
724 x = b['key']
724 x = b['key']
725 else:
725 else:
726 x = b['lines'][0]
726 x = b['lines'][0]
727 x = x.lower().strip('"')
727 x = encoding.lower(x).strip('"')
728 if '(' in x:
728 if '(' in x:
729 x = x.split('(')[0]
729 x = x.split('(')[0]
730 return x
730 return x
731
731
732 for b in blocks:
732 for b in blocks:
733 if b['type'] == 'section':
733 if b['type'] == 'section':
734 i = b['underline']
734 i = b['underline']
735 if i not in nest:
735 if i not in nest:
736 nest += i
736 nest += i
737 level = nest.index(i) + 1
737 level = nest.index(i) + 1
738 nest = nest[:level]
738 nest = nest[:level]
739 secs.append((getname(b), level, [b]))
739 secs.append((getname(b), level, [b]))
740 elif b['type'] in ('definition', 'field'):
740 elif b['type'] in ('definition', 'field'):
741 i = ' '
741 i = ' '
742 if i not in nest:
742 if i not in nest:
743 nest += i
743 nest += i
744 level = nest.index(i) + 1
744 level = nest.index(i) + 1
745 nest = nest[:level]
745 nest = nest[:level]
746 for i in range(1, len(secs) + 1):
746 for i in range(1, len(secs) + 1):
747 sec = secs[-i]
747 sec = secs[-i]
748 if sec[1] < level:
748 if sec[1] < level:
749 break
749 break
750 siblings = [a for a in sec[2] if a['type'] == 'definition']
750 siblings = [a for a in sec[2] if a['type'] == 'definition']
751 if siblings:
751 if siblings:
752 siblingindent = siblings[-1]['indent']
752 siblingindent = siblings[-1]['indent']
753 indent = b['indent']
753 indent = b['indent']
754 if siblingindent < indent:
754 if siblingindent < indent:
755 level += 1
755 level += 1
756 break
756 break
757 elif siblingindent == indent:
757 elif siblingindent == indent:
758 level = sec[1]
758 level = sec[1]
759 break
759 break
760 secs.append((getname(b), level, [b]))
760 secs.append((getname(b), level, [b]))
761 else:
761 else:
762 if not secs:
762 if not secs:
763 # add an initial empty section
763 # add an initial empty section
764 secs = [('', 0, [])]
764 secs = [('', 0, [])]
765 if b['type'] != 'margin':
765 if b['type'] != 'margin':
766 pointer = 1
766 pointer = 1
767 bindent = b['indent']
767 bindent = b['indent']
768 while pointer < len(secs):
768 while pointer < len(secs):
769 section = secs[-pointer][2][0]
769 section = secs[-pointer][2][0]
770 if section['type'] != 'margin':
770 if section['type'] != 'margin':
771 sindent = section['indent']
771 sindent = section['indent']
772 if len(section['lines']) > 1:
772 if len(section['lines']) > 1:
773 sindent += len(section['lines'][1]) - \
773 sindent += len(section['lines'][1]) - \
774 len(section['lines'][1].lstrip(' '))
774 len(section['lines'][1].lstrip(' '))
775 if bindent >= sindent:
775 if bindent >= sindent:
776 break
776 break
777 pointer += 1
777 pointer += 1
778 if pointer > 1:
778 if pointer > 1:
779 blevel = secs[-pointer][1]
779 blevel = secs[-pointer][1]
780 if section['type'] != b['type']:
780 if section['type'] != b['type']:
781 blevel += 1
781 blevel += 1
782 secs.append(('', blevel, []))
782 secs.append(('', blevel, []))
783 secs[-1][2].append(b)
783 secs[-1][2].append(b)
784 return secs
784 return secs
785
785
786 def decorateblocks(blocks, width):
786 def decorateblocks(blocks, width):
787 '''generate a list of (section name, line text) pairs for search'''
787 '''generate a list of (section name, line text) pairs for search'''
788 lines = []
788 lines = []
789 for s in getsections(blocks):
789 for s in getsections(blocks):
790 section = s[0]
790 section = s[0]
791 text = formatblocks(s[2], width)
791 text = formatblocks(s[2], width)
792 lines.append([(section, l) for l in text.splitlines(True)])
792 lines.append([(section, l) for l in text.splitlines(True)])
793 return lines
793 return lines
794
794
795 def maketable(data, indent=0, header=False):
795 def maketable(data, indent=0, header=False):
796 '''Generate an RST table for the given table data as a list of lines'''
796 '''Generate an RST table for the given table data as a list of lines'''
797
797
798 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
798 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
799 indent = ' ' * indent
799 indent = ' ' * indent
800 div = indent + ' '.join('=' * w for w in widths) + '\n'
800 div = indent + ' '.join('=' * w for w in widths) + '\n'
801
801
802 out = [div]
802 out = [div]
803 for row in data:
803 for row in data:
804 l = []
804 l = []
805 for w, v in zip(widths, row):
805 for w, v in zip(widths, row):
806 if '\n' in v:
806 if '\n' in v:
807 # only remove line breaks and indentation, long lines are
807 # only remove line breaks and indentation, long lines are
808 # handled by the next tool
808 # handled by the next tool
809 v = ' '.join(e.lstrip() for e in v.split('\n'))
809 v = ' '.join(e.lstrip() for e in v.split('\n'))
810 pad = ' ' * (w - encoding.colwidth(v))
810 pad = ' ' * (w - encoding.colwidth(v))
811 l.append(v + pad)
811 l.append(v + pad)
812 out.append(indent + ' '.join(l) + "\n")
812 out.append(indent + ' '.join(l) + "\n")
813 if header and len(data) > 1:
813 if header and len(data) > 1:
814 out.insert(2, div)
814 out.insert(2, div)
815 out.append(div)
815 out.append(div)
816 return out
816 return out
@@ -1,3057 +1,3129 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 internals Technical implementation topics
114 internals Technical implementation topics
115 merge-tools Merge Tools
115 merge-tools Merge Tools
116 multirevs Specifying Multiple Revisions
116 multirevs Specifying Multiple Revisions
117 patterns File Name Patterns
117 patterns File Name Patterns
118 phases Working with Phases
118 phases Working with Phases
119 revisions Specifying Single Revisions
119 revisions Specifying Single Revisions
120 revsets Specifying Revision Sets
120 revsets Specifying Revision Sets
121 scripting Using Mercurial from scripts and automation
121 scripting Using Mercurial from scripts and automation
122 subrepos Subrepositories
122 subrepos Subrepositories
123 templating Template Usage
123 templating Template Usage
124 urls URL Paths
124 urls URL Paths
125
125
126 (use "hg help -v" to show built-in aliases and global options)
126 (use "hg help -v" to show built-in aliases and global options)
127
127
128 $ hg -q help
128 $ hg -q help
129 add add the specified files on the next commit
129 add add the specified files on the next commit
130 addremove add all new files, delete all missing files
130 addremove add all new files, delete all missing files
131 annotate show changeset information by line for each file
131 annotate show changeset information by line for each file
132 archive create an unversioned archive of a repository revision
132 archive create an unversioned archive of a repository revision
133 backout reverse effect of earlier changeset
133 backout reverse effect of earlier changeset
134 bisect subdivision search of changesets
134 bisect subdivision search of changesets
135 bookmarks create a new bookmark or list existing bookmarks
135 bookmarks create a new bookmark or list existing bookmarks
136 branch set or show the current branch name
136 branch set or show the current branch name
137 branches list repository named branches
137 branches list repository named branches
138 bundle create a changegroup file
138 bundle create a changegroup file
139 cat output the current or given revision of files
139 cat output the current or given revision of files
140 clone make a copy of an existing repository
140 clone make a copy of an existing repository
141 commit commit the specified files or all outstanding changes
141 commit commit the specified files or all outstanding changes
142 config show combined config settings from all hgrc files
142 config show combined config settings from all hgrc files
143 copy mark files as copied for the next commit
143 copy mark files as copied for the next commit
144 diff diff repository (or selected files)
144 diff diff repository (or selected files)
145 export dump the header and diffs for one or more changesets
145 export dump the header and diffs for one or more changesets
146 files list tracked files
146 files list tracked files
147 forget forget the specified files on the next commit
147 forget forget the specified files on the next commit
148 graft copy changes from other branches onto the current branch
148 graft copy changes from other branches onto the current branch
149 grep search for a pattern in specified files and revisions
149 grep search for a pattern in specified files and revisions
150 heads show branch heads
150 heads show branch heads
151 help show help for a given topic or a help overview
151 help show help for a given topic or a help overview
152 identify identify the working directory or specified revision
152 identify identify the working directory or specified revision
153 import import an ordered set of patches
153 import import an ordered set of patches
154 incoming show new changesets found in source
154 incoming show new changesets found in source
155 init create a new repository in the given directory
155 init create a new repository in the given directory
156 log show revision history of entire repository or files
156 log show revision history of entire repository or files
157 manifest output the current or given revision of the project manifest
157 manifest output the current or given revision of the project manifest
158 merge merge another revision into working directory
158 merge merge another revision into working directory
159 outgoing show changesets not found in the destination
159 outgoing show changesets not found in the destination
160 paths show aliases for remote repositories
160 paths show aliases for remote repositories
161 phase set or show the current phase name
161 phase set or show the current phase name
162 pull pull changes from the specified source
162 pull pull changes from the specified source
163 push push changes to the specified destination
163 push push changes to the specified destination
164 recover roll back an interrupted transaction
164 recover roll back an interrupted transaction
165 remove remove the specified files on the next commit
165 remove remove the specified files on the next commit
166 rename rename files; equivalent of copy + remove
166 rename rename files; equivalent of copy + remove
167 resolve redo merges or set/view the merge status of files
167 resolve redo merges or set/view the merge status of files
168 revert restore files to their checkout state
168 revert restore files to their checkout state
169 root print the root (top) of the current working directory
169 root print the root (top) of the current working directory
170 serve start stand-alone webserver
170 serve start stand-alone webserver
171 status show changed files in the working directory
171 status show changed files in the working directory
172 summary summarize working directory state
172 summary summarize working directory state
173 tag add one or more tags for the current or given revision
173 tag add one or more tags for the current or given revision
174 tags list repository tags
174 tags list repository tags
175 unbundle apply one or more changegroup files
175 unbundle apply one or more changegroup files
176 update update working directory (or switch revisions)
176 update update working directory (or switch revisions)
177 verify verify the integrity of the repository
177 verify verify the integrity of the repository
178 version output version and copyright information
178 version output version and copyright information
179
179
180 additional help topics:
180 additional help topics:
181
181
182 config Configuration Files
182 config Configuration Files
183 dates Date Formats
183 dates Date Formats
184 diffs Diff Formats
184 diffs Diff Formats
185 environment Environment Variables
185 environment Environment Variables
186 extensions Using Additional Features
186 extensions Using Additional Features
187 filesets Specifying File Sets
187 filesets Specifying File Sets
188 glossary Glossary
188 glossary Glossary
189 hgignore Syntax for Mercurial Ignore Files
189 hgignore Syntax for Mercurial Ignore Files
190 hgweb Configuring hgweb
190 hgweb Configuring hgweb
191 internals Technical implementation topics
191 internals Technical implementation topics
192 merge-tools Merge Tools
192 merge-tools Merge Tools
193 multirevs Specifying Multiple Revisions
193 multirevs Specifying Multiple Revisions
194 patterns File Name Patterns
194 patterns File Name Patterns
195 phases Working with Phases
195 phases Working with Phases
196 revisions Specifying Single Revisions
196 revisions Specifying Single Revisions
197 revsets Specifying Revision Sets
197 revsets Specifying Revision Sets
198 scripting Using Mercurial from scripts and automation
198 scripting Using Mercurial from scripts and automation
199 subrepos Subrepositories
199 subrepos Subrepositories
200 templating Template Usage
200 templating Template Usage
201 urls URL Paths
201 urls URL Paths
202
202
203 Test extension help:
203 Test extension help:
204 $ hg help extensions --config extensions.rebase= --config extensions.children=
204 $ hg help extensions --config extensions.rebase= --config extensions.children=
205 Using Additional Features
205 Using Additional Features
206 """""""""""""""""""""""""
206 """""""""""""""""""""""""
207
207
208 Mercurial has the ability to add new features through the use of
208 Mercurial has the ability to add new features through the use of
209 extensions. Extensions may add new commands, add options to existing
209 extensions. Extensions may add new commands, add options to existing
210 commands, change the default behavior of commands, or implement hooks.
210 commands, change the default behavior of commands, or implement hooks.
211
211
212 To enable the "foo" extension, either shipped with Mercurial or in the
212 To enable the "foo" extension, either shipped with Mercurial or in the
213 Python search path, create an entry for it in your configuration file,
213 Python search path, create an entry for it in your configuration file,
214 like this:
214 like this:
215
215
216 [extensions]
216 [extensions]
217 foo =
217 foo =
218
218
219 You may also specify the full path to an extension:
219 You may also specify the full path to an extension:
220
220
221 [extensions]
221 [extensions]
222 myfeature = ~/.hgext/myfeature.py
222 myfeature = ~/.hgext/myfeature.py
223
223
224 See 'hg help config' for more information on configuration files.
224 See 'hg help config' for more information on configuration files.
225
225
226 Extensions are not loaded by default for a variety of reasons: they can
226 Extensions are not loaded by default for a variety of reasons: they can
227 increase startup overhead; they may be meant for advanced usage only; they
227 increase startup overhead; they may be meant for advanced usage only; they
228 may provide potentially dangerous abilities (such as letting you destroy
228 may provide potentially dangerous abilities (such as letting you destroy
229 or modify history); they might not be ready for prime time; or they may
229 or modify history); they might not be ready for prime time; or they may
230 alter some usual behaviors of stock Mercurial. It is thus up to the user
230 alter some usual behaviors of stock Mercurial. It is thus up to the user
231 to activate extensions as needed.
231 to activate extensions as needed.
232
232
233 To explicitly disable an extension enabled in a configuration file of
233 To explicitly disable an extension enabled in a configuration file of
234 broader scope, prepend its path with !:
234 broader scope, prepend its path with !:
235
235
236 [extensions]
236 [extensions]
237 # disabling extension bar residing in /path/to/extension/bar.py
237 # disabling extension bar residing in /path/to/extension/bar.py
238 bar = !/path/to/extension/bar.py
238 bar = !/path/to/extension/bar.py
239 # ditto, but no path was supplied for extension baz
239 # ditto, but no path was supplied for extension baz
240 baz = !
240 baz = !
241
241
242 enabled extensions:
242 enabled extensions:
243
243
244 chgserver command server extension for cHg (EXPERIMENTAL) (?)
244 chgserver command server extension for cHg (EXPERIMENTAL) (?)
245 children command to display child changesets (DEPRECATED)
245 children command to display child changesets (DEPRECATED)
246 rebase command to move sets of revisions to a different ancestor
246 rebase command to move sets of revisions to a different ancestor
247
247
248 disabled extensions:
248 disabled extensions:
249
249
250 acl hooks for controlling repository access
250 acl hooks for controlling repository access
251 blackbox log repository events to a blackbox for debugging
251 blackbox log repository events to a blackbox for debugging
252 bugzilla hooks for integrating with the Bugzilla bug tracker
252 bugzilla hooks for integrating with the Bugzilla bug tracker
253 censor erase file content at a given revision
253 censor erase file content at a given revision
254 churn command to display statistics about repository history
254 churn command to display statistics about repository history
255 clonebundles advertise pre-generated bundles to seed clones
255 clonebundles advertise pre-generated bundles to seed clones
256 color colorize output from some commands
256 color colorize output from some commands
257 convert import revisions from foreign VCS repositories into
257 convert import revisions from foreign VCS repositories into
258 Mercurial
258 Mercurial
259 eol automatically manage newlines in repository files
259 eol automatically manage newlines in repository files
260 extdiff command to allow external programs to compare revisions
260 extdiff command to allow external programs to compare revisions
261 factotum http authentication with factotum
261 factotum http authentication with factotum
262 gpg commands to sign and verify changesets
262 gpg commands to sign and verify changesets
263 hgcia hooks for integrating with the CIA.vc notification service
263 hgcia hooks for integrating with the CIA.vc notification service
264 hgk browse the repository in a graphical way
264 hgk browse the repository in a graphical way
265 highlight syntax highlighting for hgweb (requires Pygments)
265 highlight syntax highlighting for hgweb (requires Pygments)
266 histedit interactive history editing
266 histedit interactive history editing
267 keyword expand keywords in tracked files
267 keyword expand keywords in tracked files
268 largefiles track large binary files
268 largefiles track large binary files
269 mq manage a stack of patches
269 mq manage a stack of patches
270 notify hooks for sending email push notifications
270 notify hooks for sending email push notifications
271 pager browse command output with an external pager
271 pager browse command output with an external pager
272 patchbomb command to send changesets as (a series of) patch emails
272 patchbomb command to send changesets as (a series of) patch emails
273 purge command to delete untracked files from the working
273 purge command to delete untracked files from the working
274 directory
274 directory
275 relink recreates hardlinks between repository clones
275 relink recreates hardlinks between repository clones
276 schemes extend schemes with shortcuts to repository swarms
276 schemes extend schemes with shortcuts to repository swarms
277 share share a common history between several working directories
277 share share a common history between several working directories
278 shelve save and restore changes to the working directory
278 shelve save and restore changes to the working directory
279 strip strip changesets and their descendants from history
279 strip strip changesets and their descendants from history
280 transplant command to transplant changesets from another branch
280 transplant command to transplant changesets from another branch
281 win32mbcs allow the use of MBCS paths with problematic encodings
281 win32mbcs allow the use of MBCS paths with problematic encodings
282 zeroconf discover and advertise repositories on the local network
282 zeroconf discover and advertise repositories on the local network
283
283
284 Verify that extension keywords appear in help templates
284 Verify that extension keywords appear in help templates
285
285
286 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
286 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
287
287
288 Test short command list with verbose option
288 Test short command list with verbose option
289
289
290 $ hg -v help shortlist
290 $ hg -v help shortlist
291 Mercurial Distributed SCM
291 Mercurial Distributed SCM
292
292
293 basic commands:
293 basic commands:
294
294
295 add add the specified files on the next commit
295 add add the specified files on the next commit
296 annotate, blame
296 annotate, blame
297 show changeset information by line for each file
297 show changeset information by line for each file
298 clone make a copy of an existing repository
298 clone make a copy of an existing repository
299 commit, ci commit the specified files or all outstanding changes
299 commit, ci commit the specified files or all outstanding changes
300 diff diff repository (or selected files)
300 diff diff repository (or selected files)
301 export dump the header and diffs for one or more changesets
301 export dump the header and diffs for one or more changesets
302 forget forget the specified files on the next commit
302 forget forget the specified files on the next commit
303 init create a new repository in the given directory
303 init create a new repository in the given directory
304 log, history show revision history of entire repository or files
304 log, history show revision history of entire repository or files
305 merge merge another revision into working directory
305 merge merge another revision into working directory
306 pull pull changes from the specified source
306 pull pull changes from the specified source
307 push push changes to the specified destination
307 push push changes to the specified destination
308 remove, rm remove the specified files on the next commit
308 remove, rm remove the specified files on the next commit
309 serve start stand-alone webserver
309 serve start stand-alone webserver
310 status, st show changed files in the working directory
310 status, st show changed files in the working directory
311 summary, sum summarize working directory state
311 summary, sum summarize working directory state
312 update, up, checkout, co
312 update, up, checkout, co
313 update working directory (or switch revisions)
313 update working directory (or switch revisions)
314
314
315 global options ([+] can be repeated):
315 global options ([+] can be repeated):
316
316
317 -R --repository REPO repository root directory or name of overlay bundle
317 -R --repository REPO repository root directory or name of overlay bundle
318 file
318 file
319 --cwd DIR change working directory
319 --cwd DIR change working directory
320 -y --noninteractive do not prompt, automatically pick the first choice for
320 -y --noninteractive do not prompt, automatically pick the first choice for
321 all prompts
321 all prompts
322 -q --quiet suppress output
322 -q --quiet suppress output
323 -v --verbose enable additional output
323 -v --verbose enable additional output
324 --config CONFIG [+] set/override config option (use 'section.name=value')
324 --config CONFIG [+] set/override config option (use 'section.name=value')
325 --debug enable debugging output
325 --debug enable debugging output
326 --debugger start debugger
326 --debugger start debugger
327 --encoding ENCODE set the charset encoding (default: ascii)
327 --encoding ENCODE set the charset encoding (default: ascii)
328 --encodingmode MODE set the charset encoding mode (default: strict)
328 --encodingmode MODE set the charset encoding mode (default: strict)
329 --traceback always print a traceback on exception
329 --traceback always print a traceback on exception
330 --time time how long the command takes
330 --time time how long the command takes
331 --profile print command execution profile
331 --profile print command execution profile
332 --version output version information and exit
332 --version output version information and exit
333 -h --help display help and exit
333 -h --help display help and exit
334 --hidden consider hidden changesets
334 --hidden consider hidden changesets
335
335
336 (use "hg help" for the full list of commands)
336 (use "hg help" for the full list of commands)
337
337
338 $ hg add -h
338 $ hg add -h
339 hg add [OPTION]... [FILE]...
339 hg add [OPTION]... [FILE]...
340
340
341 add the specified files on the next commit
341 add the specified files on the next commit
342
342
343 Schedule files to be version controlled and added to the repository.
343 Schedule files to be version controlled and added to the repository.
344
344
345 The files will be added to the repository at the next commit. To undo an
345 The files will be added to the repository at the next commit. To undo an
346 add before that, see 'hg forget'.
346 add before that, see 'hg forget'.
347
347
348 If no names are given, add all files to the repository (except files
348 If no names are given, add all files to the repository (except files
349 matching ".hgignore").
349 matching ".hgignore").
350
350
351 Returns 0 if all files are successfully added.
351 Returns 0 if all files are successfully added.
352
352
353 options ([+] can be repeated):
353 options ([+] can be repeated):
354
354
355 -I --include PATTERN [+] include names matching the given patterns
355 -I --include PATTERN [+] include names matching the given patterns
356 -X --exclude PATTERN [+] exclude names matching the given patterns
356 -X --exclude PATTERN [+] exclude names matching the given patterns
357 -S --subrepos recurse into subrepositories
357 -S --subrepos recurse into subrepositories
358 -n --dry-run do not perform actions, just print output
358 -n --dry-run do not perform actions, just print output
359
359
360 (some details hidden, use --verbose to show complete help)
360 (some details hidden, use --verbose to show complete help)
361
361
362 Verbose help for add
362 Verbose help for add
363
363
364 $ hg add -hv
364 $ hg add -hv
365 hg add [OPTION]... [FILE]...
365 hg add [OPTION]... [FILE]...
366
366
367 add the specified files on the next commit
367 add the specified files on the next commit
368
368
369 Schedule files to be version controlled and added to the repository.
369 Schedule files to be version controlled and added to the repository.
370
370
371 The files will be added to the repository at the next commit. To undo an
371 The files will be added to the repository at the next commit. To undo an
372 add before that, see 'hg forget'.
372 add before that, see 'hg forget'.
373
373
374 If no names are given, add all files to the repository (except files
374 If no names are given, add all files to the repository (except files
375 matching ".hgignore").
375 matching ".hgignore").
376
376
377 Examples:
377 Examples:
378
378
379 - New (unknown) files are added automatically by 'hg add':
379 - New (unknown) files are added automatically by 'hg add':
380
380
381 $ ls
381 $ ls
382 foo.c
382 foo.c
383 $ hg status
383 $ hg status
384 ? foo.c
384 ? foo.c
385 $ hg add
385 $ hg add
386 adding foo.c
386 adding foo.c
387 $ hg status
387 $ hg status
388 A foo.c
388 A foo.c
389
389
390 - Specific files to be added can be specified:
390 - Specific files to be added can be specified:
391
391
392 $ ls
392 $ ls
393 bar.c foo.c
393 bar.c foo.c
394 $ hg status
394 $ hg status
395 ? bar.c
395 ? bar.c
396 ? foo.c
396 ? foo.c
397 $ hg add bar.c
397 $ hg add bar.c
398 $ hg status
398 $ hg status
399 A bar.c
399 A bar.c
400 ? foo.c
400 ? foo.c
401
401
402 Returns 0 if all files are successfully added.
402 Returns 0 if all files are successfully added.
403
403
404 options ([+] can be repeated):
404 options ([+] can be repeated):
405
405
406 -I --include PATTERN [+] include names matching the given patterns
406 -I --include PATTERN [+] include names matching the given patterns
407 -X --exclude PATTERN [+] exclude names matching the given patterns
407 -X --exclude PATTERN [+] exclude names matching the given patterns
408 -S --subrepos recurse into subrepositories
408 -S --subrepos recurse into subrepositories
409 -n --dry-run do not perform actions, just print output
409 -n --dry-run do not perform actions, just print output
410
410
411 global options ([+] can be repeated):
411 global options ([+] can be repeated):
412
412
413 -R --repository REPO repository root directory or name of overlay bundle
413 -R --repository REPO repository root directory or name of overlay bundle
414 file
414 file
415 --cwd DIR change working directory
415 --cwd DIR change working directory
416 -y --noninteractive do not prompt, automatically pick the first choice for
416 -y --noninteractive do not prompt, automatically pick the first choice for
417 all prompts
417 all prompts
418 -q --quiet suppress output
418 -q --quiet suppress output
419 -v --verbose enable additional output
419 -v --verbose enable additional output
420 --config CONFIG [+] set/override config option (use 'section.name=value')
420 --config CONFIG [+] set/override config option (use 'section.name=value')
421 --debug enable debugging output
421 --debug enable debugging output
422 --debugger start debugger
422 --debugger start debugger
423 --encoding ENCODE set the charset encoding (default: ascii)
423 --encoding ENCODE set the charset encoding (default: ascii)
424 --encodingmode MODE set the charset encoding mode (default: strict)
424 --encodingmode MODE set the charset encoding mode (default: strict)
425 --traceback always print a traceback on exception
425 --traceback always print a traceback on exception
426 --time time how long the command takes
426 --time time how long the command takes
427 --profile print command execution profile
427 --profile print command execution profile
428 --version output version information and exit
428 --version output version information and exit
429 -h --help display help and exit
429 -h --help display help and exit
430 --hidden consider hidden changesets
430 --hidden consider hidden changesets
431
431
432 Test help option with version option
432 Test help option with version option
433
433
434 $ hg add -h --version
434 $ hg add -h --version
435 Mercurial Distributed SCM (version *) (glob)
435 Mercurial Distributed SCM (version *) (glob)
436 (see https://mercurial-scm.org for more information)
436 (see https://mercurial-scm.org for more information)
437
437
438 Copyright (C) 2005-2016 Matt Mackall and others
438 Copyright (C) 2005-2016 Matt Mackall and others
439 This is free software; see the source for copying conditions. There is NO
439 This is free software; see the source for copying conditions. There is NO
440 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
440 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
441
441
442 $ hg add --skjdfks
442 $ hg add --skjdfks
443 hg add: option --skjdfks not recognized
443 hg add: option --skjdfks not recognized
444 hg add [OPTION]... [FILE]...
444 hg add [OPTION]... [FILE]...
445
445
446 add the specified files on the next commit
446 add the specified files on the next commit
447
447
448 options ([+] can be repeated):
448 options ([+] can be repeated):
449
449
450 -I --include PATTERN [+] include names matching the given patterns
450 -I --include PATTERN [+] include names matching the given patterns
451 -X --exclude PATTERN [+] exclude names matching the given patterns
451 -X --exclude PATTERN [+] exclude names matching the given patterns
452 -S --subrepos recurse into subrepositories
452 -S --subrepos recurse into subrepositories
453 -n --dry-run do not perform actions, just print output
453 -n --dry-run do not perform actions, just print output
454
454
455 (use "hg add -h" to show more help)
455 (use "hg add -h" to show more help)
456 [255]
456 [255]
457
457
458 Test ambiguous command help
458 Test ambiguous command help
459
459
460 $ hg help ad
460 $ hg help ad
461 list of commands:
461 list of commands:
462
462
463 add add the specified files on the next commit
463 add add the specified files on the next commit
464 addremove add all new files, delete all missing files
464 addremove add all new files, delete all missing files
465
465
466 (use "hg help -v ad" to show built-in aliases and global options)
466 (use "hg help -v ad" to show built-in aliases and global options)
467
467
468 Test command without options
468 Test command without options
469
469
470 $ hg help verify
470 $ hg help verify
471 hg verify
471 hg verify
472
472
473 verify the integrity of the repository
473 verify the integrity of the repository
474
474
475 Verify the integrity of the current repository.
475 Verify the integrity of the current repository.
476
476
477 This will perform an extensive check of the repository's integrity,
477 This will perform an extensive check of the repository's integrity,
478 validating the hashes and checksums of each entry in the changelog,
478 validating the hashes and checksums of each entry in the changelog,
479 manifest, and tracked files, as well as the integrity of their crosslinks
479 manifest, and tracked files, as well as the integrity of their crosslinks
480 and indices.
480 and indices.
481
481
482 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
482 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
483 information about recovery from corruption of the repository.
483 information about recovery from corruption of the repository.
484
484
485 Returns 0 on success, 1 if errors are encountered.
485 Returns 0 on success, 1 if errors are encountered.
486
486
487 (some details hidden, use --verbose to show complete help)
487 (some details hidden, use --verbose to show complete help)
488
488
489 $ hg help diff
489 $ hg help diff
490 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
490 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
491
491
492 diff repository (or selected files)
492 diff repository (or selected files)
493
493
494 Show differences between revisions for the specified files.
494 Show differences between revisions for the specified files.
495
495
496 Differences between files are shown using the unified diff format.
496 Differences between files are shown using the unified diff format.
497
497
498 Note:
498 Note:
499 'hg diff' may generate unexpected results for merges, as it will
499 'hg diff' may generate unexpected results for merges, as it will
500 default to comparing against the working directory's first parent
500 default to comparing against the working directory's first parent
501 changeset if no revisions are specified.
501 changeset if no revisions are specified.
502
502
503 When two revision arguments are given, then changes are shown between
503 When two revision arguments are given, then changes are shown between
504 those revisions. If only one revision is specified then that revision is
504 those revisions. If only one revision is specified then that revision is
505 compared to the working directory, and, when no revisions are specified,
505 compared to the working directory, and, when no revisions are specified,
506 the working directory files are compared to its first parent.
506 the working directory files are compared to its first parent.
507
507
508 Alternatively you can specify -c/--change with a revision to see the
508 Alternatively you can specify -c/--change with a revision to see the
509 changes in that changeset relative to its first parent.
509 changes in that changeset relative to its first parent.
510
510
511 Without the -a/--text option, diff will avoid generating diffs of files it
511 Without the -a/--text option, diff will avoid generating diffs of files it
512 detects as binary. With -a, diff will generate a diff anyway, probably
512 detects as binary. With -a, diff will generate a diff anyway, probably
513 with undesirable results.
513 with undesirable results.
514
514
515 Use the -g/--git option to generate diffs in the git extended diff format.
515 Use the -g/--git option to generate diffs in the git extended diff format.
516 For more information, read 'hg help diffs'.
516 For more information, read 'hg help diffs'.
517
517
518 Returns 0 on success.
518 Returns 0 on success.
519
519
520 options ([+] can be repeated):
520 options ([+] can be repeated):
521
521
522 -r --rev REV [+] revision
522 -r --rev REV [+] revision
523 -c --change REV change made by revision
523 -c --change REV change made by revision
524 -a --text treat all files as text
524 -a --text treat all files as text
525 -g --git use git extended diff format
525 -g --git use git extended diff format
526 --nodates omit dates from diff headers
526 --nodates omit dates from diff headers
527 --noprefix omit a/ and b/ prefixes from filenames
527 --noprefix omit a/ and b/ prefixes from filenames
528 -p --show-function show which function each change is in
528 -p --show-function show which function each change is in
529 --reverse produce a diff that undoes the changes
529 --reverse produce a diff that undoes the changes
530 -w --ignore-all-space ignore white space when comparing lines
530 -w --ignore-all-space ignore white space when comparing lines
531 -b --ignore-space-change ignore changes in the amount of white space
531 -b --ignore-space-change ignore changes in the amount of white space
532 -B --ignore-blank-lines ignore changes whose lines are all blank
532 -B --ignore-blank-lines ignore changes whose lines are all blank
533 -U --unified NUM number of lines of context to show
533 -U --unified NUM number of lines of context to show
534 --stat output diffstat-style summary of changes
534 --stat output diffstat-style summary of changes
535 --root DIR produce diffs relative to subdirectory
535 --root DIR produce diffs relative to subdirectory
536 -I --include PATTERN [+] include names matching the given patterns
536 -I --include PATTERN [+] include names matching the given patterns
537 -X --exclude PATTERN [+] exclude names matching the given patterns
537 -X --exclude PATTERN [+] exclude names matching the given patterns
538 -S --subrepos recurse into subrepositories
538 -S --subrepos recurse into subrepositories
539
539
540 (some details hidden, use --verbose to show complete help)
540 (some details hidden, use --verbose to show complete help)
541
541
542 $ hg help status
542 $ hg help status
543 hg status [OPTION]... [FILE]...
543 hg status [OPTION]... [FILE]...
544
544
545 aliases: st
545 aliases: st
546
546
547 show changed files in the working directory
547 show changed files in the working directory
548
548
549 Show status of files in the repository. If names are given, only files
549 Show status of files in the repository. If names are given, only files
550 that match are shown. Files that are clean or ignored or the source of a
550 that match are shown. Files that are clean or ignored or the source of a
551 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
551 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
552 -C/--copies or -A/--all are given. Unless options described with "show
552 -C/--copies or -A/--all are given. Unless options described with "show
553 only ..." are given, the options -mardu are used.
553 only ..." are given, the options -mardu are used.
554
554
555 Option -q/--quiet hides untracked (unknown and ignored) files unless
555 Option -q/--quiet hides untracked (unknown and ignored) files unless
556 explicitly requested with -u/--unknown or -i/--ignored.
556 explicitly requested with -u/--unknown or -i/--ignored.
557
557
558 Note:
558 Note:
559 'hg status' may appear to disagree with diff if permissions have
559 'hg status' may appear to disagree with diff if permissions have
560 changed or a merge has occurred. The standard diff format does not
560 changed or a merge has occurred. The standard diff format does not
561 report permission changes and diff only reports changes relative to one
561 report permission changes and diff only reports changes relative to one
562 merge parent.
562 merge parent.
563
563
564 If one revision is given, it is used as the base revision. If two
564 If one revision is given, it is used as the base revision. If two
565 revisions are given, the differences between them are shown. The --change
565 revisions are given, the differences between them are shown. The --change
566 option can also be used as a shortcut to list the changed files of a
566 option can also be used as a shortcut to list the changed files of a
567 revision from its first parent.
567 revision from its first parent.
568
568
569 The codes used to show the status of files are:
569 The codes used to show the status of files are:
570
570
571 M = modified
571 M = modified
572 A = added
572 A = added
573 R = removed
573 R = removed
574 C = clean
574 C = clean
575 ! = missing (deleted by non-hg command, but still tracked)
575 ! = missing (deleted by non-hg command, but still tracked)
576 ? = not tracked
576 ? = not tracked
577 I = ignored
577 I = ignored
578 = origin of the previous file (with --copies)
578 = origin of the previous file (with --copies)
579
579
580 Returns 0 on success.
580 Returns 0 on success.
581
581
582 options ([+] can be repeated):
582 options ([+] can be repeated):
583
583
584 -A --all show status of all files
584 -A --all show status of all files
585 -m --modified show only modified files
585 -m --modified show only modified files
586 -a --added show only added files
586 -a --added show only added files
587 -r --removed show only removed files
587 -r --removed show only removed files
588 -d --deleted show only deleted (but tracked) files
588 -d --deleted show only deleted (but tracked) files
589 -c --clean show only files without changes
589 -c --clean show only files without changes
590 -u --unknown show only unknown (not tracked) files
590 -u --unknown show only unknown (not tracked) files
591 -i --ignored show only ignored files
591 -i --ignored show only ignored files
592 -n --no-status hide status prefix
592 -n --no-status hide status prefix
593 -C --copies show source of copied files
593 -C --copies show source of copied files
594 -0 --print0 end filenames with NUL, for use with xargs
594 -0 --print0 end filenames with NUL, for use with xargs
595 --rev REV [+] show difference from revision
595 --rev REV [+] show difference from revision
596 --change REV list the changed files of a revision
596 --change REV list the changed files of a revision
597 -I --include PATTERN [+] include names matching the given patterns
597 -I --include PATTERN [+] include names matching the given patterns
598 -X --exclude PATTERN [+] exclude names matching the given patterns
598 -X --exclude PATTERN [+] exclude names matching the given patterns
599 -S --subrepos recurse into subrepositories
599 -S --subrepos recurse into subrepositories
600
600
601 (some details hidden, use --verbose to show complete help)
601 (some details hidden, use --verbose to show complete help)
602
602
603 $ hg -q help status
603 $ hg -q help status
604 hg status [OPTION]... [FILE]...
604 hg status [OPTION]... [FILE]...
605
605
606 show changed files in the working directory
606 show changed files in the working directory
607
607
608 $ hg help foo
608 $ hg help foo
609 abort: no such help topic: foo
609 abort: no such help topic: foo
610 (try "hg help --keyword foo")
610 (try "hg help --keyword foo")
611 [255]
611 [255]
612
612
613 $ hg skjdfks
613 $ hg skjdfks
614 hg: unknown command 'skjdfks'
614 hg: unknown command 'skjdfks'
615 Mercurial Distributed SCM
615 Mercurial Distributed SCM
616
616
617 basic commands:
617 basic commands:
618
618
619 add add the specified files on the next commit
619 add add the specified files on the next commit
620 annotate show changeset information by line for each file
620 annotate show changeset information by line for each file
621 clone make a copy of an existing repository
621 clone make a copy of an existing repository
622 commit commit the specified files or all outstanding changes
622 commit commit the specified files or all outstanding changes
623 diff diff repository (or selected files)
623 diff diff repository (or selected files)
624 export dump the header and diffs for one or more changesets
624 export dump the header and diffs for one or more changesets
625 forget forget the specified files on the next commit
625 forget forget the specified files on the next commit
626 init create a new repository in the given directory
626 init create a new repository in the given directory
627 log show revision history of entire repository or files
627 log show revision history of entire repository or files
628 merge merge another revision into working directory
628 merge merge another revision into working directory
629 pull pull changes from the specified source
629 pull pull changes from the specified source
630 push push changes to the specified destination
630 push push changes to the specified destination
631 remove remove the specified files on the next commit
631 remove remove the specified files on the next commit
632 serve start stand-alone webserver
632 serve start stand-alone webserver
633 status show changed files in the working directory
633 status show changed files in the working directory
634 summary summarize working directory state
634 summary summarize working directory state
635 update update working directory (or switch revisions)
635 update update working directory (or switch revisions)
636
636
637 (use "hg help" for the full list of commands or "hg -v" for details)
637 (use "hg help" for the full list of commands or "hg -v" for details)
638 [255]
638 [255]
639
639
640
640
641 Make sure that we don't run afoul of the help system thinking that
641 Make sure that we don't run afoul of the help system thinking that
642 this is a section and erroring out weirdly.
642 this is a section and erroring out weirdly.
643
643
644 $ hg .log
644 $ hg .log
645 hg: unknown command '.log'
645 hg: unknown command '.log'
646 (did you mean log?)
646 (did you mean log?)
647 [255]
647 [255]
648
648
649 $ hg log.
649 $ hg log.
650 hg: unknown command 'log.'
650 hg: unknown command 'log.'
651 (did you mean log?)
651 (did you mean log?)
652 [255]
652 [255]
653 $ hg pu.lh
653 $ hg pu.lh
654 hg: unknown command 'pu.lh'
654 hg: unknown command 'pu.lh'
655 (did you mean one of pull, push?)
655 (did you mean one of pull, push?)
656 [255]
656 [255]
657
657
658 $ cat > helpext.py <<EOF
658 $ cat > helpext.py <<EOF
659 > import os
659 > import os
660 > from mercurial import cmdutil, commands
660 > from mercurial import cmdutil, commands
661 >
661 >
662 > cmdtable = {}
662 > cmdtable = {}
663 > command = cmdutil.command(cmdtable)
663 > command = cmdutil.command(cmdtable)
664 >
664 >
665 > @command('nohelp',
665 > @command('nohelp',
666 > [('', 'longdesc', 3, 'x'*90),
666 > [('', 'longdesc', 3, 'x'*90),
667 > ('n', '', None, 'normal desc'),
667 > ('n', '', None, 'normal desc'),
668 > ('', 'newline', '', 'line1\nline2')],
668 > ('', 'newline', '', 'line1\nline2')],
669 > 'hg nohelp',
669 > 'hg nohelp',
670 > norepo=True)
670 > norepo=True)
671 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
671 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
672 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
672 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
673 > def nohelp(ui, *args, **kwargs):
673 > def nohelp(ui, *args, **kwargs):
674 > pass
674 > pass
675 >
675 >
676 > def uisetup(ui):
676 > def uisetup(ui):
677 > ui.setconfig('alias', 'shellalias', '!echo hi', 'helpext')
677 > ui.setconfig('alias', 'shellalias', '!echo hi', 'helpext')
678 > ui.setconfig('alias', 'hgalias', 'summary', 'helpext')
678 > ui.setconfig('alias', 'hgalias', 'summary', 'helpext')
679 >
679 >
680 > EOF
680 > EOF
681 $ echo '[extensions]' >> $HGRCPATH
681 $ echo '[extensions]' >> $HGRCPATH
682 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
682 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
683
683
684 Test for aliases
684 Test for aliases
685
685
686 $ hg help hgalias
686 $ hg help hgalias
687 hg hgalias [--remote]
687 hg hgalias [--remote]
688
688
689 alias for: hg summary
689 alias for: hg summary
690
690
691 summarize working directory state
691 summarize working directory state
692
692
693 This generates a brief summary of the working directory state, including
693 This generates a brief summary of the working directory state, including
694 parents, branch, commit status, phase and available updates.
694 parents, branch, commit status, phase and available updates.
695
695
696 With the --remote option, this will check the default paths for incoming
696 With the --remote option, this will check the default paths for incoming
697 and outgoing changes. This can be time-consuming.
697 and outgoing changes. This can be time-consuming.
698
698
699 Returns 0 on success.
699 Returns 0 on success.
700
700
701 defined by: helpext
701 defined by: helpext
702
702
703 options:
703 options:
704
704
705 --remote check for push and pull
705 --remote check for push and pull
706
706
707 (some details hidden, use --verbose to show complete help)
707 (some details hidden, use --verbose to show complete help)
708
708
709 $ hg help shellalias
709 $ hg help shellalias
710 hg shellalias
710 hg shellalias
711
711
712 shell alias for:
712 shell alias for:
713
713
714 echo hi
714 echo hi
715
715
716 defined by: helpext
716 defined by: helpext
717
717
718 (some details hidden, use --verbose to show complete help)
718 (some details hidden, use --verbose to show complete help)
719
719
720 Test command with no help text
720 Test command with no help text
721
721
722 $ hg help nohelp
722 $ hg help nohelp
723 hg nohelp
723 hg nohelp
724
724
725 (no help text available)
725 (no help text available)
726
726
727 options:
727 options:
728
728
729 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
729 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
730 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
730 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
731 -n -- normal desc
731 -n -- normal desc
732 --newline VALUE line1 line2
732 --newline VALUE line1 line2
733
733
734 (some details hidden, use --verbose to show complete help)
734 (some details hidden, use --verbose to show complete help)
735
735
736 $ hg help -k nohelp
736 $ hg help -k nohelp
737 Commands:
737 Commands:
738
738
739 nohelp hg nohelp
739 nohelp hg nohelp
740
740
741 Extension Commands:
741 Extension Commands:
742
742
743 nohelp (no help text available)
743 nohelp (no help text available)
744
744
745 Test that default list of commands omits extension commands
745 Test that default list of commands omits extension commands
746
746
747 $ hg help
747 $ hg help
748 Mercurial Distributed SCM
748 Mercurial Distributed SCM
749
749
750 list of commands:
750 list of commands:
751
751
752 add add the specified files on the next commit
752 add add the specified files on the next commit
753 addremove add all new files, delete all missing files
753 addremove add all new files, delete all missing files
754 annotate show changeset information by line for each file
754 annotate show changeset information by line for each file
755 archive create an unversioned archive of a repository revision
755 archive create an unversioned archive of a repository revision
756 backout reverse effect of earlier changeset
756 backout reverse effect of earlier changeset
757 bisect subdivision search of changesets
757 bisect subdivision search of changesets
758 bookmarks create a new bookmark or list existing bookmarks
758 bookmarks create a new bookmark or list existing bookmarks
759 branch set or show the current branch name
759 branch set or show the current branch name
760 branches list repository named branches
760 branches list repository named branches
761 bundle create a changegroup file
761 bundle create a changegroup file
762 cat output the current or given revision of files
762 cat output the current or given revision of files
763 clone make a copy of an existing repository
763 clone make a copy of an existing repository
764 commit commit the specified files or all outstanding changes
764 commit commit the specified files or all outstanding changes
765 config show combined config settings from all hgrc files
765 config show combined config settings from all hgrc files
766 copy mark files as copied for the next commit
766 copy mark files as copied for the next commit
767 diff diff repository (or selected files)
767 diff diff repository (or selected files)
768 export dump the header and diffs for one or more changesets
768 export dump the header and diffs for one or more changesets
769 files list tracked files
769 files list tracked files
770 forget forget the specified files on the next commit
770 forget forget the specified files on the next commit
771 graft copy changes from other branches onto the current branch
771 graft copy changes from other branches onto the current branch
772 grep search for a pattern in specified files and revisions
772 grep search for a pattern in specified files and revisions
773 heads show branch heads
773 heads show branch heads
774 help show help for a given topic or a help overview
774 help show help for a given topic or a help overview
775 identify identify the working directory or specified revision
775 identify identify the working directory or specified revision
776 import import an ordered set of patches
776 import import an ordered set of patches
777 incoming show new changesets found in source
777 incoming show new changesets found in source
778 init create a new repository in the given directory
778 init create a new repository in the given directory
779 log show revision history of entire repository or files
779 log show revision history of entire repository or files
780 manifest output the current or given revision of the project manifest
780 manifest output the current or given revision of the project manifest
781 merge merge another revision into working directory
781 merge merge another revision into working directory
782 outgoing show changesets not found in the destination
782 outgoing show changesets not found in the destination
783 paths show aliases for remote repositories
783 paths show aliases for remote repositories
784 phase set or show the current phase name
784 phase set or show the current phase name
785 pull pull changes from the specified source
785 pull pull changes from the specified source
786 push push changes to the specified destination
786 push push changes to the specified destination
787 recover roll back an interrupted transaction
787 recover roll back an interrupted transaction
788 remove remove the specified files on the next commit
788 remove remove the specified files on the next commit
789 rename rename files; equivalent of copy + remove
789 rename rename files; equivalent of copy + remove
790 resolve redo merges or set/view the merge status of files
790 resolve redo merges or set/view the merge status of files
791 revert restore files to their checkout state
791 revert restore files to their checkout state
792 root print the root (top) of the current working directory
792 root print the root (top) of the current working directory
793 serve start stand-alone webserver
793 serve start stand-alone webserver
794 status show changed files in the working directory
794 status show changed files in the working directory
795 summary summarize working directory state
795 summary summarize working directory state
796 tag add one or more tags for the current or given revision
796 tag add one or more tags for the current or given revision
797 tags list repository tags
797 tags list repository tags
798 unbundle apply one or more changegroup files
798 unbundle apply one or more changegroup files
799 update update working directory (or switch revisions)
799 update update working directory (or switch revisions)
800 verify verify the integrity of the repository
800 verify verify the integrity of the repository
801 version output version and copyright information
801 version output version and copyright information
802
802
803 enabled extensions:
803 enabled extensions:
804
804
805 helpext (no help text available)
805 helpext (no help text available)
806
806
807 additional help topics:
807 additional help topics:
808
808
809 config Configuration Files
809 config Configuration Files
810 dates Date Formats
810 dates Date Formats
811 diffs Diff Formats
811 diffs Diff Formats
812 environment Environment Variables
812 environment Environment Variables
813 extensions Using Additional Features
813 extensions Using Additional Features
814 filesets Specifying File Sets
814 filesets Specifying File Sets
815 glossary Glossary
815 glossary Glossary
816 hgignore Syntax for Mercurial Ignore Files
816 hgignore Syntax for Mercurial Ignore Files
817 hgweb Configuring hgweb
817 hgweb Configuring hgweb
818 internals Technical implementation topics
818 internals Technical implementation topics
819 merge-tools Merge Tools
819 merge-tools Merge Tools
820 multirevs Specifying Multiple Revisions
820 multirevs Specifying Multiple Revisions
821 patterns File Name Patterns
821 patterns File Name Patterns
822 phases Working with Phases
822 phases Working with Phases
823 revisions Specifying Single Revisions
823 revisions Specifying Single Revisions
824 revsets Specifying Revision Sets
824 revsets Specifying Revision Sets
825 scripting Using Mercurial from scripts and automation
825 scripting Using Mercurial from scripts and automation
826 subrepos Subrepositories
826 subrepos Subrepositories
827 templating Template Usage
827 templating Template Usage
828 urls URL Paths
828 urls URL Paths
829
829
830 (use "hg help -v" to show built-in aliases and global options)
830 (use "hg help -v" to show built-in aliases and global options)
831
831
832
832
833 Test list of internal help commands
833 Test list of internal help commands
834
834
835 $ hg help debug
835 $ hg help debug
836 debug commands (internal and unsupported):
836 debug commands (internal and unsupported):
837
837
838 debugancestor
838 debugancestor
839 find the ancestor revision of two revisions in a given index
839 find the ancestor revision of two revisions in a given index
840 debugapplystreamclonebundle
840 debugapplystreamclonebundle
841 apply a stream clone bundle file
841 apply a stream clone bundle file
842 debugbuilddag
842 debugbuilddag
843 builds a repo with a given DAG from scratch in the current
843 builds a repo with a given DAG from scratch in the current
844 empty repo
844 empty repo
845 debugbundle lists the contents of a bundle
845 debugbundle lists the contents of a bundle
846 debugcheckstate
846 debugcheckstate
847 validate the correctness of the current dirstate
847 validate the correctness of the current dirstate
848 debugcommands
848 debugcommands
849 list all available commands and options
849 list all available commands and options
850 debugcomplete
850 debugcomplete
851 returns the completion list associated with the given command
851 returns the completion list associated with the given command
852 debugcreatestreamclonebundle
852 debugcreatestreamclonebundle
853 create a stream clone bundle file
853 create a stream clone bundle file
854 debugdag format the changelog or an index DAG as a concise textual
854 debugdag format the changelog or an index DAG as a concise textual
855 description
855 description
856 debugdata dump the contents of a data file revision
856 debugdata dump the contents of a data file revision
857 debugdate parse and display a date
857 debugdate parse and display a date
858 debugdeltachain
858 debugdeltachain
859 dump information about delta chains in a revlog
859 dump information about delta chains in a revlog
860 debugdirstate
860 debugdirstate
861 show the contents of the current dirstate
861 show the contents of the current dirstate
862 debugdiscovery
862 debugdiscovery
863 runs the changeset discovery protocol in isolation
863 runs the changeset discovery protocol in isolation
864 debugextensions
864 debugextensions
865 show information about active extensions
865 show information about active extensions
866 debugfileset parse and apply a fileset specification
866 debugfileset parse and apply a fileset specification
867 debugfsinfo show information detected about current filesystem
867 debugfsinfo show information detected about current filesystem
868 debuggetbundle
868 debuggetbundle
869 retrieves a bundle from a repo
869 retrieves a bundle from a repo
870 debugignore display the combined ignore pattern and information about
870 debugignore display the combined ignore pattern and information about
871 ignored files
871 ignored files
872 debugindex dump the contents of an index file
872 debugindex dump the contents of an index file
873 debugindexdot
873 debugindexdot
874 dump an index DAG as a graphviz dot file
874 dump an index DAG as a graphviz dot file
875 debuginstall test Mercurial installation
875 debuginstall test Mercurial installation
876 debugknown test whether node ids are known to a repo
876 debugknown test whether node ids are known to a repo
877 debuglocks show or modify state of locks
877 debuglocks show or modify state of locks
878 debugmergestate
878 debugmergestate
879 print merge state
879 print merge state
880 debugnamecomplete
880 debugnamecomplete
881 complete "names" - tags, open branch names, bookmark names
881 complete "names" - tags, open branch names, bookmark names
882 debugobsolete
882 debugobsolete
883 create arbitrary obsolete marker
883 create arbitrary obsolete marker
884 debugoptDEP (no help text available)
884 debugoptDEP (no help text available)
885 debugoptEXP (no help text available)
885 debugoptEXP (no help text available)
886 debugpathcomplete
886 debugpathcomplete
887 complete part or all of a tracked path
887 complete part or all of a tracked path
888 debugpushkey access the pushkey key/value protocol
888 debugpushkey access the pushkey key/value protocol
889 debugpvec (no help text available)
889 debugpvec (no help text available)
890 debugrebuilddirstate
890 debugrebuilddirstate
891 rebuild the dirstate as it would look like for the given
891 rebuild the dirstate as it would look like for the given
892 revision
892 revision
893 debugrebuildfncache
893 debugrebuildfncache
894 rebuild the fncache file
894 rebuild the fncache file
895 debugrename dump rename information
895 debugrename dump rename information
896 debugrevlog show data and statistics about a revlog
896 debugrevlog show data and statistics about a revlog
897 debugrevspec parse and apply a revision specification
897 debugrevspec parse and apply a revision specification
898 debugsetparents
898 debugsetparents
899 manually set the parents of the current working directory
899 manually set the parents of the current working directory
900 debugsub (no help text available)
900 debugsub (no help text available)
901 debugsuccessorssets
901 debugsuccessorssets
902 show set of successors for revision
902 show set of successors for revision
903 debugtemplate
903 debugtemplate
904 parse and apply a template
904 parse and apply a template
905 debugwalk show how files match on given patterns
905 debugwalk show how files match on given patterns
906 debugwireargs
906 debugwireargs
907 (no help text available)
907 (no help text available)
908
908
909 (use "hg help -v debug" to show built-in aliases and global options)
909 (use "hg help -v debug" to show built-in aliases and global options)
910
910
911 internals topic renders index of available sub-topics
911 internals topic renders index of available sub-topics
912
912
913 $ hg help internals
913 $ hg help internals
914 Technical implementation topics
914 Technical implementation topics
915 """""""""""""""""""""""""""""""
915 """""""""""""""""""""""""""""""
916
916
917 bundles container for exchange of repository data
917 bundles container for exchange of repository data
918 changegroups representation of revlog data
918 changegroups representation of revlog data
919 requirements repository requirements
919 requirements repository requirements
920 revlogs revision storage mechanism
920 revlogs revision storage mechanism
921
921
922 sub-topics can be accessed
922 sub-topics can be accessed
923
923
924 $ hg help internals.changegroups
924 $ hg help internals.changegroups
925 Changegroups
925 Changegroups
926 ============
926 ============
927
927
928 Changegroups are representations of repository revlog data, specifically
928 Changegroups are representations of repository revlog data, specifically
929 the changelog, manifest, and filelogs.
929 the changelog, manifest, and filelogs.
930
930
931 There are 3 versions of changegroups: "1", "2", and "3". From a high-
931 There are 3 versions of changegroups: "1", "2", and "3". From a high-
932 level, versions "1" and "2" are almost exactly the same, with the only
932 level, versions "1" and "2" are almost exactly the same, with the only
933 difference being a header on entries in the changeset segment. Version "3"
933 difference being a header on entries in the changeset segment. Version "3"
934 adds support for exchanging treemanifests and includes revlog flags in the
934 adds support for exchanging treemanifests and includes revlog flags in the
935 delta header.
935 delta header.
936
936
937 Changegroups consists of 3 logical segments:
937 Changegroups consists of 3 logical segments:
938
938
939 +---------------------------------+
939 +---------------------------------+
940 | | | |
940 | | | |
941 | changeset | manifest | filelogs |
941 | changeset | manifest | filelogs |
942 | | | |
942 | | | |
943 +---------------------------------+
943 +---------------------------------+
944
944
945 The principle building block of each segment is a *chunk*. A *chunk* is a
945 The principle building block of each segment is a *chunk*. A *chunk* is a
946 framed piece of data:
946 framed piece of data:
947
947
948 +---------------------------------------+
948 +---------------------------------------+
949 | | |
949 | | |
950 | length | data |
950 | length | data |
951 | (32 bits) | <length> bytes |
951 | (32 bits) | <length> bytes |
952 | | |
952 | | |
953 +---------------------------------------+
953 +---------------------------------------+
954
954
955 Each chunk starts with a 32-bit big-endian signed integer indicating the
955 Each chunk starts with a 32-bit big-endian signed integer indicating the
956 length of the raw data that follows.
956 length of the raw data that follows.
957
957
958 There is a special case chunk that has 0 length ("0x00000000"). We call
958 There is a special case chunk that has 0 length ("0x00000000"). We call
959 this an *empty chunk*.
959 this an *empty chunk*.
960
960
961 Delta Groups
961 Delta Groups
962 ------------
962 ------------
963
963
964 A *delta group* expresses the content of a revlog as a series of deltas,
964 A *delta group* expresses the content of a revlog as a series of deltas,
965 or patches against previous revisions.
965 or patches against previous revisions.
966
966
967 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
967 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
968 to signal the end of the delta group:
968 to signal the end of the delta group:
969
969
970 +------------------------------------------------------------------------+
970 +------------------------------------------------------------------------+
971 | | | | | |
971 | | | | | |
972 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
972 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
973 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
973 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
974 | | | | | |
974 | | | | | |
975 +------------------------------------------------------------+-----------+
975 +------------------------------------------------------------+-----------+
976
976
977 Each *chunk*'s data consists of the following:
977 Each *chunk*'s data consists of the following:
978
978
979 +-----------------------------------------+
979 +-----------------------------------------+
980 | | | |
980 | | | |
981 | delta header | mdiff header | delta |
981 | delta header | mdiff header | delta |
982 | (various) | (12 bytes) | (various) |
982 | (various) | (12 bytes) | (various) |
983 | | | |
983 | | | |
984 +-----------------------------------------+
984 +-----------------------------------------+
985
985
986 The *length* field is the byte length of the remaining 3 logical pieces of
986 The *length* field is the byte length of the remaining 3 logical pieces of
987 data. The *delta* is a diff from an existing entry in the changelog.
987 data. The *delta* is a diff from an existing entry in the changelog.
988
988
989 The *delta header* is different between versions "1", "2", and "3" of the
989 The *delta header* is different between versions "1", "2", and "3" of the
990 changegroup format.
990 changegroup format.
991
991
992 Version 1:
992 Version 1:
993
993
994 +------------------------------------------------------+
994 +------------------------------------------------------+
995 | | | | |
995 | | | | |
996 | node | p1 node | p2 node | link node |
996 | node | p1 node | p2 node | link node |
997 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
997 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
998 | | | | |
998 | | | | |
999 +------------------------------------------------------+
999 +------------------------------------------------------+
1000
1000
1001 Version 2:
1001 Version 2:
1002
1002
1003 +------------------------------------------------------------------+
1003 +------------------------------------------------------------------+
1004 | | | | | |
1004 | | | | | |
1005 | node | p1 node | p2 node | base node | link node |
1005 | node | p1 node | p2 node | base node | link node |
1006 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1006 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1007 | | | | | |
1007 | | | | | |
1008 +------------------------------------------------------------------+
1008 +------------------------------------------------------------------+
1009
1009
1010 Version 3:
1010 Version 3:
1011
1011
1012 +------------------------------------------------------------------------------+
1012 +------------------------------------------------------------------------------+
1013 | | | | | | |
1013 | | | | | | |
1014 | node | p1 node | p2 node | base node | link node | flags |
1014 | node | p1 node | p2 node | base node | link node | flags |
1015 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1015 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1016 | | | | | | |
1016 | | | | | | |
1017 +------------------------------------------------------------------------------+
1017 +------------------------------------------------------------------------------+
1018
1018
1019 The *mdiff header* consists of 3 32-bit big-endian signed integers
1019 The *mdiff header* consists of 3 32-bit big-endian signed integers
1020 describing offsets at which to apply the following delta content:
1020 describing offsets at which to apply the following delta content:
1021
1021
1022 +-------------------------------------+
1022 +-------------------------------------+
1023 | | | |
1023 | | | |
1024 | offset | old length | new length |
1024 | offset | old length | new length |
1025 | (32 bits) | (32 bits) | (32 bits) |
1025 | (32 bits) | (32 bits) | (32 bits) |
1026 | | | |
1026 | | | |
1027 +-------------------------------------+
1027 +-------------------------------------+
1028
1028
1029 In version 1, the delta is always applied against the previous node from
1029 In version 1, the delta is always applied against the previous node from
1030 the changegroup or the first parent if this is the first entry in the
1030 the changegroup or the first parent if this is the first entry in the
1031 changegroup.
1031 changegroup.
1032
1032
1033 In version 2, the delta base node is encoded in the entry in the
1033 In version 2, the delta base node is encoded in the entry in the
1034 changegroup. This allows the delta to be expressed against any parent,
1034 changegroup. This allows the delta to be expressed against any parent,
1035 which can result in smaller deltas and more efficient encoding of data.
1035 which can result in smaller deltas and more efficient encoding of data.
1036
1036
1037 Changeset Segment
1037 Changeset Segment
1038 -----------------
1038 -----------------
1039
1039
1040 The *changeset segment* consists of a single *delta group* holding
1040 The *changeset segment* consists of a single *delta group* holding
1041 changelog data. It is followed by an *empty chunk* to denote the boundary
1041 changelog data. It is followed by an *empty chunk* to denote the boundary
1042 to the *manifests segment*.
1042 to the *manifests segment*.
1043
1043
1044 Manifest Segment
1044 Manifest Segment
1045 ----------------
1045 ----------------
1046
1046
1047 The *manifest segment* consists of a single *delta group* holding manifest
1047 The *manifest segment* consists of a single *delta group* holding manifest
1048 data. It is followed by an *empty chunk* to denote the boundary to the
1048 data. It is followed by an *empty chunk* to denote the boundary to the
1049 *filelogs segment*.
1049 *filelogs segment*.
1050
1050
1051 Filelogs Segment
1051 Filelogs Segment
1052 ----------------
1052 ----------------
1053
1053
1054 The *filelogs* segment consists of multiple sub-segments, each
1054 The *filelogs* segment consists of multiple sub-segments, each
1055 corresponding to an individual file whose data is being described:
1055 corresponding to an individual file whose data is being described:
1056
1056
1057 +--------------------------------------+
1057 +--------------------------------------+
1058 | | | | |
1058 | | | | |
1059 | filelog0 | filelog1 | filelog2 | ... |
1059 | filelog0 | filelog1 | filelog2 | ... |
1060 | | | | |
1060 | | | | |
1061 +--------------------------------------+
1061 +--------------------------------------+
1062
1062
1063 In version "3" of the changegroup format, filelogs may include directory
1063 In version "3" of the changegroup format, filelogs may include directory
1064 logs when treemanifests are in use. directory logs are identified by
1064 logs when treemanifests are in use. directory logs are identified by
1065 having a trailing '/' on their filename (see below).
1065 having a trailing '/' on their filename (see below).
1066
1066
1067 The final filelog sub-segment is followed by an *empty chunk* to denote
1067 The final filelog sub-segment is followed by an *empty chunk* to denote
1068 the end of the segment and the overall changegroup.
1068 the end of the segment and the overall changegroup.
1069
1069
1070 Each filelog sub-segment consists of the following:
1070 Each filelog sub-segment consists of the following:
1071
1071
1072 +------------------------------------------+
1072 +------------------------------------------+
1073 | | | |
1073 | | | |
1074 | filename size | filename | delta group |
1074 | filename size | filename | delta group |
1075 | (32 bits) | (various) | (various) |
1075 | (32 bits) | (various) | (various) |
1076 | | | |
1076 | | | |
1077 +------------------------------------------+
1077 +------------------------------------------+
1078
1078
1079 That is, a *chunk* consisting of the filename (not terminated or padded)
1079 That is, a *chunk* consisting of the filename (not terminated or padded)
1080 followed by N chunks constituting the *delta group* for this file.
1080 followed by N chunks constituting the *delta group* for this file.
1081
1081
1082 Test list of commands with command with no help text
1082 Test list of commands with command with no help text
1083
1083
1084 $ hg help helpext
1084 $ hg help helpext
1085 helpext extension - no help text available
1085 helpext extension - no help text available
1086
1086
1087 list of commands:
1087 list of commands:
1088
1088
1089 nohelp (no help text available)
1089 nohelp (no help text available)
1090
1090
1091 (use "hg help -v helpext" to show built-in aliases and global options)
1091 (use "hg help -v helpext" to show built-in aliases and global options)
1092
1092
1093
1093
1094 test deprecated and experimental options are hidden in command help
1094 test deprecated and experimental options are hidden in command help
1095 $ hg help debugoptDEP
1095 $ hg help debugoptDEP
1096 hg debugoptDEP
1096 hg debugoptDEP
1097
1097
1098 (no help text available)
1098 (no help text available)
1099
1099
1100 options:
1100 options:
1101
1101
1102 (some details hidden, use --verbose to show complete help)
1102 (some details hidden, use --verbose to show complete help)
1103
1103
1104 $ hg help debugoptEXP
1104 $ hg help debugoptEXP
1105 hg debugoptEXP
1105 hg debugoptEXP
1106
1106
1107 (no help text available)
1107 (no help text available)
1108
1108
1109 options:
1109 options:
1110
1110
1111 (some details hidden, use --verbose to show complete help)
1111 (some details hidden, use --verbose to show complete help)
1112
1112
1113 test deprecated and experimental options is shown with -v
1113 test deprecated and experimental options is shown with -v
1114 $ hg help -v debugoptDEP | grep dopt
1114 $ hg help -v debugoptDEP | grep dopt
1115 --dopt option is (DEPRECATED)
1115 --dopt option is (DEPRECATED)
1116 $ hg help -v debugoptEXP | grep eopt
1116 $ hg help -v debugoptEXP | grep eopt
1117 --eopt option is (EXPERIMENTAL)
1117 --eopt option is (EXPERIMENTAL)
1118
1118
1119 #if gettext
1119 #if gettext
1120 test deprecated option is hidden with translation with untranslated description
1120 test deprecated option is hidden with translation with untranslated description
1121 (use many globy for not failing on changed transaction)
1121 (use many globy for not failing on changed transaction)
1122 $ LANGUAGE=sv hg help debugoptDEP
1122 $ LANGUAGE=sv hg help debugoptDEP
1123 hg debugoptDEP
1123 hg debugoptDEP
1124
1124
1125 (*) (glob)
1125 (*) (glob)
1126
1126
1127 options:
1127 options:
1128
1128
1129 (some details hidden, use --verbose to show complete help)
1129 (some details hidden, use --verbose to show complete help)
1130 #endif
1130 #endif
1131
1131
1132 Test commands that collide with topics (issue4240)
1132 Test commands that collide with topics (issue4240)
1133
1133
1134 $ hg config -hq
1134 $ hg config -hq
1135 hg config [-u] [NAME]...
1135 hg config [-u] [NAME]...
1136
1136
1137 show combined config settings from all hgrc files
1137 show combined config settings from all hgrc files
1138 $ hg showconfig -hq
1138 $ hg showconfig -hq
1139 hg config [-u] [NAME]...
1139 hg config [-u] [NAME]...
1140
1140
1141 show combined config settings from all hgrc files
1141 show combined config settings from all hgrc files
1142
1142
1143 Test a help topic
1143 Test a help topic
1144
1144
1145 $ hg help revs
1145 $ hg help revs
1146 Specifying Single Revisions
1146 Specifying Single Revisions
1147 """""""""""""""""""""""""""
1147 """""""""""""""""""""""""""
1148
1148
1149 Mercurial supports several ways to specify individual revisions.
1149 Mercurial supports several ways to specify individual revisions.
1150
1150
1151 A plain integer is treated as a revision number. Negative integers are
1151 A plain integer is treated as a revision number. Negative integers are
1152 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1152 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1153 denoting the revision prior to the tip, and so forth.
1153 denoting the revision prior to the tip, and so forth.
1154
1154
1155 A 40-digit hexadecimal string is treated as a unique revision identifier.
1155 A 40-digit hexadecimal string is treated as a unique revision identifier.
1156
1156
1157 A hexadecimal string less than 40 characters long is treated as a unique
1157 A hexadecimal string less than 40 characters long is treated as a unique
1158 revision identifier and is referred to as a short-form identifier. A
1158 revision identifier and is referred to as a short-form identifier. A
1159 short-form identifier is only valid if it is the prefix of exactly one
1159 short-form identifier is only valid if it is the prefix of exactly one
1160 full-length identifier.
1160 full-length identifier.
1161
1161
1162 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1162 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1163 is a movable pointer to a revision. A tag is a permanent name associated
1163 is a movable pointer to a revision. A tag is a permanent name associated
1164 with a revision. A branch name denotes the tipmost open branch head of
1164 with a revision. A branch name denotes the tipmost open branch head of
1165 that branch - or if they are all closed, the tipmost closed head of the
1165 that branch - or if they are all closed, the tipmost closed head of the
1166 branch. Bookmark, tag, and branch names must not contain the ":"
1166 branch. Bookmark, tag, and branch names must not contain the ":"
1167 character.
1167 character.
1168
1168
1169 The reserved name "tip" always identifies the most recent revision.
1169 The reserved name "tip" always identifies the most recent revision.
1170
1170
1171 The reserved name "null" indicates the null revision. This is the revision
1171 The reserved name "null" indicates the null revision. This is the revision
1172 of an empty repository, and the parent of revision 0.
1172 of an empty repository, and the parent of revision 0.
1173
1173
1174 The reserved name "." indicates the working directory parent. If no
1174 The reserved name "." indicates the working directory parent. If no
1175 working directory is checked out, it is equivalent to null. If an
1175 working directory is checked out, it is equivalent to null. If an
1176 uncommitted merge is in progress, "." is the revision of the first parent.
1176 uncommitted merge is in progress, "." is the revision of the first parent.
1177
1177
1178 Test repeated config section name
1178 Test repeated config section name
1179
1179
1180 $ hg help config.host
1180 $ hg help config.host
1181 "http_proxy.host"
1181 "http_proxy.host"
1182 Host name and (optional) port of the proxy server, for example
1182 Host name and (optional) port of the proxy server, for example
1183 "myproxy:8000".
1183 "myproxy:8000".
1184
1184
1185 "smtp.host"
1185 "smtp.host"
1186 Host name of mail server, e.g. "mail.example.com".
1186 Host name of mail server, e.g. "mail.example.com".
1187
1187
1188 Unrelated trailing paragraphs shouldn't be included
1188 Unrelated trailing paragraphs shouldn't be included
1189
1189
1190 $ hg help config.extramsg | grep '^$'
1190 $ hg help config.extramsg | grep '^$'
1191
1191
1192
1192
1193 Test capitalized section name
1193 Test capitalized section name
1194
1194
1195 $ hg help scripting.HGPLAIN > /dev/null
1195 $ hg help scripting.HGPLAIN > /dev/null
1196
1196
1197 Help subsection:
1197 Help subsection:
1198
1198
1199 $ hg help config.charsets |grep "Email example:" > /dev/null
1199 $ hg help config.charsets |grep "Email example:" > /dev/null
1200 [1]
1200 [1]
1201
1201
1202 Show nested definitions
1202 Show nested definitions
1203 ("profiling.type"[break]"ls"[break]"stat"[break])
1203 ("profiling.type"[break]"ls"[break]"stat"[break])
1204
1204
1205 $ hg help config.type | egrep '^$'|wc -l
1205 $ hg help config.type | egrep '^$'|wc -l
1206 \s*3 (re)
1206 \s*3 (re)
1207
1207
1208 Separate sections from subsections
1208 Separate sections from subsections
1209
1209
1210 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1210 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1211 "format"
1211 "format"
1212 --------
1212 --------
1213
1213
1214 "usegeneraldelta"
1214 "usegeneraldelta"
1215
1215
1216 "dotencode"
1216 "dotencode"
1217
1217
1218 "usefncache"
1218 "usefncache"
1219
1219
1220 "usestore"
1220 "usestore"
1221
1221
1222 "profiling"
1222 "profiling"
1223 -----------
1223 -----------
1224
1224
1225 "format"
1225 "format"
1226
1226
1227 "progress"
1227 "progress"
1228 ----------
1228 ----------
1229
1229
1230 "format"
1230 "format"
1231
1231
1232
1232
1233 Last item in help config.*:
1233 Last item in help config.*:
1234
1234
1235 $ hg help config.`hg help config|grep '^ "'| \
1235 $ hg help config.`hg help config|grep '^ "'| \
1236 > tail -1|sed 's![ "]*!!g'`| \
1236 > tail -1|sed 's![ "]*!!g'`| \
1237 > grep "hg help -c config" > /dev/null
1237 > grep "hg help -c config" > /dev/null
1238 [1]
1238 [1]
1239
1239
1240 note to use help -c for general hg help config:
1240 note to use help -c for general hg help config:
1241
1241
1242 $ hg help config |grep "hg help -c config" > /dev/null
1242 $ hg help config |grep "hg help -c config" > /dev/null
1243
1243
1244 Test templating help
1244 Test templating help
1245
1245
1246 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1246 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1247 desc String. The text of the changeset description.
1247 desc String. The text of the changeset description.
1248 diffstat String. Statistics of changes with the following format:
1248 diffstat String. Statistics of changes with the following format:
1249 firstline Any text. Returns the first line of text.
1249 firstline Any text. Returns the first line of text.
1250 nonempty Any text. Returns '(none)' if the string is empty.
1250 nonempty Any text. Returns '(none)' if the string is empty.
1251
1251
1252 Test deprecated items
1252 Test deprecated items
1253
1253
1254 $ hg help -v templating | grep currentbookmark
1254 $ hg help -v templating | grep currentbookmark
1255 currentbookmark
1255 currentbookmark
1256 $ hg help templating | (grep currentbookmark || true)
1256 $ hg help templating | (grep currentbookmark || true)
1257
1257
1258 Test help hooks
1258 Test help hooks
1259
1259
1260 $ cat > helphook1.py <<EOF
1260 $ cat > helphook1.py <<EOF
1261 > from mercurial import help
1261 > from mercurial import help
1262 >
1262 >
1263 > def rewrite(ui, topic, doc):
1263 > def rewrite(ui, topic, doc):
1264 > return doc + '\nhelphook1\n'
1264 > return doc + '\nhelphook1\n'
1265 >
1265 >
1266 > def extsetup(ui):
1266 > def extsetup(ui):
1267 > help.addtopichook('revsets', rewrite)
1267 > help.addtopichook('revsets', rewrite)
1268 > EOF
1268 > EOF
1269 $ cat > helphook2.py <<EOF
1269 $ cat > helphook2.py <<EOF
1270 > from mercurial import help
1270 > from mercurial import help
1271 >
1271 >
1272 > def rewrite(ui, topic, doc):
1272 > def rewrite(ui, topic, doc):
1273 > return doc + '\nhelphook2\n'
1273 > return doc + '\nhelphook2\n'
1274 >
1274 >
1275 > def extsetup(ui):
1275 > def extsetup(ui):
1276 > help.addtopichook('revsets', rewrite)
1276 > help.addtopichook('revsets', rewrite)
1277 > EOF
1277 > EOF
1278 $ echo '[extensions]' >> $HGRCPATH
1278 $ echo '[extensions]' >> $HGRCPATH
1279 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1279 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1280 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1280 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1281 $ hg help revsets | grep helphook
1281 $ hg help revsets | grep helphook
1282 helphook1
1282 helphook1
1283 helphook2
1283 helphook2
1284
1284
1285 help -c should only show debug --debug
1285 help -c should only show debug --debug
1286
1286
1287 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1287 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1288 [1]
1288 [1]
1289
1289
1290 help -c should only show deprecated for -v
1290 help -c should only show deprecated for -v
1291
1291
1292 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1292 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1293 [1]
1293 [1]
1294
1294
1295 Test -s / --system
1295 Test -s / --system
1296
1296
1297 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1297 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1298 > wc -l | sed -e 's/ //g'
1298 > wc -l | sed -e 's/ //g'
1299 0
1299 0
1300 $ hg help config.files --system unix | grep 'USER' | \
1300 $ hg help config.files --system unix | grep 'USER' | \
1301 > wc -l | sed -e 's/ //g'
1301 > wc -l | sed -e 's/ //g'
1302 0
1302 0
1303
1303
1304 Test -e / -c / -k combinations
1304 Test -e / -c / -k combinations
1305
1305
1306 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1306 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1307 Commands:
1307 Commands:
1308 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1308 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1309 Extensions:
1309 Extensions:
1310 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1310 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1311 Topics:
1311 Topics:
1312 Commands:
1312 Commands:
1313 Extensions:
1313 Extensions:
1314 Extension Commands:
1314 Extension Commands:
1315 $ hg help -c schemes
1315 $ hg help -c schemes
1316 abort: no such help topic: schemes
1316 abort: no such help topic: schemes
1317 (try "hg help --keyword schemes")
1317 (try "hg help --keyword schemes")
1318 [255]
1318 [255]
1319 $ hg help -e schemes |head -1
1319 $ hg help -e schemes |head -1
1320 schemes extension - extend schemes with shortcuts to repository swarms
1320 schemes extension - extend schemes with shortcuts to repository swarms
1321 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1321 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1322 Commands:
1322 Commands:
1323 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1323 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1324 Extensions:
1324 Extensions:
1325 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1325 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1326 Extensions:
1326 Extensions:
1327 Commands:
1327 Commands:
1328 $ hg help -c commit > /dev/null
1328 $ hg help -c commit > /dev/null
1329 $ hg help -e -c commit > /dev/null
1329 $ hg help -e -c commit > /dev/null
1330 $ hg help -e commit > /dev/null
1330 $ hg help -e commit > /dev/null
1331 abort: no such help topic: commit
1331 abort: no such help topic: commit
1332 (try "hg help --keyword commit")
1332 (try "hg help --keyword commit")
1333 [255]
1333 [255]
1334
1334
1335 Test keyword search help
1335 Test keyword search help
1336
1336
1337 $ cat > prefixedname.py <<EOF
1337 $ cat > prefixedname.py <<EOF
1338 > '''matched against word "clone"
1338 > '''matched against word "clone"
1339 > '''
1339 > '''
1340 > EOF
1340 > EOF
1341 $ echo '[extensions]' >> $HGRCPATH
1341 $ echo '[extensions]' >> $HGRCPATH
1342 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1342 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1343 $ hg help -k clone
1343 $ hg help -k clone
1344 Topics:
1344 Topics:
1345
1345
1346 config Configuration Files
1346 config Configuration Files
1347 extensions Using Additional Features
1347 extensions Using Additional Features
1348 glossary Glossary
1348 glossary Glossary
1349 phases Working with Phases
1349 phases Working with Phases
1350 subrepos Subrepositories
1350 subrepos Subrepositories
1351 urls URL Paths
1351 urls URL Paths
1352
1352
1353 Commands:
1353 Commands:
1354
1354
1355 bookmarks create a new bookmark or list existing bookmarks
1355 bookmarks create a new bookmark or list existing bookmarks
1356 clone make a copy of an existing repository
1356 clone make a copy of an existing repository
1357 paths show aliases for remote repositories
1357 paths show aliases for remote repositories
1358 update update working directory (or switch revisions)
1358 update update working directory (or switch revisions)
1359
1359
1360 Extensions:
1360 Extensions:
1361
1361
1362 clonebundles advertise pre-generated bundles to seed clones
1362 clonebundles advertise pre-generated bundles to seed clones
1363 prefixedname matched against word "clone"
1363 prefixedname matched against word "clone"
1364 relink recreates hardlinks between repository clones
1364 relink recreates hardlinks between repository clones
1365
1365
1366 Extension Commands:
1366 Extension Commands:
1367
1367
1368 qclone clone main and patch repository at same time
1368 qclone clone main and patch repository at same time
1369
1369
1370 Test unfound topic
1370 Test unfound topic
1371
1371
1372 $ hg help nonexistingtopicthatwillneverexisteverever
1372 $ hg help nonexistingtopicthatwillneverexisteverever
1373 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1373 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1374 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1374 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1375 [255]
1375 [255]
1376
1376
1377 Test unfound keyword
1377 Test unfound keyword
1378
1378
1379 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1379 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1380 abort: no matches
1380 abort: no matches
1381 (try "hg help" for a list of topics)
1381 (try "hg help" for a list of topics)
1382 [255]
1382 [255]
1383
1383
1384 Test omit indicating for help
1384 Test omit indicating for help
1385
1385
1386 $ cat > addverboseitems.py <<EOF
1386 $ cat > addverboseitems.py <<EOF
1387 > '''extension to test omit indicating.
1387 > '''extension to test omit indicating.
1388 >
1388 >
1389 > This paragraph is never omitted (for extension)
1389 > This paragraph is never omitted (for extension)
1390 >
1390 >
1391 > .. container:: verbose
1391 > .. container:: verbose
1392 >
1392 >
1393 > This paragraph is omitted,
1393 > This paragraph is omitted,
1394 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1394 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1395 >
1395 >
1396 > This paragraph is never omitted, too (for extension)
1396 > This paragraph is never omitted, too (for extension)
1397 > '''
1397 > '''
1398 >
1398 >
1399 > from mercurial import help, commands
1399 > from mercurial import help, commands
1400 > testtopic = """This paragraph is never omitted (for topic).
1400 > testtopic = """This paragraph is never omitted (for topic).
1401 >
1401 >
1402 > .. container:: verbose
1402 > .. container:: verbose
1403 >
1403 >
1404 > This paragraph is omitted,
1404 > This paragraph is omitted,
1405 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1405 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1406 >
1406 >
1407 > This paragraph is never omitted, too (for topic)
1407 > This paragraph is never omitted, too (for topic)
1408 > """
1408 > """
1409 > def extsetup(ui):
1409 > def extsetup(ui):
1410 > help.helptable.append((["topic-containing-verbose"],
1410 > help.helptable.append((["topic-containing-verbose"],
1411 > "This is the topic to test omit indicating.",
1411 > "This is the topic to test omit indicating.",
1412 > lambda ui: testtopic))
1412 > lambda ui: testtopic))
1413 > EOF
1413 > EOF
1414 $ echo '[extensions]' >> $HGRCPATH
1414 $ echo '[extensions]' >> $HGRCPATH
1415 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1415 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1416 $ hg help addverboseitems
1416 $ hg help addverboseitems
1417 addverboseitems extension - extension to test omit indicating.
1417 addverboseitems extension - extension to test omit indicating.
1418
1418
1419 This paragraph is never omitted (for extension)
1419 This paragraph is never omitted (for extension)
1420
1420
1421 This paragraph is never omitted, too (for extension)
1421 This paragraph is never omitted, too (for extension)
1422
1422
1423 (some details hidden, use --verbose to show complete help)
1423 (some details hidden, use --verbose to show complete help)
1424
1424
1425 no commands defined
1425 no commands defined
1426 $ hg help -v addverboseitems
1426 $ hg help -v addverboseitems
1427 addverboseitems extension - extension to test omit indicating.
1427 addverboseitems extension - extension to test omit indicating.
1428
1428
1429 This paragraph is never omitted (for extension)
1429 This paragraph is never omitted (for extension)
1430
1430
1431 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1431 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1432 extension)
1432 extension)
1433
1433
1434 This paragraph is never omitted, too (for extension)
1434 This paragraph is never omitted, too (for extension)
1435
1435
1436 no commands defined
1436 no commands defined
1437 $ hg help topic-containing-verbose
1437 $ hg help topic-containing-verbose
1438 This is the topic to test omit indicating.
1438 This is the topic to test omit indicating.
1439 """"""""""""""""""""""""""""""""""""""""""
1439 """"""""""""""""""""""""""""""""""""""""""
1440
1440
1441 This paragraph is never omitted (for topic).
1441 This paragraph is never omitted (for topic).
1442
1442
1443 This paragraph is never omitted, too (for topic)
1443 This paragraph is never omitted, too (for topic)
1444
1444
1445 (some details hidden, use --verbose to show complete help)
1445 (some details hidden, use --verbose to show complete help)
1446 $ hg help -v topic-containing-verbose
1446 $ hg help -v topic-containing-verbose
1447 This is the topic to test omit indicating.
1447 This is the topic to test omit indicating.
1448 """"""""""""""""""""""""""""""""""""""""""
1448 """"""""""""""""""""""""""""""""""""""""""
1449
1449
1450 This paragraph is never omitted (for topic).
1450 This paragraph is never omitted (for topic).
1451
1451
1452 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1452 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1453 topic)
1453 topic)
1454
1454
1455 This paragraph is never omitted, too (for topic)
1455 This paragraph is never omitted, too (for topic)
1456
1456
1457 Test section lookup
1457 Test section lookup
1458
1458
1459 $ hg help revset.merge
1459 $ hg help revset.merge
1460 "merge()"
1460 "merge()"
1461 Changeset is a merge changeset.
1461 Changeset is a merge changeset.
1462
1462
1463 $ hg help glossary.dag
1463 $ hg help glossary.dag
1464 DAG
1464 DAG
1465 The repository of changesets of a distributed version control system
1465 The repository of changesets of a distributed version control system
1466 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1466 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1467 of nodes and edges, where nodes correspond to changesets and edges
1467 of nodes and edges, where nodes correspond to changesets and edges
1468 imply a parent -> child relation. This graph can be visualized by
1468 imply a parent -> child relation. This graph can be visualized by
1469 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1469 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1470 limited by the requirement for children to have at most two parents.
1470 limited by the requirement for children to have at most two parents.
1471
1471
1472
1472
1473 $ hg help hgrc.paths
1473 $ hg help hgrc.paths
1474 "paths"
1474 "paths"
1475 -------
1475 -------
1476
1476
1477 Assigns symbolic names and behavior to repositories.
1477 Assigns symbolic names and behavior to repositories.
1478
1478
1479 Options are symbolic names defining the URL or directory that is the
1479 Options are symbolic names defining the URL or directory that is the
1480 location of the repository. Example:
1480 location of the repository. Example:
1481
1481
1482 [paths]
1482 [paths]
1483 my_server = https://example.com/my_repo
1483 my_server = https://example.com/my_repo
1484 local_path = /home/me/repo
1484 local_path = /home/me/repo
1485
1485
1486 These symbolic names can be used from the command line. To pull from
1486 These symbolic names can be used from the command line. To pull from
1487 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1487 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1488 local_path'.
1488 local_path'.
1489
1489
1490 Options containing colons (":") denote sub-options that can influence
1490 Options containing colons (":") denote sub-options that can influence
1491 behavior for that specific path. Example:
1491 behavior for that specific path. Example:
1492
1492
1493 [paths]
1493 [paths]
1494 my_server = https://example.com/my_path
1494 my_server = https://example.com/my_path
1495 my_server:pushurl = ssh://example.com/my_path
1495 my_server:pushurl = ssh://example.com/my_path
1496
1496
1497 The following sub-options can be defined:
1497 The following sub-options can be defined:
1498
1498
1499 "pushurl"
1499 "pushurl"
1500 The URL to use for push operations. If not defined, the location
1500 The URL to use for push operations. If not defined, the location
1501 defined by the path's main entry is used.
1501 defined by the path's main entry is used.
1502
1502
1503 The following special named paths exist:
1503 The following special named paths exist:
1504
1504
1505 "default"
1505 "default"
1506 The URL or directory to use when no source or remote is specified.
1506 The URL or directory to use when no source or remote is specified.
1507
1507
1508 'hg clone' will automatically define this path to the location the
1508 'hg clone' will automatically define this path to the location the
1509 repository was cloned from.
1509 repository was cloned from.
1510
1510
1511 "default-push"
1511 "default-push"
1512 (deprecated) The URL or directory for the default 'hg push' location.
1512 (deprecated) The URL or directory for the default 'hg push' location.
1513 "default:pushurl" should be used instead.
1513 "default:pushurl" should be used instead.
1514
1514
1515 $ hg help glossary.mcguffin
1515 $ hg help glossary.mcguffin
1516 abort: help section not found
1516 abort: help section not found
1517 [255]
1517 [255]
1518
1518
1519 $ hg help glossary.mc.guffin
1519 $ hg help glossary.mc.guffin
1520 abort: help section not found
1520 abort: help section not found
1521 [255]
1521 [255]
1522
1522
1523 $ hg help template.files
1523 $ hg help template.files
1524 files List of strings. All files modified, added, or removed by
1524 files List of strings. All files modified, added, or removed by
1525 this changeset.
1525 this changeset.
1526
1526
1527 Test section lookup by translated message
1528
1529 str.lower() instead of encoding.lower(str) on translated message might
1530 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1531 as the second or later byte of multi-byte character.
1532
1533 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1534 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1535 replacement makes message meaningless.
1536
1537 This tests that section lookup by translated string isn't broken by
1538 such str.lower().
1539
1540 $ python <<EOF
1541 > def escape(s):
1542 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1543 > # translation of "record" in ja_JP.cp932
1544 > upper = "\x8bL\x98^"
1545 > # str.lower()-ed section name should be treated as different one
1546 > lower = "\x8bl\x98^"
1547 > with open('ambiguous.py', 'w') as fp:
1548 > fp.write("""# ambiguous section names in ja_JP.cp932
1549 > u'''summary of extension
1550 >
1551 > %s
1552 > ----
1553 >
1554 > Upper name should show only this message
1555 >
1556 > %s
1557 > ----
1558 >
1559 > Lower name should show only this message
1560 >
1561 > subsequent section
1562 > ------------------
1563 >
1564 > This should be hidden at "hg help ambiguous" with section name.
1565 > '''
1566 > """ % (escape(upper), escape(lower)))
1567 > EOF
1568
1569 $ cat >> $HGRCPATH <<EOF
1570 > [extensions]
1571 > ambiguous = ./ambiguous.py
1572 > EOF
1573
1574 $ python <<EOF | sh
1575 > upper = "\x8bL\x98^"
1576 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1577 > EOF
1578 \x8bL\x98^ (esc)
1579 ----
1580
1581 Upper name should show only this message
1582
1583
1584 $ python <<EOF | sh
1585 > lower = "\x8bl\x98^"
1586 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1587 > EOF
1588 \x8bl\x98^ (esc)
1589 ----
1590
1591 Lower name should show only this message
1592
1593
1594 $ cat >> $HGRCPATH <<EOF
1595 > [extensions]
1596 > ambiguous = !
1597 > EOF
1598
1527 Test dynamic list of merge tools only shows up once
1599 Test dynamic list of merge tools only shows up once
1528 $ hg help merge-tools
1600 $ hg help merge-tools
1529 Merge Tools
1601 Merge Tools
1530 """""""""""
1602 """""""""""
1531
1603
1532 To merge files Mercurial uses merge tools.
1604 To merge files Mercurial uses merge tools.
1533
1605
1534 A merge tool combines two different versions of a file into a merged file.
1606 A merge tool combines two different versions of a file into a merged file.
1535 Merge tools are given the two files and the greatest common ancestor of
1607 Merge tools are given the two files and the greatest common ancestor of
1536 the two file versions, so they can determine the changes made on both
1608 the two file versions, so they can determine the changes made on both
1537 branches.
1609 branches.
1538
1610
1539 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1611 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1540 backout' and in several extensions.
1612 backout' and in several extensions.
1541
1613
1542 Usually, the merge tool tries to automatically reconcile the files by
1614 Usually, the merge tool tries to automatically reconcile the files by
1543 combining all non-overlapping changes that occurred separately in the two
1615 combining all non-overlapping changes that occurred separately in the two
1544 different evolutions of the same initial base file. Furthermore, some
1616 different evolutions of the same initial base file. Furthermore, some
1545 interactive merge programs make it easier to manually resolve conflicting
1617 interactive merge programs make it easier to manually resolve conflicting
1546 merges, either in a graphical way, or by inserting some conflict markers.
1618 merges, either in a graphical way, or by inserting some conflict markers.
1547 Mercurial does not include any interactive merge programs but relies on
1619 Mercurial does not include any interactive merge programs but relies on
1548 external tools for that.
1620 external tools for that.
1549
1621
1550 Available merge tools
1622 Available merge tools
1551 =====================
1623 =====================
1552
1624
1553 External merge tools and their properties are configured in the merge-
1625 External merge tools and their properties are configured in the merge-
1554 tools configuration section - see hgrc(5) - but they can often just be
1626 tools configuration section - see hgrc(5) - but they can often just be
1555 named by their executable.
1627 named by their executable.
1556
1628
1557 A merge tool is generally usable if its executable can be found on the
1629 A merge tool is generally usable if its executable can be found on the
1558 system and if it can handle the merge. The executable is found if it is an
1630 system and if it can handle the merge. The executable is found if it is an
1559 absolute or relative executable path or the name of an application in the
1631 absolute or relative executable path or the name of an application in the
1560 executable search path. The tool is assumed to be able to handle the merge
1632 executable search path. The tool is assumed to be able to handle the merge
1561 if it can handle symlinks if the file is a symlink, if it can handle
1633 if it can handle symlinks if the file is a symlink, if it can handle
1562 binary files if the file is binary, and if a GUI is available if the tool
1634 binary files if the file is binary, and if a GUI is available if the tool
1563 requires a GUI.
1635 requires a GUI.
1564
1636
1565 There are some internal merge tools which can be used. The internal merge
1637 There are some internal merge tools which can be used. The internal merge
1566 tools are:
1638 tools are:
1567
1639
1568 ":dump"
1640 ":dump"
1569 Creates three versions of the files to merge, containing the contents of
1641 Creates three versions of the files to merge, containing the contents of
1570 local, other and base. These files can then be used to perform a merge
1642 local, other and base. These files can then be used to perform a merge
1571 manually. If the file to be merged is named "a.txt", these files will
1643 manually. If the file to be merged is named "a.txt", these files will
1572 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1644 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1573 they will be placed in the same directory as "a.txt".
1645 they will be placed in the same directory as "a.txt".
1574
1646
1575 ":fail"
1647 ":fail"
1576 Rather than attempting to merge files that were modified on both
1648 Rather than attempting to merge files that were modified on both
1577 branches, it marks them as unresolved. The resolve command must be used
1649 branches, it marks them as unresolved. The resolve command must be used
1578 to resolve these conflicts.
1650 to resolve these conflicts.
1579
1651
1580 ":local"
1652 ":local"
1581 Uses the local 'p1()' version of files as the merged version.
1653 Uses the local 'p1()' version of files as the merged version.
1582
1654
1583 ":merge"
1655 ":merge"
1584 Uses the internal non-interactive simple merge algorithm for merging
1656 Uses the internal non-interactive simple merge algorithm for merging
1585 files. It will fail if there are any conflicts and leave markers in the
1657 files. It will fail if there are any conflicts and leave markers in the
1586 partially merged file. Markers will have two sections, one for each side
1658 partially merged file. Markers will have two sections, one for each side
1587 of merge.
1659 of merge.
1588
1660
1589 ":merge-local"
1661 ":merge-local"
1590 Like :merge, but resolve all conflicts non-interactively in favor of the
1662 Like :merge, but resolve all conflicts non-interactively in favor of the
1591 local 'p1()' changes.
1663 local 'p1()' changes.
1592
1664
1593 ":merge-other"
1665 ":merge-other"
1594 Like :merge, but resolve all conflicts non-interactively in favor of the
1666 Like :merge, but resolve all conflicts non-interactively in favor of the
1595 other 'p2()' changes.
1667 other 'p2()' changes.
1596
1668
1597 ":merge3"
1669 ":merge3"
1598 Uses the internal non-interactive simple merge algorithm for merging
1670 Uses the internal non-interactive simple merge algorithm for merging
1599 files. It will fail if there are any conflicts and leave markers in the
1671 files. It will fail if there are any conflicts and leave markers in the
1600 partially merged file. Marker will have three sections, one from each
1672 partially merged file. Marker will have three sections, one from each
1601 side of the merge and one for the base content.
1673 side of the merge and one for the base content.
1602
1674
1603 ":other"
1675 ":other"
1604 Uses the other 'p2()' version of files as the merged version.
1676 Uses the other 'p2()' version of files as the merged version.
1605
1677
1606 ":prompt"
1678 ":prompt"
1607 Asks the user which of the local 'p1()' or the other 'p2()' version to
1679 Asks the user which of the local 'p1()' or the other 'p2()' version to
1608 keep as the merged version.
1680 keep as the merged version.
1609
1681
1610 ":tagmerge"
1682 ":tagmerge"
1611 Uses the internal tag merge algorithm (experimental).
1683 Uses the internal tag merge algorithm (experimental).
1612
1684
1613 ":union"
1685 ":union"
1614 Uses the internal non-interactive simple merge algorithm for merging
1686 Uses the internal non-interactive simple merge algorithm for merging
1615 files. It will use both left and right sides for conflict regions. No
1687 files. It will use both left and right sides for conflict regions. No
1616 markers are inserted.
1688 markers are inserted.
1617
1689
1618 Internal tools are always available and do not require a GUI but will by
1690 Internal tools are always available and do not require a GUI but will by
1619 default not handle symlinks or binary files.
1691 default not handle symlinks or binary files.
1620
1692
1621 Choosing a merge tool
1693 Choosing a merge tool
1622 =====================
1694 =====================
1623
1695
1624 Mercurial uses these rules when deciding which merge tool to use:
1696 Mercurial uses these rules when deciding which merge tool to use:
1625
1697
1626 1. If a tool has been specified with the --tool option to merge or
1698 1. If a tool has been specified with the --tool option to merge or
1627 resolve, it is used. If it is the name of a tool in the merge-tools
1699 resolve, it is used. If it is the name of a tool in the merge-tools
1628 configuration, its configuration is used. Otherwise the specified tool
1700 configuration, its configuration is used. Otherwise the specified tool
1629 must be executable by the shell.
1701 must be executable by the shell.
1630 2. If the "HGMERGE" environment variable is present, its value is used and
1702 2. If the "HGMERGE" environment variable is present, its value is used and
1631 must be executable by the shell.
1703 must be executable by the shell.
1632 3. If the filename of the file to be merged matches any of the patterns in
1704 3. If the filename of the file to be merged matches any of the patterns in
1633 the merge-patterns configuration section, the first usable merge tool
1705 the merge-patterns configuration section, the first usable merge tool
1634 corresponding to a matching pattern is used. Here, binary capabilities
1706 corresponding to a matching pattern is used. Here, binary capabilities
1635 of the merge tool are not considered.
1707 of the merge tool are not considered.
1636 4. If ui.merge is set it will be considered next. If the value is not the
1708 4. If ui.merge is set it will be considered next. If the value is not the
1637 name of a configured tool, the specified value is used and must be
1709 name of a configured tool, the specified value is used and must be
1638 executable by the shell. Otherwise the named tool is used if it is
1710 executable by the shell. Otherwise the named tool is used if it is
1639 usable.
1711 usable.
1640 5. If any usable merge tools are present in the merge-tools configuration
1712 5. If any usable merge tools are present in the merge-tools configuration
1641 section, the one with the highest priority is used.
1713 section, the one with the highest priority is used.
1642 6. If a program named "hgmerge" can be found on the system, it is used -
1714 6. If a program named "hgmerge" can be found on the system, it is used -
1643 but it will by default not be used for symlinks and binary files.
1715 but it will by default not be used for symlinks and binary files.
1644 7. If the file to be merged is not binary and is not a symlink, then
1716 7. If the file to be merged is not binary and is not a symlink, then
1645 internal ":merge" is used.
1717 internal ":merge" is used.
1646 8. The merge of the file fails and must be resolved before commit.
1718 8. The merge of the file fails and must be resolved before commit.
1647
1719
1648 Note:
1720 Note:
1649 After selecting a merge program, Mercurial will by default attempt to
1721 After selecting a merge program, Mercurial will by default attempt to
1650 merge the files using a simple merge algorithm first. Only if it
1722 merge the files using a simple merge algorithm first. Only if it
1651 doesn't succeed because of conflicting changes Mercurial will actually
1723 doesn't succeed because of conflicting changes Mercurial will actually
1652 execute the merge program. Whether to use the simple merge algorithm
1724 execute the merge program. Whether to use the simple merge algorithm
1653 first can be controlled by the premerge setting of the merge tool.
1725 first can be controlled by the premerge setting of the merge tool.
1654 Premerge is enabled by default unless the file is binary or a symlink.
1726 Premerge is enabled by default unless the file is binary or a symlink.
1655
1727
1656 See the merge-tools and ui sections of hgrc(5) for details on the
1728 See the merge-tools and ui sections of hgrc(5) for details on the
1657 configuration of merge tools.
1729 configuration of merge tools.
1658
1730
1659 Test usage of section marks in help documents
1731 Test usage of section marks in help documents
1660
1732
1661 $ cd "$TESTDIR"/../doc
1733 $ cd "$TESTDIR"/../doc
1662 $ python check-seclevel.py
1734 $ python check-seclevel.py
1663 $ cd $TESTTMP
1735 $ cd $TESTTMP
1664
1736
1665 #if serve
1737 #if serve
1666
1738
1667 Test the help pages in hgweb.
1739 Test the help pages in hgweb.
1668
1740
1669 Dish up an empty repo; serve it cold.
1741 Dish up an empty repo; serve it cold.
1670
1742
1671 $ hg init "$TESTTMP/test"
1743 $ hg init "$TESTTMP/test"
1672 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1744 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1673 $ cat hg.pid >> $DAEMON_PIDS
1745 $ cat hg.pid >> $DAEMON_PIDS
1674
1746
1675 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1747 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1676 200 Script output follows
1748 200 Script output follows
1677
1749
1678 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1750 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1679 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1751 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1680 <head>
1752 <head>
1681 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1753 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1682 <meta name="robots" content="index, nofollow" />
1754 <meta name="robots" content="index, nofollow" />
1683 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1755 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1684 <script type="text/javascript" src="/static/mercurial.js"></script>
1756 <script type="text/javascript" src="/static/mercurial.js"></script>
1685
1757
1686 <title>Help: Index</title>
1758 <title>Help: Index</title>
1687 </head>
1759 </head>
1688 <body>
1760 <body>
1689
1761
1690 <div class="container">
1762 <div class="container">
1691 <div class="menu">
1763 <div class="menu">
1692 <div class="logo">
1764 <div class="logo">
1693 <a href="https://mercurial-scm.org/">
1765 <a href="https://mercurial-scm.org/">
1694 <img src="/static/hglogo.png" alt="mercurial" /></a>
1766 <img src="/static/hglogo.png" alt="mercurial" /></a>
1695 </div>
1767 </div>
1696 <ul>
1768 <ul>
1697 <li><a href="/shortlog">log</a></li>
1769 <li><a href="/shortlog">log</a></li>
1698 <li><a href="/graph">graph</a></li>
1770 <li><a href="/graph">graph</a></li>
1699 <li><a href="/tags">tags</a></li>
1771 <li><a href="/tags">tags</a></li>
1700 <li><a href="/bookmarks">bookmarks</a></li>
1772 <li><a href="/bookmarks">bookmarks</a></li>
1701 <li><a href="/branches">branches</a></li>
1773 <li><a href="/branches">branches</a></li>
1702 </ul>
1774 </ul>
1703 <ul>
1775 <ul>
1704 <li class="active">help</li>
1776 <li class="active">help</li>
1705 </ul>
1777 </ul>
1706 </div>
1778 </div>
1707
1779
1708 <div class="main">
1780 <div class="main">
1709 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1781 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1710 <form class="search" action="/log">
1782 <form class="search" action="/log">
1711
1783
1712 <p><input name="rev" id="search1" type="text" size="30" /></p>
1784 <p><input name="rev" id="search1" type="text" size="30" /></p>
1713 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1785 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1714 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1786 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1715 </form>
1787 </form>
1716 <table class="bigtable">
1788 <table class="bigtable">
1717 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1789 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1718
1790
1719 <tr><td>
1791 <tr><td>
1720 <a href="/help/config">
1792 <a href="/help/config">
1721 config
1793 config
1722 </a>
1794 </a>
1723 </td><td>
1795 </td><td>
1724 Configuration Files
1796 Configuration Files
1725 </td></tr>
1797 </td></tr>
1726 <tr><td>
1798 <tr><td>
1727 <a href="/help/dates">
1799 <a href="/help/dates">
1728 dates
1800 dates
1729 </a>
1801 </a>
1730 </td><td>
1802 </td><td>
1731 Date Formats
1803 Date Formats
1732 </td></tr>
1804 </td></tr>
1733 <tr><td>
1805 <tr><td>
1734 <a href="/help/diffs">
1806 <a href="/help/diffs">
1735 diffs
1807 diffs
1736 </a>
1808 </a>
1737 </td><td>
1809 </td><td>
1738 Diff Formats
1810 Diff Formats
1739 </td></tr>
1811 </td></tr>
1740 <tr><td>
1812 <tr><td>
1741 <a href="/help/environment">
1813 <a href="/help/environment">
1742 environment
1814 environment
1743 </a>
1815 </a>
1744 </td><td>
1816 </td><td>
1745 Environment Variables
1817 Environment Variables
1746 </td></tr>
1818 </td></tr>
1747 <tr><td>
1819 <tr><td>
1748 <a href="/help/extensions">
1820 <a href="/help/extensions">
1749 extensions
1821 extensions
1750 </a>
1822 </a>
1751 </td><td>
1823 </td><td>
1752 Using Additional Features
1824 Using Additional Features
1753 </td></tr>
1825 </td></tr>
1754 <tr><td>
1826 <tr><td>
1755 <a href="/help/filesets">
1827 <a href="/help/filesets">
1756 filesets
1828 filesets
1757 </a>
1829 </a>
1758 </td><td>
1830 </td><td>
1759 Specifying File Sets
1831 Specifying File Sets
1760 </td></tr>
1832 </td></tr>
1761 <tr><td>
1833 <tr><td>
1762 <a href="/help/glossary">
1834 <a href="/help/glossary">
1763 glossary
1835 glossary
1764 </a>
1836 </a>
1765 </td><td>
1837 </td><td>
1766 Glossary
1838 Glossary
1767 </td></tr>
1839 </td></tr>
1768 <tr><td>
1840 <tr><td>
1769 <a href="/help/hgignore">
1841 <a href="/help/hgignore">
1770 hgignore
1842 hgignore
1771 </a>
1843 </a>
1772 </td><td>
1844 </td><td>
1773 Syntax for Mercurial Ignore Files
1845 Syntax for Mercurial Ignore Files
1774 </td></tr>
1846 </td></tr>
1775 <tr><td>
1847 <tr><td>
1776 <a href="/help/hgweb">
1848 <a href="/help/hgweb">
1777 hgweb
1849 hgweb
1778 </a>
1850 </a>
1779 </td><td>
1851 </td><td>
1780 Configuring hgweb
1852 Configuring hgweb
1781 </td></tr>
1853 </td></tr>
1782 <tr><td>
1854 <tr><td>
1783 <a href="/help/internals">
1855 <a href="/help/internals">
1784 internals
1856 internals
1785 </a>
1857 </a>
1786 </td><td>
1858 </td><td>
1787 Technical implementation topics
1859 Technical implementation topics
1788 </td></tr>
1860 </td></tr>
1789 <tr><td>
1861 <tr><td>
1790 <a href="/help/merge-tools">
1862 <a href="/help/merge-tools">
1791 merge-tools
1863 merge-tools
1792 </a>
1864 </a>
1793 </td><td>
1865 </td><td>
1794 Merge Tools
1866 Merge Tools
1795 </td></tr>
1867 </td></tr>
1796 <tr><td>
1868 <tr><td>
1797 <a href="/help/multirevs">
1869 <a href="/help/multirevs">
1798 multirevs
1870 multirevs
1799 </a>
1871 </a>
1800 </td><td>
1872 </td><td>
1801 Specifying Multiple Revisions
1873 Specifying Multiple Revisions
1802 </td></tr>
1874 </td></tr>
1803 <tr><td>
1875 <tr><td>
1804 <a href="/help/patterns">
1876 <a href="/help/patterns">
1805 patterns
1877 patterns
1806 </a>
1878 </a>
1807 </td><td>
1879 </td><td>
1808 File Name Patterns
1880 File Name Patterns
1809 </td></tr>
1881 </td></tr>
1810 <tr><td>
1882 <tr><td>
1811 <a href="/help/phases">
1883 <a href="/help/phases">
1812 phases
1884 phases
1813 </a>
1885 </a>
1814 </td><td>
1886 </td><td>
1815 Working with Phases
1887 Working with Phases
1816 </td></tr>
1888 </td></tr>
1817 <tr><td>
1889 <tr><td>
1818 <a href="/help/revisions">
1890 <a href="/help/revisions">
1819 revisions
1891 revisions
1820 </a>
1892 </a>
1821 </td><td>
1893 </td><td>
1822 Specifying Single Revisions
1894 Specifying Single Revisions
1823 </td></tr>
1895 </td></tr>
1824 <tr><td>
1896 <tr><td>
1825 <a href="/help/revsets">
1897 <a href="/help/revsets">
1826 revsets
1898 revsets
1827 </a>
1899 </a>
1828 </td><td>
1900 </td><td>
1829 Specifying Revision Sets
1901 Specifying Revision Sets
1830 </td></tr>
1902 </td></tr>
1831 <tr><td>
1903 <tr><td>
1832 <a href="/help/scripting">
1904 <a href="/help/scripting">
1833 scripting
1905 scripting
1834 </a>
1906 </a>
1835 </td><td>
1907 </td><td>
1836 Using Mercurial from scripts and automation
1908 Using Mercurial from scripts and automation
1837 </td></tr>
1909 </td></tr>
1838 <tr><td>
1910 <tr><td>
1839 <a href="/help/subrepos">
1911 <a href="/help/subrepos">
1840 subrepos
1912 subrepos
1841 </a>
1913 </a>
1842 </td><td>
1914 </td><td>
1843 Subrepositories
1915 Subrepositories
1844 </td></tr>
1916 </td></tr>
1845 <tr><td>
1917 <tr><td>
1846 <a href="/help/templating">
1918 <a href="/help/templating">
1847 templating
1919 templating
1848 </a>
1920 </a>
1849 </td><td>
1921 </td><td>
1850 Template Usage
1922 Template Usage
1851 </td></tr>
1923 </td></tr>
1852 <tr><td>
1924 <tr><td>
1853 <a href="/help/urls">
1925 <a href="/help/urls">
1854 urls
1926 urls
1855 </a>
1927 </a>
1856 </td><td>
1928 </td><td>
1857 URL Paths
1929 URL Paths
1858 </td></tr>
1930 </td></tr>
1859 <tr><td>
1931 <tr><td>
1860 <a href="/help/topic-containing-verbose">
1932 <a href="/help/topic-containing-verbose">
1861 topic-containing-verbose
1933 topic-containing-verbose
1862 </a>
1934 </a>
1863 </td><td>
1935 </td><td>
1864 This is the topic to test omit indicating.
1936 This is the topic to test omit indicating.
1865 </td></tr>
1937 </td></tr>
1866
1938
1867
1939
1868 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1940 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1869
1941
1870 <tr><td>
1942 <tr><td>
1871 <a href="/help/add">
1943 <a href="/help/add">
1872 add
1944 add
1873 </a>
1945 </a>
1874 </td><td>
1946 </td><td>
1875 add the specified files on the next commit
1947 add the specified files on the next commit
1876 </td></tr>
1948 </td></tr>
1877 <tr><td>
1949 <tr><td>
1878 <a href="/help/annotate">
1950 <a href="/help/annotate">
1879 annotate
1951 annotate
1880 </a>
1952 </a>
1881 </td><td>
1953 </td><td>
1882 show changeset information by line for each file
1954 show changeset information by line for each file
1883 </td></tr>
1955 </td></tr>
1884 <tr><td>
1956 <tr><td>
1885 <a href="/help/clone">
1957 <a href="/help/clone">
1886 clone
1958 clone
1887 </a>
1959 </a>
1888 </td><td>
1960 </td><td>
1889 make a copy of an existing repository
1961 make a copy of an existing repository
1890 </td></tr>
1962 </td></tr>
1891 <tr><td>
1963 <tr><td>
1892 <a href="/help/commit">
1964 <a href="/help/commit">
1893 commit
1965 commit
1894 </a>
1966 </a>
1895 </td><td>
1967 </td><td>
1896 commit the specified files or all outstanding changes
1968 commit the specified files or all outstanding changes
1897 </td></tr>
1969 </td></tr>
1898 <tr><td>
1970 <tr><td>
1899 <a href="/help/diff">
1971 <a href="/help/diff">
1900 diff
1972 diff
1901 </a>
1973 </a>
1902 </td><td>
1974 </td><td>
1903 diff repository (or selected files)
1975 diff repository (or selected files)
1904 </td></tr>
1976 </td></tr>
1905 <tr><td>
1977 <tr><td>
1906 <a href="/help/export">
1978 <a href="/help/export">
1907 export
1979 export
1908 </a>
1980 </a>
1909 </td><td>
1981 </td><td>
1910 dump the header and diffs for one or more changesets
1982 dump the header and diffs for one or more changesets
1911 </td></tr>
1983 </td></tr>
1912 <tr><td>
1984 <tr><td>
1913 <a href="/help/forget">
1985 <a href="/help/forget">
1914 forget
1986 forget
1915 </a>
1987 </a>
1916 </td><td>
1988 </td><td>
1917 forget the specified files on the next commit
1989 forget the specified files on the next commit
1918 </td></tr>
1990 </td></tr>
1919 <tr><td>
1991 <tr><td>
1920 <a href="/help/init">
1992 <a href="/help/init">
1921 init
1993 init
1922 </a>
1994 </a>
1923 </td><td>
1995 </td><td>
1924 create a new repository in the given directory
1996 create a new repository in the given directory
1925 </td></tr>
1997 </td></tr>
1926 <tr><td>
1998 <tr><td>
1927 <a href="/help/log">
1999 <a href="/help/log">
1928 log
2000 log
1929 </a>
2001 </a>
1930 </td><td>
2002 </td><td>
1931 show revision history of entire repository or files
2003 show revision history of entire repository or files
1932 </td></tr>
2004 </td></tr>
1933 <tr><td>
2005 <tr><td>
1934 <a href="/help/merge">
2006 <a href="/help/merge">
1935 merge
2007 merge
1936 </a>
2008 </a>
1937 </td><td>
2009 </td><td>
1938 merge another revision into working directory
2010 merge another revision into working directory
1939 </td></tr>
2011 </td></tr>
1940 <tr><td>
2012 <tr><td>
1941 <a href="/help/pull">
2013 <a href="/help/pull">
1942 pull
2014 pull
1943 </a>
2015 </a>
1944 </td><td>
2016 </td><td>
1945 pull changes from the specified source
2017 pull changes from the specified source
1946 </td></tr>
2018 </td></tr>
1947 <tr><td>
2019 <tr><td>
1948 <a href="/help/push">
2020 <a href="/help/push">
1949 push
2021 push
1950 </a>
2022 </a>
1951 </td><td>
2023 </td><td>
1952 push changes to the specified destination
2024 push changes to the specified destination
1953 </td></tr>
2025 </td></tr>
1954 <tr><td>
2026 <tr><td>
1955 <a href="/help/remove">
2027 <a href="/help/remove">
1956 remove
2028 remove
1957 </a>
2029 </a>
1958 </td><td>
2030 </td><td>
1959 remove the specified files on the next commit
2031 remove the specified files on the next commit
1960 </td></tr>
2032 </td></tr>
1961 <tr><td>
2033 <tr><td>
1962 <a href="/help/serve">
2034 <a href="/help/serve">
1963 serve
2035 serve
1964 </a>
2036 </a>
1965 </td><td>
2037 </td><td>
1966 start stand-alone webserver
2038 start stand-alone webserver
1967 </td></tr>
2039 </td></tr>
1968 <tr><td>
2040 <tr><td>
1969 <a href="/help/status">
2041 <a href="/help/status">
1970 status
2042 status
1971 </a>
2043 </a>
1972 </td><td>
2044 </td><td>
1973 show changed files in the working directory
2045 show changed files in the working directory
1974 </td></tr>
2046 </td></tr>
1975 <tr><td>
2047 <tr><td>
1976 <a href="/help/summary">
2048 <a href="/help/summary">
1977 summary
2049 summary
1978 </a>
2050 </a>
1979 </td><td>
2051 </td><td>
1980 summarize working directory state
2052 summarize working directory state
1981 </td></tr>
2053 </td></tr>
1982 <tr><td>
2054 <tr><td>
1983 <a href="/help/update">
2055 <a href="/help/update">
1984 update
2056 update
1985 </a>
2057 </a>
1986 </td><td>
2058 </td><td>
1987 update working directory (or switch revisions)
2059 update working directory (or switch revisions)
1988 </td></tr>
2060 </td></tr>
1989
2061
1990
2062
1991
2063
1992 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2064 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1993
2065
1994 <tr><td>
2066 <tr><td>
1995 <a href="/help/addremove">
2067 <a href="/help/addremove">
1996 addremove
2068 addremove
1997 </a>
2069 </a>
1998 </td><td>
2070 </td><td>
1999 add all new files, delete all missing files
2071 add all new files, delete all missing files
2000 </td></tr>
2072 </td></tr>
2001 <tr><td>
2073 <tr><td>
2002 <a href="/help/archive">
2074 <a href="/help/archive">
2003 archive
2075 archive
2004 </a>
2076 </a>
2005 </td><td>
2077 </td><td>
2006 create an unversioned archive of a repository revision
2078 create an unversioned archive of a repository revision
2007 </td></tr>
2079 </td></tr>
2008 <tr><td>
2080 <tr><td>
2009 <a href="/help/backout">
2081 <a href="/help/backout">
2010 backout
2082 backout
2011 </a>
2083 </a>
2012 </td><td>
2084 </td><td>
2013 reverse effect of earlier changeset
2085 reverse effect of earlier changeset
2014 </td></tr>
2086 </td></tr>
2015 <tr><td>
2087 <tr><td>
2016 <a href="/help/bisect">
2088 <a href="/help/bisect">
2017 bisect
2089 bisect
2018 </a>
2090 </a>
2019 </td><td>
2091 </td><td>
2020 subdivision search of changesets
2092 subdivision search of changesets
2021 </td></tr>
2093 </td></tr>
2022 <tr><td>
2094 <tr><td>
2023 <a href="/help/bookmarks">
2095 <a href="/help/bookmarks">
2024 bookmarks
2096 bookmarks
2025 </a>
2097 </a>
2026 </td><td>
2098 </td><td>
2027 create a new bookmark or list existing bookmarks
2099 create a new bookmark or list existing bookmarks
2028 </td></tr>
2100 </td></tr>
2029 <tr><td>
2101 <tr><td>
2030 <a href="/help/branch">
2102 <a href="/help/branch">
2031 branch
2103 branch
2032 </a>
2104 </a>
2033 </td><td>
2105 </td><td>
2034 set or show the current branch name
2106 set or show the current branch name
2035 </td></tr>
2107 </td></tr>
2036 <tr><td>
2108 <tr><td>
2037 <a href="/help/branches">
2109 <a href="/help/branches">
2038 branches
2110 branches
2039 </a>
2111 </a>
2040 </td><td>
2112 </td><td>
2041 list repository named branches
2113 list repository named branches
2042 </td></tr>
2114 </td></tr>
2043 <tr><td>
2115 <tr><td>
2044 <a href="/help/bundle">
2116 <a href="/help/bundle">
2045 bundle
2117 bundle
2046 </a>
2118 </a>
2047 </td><td>
2119 </td><td>
2048 create a changegroup file
2120 create a changegroup file
2049 </td></tr>
2121 </td></tr>
2050 <tr><td>
2122 <tr><td>
2051 <a href="/help/cat">
2123 <a href="/help/cat">
2052 cat
2124 cat
2053 </a>
2125 </a>
2054 </td><td>
2126 </td><td>
2055 output the current or given revision of files
2127 output the current or given revision of files
2056 </td></tr>
2128 </td></tr>
2057 <tr><td>
2129 <tr><td>
2058 <a href="/help/config">
2130 <a href="/help/config">
2059 config
2131 config
2060 </a>
2132 </a>
2061 </td><td>
2133 </td><td>
2062 show combined config settings from all hgrc files
2134 show combined config settings from all hgrc files
2063 </td></tr>
2135 </td></tr>
2064 <tr><td>
2136 <tr><td>
2065 <a href="/help/copy">
2137 <a href="/help/copy">
2066 copy
2138 copy
2067 </a>
2139 </a>
2068 </td><td>
2140 </td><td>
2069 mark files as copied for the next commit
2141 mark files as copied for the next commit
2070 </td></tr>
2142 </td></tr>
2071 <tr><td>
2143 <tr><td>
2072 <a href="/help/files">
2144 <a href="/help/files">
2073 files
2145 files
2074 </a>
2146 </a>
2075 </td><td>
2147 </td><td>
2076 list tracked files
2148 list tracked files
2077 </td></tr>
2149 </td></tr>
2078 <tr><td>
2150 <tr><td>
2079 <a href="/help/graft">
2151 <a href="/help/graft">
2080 graft
2152 graft
2081 </a>
2153 </a>
2082 </td><td>
2154 </td><td>
2083 copy changes from other branches onto the current branch
2155 copy changes from other branches onto the current branch
2084 </td></tr>
2156 </td></tr>
2085 <tr><td>
2157 <tr><td>
2086 <a href="/help/grep">
2158 <a href="/help/grep">
2087 grep
2159 grep
2088 </a>
2160 </a>
2089 </td><td>
2161 </td><td>
2090 search for a pattern in specified files and revisions
2162 search for a pattern in specified files and revisions
2091 </td></tr>
2163 </td></tr>
2092 <tr><td>
2164 <tr><td>
2093 <a href="/help/heads">
2165 <a href="/help/heads">
2094 heads
2166 heads
2095 </a>
2167 </a>
2096 </td><td>
2168 </td><td>
2097 show branch heads
2169 show branch heads
2098 </td></tr>
2170 </td></tr>
2099 <tr><td>
2171 <tr><td>
2100 <a href="/help/help">
2172 <a href="/help/help">
2101 help
2173 help
2102 </a>
2174 </a>
2103 </td><td>
2175 </td><td>
2104 show help for a given topic or a help overview
2176 show help for a given topic or a help overview
2105 </td></tr>
2177 </td></tr>
2106 <tr><td>
2178 <tr><td>
2107 <a href="/help/hgalias">
2179 <a href="/help/hgalias">
2108 hgalias
2180 hgalias
2109 </a>
2181 </a>
2110 </td><td>
2182 </td><td>
2111 summarize working directory state
2183 summarize working directory state
2112 </td></tr>
2184 </td></tr>
2113 <tr><td>
2185 <tr><td>
2114 <a href="/help/identify">
2186 <a href="/help/identify">
2115 identify
2187 identify
2116 </a>
2188 </a>
2117 </td><td>
2189 </td><td>
2118 identify the working directory or specified revision
2190 identify the working directory or specified revision
2119 </td></tr>
2191 </td></tr>
2120 <tr><td>
2192 <tr><td>
2121 <a href="/help/import">
2193 <a href="/help/import">
2122 import
2194 import
2123 </a>
2195 </a>
2124 </td><td>
2196 </td><td>
2125 import an ordered set of patches
2197 import an ordered set of patches
2126 </td></tr>
2198 </td></tr>
2127 <tr><td>
2199 <tr><td>
2128 <a href="/help/incoming">
2200 <a href="/help/incoming">
2129 incoming
2201 incoming
2130 </a>
2202 </a>
2131 </td><td>
2203 </td><td>
2132 show new changesets found in source
2204 show new changesets found in source
2133 </td></tr>
2205 </td></tr>
2134 <tr><td>
2206 <tr><td>
2135 <a href="/help/manifest">
2207 <a href="/help/manifest">
2136 manifest
2208 manifest
2137 </a>
2209 </a>
2138 </td><td>
2210 </td><td>
2139 output the current or given revision of the project manifest
2211 output the current or given revision of the project manifest
2140 </td></tr>
2212 </td></tr>
2141 <tr><td>
2213 <tr><td>
2142 <a href="/help/nohelp">
2214 <a href="/help/nohelp">
2143 nohelp
2215 nohelp
2144 </a>
2216 </a>
2145 </td><td>
2217 </td><td>
2146 (no help text available)
2218 (no help text available)
2147 </td></tr>
2219 </td></tr>
2148 <tr><td>
2220 <tr><td>
2149 <a href="/help/outgoing">
2221 <a href="/help/outgoing">
2150 outgoing
2222 outgoing
2151 </a>
2223 </a>
2152 </td><td>
2224 </td><td>
2153 show changesets not found in the destination
2225 show changesets not found in the destination
2154 </td></tr>
2226 </td></tr>
2155 <tr><td>
2227 <tr><td>
2156 <a href="/help/paths">
2228 <a href="/help/paths">
2157 paths
2229 paths
2158 </a>
2230 </a>
2159 </td><td>
2231 </td><td>
2160 show aliases for remote repositories
2232 show aliases for remote repositories
2161 </td></tr>
2233 </td></tr>
2162 <tr><td>
2234 <tr><td>
2163 <a href="/help/phase">
2235 <a href="/help/phase">
2164 phase
2236 phase
2165 </a>
2237 </a>
2166 </td><td>
2238 </td><td>
2167 set or show the current phase name
2239 set or show the current phase name
2168 </td></tr>
2240 </td></tr>
2169 <tr><td>
2241 <tr><td>
2170 <a href="/help/recover">
2242 <a href="/help/recover">
2171 recover
2243 recover
2172 </a>
2244 </a>
2173 </td><td>
2245 </td><td>
2174 roll back an interrupted transaction
2246 roll back an interrupted transaction
2175 </td></tr>
2247 </td></tr>
2176 <tr><td>
2248 <tr><td>
2177 <a href="/help/rename">
2249 <a href="/help/rename">
2178 rename
2250 rename
2179 </a>
2251 </a>
2180 </td><td>
2252 </td><td>
2181 rename files; equivalent of copy + remove
2253 rename files; equivalent of copy + remove
2182 </td></tr>
2254 </td></tr>
2183 <tr><td>
2255 <tr><td>
2184 <a href="/help/resolve">
2256 <a href="/help/resolve">
2185 resolve
2257 resolve
2186 </a>
2258 </a>
2187 </td><td>
2259 </td><td>
2188 redo merges or set/view the merge status of files
2260 redo merges or set/view the merge status of files
2189 </td></tr>
2261 </td></tr>
2190 <tr><td>
2262 <tr><td>
2191 <a href="/help/revert">
2263 <a href="/help/revert">
2192 revert
2264 revert
2193 </a>
2265 </a>
2194 </td><td>
2266 </td><td>
2195 restore files to their checkout state
2267 restore files to their checkout state
2196 </td></tr>
2268 </td></tr>
2197 <tr><td>
2269 <tr><td>
2198 <a href="/help/root">
2270 <a href="/help/root">
2199 root
2271 root
2200 </a>
2272 </a>
2201 </td><td>
2273 </td><td>
2202 print the root (top) of the current working directory
2274 print the root (top) of the current working directory
2203 </td></tr>
2275 </td></tr>
2204 <tr><td>
2276 <tr><td>
2205 <a href="/help/shellalias">
2277 <a href="/help/shellalias">
2206 shellalias
2278 shellalias
2207 </a>
2279 </a>
2208 </td><td>
2280 </td><td>
2209 (no help text available)
2281 (no help text available)
2210 </td></tr>
2282 </td></tr>
2211 <tr><td>
2283 <tr><td>
2212 <a href="/help/tag">
2284 <a href="/help/tag">
2213 tag
2285 tag
2214 </a>
2286 </a>
2215 </td><td>
2287 </td><td>
2216 add one or more tags for the current or given revision
2288 add one or more tags for the current or given revision
2217 </td></tr>
2289 </td></tr>
2218 <tr><td>
2290 <tr><td>
2219 <a href="/help/tags">
2291 <a href="/help/tags">
2220 tags
2292 tags
2221 </a>
2293 </a>
2222 </td><td>
2294 </td><td>
2223 list repository tags
2295 list repository tags
2224 </td></tr>
2296 </td></tr>
2225 <tr><td>
2297 <tr><td>
2226 <a href="/help/unbundle">
2298 <a href="/help/unbundle">
2227 unbundle
2299 unbundle
2228 </a>
2300 </a>
2229 </td><td>
2301 </td><td>
2230 apply one or more changegroup files
2302 apply one or more changegroup files
2231 </td></tr>
2303 </td></tr>
2232 <tr><td>
2304 <tr><td>
2233 <a href="/help/verify">
2305 <a href="/help/verify">
2234 verify
2306 verify
2235 </a>
2307 </a>
2236 </td><td>
2308 </td><td>
2237 verify the integrity of the repository
2309 verify the integrity of the repository
2238 </td></tr>
2310 </td></tr>
2239 <tr><td>
2311 <tr><td>
2240 <a href="/help/version">
2312 <a href="/help/version">
2241 version
2313 version
2242 </a>
2314 </a>
2243 </td><td>
2315 </td><td>
2244 output version and copyright information
2316 output version and copyright information
2245 </td></tr>
2317 </td></tr>
2246
2318
2247
2319
2248 </table>
2320 </table>
2249 </div>
2321 </div>
2250 </div>
2322 </div>
2251
2323
2252 <script type="text/javascript">process_dates()</script>
2324 <script type="text/javascript">process_dates()</script>
2253
2325
2254
2326
2255 </body>
2327 </body>
2256 </html>
2328 </html>
2257
2329
2258
2330
2259 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2331 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2260 200 Script output follows
2332 200 Script output follows
2261
2333
2262 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2334 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2263 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2335 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2264 <head>
2336 <head>
2265 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2337 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2266 <meta name="robots" content="index, nofollow" />
2338 <meta name="robots" content="index, nofollow" />
2267 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2339 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2268 <script type="text/javascript" src="/static/mercurial.js"></script>
2340 <script type="text/javascript" src="/static/mercurial.js"></script>
2269
2341
2270 <title>Help: add</title>
2342 <title>Help: add</title>
2271 </head>
2343 </head>
2272 <body>
2344 <body>
2273
2345
2274 <div class="container">
2346 <div class="container">
2275 <div class="menu">
2347 <div class="menu">
2276 <div class="logo">
2348 <div class="logo">
2277 <a href="https://mercurial-scm.org/">
2349 <a href="https://mercurial-scm.org/">
2278 <img src="/static/hglogo.png" alt="mercurial" /></a>
2350 <img src="/static/hglogo.png" alt="mercurial" /></a>
2279 </div>
2351 </div>
2280 <ul>
2352 <ul>
2281 <li><a href="/shortlog">log</a></li>
2353 <li><a href="/shortlog">log</a></li>
2282 <li><a href="/graph">graph</a></li>
2354 <li><a href="/graph">graph</a></li>
2283 <li><a href="/tags">tags</a></li>
2355 <li><a href="/tags">tags</a></li>
2284 <li><a href="/bookmarks">bookmarks</a></li>
2356 <li><a href="/bookmarks">bookmarks</a></li>
2285 <li><a href="/branches">branches</a></li>
2357 <li><a href="/branches">branches</a></li>
2286 </ul>
2358 </ul>
2287 <ul>
2359 <ul>
2288 <li class="active"><a href="/help">help</a></li>
2360 <li class="active"><a href="/help">help</a></li>
2289 </ul>
2361 </ul>
2290 </div>
2362 </div>
2291
2363
2292 <div class="main">
2364 <div class="main">
2293 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2365 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2294 <h3>Help: add</h3>
2366 <h3>Help: add</h3>
2295
2367
2296 <form class="search" action="/log">
2368 <form class="search" action="/log">
2297
2369
2298 <p><input name="rev" id="search1" type="text" size="30" /></p>
2370 <p><input name="rev" id="search1" type="text" size="30" /></p>
2299 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2371 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2300 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2372 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2301 </form>
2373 </form>
2302 <div id="doc">
2374 <div id="doc">
2303 <p>
2375 <p>
2304 hg add [OPTION]... [FILE]...
2376 hg add [OPTION]... [FILE]...
2305 </p>
2377 </p>
2306 <p>
2378 <p>
2307 add the specified files on the next commit
2379 add the specified files on the next commit
2308 </p>
2380 </p>
2309 <p>
2381 <p>
2310 Schedule files to be version controlled and added to the
2382 Schedule files to be version controlled and added to the
2311 repository.
2383 repository.
2312 </p>
2384 </p>
2313 <p>
2385 <p>
2314 The files will be added to the repository at the next commit. To
2386 The files will be added to the repository at the next commit. To
2315 undo an add before that, see 'hg forget'.
2387 undo an add before that, see 'hg forget'.
2316 </p>
2388 </p>
2317 <p>
2389 <p>
2318 If no names are given, add all files to the repository (except
2390 If no names are given, add all files to the repository (except
2319 files matching &quot;.hgignore&quot;).
2391 files matching &quot;.hgignore&quot;).
2320 </p>
2392 </p>
2321 <p>
2393 <p>
2322 Examples:
2394 Examples:
2323 </p>
2395 </p>
2324 <ul>
2396 <ul>
2325 <li> New (unknown) files are added automatically by 'hg add':
2397 <li> New (unknown) files are added automatically by 'hg add':
2326 <pre>
2398 <pre>
2327 \$ ls (re)
2399 \$ ls (re)
2328 foo.c
2400 foo.c
2329 \$ hg status (re)
2401 \$ hg status (re)
2330 ? foo.c
2402 ? foo.c
2331 \$ hg add (re)
2403 \$ hg add (re)
2332 adding foo.c
2404 adding foo.c
2333 \$ hg status (re)
2405 \$ hg status (re)
2334 A foo.c
2406 A foo.c
2335 </pre>
2407 </pre>
2336 <li> Specific files to be added can be specified:
2408 <li> Specific files to be added can be specified:
2337 <pre>
2409 <pre>
2338 \$ ls (re)
2410 \$ ls (re)
2339 bar.c foo.c
2411 bar.c foo.c
2340 \$ hg status (re)
2412 \$ hg status (re)
2341 ? bar.c
2413 ? bar.c
2342 ? foo.c
2414 ? foo.c
2343 \$ hg add bar.c (re)
2415 \$ hg add bar.c (re)
2344 \$ hg status (re)
2416 \$ hg status (re)
2345 A bar.c
2417 A bar.c
2346 ? foo.c
2418 ? foo.c
2347 </pre>
2419 </pre>
2348 </ul>
2420 </ul>
2349 <p>
2421 <p>
2350 Returns 0 if all files are successfully added.
2422 Returns 0 if all files are successfully added.
2351 </p>
2423 </p>
2352 <p>
2424 <p>
2353 options ([+] can be repeated):
2425 options ([+] can be repeated):
2354 </p>
2426 </p>
2355 <table>
2427 <table>
2356 <tr><td>-I</td>
2428 <tr><td>-I</td>
2357 <td>--include PATTERN [+]</td>
2429 <td>--include PATTERN [+]</td>
2358 <td>include names matching the given patterns</td></tr>
2430 <td>include names matching the given patterns</td></tr>
2359 <tr><td>-X</td>
2431 <tr><td>-X</td>
2360 <td>--exclude PATTERN [+]</td>
2432 <td>--exclude PATTERN [+]</td>
2361 <td>exclude names matching the given patterns</td></tr>
2433 <td>exclude names matching the given patterns</td></tr>
2362 <tr><td>-S</td>
2434 <tr><td>-S</td>
2363 <td>--subrepos</td>
2435 <td>--subrepos</td>
2364 <td>recurse into subrepositories</td></tr>
2436 <td>recurse into subrepositories</td></tr>
2365 <tr><td>-n</td>
2437 <tr><td>-n</td>
2366 <td>--dry-run</td>
2438 <td>--dry-run</td>
2367 <td>do not perform actions, just print output</td></tr>
2439 <td>do not perform actions, just print output</td></tr>
2368 </table>
2440 </table>
2369 <p>
2441 <p>
2370 global options ([+] can be repeated):
2442 global options ([+] can be repeated):
2371 </p>
2443 </p>
2372 <table>
2444 <table>
2373 <tr><td>-R</td>
2445 <tr><td>-R</td>
2374 <td>--repository REPO</td>
2446 <td>--repository REPO</td>
2375 <td>repository root directory or name of overlay bundle file</td></tr>
2447 <td>repository root directory or name of overlay bundle file</td></tr>
2376 <tr><td></td>
2448 <tr><td></td>
2377 <td>--cwd DIR</td>
2449 <td>--cwd DIR</td>
2378 <td>change working directory</td></tr>
2450 <td>change working directory</td></tr>
2379 <tr><td>-y</td>
2451 <tr><td>-y</td>
2380 <td>--noninteractive</td>
2452 <td>--noninteractive</td>
2381 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2453 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2382 <tr><td>-q</td>
2454 <tr><td>-q</td>
2383 <td>--quiet</td>
2455 <td>--quiet</td>
2384 <td>suppress output</td></tr>
2456 <td>suppress output</td></tr>
2385 <tr><td>-v</td>
2457 <tr><td>-v</td>
2386 <td>--verbose</td>
2458 <td>--verbose</td>
2387 <td>enable additional output</td></tr>
2459 <td>enable additional output</td></tr>
2388 <tr><td></td>
2460 <tr><td></td>
2389 <td>--config CONFIG [+]</td>
2461 <td>--config CONFIG [+]</td>
2390 <td>set/override config option (use 'section.name=value')</td></tr>
2462 <td>set/override config option (use 'section.name=value')</td></tr>
2391 <tr><td></td>
2463 <tr><td></td>
2392 <td>--debug</td>
2464 <td>--debug</td>
2393 <td>enable debugging output</td></tr>
2465 <td>enable debugging output</td></tr>
2394 <tr><td></td>
2466 <tr><td></td>
2395 <td>--debugger</td>
2467 <td>--debugger</td>
2396 <td>start debugger</td></tr>
2468 <td>start debugger</td></tr>
2397 <tr><td></td>
2469 <tr><td></td>
2398 <td>--encoding ENCODE</td>
2470 <td>--encoding ENCODE</td>
2399 <td>set the charset encoding (default: ascii)</td></tr>
2471 <td>set the charset encoding (default: ascii)</td></tr>
2400 <tr><td></td>
2472 <tr><td></td>
2401 <td>--encodingmode MODE</td>
2473 <td>--encodingmode MODE</td>
2402 <td>set the charset encoding mode (default: strict)</td></tr>
2474 <td>set the charset encoding mode (default: strict)</td></tr>
2403 <tr><td></td>
2475 <tr><td></td>
2404 <td>--traceback</td>
2476 <td>--traceback</td>
2405 <td>always print a traceback on exception</td></tr>
2477 <td>always print a traceback on exception</td></tr>
2406 <tr><td></td>
2478 <tr><td></td>
2407 <td>--time</td>
2479 <td>--time</td>
2408 <td>time how long the command takes</td></tr>
2480 <td>time how long the command takes</td></tr>
2409 <tr><td></td>
2481 <tr><td></td>
2410 <td>--profile</td>
2482 <td>--profile</td>
2411 <td>print command execution profile</td></tr>
2483 <td>print command execution profile</td></tr>
2412 <tr><td></td>
2484 <tr><td></td>
2413 <td>--version</td>
2485 <td>--version</td>
2414 <td>output version information and exit</td></tr>
2486 <td>output version information and exit</td></tr>
2415 <tr><td>-h</td>
2487 <tr><td>-h</td>
2416 <td>--help</td>
2488 <td>--help</td>
2417 <td>display help and exit</td></tr>
2489 <td>display help and exit</td></tr>
2418 <tr><td></td>
2490 <tr><td></td>
2419 <td>--hidden</td>
2491 <td>--hidden</td>
2420 <td>consider hidden changesets</td></tr>
2492 <td>consider hidden changesets</td></tr>
2421 </table>
2493 </table>
2422
2494
2423 </div>
2495 </div>
2424 </div>
2496 </div>
2425 </div>
2497 </div>
2426
2498
2427 <script type="text/javascript">process_dates()</script>
2499 <script type="text/javascript">process_dates()</script>
2428
2500
2429
2501
2430 </body>
2502 </body>
2431 </html>
2503 </html>
2432
2504
2433
2505
2434 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2506 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2435 200 Script output follows
2507 200 Script output follows
2436
2508
2437 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2509 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2438 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2510 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2439 <head>
2511 <head>
2440 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2512 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2441 <meta name="robots" content="index, nofollow" />
2513 <meta name="robots" content="index, nofollow" />
2442 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2514 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2443 <script type="text/javascript" src="/static/mercurial.js"></script>
2515 <script type="text/javascript" src="/static/mercurial.js"></script>
2444
2516
2445 <title>Help: remove</title>
2517 <title>Help: remove</title>
2446 </head>
2518 </head>
2447 <body>
2519 <body>
2448
2520
2449 <div class="container">
2521 <div class="container">
2450 <div class="menu">
2522 <div class="menu">
2451 <div class="logo">
2523 <div class="logo">
2452 <a href="https://mercurial-scm.org/">
2524 <a href="https://mercurial-scm.org/">
2453 <img src="/static/hglogo.png" alt="mercurial" /></a>
2525 <img src="/static/hglogo.png" alt="mercurial" /></a>
2454 </div>
2526 </div>
2455 <ul>
2527 <ul>
2456 <li><a href="/shortlog">log</a></li>
2528 <li><a href="/shortlog">log</a></li>
2457 <li><a href="/graph">graph</a></li>
2529 <li><a href="/graph">graph</a></li>
2458 <li><a href="/tags">tags</a></li>
2530 <li><a href="/tags">tags</a></li>
2459 <li><a href="/bookmarks">bookmarks</a></li>
2531 <li><a href="/bookmarks">bookmarks</a></li>
2460 <li><a href="/branches">branches</a></li>
2532 <li><a href="/branches">branches</a></li>
2461 </ul>
2533 </ul>
2462 <ul>
2534 <ul>
2463 <li class="active"><a href="/help">help</a></li>
2535 <li class="active"><a href="/help">help</a></li>
2464 </ul>
2536 </ul>
2465 </div>
2537 </div>
2466
2538
2467 <div class="main">
2539 <div class="main">
2468 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2540 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2469 <h3>Help: remove</h3>
2541 <h3>Help: remove</h3>
2470
2542
2471 <form class="search" action="/log">
2543 <form class="search" action="/log">
2472
2544
2473 <p><input name="rev" id="search1" type="text" size="30" /></p>
2545 <p><input name="rev" id="search1" type="text" size="30" /></p>
2474 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2546 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2475 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2547 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2476 </form>
2548 </form>
2477 <div id="doc">
2549 <div id="doc">
2478 <p>
2550 <p>
2479 hg remove [OPTION]... FILE...
2551 hg remove [OPTION]... FILE...
2480 </p>
2552 </p>
2481 <p>
2553 <p>
2482 aliases: rm
2554 aliases: rm
2483 </p>
2555 </p>
2484 <p>
2556 <p>
2485 remove the specified files on the next commit
2557 remove the specified files on the next commit
2486 </p>
2558 </p>
2487 <p>
2559 <p>
2488 Schedule the indicated files for removal from the current branch.
2560 Schedule the indicated files for removal from the current branch.
2489 </p>
2561 </p>
2490 <p>
2562 <p>
2491 This command schedules the files to be removed at the next commit.
2563 This command schedules the files to be removed at the next commit.
2492 To undo a remove before that, see 'hg revert'. To undo added
2564 To undo a remove before that, see 'hg revert'. To undo added
2493 files, see 'hg forget'.
2565 files, see 'hg forget'.
2494 </p>
2566 </p>
2495 <p>
2567 <p>
2496 -A/--after can be used to remove only files that have already
2568 -A/--after can be used to remove only files that have already
2497 been deleted, -f/--force can be used to force deletion, and -Af
2569 been deleted, -f/--force can be used to force deletion, and -Af
2498 can be used to remove files from the next revision without
2570 can be used to remove files from the next revision without
2499 deleting them from the working directory.
2571 deleting them from the working directory.
2500 </p>
2572 </p>
2501 <p>
2573 <p>
2502 The following table details the behavior of remove for different
2574 The following table details the behavior of remove for different
2503 file states (columns) and option combinations (rows). The file
2575 file states (columns) and option combinations (rows). The file
2504 states are Added [A], Clean [C], Modified [M] and Missing [!]
2576 states are Added [A], Clean [C], Modified [M] and Missing [!]
2505 (as reported by 'hg status'). The actions are Warn, Remove
2577 (as reported by 'hg status'). The actions are Warn, Remove
2506 (from branch) and Delete (from disk):
2578 (from branch) and Delete (from disk):
2507 </p>
2579 </p>
2508 <table>
2580 <table>
2509 <tr><td>opt/state</td>
2581 <tr><td>opt/state</td>
2510 <td>A</td>
2582 <td>A</td>
2511 <td>C</td>
2583 <td>C</td>
2512 <td>M</td>
2584 <td>M</td>
2513 <td>!</td></tr>
2585 <td>!</td></tr>
2514 <tr><td>none</td>
2586 <tr><td>none</td>
2515 <td>W</td>
2587 <td>W</td>
2516 <td>RD</td>
2588 <td>RD</td>
2517 <td>W</td>
2589 <td>W</td>
2518 <td>R</td></tr>
2590 <td>R</td></tr>
2519 <tr><td>-f</td>
2591 <tr><td>-f</td>
2520 <td>R</td>
2592 <td>R</td>
2521 <td>RD</td>
2593 <td>RD</td>
2522 <td>RD</td>
2594 <td>RD</td>
2523 <td>R</td></tr>
2595 <td>R</td></tr>
2524 <tr><td>-A</td>
2596 <tr><td>-A</td>
2525 <td>W</td>
2597 <td>W</td>
2526 <td>W</td>
2598 <td>W</td>
2527 <td>W</td>
2599 <td>W</td>
2528 <td>R</td></tr>
2600 <td>R</td></tr>
2529 <tr><td>-Af</td>
2601 <tr><td>-Af</td>
2530 <td>R</td>
2602 <td>R</td>
2531 <td>R</td>
2603 <td>R</td>
2532 <td>R</td>
2604 <td>R</td>
2533 <td>R</td></tr>
2605 <td>R</td></tr>
2534 </table>
2606 </table>
2535 <p>
2607 <p>
2536 <b>Note:</b>
2608 <b>Note:</b>
2537 </p>
2609 </p>
2538 <p>
2610 <p>
2539 'hg remove' never deletes files in Added [A] state from the
2611 'hg remove' never deletes files in Added [A] state from the
2540 working directory, not even if &quot;--force&quot; is specified.
2612 working directory, not even if &quot;--force&quot; is specified.
2541 </p>
2613 </p>
2542 <p>
2614 <p>
2543 Returns 0 on success, 1 if any warnings encountered.
2615 Returns 0 on success, 1 if any warnings encountered.
2544 </p>
2616 </p>
2545 <p>
2617 <p>
2546 options ([+] can be repeated):
2618 options ([+] can be repeated):
2547 </p>
2619 </p>
2548 <table>
2620 <table>
2549 <tr><td>-A</td>
2621 <tr><td>-A</td>
2550 <td>--after</td>
2622 <td>--after</td>
2551 <td>record delete for missing files</td></tr>
2623 <td>record delete for missing files</td></tr>
2552 <tr><td>-f</td>
2624 <tr><td>-f</td>
2553 <td>--force</td>
2625 <td>--force</td>
2554 <td>forget added files, delete modified files</td></tr>
2626 <td>forget added files, delete modified files</td></tr>
2555 <tr><td>-S</td>
2627 <tr><td>-S</td>
2556 <td>--subrepos</td>
2628 <td>--subrepos</td>
2557 <td>recurse into subrepositories</td></tr>
2629 <td>recurse into subrepositories</td></tr>
2558 <tr><td>-I</td>
2630 <tr><td>-I</td>
2559 <td>--include PATTERN [+]</td>
2631 <td>--include PATTERN [+]</td>
2560 <td>include names matching the given patterns</td></tr>
2632 <td>include names matching the given patterns</td></tr>
2561 <tr><td>-X</td>
2633 <tr><td>-X</td>
2562 <td>--exclude PATTERN [+]</td>
2634 <td>--exclude PATTERN [+]</td>
2563 <td>exclude names matching the given patterns</td></tr>
2635 <td>exclude names matching the given patterns</td></tr>
2564 </table>
2636 </table>
2565 <p>
2637 <p>
2566 global options ([+] can be repeated):
2638 global options ([+] can be repeated):
2567 </p>
2639 </p>
2568 <table>
2640 <table>
2569 <tr><td>-R</td>
2641 <tr><td>-R</td>
2570 <td>--repository REPO</td>
2642 <td>--repository REPO</td>
2571 <td>repository root directory or name of overlay bundle file</td></tr>
2643 <td>repository root directory or name of overlay bundle file</td></tr>
2572 <tr><td></td>
2644 <tr><td></td>
2573 <td>--cwd DIR</td>
2645 <td>--cwd DIR</td>
2574 <td>change working directory</td></tr>
2646 <td>change working directory</td></tr>
2575 <tr><td>-y</td>
2647 <tr><td>-y</td>
2576 <td>--noninteractive</td>
2648 <td>--noninteractive</td>
2577 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2649 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2578 <tr><td>-q</td>
2650 <tr><td>-q</td>
2579 <td>--quiet</td>
2651 <td>--quiet</td>
2580 <td>suppress output</td></tr>
2652 <td>suppress output</td></tr>
2581 <tr><td>-v</td>
2653 <tr><td>-v</td>
2582 <td>--verbose</td>
2654 <td>--verbose</td>
2583 <td>enable additional output</td></tr>
2655 <td>enable additional output</td></tr>
2584 <tr><td></td>
2656 <tr><td></td>
2585 <td>--config CONFIG [+]</td>
2657 <td>--config CONFIG [+]</td>
2586 <td>set/override config option (use 'section.name=value')</td></tr>
2658 <td>set/override config option (use 'section.name=value')</td></tr>
2587 <tr><td></td>
2659 <tr><td></td>
2588 <td>--debug</td>
2660 <td>--debug</td>
2589 <td>enable debugging output</td></tr>
2661 <td>enable debugging output</td></tr>
2590 <tr><td></td>
2662 <tr><td></td>
2591 <td>--debugger</td>
2663 <td>--debugger</td>
2592 <td>start debugger</td></tr>
2664 <td>start debugger</td></tr>
2593 <tr><td></td>
2665 <tr><td></td>
2594 <td>--encoding ENCODE</td>
2666 <td>--encoding ENCODE</td>
2595 <td>set the charset encoding (default: ascii)</td></tr>
2667 <td>set the charset encoding (default: ascii)</td></tr>
2596 <tr><td></td>
2668 <tr><td></td>
2597 <td>--encodingmode MODE</td>
2669 <td>--encodingmode MODE</td>
2598 <td>set the charset encoding mode (default: strict)</td></tr>
2670 <td>set the charset encoding mode (default: strict)</td></tr>
2599 <tr><td></td>
2671 <tr><td></td>
2600 <td>--traceback</td>
2672 <td>--traceback</td>
2601 <td>always print a traceback on exception</td></tr>
2673 <td>always print a traceback on exception</td></tr>
2602 <tr><td></td>
2674 <tr><td></td>
2603 <td>--time</td>
2675 <td>--time</td>
2604 <td>time how long the command takes</td></tr>
2676 <td>time how long the command takes</td></tr>
2605 <tr><td></td>
2677 <tr><td></td>
2606 <td>--profile</td>
2678 <td>--profile</td>
2607 <td>print command execution profile</td></tr>
2679 <td>print command execution profile</td></tr>
2608 <tr><td></td>
2680 <tr><td></td>
2609 <td>--version</td>
2681 <td>--version</td>
2610 <td>output version information and exit</td></tr>
2682 <td>output version information and exit</td></tr>
2611 <tr><td>-h</td>
2683 <tr><td>-h</td>
2612 <td>--help</td>
2684 <td>--help</td>
2613 <td>display help and exit</td></tr>
2685 <td>display help and exit</td></tr>
2614 <tr><td></td>
2686 <tr><td></td>
2615 <td>--hidden</td>
2687 <td>--hidden</td>
2616 <td>consider hidden changesets</td></tr>
2688 <td>consider hidden changesets</td></tr>
2617 </table>
2689 </table>
2618
2690
2619 </div>
2691 </div>
2620 </div>
2692 </div>
2621 </div>
2693 </div>
2622
2694
2623 <script type="text/javascript">process_dates()</script>
2695 <script type="text/javascript">process_dates()</script>
2624
2696
2625
2697
2626 </body>
2698 </body>
2627 </html>
2699 </html>
2628
2700
2629
2701
2630 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2702 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2631 200 Script output follows
2703 200 Script output follows
2632
2704
2633 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2705 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2634 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2706 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2635 <head>
2707 <head>
2636 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2708 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2637 <meta name="robots" content="index, nofollow" />
2709 <meta name="robots" content="index, nofollow" />
2638 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2710 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2639 <script type="text/javascript" src="/static/mercurial.js"></script>
2711 <script type="text/javascript" src="/static/mercurial.js"></script>
2640
2712
2641 <title>Help: revisions</title>
2713 <title>Help: revisions</title>
2642 </head>
2714 </head>
2643 <body>
2715 <body>
2644
2716
2645 <div class="container">
2717 <div class="container">
2646 <div class="menu">
2718 <div class="menu">
2647 <div class="logo">
2719 <div class="logo">
2648 <a href="https://mercurial-scm.org/">
2720 <a href="https://mercurial-scm.org/">
2649 <img src="/static/hglogo.png" alt="mercurial" /></a>
2721 <img src="/static/hglogo.png" alt="mercurial" /></a>
2650 </div>
2722 </div>
2651 <ul>
2723 <ul>
2652 <li><a href="/shortlog">log</a></li>
2724 <li><a href="/shortlog">log</a></li>
2653 <li><a href="/graph">graph</a></li>
2725 <li><a href="/graph">graph</a></li>
2654 <li><a href="/tags">tags</a></li>
2726 <li><a href="/tags">tags</a></li>
2655 <li><a href="/bookmarks">bookmarks</a></li>
2727 <li><a href="/bookmarks">bookmarks</a></li>
2656 <li><a href="/branches">branches</a></li>
2728 <li><a href="/branches">branches</a></li>
2657 </ul>
2729 </ul>
2658 <ul>
2730 <ul>
2659 <li class="active"><a href="/help">help</a></li>
2731 <li class="active"><a href="/help">help</a></li>
2660 </ul>
2732 </ul>
2661 </div>
2733 </div>
2662
2734
2663 <div class="main">
2735 <div class="main">
2664 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2736 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2665 <h3>Help: revisions</h3>
2737 <h3>Help: revisions</h3>
2666
2738
2667 <form class="search" action="/log">
2739 <form class="search" action="/log">
2668
2740
2669 <p><input name="rev" id="search1" type="text" size="30" /></p>
2741 <p><input name="rev" id="search1" type="text" size="30" /></p>
2670 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2742 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2671 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2743 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2672 </form>
2744 </form>
2673 <div id="doc">
2745 <div id="doc">
2674 <h1>Specifying Single Revisions</h1>
2746 <h1>Specifying Single Revisions</h1>
2675 <p>
2747 <p>
2676 Mercurial supports several ways to specify individual revisions.
2748 Mercurial supports several ways to specify individual revisions.
2677 </p>
2749 </p>
2678 <p>
2750 <p>
2679 A plain integer is treated as a revision number. Negative integers are
2751 A plain integer is treated as a revision number. Negative integers are
2680 treated as sequential offsets from the tip, with -1 denoting the tip,
2752 treated as sequential offsets from the tip, with -1 denoting the tip,
2681 -2 denoting the revision prior to the tip, and so forth.
2753 -2 denoting the revision prior to the tip, and so forth.
2682 </p>
2754 </p>
2683 <p>
2755 <p>
2684 A 40-digit hexadecimal string is treated as a unique revision
2756 A 40-digit hexadecimal string is treated as a unique revision
2685 identifier.
2757 identifier.
2686 </p>
2758 </p>
2687 <p>
2759 <p>
2688 A hexadecimal string less than 40 characters long is treated as a
2760 A hexadecimal string less than 40 characters long is treated as a
2689 unique revision identifier and is referred to as a short-form
2761 unique revision identifier and is referred to as a short-form
2690 identifier. A short-form identifier is only valid if it is the prefix
2762 identifier. A short-form identifier is only valid if it is the prefix
2691 of exactly one full-length identifier.
2763 of exactly one full-length identifier.
2692 </p>
2764 </p>
2693 <p>
2765 <p>
2694 Any other string is treated as a bookmark, tag, or branch name. A
2766 Any other string is treated as a bookmark, tag, or branch name. A
2695 bookmark is a movable pointer to a revision. A tag is a permanent name
2767 bookmark is a movable pointer to a revision. A tag is a permanent name
2696 associated with a revision. A branch name denotes the tipmost open branch head
2768 associated with a revision. A branch name denotes the tipmost open branch head
2697 of that branch - or if they are all closed, the tipmost closed head of the
2769 of that branch - or if they are all closed, the tipmost closed head of the
2698 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2770 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2699 </p>
2771 </p>
2700 <p>
2772 <p>
2701 The reserved name &quot;tip&quot; always identifies the most recent revision.
2773 The reserved name &quot;tip&quot; always identifies the most recent revision.
2702 </p>
2774 </p>
2703 <p>
2775 <p>
2704 The reserved name &quot;null&quot; indicates the null revision. This is the
2776 The reserved name &quot;null&quot; indicates the null revision. This is the
2705 revision of an empty repository, and the parent of revision 0.
2777 revision of an empty repository, and the parent of revision 0.
2706 </p>
2778 </p>
2707 <p>
2779 <p>
2708 The reserved name &quot;.&quot; indicates the working directory parent. If no
2780 The reserved name &quot;.&quot; indicates the working directory parent. If no
2709 working directory is checked out, it is equivalent to null. If an
2781 working directory is checked out, it is equivalent to null. If an
2710 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2782 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2711 parent.
2783 parent.
2712 </p>
2784 </p>
2713
2785
2714 </div>
2786 </div>
2715 </div>
2787 </div>
2716 </div>
2788 </div>
2717
2789
2718 <script type="text/javascript">process_dates()</script>
2790 <script type="text/javascript">process_dates()</script>
2719
2791
2720
2792
2721 </body>
2793 </body>
2722 </html>
2794 </html>
2723
2795
2724
2796
2725 Sub-topic indexes rendered properly
2797 Sub-topic indexes rendered properly
2726
2798
2727 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2799 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2728 200 Script output follows
2800 200 Script output follows
2729
2801
2730 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2802 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2731 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2803 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2732 <head>
2804 <head>
2733 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2805 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2734 <meta name="robots" content="index, nofollow" />
2806 <meta name="robots" content="index, nofollow" />
2735 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2807 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2736 <script type="text/javascript" src="/static/mercurial.js"></script>
2808 <script type="text/javascript" src="/static/mercurial.js"></script>
2737
2809
2738 <title>Help: internals</title>
2810 <title>Help: internals</title>
2739 </head>
2811 </head>
2740 <body>
2812 <body>
2741
2813
2742 <div class="container">
2814 <div class="container">
2743 <div class="menu">
2815 <div class="menu">
2744 <div class="logo">
2816 <div class="logo">
2745 <a href="https://mercurial-scm.org/">
2817 <a href="https://mercurial-scm.org/">
2746 <img src="/static/hglogo.png" alt="mercurial" /></a>
2818 <img src="/static/hglogo.png" alt="mercurial" /></a>
2747 </div>
2819 </div>
2748 <ul>
2820 <ul>
2749 <li><a href="/shortlog">log</a></li>
2821 <li><a href="/shortlog">log</a></li>
2750 <li><a href="/graph">graph</a></li>
2822 <li><a href="/graph">graph</a></li>
2751 <li><a href="/tags">tags</a></li>
2823 <li><a href="/tags">tags</a></li>
2752 <li><a href="/bookmarks">bookmarks</a></li>
2824 <li><a href="/bookmarks">bookmarks</a></li>
2753 <li><a href="/branches">branches</a></li>
2825 <li><a href="/branches">branches</a></li>
2754 </ul>
2826 </ul>
2755 <ul>
2827 <ul>
2756 <li><a href="/help">help</a></li>
2828 <li><a href="/help">help</a></li>
2757 </ul>
2829 </ul>
2758 </div>
2830 </div>
2759
2831
2760 <div class="main">
2832 <div class="main">
2761 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2833 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2762 <form class="search" action="/log">
2834 <form class="search" action="/log">
2763
2835
2764 <p><input name="rev" id="search1" type="text" size="30" /></p>
2836 <p><input name="rev" id="search1" type="text" size="30" /></p>
2765 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2837 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2766 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2838 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2767 </form>
2839 </form>
2768 <table class="bigtable">
2840 <table class="bigtable">
2769 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2841 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2770
2842
2771 <tr><td>
2843 <tr><td>
2772 <a href="/help/internals.bundles">
2844 <a href="/help/internals.bundles">
2773 bundles
2845 bundles
2774 </a>
2846 </a>
2775 </td><td>
2847 </td><td>
2776 container for exchange of repository data
2848 container for exchange of repository data
2777 </td></tr>
2849 </td></tr>
2778 <tr><td>
2850 <tr><td>
2779 <a href="/help/internals.changegroups">
2851 <a href="/help/internals.changegroups">
2780 changegroups
2852 changegroups
2781 </a>
2853 </a>
2782 </td><td>
2854 </td><td>
2783 representation of revlog data
2855 representation of revlog data
2784 </td></tr>
2856 </td></tr>
2785 <tr><td>
2857 <tr><td>
2786 <a href="/help/internals.requirements">
2858 <a href="/help/internals.requirements">
2787 requirements
2859 requirements
2788 </a>
2860 </a>
2789 </td><td>
2861 </td><td>
2790 repository requirements
2862 repository requirements
2791 </td></tr>
2863 </td></tr>
2792 <tr><td>
2864 <tr><td>
2793 <a href="/help/internals.revlogs">
2865 <a href="/help/internals.revlogs">
2794 revlogs
2866 revlogs
2795 </a>
2867 </a>
2796 </td><td>
2868 </td><td>
2797 revision storage mechanism
2869 revision storage mechanism
2798 </td></tr>
2870 </td></tr>
2799
2871
2800
2872
2801
2873
2802
2874
2803
2875
2804 </table>
2876 </table>
2805 </div>
2877 </div>
2806 </div>
2878 </div>
2807
2879
2808 <script type="text/javascript">process_dates()</script>
2880 <script type="text/javascript">process_dates()</script>
2809
2881
2810
2882
2811 </body>
2883 </body>
2812 </html>
2884 </html>
2813
2885
2814
2886
2815 Sub-topic topics rendered properly
2887 Sub-topic topics rendered properly
2816
2888
2817 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2889 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2818 200 Script output follows
2890 200 Script output follows
2819
2891
2820 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2892 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2821 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2893 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2822 <head>
2894 <head>
2823 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2895 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2824 <meta name="robots" content="index, nofollow" />
2896 <meta name="robots" content="index, nofollow" />
2825 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2897 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2826 <script type="text/javascript" src="/static/mercurial.js"></script>
2898 <script type="text/javascript" src="/static/mercurial.js"></script>
2827
2899
2828 <title>Help: internals.changegroups</title>
2900 <title>Help: internals.changegroups</title>
2829 </head>
2901 </head>
2830 <body>
2902 <body>
2831
2903
2832 <div class="container">
2904 <div class="container">
2833 <div class="menu">
2905 <div class="menu">
2834 <div class="logo">
2906 <div class="logo">
2835 <a href="https://mercurial-scm.org/">
2907 <a href="https://mercurial-scm.org/">
2836 <img src="/static/hglogo.png" alt="mercurial" /></a>
2908 <img src="/static/hglogo.png" alt="mercurial" /></a>
2837 </div>
2909 </div>
2838 <ul>
2910 <ul>
2839 <li><a href="/shortlog">log</a></li>
2911 <li><a href="/shortlog">log</a></li>
2840 <li><a href="/graph">graph</a></li>
2912 <li><a href="/graph">graph</a></li>
2841 <li><a href="/tags">tags</a></li>
2913 <li><a href="/tags">tags</a></li>
2842 <li><a href="/bookmarks">bookmarks</a></li>
2914 <li><a href="/bookmarks">bookmarks</a></li>
2843 <li><a href="/branches">branches</a></li>
2915 <li><a href="/branches">branches</a></li>
2844 </ul>
2916 </ul>
2845 <ul>
2917 <ul>
2846 <li class="active"><a href="/help">help</a></li>
2918 <li class="active"><a href="/help">help</a></li>
2847 </ul>
2919 </ul>
2848 </div>
2920 </div>
2849
2921
2850 <div class="main">
2922 <div class="main">
2851 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2923 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2852 <h3>Help: internals.changegroups</h3>
2924 <h3>Help: internals.changegroups</h3>
2853
2925
2854 <form class="search" action="/log">
2926 <form class="search" action="/log">
2855
2927
2856 <p><input name="rev" id="search1" type="text" size="30" /></p>
2928 <p><input name="rev" id="search1" type="text" size="30" /></p>
2857 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2929 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2858 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2930 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2859 </form>
2931 </form>
2860 <div id="doc">
2932 <div id="doc">
2861 <h1>representation of revlog data</h1>
2933 <h1>representation of revlog data</h1>
2862 <h2>Changegroups</h2>
2934 <h2>Changegroups</h2>
2863 <p>
2935 <p>
2864 Changegroups are representations of repository revlog data, specifically
2936 Changegroups are representations of repository revlog data, specifically
2865 the changelog, manifest, and filelogs.
2937 the changelog, manifest, and filelogs.
2866 </p>
2938 </p>
2867 <p>
2939 <p>
2868 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2940 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2869 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2941 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2870 the only difference being a header on entries in the changeset
2942 the only difference being a header on entries in the changeset
2871 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2943 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2872 includes revlog flags in the delta header.
2944 includes revlog flags in the delta header.
2873 </p>
2945 </p>
2874 <p>
2946 <p>
2875 Changegroups consists of 3 logical segments:
2947 Changegroups consists of 3 logical segments:
2876 </p>
2948 </p>
2877 <pre>
2949 <pre>
2878 +---------------------------------+
2950 +---------------------------------+
2879 | | | |
2951 | | | |
2880 | changeset | manifest | filelogs |
2952 | changeset | manifest | filelogs |
2881 | | | |
2953 | | | |
2882 +---------------------------------+
2954 +---------------------------------+
2883 </pre>
2955 </pre>
2884 <p>
2956 <p>
2885 The principle building block of each segment is a *chunk*. A *chunk*
2957 The principle building block of each segment is a *chunk*. A *chunk*
2886 is a framed piece of data:
2958 is a framed piece of data:
2887 </p>
2959 </p>
2888 <pre>
2960 <pre>
2889 +---------------------------------------+
2961 +---------------------------------------+
2890 | | |
2962 | | |
2891 | length | data |
2963 | length | data |
2892 | (32 bits) | &lt;length&gt; bytes |
2964 | (32 bits) | &lt;length&gt; bytes |
2893 | | |
2965 | | |
2894 +---------------------------------------+
2966 +---------------------------------------+
2895 </pre>
2967 </pre>
2896 <p>
2968 <p>
2897 Each chunk starts with a 32-bit big-endian signed integer indicating
2969 Each chunk starts with a 32-bit big-endian signed integer indicating
2898 the length of the raw data that follows.
2970 the length of the raw data that follows.
2899 </p>
2971 </p>
2900 <p>
2972 <p>
2901 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2973 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2902 call this an *empty chunk*.
2974 call this an *empty chunk*.
2903 </p>
2975 </p>
2904 <h3>Delta Groups</h3>
2976 <h3>Delta Groups</h3>
2905 <p>
2977 <p>
2906 A *delta group* expresses the content of a revlog as a series of deltas,
2978 A *delta group* expresses the content of a revlog as a series of deltas,
2907 or patches against previous revisions.
2979 or patches against previous revisions.
2908 </p>
2980 </p>
2909 <p>
2981 <p>
2910 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2982 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2911 to signal the end of the delta group:
2983 to signal the end of the delta group:
2912 </p>
2984 </p>
2913 <pre>
2985 <pre>
2914 +------------------------------------------------------------------------+
2986 +------------------------------------------------------------------------+
2915 | | | | | |
2987 | | | | | |
2916 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2988 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2917 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2989 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2918 | | | | | |
2990 | | | | | |
2919 +------------------------------------------------------------+-----------+
2991 +------------------------------------------------------------+-----------+
2920 </pre>
2992 </pre>
2921 <p>
2993 <p>
2922 Each *chunk*'s data consists of the following:
2994 Each *chunk*'s data consists of the following:
2923 </p>
2995 </p>
2924 <pre>
2996 <pre>
2925 +-----------------------------------------+
2997 +-----------------------------------------+
2926 | | | |
2998 | | | |
2927 | delta header | mdiff header | delta |
2999 | delta header | mdiff header | delta |
2928 | (various) | (12 bytes) | (various) |
3000 | (various) | (12 bytes) | (various) |
2929 | | | |
3001 | | | |
2930 +-----------------------------------------+
3002 +-----------------------------------------+
2931 </pre>
3003 </pre>
2932 <p>
3004 <p>
2933 The *length* field is the byte length of the remaining 3 logical pieces
3005 The *length* field is the byte length of the remaining 3 logical pieces
2934 of data. The *delta* is a diff from an existing entry in the changelog.
3006 of data. The *delta* is a diff from an existing entry in the changelog.
2935 </p>
3007 </p>
2936 <p>
3008 <p>
2937 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3009 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2938 &quot;3&quot; of the changegroup format.
3010 &quot;3&quot; of the changegroup format.
2939 </p>
3011 </p>
2940 <p>
3012 <p>
2941 Version 1:
3013 Version 1:
2942 </p>
3014 </p>
2943 <pre>
3015 <pre>
2944 +------------------------------------------------------+
3016 +------------------------------------------------------+
2945 | | | | |
3017 | | | | |
2946 | node | p1 node | p2 node | link node |
3018 | node | p1 node | p2 node | link node |
2947 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3019 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2948 | | | | |
3020 | | | | |
2949 +------------------------------------------------------+
3021 +------------------------------------------------------+
2950 </pre>
3022 </pre>
2951 <p>
3023 <p>
2952 Version 2:
3024 Version 2:
2953 </p>
3025 </p>
2954 <pre>
3026 <pre>
2955 +------------------------------------------------------------------+
3027 +------------------------------------------------------------------+
2956 | | | | | |
3028 | | | | | |
2957 | node | p1 node | p2 node | base node | link node |
3029 | node | p1 node | p2 node | base node | link node |
2958 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3030 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2959 | | | | | |
3031 | | | | | |
2960 +------------------------------------------------------------------+
3032 +------------------------------------------------------------------+
2961 </pre>
3033 </pre>
2962 <p>
3034 <p>
2963 Version 3:
3035 Version 3:
2964 </p>
3036 </p>
2965 <pre>
3037 <pre>
2966 +------------------------------------------------------------------------------+
3038 +------------------------------------------------------------------------------+
2967 | | | | | | |
3039 | | | | | | |
2968 | node | p1 node | p2 node | base node | link node | flags |
3040 | node | p1 node | p2 node | base node | link node | flags |
2969 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3041 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2970 | | | | | | |
3042 | | | | | | |
2971 +------------------------------------------------------------------------------+
3043 +------------------------------------------------------------------------------+
2972 </pre>
3044 </pre>
2973 <p>
3045 <p>
2974 The *mdiff header* consists of 3 32-bit big-endian signed integers
3046 The *mdiff header* consists of 3 32-bit big-endian signed integers
2975 describing offsets at which to apply the following delta content:
3047 describing offsets at which to apply the following delta content:
2976 </p>
3048 </p>
2977 <pre>
3049 <pre>
2978 +-------------------------------------+
3050 +-------------------------------------+
2979 | | | |
3051 | | | |
2980 | offset | old length | new length |
3052 | offset | old length | new length |
2981 | (32 bits) | (32 bits) | (32 bits) |
3053 | (32 bits) | (32 bits) | (32 bits) |
2982 | | | |
3054 | | | |
2983 +-------------------------------------+
3055 +-------------------------------------+
2984 </pre>
3056 </pre>
2985 <p>
3057 <p>
2986 In version 1, the delta is always applied against the previous node from
3058 In version 1, the delta is always applied against the previous node from
2987 the changegroup or the first parent if this is the first entry in the
3059 the changegroup or the first parent if this is the first entry in the
2988 changegroup.
3060 changegroup.
2989 </p>
3061 </p>
2990 <p>
3062 <p>
2991 In version 2, the delta base node is encoded in the entry in the
3063 In version 2, the delta base node is encoded in the entry in the
2992 changegroup. This allows the delta to be expressed against any parent,
3064 changegroup. This allows the delta to be expressed against any parent,
2993 which can result in smaller deltas and more efficient encoding of data.
3065 which can result in smaller deltas and more efficient encoding of data.
2994 </p>
3066 </p>
2995 <h3>Changeset Segment</h3>
3067 <h3>Changeset Segment</h3>
2996 <p>
3068 <p>
2997 The *changeset segment* consists of a single *delta group* holding
3069 The *changeset segment* consists of a single *delta group* holding
2998 changelog data. It is followed by an *empty chunk* to denote the
3070 changelog data. It is followed by an *empty chunk* to denote the
2999 boundary to the *manifests segment*.
3071 boundary to the *manifests segment*.
3000 </p>
3072 </p>
3001 <h3>Manifest Segment</h3>
3073 <h3>Manifest Segment</h3>
3002 <p>
3074 <p>
3003 The *manifest segment* consists of a single *delta group* holding
3075 The *manifest segment* consists of a single *delta group* holding
3004 manifest data. It is followed by an *empty chunk* to denote the boundary
3076 manifest data. It is followed by an *empty chunk* to denote the boundary
3005 to the *filelogs segment*.
3077 to the *filelogs segment*.
3006 </p>
3078 </p>
3007 <h3>Filelogs Segment</h3>
3079 <h3>Filelogs Segment</h3>
3008 <p>
3080 <p>
3009 The *filelogs* segment consists of multiple sub-segments, each
3081 The *filelogs* segment consists of multiple sub-segments, each
3010 corresponding to an individual file whose data is being described:
3082 corresponding to an individual file whose data is being described:
3011 </p>
3083 </p>
3012 <pre>
3084 <pre>
3013 +--------------------------------------+
3085 +--------------------------------------+
3014 | | | | |
3086 | | | | |
3015 | filelog0 | filelog1 | filelog2 | ... |
3087 | filelog0 | filelog1 | filelog2 | ... |
3016 | | | | |
3088 | | | | |
3017 +--------------------------------------+
3089 +--------------------------------------+
3018 </pre>
3090 </pre>
3019 <p>
3091 <p>
3020 In version &quot;3&quot; of the changegroup format, filelogs may include
3092 In version &quot;3&quot; of the changegroup format, filelogs may include
3021 directory logs when treemanifests are in use. directory logs are
3093 directory logs when treemanifests are in use. directory logs are
3022 identified by having a trailing '/' on their filename (see below).
3094 identified by having a trailing '/' on their filename (see below).
3023 </p>
3095 </p>
3024 <p>
3096 <p>
3025 The final filelog sub-segment is followed by an *empty chunk* to denote
3097 The final filelog sub-segment is followed by an *empty chunk* to denote
3026 the end of the segment and the overall changegroup.
3098 the end of the segment and the overall changegroup.
3027 </p>
3099 </p>
3028 <p>
3100 <p>
3029 Each filelog sub-segment consists of the following:
3101 Each filelog sub-segment consists of the following:
3030 </p>
3102 </p>
3031 <pre>
3103 <pre>
3032 +------------------------------------------+
3104 +------------------------------------------+
3033 | | | |
3105 | | | |
3034 | filename size | filename | delta group |
3106 | filename size | filename | delta group |
3035 | (32 bits) | (various) | (various) |
3107 | (32 bits) | (various) | (various) |
3036 | | | |
3108 | | | |
3037 +------------------------------------------+
3109 +------------------------------------------+
3038 </pre>
3110 </pre>
3039 <p>
3111 <p>
3040 That is, a *chunk* consisting of the filename (not terminated or padded)
3112 That is, a *chunk* consisting of the filename (not terminated or padded)
3041 followed by N chunks constituting the *delta group* for this file.
3113 followed by N chunks constituting the *delta group* for this file.
3042 </p>
3114 </p>
3043
3115
3044 </div>
3116 </div>
3045 </div>
3117 </div>
3046 </div>
3118 </div>
3047
3119
3048 <script type="text/javascript">process_dates()</script>
3120 <script type="text/javascript">process_dates()</script>
3049
3121
3050
3122
3051 </body>
3123 </body>
3052 </html>
3124 </html>
3053
3125
3054
3126
3055 $ killdaemons.py
3127 $ killdaemons.py
3056
3128
3057 #endif
3129 #endif
General Comments 0
You need to be logged in to leave comments. Login now