##// END OF EJS Templates
minirst: filter blocks by full path to section
Yuya Nishihara -
r39377:ca2f4dab default
parent child Browse files
Show More
@@ -1,822 +1,829
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 re
23 import re
24
24
25 from .i18n import _
25 from .i18n import _
26 from . import (
26 from . import (
27 encoding,
27 encoding,
28 pycompat,
28 pycompat,
29 url,
29 url,
30 )
30 )
31 from .utils import (
31 from .utils import (
32 stringutil,
32 stringutil,
33 )
33 )
34
34
35 def section(s):
35 def section(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 subsection(s):
38 def subsection(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 subsubsection(s):
41 def subsubsection(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 subsubsubsection(s):
44 def subsubsubsection(s):
45 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
45 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
46
46
47 def replace(text, substs):
47 def replace(text, substs):
48 '''
48 '''
49 Apply a list of (find, replace) pairs to a text.
49 Apply a list of (find, replace) pairs to a text.
50
50
51 >>> replace(b"foo bar", [(b'f', b'F'), (b'b', b'B')])
51 >>> replace(b"foo bar", [(b'f', b'F'), (b'b', b'B')])
52 'Foo Bar'
52 'Foo Bar'
53 >>> encoding.encoding = b'latin1'
53 >>> encoding.encoding = b'latin1'
54 >>> replace(b'\\x81\\\\', [(b'\\\\', b'/')])
54 >>> replace(b'\\x81\\\\', [(b'\\\\', b'/')])
55 '\\x81/'
55 '\\x81/'
56 >>> encoding.encoding = b'shiftjis'
56 >>> encoding.encoding = b'shiftjis'
57 >>> replace(b'\\x81\\\\', [(b'\\\\', b'/')])
57 >>> replace(b'\\x81\\\\', [(b'\\\\', b'/')])
58 '\\x81\\\\'
58 '\\x81\\\\'
59 '''
59 '''
60
60
61 # some character encodings (cp932 for Japanese, at least) use
61 # some character encodings (cp932 for Japanese, at least) use
62 # ASCII characters other than control/alphabet/digit as a part of
62 # ASCII characters other than control/alphabet/digit as a part of
63 # multi-bytes characters, so direct replacing with such characters
63 # multi-bytes characters, so direct replacing with such characters
64 # on strings in local encoding causes invalid byte sequences.
64 # on strings in local encoding causes invalid byte sequences.
65 utext = text.decode(pycompat.sysstr(encoding.encoding))
65 utext = text.decode(pycompat.sysstr(encoding.encoding))
66 for f, t in substs:
66 for f, t in substs:
67 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
67 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
68 return utext.encode(pycompat.sysstr(encoding.encoding))
68 return utext.encode(pycompat.sysstr(encoding.encoding))
69
69
70 _blockre = re.compile(br"\n(?:\s*\n)+")
70 _blockre = re.compile(br"\n(?:\s*\n)+")
71
71
72 def findblocks(text):
72 def findblocks(text):
73 """Find continuous blocks of lines in text.
73 """Find continuous blocks of lines in text.
74
74
75 Returns a list of dictionaries representing the blocks. Each block
75 Returns a list of dictionaries representing the blocks. Each block
76 has an 'indent' field and a 'lines' field.
76 has an 'indent' field and a 'lines' field.
77 """
77 """
78 blocks = []
78 blocks = []
79 for b in _blockre.split(text.lstrip('\n').rstrip()):
79 for b in _blockre.split(text.lstrip('\n').rstrip()):
80 lines = b.splitlines()
80 lines = b.splitlines()
81 if lines:
81 if lines:
82 indent = min((len(l) - len(l.lstrip())) for l in lines)
82 indent = min((len(l) - len(l.lstrip())) for l in lines)
83 lines = [l[indent:] for l in lines]
83 lines = [l[indent:] for l in lines]
84 blocks.append({'indent': indent, 'lines': lines})
84 blocks.append({'indent': indent, 'lines': lines})
85 return blocks
85 return blocks
86
86
87 def findliteralblocks(blocks):
87 def findliteralblocks(blocks):
88 """Finds literal blocks and adds a 'type' field to the blocks.
88 """Finds literal blocks and adds a 'type' field to the blocks.
89
89
90 Literal blocks are given the type 'literal', all other blocks are
90 Literal blocks are given the type 'literal', all other blocks are
91 given type the 'paragraph'.
91 given type the 'paragraph'.
92 """
92 """
93 i = 0
93 i = 0
94 while i < len(blocks):
94 while i < len(blocks):
95 # Searching for a block that looks like this:
95 # Searching for a block that looks like this:
96 #
96 #
97 # +------------------------------+
97 # +------------------------------+
98 # | paragraph |
98 # | paragraph |
99 # | (ends with "::") |
99 # | (ends with "::") |
100 # +------------------------------+
100 # +------------------------------+
101 # +---------------------------+
101 # +---------------------------+
102 # | indented literal block |
102 # | indented literal block |
103 # +---------------------------+
103 # +---------------------------+
104 blocks[i]['type'] = 'paragraph'
104 blocks[i]['type'] = 'paragraph'
105 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
105 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
106 indent = blocks[i]['indent']
106 indent = blocks[i]['indent']
107 adjustment = blocks[i + 1]['indent'] - indent
107 adjustment = blocks[i + 1]['indent'] - indent
108
108
109 if blocks[i]['lines'] == ['::']:
109 if blocks[i]['lines'] == ['::']:
110 # Expanded form: remove block
110 # Expanded form: remove block
111 del blocks[i]
111 del blocks[i]
112 i -= 1
112 i -= 1
113 elif blocks[i]['lines'][-1].endswith(' ::'):
113 elif blocks[i]['lines'][-1].endswith(' ::'):
114 # Partially minimized form: remove space and both
114 # Partially minimized form: remove space and both
115 # colons.
115 # colons.
116 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
116 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
117 elif len(blocks[i]['lines']) == 1 and \
117 elif len(blocks[i]['lines']) == 1 and \
118 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
118 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
119 blocks[i]['lines'][0].find(' ', 3) == -1:
119 blocks[i]['lines'][0].find(' ', 3) == -1:
120 # directive on its own line, not a literal block
120 # directive on its own line, not a literal block
121 i += 1
121 i += 1
122 continue
122 continue
123 else:
123 else:
124 # Fully minimized form: remove just one colon.
124 # Fully minimized form: remove just one colon.
125 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
125 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
126
126
127 # List items are formatted with a hanging indent. We must
127 # List items are formatted with a hanging indent. We must
128 # correct for this here while we still have the original
128 # correct for this here while we still have the original
129 # information on the indentation of the subsequent literal
129 # information on the indentation of the subsequent literal
130 # blocks available.
130 # blocks available.
131 m = _bulletre.match(blocks[i]['lines'][0])
131 m = _bulletre.match(blocks[i]['lines'][0])
132 if m:
132 if m:
133 indent += m.end()
133 indent += m.end()
134 adjustment -= m.end()
134 adjustment -= m.end()
135
135
136 # Mark the following indented blocks.
136 # Mark the following indented blocks.
137 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
137 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
138 blocks[i + 1]['type'] = 'literal'
138 blocks[i + 1]['type'] = 'literal'
139 blocks[i + 1]['indent'] -= adjustment
139 blocks[i + 1]['indent'] -= adjustment
140 i += 1
140 i += 1
141 i += 1
141 i += 1
142 return blocks
142 return blocks
143
143
144 _bulletre = re.compile(br'(\*|-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
144 _bulletre = re.compile(br'(\*|-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
145 _optionre = re.compile(br'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
145 _optionre = re.compile(br'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
146 br'((.*) +)(.*)$')
146 br'((.*) +)(.*)$')
147 _fieldre = re.compile(br':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
147 _fieldre = re.compile(br':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
148 _definitionre = re.compile(br'[^ ]')
148 _definitionre = re.compile(br'[^ ]')
149 _tablere = re.compile(br'(=+\s+)*=+')
149 _tablere = re.compile(br'(=+\s+)*=+')
150
150
151 def splitparagraphs(blocks):
151 def splitparagraphs(blocks):
152 """Split paragraphs into lists."""
152 """Split paragraphs into lists."""
153 # Tuples with (list type, item regexp, single line items?). Order
153 # Tuples with (list type, item regexp, single line items?). Order
154 # matters: definition lists has the least specific regexp and must
154 # matters: definition lists has the least specific regexp and must
155 # come last.
155 # come last.
156 listtypes = [('bullet', _bulletre, True),
156 listtypes = [('bullet', _bulletre, True),
157 ('option', _optionre, True),
157 ('option', _optionre, True),
158 ('field', _fieldre, True),
158 ('field', _fieldre, True),
159 ('definition', _definitionre, False)]
159 ('definition', _definitionre, False)]
160
160
161 def match(lines, i, itemre, singleline):
161 def match(lines, i, itemre, singleline):
162 """Does itemre match an item at line i?
162 """Does itemre match an item at line i?
163
163
164 A list item can be followed by an indented line or another list
164 A list item can be followed by an indented line or another list
165 item (but only if singleline is True).
165 item (but only if singleline is True).
166 """
166 """
167 line1 = lines[i]
167 line1 = lines[i]
168 line2 = i + 1 < len(lines) and lines[i + 1] or ''
168 line2 = i + 1 < len(lines) and lines[i + 1] or ''
169 if not itemre.match(line1):
169 if not itemre.match(line1):
170 return False
170 return False
171 if singleline:
171 if singleline:
172 return line2 == '' or line2[0:1] == ' ' or itemre.match(line2)
172 return line2 == '' or line2[0:1] == ' ' or itemre.match(line2)
173 else:
173 else:
174 return line2.startswith(' ')
174 return line2.startswith(' ')
175
175
176 i = 0
176 i = 0
177 while i < len(blocks):
177 while i < len(blocks):
178 if blocks[i]['type'] == 'paragraph':
178 if blocks[i]['type'] == 'paragraph':
179 lines = blocks[i]['lines']
179 lines = blocks[i]['lines']
180 for type, itemre, singleline in listtypes:
180 for type, itemre, singleline in listtypes:
181 if match(lines, 0, itemre, singleline):
181 if match(lines, 0, itemre, singleline):
182 items = []
182 items = []
183 for j, line in enumerate(lines):
183 for j, line in enumerate(lines):
184 if match(lines, j, itemre, singleline):
184 if match(lines, j, itemre, singleline):
185 items.append({'type': type, 'lines': [],
185 items.append({'type': type, 'lines': [],
186 'indent': blocks[i]['indent']})
186 'indent': blocks[i]['indent']})
187 items[-1]['lines'].append(line)
187 items[-1]['lines'].append(line)
188 blocks[i:i + 1] = items
188 blocks[i:i + 1] = items
189 break
189 break
190 i += 1
190 i += 1
191 return blocks
191 return blocks
192
192
193 _fieldwidth = 14
193 _fieldwidth = 14
194
194
195 def updatefieldlists(blocks):
195 def updatefieldlists(blocks):
196 """Find key for field lists."""
196 """Find key for field lists."""
197 i = 0
197 i = 0
198 while i < len(blocks):
198 while i < len(blocks):
199 if blocks[i]['type'] != 'field':
199 if blocks[i]['type'] != 'field':
200 i += 1
200 i += 1
201 continue
201 continue
202
202
203 j = i
203 j = i
204 while j < len(blocks) and blocks[j]['type'] == 'field':
204 while j < len(blocks) and blocks[j]['type'] == 'field':
205 m = _fieldre.match(blocks[j]['lines'][0])
205 m = _fieldre.match(blocks[j]['lines'][0])
206 key, rest = m.groups()
206 key, rest = m.groups()
207 blocks[j]['lines'][0] = rest
207 blocks[j]['lines'][0] = rest
208 blocks[j]['key'] = key
208 blocks[j]['key'] = key
209 j += 1
209 j += 1
210
210
211 i = j + 1
211 i = j + 1
212
212
213 return blocks
213 return blocks
214
214
215 def updateoptionlists(blocks):
215 def updateoptionlists(blocks):
216 i = 0
216 i = 0
217 while i < len(blocks):
217 while i < len(blocks):
218 if blocks[i]['type'] != 'option':
218 if blocks[i]['type'] != 'option':
219 i += 1
219 i += 1
220 continue
220 continue
221
221
222 optstrwidth = 0
222 optstrwidth = 0
223 j = i
223 j = i
224 while j < len(blocks) and blocks[j]['type'] == 'option':
224 while j < len(blocks) and blocks[j]['type'] == 'option':
225 m = _optionre.match(blocks[j]['lines'][0])
225 m = _optionre.match(blocks[j]['lines'][0])
226
226
227 shortoption = m.group(2)
227 shortoption = m.group(2)
228 group3 = m.group(3)
228 group3 = m.group(3)
229 longoption = group3[2:].strip()
229 longoption = group3[2:].strip()
230 desc = m.group(6).strip()
230 desc = m.group(6).strip()
231 longoptionarg = m.group(5).strip()
231 longoptionarg = m.group(5).strip()
232 blocks[j]['lines'][0] = desc
232 blocks[j]['lines'][0] = desc
233
233
234 noshortop = ''
234 noshortop = ''
235 if not shortoption:
235 if not shortoption:
236 noshortop = ' '
236 noshortop = ' '
237
237
238 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
238 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
239 ("%s--%s %s") % (noshortop, longoption,
239 ("%s--%s %s") % (noshortop, longoption,
240 longoptionarg))
240 longoptionarg))
241 opt = opt.rstrip()
241 opt = opt.rstrip()
242 blocks[j]['optstr'] = opt
242 blocks[j]['optstr'] = opt
243 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
243 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
244 j += 1
244 j += 1
245
245
246 for block in blocks[i:j]:
246 for block in blocks[i:j]:
247 block['optstrwidth'] = optstrwidth
247 block['optstrwidth'] = optstrwidth
248 i = j + 1
248 i = j + 1
249 return blocks
249 return blocks
250
250
251 def prunecontainers(blocks, keep):
251 def prunecontainers(blocks, keep):
252 """Prune unwanted containers.
252 """Prune unwanted containers.
253
253
254 The blocks must have a 'type' field, i.e., they should have been
254 The blocks must have a 'type' field, i.e., they should have been
255 run through findliteralblocks first.
255 run through findliteralblocks first.
256 """
256 """
257 pruned = []
257 pruned = []
258 i = 0
258 i = 0
259 while i + 1 < len(blocks):
259 while i + 1 < len(blocks):
260 # Searching for a block that looks like this:
260 # Searching for a block that looks like this:
261 #
261 #
262 # +-------+---------------------------+
262 # +-------+---------------------------+
263 # | ".. container ::" type |
263 # | ".. container ::" type |
264 # +---+ |
264 # +---+ |
265 # | blocks |
265 # | blocks |
266 # +-------------------------------+
266 # +-------------------------------+
267 if (blocks[i]['type'] == 'paragraph' and
267 if (blocks[i]['type'] == 'paragraph' and
268 blocks[i]['lines'][0].startswith('.. container::')):
268 blocks[i]['lines'][0].startswith('.. container::')):
269 indent = blocks[i]['indent']
269 indent = blocks[i]['indent']
270 adjustment = blocks[i + 1]['indent'] - indent
270 adjustment = blocks[i + 1]['indent'] - indent
271 containertype = blocks[i]['lines'][0][15:]
271 containertype = blocks[i]['lines'][0][15:]
272 prune = True
272 prune = True
273 for c in keep:
273 for c in keep:
274 if c in containertype.split('.'):
274 if c in containertype.split('.'):
275 prune = False
275 prune = False
276 if prune:
276 if prune:
277 pruned.append(containertype)
277 pruned.append(containertype)
278
278
279 # Always delete "..container:: type" block
279 # Always delete "..container:: type" block
280 del blocks[i]
280 del blocks[i]
281 j = i
281 j = i
282 i -= 1
282 i -= 1
283 while j < len(blocks) and blocks[j]['indent'] > indent:
283 while j < len(blocks) and blocks[j]['indent'] > indent:
284 if prune:
284 if prune:
285 del blocks[j]
285 del blocks[j]
286 else:
286 else:
287 blocks[j]['indent'] -= adjustment
287 blocks[j]['indent'] -= adjustment
288 j += 1
288 j += 1
289 i += 1
289 i += 1
290 return blocks, pruned
290 return blocks, pruned
291
291
292 _sectionre = re.compile(br"""^([-=`:.'"~^_*+#])\1+$""")
292 _sectionre = re.compile(br"""^([-=`:.'"~^_*+#])\1+$""")
293
293
294 def findtables(blocks):
294 def findtables(blocks):
295 '''Find simple tables
295 '''Find simple tables
296
296
297 Only simple one-line table elements are supported
297 Only simple one-line table elements are supported
298 '''
298 '''
299
299
300 for block in blocks:
300 for block in blocks:
301 # Searching for a block that looks like this:
301 # Searching for a block that looks like this:
302 #
302 #
303 # === ==== ===
303 # === ==== ===
304 # A B C
304 # A B C
305 # === ==== === <- optional
305 # === ==== === <- optional
306 # 1 2 3
306 # 1 2 3
307 # x y z
307 # x y z
308 # === ==== ===
308 # === ==== ===
309 if (block['type'] == 'paragraph' and
309 if (block['type'] == 'paragraph' and
310 len(block['lines']) > 2 and
310 len(block['lines']) > 2 and
311 _tablere.match(block['lines'][0]) and
311 _tablere.match(block['lines'][0]) and
312 block['lines'][0] == block['lines'][-1]):
312 block['lines'][0] == block['lines'][-1]):
313 block['type'] = 'table'
313 block['type'] = 'table'
314 block['header'] = False
314 block['header'] = False
315 div = block['lines'][0]
315 div = block['lines'][0]
316
316
317 # column markers are ASCII so we can calculate column
317 # column markers are ASCII so we can calculate column
318 # position in bytes
318 # position in bytes
319 columns = [x for x in pycompat.xrange(len(div))
319 columns = [x for x in pycompat.xrange(len(div))
320 if div[x:x + 1] == '=' and (x == 0 or
320 if div[x:x + 1] == '=' and (x == 0 or
321 div[x - 1:x] == ' ')]
321 div[x - 1:x] == ' ')]
322 rows = []
322 rows = []
323 for l in block['lines'][1:-1]:
323 for l in block['lines'][1:-1]:
324 if l == div:
324 if l == div:
325 block['header'] = True
325 block['header'] = True
326 continue
326 continue
327 row = []
327 row = []
328 # we measure columns not in bytes or characters but in
328 # we measure columns not in bytes or characters but in
329 # colwidth which makes things tricky
329 # colwidth which makes things tricky
330 pos = columns[0] # leading whitespace is bytes
330 pos = columns[0] # leading whitespace is bytes
331 for n, start in enumerate(columns):
331 for n, start in enumerate(columns):
332 if n + 1 < len(columns):
332 if n + 1 < len(columns):
333 width = columns[n + 1] - start
333 width = columns[n + 1] - start
334 v = encoding.getcols(l, pos, width) # gather columns
334 v = encoding.getcols(l, pos, width) # gather columns
335 pos += len(v) # calculate byte position of end
335 pos += len(v) # calculate byte position of end
336 row.append(v.strip())
336 row.append(v.strip())
337 else:
337 else:
338 row.append(l[pos:].strip())
338 row.append(l[pos:].strip())
339 rows.append(row)
339 rows.append(row)
340
340
341 block['table'] = rows
341 block['table'] = rows
342
342
343 return blocks
343 return blocks
344
344
345 def findsections(blocks):
345 def findsections(blocks):
346 """Finds sections.
346 """Finds sections.
347
347
348 The blocks must have a 'type' field, i.e., they should have been
348 The blocks must have a 'type' field, i.e., they should have been
349 run through findliteralblocks first.
349 run through findliteralblocks first.
350 """
350 """
351 for block in blocks:
351 for block in blocks:
352 # Searching for a block that looks like this:
352 # Searching for a block that looks like this:
353 #
353 #
354 # +------------------------------+
354 # +------------------------------+
355 # | Section title |
355 # | Section title |
356 # | ------------- |
356 # | ------------- |
357 # +------------------------------+
357 # +------------------------------+
358 if (block['type'] == 'paragraph' and
358 if (block['type'] == 'paragraph' and
359 len(block['lines']) == 2 and
359 len(block['lines']) == 2 and
360 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
360 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
361 _sectionre.match(block['lines'][1])):
361 _sectionre.match(block['lines'][1])):
362 block['underline'] = block['lines'][1][0:1]
362 block['underline'] = block['lines'][1][0:1]
363 block['type'] = 'section'
363 block['type'] = 'section'
364 del block['lines'][1]
364 del block['lines'][1]
365 return blocks
365 return blocks
366
366
367 def inlineliterals(blocks):
367 def inlineliterals(blocks):
368 substs = [('``', '"')]
368 substs = [('``', '"')]
369 for b in blocks:
369 for b in blocks:
370 if b['type'] in ('paragraph', 'section'):
370 if b['type'] in ('paragraph', 'section'):
371 b['lines'] = [replace(l, substs) for l in b['lines']]
371 b['lines'] = [replace(l, substs) for l in b['lines']]
372 return blocks
372 return blocks
373
373
374 def hgrole(blocks):
374 def hgrole(blocks):
375 substs = [(':hg:`', "'hg "), ('`', "'")]
375 substs = [(':hg:`', "'hg "), ('`', "'")]
376 for b in blocks:
376 for b in blocks:
377 if b['type'] in ('paragraph', 'section'):
377 if b['type'] in ('paragraph', 'section'):
378 # Turn :hg:`command` into "hg command". This also works
378 # Turn :hg:`command` into "hg command". This also works
379 # when there is a line break in the command and relies on
379 # when there is a line break in the command and relies on
380 # the fact that we have no stray back-quotes in the input
380 # the fact that we have no stray back-quotes in the input
381 # (run the blocks through inlineliterals first).
381 # (run the blocks through inlineliterals first).
382 b['lines'] = [replace(l, substs) for l in b['lines']]
382 b['lines'] = [replace(l, substs) for l in b['lines']]
383 return blocks
383 return blocks
384
384
385 def addmargins(blocks):
385 def addmargins(blocks):
386 """Adds empty blocks for vertical spacing.
386 """Adds empty blocks for vertical spacing.
387
387
388 This groups bullets, options, and definitions together with no vertical
388 This groups bullets, options, and definitions together with no vertical
389 space between them, and adds an empty block between all other blocks.
389 space between them, and adds an empty block between all other blocks.
390 """
390 """
391 i = 1
391 i = 1
392 while i < len(blocks):
392 while i < len(blocks):
393 if (blocks[i]['type'] == blocks[i - 1]['type'] and
393 if (blocks[i]['type'] == blocks[i - 1]['type'] and
394 blocks[i]['type'] in ('bullet', 'option', 'field')):
394 blocks[i]['type'] in ('bullet', 'option', 'field')):
395 i += 1
395 i += 1
396 elif not blocks[i - 1]['lines']:
396 elif not blocks[i - 1]['lines']:
397 # no lines in previous block, do not separate
397 # no lines in previous block, do not separate
398 i += 1
398 i += 1
399 else:
399 else:
400 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
400 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
401 i += 2
401 i += 2
402 return blocks
402 return blocks
403
403
404 def prunecomments(blocks):
404 def prunecomments(blocks):
405 """Remove comments."""
405 """Remove comments."""
406 i = 0
406 i = 0
407 while i < len(blocks):
407 while i < len(blocks):
408 b = blocks[i]
408 b = blocks[i]
409 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
409 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
410 b['lines'] == ['..']):
410 b['lines'] == ['..']):
411 del blocks[i]
411 del blocks[i]
412 if i < len(blocks) and blocks[i]['type'] == 'margin':
412 if i < len(blocks) and blocks[i]['type'] == 'margin':
413 del blocks[i]
413 del blocks[i]
414 else:
414 else:
415 i += 1
415 i += 1
416 return blocks
416 return blocks
417
417
418
418
419 def findadmonitions(blocks, admonitions=None):
419 def findadmonitions(blocks, admonitions=None):
420 """
420 """
421 Makes the type of the block an admonition block if
421 Makes the type of the block an admonition block if
422 the first line is an admonition directive
422 the first line is an admonition directive
423 """
423 """
424 admonitions = admonitions or _admonitiontitles.keys()
424 admonitions = admonitions or _admonitiontitles.keys()
425
425
426 admonitionre = re.compile(br'\.\. (%s)::' % '|'.join(sorted(admonitions)),
426 admonitionre = re.compile(br'\.\. (%s)::' % '|'.join(sorted(admonitions)),
427 flags=re.IGNORECASE)
427 flags=re.IGNORECASE)
428
428
429 i = 0
429 i = 0
430 while i < len(blocks):
430 while i < len(blocks):
431 m = admonitionre.match(blocks[i]['lines'][0])
431 m = admonitionre.match(blocks[i]['lines'][0])
432 if m:
432 if m:
433 blocks[i]['type'] = 'admonition'
433 blocks[i]['type'] = 'admonition'
434 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
434 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
435
435
436 firstline = blocks[i]['lines'][0][m.end() + 1:]
436 firstline = blocks[i]['lines'][0][m.end() + 1:]
437 if firstline:
437 if firstline:
438 blocks[i]['lines'].insert(1, ' ' + firstline)
438 blocks[i]['lines'].insert(1, ' ' + firstline)
439
439
440 blocks[i]['admonitiontitle'] = admonitiontitle
440 blocks[i]['admonitiontitle'] = admonitiontitle
441 del blocks[i]['lines'][0]
441 del blocks[i]['lines'][0]
442 i = i + 1
442 i = i + 1
443 return blocks
443 return blocks
444
444
445 _admonitiontitles = {
445 _admonitiontitles = {
446 'attention': _('Attention:'),
446 'attention': _('Attention:'),
447 'caution': _('Caution:'),
447 'caution': _('Caution:'),
448 'danger': _('!Danger!'),
448 'danger': _('!Danger!'),
449 'error': _('Error:'),
449 'error': _('Error:'),
450 'hint': _('Hint:'),
450 'hint': _('Hint:'),
451 'important': _('Important:'),
451 'important': _('Important:'),
452 'note': _('Note:'),
452 'note': _('Note:'),
453 'tip': _('Tip:'),
453 'tip': _('Tip:'),
454 'warning': _('Warning!'),
454 'warning': _('Warning!'),
455 }
455 }
456
456
457 def formatoption(block, width):
457 def formatoption(block, width):
458 desc = ' '.join(map(bytes.strip, block['lines']))
458 desc = ' '.join(map(bytes.strip, block['lines']))
459 colwidth = encoding.colwidth(block['optstr'])
459 colwidth = encoding.colwidth(block['optstr'])
460 usablewidth = width - 1
460 usablewidth = width - 1
461 hanging = block['optstrwidth']
461 hanging = block['optstrwidth']
462 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
462 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
463 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
463 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
464 return ' %s\n' % (stringutil.wrap(desc, usablewidth,
464 return ' %s\n' % (stringutil.wrap(desc, usablewidth,
465 initindent=initindent,
465 initindent=initindent,
466 hangindent=hangindent))
466 hangindent=hangindent))
467
467
468 def formatblock(block, width):
468 def formatblock(block, width):
469 """Format a block according to width."""
469 """Format a block according to width."""
470 if width <= 0:
470 if width <= 0:
471 width = 78
471 width = 78
472 indent = ' ' * block['indent']
472 indent = ' ' * block['indent']
473 if block['type'] == 'admonition':
473 if block['type'] == 'admonition':
474 admonition = _admonitiontitles[block['admonitiontitle']]
474 admonition = _admonitiontitles[block['admonitiontitle']]
475 if not block['lines']:
475 if not block['lines']:
476 return indent + admonition + '\n'
476 return indent + admonition + '\n'
477 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
477 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
478
478
479 defindent = indent + hang * ' '
479 defindent = indent + hang * ' '
480 text = ' '.join(map(bytes.strip, block['lines']))
480 text = ' '.join(map(bytes.strip, block['lines']))
481 return '%s\n%s\n' % (indent + admonition,
481 return '%s\n%s\n' % (indent + admonition,
482 stringutil.wrap(text, width=width,
482 stringutil.wrap(text, width=width,
483 initindent=defindent,
483 initindent=defindent,
484 hangindent=defindent))
484 hangindent=defindent))
485 if block['type'] == 'margin':
485 if block['type'] == 'margin':
486 return '\n'
486 return '\n'
487 if block['type'] == 'literal':
487 if block['type'] == 'literal':
488 indent += ' '
488 indent += ' '
489 return indent + ('\n' + indent).join(block['lines']) + '\n'
489 return indent + ('\n' + indent).join(block['lines']) + '\n'
490 if block['type'] == 'section':
490 if block['type'] == 'section':
491 underline = encoding.colwidth(block['lines'][0]) * block['underline']
491 underline = encoding.colwidth(block['lines'][0]) * block['underline']
492 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
492 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
493 if block['type'] == 'table':
493 if block['type'] == 'table':
494 table = block['table']
494 table = block['table']
495 # compute column widths
495 # compute column widths
496 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
496 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
497 text = ''
497 text = ''
498 span = sum(widths) + len(widths) - 1
498 span = sum(widths) + len(widths) - 1
499 indent = ' ' * block['indent']
499 indent = ' ' * block['indent']
500 hang = ' ' * (len(indent) + span - widths[-1])
500 hang = ' ' * (len(indent) + span - widths[-1])
501
501
502 for row in table:
502 for row in table:
503 l = []
503 l = []
504 for w, v in zip(widths, row):
504 for w, v in zip(widths, row):
505 pad = ' ' * (w - encoding.colwidth(v))
505 pad = ' ' * (w - encoding.colwidth(v))
506 l.append(v + pad)
506 l.append(v + pad)
507 l = ' '.join(l)
507 l = ' '.join(l)
508 l = stringutil.wrap(l, width=width,
508 l = stringutil.wrap(l, width=width,
509 initindent=indent,
509 initindent=indent,
510 hangindent=hang)
510 hangindent=hang)
511 if not text and block['header']:
511 if not text and block['header']:
512 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
512 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
513 else:
513 else:
514 text += l + "\n"
514 text += l + "\n"
515 return text
515 return text
516 if block['type'] == 'definition':
516 if block['type'] == 'definition':
517 term = indent + block['lines'][0]
517 term = indent + block['lines'][0]
518 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
518 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
519 defindent = indent + hang * ' '
519 defindent = indent + hang * ' '
520 text = ' '.join(map(bytes.strip, block['lines'][1:]))
520 text = ' '.join(map(bytes.strip, block['lines'][1:]))
521 return '%s\n%s\n' % (term, stringutil.wrap(text, width=width,
521 return '%s\n%s\n' % (term, stringutil.wrap(text, width=width,
522 initindent=defindent,
522 initindent=defindent,
523 hangindent=defindent))
523 hangindent=defindent))
524 subindent = indent
524 subindent = indent
525 if block['type'] == 'bullet':
525 if block['type'] == 'bullet':
526 if block['lines'][0].startswith('| '):
526 if block['lines'][0].startswith('| '):
527 # Remove bullet for line blocks and add no extra
527 # Remove bullet for line blocks and add no extra
528 # indentation.
528 # indentation.
529 block['lines'][0] = block['lines'][0][2:]
529 block['lines'][0] = block['lines'][0][2:]
530 else:
530 else:
531 m = _bulletre.match(block['lines'][0])
531 m = _bulletre.match(block['lines'][0])
532 subindent = indent + m.end() * ' '
532 subindent = indent + m.end() * ' '
533 elif block['type'] == 'field':
533 elif block['type'] == 'field':
534 key = block['key']
534 key = block['key']
535 subindent = indent + _fieldwidth * ' '
535 subindent = indent + _fieldwidth * ' '
536 if len(key) + 2 > _fieldwidth:
536 if len(key) + 2 > _fieldwidth:
537 # key too large, use full line width
537 # key too large, use full line width
538 key = key.ljust(width)
538 key = key.ljust(width)
539 else:
539 else:
540 # key fits within field width
540 # key fits within field width
541 key = key.ljust(_fieldwidth)
541 key = key.ljust(_fieldwidth)
542 block['lines'][0] = key + block['lines'][0]
542 block['lines'][0] = key + block['lines'][0]
543 elif block['type'] == 'option':
543 elif block['type'] == 'option':
544 return formatoption(block, width)
544 return formatoption(block, width)
545
545
546 text = ' '.join(map(bytes.strip, block['lines']))
546 text = ' '.join(map(bytes.strip, block['lines']))
547 return stringutil.wrap(text, width=width,
547 return stringutil.wrap(text, width=width,
548 initindent=indent,
548 initindent=indent,
549 hangindent=subindent) + '\n'
549 hangindent=subindent) + '\n'
550
550
551 def formathtml(blocks):
551 def formathtml(blocks):
552 """Format RST blocks as HTML"""
552 """Format RST blocks as HTML"""
553
553
554 out = []
554 out = []
555 headernest = ''
555 headernest = ''
556 listnest = []
556 listnest = []
557
557
558 def escape(s):
558 def escape(s):
559 return url.escape(s, True)
559 return url.escape(s, True)
560
560
561 def openlist(start, level):
561 def openlist(start, level):
562 if not listnest or listnest[-1][0] != start:
562 if not listnest or listnest[-1][0] != start:
563 listnest.append((start, level))
563 listnest.append((start, level))
564 out.append('<%s>\n' % start)
564 out.append('<%s>\n' % start)
565
565
566 blocks = [b for b in blocks if b['type'] != 'margin']
566 blocks = [b for b in blocks if b['type'] != 'margin']
567
567
568 for pos, b in enumerate(blocks):
568 for pos, b in enumerate(blocks):
569 btype = b['type']
569 btype = b['type']
570 level = b['indent']
570 level = b['indent']
571 lines = b['lines']
571 lines = b['lines']
572
572
573 if btype == 'admonition':
573 if btype == 'admonition':
574 admonition = escape(_admonitiontitles[b['admonitiontitle']])
574 admonition = escape(_admonitiontitles[b['admonitiontitle']])
575 text = escape(' '.join(map(bytes.strip, lines)))
575 text = escape(' '.join(map(bytes.strip, lines)))
576 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
576 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
577 elif btype == 'paragraph':
577 elif btype == 'paragraph':
578 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
578 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
579 elif btype == 'margin':
579 elif btype == 'margin':
580 pass
580 pass
581 elif btype == 'literal':
581 elif btype == 'literal':
582 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
582 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
583 elif btype == 'section':
583 elif btype == 'section':
584 i = b['underline']
584 i = b['underline']
585 if i not in headernest:
585 if i not in headernest:
586 headernest += i
586 headernest += i
587 level = headernest.index(i) + 1
587 level = headernest.index(i) + 1
588 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
588 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
589 elif btype == 'table':
589 elif btype == 'table':
590 table = b['table']
590 table = b['table']
591 out.append('<table>\n')
591 out.append('<table>\n')
592 for row in table:
592 for row in table:
593 out.append('<tr>')
593 out.append('<tr>')
594 for v in row:
594 for v in row:
595 out.append('<td>')
595 out.append('<td>')
596 out.append(escape(v))
596 out.append(escape(v))
597 out.append('</td>')
597 out.append('</td>')
598 out.append('\n')
598 out.append('\n')
599 out.pop()
599 out.pop()
600 out.append('</tr>\n')
600 out.append('</tr>\n')
601 out.append('</table>\n')
601 out.append('</table>\n')
602 elif btype == 'definition':
602 elif btype == 'definition':
603 openlist('dl', level)
603 openlist('dl', level)
604 term = escape(lines[0])
604 term = escape(lines[0])
605 text = escape(' '.join(map(bytes.strip, lines[1:])))
605 text = escape(' '.join(map(bytes.strip, lines[1:])))
606 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
606 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
607 elif btype == 'bullet':
607 elif btype == 'bullet':
608 bullet, head = lines[0].split(' ', 1)
608 bullet, head = lines[0].split(' ', 1)
609 if bullet in ('*', '-'):
609 if bullet in ('*', '-'):
610 openlist('ul', level)
610 openlist('ul', level)
611 else:
611 else:
612 openlist('ol', level)
612 openlist('ol', level)
613 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
613 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
614 elif btype == 'field':
614 elif btype == 'field':
615 openlist('dl', level)
615 openlist('dl', level)
616 key = escape(b['key'])
616 key = escape(b['key'])
617 text = escape(' '.join(map(bytes.strip, lines)))
617 text = escape(' '.join(map(bytes.strip, lines)))
618 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
618 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
619 elif btype == 'option':
619 elif btype == 'option':
620 openlist('dl', level)
620 openlist('dl', level)
621 opt = escape(b['optstr'])
621 opt = escape(b['optstr'])
622 desc = escape(' '.join(map(bytes.strip, lines)))
622 desc = escape(' '.join(map(bytes.strip, lines)))
623 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
623 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
624
624
625 # close lists if indent level of next block is lower
625 # close lists if indent level of next block is lower
626 if listnest:
626 if listnest:
627 start, level = listnest[-1]
627 start, level = listnest[-1]
628 if pos == len(blocks) - 1:
628 if pos == len(blocks) - 1:
629 out.append('</%s>\n' % start)
629 out.append('</%s>\n' % start)
630 listnest.pop()
630 listnest.pop()
631 else:
631 else:
632 nb = blocks[pos + 1]
632 nb = blocks[pos + 1]
633 ni = nb['indent']
633 ni = nb['indent']
634 if (ni < level or
634 if (ni < level or
635 (ni == level and
635 (ni == level and
636 nb['type'] not in 'definition bullet field option')):
636 nb['type'] not in 'definition bullet field option')):
637 out.append('</%s>\n' % start)
637 out.append('</%s>\n' % start)
638 listnest.pop()
638 listnest.pop()
639
639
640 return ''.join(out)
640 return ''.join(out)
641
641
642 def parse(text, indent=0, keep=None, admonitions=None):
642 def parse(text, indent=0, keep=None, admonitions=None):
643 """Parse text into a list of blocks"""
643 """Parse text into a list of blocks"""
644 pruned = []
644 pruned = []
645 blocks = findblocks(text)
645 blocks = findblocks(text)
646 for b in blocks:
646 for b in blocks:
647 b['indent'] += indent
647 b['indent'] += indent
648 blocks = findliteralblocks(blocks)
648 blocks = findliteralblocks(blocks)
649 blocks = findtables(blocks)
649 blocks = findtables(blocks)
650 blocks, pruned = prunecontainers(blocks, keep or [])
650 blocks, pruned = prunecontainers(blocks, keep or [])
651 blocks = findsections(blocks)
651 blocks = findsections(blocks)
652 blocks = inlineliterals(blocks)
652 blocks = inlineliterals(blocks)
653 blocks = hgrole(blocks)
653 blocks = hgrole(blocks)
654 blocks = splitparagraphs(blocks)
654 blocks = splitparagraphs(blocks)
655 blocks = updatefieldlists(blocks)
655 blocks = updatefieldlists(blocks)
656 blocks = updateoptionlists(blocks)
656 blocks = updateoptionlists(blocks)
657 blocks = findadmonitions(blocks, admonitions=admonitions)
657 blocks = findadmonitions(blocks, admonitions=admonitions)
658 blocks = addmargins(blocks)
658 blocks = addmargins(blocks)
659 blocks = prunecomments(blocks)
659 blocks = prunecomments(blocks)
660 return blocks, pruned
660 return blocks, pruned
661
661
662 def formatblocks(blocks, width):
662 def formatblocks(blocks, width):
663 text = ''.join(formatblock(b, width) for b in blocks)
663 text = ''.join(formatblock(b, width) for b in blocks)
664 return text
664 return text
665
665
666 def formatplain(blocks, width):
666 def formatplain(blocks, width):
667 """Format parsed blocks as plain text"""
667 """Format parsed blocks as plain text"""
668 return ''.join(formatblock(b, width) for b in blocks)
668 return ''.join(formatblock(b, width) for b in blocks)
669
669
670 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
670 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
671 """Parse and format the text according to width."""
671 """Parse and format the text according to width."""
672 blocks, pruned = parse(text, indent, keep or [])
672 blocks, pruned = parse(text, indent, keep or [])
673 if section:
673 if section:
674 blocks = filtersections(blocks, section)
674 blocks = filtersections(blocks, section)
675 if style == 'html':
675 if style == 'html':
676 return formathtml(blocks)
676 return formathtml(blocks)
677 else:
677 else:
678 return formatplain(blocks, width=width)
678 return formatplain(blocks, width=width)
679
679
680 def filtersections(blocks, section):
680 def filtersections(blocks, section):
681 """Select parsed blocks under the specified section"""
681 """Select parsed blocks under the specified section
682
683 The section name is separated by a dot, and matches the suffix of the
684 full section path.
685 """
682 parents = []
686 parents = []
683 sections = _getsections(blocks)
687 sections = _getsections(blocks)
684 blocks = []
688 blocks = []
685 i = 0
689 i = 0
686 lastparents = []
690 lastparents = []
687 synthetic = []
691 synthetic = []
688 collapse = True
692 collapse = True
689 while i < len(sections):
693 while i < len(sections):
690 name, nest, b = sections[i]
694 path, nest, b = sections[i]
691 del parents[nest:]
695 del parents[nest:]
692 parents.append(i)
696 parents.append(i)
693 if name == section:
697 if path == section or path.endswith('.' + section):
694 if lastparents != parents:
698 if lastparents != parents:
695 llen = len(lastparents)
699 llen = len(lastparents)
696 plen = len(parents)
700 plen = len(parents)
697 if llen and llen != plen:
701 if llen and llen != plen:
698 collapse = False
702 collapse = False
699 s = []
703 s = []
700 for j in pycompat.xrange(3, plen - 1):
704 for j in pycompat.xrange(3, plen - 1):
701 parent = parents[j]
705 parent = parents[j]
702 if (j >= llen or
706 if (j >= llen or
703 lastparents[j] != parent):
707 lastparents[j] != parent):
704 s.append(len(blocks))
708 s.append(len(blocks))
705 sec = sections[parent][2]
709 sec = sections[parent][2]
706 blocks.append(sec[0])
710 blocks.append(sec[0])
707 blocks.append(sec[-1])
711 blocks.append(sec[-1])
708 if s:
712 if s:
709 synthetic.append(s)
713 synthetic.append(s)
710
714
711 lastparents = parents[:]
715 lastparents = parents[:]
712 blocks.extend(b)
716 blocks.extend(b)
713
717
714 ## Also show all subnested sections
718 ## Also show all subnested sections
715 while i + 1 < len(sections) and sections[i + 1][1] > nest:
719 while i + 1 < len(sections) and sections[i + 1][1] > nest:
716 i += 1
720 i += 1
717 blocks.extend(sections[i][2])
721 blocks.extend(sections[i][2])
718 i += 1
722 i += 1
719 if collapse:
723 if collapse:
720 synthetic.reverse()
724 synthetic.reverse()
721 for s in synthetic:
725 for s in synthetic:
722 path = [blocks[syn]['lines'][0] for syn in s]
726 path = [blocks[syn]['lines'][0] for syn in s]
723 real = s[-1] + 2
727 real = s[-1] + 2
724 realline = blocks[real]['lines']
728 realline = blocks[real]['lines']
725 realline[0] = ('"%s"' %
729 realline[0] = ('"%s"' %
726 '.'.join(path + [realline[0]]).replace('"', ''))
730 '.'.join(path + [realline[0]]).replace('"', ''))
727 del blocks[s[0]:real]
731 del blocks[s[0]:real]
728
732
729 return blocks
733 return blocks
730
734
731 def _getsections(blocks):
735 def _getsections(blocks):
732 '''return a list of (section name, nesting level, blocks) tuples'''
736 '''return a list of (section path, nesting level, blocks) tuples'''
733 nest = ""
737 nest = ""
738 names = ()
734 level = 0
739 level = 0
735 secs = []
740 secs = []
736
741
737 def getname(b):
742 def getname(b):
738 if b['type'] == 'field':
743 if b['type'] == 'field':
739 x = b['key']
744 x = b['key']
740 else:
745 else:
741 x = b['lines'][0]
746 x = b['lines'][0]
742 x = encoding.lower(x).strip('"')
747 x = encoding.lower(x).strip('"')
743 if '(' in x:
748 if '(' in x:
744 x = x.split('(')[0]
749 x = x.split('(')[0]
745 return x
750 return x
746
751
747 for b in blocks:
752 for b in blocks:
748 if b['type'] == 'section':
753 if b['type'] == 'section':
749 i = b['underline']
754 i = b['underline']
750 if i not in nest:
755 if i not in nest:
751 nest += i
756 nest += i
752 level = nest.index(i) + 1
757 level = nest.index(i) + 1
753 nest = nest[:level]
758 nest = nest[:level]
754 secs.append((getname(b), level, [b]))
759 names = names[:level] + (getname(b),)
760 secs.append(('.'.join(names), level, [b]))
755 elif b['type'] in ('definition', 'field'):
761 elif b['type'] in ('definition', 'field'):
756 i = ' '
762 i = ' '
757 if i not in nest:
763 if i not in nest:
758 nest += i
764 nest += i
759 level = nest.index(i) + 1
765 level = nest.index(i) + 1
760 nest = nest[:level]
766 nest = nest[:level]
761 for i in range(1, len(secs) + 1):
767 for i in range(1, len(secs) + 1):
762 sec = secs[-i]
768 sec = secs[-i]
763 if sec[1] < level:
769 if sec[1] < level:
764 break
770 break
765 siblings = [a for a in sec[2] if a['type'] == 'definition']
771 siblings = [a for a in sec[2] if a['type'] == 'definition']
766 if siblings:
772 if siblings:
767 siblingindent = siblings[-1]['indent']
773 siblingindent = siblings[-1]['indent']
768 indent = b['indent']
774 indent = b['indent']
769 if siblingindent < indent:
775 if siblingindent < indent:
770 level += 1
776 level += 1
771 break
777 break
772 elif siblingindent == indent:
778 elif siblingindent == indent:
773 level = sec[1]
779 level = sec[1]
774 break
780 break
775 secs.append((getname(b), level, [b]))
781 names = names[:level] + (getname(b),)
782 secs.append(('.'.join(names), level, [b]))
776 else:
783 else:
777 if not secs:
784 if not secs:
778 # add an initial empty section
785 # add an initial empty section
779 secs = [('', 0, [])]
786 secs = [('', 0, [])]
780 if b['type'] != 'margin':
787 if b['type'] != 'margin':
781 pointer = 1
788 pointer = 1
782 bindent = b['indent']
789 bindent = b['indent']
783 while pointer < len(secs):
790 while pointer < len(secs):
784 section = secs[-pointer][2][0]
791 section = secs[-pointer][2][0]
785 if section['type'] != 'margin':
792 if section['type'] != 'margin':
786 sindent = section['indent']
793 sindent = section['indent']
787 if len(section['lines']) > 1:
794 if len(section['lines']) > 1:
788 sindent += len(section['lines'][1]) - \
795 sindent += len(section['lines'][1]) - \
789 len(section['lines'][1].lstrip(' '))
796 len(section['lines'][1].lstrip(' '))
790 if bindent >= sindent:
797 if bindent >= sindent:
791 break
798 break
792 pointer += 1
799 pointer += 1
793 if pointer > 1:
800 if pointer > 1:
794 blevel = secs[-pointer][1]
801 blevel = secs[-pointer][1]
795 if section['type'] != b['type']:
802 if section['type'] != b['type']:
796 blevel += 1
803 blevel += 1
797 secs.append(('', blevel, []))
804 secs.append(('', blevel, []))
798 secs[-1][2].append(b)
805 secs[-1][2].append(b)
799 return secs
806 return secs
800
807
801 def maketable(data, indent=0, header=False):
808 def maketable(data, indent=0, header=False):
802 '''Generate an RST table for the given table data as a list of lines'''
809 '''Generate an RST table for the given table data as a list of lines'''
803
810
804 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
811 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
805 indent = ' ' * indent
812 indent = ' ' * indent
806 div = indent + ' '.join('=' * w for w in widths) + '\n'
813 div = indent + ' '.join('=' * w for w in widths) + '\n'
807
814
808 out = [div]
815 out = [div]
809 for row in data:
816 for row in data:
810 l = []
817 l = []
811 for w, v in zip(widths, row):
818 for w, v in zip(widths, row):
812 if '\n' in v:
819 if '\n' in v:
813 # only remove line breaks and indentation, long lines are
820 # only remove line breaks and indentation, long lines are
814 # handled by the next tool
821 # handled by the next tool
815 v = ' '.join(e.lstrip() for e in v.split('\n'))
822 v = ' '.join(e.lstrip() for e in v.split('\n'))
816 pad = ' ' * (w - encoding.colwidth(v))
823 pad = ' ' * (w - encoding.colwidth(v))
817 l.append(v + pad)
824 l.append(v + pad)
818 out.append(indent + ' '.join(l) + "\n")
825 out.append(indent + ' '.join(l) + "\n")
819 if header and len(data) > 1:
826 if header and len(data) > 1:
820 out.insert(2, div)
827 out.insert(2, div)
821 out.append(div)
828 out.append(div)
822 return out
829 return out
@@ -1,3664 +1,3693
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 Extra extensions will be printed in help output in a non-reliable order since
47 Extra extensions will be printed in help output in a non-reliable order since
48 the extension is unknown.
48 the extension is unknown.
49 #if no-extraextensions
49 #if no-extraextensions
50
50
51 $ hg help
51 $ hg help
52 Mercurial Distributed SCM
52 Mercurial Distributed SCM
53
53
54 list of commands:
54 list of commands:
55
55
56 add add the specified files on the next commit
56 add add the specified files on the next commit
57 addremove add all new files, delete all missing files
57 addremove add all new files, delete all missing files
58 annotate show changeset information by line for each file
58 annotate show changeset information by line for each file
59 archive create an unversioned archive of a repository revision
59 archive create an unversioned archive of a repository revision
60 backout reverse effect of earlier changeset
60 backout reverse effect of earlier changeset
61 bisect subdivision search of changesets
61 bisect subdivision search of changesets
62 bookmarks create a new bookmark or list existing bookmarks
62 bookmarks create a new bookmark or list existing bookmarks
63 branch set or show the current branch name
63 branch set or show the current branch name
64 branches list repository named branches
64 branches list repository named branches
65 bundle create a bundle file
65 bundle create a bundle file
66 cat output the current or given revision of files
66 cat output the current or given revision of files
67 clone make a copy of an existing repository
67 clone make a copy of an existing repository
68 commit commit the specified files or all outstanding changes
68 commit commit the specified files or all outstanding changes
69 config show combined config settings from all hgrc files
69 config show combined config settings from all hgrc files
70 copy mark files as copied for the next commit
70 copy mark files as copied for the next commit
71 diff diff repository (or selected files)
71 diff diff repository (or selected files)
72 export dump the header and diffs for one or more changesets
72 export dump the header and diffs for one or more changesets
73 files list tracked files
73 files list tracked files
74 forget forget the specified files on the next commit
74 forget forget the specified files on the next commit
75 graft copy changes from other branches onto the current branch
75 graft copy changes from other branches onto the current branch
76 grep search revision history for a pattern in specified files
76 grep search revision history for a pattern in specified files
77 heads show branch heads
77 heads show branch heads
78 help show help for a given topic or a help overview
78 help show help for a given topic or a help overview
79 identify identify the working directory or specified revision
79 identify identify the working directory or specified revision
80 import import an ordered set of patches
80 import import an ordered set of patches
81 incoming show new changesets found in source
81 incoming show new changesets found in source
82 init create a new repository in the given directory
82 init create a new repository in the given directory
83 log show revision history of entire repository or files
83 log show revision history of entire repository or files
84 manifest output the current or given revision of the project manifest
84 manifest output the current or given revision of the project manifest
85 merge merge another revision into working directory
85 merge merge another revision into working directory
86 outgoing show changesets not found in the destination
86 outgoing show changesets not found in the destination
87 paths show aliases for remote repositories
87 paths show aliases for remote repositories
88 phase set or show the current phase name
88 phase set or show the current phase name
89 pull pull changes from the specified source
89 pull pull changes from the specified source
90 push push changes to the specified destination
90 push push changes to the specified destination
91 recover roll back an interrupted transaction
91 recover roll back an interrupted transaction
92 remove remove the specified files on the next commit
92 remove remove the specified files on the next commit
93 rename rename files; equivalent of copy + remove
93 rename rename files; equivalent of copy + remove
94 resolve redo merges or set/view the merge status of files
94 resolve redo merges or set/view the merge status of files
95 revert restore files to their checkout state
95 revert restore files to their checkout state
96 root print the root (top) of the current working directory
96 root print the root (top) of the current working directory
97 serve start stand-alone webserver
97 serve start stand-alone webserver
98 status show changed files in the working directory
98 status show changed files in the working directory
99 summary summarize working directory state
99 summary summarize working directory state
100 tag add one or more tags for the current or given revision
100 tag add one or more tags for the current or given revision
101 tags list repository tags
101 tags list repository tags
102 unbundle apply one or more bundle files
102 unbundle apply one or more bundle files
103 update update working directory (or switch revisions)
103 update update working directory (or switch revisions)
104 verify verify the integrity of the repository
104 verify verify the integrity of the repository
105 version output version and copyright information
105 version output version and copyright information
106
106
107 additional help topics:
107 additional help topics:
108
108
109 bundlespec Bundle File Formats
109 bundlespec Bundle File Formats
110 color Colorizing Outputs
110 color Colorizing Outputs
111 config Configuration Files
111 config Configuration Files
112 dates Date Formats
112 dates Date Formats
113 deprecated Deprecated Features
113 deprecated Deprecated Features
114 diffs Diff Formats
114 diffs Diff Formats
115 environment Environment Variables
115 environment Environment Variables
116 extensions Using Additional Features
116 extensions Using Additional Features
117 filesets Specifying File Sets
117 filesets Specifying File Sets
118 flags Command-line flags
118 flags Command-line flags
119 glossary Glossary
119 glossary Glossary
120 hgignore Syntax for Mercurial Ignore Files
120 hgignore Syntax for Mercurial Ignore Files
121 hgweb Configuring hgweb
121 hgweb Configuring hgweb
122 internals Technical implementation topics
122 internals Technical implementation topics
123 merge-tools Merge Tools
123 merge-tools Merge Tools
124 pager Pager Support
124 pager Pager Support
125 patterns File Name Patterns
125 patterns File Name Patterns
126 phases Working with Phases
126 phases Working with Phases
127 revisions Specifying Revisions
127 revisions Specifying Revisions
128 scripting Using Mercurial from scripts and automation
128 scripting Using Mercurial from scripts and automation
129 subrepos Subrepositories
129 subrepos Subrepositories
130 templating Template Usage
130 templating Template Usage
131 urls URL Paths
131 urls URL Paths
132
132
133 (use 'hg help -v' to show built-in aliases and global options)
133 (use 'hg help -v' to show built-in aliases and global options)
134
134
135 $ hg -q help
135 $ hg -q help
136 add add the specified files on the next commit
136 add add the specified files on the next commit
137 addremove add all new files, delete all missing files
137 addremove add all new files, delete all missing files
138 annotate show changeset information by line for each file
138 annotate show changeset information by line for each file
139 archive create an unversioned archive of a repository revision
139 archive create an unversioned archive of a repository revision
140 backout reverse effect of earlier changeset
140 backout reverse effect of earlier changeset
141 bisect subdivision search of changesets
141 bisect subdivision search of changesets
142 bookmarks create a new bookmark or list existing bookmarks
142 bookmarks create a new bookmark or list existing bookmarks
143 branch set or show the current branch name
143 branch set or show the current branch name
144 branches list repository named branches
144 branches list repository named branches
145 bundle create a bundle file
145 bundle create a bundle file
146 cat output the current or given revision of files
146 cat output the current or given revision of files
147 clone make a copy of an existing repository
147 clone make a copy of an existing repository
148 commit commit the specified files or all outstanding changes
148 commit commit the specified files or all outstanding changes
149 config show combined config settings from all hgrc files
149 config show combined config settings from all hgrc files
150 copy mark files as copied for the next commit
150 copy mark files as copied for the next commit
151 diff diff repository (or selected files)
151 diff diff repository (or selected files)
152 export dump the header and diffs for one or more changesets
152 export dump the header and diffs for one or more changesets
153 files list tracked files
153 files list tracked files
154 forget forget the specified files on the next commit
154 forget forget the specified files on the next commit
155 graft copy changes from other branches onto the current branch
155 graft copy changes from other branches onto the current branch
156 grep search revision history for a pattern in specified files
156 grep search revision history for a pattern in specified files
157 heads show branch heads
157 heads show branch heads
158 help show help for a given topic or a help overview
158 help show help for a given topic or a help overview
159 identify identify the working directory or specified revision
159 identify identify the working directory or specified revision
160 import import an ordered set of patches
160 import import an ordered set of patches
161 incoming show new changesets found in source
161 incoming show new changesets found in source
162 init create a new repository in the given directory
162 init create a new repository in the given directory
163 log show revision history of entire repository or files
163 log show revision history of entire repository or files
164 manifest output the current or given revision of the project manifest
164 manifest output the current or given revision of the project manifest
165 merge merge another revision into working directory
165 merge merge another revision into working directory
166 outgoing show changesets not found in the destination
166 outgoing show changesets not found in the destination
167 paths show aliases for remote repositories
167 paths show aliases for remote repositories
168 phase set or show the current phase name
168 phase set or show the current phase name
169 pull pull changes from the specified source
169 pull pull changes from the specified source
170 push push changes to the specified destination
170 push push changes to the specified destination
171 recover roll back an interrupted transaction
171 recover roll back an interrupted transaction
172 remove remove the specified files on the next commit
172 remove remove the specified files on the next commit
173 rename rename files; equivalent of copy + remove
173 rename rename files; equivalent of copy + remove
174 resolve redo merges or set/view the merge status of files
174 resolve redo merges or set/view the merge status of files
175 revert restore files to their checkout state
175 revert restore files to their checkout state
176 root print the root (top) of the current working directory
176 root print the root (top) of the current working directory
177 serve start stand-alone webserver
177 serve start stand-alone webserver
178 status show changed files in the working directory
178 status show changed files in the working directory
179 summary summarize working directory state
179 summary summarize working directory state
180 tag add one or more tags for the current or given revision
180 tag add one or more tags for the current or given revision
181 tags list repository tags
181 tags list repository tags
182 unbundle apply one or more bundle files
182 unbundle apply one or more bundle files
183 update update working directory (or switch revisions)
183 update update working directory (or switch revisions)
184 verify verify the integrity of the repository
184 verify verify the integrity of the repository
185 version output version and copyright information
185 version output version and copyright information
186
186
187 additional help topics:
187 additional help topics:
188
188
189 bundlespec Bundle File Formats
189 bundlespec Bundle File Formats
190 color Colorizing Outputs
190 color Colorizing Outputs
191 config Configuration Files
191 config Configuration Files
192 dates Date Formats
192 dates Date Formats
193 deprecated Deprecated Features
193 deprecated Deprecated Features
194 diffs Diff Formats
194 diffs Diff Formats
195 environment Environment Variables
195 environment Environment Variables
196 extensions Using Additional Features
196 extensions Using Additional Features
197 filesets Specifying File Sets
197 filesets Specifying File Sets
198 flags Command-line flags
198 flags Command-line flags
199 glossary Glossary
199 glossary Glossary
200 hgignore Syntax for Mercurial Ignore Files
200 hgignore Syntax for Mercurial Ignore Files
201 hgweb Configuring hgweb
201 hgweb Configuring hgweb
202 internals Technical implementation topics
202 internals Technical implementation topics
203 merge-tools Merge Tools
203 merge-tools Merge Tools
204 pager Pager Support
204 pager Pager Support
205 patterns File Name Patterns
205 patterns File Name Patterns
206 phases Working with Phases
206 phases Working with Phases
207 revisions Specifying Revisions
207 revisions Specifying Revisions
208 scripting Using Mercurial from scripts and automation
208 scripting Using Mercurial from scripts and automation
209 subrepos Subrepositories
209 subrepos Subrepositories
210 templating Template Usage
210 templating Template Usage
211 urls URL Paths
211 urls URL Paths
212
212
213 Test extension help:
213 Test extension help:
214 $ hg help extensions --config extensions.rebase= --config extensions.children=
214 $ hg help extensions --config extensions.rebase= --config extensions.children=
215 Using Additional Features
215 Using Additional Features
216 """""""""""""""""""""""""
216 """""""""""""""""""""""""
217
217
218 Mercurial has the ability to add new features through the use of
218 Mercurial has the ability to add new features through the use of
219 extensions. Extensions may add new commands, add options to existing
219 extensions. Extensions may add new commands, add options to existing
220 commands, change the default behavior of commands, or implement hooks.
220 commands, change the default behavior of commands, or implement hooks.
221
221
222 To enable the "foo" extension, either shipped with Mercurial or in the
222 To enable the "foo" extension, either shipped with Mercurial or in the
223 Python search path, create an entry for it in your configuration file,
223 Python search path, create an entry for it in your configuration file,
224 like this:
224 like this:
225
225
226 [extensions]
226 [extensions]
227 foo =
227 foo =
228
228
229 You may also specify the full path to an extension:
229 You may also specify the full path to an extension:
230
230
231 [extensions]
231 [extensions]
232 myfeature = ~/.hgext/myfeature.py
232 myfeature = ~/.hgext/myfeature.py
233
233
234 See 'hg help config' for more information on configuration files.
234 See 'hg help config' for more information on configuration files.
235
235
236 Extensions are not loaded by default for a variety of reasons: they can
236 Extensions are not loaded by default for a variety of reasons: they can
237 increase startup overhead; they may be meant for advanced usage only; they
237 increase startup overhead; they may be meant for advanced usage only; they
238 may provide potentially dangerous abilities (such as letting you destroy
238 may provide potentially dangerous abilities (such as letting you destroy
239 or modify history); they might not be ready for prime time; or they may
239 or modify history); they might not be ready for prime time; or they may
240 alter some usual behaviors of stock Mercurial. It is thus up to the user
240 alter some usual behaviors of stock Mercurial. It is thus up to the user
241 to activate extensions as needed.
241 to activate extensions as needed.
242
242
243 To explicitly disable an extension enabled in a configuration file of
243 To explicitly disable an extension enabled in a configuration file of
244 broader scope, prepend its path with !:
244 broader scope, prepend its path with !:
245
245
246 [extensions]
246 [extensions]
247 # disabling extension bar residing in /path/to/extension/bar.py
247 # disabling extension bar residing in /path/to/extension/bar.py
248 bar = !/path/to/extension/bar.py
248 bar = !/path/to/extension/bar.py
249 # ditto, but no path was supplied for extension baz
249 # ditto, but no path was supplied for extension baz
250 baz = !
250 baz = !
251
251
252 enabled extensions:
252 enabled extensions:
253
253
254 children command to display child changesets (DEPRECATED)
254 children command to display child changesets (DEPRECATED)
255 rebase command to move sets of revisions to a different ancestor
255 rebase command to move sets of revisions to a different ancestor
256
256
257 disabled extensions:
257 disabled extensions:
258
258
259 acl hooks for controlling repository access
259 acl hooks for controlling repository access
260 blackbox log repository events to a blackbox for debugging
260 blackbox log repository events to a blackbox for debugging
261 bugzilla hooks for integrating with the Bugzilla bug tracker
261 bugzilla hooks for integrating with the Bugzilla bug tracker
262 censor erase file content at a given revision
262 censor erase file content at a given revision
263 churn command to display statistics about repository history
263 churn command to display statistics about repository history
264 clonebundles advertise pre-generated bundles to seed clones
264 clonebundles advertise pre-generated bundles to seed clones
265 convert import revisions from foreign VCS repositories into
265 convert import revisions from foreign VCS repositories into
266 Mercurial
266 Mercurial
267 eol automatically manage newlines in repository files
267 eol automatically manage newlines in repository files
268 extdiff command to allow external programs to compare revisions
268 extdiff command to allow external programs to compare revisions
269 factotum http authentication with factotum
269 factotum http authentication with factotum
270 githelp try mapping git commands to Mercurial commands
270 githelp try mapping git commands to Mercurial commands
271 gpg commands to sign and verify changesets
271 gpg commands to sign and verify changesets
272 hgk browse the repository in a graphical way
272 hgk browse the repository in a graphical way
273 highlight syntax highlighting for hgweb (requires Pygments)
273 highlight syntax highlighting for hgweb (requires Pygments)
274 histedit interactive history editing
274 histedit interactive history editing
275 keyword expand keywords in tracked files
275 keyword expand keywords in tracked files
276 largefiles track large binary files
276 largefiles track large binary files
277 mq manage a stack of patches
277 mq manage a stack of patches
278 notify hooks for sending email push notifications
278 notify hooks for sending email push notifications
279 patchbomb command to send changesets as (a series of) patch emails
279 patchbomb command to send changesets as (a series of) patch emails
280 purge command to delete untracked files from the working
280 purge command to delete untracked files from the working
281 directory
281 directory
282 relink recreates hardlinks between repository clones
282 relink recreates hardlinks between repository clones
283 schemes extend schemes with shortcuts to repository swarms
283 schemes extend schemes with shortcuts to repository swarms
284 share share a common history between several working directories
284 share share a common history between several working directories
285 shelve save and restore changes to the working directory
285 shelve save and restore changes to the working directory
286 strip strip changesets and their descendants from history
286 strip strip changesets and their descendants from history
287 transplant command to transplant changesets from another branch
287 transplant command to transplant changesets from another branch
288 win32mbcs allow the use of MBCS paths with problematic encodings
288 win32mbcs allow the use of MBCS paths with problematic encodings
289 zeroconf discover and advertise repositories on the local network
289 zeroconf discover and advertise repositories on the local network
290
290
291 #endif
291 #endif
292
292
293 Verify that deprecated extensions are included if --verbose:
293 Verify that deprecated extensions are included if --verbose:
294
294
295 $ hg -v help extensions | grep children
295 $ hg -v help extensions | grep children
296 children command to display child changesets (DEPRECATED)
296 children command to display child changesets (DEPRECATED)
297
297
298 Verify that extension keywords appear in help templates
298 Verify that extension keywords appear in help templates
299
299
300 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
300 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
301
301
302 Test short command list with verbose option
302 Test short command list with verbose option
303
303
304 $ hg -v help shortlist
304 $ hg -v help shortlist
305 Mercurial Distributed SCM
305 Mercurial Distributed SCM
306
306
307 basic commands:
307 basic commands:
308
308
309 add add the specified files on the next commit
309 add add the specified files on the next commit
310 annotate, blame
310 annotate, blame
311 show changeset information by line for each file
311 show changeset information by line for each file
312 clone make a copy of an existing repository
312 clone make a copy of an existing repository
313 commit, ci commit the specified files or all outstanding changes
313 commit, ci commit the specified files or all outstanding changes
314 diff diff repository (or selected files)
314 diff diff repository (or selected files)
315 export dump the header and diffs for one or more changesets
315 export dump the header and diffs for one or more changesets
316 forget forget the specified files on the next commit
316 forget forget the specified files on the next commit
317 init create a new repository in the given directory
317 init create a new repository in the given directory
318 log, history show revision history of entire repository or files
318 log, history show revision history of entire repository or files
319 merge merge another revision into working directory
319 merge merge another revision into working directory
320 pull pull changes from the specified source
320 pull pull changes from the specified source
321 push push changes to the specified destination
321 push push changes to the specified destination
322 remove, rm remove the specified files on the next commit
322 remove, rm remove the specified files on the next commit
323 serve start stand-alone webserver
323 serve start stand-alone webserver
324 status, st show changed files in the working directory
324 status, st show changed files in the working directory
325 summary, sum summarize working directory state
325 summary, sum summarize working directory state
326 update, up, checkout, co
326 update, up, checkout, co
327 update working directory (or switch revisions)
327 update working directory (or switch revisions)
328
328
329 global options ([+] can be repeated):
329 global options ([+] can be repeated):
330
330
331 -R --repository REPO repository root directory or name of overlay bundle
331 -R --repository REPO repository root directory or name of overlay bundle
332 file
332 file
333 --cwd DIR change working directory
333 --cwd DIR change working directory
334 -y --noninteractive do not prompt, automatically pick the first choice for
334 -y --noninteractive do not prompt, automatically pick the first choice for
335 all prompts
335 all prompts
336 -q --quiet suppress output
336 -q --quiet suppress output
337 -v --verbose enable additional output
337 -v --verbose enable additional output
338 --color TYPE when to colorize (boolean, always, auto, never, or
338 --color TYPE when to colorize (boolean, always, auto, never, or
339 debug)
339 debug)
340 --config CONFIG [+] set/override config option (use 'section.name=value')
340 --config CONFIG [+] set/override config option (use 'section.name=value')
341 --debug enable debugging output
341 --debug enable debugging output
342 --debugger start debugger
342 --debugger start debugger
343 --encoding ENCODE set the charset encoding (default: ascii)
343 --encoding ENCODE set the charset encoding (default: ascii)
344 --encodingmode MODE set the charset encoding mode (default: strict)
344 --encodingmode MODE set the charset encoding mode (default: strict)
345 --traceback always print a traceback on exception
345 --traceback always print a traceback on exception
346 --time time how long the command takes
346 --time time how long the command takes
347 --profile print command execution profile
347 --profile print command execution profile
348 --version output version information and exit
348 --version output version information and exit
349 -h --help display help and exit
349 -h --help display help and exit
350 --hidden consider hidden changesets
350 --hidden consider hidden changesets
351 --pager TYPE when to paginate (boolean, always, auto, or never)
351 --pager TYPE when to paginate (boolean, always, auto, or never)
352 (default: auto)
352 (default: auto)
353
353
354 (use 'hg help' for the full list of commands)
354 (use 'hg help' for the full list of commands)
355
355
356 $ hg add -h
356 $ hg add -h
357 hg add [OPTION]... [FILE]...
357 hg add [OPTION]... [FILE]...
358
358
359 add the specified files on the next commit
359 add the specified files on the next commit
360
360
361 Schedule files to be version controlled and added to the repository.
361 Schedule files to be version controlled and added to the repository.
362
362
363 The files will be added to the repository at the next commit. To undo an
363 The files will be added to the repository at the next commit. To undo an
364 add before that, see 'hg forget'.
364 add before that, see 'hg forget'.
365
365
366 If no names are given, add all files to the repository (except files
366 If no names are given, add all files to the repository (except files
367 matching ".hgignore").
367 matching ".hgignore").
368
368
369 Returns 0 if all files are successfully added.
369 Returns 0 if all files are successfully added.
370
370
371 options ([+] can be repeated):
371 options ([+] can be repeated):
372
372
373 -I --include PATTERN [+] include names matching the given patterns
373 -I --include PATTERN [+] include names matching the given patterns
374 -X --exclude PATTERN [+] exclude names matching the given patterns
374 -X --exclude PATTERN [+] exclude names matching the given patterns
375 -S --subrepos recurse into subrepositories
375 -S --subrepos recurse into subrepositories
376 -n --dry-run do not perform actions, just print output
376 -n --dry-run do not perform actions, just print output
377
377
378 (some details hidden, use --verbose to show complete help)
378 (some details hidden, use --verbose to show complete help)
379
379
380 Verbose help for add
380 Verbose help for add
381
381
382 $ hg add -hv
382 $ hg add -hv
383 hg add [OPTION]... [FILE]...
383 hg add [OPTION]... [FILE]...
384
384
385 add the specified files on the next commit
385 add the specified files on the next commit
386
386
387 Schedule files to be version controlled and added to the repository.
387 Schedule files to be version controlled and added to the repository.
388
388
389 The files will be added to the repository at the next commit. To undo an
389 The files will be added to the repository at the next commit. To undo an
390 add before that, see 'hg forget'.
390 add before that, see 'hg forget'.
391
391
392 If no names are given, add all files to the repository (except files
392 If no names are given, add all files to the repository (except files
393 matching ".hgignore").
393 matching ".hgignore").
394
394
395 Examples:
395 Examples:
396
396
397 - New (unknown) files are added automatically by 'hg add':
397 - New (unknown) files are added automatically by 'hg add':
398
398
399 $ ls
399 $ ls
400 foo.c
400 foo.c
401 $ hg status
401 $ hg status
402 ? foo.c
402 ? foo.c
403 $ hg add
403 $ hg add
404 adding foo.c
404 adding foo.c
405 $ hg status
405 $ hg status
406 A foo.c
406 A foo.c
407
407
408 - Specific files to be added can be specified:
408 - Specific files to be added can be specified:
409
409
410 $ ls
410 $ ls
411 bar.c foo.c
411 bar.c foo.c
412 $ hg status
412 $ hg status
413 ? bar.c
413 ? bar.c
414 ? foo.c
414 ? foo.c
415 $ hg add bar.c
415 $ hg add bar.c
416 $ hg status
416 $ hg status
417 A bar.c
417 A bar.c
418 ? foo.c
418 ? foo.c
419
419
420 Returns 0 if all files are successfully added.
420 Returns 0 if all files are successfully added.
421
421
422 options ([+] can be repeated):
422 options ([+] can be repeated):
423
423
424 -I --include PATTERN [+] include names matching the given patterns
424 -I --include PATTERN [+] include names matching the given patterns
425 -X --exclude PATTERN [+] exclude names matching the given patterns
425 -X --exclude PATTERN [+] exclude names matching the given patterns
426 -S --subrepos recurse into subrepositories
426 -S --subrepos recurse into subrepositories
427 -n --dry-run do not perform actions, just print output
427 -n --dry-run do not perform actions, just print output
428
428
429 global options ([+] can be repeated):
429 global options ([+] can be repeated):
430
430
431 -R --repository REPO repository root directory or name of overlay bundle
431 -R --repository REPO repository root directory or name of overlay bundle
432 file
432 file
433 --cwd DIR change working directory
433 --cwd DIR change working directory
434 -y --noninteractive do not prompt, automatically pick the first choice for
434 -y --noninteractive do not prompt, automatically pick the first choice for
435 all prompts
435 all prompts
436 -q --quiet suppress output
436 -q --quiet suppress output
437 -v --verbose enable additional output
437 -v --verbose enable additional output
438 --color TYPE when to colorize (boolean, always, auto, never, or
438 --color TYPE when to colorize (boolean, always, auto, never, or
439 debug)
439 debug)
440 --config CONFIG [+] set/override config option (use 'section.name=value')
440 --config CONFIG [+] set/override config option (use 'section.name=value')
441 --debug enable debugging output
441 --debug enable debugging output
442 --debugger start debugger
442 --debugger start debugger
443 --encoding ENCODE set the charset encoding (default: ascii)
443 --encoding ENCODE set the charset encoding (default: ascii)
444 --encodingmode MODE set the charset encoding mode (default: strict)
444 --encodingmode MODE set the charset encoding mode (default: strict)
445 --traceback always print a traceback on exception
445 --traceback always print a traceback on exception
446 --time time how long the command takes
446 --time time how long the command takes
447 --profile print command execution profile
447 --profile print command execution profile
448 --version output version information and exit
448 --version output version information and exit
449 -h --help display help and exit
449 -h --help display help and exit
450 --hidden consider hidden changesets
450 --hidden consider hidden changesets
451 --pager TYPE when to paginate (boolean, always, auto, or never)
451 --pager TYPE when to paginate (boolean, always, auto, or never)
452 (default: auto)
452 (default: auto)
453
453
454 Test the textwidth config option
454 Test the textwidth config option
455
455
456 $ hg root -h --config ui.textwidth=50
456 $ hg root -h --config ui.textwidth=50
457 hg root
457 hg root
458
458
459 print the root (top) of the current working
459 print the root (top) of the current working
460 directory
460 directory
461
461
462 Print the root directory of the current
462 Print the root directory of the current
463 repository.
463 repository.
464
464
465 Returns 0 on success.
465 Returns 0 on success.
466
466
467 (some details hidden, use --verbose to show
467 (some details hidden, use --verbose to show
468 complete help)
468 complete help)
469
469
470 Test help option with version option
470 Test help option with version option
471
471
472 $ hg add -h --version
472 $ hg add -h --version
473 Mercurial Distributed SCM (version *) (glob)
473 Mercurial Distributed SCM (version *) (glob)
474 (see https://mercurial-scm.org for more information)
474 (see https://mercurial-scm.org for more information)
475
475
476 Copyright (C) 2005-* Matt Mackall and others (glob)
476 Copyright (C) 2005-* Matt Mackall and others (glob)
477 This is free software; see the source for copying conditions. There is NO
477 This is free software; see the source for copying conditions. There is NO
478 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
478 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
479
479
480 $ hg add --skjdfks
480 $ hg add --skjdfks
481 hg add: option --skjdfks not recognized
481 hg add: option --skjdfks not recognized
482 hg add [OPTION]... [FILE]...
482 hg add [OPTION]... [FILE]...
483
483
484 add the specified files on the next commit
484 add the specified files on the next commit
485
485
486 options ([+] can be repeated):
486 options ([+] can be repeated):
487
487
488 -I --include PATTERN [+] include names matching the given patterns
488 -I --include PATTERN [+] include names matching the given patterns
489 -X --exclude PATTERN [+] exclude names matching the given patterns
489 -X --exclude PATTERN [+] exclude names matching the given patterns
490 -S --subrepos recurse into subrepositories
490 -S --subrepos recurse into subrepositories
491 -n --dry-run do not perform actions, just print output
491 -n --dry-run do not perform actions, just print output
492
492
493 (use 'hg add -h' to show more help)
493 (use 'hg add -h' to show more help)
494 [255]
494 [255]
495
495
496 Test ambiguous command help
496 Test ambiguous command help
497
497
498 $ hg help ad
498 $ hg help ad
499 list of commands:
499 list of commands:
500
500
501 add add the specified files on the next commit
501 add add the specified files on the next commit
502 addremove add all new files, delete all missing files
502 addremove add all new files, delete all missing files
503
503
504 (use 'hg help -v ad' to show built-in aliases and global options)
504 (use 'hg help -v ad' to show built-in aliases and global options)
505
505
506 Test command without options
506 Test command without options
507
507
508 $ hg help verify
508 $ hg help verify
509 hg verify
509 hg verify
510
510
511 verify the integrity of the repository
511 verify the integrity of the repository
512
512
513 Verify the integrity of the current repository.
513 Verify the integrity of the current repository.
514
514
515 This will perform an extensive check of the repository's integrity,
515 This will perform an extensive check of the repository's integrity,
516 validating the hashes and checksums of each entry in the changelog,
516 validating the hashes and checksums of each entry in the changelog,
517 manifest, and tracked files, as well as the integrity of their crosslinks
517 manifest, and tracked files, as well as the integrity of their crosslinks
518 and indices.
518 and indices.
519
519
520 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
520 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
521 information about recovery from corruption of the repository.
521 information about recovery from corruption of the repository.
522
522
523 Returns 0 on success, 1 if errors are encountered.
523 Returns 0 on success, 1 if errors are encountered.
524
524
525 (some details hidden, use --verbose to show complete help)
525 (some details hidden, use --verbose to show complete help)
526
526
527 $ hg help diff
527 $ hg help diff
528 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
528 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
529
529
530 diff repository (or selected files)
530 diff repository (or selected files)
531
531
532 Show differences between revisions for the specified files.
532 Show differences between revisions for the specified files.
533
533
534 Differences between files are shown using the unified diff format.
534 Differences between files are shown using the unified diff format.
535
535
536 Note:
536 Note:
537 'hg diff' may generate unexpected results for merges, as it will
537 'hg diff' may generate unexpected results for merges, as it will
538 default to comparing against the working directory's first parent
538 default to comparing against the working directory's first parent
539 changeset if no revisions are specified.
539 changeset if no revisions are specified.
540
540
541 When two revision arguments are given, then changes are shown between
541 When two revision arguments are given, then changes are shown between
542 those revisions. If only one revision is specified then that revision is
542 those revisions. If only one revision is specified then that revision is
543 compared to the working directory, and, when no revisions are specified,
543 compared to the working directory, and, when no revisions are specified,
544 the working directory files are compared to its first parent.
544 the working directory files are compared to its first parent.
545
545
546 Alternatively you can specify -c/--change with a revision to see the
546 Alternatively you can specify -c/--change with a revision to see the
547 changes in that changeset relative to its first parent.
547 changes in that changeset relative to its first parent.
548
548
549 Without the -a/--text option, diff will avoid generating diffs of files it
549 Without the -a/--text option, diff will avoid generating diffs of files it
550 detects as binary. With -a, diff will generate a diff anyway, probably
550 detects as binary. With -a, diff will generate a diff anyway, probably
551 with undesirable results.
551 with undesirable results.
552
552
553 Use the -g/--git option to generate diffs in the git extended diff format.
553 Use the -g/--git option to generate diffs in the git extended diff format.
554 For more information, read 'hg help diffs'.
554 For more information, read 'hg help diffs'.
555
555
556 Returns 0 on success.
556 Returns 0 on success.
557
557
558 options ([+] can be repeated):
558 options ([+] can be repeated):
559
559
560 -r --rev REV [+] revision
560 -r --rev REV [+] revision
561 -c --change REV change made by revision
561 -c --change REV change made by revision
562 -a --text treat all files as text
562 -a --text treat all files as text
563 -g --git use git extended diff format
563 -g --git use git extended diff format
564 --binary generate binary diffs in git mode (default)
564 --binary generate binary diffs in git mode (default)
565 --nodates omit dates from diff headers
565 --nodates omit dates from diff headers
566 --noprefix omit a/ and b/ prefixes from filenames
566 --noprefix omit a/ and b/ prefixes from filenames
567 -p --show-function show which function each change is in
567 -p --show-function show which function each change is in
568 --reverse produce a diff that undoes the changes
568 --reverse produce a diff that undoes the changes
569 -w --ignore-all-space ignore white space when comparing lines
569 -w --ignore-all-space ignore white space when comparing lines
570 -b --ignore-space-change ignore changes in the amount of white space
570 -b --ignore-space-change ignore changes in the amount of white space
571 -B --ignore-blank-lines ignore changes whose lines are all blank
571 -B --ignore-blank-lines ignore changes whose lines are all blank
572 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
572 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
573 -U --unified NUM number of lines of context to show
573 -U --unified NUM number of lines of context to show
574 --stat output diffstat-style summary of changes
574 --stat output diffstat-style summary of changes
575 --root DIR produce diffs relative to subdirectory
575 --root DIR produce diffs relative to subdirectory
576 -I --include PATTERN [+] include names matching the given patterns
576 -I --include PATTERN [+] include names matching the given patterns
577 -X --exclude PATTERN [+] exclude names matching the given patterns
577 -X --exclude PATTERN [+] exclude names matching the given patterns
578 -S --subrepos recurse into subrepositories
578 -S --subrepos recurse into subrepositories
579
579
580 (some details hidden, use --verbose to show complete help)
580 (some details hidden, use --verbose to show complete help)
581
581
582 $ hg help status
582 $ hg help status
583 hg status [OPTION]... [FILE]...
583 hg status [OPTION]... [FILE]...
584
584
585 aliases: st
585 aliases: st
586
586
587 show changed files in the working directory
587 show changed files in the working directory
588
588
589 Show status of files in the repository. If names are given, only files
589 Show status of files in the repository. If names are given, only files
590 that match are shown. Files that are clean or ignored or the source of a
590 that match are shown. Files that are clean or ignored or the source of a
591 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
591 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
592 -C/--copies or -A/--all are given. Unless options described with "show
592 -C/--copies or -A/--all are given. Unless options described with "show
593 only ..." are given, the options -mardu are used.
593 only ..." are given, the options -mardu are used.
594
594
595 Option -q/--quiet hides untracked (unknown and ignored) files unless
595 Option -q/--quiet hides untracked (unknown and ignored) files unless
596 explicitly requested with -u/--unknown or -i/--ignored.
596 explicitly requested with -u/--unknown or -i/--ignored.
597
597
598 Note:
598 Note:
599 'hg status' may appear to disagree with diff if permissions have
599 'hg status' may appear to disagree with diff if permissions have
600 changed or a merge has occurred. The standard diff format does not
600 changed or a merge has occurred. The standard diff format does not
601 report permission changes and diff only reports changes relative to one
601 report permission changes and diff only reports changes relative to one
602 merge parent.
602 merge parent.
603
603
604 If one revision is given, it is used as the base revision. If two
604 If one revision is given, it is used as the base revision. If two
605 revisions are given, the differences between them are shown. The --change
605 revisions are given, the differences between them are shown. The --change
606 option can also be used as a shortcut to list the changed files of a
606 option can also be used as a shortcut to list the changed files of a
607 revision from its first parent.
607 revision from its first parent.
608
608
609 The codes used to show the status of files are:
609 The codes used to show the status of files are:
610
610
611 M = modified
611 M = modified
612 A = added
612 A = added
613 R = removed
613 R = removed
614 C = clean
614 C = clean
615 ! = missing (deleted by non-hg command, but still tracked)
615 ! = missing (deleted by non-hg command, but still tracked)
616 ? = not tracked
616 ? = not tracked
617 I = ignored
617 I = ignored
618 = origin of the previous file (with --copies)
618 = origin of the previous file (with --copies)
619
619
620 Returns 0 on success.
620 Returns 0 on success.
621
621
622 options ([+] can be repeated):
622 options ([+] can be repeated):
623
623
624 -A --all show status of all files
624 -A --all show status of all files
625 -m --modified show only modified files
625 -m --modified show only modified files
626 -a --added show only added files
626 -a --added show only added files
627 -r --removed show only removed files
627 -r --removed show only removed files
628 -d --deleted show only deleted (but tracked) files
628 -d --deleted show only deleted (but tracked) files
629 -c --clean show only files without changes
629 -c --clean show only files without changes
630 -u --unknown show only unknown (not tracked) files
630 -u --unknown show only unknown (not tracked) files
631 -i --ignored show only ignored files
631 -i --ignored show only ignored files
632 -n --no-status hide status prefix
632 -n --no-status hide status prefix
633 -C --copies show source of copied files
633 -C --copies show source of copied files
634 -0 --print0 end filenames with NUL, for use with xargs
634 -0 --print0 end filenames with NUL, for use with xargs
635 --rev REV [+] show difference from revision
635 --rev REV [+] show difference from revision
636 --change REV list the changed files of a revision
636 --change REV list the changed files of a revision
637 -I --include PATTERN [+] include names matching the given patterns
637 -I --include PATTERN [+] include names matching the given patterns
638 -X --exclude PATTERN [+] exclude names matching the given patterns
638 -X --exclude PATTERN [+] exclude names matching the given patterns
639 -S --subrepos recurse into subrepositories
639 -S --subrepos recurse into subrepositories
640
640
641 (some details hidden, use --verbose to show complete help)
641 (some details hidden, use --verbose to show complete help)
642
642
643 $ hg -q help status
643 $ hg -q help status
644 hg status [OPTION]... [FILE]...
644 hg status [OPTION]... [FILE]...
645
645
646 show changed files in the working directory
646 show changed files in the working directory
647
647
648 $ hg help foo
648 $ hg help foo
649 abort: no such help topic: foo
649 abort: no such help topic: foo
650 (try 'hg help --keyword foo')
650 (try 'hg help --keyword foo')
651 [255]
651 [255]
652
652
653 $ hg skjdfks
653 $ hg skjdfks
654 hg: unknown command 'skjdfks'
654 hg: unknown command 'skjdfks'
655 (use 'hg help' for a list of commands)
655 (use 'hg help' for a list of commands)
656 [255]
656 [255]
657
657
658 Typoed command gives suggestion
658 Typoed command gives suggestion
659 $ hg puls
659 $ hg puls
660 hg: unknown command 'puls'
660 hg: unknown command 'puls'
661 (did you mean one of pull, push?)
661 (did you mean one of pull, push?)
662 [255]
662 [255]
663
663
664 Not enabled extension gets suggested
664 Not enabled extension gets suggested
665
665
666 $ hg rebase
666 $ hg rebase
667 hg: unknown command 'rebase'
667 hg: unknown command 'rebase'
668 'rebase' is provided by the following extension:
668 'rebase' is provided by the following extension:
669
669
670 rebase command to move sets of revisions to a different ancestor
670 rebase command to move sets of revisions to a different ancestor
671
671
672 (use 'hg help extensions' for information on enabling extensions)
672 (use 'hg help extensions' for information on enabling extensions)
673 [255]
673 [255]
674
674
675 Disabled extension gets suggested
675 Disabled extension gets suggested
676 $ hg --config extensions.rebase=! rebase
676 $ hg --config extensions.rebase=! rebase
677 hg: unknown command 'rebase'
677 hg: unknown command 'rebase'
678 'rebase' is provided by the following extension:
678 'rebase' is provided by the following extension:
679
679
680 rebase command to move sets of revisions to a different ancestor
680 rebase command to move sets of revisions to a different ancestor
681
681
682 (use 'hg help extensions' for information on enabling extensions)
682 (use 'hg help extensions' for information on enabling extensions)
683 [255]
683 [255]
684
684
685 Make sure that we don't run afoul of the help system thinking that
685 Make sure that we don't run afoul of the help system thinking that
686 this is a section and erroring out weirdly.
686 this is a section and erroring out weirdly.
687
687
688 $ hg .log
688 $ hg .log
689 hg: unknown command '.log'
689 hg: unknown command '.log'
690 (did you mean log?)
690 (did you mean log?)
691 [255]
691 [255]
692
692
693 $ hg log.
693 $ hg log.
694 hg: unknown command 'log.'
694 hg: unknown command 'log.'
695 (did you mean log?)
695 (did you mean log?)
696 [255]
696 [255]
697 $ hg pu.lh
697 $ hg pu.lh
698 hg: unknown command 'pu.lh'
698 hg: unknown command 'pu.lh'
699 (did you mean one of pull, push?)
699 (did you mean one of pull, push?)
700 [255]
700 [255]
701
701
702 $ cat > helpext.py <<EOF
702 $ cat > helpext.py <<EOF
703 > import os
703 > import os
704 > from mercurial import commands, fancyopts, registrar
704 > from mercurial import commands, fancyopts, registrar
705 >
705 >
706 > def func(arg):
706 > def func(arg):
707 > return '%sfoo' % arg
707 > return '%sfoo' % arg
708 > class customopt(fancyopts.customopt):
708 > class customopt(fancyopts.customopt):
709 > def newstate(self, oldstate, newparam, abort):
709 > def newstate(self, oldstate, newparam, abort):
710 > return '%sbar' % oldstate
710 > return '%sbar' % oldstate
711 > cmdtable = {}
711 > cmdtable = {}
712 > command = registrar.command(cmdtable)
712 > command = registrar.command(cmdtable)
713 >
713 >
714 > @command(b'nohelp',
714 > @command(b'nohelp',
715 > [(b'', b'longdesc', 3, b'x'*67),
715 > [(b'', b'longdesc', 3, b'x'*67),
716 > (b'n', b'', None, b'normal desc'),
716 > (b'n', b'', None, b'normal desc'),
717 > (b'', b'newline', b'', b'line1\nline2'),
717 > (b'', b'newline', b'', b'line1\nline2'),
718 > (b'', b'callableopt', func, b'adds foo'),
718 > (b'', b'callableopt', func, b'adds foo'),
719 > (b'', b'customopt', customopt(''), b'adds bar'),
719 > (b'', b'customopt', customopt(''), b'adds bar'),
720 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
720 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
721 > b'hg nohelp',
721 > b'hg nohelp',
722 > norepo=True)
722 > norepo=True)
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
726 > def nohelp(ui, *args, **kwargs):
726 > def nohelp(ui, *args, **kwargs):
727 > pass
727 > pass
728 >
728 >
729 > def uisetup(ui):
729 > def uisetup(ui):
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
732 >
732 >
733 > EOF
733 > EOF
734 $ echo '[extensions]' >> $HGRCPATH
734 $ echo '[extensions]' >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
736
736
737 Test for aliases
737 Test for aliases
738
738
739 $ hg help hgalias
739 $ hg help hgalias
740 hg hgalias [--remote]
740 hg hgalias [--remote]
741
741
742 alias for: hg summary
742 alias for: hg summary
743
743
744 summarize working directory state
744 summarize working directory state
745
745
746 This generates a brief summary of the working directory state, including
746 This generates a brief summary of the working directory state, including
747 parents, branch, commit status, phase and available updates.
747 parents, branch, commit status, phase and available updates.
748
748
749 With the --remote option, this will check the default paths for incoming
749 With the --remote option, this will check the default paths for incoming
750 and outgoing changes. This can be time-consuming.
750 and outgoing changes. This can be time-consuming.
751
751
752 Returns 0 on success.
752 Returns 0 on success.
753
753
754 defined by: helpext
754 defined by: helpext
755
755
756 options:
756 options:
757
757
758 --remote check for push and pull
758 --remote check for push and pull
759
759
760 (some details hidden, use --verbose to show complete help)
760 (some details hidden, use --verbose to show complete help)
761
761
762 $ hg help shellalias
762 $ hg help shellalias
763 hg shellalias
763 hg shellalias
764
764
765 shell alias for: echo hi
765 shell alias for: echo hi
766
766
767 (no help text available)
767 (no help text available)
768
768
769 defined by: helpext
769 defined by: helpext
770
770
771 (some details hidden, use --verbose to show complete help)
771 (some details hidden, use --verbose to show complete help)
772
772
773 Test command with no help text
773 Test command with no help text
774
774
775 $ hg help nohelp
775 $ hg help nohelp
776 hg nohelp
776 hg nohelp
777
777
778 (no help text available)
778 (no help text available)
779
779
780 options:
780 options:
781
781
782 --longdesc VALUE
782 --longdesc VALUE
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
784 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
784 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
785 -n -- normal desc
785 -n -- normal desc
786 --newline VALUE line1 line2
786 --newline VALUE line1 line2
787 --callableopt VALUE adds foo
787 --callableopt VALUE adds foo
788 --customopt VALUE adds bar
788 --customopt VALUE adds bar
789 --customopt-withdefault VALUE adds bar (default: foo)
789 --customopt-withdefault VALUE adds bar (default: foo)
790
790
791 (some details hidden, use --verbose to show complete help)
791 (some details hidden, use --verbose to show complete help)
792
792
793 $ hg help -k nohelp
793 $ hg help -k nohelp
794 Commands:
794 Commands:
795
795
796 nohelp hg nohelp
796 nohelp hg nohelp
797
797
798 Extension Commands:
798 Extension Commands:
799
799
800 nohelp (no help text available)
800 nohelp (no help text available)
801
801
802 Test that default list of commands omits extension commands
802 Test that default list of commands omits extension commands
803
803
804 #if no-extraextensions
804 #if no-extraextensions
805
805
806 $ hg help
806 $ hg help
807 Mercurial Distributed SCM
807 Mercurial Distributed SCM
808
808
809 list of commands:
809 list of commands:
810
810
811 add add the specified files on the next commit
811 add add the specified files on the next commit
812 addremove add all new files, delete all missing files
812 addremove add all new files, delete all missing files
813 annotate show changeset information by line for each file
813 annotate show changeset information by line for each file
814 archive create an unversioned archive of a repository revision
814 archive create an unversioned archive of a repository revision
815 backout reverse effect of earlier changeset
815 backout reverse effect of earlier changeset
816 bisect subdivision search of changesets
816 bisect subdivision search of changesets
817 bookmarks create a new bookmark or list existing bookmarks
817 bookmarks create a new bookmark or list existing bookmarks
818 branch set or show the current branch name
818 branch set or show the current branch name
819 branches list repository named branches
819 branches list repository named branches
820 bundle create a bundle file
820 bundle create a bundle file
821 cat output the current or given revision of files
821 cat output the current or given revision of files
822 clone make a copy of an existing repository
822 clone make a copy of an existing repository
823 commit commit the specified files or all outstanding changes
823 commit commit the specified files or all outstanding changes
824 config show combined config settings from all hgrc files
824 config show combined config settings from all hgrc files
825 copy mark files as copied for the next commit
825 copy mark files as copied for the next commit
826 diff diff repository (or selected files)
826 diff diff repository (or selected files)
827 export dump the header and diffs for one or more changesets
827 export dump the header and diffs for one or more changesets
828 files list tracked files
828 files list tracked files
829 forget forget the specified files on the next commit
829 forget forget the specified files on the next commit
830 graft copy changes from other branches onto the current branch
830 graft copy changes from other branches onto the current branch
831 grep search revision history for a pattern in specified files
831 grep search revision history for a pattern in specified files
832 heads show branch heads
832 heads show branch heads
833 help show help for a given topic or a help overview
833 help show help for a given topic or a help overview
834 identify identify the working directory or specified revision
834 identify identify the working directory or specified revision
835 import import an ordered set of patches
835 import import an ordered set of patches
836 incoming show new changesets found in source
836 incoming show new changesets found in source
837 init create a new repository in the given directory
837 init create a new repository in the given directory
838 log show revision history of entire repository or files
838 log show revision history of entire repository or files
839 manifest output the current or given revision of the project manifest
839 manifest output the current or given revision of the project manifest
840 merge merge another revision into working directory
840 merge merge another revision into working directory
841 outgoing show changesets not found in the destination
841 outgoing show changesets not found in the destination
842 paths show aliases for remote repositories
842 paths show aliases for remote repositories
843 phase set or show the current phase name
843 phase set or show the current phase name
844 pull pull changes from the specified source
844 pull pull changes from the specified source
845 push push changes to the specified destination
845 push push changes to the specified destination
846 recover roll back an interrupted transaction
846 recover roll back an interrupted transaction
847 remove remove the specified files on the next commit
847 remove remove the specified files on the next commit
848 rename rename files; equivalent of copy + remove
848 rename rename files; equivalent of copy + remove
849 resolve redo merges or set/view the merge status of files
849 resolve redo merges or set/view the merge status of files
850 revert restore files to their checkout state
850 revert restore files to their checkout state
851 root print the root (top) of the current working directory
851 root print the root (top) of the current working directory
852 serve start stand-alone webserver
852 serve start stand-alone webserver
853 status show changed files in the working directory
853 status show changed files in the working directory
854 summary summarize working directory state
854 summary summarize working directory state
855 tag add one or more tags for the current or given revision
855 tag add one or more tags for the current or given revision
856 tags list repository tags
856 tags list repository tags
857 unbundle apply one or more bundle files
857 unbundle apply one or more bundle files
858 update update working directory (or switch revisions)
858 update update working directory (or switch revisions)
859 verify verify the integrity of the repository
859 verify verify the integrity of the repository
860 version output version and copyright information
860 version output version and copyright information
861
861
862 enabled extensions:
862 enabled extensions:
863
863
864 helpext (no help text available)
864 helpext (no help text available)
865
865
866 additional help topics:
866 additional help topics:
867
867
868 bundlespec Bundle File Formats
868 bundlespec Bundle File Formats
869 color Colorizing Outputs
869 color Colorizing Outputs
870 config Configuration Files
870 config Configuration Files
871 dates Date Formats
871 dates Date Formats
872 deprecated Deprecated Features
872 deprecated Deprecated Features
873 diffs Diff Formats
873 diffs Diff Formats
874 environment Environment Variables
874 environment Environment Variables
875 extensions Using Additional Features
875 extensions Using Additional Features
876 filesets Specifying File Sets
876 filesets Specifying File Sets
877 flags Command-line flags
877 flags Command-line flags
878 glossary Glossary
878 glossary Glossary
879 hgignore Syntax for Mercurial Ignore Files
879 hgignore Syntax for Mercurial Ignore Files
880 hgweb Configuring hgweb
880 hgweb Configuring hgweb
881 internals Technical implementation topics
881 internals Technical implementation topics
882 merge-tools Merge Tools
882 merge-tools Merge Tools
883 pager Pager Support
883 pager Pager Support
884 patterns File Name Patterns
884 patterns File Name Patterns
885 phases Working with Phases
885 phases Working with Phases
886 revisions Specifying Revisions
886 revisions Specifying Revisions
887 scripting Using Mercurial from scripts and automation
887 scripting Using Mercurial from scripts and automation
888 subrepos Subrepositories
888 subrepos Subrepositories
889 templating Template Usage
889 templating Template Usage
890 urls URL Paths
890 urls URL Paths
891
891
892 (use 'hg help -v' to show built-in aliases and global options)
892 (use 'hg help -v' to show built-in aliases and global options)
893
893
894 #endif
894 #endif
895
895
896 Test list of internal help commands
896 Test list of internal help commands
897
897
898 $ hg help debug
898 $ hg help debug
899 debug commands (internal and unsupported):
899 debug commands (internal and unsupported):
900
900
901 debugancestor
901 debugancestor
902 find the ancestor revision of two revisions in a given index
902 find the ancestor revision of two revisions in a given index
903 debugapplystreamclonebundle
903 debugapplystreamclonebundle
904 apply a stream clone bundle file
904 apply a stream clone bundle file
905 debugbuilddag
905 debugbuilddag
906 builds a repo with a given DAG from scratch in the current
906 builds a repo with a given DAG from scratch in the current
907 empty repo
907 empty repo
908 debugbundle lists the contents of a bundle
908 debugbundle lists the contents of a bundle
909 debugcapabilities
909 debugcapabilities
910 lists the capabilities of a remote peer
910 lists the capabilities of a remote peer
911 debugcheckstate
911 debugcheckstate
912 validate the correctness of the current dirstate
912 validate the correctness of the current dirstate
913 debugcolor show available color, effects or style
913 debugcolor show available color, effects or style
914 debugcommands
914 debugcommands
915 list all available commands and options
915 list all available commands and options
916 debugcomplete
916 debugcomplete
917 returns the completion list associated with the given command
917 returns the completion list associated with the given command
918 debugcreatestreamclonebundle
918 debugcreatestreamclonebundle
919 create a stream clone bundle file
919 create a stream clone bundle file
920 debugdag format the changelog or an index DAG as a concise textual
920 debugdag format the changelog or an index DAG as a concise textual
921 description
921 description
922 debugdata dump the contents of a data file revision
922 debugdata dump the contents of a data file revision
923 debugdate parse and display a date
923 debugdate parse and display a date
924 debugdeltachain
924 debugdeltachain
925 dump information about delta chains in a revlog
925 dump information about delta chains in a revlog
926 debugdirstate
926 debugdirstate
927 show the contents of the current dirstate
927 show the contents of the current dirstate
928 debugdiscovery
928 debugdiscovery
929 runs the changeset discovery protocol in isolation
929 runs the changeset discovery protocol in isolation
930 debugdownload
930 debugdownload
931 download a resource using Mercurial logic and config
931 download a resource using Mercurial logic and config
932 debugextensions
932 debugextensions
933 show information about active extensions
933 show information about active extensions
934 debugfileset parse and apply a fileset specification
934 debugfileset parse and apply a fileset specification
935 debugformat display format information about the current repository
935 debugformat display format information about the current repository
936 debugfsinfo show information detected about current filesystem
936 debugfsinfo show information detected about current filesystem
937 debuggetbundle
937 debuggetbundle
938 retrieves a bundle from a repo
938 retrieves a bundle from a repo
939 debugignore display the combined ignore pattern and information about
939 debugignore display the combined ignore pattern and information about
940 ignored files
940 ignored files
941 debugindex dump index data for a storage primitive
941 debugindex dump index data for a storage primitive
942 debugindexdot
942 debugindexdot
943 dump an index DAG as a graphviz dot file
943 dump an index DAG as a graphviz dot file
944 debuginstall test Mercurial installation
944 debuginstall test Mercurial installation
945 debugknown test whether node ids are known to a repo
945 debugknown test whether node ids are known to a repo
946 debuglocks show or modify state of locks
946 debuglocks show or modify state of locks
947 debugmanifestfulltextcache
947 debugmanifestfulltextcache
948 show, clear or amend the contents of the manifest fulltext
948 show, clear or amend the contents of the manifest fulltext
949 cache
949 cache
950 debugmergestate
950 debugmergestate
951 print merge state
951 print merge state
952 debugnamecomplete
952 debugnamecomplete
953 complete "names" - tags, open branch names, bookmark names
953 complete "names" - tags, open branch names, bookmark names
954 debugobsolete
954 debugobsolete
955 create arbitrary obsolete marker
955 create arbitrary obsolete marker
956 debugoptADV (no help text available)
956 debugoptADV (no help text available)
957 debugoptDEP (no help text available)
957 debugoptDEP (no help text available)
958 debugoptEXP (no help text available)
958 debugoptEXP (no help text available)
959 debugpathcomplete
959 debugpathcomplete
960 complete part or all of a tracked path
960 complete part or all of a tracked path
961 debugpeer establish a connection to a peer repository
961 debugpeer establish a connection to a peer repository
962 debugpickmergetool
962 debugpickmergetool
963 examine which merge tool is chosen for specified file
963 examine which merge tool is chosen for specified file
964 debugpushkey access the pushkey key/value protocol
964 debugpushkey access the pushkey key/value protocol
965 debugpvec (no help text available)
965 debugpvec (no help text available)
966 debugrebuilddirstate
966 debugrebuilddirstate
967 rebuild the dirstate as it would look like for the given
967 rebuild the dirstate as it would look like for the given
968 revision
968 revision
969 debugrebuildfncache
969 debugrebuildfncache
970 rebuild the fncache file
970 rebuild the fncache file
971 debugrename dump rename information
971 debugrename dump rename information
972 debugrevlog show data and statistics about a revlog
972 debugrevlog show data and statistics about a revlog
973 debugrevlogindex
973 debugrevlogindex
974 dump the contents of a revlog index
974 dump the contents of a revlog index
975 debugrevspec parse and apply a revision specification
975 debugrevspec parse and apply a revision specification
976 debugserve run a server with advanced settings
976 debugserve run a server with advanced settings
977 debugsetparents
977 debugsetparents
978 manually set the parents of the current working directory
978 manually set the parents of the current working directory
979 debugssl test a secure connection to a server
979 debugssl test a secure connection to a server
980 debugsub (no help text available)
980 debugsub (no help text available)
981 debugsuccessorssets
981 debugsuccessorssets
982 show set of successors for revision
982 show set of successors for revision
983 debugtemplate
983 debugtemplate
984 parse and apply a template
984 parse and apply a template
985 debuguigetpass
985 debuguigetpass
986 show prompt to type password
986 show prompt to type password
987 debuguiprompt
987 debuguiprompt
988 show plain prompt
988 show plain prompt
989 debugupdatecaches
989 debugupdatecaches
990 warm all known caches in the repository
990 warm all known caches in the repository
991 debugupgraderepo
991 debugupgraderepo
992 upgrade a repository to use different features
992 upgrade a repository to use different features
993 debugwalk show how files match on given patterns
993 debugwalk show how files match on given patterns
994 debugwhyunstable
994 debugwhyunstable
995 explain instabilities of a changeset
995 explain instabilities of a changeset
996 debugwireargs
996 debugwireargs
997 (no help text available)
997 (no help text available)
998 debugwireproto
998 debugwireproto
999 send wire protocol commands to a server
999 send wire protocol commands to a server
1000
1000
1001 (use 'hg help -v debug' to show built-in aliases and global options)
1001 (use 'hg help -v debug' to show built-in aliases and global options)
1002
1002
1003 internals topic renders index of available sub-topics
1003 internals topic renders index of available sub-topics
1004
1004
1005 $ hg help internals
1005 $ hg help internals
1006 Technical implementation topics
1006 Technical implementation topics
1007 """""""""""""""""""""""""""""""
1007 """""""""""""""""""""""""""""""
1008
1008
1009 To access a subtopic, use "hg help internals.{subtopic-name}"
1009 To access a subtopic, use "hg help internals.{subtopic-name}"
1010
1010
1011 bundle2 Bundle2
1011 bundle2 Bundle2
1012 bundles Bundles
1012 bundles Bundles
1013 censor Censor
1013 censor Censor
1014 changegroups Changegroups
1014 changegroups Changegroups
1015 config Config Registrar
1015 config Config Registrar
1016 requirements Repository Requirements
1016 requirements Repository Requirements
1017 revlogs Revision Logs
1017 revlogs Revision Logs
1018 wireprotocol Wire Protocol
1018 wireprotocol Wire Protocol
1019
1019
1020 sub-topics can be accessed
1020 sub-topics can be accessed
1021
1021
1022 $ hg help internals.changegroups
1022 $ hg help internals.changegroups
1023 Changegroups
1023 Changegroups
1024 """"""""""""
1024 """"""""""""
1025
1025
1026 Changegroups are representations of repository revlog data, specifically
1026 Changegroups are representations of repository revlog data, specifically
1027 the changelog data, root/flat manifest data, treemanifest data, and
1027 the changelog data, root/flat manifest data, treemanifest data, and
1028 filelogs.
1028 filelogs.
1029
1029
1030 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1030 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1031 level, versions "1" and "2" are almost exactly the same, with the only
1031 level, versions "1" and "2" are almost exactly the same, with the only
1032 difference being an additional item in the *delta header*. Version "3"
1032 difference being an additional item in the *delta header*. Version "3"
1033 adds support for revlog flags in the *delta header* and optionally
1033 adds support for revlog flags in the *delta header* and optionally
1034 exchanging treemanifests (enabled by setting an option on the
1034 exchanging treemanifests (enabled by setting an option on the
1035 "changegroup" part in the bundle2).
1035 "changegroup" part in the bundle2).
1036
1036
1037 Changegroups when not exchanging treemanifests consist of 3 logical
1037 Changegroups when not exchanging treemanifests consist of 3 logical
1038 segments:
1038 segments:
1039
1039
1040 +---------------------------------+
1040 +---------------------------------+
1041 | | | |
1041 | | | |
1042 | changeset | manifest | filelogs |
1042 | changeset | manifest | filelogs |
1043 | | | |
1043 | | | |
1044 | | | |
1044 | | | |
1045 +---------------------------------+
1045 +---------------------------------+
1046
1046
1047 When exchanging treemanifests, there are 4 logical segments:
1047 When exchanging treemanifests, there are 4 logical segments:
1048
1048
1049 +-------------------------------------------------+
1049 +-------------------------------------------------+
1050 | | | | |
1050 | | | | |
1051 | changeset | root | treemanifests | filelogs |
1051 | changeset | root | treemanifests | filelogs |
1052 | | manifest | | |
1052 | | manifest | | |
1053 | | | | |
1053 | | | | |
1054 +-------------------------------------------------+
1054 +-------------------------------------------------+
1055
1055
1056 The principle building block of each segment is a *chunk*. A *chunk* is a
1056 The principle building block of each segment is a *chunk*. A *chunk* is a
1057 framed piece of data:
1057 framed piece of data:
1058
1058
1059 +---------------------------------------+
1059 +---------------------------------------+
1060 | | |
1060 | | |
1061 | length | data |
1061 | length | data |
1062 | (4 bytes) | (<length - 4> bytes) |
1062 | (4 bytes) | (<length - 4> bytes) |
1063 | | |
1063 | | |
1064 +---------------------------------------+
1064 +---------------------------------------+
1065
1065
1066 All integers are big-endian signed integers. Each chunk starts with a
1066 All integers are big-endian signed integers. Each chunk starts with a
1067 32-bit integer indicating the length of the entire chunk (including the
1067 32-bit integer indicating the length of the entire chunk (including the
1068 length field itself).
1068 length field itself).
1069
1069
1070 There is a special case chunk that has a value of 0 for the length
1070 There is a special case chunk that has a value of 0 for the length
1071 ("0x00000000"). We call this an *empty chunk*.
1071 ("0x00000000"). We call this an *empty chunk*.
1072
1072
1073 Delta Groups
1073 Delta Groups
1074 ============
1074 ============
1075
1075
1076 A *delta group* expresses the content of a revlog as a series of deltas,
1076 A *delta group* expresses the content of a revlog as a series of deltas,
1077 or patches against previous revisions.
1077 or patches against previous revisions.
1078
1078
1079 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1079 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1080 to signal the end of the delta group:
1080 to signal the end of the delta group:
1081
1081
1082 +------------------------------------------------------------------------+
1082 +------------------------------------------------------------------------+
1083 | | | | | |
1083 | | | | | |
1084 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1084 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1085 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1085 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1086 | | | | | |
1086 | | | | | |
1087 +------------------------------------------------------------------------+
1087 +------------------------------------------------------------------------+
1088
1088
1089 Each *chunk*'s data consists of the following:
1089 Each *chunk*'s data consists of the following:
1090
1090
1091 +---------------------------------------+
1091 +---------------------------------------+
1092 | | |
1092 | | |
1093 | delta header | delta data |
1093 | delta header | delta data |
1094 | (various by version) | (various) |
1094 | (various by version) | (various) |
1095 | | |
1095 | | |
1096 +---------------------------------------+
1096 +---------------------------------------+
1097
1097
1098 The *delta data* is a series of *delta*s that describe a diff from an
1098 The *delta data* is a series of *delta*s that describe a diff from an
1099 existing entry (either that the recipient already has, or previously
1099 existing entry (either that the recipient already has, or previously
1100 specified in the bundle/changegroup).
1100 specified in the bundle/changegroup).
1101
1101
1102 The *delta header* is different between versions "1", "2", and "3" of the
1102 The *delta header* is different between versions "1", "2", and "3" of the
1103 changegroup format.
1103 changegroup format.
1104
1104
1105 Version 1 (headerlen=80):
1105 Version 1 (headerlen=80):
1106
1106
1107 +------------------------------------------------------+
1107 +------------------------------------------------------+
1108 | | | | |
1108 | | | | |
1109 | node | p1 node | p2 node | link node |
1109 | node | p1 node | p2 node | link node |
1110 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1110 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1111 | | | | |
1111 | | | | |
1112 +------------------------------------------------------+
1112 +------------------------------------------------------+
1113
1113
1114 Version 2 (headerlen=100):
1114 Version 2 (headerlen=100):
1115
1115
1116 +------------------------------------------------------------------+
1116 +------------------------------------------------------------------+
1117 | | | | | |
1117 | | | | | |
1118 | node | p1 node | p2 node | base node | link node |
1118 | node | p1 node | p2 node | base node | link node |
1119 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1119 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1120 | | | | | |
1120 | | | | | |
1121 +------------------------------------------------------------------+
1121 +------------------------------------------------------------------+
1122
1122
1123 Version 3 (headerlen=102):
1123 Version 3 (headerlen=102):
1124
1124
1125 +------------------------------------------------------------------------------+
1125 +------------------------------------------------------------------------------+
1126 | | | | | | |
1126 | | | | | | |
1127 | node | p1 node | p2 node | base node | link node | flags |
1127 | node | p1 node | p2 node | base node | link node | flags |
1128 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1128 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1129 | | | | | | |
1129 | | | | | | |
1130 +------------------------------------------------------------------------------+
1130 +------------------------------------------------------------------------------+
1131
1131
1132 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1132 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1133 contain a series of *delta*s, densely packed (no separators). These deltas
1133 contain a series of *delta*s, densely packed (no separators). These deltas
1134 describe a diff from an existing entry (either that the recipient already
1134 describe a diff from an existing entry (either that the recipient already
1135 has, or previously specified in the bundle/changegroup). The format is
1135 has, or previously specified in the bundle/changegroup). The format is
1136 described more fully in "hg help internals.bdiff", but briefly:
1136 described more fully in "hg help internals.bdiff", but briefly:
1137
1137
1138 +---------------------------------------------------------------+
1138 +---------------------------------------------------------------+
1139 | | | | |
1139 | | | | |
1140 | start offset | end offset | new length | content |
1140 | start offset | end offset | new length | content |
1141 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1141 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1142 | | | | |
1142 | | | | |
1143 +---------------------------------------------------------------+
1143 +---------------------------------------------------------------+
1144
1144
1145 Please note that the length field in the delta data does *not* include
1145 Please note that the length field in the delta data does *not* include
1146 itself.
1146 itself.
1147
1147
1148 In version 1, the delta is always applied against the previous node from
1148 In version 1, the delta is always applied against the previous node from
1149 the changegroup or the first parent if this is the first entry in the
1149 the changegroup or the first parent if this is the first entry in the
1150 changegroup.
1150 changegroup.
1151
1151
1152 In version 2 and up, the delta base node is encoded in the entry in the
1152 In version 2 and up, the delta base node is encoded in the entry in the
1153 changegroup. This allows the delta to be expressed against any parent,
1153 changegroup. This allows the delta to be expressed against any parent,
1154 which can result in smaller deltas and more efficient encoding of data.
1154 which can result in smaller deltas and more efficient encoding of data.
1155
1155
1156 Changeset Segment
1156 Changeset Segment
1157 =================
1157 =================
1158
1158
1159 The *changeset segment* consists of a single *delta group* holding
1159 The *changeset segment* consists of a single *delta group* holding
1160 changelog data. The *empty chunk* at the end of the *delta group* denotes
1160 changelog data. The *empty chunk* at the end of the *delta group* denotes
1161 the boundary to the *manifest segment*.
1161 the boundary to the *manifest segment*.
1162
1162
1163 Manifest Segment
1163 Manifest Segment
1164 ================
1164 ================
1165
1165
1166 The *manifest segment* consists of a single *delta group* holding manifest
1166 The *manifest segment* consists of a single *delta group* holding manifest
1167 data. If treemanifests are in use, it contains only the manifest for the
1167 data. If treemanifests are in use, it contains only the manifest for the
1168 root directory of the repository. Otherwise, it contains the entire
1168 root directory of the repository. Otherwise, it contains the entire
1169 manifest data. The *empty chunk* at the end of the *delta group* denotes
1169 manifest data. The *empty chunk* at the end of the *delta group* denotes
1170 the boundary to the next segment (either the *treemanifests segment* or
1170 the boundary to the next segment (either the *treemanifests segment* or
1171 the *filelogs segment*, depending on version and the request options).
1171 the *filelogs segment*, depending on version and the request options).
1172
1172
1173 Treemanifests Segment
1173 Treemanifests Segment
1174 ---------------------
1174 ---------------------
1175
1175
1176 The *treemanifests segment* only exists in changegroup version "3", and
1176 The *treemanifests segment* only exists in changegroup version "3", and
1177 only if the 'treemanifest' param is part of the bundle2 changegroup part
1177 only if the 'treemanifest' param is part of the bundle2 changegroup part
1178 (it is not possible to use changegroup version 3 outside of bundle2).
1178 (it is not possible to use changegroup version 3 outside of bundle2).
1179 Aside from the filenames in the *treemanifests segment* containing a
1179 Aside from the filenames in the *treemanifests segment* containing a
1180 trailing "/" character, it behaves identically to the *filelogs segment*
1180 trailing "/" character, it behaves identically to the *filelogs segment*
1181 (see below). The final sub-segment is followed by an *empty chunk*
1181 (see below). The final sub-segment is followed by an *empty chunk*
1182 (logically, a sub-segment with filename size 0). This denotes the boundary
1182 (logically, a sub-segment with filename size 0). This denotes the boundary
1183 to the *filelogs segment*.
1183 to the *filelogs segment*.
1184
1184
1185 Filelogs Segment
1185 Filelogs Segment
1186 ================
1186 ================
1187
1187
1188 The *filelogs segment* consists of multiple sub-segments, each
1188 The *filelogs segment* consists of multiple sub-segments, each
1189 corresponding to an individual file whose data is being described:
1189 corresponding to an individual file whose data is being described:
1190
1190
1191 +--------------------------------------------------+
1191 +--------------------------------------------------+
1192 | | | | | |
1192 | | | | | |
1193 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1193 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1194 | | | | | (4 bytes) |
1194 | | | | | (4 bytes) |
1195 | | | | | |
1195 | | | | | |
1196 +--------------------------------------------------+
1196 +--------------------------------------------------+
1197
1197
1198 The final filelog sub-segment is followed by an *empty chunk* (logically,
1198 The final filelog sub-segment is followed by an *empty chunk* (logically,
1199 a sub-segment with filename size 0). This denotes the end of the segment
1199 a sub-segment with filename size 0). This denotes the end of the segment
1200 and of the overall changegroup.
1200 and of the overall changegroup.
1201
1201
1202 Each filelog sub-segment consists of the following:
1202 Each filelog sub-segment consists of the following:
1203
1203
1204 +------------------------------------------------------+
1204 +------------------------------------------------------+
1205 | | | |
1205 | | | |
1206 | filename length | filename | delta group |
1206 | filename length | filename | delta group |
1207 | (4 bytes) | (<length - 4> bytes) | (various) |
1207 | (4 bytes) | (<length - 4> bytes) | (various) |
1208 | | | |
1208 | | | |
1209 +------------------------------------------------------+
1209 +------------------------------------------------------+
1210
1210
1211 That is, a *chunk* consisting of the filename (not terminated or padded)
1211 That is, a *chunk* consisting of the filename (not terminated or padded)
1212 followed by N chunks constituting the *delta group* for this file. The
1212 followed by N chunks constituting the *delta group* for this file. The
1213 *empty chunk* at the end of each *delta group* denotes the boundary to the
1213 *empty chunk* at the end of each *delta group* denotes the boundary to the
1214 next filelog sub-segment.
1214 next filelog sub-segment.
1215
1215
1216 Test list of commands with command with no help text
1216 Test list of commands with command with no help text
1217
1217
1218 $ hg help helpext
1218 $ hg help helpext
1219 helpext extension - no help text available
1219 helpext extension - no help text available
1220
1220
1221 list of commands:
1221 list of commands:
1222
1222
1223 nohelp (no help text available)
1223 nohelp (no help text available)
1224
1224
1225 (use 'hg help -v helpext' to show built-in aliases and global options)
1225 (use 'hg help -v helpext' to show built-in aliases and global options)
1226
1226
1227
1227
1228 test advanced, deprecated and experimental options are hidden in command help
1228 test advanced, deprecated and experimental options are hidden in command help
1229 $ hg help debugoptADV
1229 $ hg help debugoptADV
1230 hg debugoptADV
1230 hg debugoptADV
1231
1231
1232 (no help text available)
1232 (no help text available)
1233
1233
1234 options:
1234 options:
1235
1235
1236 (some details hidden, use --verbose to show complete help)
1236 (some details hidden, use --verbose to show complete help)
1237 $ hg help debugoptDEP
1237 $ hg help debugoptDEP
1238 hg debugoptDEP
1238 hg debugoptDEP
1239
1239
1240 (no help text available)
1240 (no help text available)
1241
1241
1242 options:
1242 options:
1243
1243
1244 (some details hidden, use --verbose to show complete help)
1244 (some details hidden, use --verbose to show complete help)
1245
1245
1246 $ hg help debugoptEXP
1246 $ hg help debugoptEXP
1247 hg debugoptEXP
1247 hg debugoptEXP
1248
1248
1249 (no help text available)
1249 (no help text available)
1250
1250
1251 options:
1251 options:
1252
1252
1253 (some details hidden, use --verbose to show complete help)
1253 (some details hidden, use --verbose to show complete help)
1254
1254
1255 test advanced, deprecated and experimental options are shown with -v
1255 test advanced, deprecated and experimental options are shown with -v
1256 $ hg help -v debugoptADV | grep aopt
1256 $ hg help -v debugoptADV | grep aopt
1257 --aopt option is (ADVANCED)
1257 --aopt option is (ADVANCED)
1258 $ hg help -v debugoptDEP | grep dopt
1258 $ hg help -v debugoptDEP | grep dopt
1259 --dopt option is (DEPRECATED)
1259 --dopt option is (DEPRECATED)
1260 $ hg help -v debugoptEXP | grep eopt
1260 $ hg help -v debugoptEXP | grep eopt
1261 --eopt option is (EXPERIMENTAL)
1261 --eopt option is (EXPERIMENTAL)
1262
1262
1263 #if gettext
1263 #if gettext
1264 test deprecated option is hidden with translation with untranslated description
1264 test deprecated option is hidden with translation with untranslated description
1265 (use many globy for not failing on changed transaction)
1265 (use many globy for not failing on changed transaction)
1266 $ LANGUAGE=sv hg help debugoptDEP
1266 $ LANGUAGE=sv hg help debugoptDEP
1267 hg debugoptDEP
1267 hg debugoptDEP
1268
1268
1269 (*) (glob)
1269 (*) (glob)
1270
1270
1271 options:
1271 options:
1272
1272
1273 (some details hidden, use --verbose to show complete help)
1273 (some details hidden, use --verbose to show complete help)
1274 #endif
1274 #endif
1275
1275
1276 Test commands that collide with topics (issue4240)
1276 Test commands that collide with topics (issue4240)
1277
1277
1278 $ hg config -hq
1278 $ hg config -hq
1279 hg config [-u] [NAME]...
1279 hg config [-u] [NAME]...
1280
1280
1281 show combined config settings from all hgrc files
1281 show combined config settings from all hgrc files
1282 $ hg showconfig -hq
1282 $ hg showconfig -hq
1283 hg config [-u] [NAME]...
1283 hg config [-u] [NAME]...
1284
1284
1285 show combined config settings from all hgrc files
1285 show combined config settings from all hgrc files
1286
1286
1287 Test a help topic
1287 Test a help topic
1288
1288
1289 $ hg help dates
1289 $ hg help dates
1290 Date Formats
1290 Date Formats
1291 """"""""""""
1291 """"""""""""
1292
1292
1293 Some commands allow the user to specify a date, e.g.:
1293 Some commands allow the user to specify a date, e.g.:
1294
1294
1295 - backout, commit, import, tag: Specify the commit date.
1295 - backout, commit, import, tag: Specify the commit date.
1296 - log, revert, update: Select revision(s) by date.
1296 - log, revert, update: Select revision(s) by date.
1297
1297
1298 Many date formats are valid. Here are some examples:
1298 Many date formats are valid. Here are some examples:
1299
1299
1300 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1300 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1301 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1301 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1302 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1302 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1303 - "Dec 6" (midnight)
1303 - "Dec 6" (midnight)
1304 - "13:18" (today assumed)
1304 - "13:18" (today assumed)
1305 - "3:39" (3:39AM assumed)
1305 - "3:39" (3:39AM assumed)
1306 - "3:39pm" (15:39)
1306 - "3:39pm" (15:39)
1307 - "2006-12-06 13:18:29" (ISO 8601 format)
1307 - "2006-12-06 13:18:29" (ISO 8601 format)
1308 - "2006-12-6 13:18"
1308 - "2006-12-6 13:18"
1309 - "2006-12-6"
1309 - "2006-12-6"
1310 - "12-6"
1310 - "12-6"
1311 - "12/6"
1311 - "12/6"
1312 - "12/6/6" (Dec 6 2006)
1312 - "12/6/6" (Dec 6 2006)
1313 - "today" (midnight)
1313 - "today" (midnight)
1314 - "yesterday" (midnight)
1314 - "yesterday" (midnight)
1315 - "now" - right now
1315 - "now" - right now
1316
1316
1317 Lastly, there is Mercurial's internal format:
1317 Lastly, there is Mercurial's internal format:
1318
1318
1319 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1319 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1320
1320
1321 This is the internal representation format for dates. The first number is
1321 This is the internal representation format for dates. The first number is
1322 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1322 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1323 is the offset of the local timezone, in seconds west of UTC (negative if
1323 is the offset of the local timezone, in seconds west of UTC (negative if
1324 the timezone is east of UTC).
1324 the timezone is east of UTC).
1325
1325
1326 The log command also accepts date ranges:
1326 The log command also accepts date ranges:
1327
1327
1328 - "<DATE" - at or before a given date/time
1328 - "<DATE" - at or before a given date/time
1329 - ">DATE" - on or after a given date/time
1329 - ">DATE" - on or after a given date/time
1330 - "DATE to DATE" - a date range, inclusive
1330 - "DATE to DATE" - a date range, inclusive
1331 - "-DAYS" - within a given number of days of today
1331 - "-DAYS" - within a given number of days of today
1332
1332
1333 Test repeated config section name
1333 Test repeated config section name
1334
1334
1335 $ hg help config.host
1335 $ hg help config.host
1336 "http_proxy.host"
1336 "http_proxy.host"
1337 Host name and (optional) port of the proxy server, for example
1337 Host name and (optional) port of the proxy server, for example
1338 "myproxy:8000".
1338 "myproxy:8000".
1339
1339
1340 "smtp.host"
1340 "smtp.host"
1341 Host name of mail server, e.g. "mail.example.com".
1341 Host name of mail server, e.g. "mail.example.com".
1342
1342
1343
1343
1344 Test section name with dot
1344 Test section name with dot
1345
1345
1346 $ hg help config.ui.username
1346 $ hg help config.ui.username
1347 abort: help section not found: config.ui.username
1347 "ui.username"
1348 [255]
1348 The committer of a changeset created when running "commit". Typically
1349 a person's name and email address, e.g. "Fred Widget
1350 <fred@example.com>". Environment variables in the username are
1351 expanded.
1352
1353 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1354 empty, e.g. if the system admin set "username =" in the system hgrc,
1355 it has to be specified manually or in a different hgrc file)
1356
1349
1357
1350 $ hg help config.annotate.git
1358 $ hg help config.annotate.git
1351 abort: help section not found: config.annotate.git
1359 abort: help section not found: config.annotate.git
1352 [255]
1360 [255]
1353
1361
1354 $ hg help config.update.check
1362 $ hg help config.update.check
1355 "commands.update.check"
1363 "commands.update.check"
1356 Determines what level of checking 'hg update' will perform before
1364 Determines what level of checking 'hg update' will perform before
1357 moving to a destination revision. Valid values are "abort", "none",
1365 moving to a destination revision. Valid values are "abort", "none",
1358 "linear", and "noconflict". "abort" always fails if the working
1366 "linear", and "noconflict". "abort" always fails if the working
1359 directory has uncommitted changes. "none" performs no checking, and
1367 directory has uncommitted changes. "none" performs no checking, and
1360 may result in a merge with uncommitted changes. "linear" allows any
1368 may result in a merge with uncommitted changes. "linear" allows any
1361 update as long as it follows a straight line in the revision history,
1369 update as long as it follows a straight line in the revision history,
1362 and may trigger a merge with uncommitted changes. "noconflict" will
1370 and may trigger a merge with uncommitted changes. "noconflict" will
1363 allow any update which would not trigger a merge with uncommitted
1371 allow any update which would not trigger a merge with uncommitted
1364 changes, if any are present. (default: "linear")
1372 changes, if any are present. (default: "linear")
1365
1373
1366
1374
1367 $ hg help config.commands.update.check
1375 $ hg help config.commands.update.check
1368 abort: help section not found: config.commands.update.check
1376 "commands.update.check"
1377 Determines what level of checking 'hg update' will perform before
1378 moving to a destination revision. Valid values are "abort", "none",
1379 "linear", and "noconflict". "abort" always fails if the working
1380 directory has uncommitted changes. "none" performs no checking, and
1381 may result in a merge with uncommitted changes. "linear" allows any
1382 update as long as it follows a straight line in the revision history,
1383 and may trigger a merge with uncommitted changes. "noconflict" will
1384 allow any update which would not trigger a merge with uncommitted
1385 changes, if any are present. (default: "linear")
1386
1387
1388 $ hg help config.ommands.update.check
1389 abort: help section not found: config.ommands.update.check
1369 [255]
1390 [255]
1370
1391
1371 Unrelated trailing paragraphs shouldn't be included
1392 Unrelated trailing paragraphs shouldn't be included
1372
1393
1373 $ hg help config.extramsg | grep '^$'
1394 $ hg help config.extramsg | grep '^$'
1374
1395
1375
1396
1376 Test capitalized section name
1397 Test capitalized section name
1377
1398
1378 $ hg help scripting.HGPLAIN > /dev/null
1399 $ hg help scripting.HGPLAIN > /dev/null
1379
1400
1380 Help subsection:
1401 Help subsection:
1381
1402
1382 $ hg help config.charsets |grep "Email example:" > /dev/null
1403 $ hg help config.charsets |grep "Email example:" > /dev/null
1383 [1]
1404 [1]
1384
1405
1385 Show nested definitions
1406 Show nested definitions
1386 ("profiling.type"[break]"ls"[break]"stat"[break])
1407 ("profiling.type"[break]"ls"[break]"stat"[break])
1387
1408
1388 $ hg help config.type | egrep '^$'|wc -l
1409 $ hg help config.type | egrep '^$'|wc -l
1389 \s*3 (re)
1410 \s*3 (re)
1390
1411
1412 $ hg help config.profiling.type.ls
1413 "profiling.type.ls"
1414 Use Python's built-in instrumenting profiler. This profiler works on
1415 all platforms, but each line number it reports is the first line of
1416 a function. This restriction makes it difficult to identify the
1417 expensive parts of a non-trivial function.
1418
1419
1391 Separate sections from subsections
1420 Separate sections from subsections
1392
1421
1393 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1422 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1394 "format"
1423 "format"
1395 --------
1424 --------
1396
1425
1397 "usegeneraldelta"
1426 "usegeneraldelta"
1398
1427
1399 "dotencode"
1428 "dotencode"
1400
1429
1401 "usefncache"
1430 "usefncache"
1402
1431
1403 "usestore"
1432 "usestore"
1404
1433
1405 "profiling"
1434 "profiling"
1406 -----------
1435 -----------
1407
1436
1408 "format"
1437 "format"
1409
1438
1410 "progress"
1439 "progress"
1411 ----------
1440 ----------
1412
1441
1413 "format"
1442 "format"
1414
1443
1415
1444
1416 Last item in help config.*:
1445 Last item in help config.*:
1417
1446
1418 $ hg help config.`hg help config|grep '^ "'| \
1447 $ hg help config.`hg help config|grep '^ "'| \
1419 > tail -1|sed 's![ "]*!!g'`| \
1448 > tail -1|sed 's![ "]*!!g'`| \
1420 > grep 'hg help -c config' > /dev/null
1449 > grep 'hg help -c config' > /dev/null
1421 [1]
1450 [1]
1422
1451
1423 note to use help -c for general hg help config:
1452 note to use help -c for general hg help config:
1424
1453
1425 $ hg help config |grep 'hg help -c config' > /dev/null
1454 $ hg help config |grep 'hg help -c config' > /dev/null
1426
1455
1427 Test templating help
1456 Test templating help
1428
1457
1429 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1458 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1430 desc String. The text of the changeset description.
1459 desc String. The text of the changeset description.
1431 diffstat String. Statistics of changes with the following format:
1460 diffstat String. Statistics of changes with the following format:
1432 firstline Any text. Returns the first line of text.
1461 firstline Any text. Returns the first line of text.
1433 nonempty Any text. Returns '(none)' if the string is empty.
1462 nonempty Any text. Returns '(none)' if the string is empty.
1434
1463
1435 Test deprecated items
1464 Test deprecated items
1436
1465
1437 $ hg help -v templating | grep currentbookmark
1466 $ hg help -v templating | grep currentbookmark
1438 currentbookmark
1467 currentbookmark
1439 $ hg help templating | (grep currentbookmark || true)
1468 $ hg help templating | (grep currentbookmark || true)
1440
1469
1441 Test help hooks
1470 Test help hooks
1442
1471
1443 $ cat > helphook1.py <<EOF
1472 $ cat > helphook1.py <<EOF
1444 > from mercurial import help
1473 > from mercurial import help
1445 >
1474 >
1446 > def rewrite(ui, topic, doc):
1475 > def rewrite(ui, topic, doc):
1447 > return doc + '\nhelphook1\n'
1476 > return doc + '\nhelphook1\n'
1448 >
1477 >
1449 > def extsetup(ui):
1478 > def extsetup(ui):
1450 > help.addtopichook('revisions', rewrite)
1479 > help.addtopichook('revisions', rewrite)
1451 > EOF
1480 > EOF
1452 $ cat > helphook2.py <<EOF
1481 $ cat > helphook2.py <<EOF
1453 > from mercurial import help
1482 > from mercurial import help
1454 >
1483 >
1455 > def rewrite(ui, topic, doc):
1484 > def rewrite(ui, topic, doc):
1456 > return doc + '\nhelphook2\n'
1485 > return doc + '\nhelphook2\n'
1457 >
1486 >
1458 > def extsetup(ui):
1487 > def extsetup(ui):
1459 > help.addtopichook('revisions', rewrite)
1488 > help.addtopichook('revisions', rewrite)
1460 > EOF
1489 > EOF
1461 $ echo '[extensions]' >> $HGRCPATH
1490 $ echo '[extensions]' >> $HGRCPATH
1462 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1491 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1463 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1492 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1464 $ hg help revsets | grep helphook
1493 $ hg help revsets | grep helphook
1465 helphook1
1494 helphook1
1466 helphook2
1495 helphook2
1467
1496
1468 help -c should only show debug --debug
1497 help -c should only show debug --debug
1469
1498
1470 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1499 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1471 [1]
1500 [1]
1472
1501
1473 help -c should only show deprecated for -v
1502 help -c should only show deprecated for -v
1474
1503
1475 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1504 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1476 [1]
1505 [1]
1477
1506
1478 Test -s / --system
1507 Test -s / --system
1479
1508
1480 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1509 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1481 > wc -l | sed -e 's/ //g'
1510 > wc -l | sed -e 's/ //g'
1482 0
1511 0
1483 $ hg help config.files --system unix | grep 'USER' | \
1512 $ hg help config.files --system unix | grep 'USER' | \
1484 > wc -l | sed -e 's/ //g'
1513 > wc -l | sed -e 's/ //g'
1485 0
1514 0
1486
1515
1487 Test -e / -c / -k combinations
1516 Test -e / -c / -k combinations
1488
1517
1489 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1518 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1490 Commands:
1519 Commands:
1491 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1520 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1492 Extensions:
1521 Extensions:
1493 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1522 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1494 Topics:
1523 Topics:
1495 Commands:
1524 Commands:
1496 Extensions:
1525 Extensions:
1497 Extension Commands:
1526 Extension Commands:
1498 $ hg help -c schemes
1527 $ hg help -c schemes
1499 abort: no such help topic: schemes
1528 abort: no such help topic: schemes
1500 (try 'hg help --keyword schemes')
1529 (try 'hg help --keyword schemes')
1501 [255]
1530 [255]
1502 $ hg help -e schemes |head -1
1531 $ hg help -e schemes |head -1
1503 schemes extension - extend schemes with shortcuts to repository swarms
1532 schemes extension - extend schemes with shortcuts to repository swarms
1504 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1533 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1505 Commands:
1534 Commands:
1506 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1535 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1507 Extensions:
1536 Extensions:
1508 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1537 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1509 Extensions:
1538 Extensions:
1510 Commands:
1539 Commands:
1511 $ hg help -c commit > /dev/null
1540 $ hg help -c commit > /dev/null
1512 $ hg help -e -c commit > /dev/null
1541 $ hg help -e -c commit > /dev/null
1513 $ hg help -e commit
1542 $ hg help -e commit
1514 abort: no such help topic: commit
1543 abort: no such help topic: commit
1515 (try 'hg help --keyword commit')
1544 (try 'hg help --keyword commit')
1516 [255]
1545 [255]
1517
1546
1518 Test keyword search help
1547 Test keyword search help
1519
1548
1520 $ cat > prefixedname.py <<EOF
1549 $ cat > prefixedname.py <<EOF
1521 > '''matched against word "clone"
1550 > '''matched against word "clone"
1522 > '''
1551 > '''
1523 > EOF
1552 > EOF
1524 $ echo '[extensions]' >> $HGRCPATH
1553 $ echo '[extensions]' >> $HGRCPATH
1525 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1554 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1526 $ hg help -k clone
1555 $ hg help -k clone
1527 Topics:
1556 Topics:
1528
1557
1529 config Configuration Files
1558 config Configuration Files
1530 extensions Using Additional Features
1559 extensions Using Additional Features
1531 glossary Glossary
1560 glossary Glossary
1532 phases Working with Phases
1561 phases Working with Phases
1533 subrepos Subrepositories
1562 subrepos Subrepositories
1534 urls URL Paths
1563 urls URL Paths
1535
1564
1536 Commands:
1565 Commands:
1537
1566
1538 bookmarks create a new bookmark or list existing bookmarks
1567 bookmarks create a new bookmark or list existing bookmarks
1539 clone make a copy of an existing repository
1568 clone make a copy of an existing repository
1540 paths show aliases for remote repositories
1569 paths show aliases for remote repositories
1541 pull pull changes from the specified source
1570 pull pull changes from the specified source
1542 update update working directory (or switch revisions)
1571 update update working directory (or switch revisions)
1543
1572
1544 Extensions:
1573 Extensions:
1545
1574
1546 clonebundles advertise pre-generated bundles to seed clones
1575 clonebundles advertise pre-generated bundles to seed clones
1547 narrow create clones which fetch history data for subset of files
1576 narrow create clones which fetch history data for subset of files
1548 (EXPERIMENTAL)
1577 (EXPERIMENTAL)
1549 prefixedname matched against word "clone"
1578 prefixedname matched against word "clone"
1550 relink recreates hardlinks between repository clones
1579 relink recreates hardlinks between repository clones
1551
1580
1552 Extension Commands:
1581 Extension Commands:
1553
1582
1554 qclone clone main and patch repository at same time
1583 qclone clone main and patch repository at same time
1555
1584
1556 Test unfound topic
1585 Test unfound topic
1557
1586
1558 $ hg help nonexistingtopicthatwillneverexisteverever
1587 $ hg help nonexistingtopicthatwillneverexisteverever
1559 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1588 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1560 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1589 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1561 [255]
1590 [255]
1562
1591
1563 Test unfound keyword
1592 Test unfound keyword
1564
1593
1565 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1594 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1566 abort: no matches
1595 abort: no matches
1567 (try 'hg help' for a list of topics)
1596 (try 'hg help' for a list of topics)
1568 [255]
1597 [255]
1569
1598
1570 Test omit indicating for help
1599 Test omit indicating for help
1571
1600
1572 $ cat > addverboseitems.py <<EOF
1601 $ cat > addverboseitems.py <<EOF
1573 > '''extension to test omit indicating.
1602 > '''extension to test omit indicating.
1574 >
1603 >
1575 > This paragraph is never omitted (for extension)
1604 > This paragraph is never omitted (for extension)
1576 >
1605 >
1577 > .. container:: verbose
1606 > .. container:: verbose
1578 >
1607 >
1579 > This paragraph is omitted,
1608 > This paragraph is omitted,
1580 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1609 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1581 >
1610 >
1582 > This paragraph is never omitted, too (for extension)
1611 > This paragraph is never omitted, too (for extension)
1583 > '''
1612 > '''
1584 > from __future__ import absolute_import
1613 > from __future__ import absolute_import
1585 > from mercurial import commands, help
1614 > from mercurial import commands, help
1586 > testtopic = """This paragraph is never omitted (for topic).
1615 > testtopic = """This paragraph is never omitted (for topic).
1587 >
1616 >
1588 > .. container:: verbose
1617 > .. container:: verbose
1589 >
1618 >
1590 > This paragraph is omitted,
1619 > This paragraph is omitted,
1591 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1620 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1592 >
1621 >
1593 > This paragraph is never omitted, too (for topic)
1622 > This paragraph is never omitted, too (for topic)
1594 > """
1623 > """
1595 > def extsetup(ui):
1624 > def extsetup(ui):
1596 > help.helptable.append((["topic-containing-verbose"],
1625 > help.helptable.append((["topic-containing-verbose"],
1597 > "This is the topic to test omit indicating.",
1626 > "This is the topic to test omit indicating.",
1598 > lambda ui: testtopic))
1627 > lambda ui: testtopic))
1599 > EOF
1628 > EOF
1600 $ echo '[extensions]' >> $HGRCPATH
1629 $ echo '[extensions]' >> $HGRCPATH
1601 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1630 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1602 $ hg help addverboseitems
1631 $ hg help addverboseitems
1603 addverboseitems extension - extension to test omit indicating.
1632 addverboseitems extension - extension to test omit indicating.
1604
1633
1605 This paragraph is never omitted (for extension)
1634 This paragraph is never omitted (for extension)
1606
1635
1607 This paragraph is never omitted, too (for extension)
1636 This paragraph is never omitted, too (for extension)
1608
1637
1609 (some details hidden, use --verbose to show complete help)
1638 (some details hidden, use --verbose to show complete help)
1610
1639
1611 no commands defined
1640 no commands defined
1612 $ hg help -v addverboseitems
1641 $ hg help -v addverboseitems
1613 addverboseitems extension - extension to test omit indicating.
1642 addverboseitems extension - extension to test omit indicating.
1614
1643
1615 This paragraph is never omitted (for extension)
1644 This paragraph is never omitted (for extension)
1616
1645
1617 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1646 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1618 extension)
1647 extension)
1619
1648
1620 This paragraph is never omitted, too (for extension)
1649 This paragraph is never omitted, too (for extension)
1621
1650
1622 no commands defined
1651 no commands defined
1623 $ hg help topic-containing-verbose
1652 $ hg help topic-containing-verbose
1624 This is the topic to test omit indicating.
1653 This is the topic to test omit indicating.
1625 """"""""""""""""""""""""""""""""""""""""""
1654 """"""""""""""""""""""""""""""""""""""""""
1626
1655
1627 This paragraph is never omitted (for topic).
1656 This paragraph is never omitted (for topic).
1628
1657
1629 This paragraph is never omitted, too (for topic)
1658 This paragraph is never omitted, too (for topic)
1630
1659
1631 (some details hidden, use --verbose to show complete help)
1660 (some details hidden, use --verbose to show complete help)
1632 $ hg help -v topic-containing-verbose
1661 $ hg help -v topic-containing-verbose
1633 This is the topic to test omit indicating.
1662 This is the topic to test omit indicating.
1634 """"""""""""""""""""""""""""""""""""""""""
1663 """"""""""""""""""""""""""""""""""""""""""
1635
1664
1636 This paragraph is never omitted (for topic).
1665 This paragraph is never omitted (for topic).
1637
1666
1638 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1667 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1639 topic)
1668 topic)
1640
1669
1641 This paragraph is never omitted, too (for topic)
1670 This paragraph is never omitted, too (for topic)
1642
1671
1643 Test section lookup
1672 Test section lookup
1644
1673
1645 $ hg help revset.merge
1674 $ hg help revset.merge
1646 "merge()"
1675 "merge()"
1647 Changeset is a merge changeset.
1676 Changeset is a merge changeset.
1648
1677
1649 $ hg help glossary.dag
1678 $ hg help glossary.dag
1650 DAG
1679 DAG
1651 The repository of changesets of a distributed version control system
1680 The repository of changesets of a distributed version control system
1652 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1681 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1653 of nodes and edges, where nodes correspond to changesets and edges
1682 of nodes and edges, where nodes correspond to changesets and edges
1654 imply a parent -> child relation. This graph can be visualized by
1683 imply a parent -> child relation. This graph can be visualized by
1655 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1684 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1656 limited by the requirement for children to have at most two parents.
1685 limited by the requirement for children to have at most two parents.
1657
1686
1658
1687
1659 $ hg help hgrc.paths
1688 $ hg help hgrc.paths
1660 "paths"
1689 "paths"
1661 -------
1690 -------
1662
1691
1663 Assigns symbolic names and behavior to repositories.
1692 Assigns symbolic names and behavior to repositories.
1664
1693
1665 Options are symbolic names defining the URL or directory that is the
1694 Options are symbolic names defining the URL or directory that is the
1666 location of the repository. Example:
1695 location of the repository. Example:
1667
1696
1668 [paths]
1697 [paths]
1669 my_server = https://example.com/my_repo
1698 my_server = https://example.com/my_repo
1670 local_path = /home/me/repo
1699 local_path = /home/me/repo
1671
1700
1672 These symbolic names can be used from the command line. To pull from
1701 These symbolic names can be used from the command line. To pull from
1673 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1702 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1674 local_path'.
1703 local_path'.
1675
1704
1676 Options containing colons (":") denote sub-options that can influence
1705 Options containing colons (":") denote sub-options that can influence
1677 behavior for that specific path. Example:
1706 behavior for that specific path. Example:
1678
1707
1679 [paths]
1708 [paths]
1680 my_server = https://example.com/my_path
1709 my_server = https://example.com/my_path
1681 my_server:pushurl = ssh://example.com/my_path
1710 my_server:pushurl = ssh://example.com/my_path
1682
1711
1683 The following sub-options can be defined:
1712 The following sub-options can be defined:
1684
1713
1685 "pushurl"
1714 "pushurl"
1686 The URL to use for push operations. If not defined, the location
1715 The URL to use for push operations. If not defined, the location
1687 defined by the path's main entry is used.
1716 defined by the path's main entry is used.
1688
1717
1689 "pushrev"
1718 "pushrev"
1690 A revset defining which revisions to push by default.
1719 A revset defining which revisions to push by default.
1691
1720
1692 When 'hg push' is executed without a "-r" argument, the revset defined
1721 When 'hg push' is executed without a "-r" argument, the revset defined
1693 by this sub-option is evaluated to determine what to push.
1722 by this sub-option is evaluated to determine what to push.
1694
1723
1695 For example, a value of "." will push the working directory's revision
1724 For example, a value of "." will push the working directory's revision
1696 by default.
1725 by default.
1697
1726
1698 Revsets specifying bookmarks will not result in the bookmark being
1727 Revsets specifying bookmarks will not result in the bookmark being
1699 pushed.
1728 pushed.
1700
1729
1701 The following special named paths exist:
1730 The following special named paths exist:
1702
1731
1703 "default"
1732 "default"
1704 The URL or directory to use when no source or remote is specified.
1733 The URL or directory to use when no source or remote is specified.
1705
1734
1706 'hg clone' will automatically define this path to the location the
1735 'hg clone' will automatically define this path to the location the
1707 repository was cloned from.
1736 repository was cloned from.
1708
1737
1709 "default-push"
1738 "default-push"
1710 (deprecated) The URL or directory for the default 'hg push' location.
1739 (deprecated) The URL or directory for the default 'hg push' location.
1711 "default:pushurl" should be used instead.
1740 "default:pushurl" should be used instead.
1712
1741
1713 $ hg help glossary.mcguffin
1742 $ hg help glossary.mcguffin
1714 abort: help section not found: glossary.mcguffin
1743 abort: help section not found: glossary.mcguffin
1715 [255]
1744 [255]
1716
1745
1717 $ hg help glossary.mc.guffin
1746 $ hg help glossary.mc.guffin
1718 abort: help section not found: glossary.mc.guffin
1747 abort: help section not found: glossary.mc.guffin
1719 [255]
1748 [255]
1720
1749
1721 $ hg help template.files
1750 $ hg help template.files
1722 files List of strings. All files modified, added, or removed by
1751 files List of strings. All files modified, added, or removed by
1723 this changeset.
1752 this changeset.
1724 files(pattern)
1753 files(pattern)
1725 All files of the current changeset matching the pattern. See
1754 All files of the current changeset matching the pattern. See
1726 'hg help patterns'.
1755 'hg help patterns'.
1727
1756
1728 Test section lookup by translated message
1757 Test section lookup by translated message
1729
1758
1730 str.lower() instead of encoding.lower(str) on translated message might
1759 str.lower() instead of encoding.lower(str) on translated message might
1731 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1760 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1732 as the second or later byte of multi-byte character.
1761 as the second or later byte of multi-byte character.
1733
1762
1734 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1763 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1735 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1764 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1736 replacement makes message meaningless.
1765 replacement makes message meaningless.
1737
1766
1738 This tests that section lookup by translated string isn't broken by
1767 This tests that section lookup by translated string isn't broken by
1739 such str.lower().
1768 such str.lower().
1740
1769
1741 $ $PYTHON <<EOF
1770 $ $PYTHON <<EOF
1742 > def escape(s):
1771 > def escape(s):
1743 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1772 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1744 > # translation of "record" in ja_JP.cp932
1773 > # translation of "record" in ja_JP.cp932
1745 > upper = "\x8bL\x98^"
1774 > upper = "\x8bL\x98^"
1746 > # str.lower()-ed section name should be treated as different one
1775 > # str.lower()-ed section name should be treated as different one
1747 > lower = "\x8bl\x98^"
1776 > lower = "\x8bl\x98^"
1748 > with open('ambiguous.py', 'w') as fp:
1777 > with open('ambiguous.py', 'w') as fp:
1749 > fp.write("""# ambiguous section names in ja_JP.cp932
1778 > fp.write("""# ambiguous section names in ja_JP.cp932
1750 > u'''summary of extension
1779 > u'''summary of extension
1751 >
1780 >
1752 > %s
1781 > %s
1753 > ----
1782 > ----
1754 >
1783 >
1755 > Upper name should show only this message
1784 > Upper name should show only this message
1756 >
1785 >
1757 > %s
1786 > %s
1758 > ----
1787 > ----
1759 >
1788 >
1760 > Lower name should show only this message
1789 > Lower name should show only this message
1761 >
1790 >
1762 > subsequent section
1791 > subsequent section
1763 > ------------------
1792 > ------------------
1764 >
1793 >
1765 > This should be hidden at 'hg help ambiguous' with section name.
1794 > This should be hidden at 'hg help ambiguous' with section name.
1766 > '''
1795 > '''
1767 > """ % (escape(upper), escape(lower)))
1796 > """ % (escape(upper), escape(lower)))
1768 > EOF
1797 > EOF
1769
1798
1770 $ cat >> $HGRCPATH <<EOF
1799 $ cat >> $HGRCPATH <<EOF
1771 > [extensions]
1800 > [extensions]
1772 > ambiguous = ./ambiguous.py
1801 > ambiguous = ./ambiguous.py
1773 > EOF
1802 > EOF
1774
1803
1775 $ $PYTHON <<EOF | sh
1804 $ $PYTHON <<EOF | sh
1776 > upper = "\x8bL\x98^"
1805 > upper = "\x8bL\x98^"
1777 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1806 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1778 > EOF
1807 > EOF
1779 \x8bL\x98^ (esc)
1808 \x8bL\x98^ (esc)
1780 ----
1809 ----
1781
1810
1782 Upper name should show only this message
1811 Upper name should show only this message
1783
1812
1784
1813
1785 $ $PYTHON <<EOF | sh
1814 $ $PYTHON <<EOF | sh
1786 > lower = "\x8bl\x98^"
1815 > lower = "\x8bl\x98^"
1787 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1816 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1788 > EOF
1817 > EOF
1789 \x8bl\x98^ (esc)
1818 \x8bl\x98^ (esc)
1790 ----
1819 ----
1791
1820
1792 Lower name should show only this message
1821 Lower name should show only this message
1793
1822
1794
1823
1795 $ cat >> $HGRCPATH <<EOF
1824 $ cat >> $HGRCPATH <<EOF
1796 > [extensions]
1825 > [extensions]
1797 > ambiguous = !
1826 > ambiguous = !
1798 > EOF
1827 > EOF
1799
1828
1800 Show help content of disabled extensions
1829 Show help content of disabled extensions
1801
1830
1802 $ cat >> $HGRCPATH <<EOF
1831 $ cat >> $HGRCPATH <<EOF
1803 > [extensions]
1832 > [extensions]
1804 > ambiguous = !./ambiguous.py
1833 > ambiguous = !./ambiguous.py
1805 > EOF
1834 > EOF
1806 $ hg help -e ambiguous
1835 $ hg help -e ambiguous
1807 ambiguous extension - (no help text available)
1836 ambiguous extension - (no help text available)
1808
1837
1809 (use 'hg help extensions' for information on enabling extensions)
1838 (use 'hg help extensions' for information on enabling extensions)
1810
1839
1811 Test dynamic list of merge tools only shows up once
1840 Test dynamic list of merge tools only shows up once
1812 $ hg help merge-tools
1841 $ hg help merge-tools
1813 Merge Tools
1842 Merge Tools
1814 """""""""""
1843 """""""""""
1815
1844
1816 To merge files Mercurial uses merge tools.
1845 To merge files Mercurial uses merge tools.
1817
1846
1818 A merge tool combines two different versions of a file into a merged file.
1847 A merge tool combines two different versions of a file into a merged file.
1819 Merge tools are given the two files and the greatest common ancestor of
1848 Merge tools are given the two files and the greatest common ancestor of
1820 the two file versions, so they can determine the changes made on both
1849 the two file versions, so they can determine the changes made on both
1821 branches.
1850 branches.
1822
1851
1823 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1852 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1824 backout' and in several extensions.
1853 backout' and in several extensions.
1825
1854
1826 Usually, the merge tool tries to automatically reconcile the files by
1855 Usually, the merge tool tries to automatically reconcile the files by
1827 combining all non-overlapping changes that occurred separately in the two
1856 combining all non-overlapping changes that occurred separately in the two
1828 different evolutions of the same initial base file. Furthermore, some
1857 different evolutions of the same initial base file. Furthermore, some
1829 interactive merge programs make it easier to manually resolve conflicting
1858 interactive merge programs make it easier to manually resolve conflicting
1830 merges, either in a graphical way, or by inserting some conflict markers.
1859 merges, either in a graphical way, or by inserting some conflict markers.
1831 Mercurial does not include any interactive merge programs but relies on
1860 Mercurial does not include any interactive merge programs but relies on
1832 external tools for that.
1861 external tools for that.
1833
1862
1834 Available merge tools
1863 Available merge tools
1835 =====================
1864 =====================
1836
1865
1837 External merge tools and their properties are configured in the merge-
1866 External merge tools and their properties are configured in the merge-
1838 tools configuration section - see hgrc(5) - but they can often just be
1867 tools configuration section - see hgrc(5) - but they can often just be
1839 named by their executable.
1868 named by their executable.
1840
1869
1841 A merge tool is generally usable if its executable can be found on the
1870 A merge tool is generally usable if its executable can be found on the
1842 system and if it can handle the merge. The executable is found if it is an
1871 system and if it can handle the merge. The executable is found if it is an
1843 absolute or relative executable path or the name of an application in the
1872 absolute or relative executable path or the name of an application in the
1844 executable search path. The tool is assumed to be able to handle the merge
1873 executable search path. The tool is assumed to be able to handle the merge
1845 if it can handle symlinks if the file is a symlink, if it can handle
1874 if it can handle symlinks if the file is a symlink, if it can handle
1846 binary files if the file is binary, and if a GUI is available if the tool
1875 binary files if the file is binary, and if a GUI is available if the tool
1847 requires a GUI.
1876 requires a GUI.
1848
1877
1849 There are some internal merge tools which can be used. The internal merge
1878 There are some internal merge tools which can be used. The internal merge
1850 tools are:
1879 tools are:
1851
1880
1852 ":dump"
1881 ":dump"
1853 Creates three versions of the files to merge, containing the contents of
1882 Creates three versions of the files to merge, containing the contents of
1854 local, other and base. These files can then be used to perform a merge
1883 local, other and base. These files can then be used to perform a merge
1855 manually. If the file to be merged is named "a.txt", these files will
1884 manually. If the file to be merged is named "a.txt", these files will
1856 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1885 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1857 they will be placed in the same directory as "a.txt".
1886 they will be placed in the same directory as "a.txt".
1858
1887
1859 This implies premerge. Therefore, files aren't dumped, if premerge runs
1888 This implies premerge. Therefore, files aren't dumped, if premerge runs
1860 successfully. Use :forcedump to forcibly write files out.
1889 successfully. Use :forcedump to forcibly write files out.
1861
1890
1862 (actual capabilities: binary, symlink)
1891 (actual capabilities: binary, symlink)
1863
1892
1864 ":fail"
1893 ":fail"
1865 Rather than attempting to merge files that were modified on both
1894 Rather than attempting to merge files that were modified on both
1866 branches, it marks them as unresolved. The resolve command must be used
1895 branches, it marks them as unresolved. The resolve command must be used
1867 to resolve these conflicts.
1896 to resolve these conflicts.
1868
1897
1869 (actual capabilities: binary, symlink)
1898 (actual capabilities: binary, symlink)
1870
1899
1871 ":forcedump"
1900 ":forcedump"
1872 Creates three versions of the files as same as :dump, but omits
1901 Creates three versions of the files as same as :dump, but omits
1873 premerge.
1902 premerge.
1874
1903
1875 (actual capabilities: binary, symlink)
1904 (actual capabilities: binary, symlink)
1876
1905
1877 ":local"
1906 ":local"
1878 Uses the local 'p1()' version of files as the merged version.
1907 Uses the local 'p1()' version of files as the merged version.
1879
1908
1880 (actual capabilities: binary, symlink)
1909 (actual capabilities: binary, symlink)
1881
1910
1882 ":merge"
1911 ":merge"
1883 Uses the internal non-interactive simple merge algorithm for merging
1912 Uses the internal non-interactive simple merge algorithm for merging
1884 files. It will fail if there are any conflicts and leave markers in the
1913 files. It will fail if there are any conflicts and leave markers in the
1885 partially merged file. Markers will have two sections, one for each side
1914 partially merged file. Markers will have two sections, one for each side
1886 of merge.
1915 of merge.
1887
1916
1888 ":merge-local"
1917 ":merge-local"
1889 Like :merge, but resolve all conflicts non-interactively in favor of the
1918 Like :merge, but resolve all conflicts non-interactively in favor of the
1890 local 'p1()' changes.
1919 local 'p1()' changes.
1891
1920
1892 ":merge-other"
1921 ":merge-other"
1893 Like :merge, but resolve all conflicts non-interactively in favor of the
1922 Like :merge, but resolve all conflicts non-interactively in favor of the
1894 other 'p2()' changes.
1923 other 'p2()' changes.
1895
1924
1896 ":merge3"
1925 ":merge3"
1897 Uses the internal non-interactive simple merge algorithm for merging
1926 Uses the internal non-interactive simple merge algorithm for merging
1898 files. It will fail if there are any conflicts and leave markers in the
1927 files. It will fail if there are any conflicts and leave markers in the
1899 partially merged file. Marker will have three sections, one from each
1928 partially merged file. Marker will have three sections, one from each
1900 side of the merge and one for the base content.
1929 side of the merge and one for the base content.
1901
1930
1902 ":other"
1931 ":other"
1903 Uses the other 'p2()' version of files as the merged version.
1932 Uses the other 'p2()' version of files as the merged version.
1904
1933
1905 (actual capabilities: binary, symlink)
1934 (actual capabilities: binary, symlink)
1906
1935
1907 ":prompt"
1936 ":prompt"
1908 Asks the user which of the local 'p1()' or the other 'p2()' version to
1937 Asks the user which of the local 'p1()' or the other 'p2()' version to
1909 keep as the merged version.
1938 keep as the merged version.
1910
1939
1911 (actual capabilities: binary, symlink)
1940 (actual capabilities: binary, symlink)
1912
1941
1913 ":tagmerge"
1942 ":tagmerge"
1914 Uses the internal tag merge algorithm (experimental).
1943 Uses the internal tag merge algorithm (experimental).
1915
1944
1916 ":union"
1945 ":union"
1917 Uses the internal non-interactive simple merge algorithm for merging
1946 Uses the internal non-interactive simple merge algorithm for merging
1918 files. It will use both left and right sides for conflict regions. No
1947 files. It will use both left and right sides for conflict regions. No
1919 markers are inserted.
1948 markers are inserted.
1920
1949
1921 Internal tools are always available and do not require a GUI but will by
1950 Internal tools are always available and do not require a GUI but will by
1922 default not handle symlinks or binary files. See next section for detail
1951 default not handle symlinks or binary files. See next section for detail
1923 about "actual capabilities" described above.
1952 about "actual capabilities" described above.
1924
1953
1925 Choosing a merge tool
1954 Choosing a merge tool
1926 =====================
1955 =====================
1927
1956
1928 Mercurial uses these rules when deciding which merge tool to use:
1957 Mercurial uses these rules when deciding which merge tool to use:
1929
1958
1930 1. If a tool has been specified with the --tool option to merge or
1959 1. If a tool has been specified with the --tool option to merge or
1931 resolve, it is used. If it is the name of a tool in the merge-tools
1960 resolve, it is used. If it is the name of a tool in the merge-tools
1932 configuration, its configuration is used. Otherwise the specified tool
1961 configuration, its configuration is used. Otherwise the specified tool
1933 must be executable by the shell.
1962 must be executable by the shell.
1934 2. If the "HGMERGE" environment variable is present, its value is used and
1963 2. If the "HGMERGE" environment variable is present, its value is used and
1935 must be executable by the shell.
1964 must be executable by the shell.
1936 3. If the filename of the file to be merged matches any of the patterns in
1965 3. If the filename of the file to be merged matches any of the patterns in
1937 the merge-patterns configuration section, the first usable merge tool
1966 the merge-patterns configuration section, the first usable merge tool
1938 corresponding to a matching pattern is used.
1967 corresponding to a matching pattern is used.
1939 4. If ui.merge is set it will be considered next. If the value is not the
1968 4. If ui.merge is set it will be considered next. If the value is not the
1940 name of a configured tool, the specified value is used and must be
1969 name of a configured tool, the specified value is used and must be
1941 executable by the shell. Otherwise the named tool is used if it is
1970 executable by the shell. Otherwise the named tool is used if it is
1942 usable.
1971 usable.
1943 5. If any usable merge tools are present in the merge-tools configuration
1972 5. If any usable merge tools are present in the merge-tools configuration
1944 section, the one with the highest priority is used.
1973 section, the one with the highest priority is used.
1945 6. If a program named "hgmerge" can be found on the system, it is used -
1974 6. If a program named "hgmerge" can be found on the system, it is used -
1946 but it will by default not be used for symlinks and binary files.
1975 but it will by default not be used for symlinks and binary files.
1947 7. If the file to be merged is not binary and is not a symlink, then
1976 7. If the file to be merged is not binary and is not a symlink, then
1948 internal ":merge" is used.
1977 internal ":merge" is used.
1949 8. Otherwise, ":prompt" is used.
1978 8. Otherwise, ":prompt" is used.
1950
1979
1951 For historical reason, Mercurial treats merge tools as below while
1980 For historical reason, Mercurial treats merge tools as below while
1952 examining rules above.
1981 examining rules above.
1953
1982
1954 step specified via binary symlink
1983 step specified via binary symlink
1955 ----------------------------------
1984 ----------------------------------
1956 1. --tool o/o o/o
1985 1. --tool o/o o/o
1957 2. HGMERGE o/o o/o
1986 2. HGMERGE o/o o/o
1958 3. merge-patterns o/o(*) x/?(*)
1987 3. merge-patterns o/o(*) x/?(*)
1959 4. ui.merge x/?(*) x/?(*)
1988 4. ui.merge x/?(*) x/?(*)
1960
1989
1961 Each capability column indicates Mercurial behavior for internal/external
1990 Each capability column indicates Mercurial behavior for internal/external
1962 merge tools at examining each rule.
1991 merge tools at examining each rule.
1963
1992
1964 - "o": "assume that a tool has capability"
1993 - "o": "assume that a tool has capability"
1965 - "x": "assume that a tool does not have capability"
1994 - "x": "assume that a tool does not have capability"
1966 - "?": "check actual capability of a tool"
1995 - "?": "check actual capability of a tool"
1967
1996
1968 If "merge.strict-capability-check" configuration is true, Mercurial checks
1997 If "merge.strict-capability-check" configuration is true, Mercurial checks
1969 capabilities of merge tools strictly in (*) cases above (= each capability
1998 capabilities of merge tools strictly in (*) cases above (= each capability
1970 column becomes "?/?"). It is false by default for backward compatibility.
1999 column becomes "?/?"). It is false by default for backward compatibility.
1971
2000
1972 Note:
2001 Note:
1973 After selecting a merge program, Mercurial will by default attempt to
2002 After selecting a merge program, Mercurial will by default attempt to
1974 merge the files using a simple merge algorithm first. Only if it
2003 merge the files using a simple merge algorithm first. Only if it
1975 doesn't succeed because of conflicting changes will Mercurial actually
2004 doesn't succeed because of conflicting changes will Mercurial actually
1976 execute the merge program. Whether to use the simple merge algorithm
2005 execute the merge program. Whether to use the simple merge algorithm
1977 first can be controlled by the premerge setting of the merge tool.
2006 first can be controlled by the premerge setting of the merge tool.
1978 Premerge is enabled by default unless the file is binary or a symlink.
2007 Premerge is enabled by default unless the file is binary or a symlink.
1979
2008
1980 See the merge-tools and ui sections of hgrc(5) for details on the
2009 See the merge-tools and ui sections of hgrc(5) for details on the
1981 configuration of merge tools.
2010 configuration of merge tools.
1982
2011
1983 Compression engines listed in `hg help bundlespec`
2012 Compression engines listed in `hg help bundlespec`
1984
2013
1985 $ hg help bundlespec | grep gzip
2014 $ hg help bundlespec | grep gzip
1986 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2015 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1987 An algorithm that produces smaller bundles than "gzip".
2016 An algorithm that produces smaller bundles than "gzip".
1988 This engine will likely produce smaller bundles than "gzip" but will be
2017 This engine will likely produce smaller bundles than "gzip" but will be
1989 "gzip"
2018 "gzip"
1990 better compression than "gzip". It also frequently yields better (?)
2019 better compression than "gzip". It also frequently yields better (?)
1991
2020
1992 Test usage of section marks in help documents
2021 Test usage of section marks in help documents
1993
2022
1994 $ cd "$TESTDIR"/../doc
2023 $ cd "$TESTDIR"/../doc
1995 $ $PYTHON check-seclevel.py
2024 $ $PYTHON check-seclevel.py
1996 $ cd $TESTTMP
2025 $ cd $TESTTMP
1997
2026
1998 #if serve
2027 #if serve
1999
2028
2000 Test the help pages in hgweb.
2029 Test the help pages in hgweb.
2001
2030
2002 Dish up an empty repo; serve it cold.
2031 Dish up an empty repo; serve it cold.
2003
2032
2004 $ hg init "$TESTTMP/test"
2033 $ hg init "$TESTTMP/test"
2005 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2034 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2006 $ cat hg.pid >> $DAEMON_PIDS
2035 $ cat hg.pid >> $DAEMON_PIDS
2007
2036
2008 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2037 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2009 200 Script output follows
2038 200 Script output follows
2010
2039
2011 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2040 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2012 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2041 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2013 <head>
2042 <head>
2014 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2043 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2015 <meta name="robots" content="index, nofollow" />
2044 <meta name="robots" content="index, nofollow" />
2016 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2045 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2017 <script type="text/javascript" src="/static/mercurial.js"></script>
2046 <script type="text/javascript" src="/static/mercurial.js"></script>
2018
2047
2019 <title>Help: Index</title>
2048 <title>Help: Index</title>
2020 </head>
2049 </head>
2021 <body>
2050 <body>
2022
2051
2023 <div class="container">
2052 <div class="container">
2024 <div class="menu">
2053 <div class="menu">
2025 <div class="logo">
2054 <div class="logo">
2026 <a href="https://mercurial-scm.org/">
2055 <a href="https://mercurial-scm.org/">
2027 <img src="/static/hglogo.png" alt="mercurial" /></a>
2056 <img src="/static/hglogo.png" alt="mercurial" /></a>
2028 </div>
2057 </div>
2029 <ul>
2058 <ul>
2030 <li><a href="/shortlog">log</a></li>
2059 <li><a href="/shortlog">log</a></li>
2031 <li><a href="/graph">graph</a></li>
2060 <li><a href="/graph">graph</a></li>
2032 <li><a href="/tags">tags</a></li>
2061 <li><a href="/tags">tags</a></li>
2033 <li><a href="/bookmarks">bookmarks</a></li>
2062 <li><a href="/bookmarks">bookmarks</a></li>
2034 <li><a href="/branches">branches</a></li>
2063 <li><a href="/branches">branches</a></li>
2035 </ul>
2064 </ul>
2036 <ul>
2065 <ul>
2037 <li class="active">help</li>
2066 <li class="active">help</li>
2038 </ul>
2067 </ul>
2039 </div>
2068 </div>
2040
2069
2041 <div class="main">
2070 <div class="main">
2042 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2071 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2043
2072
2044 <form class="search" action="/log">
2073 <form class="search" action="/log">
2045
2074
2046 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2075 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2047 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2076 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2048 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2077 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2049 </form>
2078 </form>
2050 <table class="bigtable">
2079 <table class="bigtable">
2051 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2080 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2052
2081
2053 <tr><td>
2082 <tr><td>
2054 <a href="/help/bundlespec">
2083 <a href="/help/bundlespec">
2055 bundlespec
2084 bundlespec
2056 </a>
2085 </a>
2057 </td><td>
2086 </td><td>
2058 Bundle File Formats
2087 Bundle File Formats
2059 </td></tr>
2088 </td></tr>
2060 <tr><td>
2089 <tr><td>
2061 <a href="/help/color">
2090 <a href="/help/color">
2062 color
2091 color
2063 </a>
2092 </a>
2064 </td><td>
2093 </td><td>
2065 Colorizing Outputs
2094 Colorizing Outputs
2066 </td></tr>
2095 </td></tr>
2067 <tr><td>
2096 <tr><td>
2068 <a href="/help/config">
2097 <a href="/help/config">
2069 config
2098 config
2070 </a>
2099 </a>
2071 </td><td>
2100 </td><td>
2072 Configuration Files
2101 Configuration Files
2073 </td></tr>
2102 </td></tr>
2074 <tr><td>
2103 <tr><td>
2075 <a href="/help/dates">
2104 <a href="/help/dates">
2076 dates
2105 dates
2077 </a>
2106 </a>
2078 </td><td>
2107 </td><td>
2079 Date Formats
2108 Date Formats
2080 </td></tr>
2109 </td></tr>
2081 <tr><td>
2110 <tr><td>
2082 <a href="/help/deprecated">
2111 <a href="/help/deprecated">
2083 deprecated
2112 deprecated
2084 </a>
2113 </a>
2085 </td><td>
2114 </td><td>
2086 Deprecated Features
2115 Deprecated Features
2087 </td></tr>
2116 </td></tr>
2088 <tr><td>
2117 <tr><td>
2089 <a href="/help/diffs">
2118 <a href="/help/diffs">
2090 diffs
2119 diffs
2091 </a>
2120 </a>
2092 </td><td>
2121 </td><td>
2093 Diff Formats
2122 Diff Formats
2094 </td></tr>
2123 </td></tr>
2095 <tr><td>
2124 <tr><td>
2096 <a href="/help/environment">
2125 <a href="/help/environment">
2097 environment
2126 environment
2098 </a>
2127 </a>
2099 </td><td>
2128 </td><td>
2100 Environment Variables
2129 Environment Variables
2101 </td></tr>
2130 </td></tr>
2102 <tr><td>
2131 <tr><td>
2103 <a href="/help/extensions">
2132 <a href="/help/extensions">
2104 extensions
2133 extensions
2105 </a>
2134 </a>
2106 </td><td>
2135 </td><td>
2107 Using Additional Features
2136 Using Additional Features
2108 </td></tr>
2137 </td></tr>
2109 <tr><td>
2138 <tr><td>
2110 <a href="/help/filesets">
2139 <a href="/help/filesets">
2111 filesets
2140 filesets
2112 </a>
2141 </a>
2113 </td><td>
2142 </td><td>
2114 Specifying File Sets
2143 Specifying File Sets
2115 </td></tr>
2144 </td></tr>
2116 <tr><td>
2145 <tr><td>
2117 <a href="/help/flags">
2146 <a href="/help/flags">
2118 flags
2147 flags
2119 </a>
2148 </a>
2120 </td><td>
2149 </td><td>
2121 Command-line flags
2150 Command-line flags
2122 </td></tr>
2151 </td></tr>
2123 <tr><td>
2152 <tr><td>
2124 <a href="/help/glossary">
2153 <a href="/help/glossary">
2125 glossary
2154 glossary
2126 </a>
2155 </a>
2127 </td><td>
2156 </td><td>
2128 Glossary
2157 Glossary
2129 </td></tr>
2158 </td></tr>
2130 <tr><td>
2159 <tr><td>
2131 <a href="/help/hgignore">
2160 <a href="/help/hgignore">
2132 hgignore
2161 hgignore
2133 </a>
2162 </a>
2134 </td><td>
2163 </td><td>
2135 Syntax for Mercurial Ignore Files
2164 Syntax for Mercurial Ignore Files
2136 </td></tr>
2165 </td></tr>
2137 <tr><td>
2166 <tr><td>
2138 <a href="/help/hgweb">
2167 <a href="/help/hgweb">
2139 hgweb
2168 hgweb
2140 </a>
2169 </a>
2141 </td><td>
2170 </td><td>
2142 Configuring hgweb
2171 Configuring hgweb
2143 </td></tr>
2172 </td></tr>
2144 <tr><td>
2173 <tr><td>
2145 <a href="/help/internals">
2174 <a href="/help/internals">
2146 internals
2175 internals
2147 </a>
2176 </a>
2148 </td><td>
2177 </td><td>
2149 Technical implementation topics
2178 Technical implementation topics
2150 </td></tr>
2179 </td></tr>
2151 <tr><td>
2180 <tr><td>
2152 <a href="/help/merge-tools">
2181 <a href="/help/merge-tools">
2153 merge-tools
2182 merge-tools
2154 </a>
2183 </a>
2155 </td><td>
2184 </td><td>
2156 Merge Tools
2185 Merge Tools
2157 </td></tr>
2186 </td></tr>
2158 <tr><td>
2187 <tr><td>
2159 <a href="/help/pager">
2188 <a href="/help/pager">
2160 pager
2189 pager
2161 </a>
2190 </a>
2162 </td><td>
2191 </td><td>
2163 Pager Support
2192 Pager Support
2164 </td></tr>
2193 </td></tr>
2165 <tr><td>
2194 <tr><td>
2166 <a href="/help/patterns">
2195 <a href="/help/patterns">
2167 patterns
2196 patterns
2168 </a>
2197 </a>
2169 </td><td>
2198 </td><td>
2170 File Name Patterns
2199 File Name Patterns
2171 </td></tr>
2200 </td></tr>
2172 <tr><td>
2201 <tr><td>
2173 <a href="/help/phases">
2202 <a href="/help/phases">
2174 phases
2203 phases
2175 </a>
2204 </a>
2176 </td><td>
2205 </td><td>
2177 Working with Phases
2206 Working with Phases
2178 </td></tr>
2207 </td></tr>
2179 <tr><td>
2208 <tr><td>
2180 <a href="/help/revisions">
2209 <a href="/help/revisions">
2181 revisions
2210 revisions
2182 </a>
2211 </a>
2183 </td><td>
2212 </td><td>
2184 Specifying Revisions
2213 Specifying Revisions
2185 </td></tr>
2214 </td></tr>
2186 <tr><td>
2215 <tr><td>
2187 <a href="/help/scripting">
2216 <a href="/help/scripting">
2188 scripting
2217 scripting
2189 </a>
2218 </a>
2190 </td><td>
2219 </td><td>
2191 Using Mercurial from scripts and automation
2220 Using Mercurial from scripts and automation
2192 </td></tr>
2221 </td></tr>
2193 <tr><td>
2222 <tr><td>
2194 <a href="/help/subrepos">
2223 <a href="/help/subrepos">
2195 subrepos
2224 subrepos
2196 </a>
2225 </a>
2197 </td><td>
2226 </td><td>
2198 Subrepositories
2227 Subrepositories
2199 </td></tr>
2228 </td></tr>
2200 <tr><td>
2229 <tr><td>
2201 <a href="/help/templating">
2230 <a href="/help/templating">
2202 templating
2231 templating
2203 </a>
2232 </a>
2204 </td><td>
2233 </td><td>
2205 Template Usage
2234 Template Usage
2206 </td></tr>
2235 </td></tr>
2207 <tr><td>
2236 <tr><td>
2208 <a href="/help/urls">
2237 <a href="/help/urls">
2209 urls
2238 urls
2210 </a>
2239 </a>
2211 </td><td>
2240 </td><td>
2212 URL Paths
2241 URL Paths
2213 </td></tr>
2242 </td></tr>
2214 <tr><td>
2243 <tr><td>
2215 <a href="/help/topic-containing-verbose">
2244 <a href="/help/topic-containing-verbose">
2216 topic-containing-verbose
2245 topic-containing-verbose
2217 </a>
2246 </a>
2218 </td><td>
2247 </td><td>
2219 This is the topic to test omit indicating.
2248 This is the topic to test omit indicating.
2220 </td></tr>
2249 </td></tr>
2221
2250
2222
2251
2223 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2252 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2224
2253
2225 <tr><td>
2254 <tr><td>
2226 <a href="/help/add">
2255 <a href="/help/add">
2227 add
2256 add
2228 </a>
2257 </a>
2229 </td><td>
2258 </td><td>
2230 add the specified files on the next commit
2259 add the specified files on the next commit
2231 </td></tr>
2260 </td></tr>
2232 <tr><td>
2261 <tr><td>
2233 <a href="/help/annotate">
2262 <a href="/help/annotate">
2234 annotate
2263 annotate
2235 </a>
2264 </a>
2236 </td><td>
2265 </td><td>
2237 show changeset information by line for each file
2266 show changeset information by line for each file
2238 </td></tr>
2267 </td></tr>
2239 <tr><td>
2268 <tr><td>
2240 <a href="/help/clone">
2269 <a href="/help/clone">
2241 clone
2270 clone
2242 </a>
2271 </a>
2243 </td><td>
2272 </td><td>
2244 make a copy of an existing repository
2273 make a copy of an existing repository
2245 </td></tr>
2274 </td></tr>
2246 <tr><td>
2275 <tr><td>
2247 <a href="/help/commit">
2276 <a href="/help/commit">
2248 commit
2277 commit
2249 </a>
2278 </a>
2250 </td><td>
2279 </td><td>
2251 commit the specified files or all outstanding changes
2280 commit the specified files or all outstanding changes
2252 </td></tr>
2281 </td></tr>
2253 <tr><td>
2282 <tr><td>
2254 <a href="/help/diff">
2283 <a href="/help/diff">
2255 diff
2284 diff
2256 </a>
2285 </a>
2257 </td><td>
2286 </td><td>
2258 diff repository (or selected files)
2287 diff repository (or selected files)
2259 </td></tr>
2288 </td></tr>
2260 <tr><td>
2289 <tr><td>
2261 <a href="/help/export">
2290 <a href="/help/export">
2262 export
2291 export
2263 </a>
2292 </a>
2264 </td><td>
2293 </td><td>
2265 dump the header and diffs for one or more changesets
2294 dump the header and diffs for one or more changesets
2266 </td></tr>
2295 </td></tr>
2267 <tr><td>
2296 <tr><td>
2268 <a href="/help/forget">
2297 <a href="/help/forget">
2269 forget
2298 forget
2270 </a>
2299 </a>
2271 </td><td>
2300 </td><td>
2272 forget the specified files on the next commit
2301 forget the specified files on the next commit
2273 </td></tr>
2302 </td></tr>
2274 <tr><td>
2303 <tr><td>
2275 <a href="/help/init">
2304 <a href="/help/init">
2276 init
2305 init
2277 </a>
2306 </a>
2278 </td><td>
2307 </td><td>
2279 create a new repository in the given directory
2308 create a new repository in the given directory
2280 </td></tr>
2309 </td></tr>
2281 <tr><td>
2310 <tr><td>
2282 <a href="/help/log">
2311 <a href="/help/log">
2283 log
2312 log
2284 </a>
2313 </a>
2285 </td><td>
2314 </td><td>
2286 show revision history of entire repository or files
2315 show revision history of entire repository or files
2287 </td></tr>
2316 </td></tr>
2288 <tr><td>
2317 <tr><td>
2289 <a href="/help/merge">
2318 <a href="/help/merge">
2290 merge
2319 merge
2291 </a>
2320 </a>
2292 </td><td>
2321 </td><td>
2293 merge another revision into working directory
2322 merge another revision into working directory
2294 </td></tr>
2323 </td></tr>
2295 <tr><td>
2324 <tr><td>
2296 <a href="/help/pull">
2325 <a href="/help/pull">
2297 pull
2326 pull
2298 </a>
2327 </a>
2299 </td><td>
2328 </td><td>
2300 pull changes from the specified source
2329 pull changes from the specified source
2301 </td></tr>
2330 </td></tr>
2302 <tr><td>
2331 <tr><td>
2303 <a href="/help/push">
2332 <a href="/help/push">
2304 push
2333 push
2305 </a>
2334 </a>
2306 </td><td>
2335 </td><td>
2307 push changes to the specified destination
2336 push changes to the specified destination
2308 </td></tr>
2337 </td></tr>
2309 <tr><td>
2338 <tr><td>
2310 <a href="/help/remove">
2339 <a href="/help/remove">
2311 remove
2340 remove
2312 </a>
2341 </a>
2313 </td><td>
2342 </td><td>
2314 remove the specified files on the next commit
2343 remove the specified files on the next commit
2315 </td></tr>
2344 </td></tr>
2316 <tr><td>
2345 <tr><td>
2317 <a href="/help/serve">
2346 <a href="/help/serve">
2318 serve
2347 serve
2319 </a>
2348 </a>
2320 </td><td>
2349 </td><td>
2321 start stand-alone webserver
2350 start stand-alone webserver
2322 </td></tr>
2351 </td></tr>
2323 <tr><td>
2352 <tr><td>
2324 <a href="/help/status">
2353 <a href="/help/status">
2325 status
2354 status
2326 </a>
2355 </a>
2327 </td><td>
2356 </td><td>
2328 show changed files in the working directory
2357 show changed files in the working directory
2329 </td></tr>
2358 </td></tr>
2330 <tr><td>
2359 <tr><td>
2331 <a href="/help/summary">
2360 <a href="/help/summary">
2332 summary
2361 summary
2333 </a>
2362 </a>
2334 </td><td>
2363 </td><td>
2335 summarize working directory state
2364 summarize working directory state
2336 </td></tr>
2365 </td></tr>
2337 <tr><td>
2366 <tr><td>
2338 <a href="/help/update">
2367 <a href="/help/update">
2339 update
2368 update
2340 </a>
2369 </a>
2341 </td><td>
2370 </td><td>
2342 update working directory (or switch revisions)
2371 update working directory (or switch revisions)
2343 </td></tr>
2372 </td></tr>
2344
2373
2345
2374
2346
2375
2347 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2376 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2348
2377
2349 <tr><td>
2378 <tr><td>
2350 <a href="/help/addremove">
2379 <a href="/help/addremove">
2351 addremove
2380 addremove
2352 </a>
2381 </a>
2353 </td><td>
2382 </td><td>
2354 add all new files, delete all missing files
2383 add all new files, delete all missing files
2355 </td></tr>
2384 </td></tr>
2356 <tr><td>
2385 <tr><td>
2357 <a href="/help/archive">
2386 <a href="/help/archive">
2358 archive
2387 archive
2359 </a>
2388 </a>
2360 </td><td>
2389 </td><td>
2361 create an unversioned archive of a repository revision
2390 create an unversioned archive of a repository revision
2362 </td></tr>
2391 </td></tr>
2363 <tr><td>
2392 <tr><td>
2364 <a href="/help/backout">
2393 <a href="/help/backout">
2365 backout
2394 backout
2366 </a>
2395 </a>
2367 </td><td>
2396 </td><td>
2368 reverse effect of earlier changeset
2397 reverse effect of earlier changeset
2369 </td></tr>
2398 </td></tr>
2370 <tr><td>
2399 <tr><td>
2371 <a href="/help/bisect">
2400 <a href="/help/bisect">
2372 bisect
2401 bisect
2373 </a>
2402 </a>
2374 </td><td>
2403 </td><td>
2375 subdivision search of changesets
2404 subdivision search of changesets
2376 </td></tr>
2405 </td></tr>
2377 <tr><td>
2406 <tr><td>
2378 <a href="/help/bookmarks">
2407 <a href="/help/bookmarks">
2379 bookmarks
2408 bookmarks
2380 </a>
2409 </a>
2381 </td><td>
2410 </td><td>
2382 create a new bookmark or list existing bookmarks
2411 create a new bookmark or list existing bookmarks
2383 </td></tr>
2412 </td></tr>
2384 <tr><td>
2413 <tr><td>
2385 <a href="/help/branch">
2414 <a href="/help/branch">
2386 branch
2415 branch
2387 </a>
2416 </a>
2388 </td><td>
2417 </td><td>
2389 set or show the current branch name
2418 set or show the current branch name
2390 </td></tr>
2419 </td></tr>
2391 <tr><td>
2420 <tr><td>
2392 <a href="/help/branches">
2421 <a href="/help/branches">
2393 branches
2422 branches
2394 </a>
2423 </a>
2395 </td><td>
2424 </td><td>
2396 list repository named branches
2425 list repository named branches
2397 </td></tr>
2426 </td></tr>
2398 <tr><td>
2427 <tr><td>
2399 <a href="/help/bundle">
2428 <a href="/help/bundle">
2400 bundle
2429 bundle
2401 </a>
2430 </a>
2402 </td><td>
2431 </td><td>
2403 create a bundle file
2432 create a bundle file
2404 </td></tr>
2433 </td></tr>
2405 <tr><td>
2434 <tr><td>
2406 <a href="/help/cat">
2435 <a href="/help/cat">
2407 cat
2436 cat
2408 </a>
2437 </a>
2409 </td><td>
2438 </td><td>
2410 output the current or given revision of files
2439 output the current or given revision of files
2411 </td></tr>
2440 </td></tr>
2412 <tr><td>
2441 <tr><td>
2413 <a href="/help/config">
2442 <a href="/help/config">
2414 config
2443 config
2415 </a>
2444 </a>
2416 </td><td>
2445 </td><td>
2417 show combined config settings from all hgrc files
2446 show combined config settings from all hgrc files
2418 </td></tr>
2447 </td></tr>
2419 <tr><td>
2448 <tr><td>
2420 <a href="/help/copy">
2449 <a href="/help/copy">
2421 copy
2450 copy
2422 </a>
2451 </a>
2423 </td><td>
2452 </td><td>
2424 mark files as copied for the next commit
2453 mark files as copied for the next commit
2425 </td></tr>
2454 </td></tr>
2426 <tr><td>
2455 <tr><td>
2427 <a href="/help/files">
2456 <a href="/help/files">
2428 files
2457 files
2429 </a>
2458 </a>
2430 </td><td>
2459 </td><td>
2431 list tracked files
2460 list tracked files
2432 </td></tr>
2461 </td></tr>
2433 <tr><td>
2462 <tr><td>
2434 <a href="/help/graft">
2463 <a href="/help/graft">
2435 graft
2464 graft
2436 </a>
2465 </a>
2437 </td><td>
2466 </td><td>
2438 copy changes from other branches onto the current branch
2467 copy changes from other branches onto the current branch
2439 </td></tr>
2468 </td></tr>
2440 <tr><td>
2469 <tr><td>
2441 <a href="/help/grep">
2470 <a href="/help/grep">
2442 grep
2471 grep
2443 </a>
2472 </a>
2444 </td><td>
2473 </td><td>
2445 search revision history for a pattern in specified files
2474 search revision history for a pattern in specified files
2446 </td></tr>
2475 </td></tr>
2447 <tr><td>
2476 <tr><td>
2448 <a href="/help/heads">
2477 <a href="/help/heads">
2449 heads
2478 heads
2450 </a>
2479 </a>
2451 </td><td>
2480 </td><td>
2452 show branch heads
2481 show branch heads
2453 </td></tr>
2482 </td></tr>
2454 <tr><td>
2483 <tr><td>
2455 <a href="/help/help">
2484 <a href="/help/help">
2456 help
2485 help
2457 </a>
2486 </a>
2458 </td><td>
2487 </td><td>
2459 show help for a given topic or a help overview
2488 show help for a given topic or a help overview
2460 </td></tr>
2489 </td></tr>
2461 <tr><td>
2490 <tr><td>
2462 <a href="/help/hgalias">
2491 <a href="/help/hgalias">
2463 hgalias
2492 hgalias
2464 </a>
2493 </a>
2465 </td><td>
2494 </td><td>
2466 summarize working directory state
2495 summarize working directory state
2467 </td></tr>
2496 </td></tr>
2468 <tr><td>
2497 <tr><td>
2469 <a href="/help/identify">
2498 <a href="/help/identify">
2470 identify
2499 identify
2471 </a>
2500 </a>
2472 </td><td>
2501 </td><td>
2473 identify the working directory or specified revision
2502 identify the working directory or specified revision
2474 </td></tr>
2503 </td></tr>
2475 <tr><td>
2504 <tr><td>
2476 <a href="/help/import">
2505 <a href="/help/import">
2477 import
2506 import
2478 </a>
2507 </a>
2479 </td><td>
2508 </td><td>
2480 import an ordered set of patches
2509 import an ordered set of patches
2481 </td></tr>
2510 </td></tr>
2482 <tr><td>
2511 <tr><td>
2483 <a href="/help/incoming">
2512 <a href="/help/incoming">
2484 incoming
2513 incoming
2485 </a>
2514 </a>
2486 </td><td>
2515 </td><td>
2487 show new changesets found in source
2516 show new changesets found in source
2488 </td></tr>
2517 </td></tr>
2489 <tr><td>
2518 <tr><td>
2490 <a href="/help/manifest">
2519 <a href="/help/manifest">
2491 manifest
2520 manifest
2492 </a>
2521 </a>
2493 </td><td>
2522 </td><td>
2494 output the current or given revision of the project manifest
2523 output the current or given revision of the project manifest
2495 </td></tr>
2524 </td></tr>
2496 <tr><td>
2525 <tr><td>
2497 <a href="/help/nohelp">
2526 <a href="/help/nohelp">
2498 nohelp
2527 nohelp
2499 </a>
2528 </a>
2500 </td><td>
2529 </td><td>
2501 (no help text available)
2530 (no help text available)
2502 </td></tr>
2531 </td></tr>
2503 <tr><td>
2532 <tr><td>
2504 <a href="/help/outgoing">
2533 <a href="/help/outgoing">
2505 outgoing
2534 outgoing
2506 </a>
2535 </a>
2507 </td><td>
2536 </td><td>
2508 show changesets not found in the destination
2537 show changesets not found in the destination
2509 </td></tr>
2538 </td></tr>
2510 <tr><td>
2539 <tr><td>
2511 <a href="/help/paths">
2540 <a href="/help/paths">
2512 paths
2541 paths
2513 </a>
2542 </a>
2514 </td><td>
2543 </td><td>
2515 show aliases for remote repositories
2544 show aliases for remote repositories
2516 </td></tr>
2545 </td></tr>
2517 <tr><td>
2546 <tr><td>
2518 <a href="/help/phase">
2547 <a href="/help/phase">
2519 phase
2548 phase
2520 </a>
2549 </a>
2521 </td><td>
2550 </td><td>
2522 set or show the current phase name
2551 set or show the current phase name
2523 </td></tr>
2552 </td></tr>
2524 <tr><td>
2553 <tr><td>
2525 <a href="/help/recover">
2554 <a href="/help/recover">
2526 recover
2555 recover
2527 </a>
2556 </a>
2528 </td><td>
2557 </td><td>
2529 roll back an interrupted transaction
2558 roll back an interrupted transaction
2530 </td></tr>
2559 </td></tr>
2531 <tr><td>
2560 <tr><td>
2532 <a href="/help/rename">
2561 <a href="/help/rename">
2533 rename
2562 rename
2534 </a>
2563 </a>
2535 </td><td>
2564 </td><td>
2536 rename files; equivalent of copy + remove
2565 rename files; equivalent of copy + remove
2537 </td></tr>
2566 </td></tr>
2538 <tr><td>
2567 <tr><td>
2539 <a href="/help/resolve">
2568 <a href="/help/resolve">
2540 resolve
2569 resolve
2541 </a>
2570 </a>
2542 </td><td>
2571 </td><td>
2543 redo merges or set/view the merge status of files
2572 redo merges or set/view the merge status of files
2544 </td></tr>
2573 </td></tr>
2545 <tr><td>
2574 <tr><td>
2546 <a href="/help/revert">
2575 <a href="/help/revert">
2547 revert
2576 revert
2548 </a>
2577 </a>
2549 </td><td>
2578 </td><td>
2550 restore files to their checkout state
2579 restore files to their checkout state
2551 </td></tr>
2580 </td></tr>
2552 <tr><td>
2581 <tr><td>
2553 <a href="/help/root">
2582 <a href="/help/root">
2554 root
2583 root
2555 </a>
2584 </a>
2556 </td><td>
2585 </td><td>
2557 print the root (top) of the current working directory
2586 print the root (top) of the current working directory
2558 </td></tr>
2587 </td></tr>
2559 <tr><td>
2588 <tr><td>
2560 <a href="/help/shellalias">
2589 <a href="/help/shellalias">
2561 shellalias
2590 shellalias
2562 </a>
2591 </a>
2563 </td><td>
2592 </td><td>
2564 (no help text available)
2593 (no help text available)
2565 </td></tr>
2594 </td></tr>
2566 <tr><td>
2595 <tr><td>
2567 <a href="/help/tag">
2596 <a href="/help/tag">
2568 tag
2597 tag
2569 </a>
2598 </a>
2570 </td><td>
2599 </td><td>
2571 add one or more tags for the current or given revision
2600 add one or more tags for the current or given revision
2572 </td></tr>
2601 </td></tr>
2573 <tr><td>
2602 <tr><td>
2574 <a href="/help/tags">
2603 <a href="/help/tags">
2575 tags
2604 tags
2576 </a>
2605 </a>
2577 </td><td>
2606 </td><td>
2578 list repository tags
2607 list repository tags
2579 </td></tr>
2608 </td></tr>
2580 <tr><td>
2609 <tr><td>
2581 <a href="/help/unbundle">
2610 <a href="/help/unbundle">
2582 unbundle
2611 unbundle
2583 </a>
2612 </a>
2584 </td><td>
2613 </td><td>
2585 apply one or more bundle files
2614 apply one or more bundle files
2586 </td></tr>
2615 </td></tr>
2587 <tr><td>
2616 <tr><td>
2588 <a href="/help/verify">
2617 <a href="/help/verify">
2589 verify
2618 verify
2590 </a>
2619 </a>
2591 </td><td>
2620 </td><td>
2592 verify the integrity of the repository
2621 verify the integrity of the repository
2593 </td></tr>
2622 </td></tr>
2594 <tr><td>
2623 <tr><td>
2595 <a href="/help/version">
2624 <a href="/help/version">
2596 version
2625 version
2597 </a>
2626 </a>
2598 </td><td>
2627 </td><td>
2599 output version and copyright information
2628 output version and copyright information
2600 </td></tr>
2629 </td></tr>
2601
2630
2602
2631
2603 </table>
2632 </table>
2604 </div>
2633 </div>
2605 </div>
2634 </div>
2606
2635
2607
2636
2608
2637
2609 </body>
2638 </body>
2610 </html>
2639 </html>
2611
2640
2612
2641
2613 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2642 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2614 200 Script output follows
2643 200 Script output follows
2615
2644
2616 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2645 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2617 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2646 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2618 <head>
2647 <head>
2619 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2648 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2620 <meta name="robots" content="index, nofollow" />
2649 <meta name="robots" content="index, nofollow" />
2621 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2650 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2622 <script type="text/javascript" src="/static/mercurial.js"></script>
2651 <script type="text/javascript" src="/static/mercurial.js"></script>
2623
2652
2624 <title>Help: add</title>
2653 <title>Help: add</title>
2625 </head>
2654 </head>
2626 <body>
2655 <body>
2627
2656
2628 <div class="container">
2657 <div class="container">
2629 <div class="menu">
2658 <div class="menu">
2630 <div class="logo">
2659 <div class="logo">
2631 <a href="https://mercurial-scm.org/">
2660 <a href="https://mercurial-scm.org/">
2632 <img src="/static/hglogo.png" alt="mercurial" /></a>
2661 <img src="/static/hglogo.png" alt="mercurial" /></a>
2633 </div>
2662 </div>
2634 <ul>
2663 <ul>
2635 <li><a href="/shortlog">log</a></li>
2664 <li><a href="/shortlog">log</a></li>
2636 <li><a href="/graph">graph</a></li>
2665 <li><a href="/graph">graph</a></li>
2637 <li><a href="/tags">tags</a></li>
2666 <li><a href="/tags">tags</a></li>
2638 <li><a href="/bookmarks">bookmarks</a></li>
2667 <li><a href="/bookmarks">bookmarks</a></li>
2639 <li><a href="/branches">branches</a></li>
2668 <li><a href="/branches">branches</a></li>
2640 </ul>
2669 </ul>
2641 <ul>
2670 <ul>
2642 <li class="active"><a href="/help">help</a></li>
2671 <li class="active"><a href="/help">help</a></li>
2643 </ul>
2672 </ul>
2644 </div>
2673 </div>
2645
2674
2646 <div class="main">
2675 <div class="main">
2647 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2676 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2648 <h3>Help: add</h3>
2677 <h3>Help: add</h3>
2649
2678
2650 <form class="search" action="/log">
2679 <form class="search" action="/log">
2651
2680
2652 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2681 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2653 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2682 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2654 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2683 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2655 </form>
2684 </form>
2656 <div id="doc">
2685 <div id="doc">
2657 <p>
2686 <p>
2658 hg add [OPTION]... [FILE]...
2687 hg add [OPTION]... [FILE]...
2659 </p>
2688 </p>
2660 <p>
2689 <p>
2661 add the specified files on the next commit
2690 add the specified files on the next commit
2662 </p>
2691 </p>
2663 <p>
2692 <p>
2664 Schedule files to be version controlled and added to the
2693 Schedule files to be version controlled and added to the
2665 repository.
2694 repository.
2666 </p>
2695 </p>
2667 <p>
2696 <p>
2668 The files will be added to the repository at the next commit. To
2697 The files will be added to the repository at the next commit. To
2669 undo an add before that, see 'hg forget'.
2698 undo an add before that, see 'hg forget'.
2670 </p>
2699 </p>
2671 <p>
2700 <p>
2672 If no names are given, add all files to the repository (except
2701 If no names are given, add all files to the repository (except
2673 files matching &quot;.hgignore&quot;).
2702 files matching &quot;.hgignore&quot;).
2674 </p>
2703 </p>
2675 <p>
2704 <p>
2676 Examples:
2705 Examples:
2677 </p>
2706 </p>
2678 <ul>
2707 <ul>
2679 <li> New (unknown) files are added automatically by 'hg add':
2708 <li> New (unknown) files are added automatically by 'hg add':
2680 <pre>
2709 <pre>
2681 \$ ls (re)
2710 \$ ls (re)
2682 foo.c
2711 foo.c
2683 \$ hg status (re)
2712 \$ hg status (re)
2684 ? foo.c
2713 ? foo.c
2685 \$ hg add (re)
2714 \$ hg add (re)
2686 adding foo.c
2715 adding foo.c
2687 \$ hg status (re)
2716 \$ hg status (re)
2688 A foo.c
2717 A foo.c
2689 </pre>
2718 </pre>
2690 <li> Specific files to be added can be specified:
2719 <li> Specific files to be added can be specified:
2691 <pre>
2720 <pre>
2692 \$ ls (re)
2721 \$ ls (re)
2693 bar.c foo.c
2722 bar.c foo.c
2694 \$ hg status (re)
2723 \$ hg status (re)
2695 ? bar.c
2724 ? bar.c
2696 ? foo.c
2725 ? foo.c
2697 \$ hg add bar.c (re)
2726 \$ hg add bar.c (re)
2698 \$ hg status (re)
2727 \$ hg status (re)
2699 A bar.c
2728 A bar.c
2700 ? foo.c
2729 ? foo.c
2701 </pre>
2730 </pre>
2702 </ul>
2731 </ul>
2703 <p>
2732 <p>
2704 Returns 0 if all files are successfully added.
2733 Returns 0 if all files are successfully added.
2705 </p>
2734 </p>
2706 <p>
2735 <p>
2707 options ([+] can be repeated):
2736 options ([+] can be repeated):
2708 </p>
2737 </p>
2709 <table>
2738 <table>
2710 <tr><td>-I</td>
2739 <tr><td>-I</td>
2711 <td>--include PATTERN [+]</td>
2740 <td>--include PATTERN [+]</td>
2712 <td>include names matching the given patterns</td></tr>
2741 <td>include names matching the given patterns</td></tr>
2713 <tr><td>-X</td>
2742 <tr><td>-X</td>
2714 <td>--exclude PATTERN [+]</td>
2743 <td>--exclude PATTERN [+]</td>
2715 <td>exclude names matching the given patterns</td></tr>
2744 <td>exclude names matching the given patterns</td></tr>
2716 <tr><td>-S</td>
2745 <tr><td>-S</td>
2717 <td>--subrepos</td>
2746 <td>--subrepos</td>
2718 <td>recurse into subrepositories</td></tr>
2747 <td>recurse into subrepositories</td></tr>
2719 <tr><td>-n</td>
2748 <tr><td>-n</td>
2720 <td>--dry-run</td>
2749 <td>--dry-run</td>
2721 <td>do not perform actions, just print output</td></tr>
2750 <td>do not perform actions, just print output</td></tr>
2722 </table>
2751 </table>
2723 <p>
2752 <p>
2724 global options ([+] can be repeated):
2753 global options ([+] can be repeated):
2725 </p>
2754 </p>
2726 <table>
2755 <table>
2727 <tr><td>-R</td>
2756 <tr><td>-R</td>
2728 <td>--repository REPO</td>
2757 <td>--repository REPO</td>
2729 <td>repository root directory or name of overlay bundle file</td></tr>
2758 <td>repository root directory or name of overlay bundle file</td></tr>
2730 <tr><td></td>
2759 <tr><td></td>
2731 <td>--cwd DIR</td>
2760 <td>--cwd DIR</td>
2732 <td>change working directory</td></tr>
2761 <td>change working directory</td></tr>
2733 <tr><td>-y</td>
2762 <tr><td>-y</td>
2734 <td>--noninteractive</td>
2763 <td>--noninteractive</td>
2735 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2764 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2736 <tr><td>-q</td>
2765 <tr><td>-q</td>
2737 <td>--quiet</td>
2766 <td>--quiet</td>
2738 <td>suppress output</td></tr>
2767 <td>suppress output</td></tr>
2739 <tr><td>-v</td>
2768 <tr><td>-v</td>
2740 <td>--verbose</td>
2769 <td>--verbose</td>
2741 <td>enable additional output</td></tr>
2770 <td>enable additional output</td></tr>
2742 <tr><td></td>
2771 <tr><td></td>
2743 <td>--color TYPE</td>
2772 <td>--color TYPE</td>
2744 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2773 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2745 <tr><td></td>
2774 <tr><td></td>
2746 <td>--config CONFIG [+]</td>
2775 <td>--config CONFIG [+]</td>
2747 <td>set/override config option (use 'section.name=value')</td></tr>
2776 <td>set/override config option (use 'section.name=value')</td></tr>
2748 <tr><td></td>
2777 <tr><td></td>
2749 <td>--debug</td>
2778 <td>--debug</td>
2750 <td>enable debugging output</td></tr>
2779 <td>enable debugging output</td></tr>
2751 <tr><td></td>
2780 <tr><td></td>
2752 <td>--debugger</td>
2781 <td>--debugger</td>
2753 <td>start debugger</td></tr>
2782 <td>start debugger</td></tr>
2754 <tr><td></td>
2783 <tr><td></td>
2755 <td>--encoding ENCODE</td>
2784 <td>--encoding ENCODE</td>
2756 <td>set the charset encoding (default: ascii)</td></tr>
2785 <td>set the charset encoding (default: ascii)</td></tr>
2757 <tr><td></td>
2786 <tr><td></td>
2758 <td>--encodingmode MODE</td>
2787 <td>--encodingmode MODE</td>
2759 <td>set the charset encoding mode (default: strict)</td></tr>
2788 <td>set the charset encoding mode (default: strict)</td></tr>
2760 <tr><td></td>
2789 <tr><td></td>
2761 <td>--traceback</td>
2790 <td>--traceback</td>
2762 <td>always print a traceback on exception</td></tr>
2791 <td>always print a traceback on exception</td></tr>
2763 <tr><td></td>
2792 <tr><td></td>
2764 <td>--time</td>
2793 <td>--time</td>
2765 <td>time how long the command takes</td></tr>
2794 <td>time how long the command takes</td></tr>
2766 <tr><td></td>
2795 <tr><td></td>
2767 <td>--profile</td>
2796 <td>--profile</td>
2768 <td>print command execution profile</td></tr>
2797 <td>print command execution profile</td></tr>
2769 <tr><td></td>
2798 <tr><td></td>
2770 <td>--version</td>
2799 <td>--version</td>
2771 <td>output version information and exit</td></tr>
2800 <td>output version information and exit</td></tr>
2772 <tr><td>-h</td>
2801 <tr><td>-h</td>
2773 <td>--help</td>
2802 <td>--help</td>
2774 <td>display help and exit</td></tr>
2803 <td>display help and exit</td></tr>
2775 <tr><td></td>
2804 <tr><td></td>
2776 <td>--hidden</td>
2805 <td>--hidden</td>
2777 <td>consider hidden changesets</td></tr>
2806 <td>consider hidden changesets</td></tr>
2778 <tr><td></td>
2807 <tr><td></td>
2779 <td>--pager TYPE</td>
2808 <td>--pager TYPE</td>
2780 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2809 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2781 </table>
2810 </table>
2782
2811
2783 </div>
2812 </div>
2784 </div>
2813 </div>
2785 </div>
2814 </div>
2786
2815
2787
2816
2788
2817
2789 </body>
2818 </body>
2790 </html>
2819 </html>
2791
2820
2792
2821
2793 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2822 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2794 200 Script output follows
2823 200 Script output follows
2795
2824
2796 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2825 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2797 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2826 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2798 <head>
2827 <head>
2799 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2828 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2800 <meta name="robots" content="index, nofollow" />
2829 <meta name="robots" content="index, nofollow" />
2801 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2830 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2802 <script type="text/javascript" src="/static/mercurial.js"></script>
2831 <script type="text/javascript" src="/static/mercurial.js"></script>
2803
2832
2804 <title>Help: remove</title>
2833 <title>Help: remove</title>
2805 </head>
2834 </head>
2806 <body>
2835 <body>
2807
2836
2808 <div class="container">
2837 <div class="container">
2809 <div class="menu">
2838 <div class="menu">
2810 <div class="logo">
2839 <div class="logo">
2811 <a href="https://mercurial-scm.org/">
2840 <a href="https://mercurial-scm.org/">
2812 <img src="/static/hglogo.png" alt="mercurial" /></a>
2841 <img src="/static/hglogo.png" alt="mercurial" /></a>
2813 </div>
2842 </div>
2814 <ul>
2843 <ul>
2815 <li><a href="/shortlog">log</a></li>
2844 <li><a href="/shortlog">log</a></li>
2816 <li><a href="/graph">graph</a></li>
2845 <li><a href="/graph">graph</a></li>
2817 <li><a href="/tags">tags</a></li>
2846 <li><a href="/tags">tags</a></li>
2818 <li><a href="/bookmarks">bookmarks</a></li>
2847 <li><a href="/bookmarks">bookmarks</a></li>
2819 <li><a href="/branches">branches</a></li>
2848 <li><a href="/branches">branches</a></li>
2820 </ul>
2849 </ul>
2821 <ul>
2850 <ul>
2822 <li class="active"><a href="/help">help</a></li>
2851 <li class="active"><a href="/help">help</a></li>
2823 </ul>
2852 </ul>
2824 </div>
2853 </div>
2825
2854
2826 <div class="main">
2855 <div class="main">
2827 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2856 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2828 <h3>Help: remove</h3>
2857 <h3>Help: remove</h3>
2829
2858
2830 <form class="search" action="/log">
2859 <form class="search" action="/log">
2831
2860
2832 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2861 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2833 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2862 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2834 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2863 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2835 </form>
2864 </form>
2836 <div id="doc">
2865 <div id="doc">
2837 <p>
2866 <p>
2838 hg remove [OPTION]... FILE...
2867 hg remove [OPTION]... FILE...
2839 </p>
2868 </p>
2840 <p>
2869 <p>
2841 aliases: rm
2870 aliases: rm
2842 </p>
2871 </p>
2843 <p>
2872 <p>
2844 remove the specified files on the next commit
2873 remove the specified files on the next commit
2845 </p>
2874 </p>
2846 <p>
2875 <p>
2847 Schedule the indicated files for removal from the current branch.
2876 Schedule the indicated files for removal from the current branch.
2848 </p>
2877 </p>
2849 <p>
2878 <p>
2850 This command schedules the files to be removed at the next commit.
2879 This command schedules the files to be removed at the next commit.
2851 To undo a remove before that, see 'hg revert'. To undo added
2880 To undo a remove before that, see 'hg revert'. To undo added
2852 files, see 'hg forget'.
2881 files, see 'hg forget'.
2853 </p>
2882 </p>
2854 <p>
2883 <p>
2855 -A/--after can be used to remove only files that have already
2884 -A/--after can be used to remove only files that have already
2856 been deleted, -f/--force can be used to force deletion, and -Af
2885 been deleted, -f/--force can be used to force deletion, and -Af
2857 can be used to remove files from the next revision without
2886 can be used to remove files from the next revision without
2858 deleting them from the working directory.
2887 deleting them from the working directory.
2859 </p>
2888 </p>
2860 <p>
2889 <p>
2861 The following table details the behavior of remove for different
2890 The following table details the behavior of remove for different
2862 file states (columns) and option combinations (rows). The file
2891 file states (columns) and option combinations (rows). The file
2863 states are Added [A], Clean [C], Modified [M] and Missing [!]
2892 states are Added [A], Clean [C], Modified [M] and Missing [!]
2864 (as reported by 'hg status'). The actions are Warn, Remove
2893 (as reported by 'hg status'). The actions are Warn, Remove
2865 (from branch) and Delete (from disk):
2894 (from branch) and Delete (from disk):
2866 </p>
2895 </p>
2867 <table>
2896 <table>
2868 <tr><td>opt/state</td>
2897 <tr><td>opt/state</td>
2869 <td>A</td>
2898 <td>A</td>
2870 <td>C</td>
2899 <td>C</td>
2871 <td>M</td>
2900 <td>M</td>
2872 <td>!</td></tr>
2901 <td>!</td></tr>
2873 <tr><td>none</td>
2902 <tr><td>none</td>
2874 <td>W</td>
2903 <td>W</td>
2875 <td>RD</td>
2904 <td>RD</td>
2876 <td>W</td>
2905 <td>W</td>
2877 <td>R</td></tr>
2906 <td>R</td></tr>
2878 <tr><td>-f</td>
2907 <tr><td>-f</td>
2879 <td>R</td>
2908 <td>R</td>
2880 <td>RD</td>
2909 <td>RD</td>
2881 <td>RD</td>
2910 <td>RD</td>
2882 <td>R</td></tr>
2911 <td>R</td></tr>
2883 <tr><td>-A</td>
2912 <tr><td>-A</td>
2884 <td>W</td>
2913 <td>W</td>
2885 <td>W</td>
2914 <td>W</td>
2886 <td>W</td>
2915 <td>W</td>
2887 <td>R</td></tr>
2916 <td>R</td></tr>
2888 <tr><td>-Af</td>
2917 <tr><td>-Af</td>
2889 <td>R</td>
2918 <td>R</td>
2890 <td>R</td>
2919 <td>R</td>
2891 <td>R</td>
2920 <td>R</td>
2892 <td>R</td></tr>
2921 <td>R</td></tr>
2893 </table>
2922 </table>
2894 <p>
2923 <p>
2895 <b>Note:</b>
2924 <b>Note:</b>
2896 </p>
2925 </p>
2897 <p>
2926 <p>
2898 'hg remove' never deletes files in Added [A] state from the
2927 'hg remove' never deletes files in Added [A] state from the
2899 working directory, not even if &quot;--force&quot; is specified.
2928 working directory, not even if &quot;--force&quot; is specified.
2900 </p>
2929 </p>
2901 <p>
2930 <p>
2902 Returns 0 on success, 1 if any warnings encountered.
2931 Returns 0 on success, 1 if any warnings encountered.
2903 </p>
2932 </p>
2904 <p>
2933 <p>
2905 options ([+] can be repeated):
2934 options ([+] can be repeated):
2906 </p>
2935 </p>
2907 <table>
2936 <table>
2908 <tr><td>-A</td>
2937 <tr><td>-A</td>
2909 <td>--after</td>
2938 <td>--after</td>
2910 <td>record delete for missing files</td></tr>
2939 <td>record delete for missing files</td></tr>
2911 <tr><td>-f</td>
2940 <tr><td>-f</td>
2912 <td>--force</td>
2941 <td>--force</td>
2913 <td>forget added files, delete modified files</td></tr>
2942 <td>forget added files, delete modified files</td></tr>
2914 <tr><td>-S</td>
2943 <tr><td>-S</td>
2915 <td>--subrepos</td>
2944 <td>--subrepos</td>
2916 <td>recurse into subrepositories</td></tr>
2945 <td>recurse into subrepositories</td></tr>
2917 <tr><td>-I</td>
2946 <tr><td>-I</td>
2918 <td>--include PATTERN [+]</td>
2947 <td>--include PATTERN [+]</td>
2919 <td>include names matching the given patterns</td></tr>
2948 <td>include names matching the given patterns</td></tr>
2920 <tr><td>-X</td>
2949 <tr><td>-X</td>
2921 <td>--exclude PATTERN [+]</td>
2950 <td>--exclude PATTERN [+]</td>
2922 <td>exclude names matching the given patterns</td></tr>
2951 <td>exclude names matching the given patterns</td></tr>
2923 <tr><td>-n</td>
2952 <tr><td>-n</td>
2924 <td>--dry-run</td>
2953 <td>--dry-run</td>
2925 <td>do not perform actions, just print output</td></tr>
2954 <td>do not perform actions, just print output</td></tr>
2926 </table>
2955 </table>
2927 <p>
2956 <p>
2928 global options ([+] can be repeated):
2957 global options ([+] can be repeated):
2929 </p>
2958 </p>
2930 <table>
2959 <table>
2931 <tr><td>-R</td>
2960 <tr><td>-R</td>
2932 <td>--repository REPO</td>
2961 <td>--repository REPO</td>
2933 <td>repository root directory or name of overlay bundle file</td></tr>
2962 <td>repository root directory or name of overlay bundle file</td></tr>
2934 <tr><td></td>
2963 <tr><td></td>
2935 <td>--cwd DIR</td>
2964 <td>--cwd DIR</td>
2936 <td>change working directory</td></tr>
2965 <td>change working directory</td></tr>
2937 <tr><td>-y</td>
2966 <tr><td>-y</td>
2938 <td>--noninteractive</td>
2967 <td>--noninteractive</td>
2939 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2968 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2940 <tr><td>-q</td>
2969 <tr><td>-q</td>
2941 <td>--quiet</td>
2970 <td>--quiet</td>
2942 <td>suppress output</td></tr>
2971 <td>suppress output</td></tr>
2943 <tr><td>-v</td>
2972 <tr><td>-v</td>
2944 <td>--verbose</td>
2973 <td>--verbose</td>
2945 <td>enable additional output</td></tr>
2974 <td>enable additional output</td></tr>
2946 <tr><td></td>
2975 <tr><td></td>
2947 <td>--color TYPE</td>
2976 <td>--color TYPE</td>
2948 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2977 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2949 <tr><td></td>
2978 <tr><td></td>
2950 <td>--config CONFIG [+]</td>
2979 <td>--config CONFIG [+]</td>
2951 <td>set/override config option (use 'section.name=value')</td></tr>
2980 <td>set/override config option (use 'section.name=value')</td></tr>
2952 <tr><td></td>
2981 <tr><td></td>
2953 <td>--debug</td>
2982 <td>--debug</td>
2954 <td>enable debugging output</td></tr>
2983 <td>enable debugging output</td></tr>
2955 <tr><td></td>
2984 <tr><td></td>
2956 <td>--debugger</td>
2985 <td>--debugger</td>
2957 <td>start debugger</td></tr>
2986 <td>start debugger</td></tr>
2958 <tr><td></td>
2987 <tr><td></td>
2959 <td>--encoding ENCODE</td>
2988 <td>--encoding ENCODE</td>
2960 <td>set the charset encoding (default: ascii)</td></tr>
2989 <td>set the charset encoding (default: ascii)</td></tr>
2961 <tr><td></td>
2990 <tr><td></td>
2962 <td>--encodingmode MODE</td>
2991 <td>--encodingmode MODE</td>
2963 <td>set the charset encoding mode (default: strict)</td></tr>
2992 <td>set the charset encoding mode (default: strict)</td></tr>
2964 <tr><td></td>
2993 <tr><td></td>
2965 <td>--traceback</td>
2994 <td>--traceback</td>
2966 <td>always print a traceback on exception</td></tr>
2995 <td>always print a traceback on exception</td></tr>
2967 <tr><td></td>
2996 <tr><td></td>
2968 <td>--time</td>
2997 <td>--time</td>
2969 <td>time how long the command takes</td></tr>
2998 <td>time how long the command takes</td></tr>
2970 <tr><td></td>
2999 <tr><td></td>
2971 <td>--profile</td>
3000 <td>--profile</td>
2972 <td>print command execution profile</td></tr>
3001 <td>print command execution profile</td></tr>
2973 <tr><td></td>
3002 <tr><td></td>
2974 <td>--version</td>
3003 <td>--version</td>
2975 <td>output version information and exit</td></tr>
3004 <td>output version information and exit</td></tr>
2976 <tr><td>-h</td>
3005 <tr><td>-h</td>
2977 <td>--help</td>
3006 <td>--help</td>
2978 <td>display help and exit</td></tr>
3007 <td>display help and exit</td></tr>
2979 <tr><td></td>
3008 <tr><td></td>
2980 <td>--hidden</td>
3009 <td>--hidden</td>
2981 <td>consider hidden changesets</td></tr>
3010 <td>consider hidden changesets</td></tr>
2982 <tr><td></td>
3011 <tr><td></td>
2983 <td>--pager TYPE</td>
3012 <td>--pager TYPE</td>
2984 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3013 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2985 </table>
3014 </table>
2986
3015
2987 </div>
3016 </div>
2988 </div>
3017 </div>
2989 </div>
3018 </div>
2990
3019
2991
3020
2992
3021
2993 </body>
3022 </body>
2994 </html>
3023 </html>
2995
3024
2996
3025
2997 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3026 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2998 200 Script output follows
3027 200 Script output follows
2999
3028
3000 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3029 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3001 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3030 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3002 <head>
3031 <head>
3003 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3032 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3004 <meta name="robots" content="index, nofollow" />
3033 <meta name="robots" content="index, nofollow" />
3005 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3034 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3006 <script type="text/javascript" src="/static/mercurial.js"></script>
3035 <script type="text/javascript" src="/static/mercurial.js"></script>
3007
3036
3008 <title>Help: dates</title>
3037 <title>Help: dates</title>
3009 </head>
3038 </head>
3010 <body>
3039 <body>
3011
3040
3012 <div class="container">
3041 <div class="container">
3013 <div class="menu">
3042 <div class="menu">
3014 <div class="logo">
3043 <div class="logo">
3015 <a href="https://mercurial-scm.org/">
3044 <a href="https://mercurial-scm.org/">
3016 <img src="/static/hglogo.png" alt="mercurial" /></a>
3045 <img src="/static/hglogo.png" alt="mercurial" /></a>
3017 </div>
3046 </div>
3018 <ul>
3047 <ul>
3019 <li><a href="/shortlog">log</a></li>
3048 <li><a href="/shortlog">log</a></li>
3020 <li><a href="/graph">graph</a></li>
3049 <li><a href="/graph">graph</a></li>
3021 <li><a href="/tags">tags</a></li>
3050 <li><a href="/tags">tags</a></li>
3022 <li><a href="/bookmarks">bookmarks</a></li>
3051 <li><a href="/bookmarks">bookmarks</a></li>
3023 <li><a href="/branches">branches</a></li>
3052 <li><a href="/branches">branches</a></li>
3024 </ul>
3053 </ul>
3025 <ul>
3054 <ul>
3026 <li class="active"><a href="/help">help</a></li>
3055 <li class="active"><a href="/help">help</a></li>
3027 </ul>
3056 </ul>
3028 </div>
3057 </div>
3029
3058
3030 <div class="main">
3059 <div class="main">
3031 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3060 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3032 <h3>Help: dates</h3>
3061 <h3>Help: dates</h3>
3033
3062
3034 <form class="search" action="/log">
3063 <form class="search" action="/log">
3035
3064
3036 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3065 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3037 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3066 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3038 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3067 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3039 </form>
3068 </form>
3040 <div id="doc">
3069 <div id="doc">
3041 <h1>Date Formats</h1>
3070 <h1>Date Formats</h1>
3042 <p>
3071 <p>
3043 Some commands allow the user to specify a date, e.g.:
3072 Some commands allow the user to specify a date, e.g.:
3044 </p>
3073 </p>
3045 <ul>
3074 <ul>
3046 <li> backout, commit, import, tag: Specify the commit date.
3075 <li> backout, commit, import, tag: Specify the commit date.
3047 <li> log, revert, update: Select revision(s) by date.
3076 <li> log, revert, update: Select revision(s) by date.
3048 </ul>
3077 </ul>
3049 <p>
3078 <p>
3050 Many date formats are valid. Here are some examples:
3079 Many date formats are valid. Here are some examples:
3051 </p>
3080 </p>
3052 <ul>
3081 <ul>
3053 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3082 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3054 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3083 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3055 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3084 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3056 <li> &quot;Dec 6&quot; (midnight)
3085 <li> &quot;Dec 6&quot; (midnight)
3057 <li> &quot;13:18&quot; (today assumed)
3086 <li> &quot;13:18&quot; (today assumed)
3058 <li> &quot;3:39&quot; (3:39AM assumed)
3087 <li> &quot;3:39&quot; (3:39AM assumed)
3059 <li> &quot;3:39pm&quot; (15:39)
3088 <li> &quot;3:39pm&quot; (15:39)
3060 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3089 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3061 <li> &quot;2006-12-6 13:18&quot;
3090 <li> &quot;2006-12-6 13:18&quot;
3062 <li> &quot;2006-12-6&quot;
3091 <li> &quot;2006-12-6&quot;
3063 <li> &quot;12-6&quot;
3092 <li> &quot;12-6&quot;
3064 <li> &quot;12/6&quot;
3093 <li> &quot;12/6&quot;
3065 <li> &quot;12/6/6&quot; (Dec 6 2006)
3094 <li> &quot;12/6/6&quot; (Dec 6 2006)
3066 <li> &quot;today&quot; (midnight)
3095 <li> &quot;today&quot; (midnight)
3067 <li> &quot;yesterday&quot; (midnight)
3096 <li> &quot;yesterday&quot; (midnight)
3068 <li> &quot;now&quot; - right now
3097 <li> &quot;now&quot; - right now
3069 </ul>
3098 </ul>
3070 <p>
3099 <p>
3071 Lastly, there is Mercurial's internal format:
3100 Lastly, there is Mercurial's internal format:
3072 </p>
3101 </p>
3073 <ul>
3102 <ul>
3074 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3103 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3075 </ul>
3104 </ul>
3076 <p>
3105 <p>
3077 This is the internal representation format for dates. The first number
3106 This is the internal representation format for dates. The first number
3078 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3107 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3079 second is the offset of the local timezone, in seconds west of UTC
3108 second is the offset of the local timezone, in seconds west of UTC
3080 (negative if the timezone is east of UTC).
3109 (negative if the timezone is east of UTC).
3081 </p>
3110 </p>
3082 <p>
3111 <p>
3083 The log command also accepts date ranges:
3112 The log command also accepts date ranges:
3084 </p>
3113 </p>
3085 <ul>
3114 <ul>
3086 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3115 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3087 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3116 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3088 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3117 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3089 <li> &quot;-DAYS&quot; - within a given number of days of today
3118 <li> &quot;-DAYS&quot; - within a given number of days of today
3090 </ul>
3119 </ul>
3091
3120
3092 </div>
3121 </div>
3093 </div>
3122 </div>
3094 </div>
3123 </div>
3095
3124
3096
3125
3097
3126
3098 </body>
3127 </body>
3099 </html>
3128 </html>
3100
3129
3101
3130
3102 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3131 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3103 200 Script output follows
3132 200 Script output follows
3104
3133
3105 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3134 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3106 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3135 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3107 <head>
3136 <head>
3108 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3137 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3109 <meta name="robots" content="index, nofollow" />
3138 <meta name="robots" content="index, nofollow" />
3110 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3139 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3111 <script type="text/javascript" src="/static/mercurial.js"></script>
3140 <script type="text/javascript" src="/static/mercurial.js"></script>
3112
3141
3113 <title>Help: pager</title>
3142 <title>Help: pager</title>
3114 </head>
3143 </head>
3115 <body>
3144 <body>
3116
3145
3117 <div class="container">
3146 <div class="container">
3118 <div class="menu">
3147 <div class="menu">
3119 <div class="logo">
3148 <div class="logo">
3120 <a href="https://mercurial-scm.org/">
3149 <a href="https://mercurial-scm.org/">
3121 <img src="/static/hglogo.png" alt="mercurial" /></a>
3150 <img src="/static/hglogo.png" alt="mercurial" /></a>
3122 </div>
3151 </div>
3123 <ul>
3152 <ul>
3124 <li><a href="/shortlog">log</a></li>
3153 <li><a href="/shortlog">log</a></li>
3125 <li><a href="/graph">graph</a></li>
3154 <li><a href="/graph">graph</a></li>
3126 <li><a href="/tags">tags</a></li>
3155 <li><a href="/tags">tags</a></li>
3127 <li><a href="/bookmarks">bookmarks</a></li>
3156 <li><a href="/bookmarks">bookmarks</a></li>
3128 <li><a href="/branches">branches</a></li>
3157 <li><a href="/branches">branches</a></li>
3129 </ul>
3158 </ul>
3130 <ul>
3159 <ul>
3131 <li class="active"><a href="/help">help</a></li>
3160 <li class="active"><a href="/help">help</a></li>
3132 </ul>
3161 </ul>
3133 </div>
3162 </div>
3134
3163
3135 <div class="main">
3164 <div class="main">
3136 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3165 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3137 <h3>Help: pager</h3>
3166 <h3>Help: pager</h3>
3138
3167
3139 <form class="search" action="/log">
3168 <form class="search" action="/log">
3140
3169
3141 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3170 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3142 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3171 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3143 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3172 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3144 </form>
3173 </form>
3145 <div id="doc">
3174 <div id="doc">
3146 <h1>Pager Support</h1>
3175 <h1>Pager Support</h1>
3147 <p>
3176 <p>
3148 Some Mercurial commands can produce a lot of output, and Mercurial will
3177 Some Mercurial commands can produce a lot of output, and Mercurial will
3149 attempt to use a pager to make those commands more pleasant.
3178 attempt to use a pager to make those commands more pleasant.
3150 </p>
3179 </p>
3151 <p>
3180 <p>
3152 To set the pager that should be used, set the application variable:
3181 To set the pager that should be used, set the application variable:
3153 </p>
3182 </p>
3154 <pre>
3183 <pre>
3155 [pager]
3184 [pager]
3156 pager = less -FRX
3185 pager = less -FRX
3157 </pre>
3186 </pre>
3158 <p>
3187 <p>
3159 If no pager is set in the user or repository configuration, Mercurial uses the
3188 If no pager is set in the user or repository configuration, Mercurial uses the
3160 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3189 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3161 or system configuration is used. If none of these are set, a default pager will
3190 or system configuration is used. If none of these are set, a default pager will
3162 be used, typically 'less' on Unix and 'more' on Windows.
3191 be used, typically 'less' on Unix and 'more' on Windows.
3163 </p>
3192 </p>
3164 <p>
3193 <p>
3165 You can disable the pager for certain commands by adding them to the
3194 You can disable the pager for certain commands by adding them to the
3166 pager.ignore list:
3195 pager.ignore list:
3167 </p>
3196 </p>
3168 <pre>
3197 <pre>
3169 [pager]
3198 [pager]
3170 ignore = version, help, update
3199 ignore = version, help, update
3171 </pre>
3200 </pre>
3172 <p>
3201 <p>
3173 To ignore global commands like 'hg version' or 'hg help', you have
3202 To ignore global commands like 'hg version' or 'hg help', you have
3174 to specify them in your user configuration file.
3203 to specify them in your user configuration file.
3175 </p>
3204 </p>
3176 <p>
3205 <p>
3177 To control whether the pager is used at all for an individual command,
3206 To control whether the pager is used at all for an individual command,
3178 you can use --pager=&lt;value&gt;:
3207 you can use --pager=&lt;value&gt;:
3179 </p>
3208 </p>
3180 <ul>
3209 <ul>
3181 <li> use as needed: 'auto'.
3210 <li> use as needed: 'auto'.
3182 <li> require the pager: 'yes' or 'on'.
3211 <li> require the pager: 'yes' or 'on'.
3183 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3212 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3184 </ul>
3213 </ul>
3185 <p>
3214 <p>
3186 To globally turn off all attempts to use a pager, set:
3215 To globally turn off all attempts to use a pager, set:
3187 </p>
3216 </p>
3188 <pre>
3217 <pre>
3189 [ui]
3218 [ui]
3190 paginate = never
3219 paginate = never
3191 </pre>
3220 </pre>
3192 <p>
3221 <p>
3193 which will prevent the pager from running.
3222 which will prevent the pager from running.
3194 </p>
3223 </p>
3195
3224
3196 </div>
3225 </div>
3197 </div>
3226 </div>
3198 </div>
3227 </div>
3199
3228
3200
3229
3201
3230
3202 </body>
3231 </body>
3203 </html>
3232 </html>
3204
3233
3205
3234
3206 Sub-topic indexes rendered properly
3235 Sub-topic indexes rendered properly
3207
3236
3208 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3237 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3209 200 Script output follows
3238 200 Script output follows
3210
3239
3211 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3240 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3212 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3241 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3213 <head>
3242 <head>
3214 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3243 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3215 <meta name="robots" content="index, nofollow" />
3244 <meta name="robots" content="index, nofollow" />
3216 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3245 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3217 <script type="text/javascript" src="/static/mercurial.js"></script>
3246 <script type="text/javascript" src="/static/mercurial.js"></script>
3218
3247
3219 <title>Help: internals</title>
3248 <title>Help: internals</title>
3220 </head>
3249 </head>
3221 <body>
3250 <body>
3222
3251
3223 <div class="container">
3252 <div class="container">
3224 <div class="menu">
3253 <div class="menu">
3225 <div class="logo">
3254 <div class="logo">
3226 <a href="https://mercurial-scm.org/">
3255 <a href="https://mercurial-scm.org/">
3227 <img src="/static/hglogo.png" alt="mercurial" /></a>
3256 <img src="/static/hglogo.png" alt="mercurial" /></a>
3228 </div>
3257 </div>
3229 <ul>
3258 <ul>
3230 <li><a href="/shortlog">log</a></li>
3259 <li><a href="/shortlog">log</a></li>
3231 <li><a href="/graph">graph</a></li>
3260 <li><a href="/graph">graph</a></li>
3232 <li><a href="/tags">tags</a></li>
3261 <li><a href="/tags">tags</a></li>
3233 <li><a href="/bookmarks">bookmarks</a></li>
3262 <li><a href="/bookmarks">bookmarks</a></li>
3234 <li><a href="/branches">branches</a></li>
3263 <li><a href="/branches">branches</a></li>
3235 </ul>
3264 </ul>
3236 <ul>
3265 <ul>
3237 <li><a href="/help">help</a></li>
3266 <li><a href="/help">help</a></li>
3238 </ul>
3267 </ul>
3239 </div>
3268 </div>
3240
3269
3241 <div class="main">
3270 <div class="main">
3242 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3271 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3243
3272
3244 <form class="search" action="/log">
3273 <form class="search" action="/log">
3245
3274
3246 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3275 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3247 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3276 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3248 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3277 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3249 </form>
3278 </form>
3250 <table class="bigtable">
3279 <table class="bigtable">
3251 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3280 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3252
3281
3253 <tr><td>
3282 <tr><td>
3254 <a href="/help/internals.bundle2">
3283 <a href="/help/internals.bundle2">
3255 bundle2
3284 bundle2
3256 </a>
3285 </a>
3257 </td><td>
3286 </td><td>
3258 Bundle2
3287 Bundle2
3259 </td></tr>
3288 </td></tr>
3260 <tr><td>
3289 <tr><td>
3261 <a href="/help/internals.bundles">
3290 <a href="/help/internals.bundles">
3262 bundles
3291 bundles
3263 </a>
3292 </a>
3264 </td><td>
3293 </td><td>
3265 Bundles
3294 Bundles
3266 </td></tr>
3295 </td></tr>
3267 <tr><td>
3296 <tr><td>
3268 <a href="/help/internals.censor">
3297 <a href="/help/internals.censor">
3269 censor
3298 censor
3270 </a>
3299 </a>
3271 </td><td>
3300 </td><td>
3272 Censor
3301 Censor
3273 </td></tr>
3302 </td></tr>
3274 <tr><td>
3303 <tr><td>
3275 <a href="/help/internals.changegroups">
3304 <a href="/help/internals.changegroups">
3276 changegroups
3305 changegroups
3277 </a>
3306 </a>
3278 </td><td>
3307 </td><td>
3279 Changegroups
3308 Changegroups
3280 </td></tr>
3309 </td></tr>
3281 <tr><td>
3310 <tr><td>
3282 <a href="/help/internals.config">
3311 <a href="/help/internals.config">
3283 config
3312 config
3284 </a>
3313 </a>
3285 </td><td>
3314 </td><td>
3286 Config Registrar
3315 Config Registrar
3287 </td></tr>
3316 </td></tr>
3288 <tr><td>
3317 <tr><td>
3289 <a href="/help/internals.requirements">
3318 <a href="/help/internals.requirements">
3290 requirements
3319 requirements
3291 </a>
3320 </a>
3292 </td><td>
3321 </td><td>
3293 Repository Requirements
3322 Repository Requirements
3294 </td></tr>
3323 </td></tr>
3295 <tr><td>
3324 <tr><td>
3296 <a href="/help/internals.revlogs">
3325 <a href="/help/internals.revlogs">
3297 revlogs
3326 revlogs
3298 </a>
3327 </a>
3299 </td><td>
3328 </td><td>
3300 Revision Logs
3329 Revision Logs
3301 </td></tr>
3330 </td></tr>
3302 <tr><td>
3331 <tr><td>
3303 <a href="/help/internals.wireprotocol">
3332 <a href="/help/internals.wireprotocol">
3304 wireprotocol
3333 wireprotocol
3305 </a>
3334 </a>
3306 </td><td>
3335 </td><td>
3307 Wire Protocol
3336 Wire Protocol
3308 </td></tr>
3337 </td></tr>
3309
3338
3310
3339
3311
3340
3312
3341
3313
3342
3314 </table>
3343 </table>
3315 </div>
3344 </div>
3316 </div>
3345 </div>
3317
3346
3318
3347
3319
3348
3320 </body>
3349 </body>
3321 </html>
3350 </html>
3322
3351
3323
3352
3324 Sub-topic topics rendered properly
3353 Sub-topic topics rendered properly
3325
3354
3326 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3355 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3327 200 Script output follows
3356 200 Script output follows
3328
3357
3329 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3358 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3330 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3359 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3331 <head>
3360 <head>
3332 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3361 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3333 <meta name="robots" content="index, nofollow" />
3362 <meta name="robots" content="index, nofollow" />
3334 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3363 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3335 <script type="text/javascript" src="/static/mercurial.js"></script>
3364 <script type="text/javascript" src="/static/mercurial.js"></script>
3336
3365
3337 <title>Help: internals.changegroups</title>
3366 <title>Help: internals.changegroups</title>
3338 </head>
3367 </head>
3339 <body>
3368 <body>
3340
3369
3341 <div class="container">
3370 <div class="container">
3342 <div class="menu">
3371 <div class="menu">
3343 <div class="logo">
3372 <div class="logo">
3344 <a href="https://mercurial-scm.org/">
3373 <a href="https://mercurial-scm.org/">
3345 <img src="/static/hglogo.png" alt="mercurial" /></a>
3374 <img src="/static/hglogo.png" alt="mercurial" /></a>
3346 </div>
3375 </div>
3347 <ul>
3376 <ul>
3348 <li><a href="/shortlog">log</a></li>
3377 <li><a href="/shortlog">log</a></li>
3349 <li><a href="/graph">graph</a></li>
3378 <li><a href="/graph">graph</a></li>
3350 <li><a href="/tags">tags</a></li>
3379 <li><a href="/tags">tags</a></li>
3351 <li><a href="/bookmarks">bookmarks</a></li>
3380 <li><a href="/bookmarks">bookmarks</a></li>
3352 <li><a href="/branches">branches</a></li>
3381 <li><a href="/branches">branches</a></li>
3353 </ul>
3382 </ul>
3354 <ul>
3383 <ul>
3355 <li class="active"><a href="/help">help</a></li>
3384 <li class="active"><a href="/help">help</a></li>
3356 </ul>
3385 </ul>
3357 </div>
3386 </div>
3358
3387
3359 <div class="main">
3388 <div class="main">
3360 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3389 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3361 <h3>Help: internals.changegroups</h3>
3390 <h3>Help: internals.changegroups</h3>
3362
3391
3363 <form class="search" action="/log">
3392 <form class="search" action="/log">
3364
3393
3365 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3394 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3366 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3395 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3367 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3396 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3368 </form>
3397 </form>
3369 <div id="doc">
3398 <div id="doc">
3370 <h1>Changegroups</h1>
3399 <h1>Changegroups</h1>
3371 <p>
3400 <p>
3372 Changegroups are representations of repository revlog data, specifically
3401 Changegroups are representations of repository revlog data, specifically
3373 the changelog data, root/flat manifest data, treemanifest data, and
3402 the changelog data, root/flat manifest data, treemanifest data, and
3374 filelogs.
3403 filelogs.
3375 </p>
3404 </p>
3376 <p>
3405 <p>
3377 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3406 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3378 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3407 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3379 only difference being an additional item in the *delta header*. Version
3408 only difference being an additional item in the *delta header*. Version
3380 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3409 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3381 exchanging treemanifests (enabled by setting an option on the
3410 exchanging treemanifests (enabled by setting an option on the
3382 &quot;changegroup&quot; part in the bundle2).
3411 &quot;changegroup&quot; part in the bundle2).
3383 </p>
3412 </p>
3384 <p>
3413 <p>
3385 Changegroups when not exchanging treemanifests consist of 3 logical
3414 Changegroups when not exchanging treemanifests consist of 3 logical
3386 segments:
3415 segments:
3387 </p>
3416 </p>
3388 <pre>
3417 <pre>
3389 +---------------------------------+
3418 +---------------------------------+
3390 | | | |
3419 | | | |
3391 | changeset | manifest | filelogs |
3420 | changeset | manifest | filelogs |
3392 | | | |
3421 | | | |
3393 | | | |
3422 | | | |
3394 +---------------------------------+
3423 +---------------------------------+
3395 </pre>
3424 </pre>
3396 <p>
3425 <p>
3397 When exchanging treemanifests, there are 4 logical segments:
3426 When exchanging treemanifests, there are 4 logical segments:
3398 </p>
3427 </p>
3399 <pre>
3428 <pre>
3400 +-------------------------------------------------+
3429 +-------------------------------------------------+
3401 | | | | |
3430 | | | | |
3402 | changeset | root | treemanifests | filelogs |
3431 | changeset | root | treemanifests | filelogs |
3403 | | manifest | | |
3432 | | manifest | | |
3404 | | | | |
3433 | | | | |
3405 +-------------------------------------------------+
3434 +-------------------------------------------------+
3406 </pre>
3435 </pre>
3407 <p>
3436 <p>
3408 The principle building block of each segment is a *chunk*. A *chunk*
3437 The principle building block of each segment is a *chunk*. A *chunk*
3409 is a framed piece of data:
3438 is a framed piece of data:
3410 </p>
3439 </p>
3411 <pre>
3440 <pre>
3412 +---------------------------------------+
3441 +---------------------------------------+
3413 | | |
3442 | | |
3414 | length | data |
3443 | length | data |
3415 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3444 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3416 | | |
3445 | | |
3417 +---------------------------------------+
3446 +---------------------------------------+
3418 </pre>
3447 </pre>
3419 <p>
3448 <p>
3420 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3449 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3421 integer indicating the length of the entire chunk (including the length field
3450 integer indicating the length of the entire chunk (including the length field
3422 itself).
3451 itself).
3423 </p>
3452 </p>
3424 <p>
3453 <p>
3425 There is a special case chunk that has a value of 0 for the length
3454 There is a special case chunk that has a value of 0 for the length
3426 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3455 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3427 </p>
3456 </p>
3428 <h2>Delta Groups</h2>
3457 <h2>Delta Groups</h2>
3429 <p>
3458 <p>
3430 A *delta group* expresses the content of a revlog as a series of deltas,
3459 A *delta group* expresses the content of a revlog as a series of deltas,
3431 or patches against previous revisions.
3460 or patches against previous revisions.
3432 </p>
3461 </p>
3433 <p>
3462 <p>
3434 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3463 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3435 to signal the end of the delta group:
3464 to signal the end of the delta group:
3436 </p>
3465 </p>
3437 <pre>
3466 <pre>
3438 +------------------------------------------------------------------------+
3467 +------------------------------------------------------------------------+
3439 | | | | | |
3468 | | | | | |
3440 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3469 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3441 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3470 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3442 | | | | | |
3471 | | | | | |
3443 +------------------------------------------------------------------------+
3472 +------------------------------------------------------------------------+
3444 </pre>
3473 </pre>
3445 <p>
3474 <p>
3446 Each *chunk*'s data consists of the following:
3475 Each *chunk*'s data consists of the following:
3447 </p>
3476 </p>
3448 <pre>
3477 <pre>
3449 +---------------------------------------+
3478 +---------------------------------------+
3450 | | |
3479 | | |
3451 | delta header | delta data |
3480 | delta header | delta data |
3452 | (various by version) | (various) |
3481 | (various by version) | (various) |
3453 | | |
3482 | | |
3454 +---------------------------------------+
3483 +---------------------------------------+
3455 </pre>
3484 </pre>
3456 <p>
3485 <p>
3457 The *delta data* is a series of *delta*s that describe a diff from an existing
3486 The *delta data* is a series of *delta*s that describe a diff from an existing
3458 entry (either that the recipient already has, or previously specified in the
3487 entry (either that the recipient already has, or previously specified in the
3459 bundle/changegroup).
3488 bundle/changegroup).
3460 </p>
3489 </p>
3461 <p>
3490 <p>
3462 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3491 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3463 &quot;3&quot; of the changegroup format.
3492 &quot;3&quot; of the changegroup format.
3464 </p>
3493 </p>
3465 <p>
3494 <p>
3466 Version 1 (headerlen=80):
3495 Version 1 (headerlen=80):
3467 </p>
3496 </p>
3468 <pre>
3497 <pre>
3469 +------------------------------------------------------+
3498 +------------------------------------------------------+
3470 | | | | |
3499 | | | | |
3471 | node | p1 node | p2 node | link node |
3500 | node | p1 node | p2 node | link node |
3472 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3501 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3473 | | | | |
3502 | | | | |
3474 +------------------------------------------------------+
3503 +------------------------------------------------------+
3475 </pre>
3504 </pre>
3476 <p>
3505 <p>
3477 Version 2 (headerlen=100):
3506 Version 2 (headerlen=100):
3478 </p>
3507 </p>
3479 <pre>
3508 <pre>
3480 +------------------------------------------------------------------+
3509 +------------------------------------------------------------------+
3481 | | | | | |
3510 | | | | | |
3482 | node | p1 node | p2 node | base node | link node |
3511 | node | p1 node | p2 node | base node | link node |
3483 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3512 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3484 | | | | | |
3513 | | | | | |
3485 +------------------------------------------------------------------+
3514 +------------------------------------------------------------------+
3486 </pre>
3515 </pre>
3487 <p>
3516 <p>
3488 Version 3 (headerlen=102):
3517 Version 3 (headerlen=102):
3489 </p>
3518 </p>
3490 <pre>
3519 <pre>
3491 +------------------------------------------------------------------------------+
3520 +------------------------------------------------------------------------------+
3492 | | | | | | |
3521 | | | | | | |
3493 | node | p1 node | p2 node | base node | link node | flags |
3522 | node | p1 node | p2 node | base node | link node | flags |
3494 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3523 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3495 | | | | | | |
3524 | | | | | | |
3496 +------------------------------------------------------------------------------+
3525 +------------------------------------------------------------------------------+
3497 </pre>
3526 </pre>
3498 <p>
3527 <p>
3499 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3528 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3500 series of *delta*s, densely packed (no separators). These deltas describe a diff
3529 series of *delta*s, densely packed (no separators). These deltas describe a diff
3501 from an existing entry (either that the recipient already has, or previously
3530 from an existing entry (either that the recipient already has, or previously
3502 specified in the bundle/changegroup). The format is described more fully in
3531 specified in the bundle/changegroup). The format is described more fully in
3503 &quot;hg help internals.bdiff&quot;, but briefly:
3532 &quot;hg help internals.bdiff&quot;, but briefly:
3504 </p>
3533 </p>
3505 <pre>
3534 <pre>
3506 +---------------------------------------------------------------+
3535 +---------------------------------------------------------------+
3507 | | | | |
3536 | | | | |
3508 | start offset | end offset | new length | content |
3537 | start offset | end offset | new length | content |
3509 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3538 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3510 | | | | |
3539 | | | | |
3511 +---------------------------------------------------------------+
3540 +---------------------------------------------------------------+
3512 </pre>
3541 </pre>
3513 <p>
3542 <p>
3514 Please note that the length field in the delta data does *not* include itself.
3543 Please note that the length field in the delta data does *not* include itself.
3515 </p>
3544 </p>
3516 <p>
3545 <p>
3517 In version 1, the delta is always applied against the previous node from
3546 In version 1, the delta is always applied against the previous node from
3518 the changegroup or the first parent if this is the first entry in the
3547 the changegroup or the first parent if this is the first entry in the
3519 changegroup.
3548 changegroup.
3520 </p>
3549 </p>
3521 <p>
3550 <p>
3522 In version 2 and up, the delta base node is encoded in the entry in the
3551 In version 2 and up, the delta base node is encoded in the entry in the
3523 changegroup. This allows the delta to be expressed against any parent,
3552 changegroup. This allows the delta to be expressed against any parent,
3524 which can result in smaller deltas and more efficient encoding of data.
3553 which can result in smaller deltas and more efficient encoding of data.
3525 </p>
3554 </p>
3526 <h2>Changeset Segment</h2>
3555 <h2>Changeset Segment</h2>
3527 <p>
3556 <p>
3528 The *changeset segment* consists of a single *delta group* holding
3557 The *changeset segment* consists of a single *delta group* holding
3529 changelog data. The *empty chunk* at the end of the *delta group* denotes
3558 changelog data. The *empty chunk* at the end of the *delta group* denotes
3530 the boundary to the *manifest segment*.
3559 the boundary to the *manifest segment*.
3531 </p>
3560 </p>
3532 <h2>Manifest Segment</h2>
3561 <h2>Manifest Segment</h2>
3533 <p>
3562 <p>
3534 The *manifest segment* consists of a single *delta group* holding manifest
3563 The *manifest segment* consists of a single *delta group* holding manifest
3535 data. If treemanifests are in use, it contains only the manifest for the
3564 data. If treemanifests are in use, it contains only the manifest for the
3536 root directory of the repository. Otherwise, it contains the entire
3565 root directory of the repository. Otherwise, it contains the entire
3537 manifest data. The *empty chunk* at the end of the *delta group* denotes
3566 manifest data. The *empty chunk* at the end of the *delta group* denotes
3538 the boundary to the next segment (either the *treemanifests segment* or the
3567 the boundary to the next segment (either the *treemanifests segment* or the
3539 *filelogs segment*, depending on version and the request options).
3568 *filelogs segment*, depending on version and the request options).
3540 </p>
3569 </p>
3541 <h3>Treemanifests Segment</h3>
3570 <h3>Treemanifests Segment</h3>
3542 <p>
3571 <p>
3543 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3572 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3544 only if the 'treemanifest' param is part of the bundle2 changegroup part
3573 only if the 'treemanifest' param is part of the bundle2 changegroup part
3545 (it is not possible to use changegroup version 3 outside of bundle2).
3574 (it is not possible to use changegroup version 3 outside of bundle2).
3546 Aside from the filenames in the *treemanifests segment* containing a
3575 Aside from the filenames in the *treemanifests segment* containing a
3547 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3576 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3548 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3577 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3549 a sub-segment with filename size 0). This denotes the boundary to the
3578 a sub-segment with filename size 0). This denotes the boundary to the
3550 *filelogs segment*.
3579 *filelogs segment*.
3551 </p>
3580 </p>
3552 <h2>Filelogs Segment</h2>
3581 <h2>Filelogs Segment</h2>
3553 <p>
3582 <p>
3554 The *filelogs segment* consists of multiple sub-segments, each
3583 The *filelogs segment* consists of multiple sub-segments, each
3555 corresponding to an individual file whose data is being described:
3584 corresponding to an individual file whose data is being described:
3556 </p>
3585 </p>
3557 <pre>
3586 <pre>
3558 +--------------------------------------------------+
3587 +--------------------------------------------------+
3559 | | | | | |
3588 | | | | | |
3560 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3589 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3561 | | | | | (4 bytes) |
3590 | | | | | (4 bytes) |
3562 | | | | | |
3591 | | | | | |
3563 +--------------------------------------------------+
3592 +--------------------------------------------------+
3564 </pre>
3593 </pre>
3565 <p>
3594 <p>
3566 The final filelog sub-segment is followed by an *empty chunk* (logically,
3595 The final filelog sub-segment is followed by an *empty chunk* (logically,
3567 a sub-segment with filename size 0). This denotes the end of the segment
3596 a sub-segment with filename size 0). This denotes the end of the segment
3568 and of the overall changegroup.
3597 and of the overall changegroup.
3569 </p>
3598 </p>
3570 <p>
3599 <p>
3571 Each filelog sub-segment consists of the following:
3600 Each filelog sub-segment consists of the following:
3572 </p>
3601 </p>
3573 <pre>
3602 <pre>
3574 +------------------------------------------------------+
3603 +------------------------------------------------------+
3575 | | | |
3604 | | | |
3576 | filename length | filename | delta group |
3605 | filename length | filename | delta group |
3577 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3606 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3578 | | | |
3607 | | | |
3579 +------------------------------------------------------+
3608 +------------------------------------------------------+
3580 </pre>
3609 </pre>
3581 <p>
3610 <p>
3582 That is, a *chunk* consisting of the filename (not terminated or padded)
3611 That is, a *chunk* consisting of the filename (not terminated or padded)
3583 followed by N chunks constituting the *delta group* for this file. The
3612 followed by N chunks constituting the *delta group* for this file. The
3584 *empty chunk* at the end of each *delta group* denotes the boundary to the
3613 *empty chunk* at the end of each *delta group* denotes the boundary to the
3585 next filelog sub-segment.
3614 next filelog sub-segment.
3586 </p>
3615 </p>
3587
3616
3588 </div>
3617 </div>
3589 </div>
3618 </div>
3590 </div>
3619 </div>
3591
3620
3592
3621
3593
3622
3594 </body>
3623 </body>
3595 </html>
3624 </html>
3596
3625
3597
3626
3598 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3627 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3599 404 Not Found
3628 404 Not Found
3600
3629
3601 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3630 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3602 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3631 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3603 <head>
3632 <head>
3604 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3633 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3605 <meta name="robots" content="index, nofollow" />
3634 <meta name="robots" content="index, nofollow" />
3606 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3635 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3607 <script type="text/javascript" src="/static/mercurial.js"></script>
3636 <script type="text/javascript" src="/static/mercurial.js"></script>
3608
3637
3609 <title>test: error</title>
3638 <title>test: error</title>
3610 </head>
3639 </head>
3611 <body>
3640 <body>
3612
3641
3613 <div class="container">
3642 <div class="container">
3614 <div class="menu">
3643 <div class="menu">
3615 <div class="logo">
3644 <div class="logo">
3616 <a href="https://mercurial-scm.org/">
3645 <a href="https://mercurial-scm.org/">
3617 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3646 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3618 </div>
3647 </div>
3619 <ul>
3648 <ul>
3620 <li><a href="/shortlog">log</a></li>
3649 <li><a href="/shortlog">log</a></li>
3621 <li><a href="/graph">graph</a></li>
3650 <li><a href="/graph">graph</a></li>
3622 <li><a href="/tags">tags</a></li>
3651 <li><a href="/tags">tags</a></li>
3623 <li><a href="/bookmarks">bookmarks</a></li>
3652 <li><a href="/bookmarks">bookmarks</a></li>
3624 <li><a href="/branches">branches</a></li>
3653 <li><a href="/branches">branches</a></li>
3625 </ul>
3654 </ul>
3626 <ul>
3655 <ul>
3627 <li><a href="/help">help</a></li>
3656 <li><a href="/help">help</a></li>
3628 </ul>
3657 </ul>
3629 </div>
3658 </div>
3630
3659
3631 <div class="main">
3660 <div class="main">
3632
3661
3633 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3662 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3634 <h3>error</h3>
3663 <h3>error</h3>
3635
3664
3636
3665
3637 <form class="search" action="/log">
3666 <form class="search" action="/log">
3638
3667
3639 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3668 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3640 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3669 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3641 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3670 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3642 </form>
3671 </form>
3643
3672
3644 <div class="description">
3673 <div class="description">
3645 <p>
3674 <p>
3646 An error occurred while processing your request:
3675 An error occurred while processing your request:
3647 </p>
3676 </p>
3648 <p>
3677 <p>
3649 Not Found
3678 Not Found
3650 </p>
3679 </p>
3651 </div>
3680 </div>
3652 </div>
3681 </div>
3653 </div>
3682 </div>
3654
3683
3655
3684
3656
3685
3657 </body>
3686 </body>
3658 </html>
3687 </html>
3659
3688
3660 [1]
3689 [1]
3661
3690
3662 $ killdaemons.py
3691 $ killdaemons.py
3663
3692
3664 #endif
3693 #endif
General Comments 0
You need to be logged in to leave comments. Login now