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