##// END OF EJS Templates
minirst: change hgrole to use single quotes...
timeless -
r27729:58f8b29c default
parent child Browse files
Show More
@@ -1,816 +1,816 b''
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 cgi
24 24 import re
25 25
26 26 from .i18n import _
27 27 from . import (
28 28 encoding,
29 29 util,
30 30 )
31 31
32 32 def section(s):
33 33 return "%s\n%s\n\n" % (s, "\"" * encoding.colwidth(s))
34 34
35 35 def subsection(s):
36 36 return "%s\n%s\n\n" % (s, '=' * encoding.colwidth(s))
37 37
38 38 def subsubsection(s):
39 39 return "%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))
40 40
41 41 def subsubsubsection(s):
42 42 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
43 43
44 44 def replace(text, substs):
45 45 '''
46 46 Apply a list of (find, replace) pairs to a text.
47 47
48 48 >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
49 49 'Foo Bar'
50 50 >>> encoding.encoding = 'latin1'
51 51 >>> replace('\\x81\\\\', [('\\\\', '/')])
52 52 '\\x81/'
53 53 >>> encoding.encoding = 'shiftjis'
54 54 >>> replace('\\x81\\\\', [('\\\\', '/')])
55 55 '\\x81\\\\'
56 56 '''
57 57
58 58 # some character encodings (cp932 for Japanese, at least) use
59 59 # ASCII characters other than control/alphabet/digit as a part of
60 60 # multi-bytes characters, so direct replacing with such characters
61 61 # on strings in local encoding causes invalid byte sequences.
62 62 utext = text.decode(encoding.encoding)
63 63 for f, t in substs:
64 64 utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
65 65 return utext.encode(encoding.encoding)
66 66
67 67 _blockre = re.compile(r"\n(?:\s*\n)+")
68 68
69 69 def findblocks(text):
70 70 """Find continuous blocks of lines in text.
71 71
72 72 Returns a list of dictionaries representing the blocks. Each block
73 73 has an 'indent' field and a 'lines' field.
74 74 """
75 75 blocks = []
76 76 for b in _blockre.split(text.lstrip('\n').rstrip()):
77 77 lines = b.splitlines()
78 78 if lines:
79 79 indent = min((len(l) - len(l.lstrip())) for l in lines)
80 80 lines = [l[indent:] for l in lines]
81 81 blocks.append({'indent': indent, 'lines': lines})
82 82 return blocks
83 83
84 84 def findliteralblocks(blocks):
85 85 """Finds literal blocks and adds a 'type' field to the blocks.
86 86
87 87 Literal blocks are given the type 'literal', all other blocks are
88 88 given type the 'paragraph'.
89 89 """
90 90 i = 0
91 91 while i < len(blocks):
92 92 # Searching for a block that looks like this:
93 93 #
94 94 # +------------------------------+
95 95 # | paragraph |
96 96 # | (ends with "::") |
97 97 # +------------------------------+
98 98 # +---------------------------+
99 99 # | indented literal block |
100 100 # +---------------------------+
101 101 blocks[i]['type'] = 'paragraph'
102 102 if blocks[i]['lines'][-1].endswith('::') and i + 1 < len(blocks):
103 103 indent = blocks[i]['indent']
104 104 adjustment = blocks[i + 1]['indent'] - indent
105 105
106 106 if blocks[i]['lines'] == ['::']:
107 107 # Expanded form: remove block
108 108 del blocks[i]
109 109 i -= 1
110 110 elif blocks[i]['lines'][-1].endswith(' ::'):
111 111 # Partially minimized form: remove space and both
112 112 # colons.
113 113 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3]
114 114 elif len(blocks[i]['lines']) == 1 and \
115 115 blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \
116 116 blocks[i]['lines'][0].find(' ', 3) == -1:
117 117 # directive on its own line, not a literal block
118 118 i += 1
119 119 continue
120 120 else:
121 121 # Fully minimized form: remove just one colon.
122 122 blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-1]
123 123
124 124 # List items are formatted with a hanging indent. We must
125 125 # correct for this here while we still have the original
126 126 # information on the indentation of the subsequent literal
127 127 # blocks available.
128 128 m = _bulletre.match(blocks[i]['lines'][0])
129 129 if m:
130 130 indent += m.end()
131 131 adjustment -= m.end()
132 132
133 133 # Mark the following indented blocks.
134 134 while i + 1 < len(blocks) and blocks[i + 1]['indent'] > indent:
135 135 blocks[i + 1]['type'] = 'literal'
136 136 blocks[i + 1]['indent'] -= adjustment
137 137 i += 1
138 138 i += 1
139 139 return blocks
140 140
141 141 _bulletre = re.compile(r'(-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) ')
142 142 _optionre = re.compile(r'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)'
143 143 r'((.*) +)(.*)$')
144 144 _fieldre = re.compile(r':(?![: ])([^:]*)(?<! ):[ ]+(.*)')
145 145 _definitionre = re.compile(r'[^ ]')
146 146 _tablere = re.compile(r'(=+\s+)*=+')
147 147
148 148 def splitparagraphs(blocks):
149 149 """Split paragraphs into lists."""
150 150 # Tuples with (list type, item regexp, single line items?). Order
151 151 # matters: definition lists has the least specific regexp and must
152 152 # come last.
153 153 listtypes = [('bullet', _bulletre, True),
154 154 ('option', _optionre, True),
155 155 ('field', _fieldre, True),
156 156 ('definition', _definitionre, False)]
157 157
158 158 def match(lines, i, itemre, singleline):
159 159 """Does itemre match an item at line i?
160 160
161 161 A list item can be followed by an indented line or another list
162 162 item (but only if singleline is True).
163 163 """
164 164 line1 = lines[i]
165 165 line2 = i + 1 < len(lines) and lines[i + 1] or ''
166 166 if not itemre.match(line1):
167 167 return False
168 168 if singleline:
169 169 return line2 == '' or line2[0] == ' ' or itemre.match(line2)
170 170 else:
171 171 return line2.startswith(' ')
172 172
173 173 i = 0
174 174 while i < len(blocks):
175 175 if blocks[i]['type'] == 'paragraph':
176 176 lines = blocks[i]['lines']
177 177 for type, itemre, singleline in listtypes:
178 178 if match(lines, 0, itemre, singleline):
179 179 items = []
180 180 for j, line in enumerate(lines):
181 181 if match(lines, j, itemre, singleline):
182 182 items.append({'type': type, 'lines': [],
183 183 'indent': blocks[i]['indent']})
184 184 items[-1]['lines'].append(line)
185 185 blocks[i:i + 1] = items
186 186 break
187 187 i += 1
188 188 return blocks
189 189
190 190 _fieldwidth = 14
191 191
192 192 def updatefieldlists(blocks):
193 193 """Find key for field lists."""
194 194 i = 0
195 195 while i < len(blocks):
196 196 if blocks[i]['type'] != 'field':
197 197 i += 1
198 198 continue
199 199
200 200 j = i
201 201 while j < len(blocks) and blocks[j]['type'] == 'field':
202 202 m = _fieldre.match(blocks[j]['lines'][0])
203 203 key, rest = m.groups()
204 204 blocks[j]['lines'][0] = rest
205 205 blocks[j]['key'] = key
206 206 j += 1
207 207
208 208 i = j + 1
209 209
210 210 return blocks
211 211
212 212 def updateoptionlists(blocks):
213 213 i = 0
214 214 while i < len(blocks):
215 215 if blocks[i]['type'] != 'option':
216 216 i += 1
217 217 continue
218 218
219 219 optstrwidth = 0
220 220 j = i
221 221 while j < len(blocks) and blocks[j]['type'] == 'option':
222 222 m = _optionre.match(blocks[j]['lines'][0])
223 223
224 224 shortoption = m.group(2)
225 225 group3 = m.group(3)
226 226 longoption = group3[2:].strip()
227 227 desc = m.group(6).strip()
228 228 longoptionarg = m.group(5).strip()
229 229 blocks[j]['lines'][0] = desc
230 230
231 231 noshortop = ''
232 232 if not shortoption:
233 233 noshortop = ' '
234 234
235 235 opt = "%s%s" % (shortoption and "-%s " % shortoption or '',
236 236 ("%s--%s %s") % (noshortop, longoption,
237 237 longoptionarg))
238 238 opt = opt.rstrip()
239 239 blocks[j]['optstr'] = opt
240 240 optstrwidth = max(optstrwidth, encoding.colwidth(opt))
241 241 j += 1
242 242
243 243 for block in blocks[i:j]:
244 244 block['optstrwidth'] = optstrwidth
245 245 i = j + 1
246 246 return blocks
247 247
248 248 def prunecontainers(blocks, keep):
249 249 """Prune unwanted containers.
250 250
251 251 The blocks must have a 'type' field, i.e., they should have been
252 252 run through findliteralblocks first.
253 253 """
254 254 pruned = []
255 255 i = 0
256 256 while i + 1 < len(blocks):
257 257 # Searching for a block that looks like this:
258 258 #
259 259 # +-------+---------------------------+
260 260 # | ".. container ::" type |
261 261 # +---+ |
262 262 # | blocks |
263 263 # +-------------------------------+
264 264 if (blocks[i]['type'] == 'paragraph' and
265 265 blocks[i]['lines'][0].startswith('.. container::')):
266 266 indent = blocks[i]['indent']
267 267 adjustment = blocks[i + 1]['indent'] - indent
268 268 containertype = blocks[i]['lines'][0][15:]
269 269 prune = True
270 270 for c in keep:
271 271 if c in containertype.split('.'):
272 272 prune = False
273 273 if prune:
274 274 pruned.append(containertype)
275 275
276 276 # Always delete "..container:: type" block
277 277 del blocks[i]
278 278 j = i
279 279 i -= 1
280 280 while j < len(blocks) and blocks[j]['indent'] > indent:
281 281 if prune:
282 282 del blocks[j]
283 283 else:
284 284 blocks[j]['indent'] -= adjustment
285 285 j += 1
286 286 i += 1
287 287 return blocks, pruned
288 288
289 289 _sectionre = re.compile(r"""^([-=`:.'"~^_*+#])\1+$""")
290 290
291 291 def findtables(blocks):
292 292 '''Find simple tables
293 293
294 294 Only simple one-line table elements are supported
295 295 '''
296 296
297 297 for block in blocks:
298 298 # Searching for a block that looks like this:
299 299 #
300 300 # === ==== ===
301 301 # A B C
302 302 # === ==== === <- optional
303 303 # 1 2 3
304 304 # x y z
305 305 # === ==== ===
306 306 if (block['type'] == 'paragraph' and
307 307 len(block['lines']) > 2 and
308 308 _tablere.match(block['lines'][0]) and
309 309 block['lines'][0] == block['lines'][-1]):
310 310 block['type'] = 'table'
311 311 block['header'] = False
312 312 div = block['lines'][0]
313 313
314 314 # column markers are ASCII so we can calculate column
315 315 # position in bytes
316 316 columns = [x for x in xrange(len(div))
317 317 if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
318 318 rows = []
319 319 for l in block['lines'][1:-1]:
320 320 if l == div:
321 321 block['header'] = True
322 322 continue
323 323 row = []
324 324 # we measure columns not in bytes or characters but in
325 325 # colwidth which makes things tricky
326 326 pos = columns[0] # leading whitespace is bytes
327 327 for n, start in enumerate(columns):
328 328 if n + 1 < len(columns):
329 329 width = columns[n + 1] - start
330 330 v = encoding.getcols(l, pos, width) # gather columns
331 331 pos += len(v) # calculate byte position of end
332 332 row.append(v.strip())
333 333 else:
334 334 row.append(l[pos:].strip())
335 335 rows.append(row)
336 336
337 337 block['table'] = rows
338 338
339 339 return blocks
340 340
341 341 def findsections(blocks):
342 342 """Finds sections.
343 343
344 344 The blocks must have a 'type' field, i.e., they should have been
345 345 run through findliteralblocks first.
346 346 """
347 347 for block in blocks:
348 348 # Searching for a block that looks like this:
349 349 #
350 350 # +------------------------------+
351 351 # | Section title |
352 352 # | ------------- |
353 353 # +------------------------------+
354 354 if (block['type'] == 'paragraph' and
355 355 len(block['lines']) == 2 and
356 356 encoding.colwidth(block['lines'][0]) == len(block['lines'][1]) and
357 357 _sectionre.match(block['lines'][1])):
358 358 block['underline'] = block['lines'][1][0]
359 359 block['type'] = 'section'
360 360 del block['lines'][1]
361 361 return blocks
362 362
363 363 def inlineliterals(blocks):
364 364 substs = [('``', '"')]
365 365 for b in blocks:
366 366 if b['type'] in ('paragraph', 'section'):
367 367 b['lines'] = [replace(l, substs) for l in b['lines']]
368 368 return blocks
369 369
370 370 def hgrole(blocks):
371 substs = [(':hg:`', '"hg '), ('`', '"')]
371 substs = [(':hg:`', "'hg "), ('`', "'")]
372 372 for b in blocks:
373 373 if b['type'] in ('paragraph', 'section'):
374 374 # Turn :hg:`command` into "hg command". This also works
375 375 # when there is a line break in the command and relies on
376 376 # the fact that we have no stray back-quotes in the input
377 377 # (run the blocks through inlineliterals first).
378 378 b['lines'] = [replace(l, substs) for l in b['lines']]
379 379 return blocks
380 380
381 381 def addmargins(blocks):
382 382 """Adds empty blocks for vertical spacing.
383 383
384 384 This groups bullets, options, and definitions together with no vertical
385 385 space between them, and adds an empty block between all other blocks.
386 386 """
387 387 i = 1
388 388 while i < len(blocks):
389 389 if (blocks[i]['type'] == blocks[i - 1]['type'] and
390 390 blocks[i]['type'] in ('bullet', 'option', 'field')):
391 391 i += 1
392 392 elif not blocks[i - 1]['lines']:
393 393 # no lines in previous block, do not separate
394 394 i += 1
395 395 else:
396 396 blocks.insert(i, {'lines': [''], 'indent': 0, 'type': 'margin'})
397 397 i += 2
398 398 return blocks
399 399
400 400 def prunecomments(blocks):
401 401 """Remove comments."""
402 402 i = 0
403 403 while i < len(blocks):
404 404 b = blocks[i]
405 405 if b['type'] == 'paragraph' and (b['lines'][0].startswith('.. ') or
406 406 b['lines'] == ['..']):
407 407 del blocks[i]
408 408 if i < len(blocks) and blocks[i]['type'] == 'margin':
409 409 del blocks[i]
410 410 else:
411 411 i += 1
412 412 return blocks
413 413
414 414 _admonitionre = re.compile(r"\.\. (admonition|attention|caution|danger|"
415 415 r"error|hint|important|note|tip|warning)::",
416 416 flags=re.IGNORECASE)
417 417
418 418 def findadmonitions(blocks):
419 419 """
420 420 Makes the type of the block an admonition block if
421 421 the first line is an admonition directive
422 422 """
423 423 i = 0
424 424 while i < len(blocks):
425 425 m = _admonitionre.match(blocks[i]['lines'][0])
426 426 if m:
427 427 blocks[i]['type'] = 'admonition'
428 428 admonitiontitle = blocks[i]['lines'][0][3:m.end() - 2].lower()
429 429
430 430 firstline = blocks[i]['lines'][0][m.end() + 1:]
431 431 if firstline:
432 432 blocks[i]['lines'].insert(1, ' ' + firstline)
433 433
434 434 blocks[i]['admonitiontitle'] = admonitiontitle
435 435 del blocks[i]['lines'][0]
436 436 i = i + 1
437 437 return blocks
438 438
439 439 _admonitiontitles = {'attention': _('Attention:'),
440 440 'caution': _('Caution:'),
441 441 'danger': _('!Danger!') ,
442 442 'error': _('Error:'),
443 443 'hint': _('Hint:'),
444 444 'important': _('Important:'),
445 445 'note': _('Note:'),
446 446 'tip': _('Tip:'),
447 447 'warning': _('Warning!')}
448 448
449 449 def formatoption(block, width):
450 450 desc = ' '.join(map(str.strip, block['lines']))
451 451 colwidth = encoding.colwidth(block['optstr'])
452 452 usablewidth = width - 1
453 453 hanging = block['optstrwidth']
454 454 initindent = '%s%s ' % (block['optstr'], ' ' * ((hanging - colwidth)))
455 455 hangindent = ' ' * (encoding.colwidth(initindent) + 1)
456 456 return ' %s\n' % (util.wrap(desc, usablewidth,
457 457 initindent=initindent,
458 458 hangindent=hangindent))
459 459
460 460 def formatblock(block, width):
461 461 """Format a block according to width."""
462 462 if width <= 0:
463 463 width = 78
464 464 indent = ' ' * block['indent']
465 465 if block['type'] == 'admonition':
466 466 admonition = _admonitiontitles[block['admonitiontitle']]
467 467 if not block['lines']:
468 468 return indent + admonition + '\n'
469 469 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
470 470
471 471 defindent = indent + hang * ' '
472 472 text = ' '.join(map(str.strip, block['lines']))
473 473 return '%s\n%s\n' % (indent + admonition,
474 474 util.wrap(text, width=width,
475 475 initindent=defindent,
476 476 hangindent=defindent))
477 477 if block['type'] == 'margin':
478 478 return '\n'
479 479 if block['type'] == 'literal':
480 480 indent += ' '
481 481 return indent + ('\n' + indent).join(block['lines']) + '\n'
482 482 if block['type'] == 'section':
483 483 underline = encoding.colwidth(block['lines'][0]) * block['underline']
484 484 return "%s%s\n%s%s\n" % (indent, block['lines'][0],indent, underline)
485 485 if block['type'] == 'table':
486 486 table = block['table']
487 487 # compute column widths
488 488 widths = [max([encoding.colwidth(e) for e in c]) for c in zip(*table)]
489 489 text = ''
490 490 span = sum(widths) + len(widths) - 1
491 491 indent = ' ' * block['indent']
492 492 hang = ' ' * (len(indent) + span - widths[-1])
493 493
494 494 for row in table:
495 495 l = []
496 496 for w, v in zip(widths, row):
497 497 pad = ' ' * (w - encoding.colwidth(v))
498 498 l.append(v + pad)
499 499 l = ' '.join(l)
500 500 l = util.wrap(l, width=width, initindent=indent, hangindent=hang)
501 501 if not text and block['header']:
502 502 text = l + '\n' + indent + '-' * (min(width, span)) + '\n'
503 503 else:
504 504 text += l + "\n"
505 505 return text
506 506 if block['type'] == 'definition':
507 507 term = indent + block['lines'][0]
508 508 hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip())
509 509 defindent = indent + hang * ' '
510 510 text = ' '.join(map(str.strip, block['lines'][1:]))
511 511 return '%s\n%s\n' % (term, util.wrap(text, width=width,
512 512 initindent=defindent,
513 513 hangindent=defindent))
514 514 subindent = indent
515 515 if block['type'] == 'bullet':
516 516 if block['lines'][0].startswith('| '):
517 517 # Remove bullet for line blocks and add no extra
518 518 # indentation.
519 519 block['lines'][0] = block['lines'][0][2:]
520 520 else:
521 521 m = _bulletre.match(block['lines'][0])
522 522 subindent = indent + m.end() * ' '
523 523 elif block['type'] == 'field':
524 524 key = block['key']
525 525 subindent = indent + _fieldwidth * ' '
526 526 if len(key) + 2 > _fieldwidth:
527 527 # key too large, use full line width
528 528 key = key.ljust(width)
529 529 else:
530 530 # key fits within field width
531 531 key = key.ljust(_fieldwidth)
532 532 block['lines'][0] = key + block['lines'][0]
533 533 elif block['type'] == 'option':
534 534 return formatoption(block, width)
535 535
536 536 text = ' '.join(map(str.strip, block['lines']))
537 537 return util.wrap(text, width=width,
538 538 initindent=indent,
539 539 hangindent=subindent) + '\n'
540 540
541 541 def formathtml(blocks):
542 542 """Format RST blocks as HTML"""
543 543
544 544 out = []
545 545 headernest = ''
546 546 listnest = []
547 547
548 548 def escape(s):
549 549 return cgi.escape(s, True)
550 550
551 551 def openlist(start, level):
552 552 if not listnest or listnest[-1][0] != start:
553 553 listnest.append((start, level))
554 554 out.append('<%s>\n' % start)
555 555
556 556 blocks = [b for b in blocks if b['type'] != 'margin']
557 557
558 558 for pos, b in enumerate(blocks):
559 559 btype = b['type']
560 560 level = b['indent']
561 561 lines = b['lines']
562 562
563 563 if btype == 'admonition':
564 564 admonition = escape(_admonitiontitles[b['admonitiontitle']])
565 565 text = escape(' '.join(map(str.strip, lines)))
566 566 out.append('<p>\n<b>%s</b> %s\n</p>\n' % (admonition, text))
567 567 elif btype == 'paragraph':
568 568 out.append('<p>\n%s\n</p>\n' % escape('\n'.join(lines)))
569 569 elif btype == 'margin':
570 570 pass
571 571 elif btype == 'literal':
572 572 out.append('<pre>\n%s\n</pre>\n' % escape('\n'.join(lines)))
573 573 elif btype == 'section':
574 574 i = b['underline']
575 575 if i not in headernest:
576 576 headernest += i
577 577 level = headernest.index(i) + 1
578 578 out.append('<h%d>%s</h%d>\n' % (level, escape(lines[0]), level))
579 579 elif btype == 'table':
580 580 table = b['table']
581 581 out.append('<table>\n')
582 582 for row in table:
583 583 out.append('<tr>')
584 584 for v in row:
585 585 out.append('<td>')
586 586 out.append(escape(v))
587 587 out.append('</td>')
588 588 out.append('\n')
589 589 out.pop()
590 590 out.append('</tr>\n')
591 591 out.append('</table>\n')
592 592 elif btype == 'definition':
593 593 openlist('dl', level)
594 594 term = escape(lines[0])
595 595 text = escape(' '.join(map(str.strip, lines[1:])))
596 596 out.append(' <dt>%s\n <dd>%s\n' % (term, text))
597 597 elif btype == 'bullet':
598 598 bullet, head = lines[0].split(' ', 1)
599 599 if bullet == '-':
600 600 openlist('ul', level)
601 601 else:
602 602 openlist('ol', level)
603 603 out.append(' <li> %s\n' % escape(' '.join([head] + lines[1:])))
604 604 elif btype == 'field':
605 605 openlist('dl', level)
606 606 key = escape(b['key'])
607 607 text = escape(' '.join(map(str.strip, lines)))
608 608 out.append(' <dt>%s\n <dd>%s\n' % (key, text))
609 609 elif btype == 'option':
610 610 openlist('dl', level)
611 611 opt = escape(b['optstr'])
612 612 desc = escape(' '.join(map(str.strip, lines)))
613 613 out.append(' <dt>%s\n <dd>%s\n' % (opt, desc))
614 614
615 615 # close lists if indent level of next block is lower
616 616 if listnest:
617 617 start, level = listnest[-1]
618 618 if pos == len(blocks) - 1:
619 619 out.append('</%s>\n' % start)
620 620 listnest.pop()
621 621 else:
622 622 nb = blocks[pos + 1]
623 623 ni = nb['indent']
624 624 if (ni < level or
625 625 (ni == level and
626 626 nb['type'] not in 'definition bullet field option')):
627 627 out.append('</%s>\n' % start)
628 628 listnest.pop()
629 629
630 630 return ''.join(out)
631 631
632 632 def parse(text, indent=0, keep=None):
633 633 """Parse text into a list of blocks"""
634 634 pruned = []
635 635 blocks = findblocks(text)
636 636 for b in blocks:
637 637 b['indent'] += indent
638 638 blocks = findliteralblocks(blocks)
639 639 blocks = findtables(blocks)
640 640 blocks, pruned = prunecontainers(blocks, keep or [])
641 641 blocks = findsections(blocks)
642 642 blocks = inlineliterals(blocks)
643 643 blocks = hgrole(blocks)
644 644 blocks = splitparagraphs(blocks)
645 645 blocks = updatefieldlists(blocks)
646 646 blocks = updateoptionlists(blocks)
647 647 blocks = findadmonitions(blocks)
648 648 blocks = addmargins(blocks)
649 649 blocks = prunecomments(blocks)
650 650 return blocks, pruned
651 651
652 652 def formatblocks(blocks, width):
653 653 text = ''.join(formatblock(b, width) for b in blocks)
654 654 return text
655 655
656 656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
657 657 """Parse and format the text according to width."""
658 658 blocks, pruned = parse(text, indent, keep or [])
659 659 parents = []
660 660 if section:
661 661 sections = getsections(blocks)
662 662 blocks = []
663 663 i = 0
664 664 lastparents = []
665 665 synthetic = []
666 666 collapse = True
667 667 while i < len(sections):
668 668 name, nest, b = sections[i]
669 669 del parents[nest:]
670 670 parents.append(i)
671 671 if name == section:
672 672 if lastparents != parents:
673 673 llen = len(lastparents)
674 674 plen = len(parents)
675 675 if llen and llen != plen:
676 676 collapse = False
677 677 s = []
678 678 for j in xrange(3, plen - 1):
679 679 parent = parents[j]
680 680 if (j >= llen or
681 681 lastparents[j] != parent):
682 682 s.append(len(blocks))
683 683 sec = sections[parent][2]
684 684 blocks.append(sec[0])
685 685 blocks.append(sec[-1])
686 686 if s:
687 687 synthetic.append(s)
688 688
689 689 lastparents = parents[:]
690 690 blocks.extend(b)
691 691
692 692 ## Also show all subnested sections
693 693 while i + 1 < len(sections) and sections[i + 1][1] > nest:
694 694 i += 1
695 695 blocks.extend(sections[i][2])
696 696 i += 1
697 697 if collapse:
698 698 synthetic.reverse()
699 699 for s in synthetic:
700 700 path = [blocks[i]['lines'][0] for i in s]
701 701 real = s[-1] + 2
702 702 realline = blocks[real]['lines']
703 703 realline[0] = ('"%s"' %
704 704 '.'.join(path + [realline[0]]).replace('"', ''))
705 705 del blocks[s[0]:real]
706 706
707 707 if style == 'html':
708 708 text = formathtml(blocks)
709 709 else:
710 710 text = ''.join(formatblock(b, width) for b in blocks)
711 711 if keep is None:
712 712 return text
713 713 else:
714 714 return text, pruned
715 715
716 716 def getsections(blocks):
717 717 '''return a list of (section name, nesting level, blocks) tuples'''
718 718 nest = ""
719 719 level = 0
720 720 secs = []
721 721
722 722 def getname(b):
723 723 if b['type'] == 'field':
724 724 x = b['key']
725 725 else:
726 726 x = b['lines'][0]
727 727 x = x.lower().strip('"')
728 728 if '(' in x:
729 729 x = x.split('(')[0]
730 730 return x
731 731
732 732 for b in blocks:
733 733 if b['type'] == 'section':
734 734 i = b['underline']
735 735 if i not in nest:
736 736 nest += i
737 737 level = nest.index(i) + 1
738 738 nest = nest[:level]
739 739 secs.append((getname(b), level, [b]))
740 740 elif b['type'] in ('definition', 'field'):
741 741 i = ' '
742 742 if i not in nest:
743 743 nest += i
744 744 level = nest.index(i) + 1
745 745 nest = nest[:level]
746 746 for i in range(1, len(secs) + 1):
747 747 sec = secs[-i]
748 748 if sec[1] < level:
749 749 break
750 750 siblings = [a for a in sec[2] if a['type'] == 'definition']
751 751 if siblings:
752 752 siblingindent = siblings[-1]['indent']
753 753 indent = b['indent']
754 754 if siblingindent < indent:
755 755 level += 1
756 756 break
757 757 elif siblingindent == indent:
758 758 level = sec[1]
759 759 break
760 760 secs.append((getname(b), level, [b]))
761 761 else:
762 762 if not secs:
763 763 # add an initial empty section
764 764 secs = [('', 0, [])]
765 765 if b['type'] != 'margin':
766 766 pointer = 1
767 767 bindent = b['indent']
768 768 while pointer < len(secs):
769 769 section = secs[-pointer][2][0]
770 770 if section['type'] != 'margin':
771 771 sindent = section['indent']
772 772 if len(section['lines']) > 1:
773 773 sindent += len(section['lines'][1]) - \
774 774 len(section['lines'][1].lstrip(' '))
775 775 if bindent >= sindent:
776 776 break
777 777 pointer += 1
778 778 if pointer > 1:
779 779 blevel = secs[-pointer][1]
780 780 if section['type'] != b['type']:
781 781 blevel += 1
782 782 secs.append(('', blevel, []))
783 783 secs[-1][2].append(b)
784 784 return secs
785 785
786 786 def decorateblocks(blocks, width):
787 787 '''generate a list of (section name, line text) pairs for search'''
788 788 lines = []
789 789 for s in getsections(blocks):
790 790 section = s[0]
791 791 text = formatblocks(s[2], width)
792 792 lines.append([(section, l) for l in text.splitlines(True)])
793 793 return lines
794 794
795 795 def maketable(data, indent=0, header=False):
796 796 '''Generate an RST table for the given table data as a list of lines'''
797 797
798 798 widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)]
799 799 indent = ' ' * indent
800 800 div = indent + ' '.join('=' * w for w in widths) + '\n'
801 801
802 802 out = [div]
803 803 for row in data:
804 804 l = []
805 805 for w, v in zip(widths, row):
806 806 if '\n' in v:
807 807 # only remove line breaks and indentation, long lines are
808 808 # handled by the next tool
809 809 v = ' '.join(e.lstrip() for e in v.split('\n'))
810 810 pad = ' ' * (w - encoding.colwidth(v))
811 811 l.append(v + pad)
812 812 out.append(indent + ' '.join(l) + "\n")
813 813 if header and len(data) > 1:
814 814 out.insert(2, div)
815 815 out.append(div)
816 816 return out
@@ -1,535 +1,535 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > convert=
4 4 > [convert]
5 5 > hg.saverev=False
6 6 > EOF
7 7 $ hg help convert
8 8 hg convert [OPTION]... SOURCE [DEST [REVMAP]]
9 9
10 10 convert a foreign SCM repository to a Mercurial one.
11 11
12 12 Accepted source formats [identifiers]:
13 13
14 14 - Mercurial [hg]
15 15 - CVS [cvs]
16 16 - Darcs [darcs]
17 17 - git [git]
18 18 - Subversion [svn]
19 19 - Monotone [mtn]
20 20 - GNU Arch [gnuarch]
21 21 - Bazaar [bzr]
22 22 - Perforce [p4]
23 23
24 24 Accepted destination formats [identifiers]:
25 25
26 26 - Mercurial [hg]
27 27 - Subversion [svn] (history on branches is not preserved)
28 28
29 29 If no revision is given, all revisions will be converted. Otherwise,
30 30 convert will only import up to the named revision (given in a format
31 31 understood by the source).
32 32
33 33 If no destination directory name is specified, it defaults to the basename
34 34 of the source with "-hg" appended. If the destination repository doesn't
35 35 exist, it will be created.
36 36
37 37 By default, all sources except Mercurial will use --branchsort. Mercurial
38 38 uses --sourcesort to preserve original revision numbers order. Sort modes
39 39 have the following effects:
40 40
41 41 --branchsort convert from parent to child revision when possible, which
42 42 means branches are usually converted one after the other.
43 43 It generates more compact repositories.
44 44 --datesort sort revisions by date. Converted repositories have good-
45 45 looking changelogs but are often an order of magnitude
46 46 larger than the same ones generated by --branchsort.
47 47 --sourcesort try to preserve source revisions order, only supported by
48 48 Mercurial sources.
49 49 --closesort try to move closed revisions as close as possible to parent
50 50 branches, only supported by Mercurial sources.
51 51
52 52 If "REVMAP" isn't given, it will be put in a default location
53 53 ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that
54 54 maps each source commit ID to the destination ID for that revision, like
55 55 so:
56 56
57 57 <source ID> <destination ID>
58 58
59 59 If the file doesn't exist, it's automatically created. It's updated on
60 each commit copied, so "hg convert" can be interrupted and can be run
60 each commit copied, so 'hg convert' can be interrupted and can be run
61 61 repeatedly to copy new commits.
62 62
63 63 The authormap is a simple text file that maps each source commit author to
64 64 a destination commit author. It is handy for source SCMs that use unix
65 65 logins to identify authors (e.g.: CVS). One line per author mapping and
66 66 the line format is:
67 67
68 68 source author = destination author
69 69
70 70 Empty lines and lines starting with a "#" are ignored.
71 71
72 72 The filemap is a file that allows filtering and remapping of files and
73 73 directories. Each line can contain one of the following directives:
74 74
75 75 include path/to/file-or-dir
76 76
77 77 exclude path/to/file-or-dir
78 78
79 79 rename path/to/source path/to/destination
80 80
81 81 Comment lines start with "#". A specified path matches if it equals the
82 82 full relative name of a file or one of its parent directories. The
83 83 "include" or "exclude" directive with the longest matching path applies,
84 84 so line order does not matter.
85 85
86 86 The "include" directive causes a file, or all files under a directory, to
87 87 be included in the destination repository. The default if there are no
88 88 "include" statements is to include everything. If there are any "include"
89 89 statements, nothing else is included. The "exclude" directive causes files
90 90 or directories to be omitted. The "rename" directive renames a file or
91 91 directory if it is converted. To rename from a subdirectory into the root
92 92 of the repository, use "." as the path to rename to.
93 93
94 94 "--full" will make sure the converted changesets contain exactly the right
95 95 files with the right content. It will make a full conversion of all files,
96 96 not just the ones that have changed. Files that already are correct will
97 97 not be changed. This can be used to apply filemap changes when converting
98 98 incrementally. This is currently only supported for Mercurial and
99 99 Subversion.
100 100
101 101 The splicemap is a file that allows insertion of synthetic history,
102 102 letting you specify the parents of a revision. This is useful if you want
103 103 to e.g. give a Subversion merge two parents, or graft two disconnected
104 104 series of history together. Each entry contains a key, followed by a
105 105 space, followed by one or two comma-separated values:
106 106
107 107 key parent1, parent2
108 108
109 109 The key is the revision ID in the source revision control system whose
110 110 parents should be modified (same format as a key in .hg/shamap). The
111 111 values are the revision IDs (in either the source or destination revision
112 112 control system) that should be used as the new parents for that node. For
113 113 example, if you have merged "release-1.0" into "trunk", then you should
114 114 specify the revision on "trunk" as the first parent and the one on the
115 115 "release-1.0" branch as the second.
116 116
117 117 The branchmap is a file that allows you to rename a branch when it is
118 118 being brought in from whatever external repository. When used in
119 119 conjunction with a splicemap, it allows for a powerful combination to help
120 120 fix even the most badly mismanaged repositories and turn them into nicely
121 121 structured Mercurial repositories. The branchmap contains lines of the
122 122 form:
123 123
124 124 original_branch_name new_branch_name
125 125
126 126 where "original_branch_name" is the name of the branch in the source
127 127 repository, and "new_branch_name" is the name of the branch is the
128 128 destination repository. No whitespace is allowed in the branch names. This
129 129 can be used to (for instance) move code in one repository from "default"
130 130 to a named branch.
131 131
132 132 Mercurial Source
133 133 ################
134 134
135 135 The Mercurial source recognizes the following configuration options, which
136 136 you can set on the command line with "--config":
137 137
138 138 convert.hg.ignoreerrors
139 139 ignore integrity errors when reading. Use it to fix
140 140 Mercurial repositories with missing revlogs, by converting
141 141 from and to Mercurial. Default is False.
142 142 convert.hg.saverev
143 143 store original revision ID in changeset (forces target IDs
144 144 to change). It takes a boolean argument and defaults to
145 145 False.
146 146 convert.hg.startrev
147 147 specify the initial Mercurial revision. The default is 0.
148 148 convert.hg.revs
149 149 revset specifying the source revisions to convert.
150 150
151 151 CVS Source
152 152 ##########
153 153
154 154 CVS source will use a sandbox (i.e. a checked-out copy) from CVS to
155 155 indicate the starting point of what will be converted. Direct access to
156 156 the repository files is not needed, unless of course the repository is
157 157 ":local:". The conversion uses the top level directory in the sandbox to
158 158 find the CVS repository, and then uses CVS rlog commands to find files to
159 159 convert. This means that unless a filemap is given, all files under the
160 160 starting directory will be converted, and that any directory
161 161 reorganization in the CVS sandbox is ignored.
162 162
163 163 The following options can be used with "--config":
164 164
165 165 convert.cvsps.cache
166 166 Set to False to disable remote log caching, for testing and
167 167 debugging purposes. Default is True.
168 168 convert.cvsps.fuzz
169 169 Specify the maximum time (in seconds) that is allowed
170 170 between commits with identical user and log message in a
171 171 single changeset. When very large files were checked in as
172 172 part of a changeset then the default may not be long enough.
173 173 The default is 60.
174 174 convert.cvsps.mergeto
175 175 Specify a regular expression to which commit log messages
176 176 are matched. If a match occurs, then the conversion process
177 177 will insert a dummy revision merging the branch on which
178 178 this log message occurs to the branch indicated in the
179 179 regex. Default is "{{mergetobranch ([-\w]+)}}"
180 180 convert.cvsps.mergefrom
181 181 Specify a regular expression to which commit log messages
182 182 are matched. If a match occurs, then the conversion process
183 183 will add the most recent revision on the branch indicated in
184 184 the regex as the second parent of the changeset. Default is
185 185 "{{mergefrombranch ([-\w]+)}}"
186 186 convert.localtimezone
187 187 use local time (as determined by the TZ environment
188 188 variable) for changeset date/times. The default is False
189 189 (use UTC).
190 190 hooks.cvslog Specify a Python function to be called at the end of
191 191 gathering the CVS log. The function is passed a list with
192 192 the log entries, and can modify the entries in-place, or add
193 193 or delete them.
194 194 hooks.cvschangesets
195 195 Specify a Python function to be called after the changesets
196 196 are calculated from the CVS log. The function is passed a
197 197 list with the changeset entries, and can modify the
198 198 changesets in-place, or add or delete them.
199 199
200 200 An additional "debugcvsps" Mercurial command allows the builtin changeset
201 201 merging code to be run without doing a conversion. Its parameters and
202 202 output are similar to that of cvsps 2.1. Please see the command help for
203 203 more details.
204 204
205 205 Subversion Source
206 206 #################
207 207
208 208 Subversion source detects classical trunk/branches/tags layouts. By
209 209 default, the supplied "svn://repo/path/" source URL is converted as a
210 210 single branch. If "svn://repo/path/trunk" exists it replaces the default
211 211 branch. If "svn://repo/path/branches" exists, its subdirectories are
212 212 listed as possible branches. If "svn://repo/path/tags" exists, it is
213 213 looked for tags referencing converted branches. Default "trunk",
214 214 "branches" and "tags" values can be overridden with following options. Set
215 215 them to paths relative to the source URL, or leave them blank to disable
216 216 auto detection.
217 217
218 218 The following options can be set with "--config":
219 219
220 220 convert.svn.branches
221 221 specify the directory containing branches. The default is
222 222 "branches".
223 223 convert.svn.tags
224 224 specify the directory containing tags. The default is
225 225 "tags".
226 226 convert.svn.trunk
227 227 specify the name of the trunk branch. The default is
228 228 "trunk".
229 229 convert.localtimezone
230 230 use local time (as determined by the TZ environment
231 231 variable) for changeset date/times. The default is False
232 232 (use UTC).
233 233
234 234 Source history can be retrieved starting at a specific revision, instead
235 235 of being integrally converted. Only single branch conversions are
236 236 supported.
237 237
238 238 convert.svn.startrev
239 239 specify start Subversion revision number. The default is 0.
240 240
241 241 Git Source
242 242 ##########
243 243
244 244 The Git importer converts commits from all reachable branches (refs in
245 245 refs/heads) and remotes (refs in refs/remotes) to Mercurial. Branches are
246 246 converted to bookmarks with the same name, with the leading 'refs/heads'
247 247 stripped. Git submodules are converted to Git subrepos in Mercurial.
248 248
249 249 The following options can be set with "--config":
250 250
251 251 convert.git.similarity
252 252 specify how similar files modified in a commit must be to be
253 253 imported as renames or copies, as a percentage between "0"
254 254 (disabled) and "100" (files must be identical). For example,
255 255 "90" means that a delete/add pair will be imported as a
256 256 rename if more than 90% of the file hasn't changed. The
257 257 default is "50".
258 258 convert.git.findcopiesharder
259 259 while detecting copies, look at all files in the working
260 260 copy instead of just changed ones. This is very expensive
261 261 for large projects, and is only effective when
262 262 "convert.git.similarity" is greater than 0. The default is
263 263 False.
264 264 convert.git.remoteprefix
265 265 remote refs are converted as bookmarks with
266 266 "convert.git.remoteprefix" as a prefix followed by a /. The
267 267 default is 'remote'.
268 268 convert.git.skipsubmodules
269 269 does not convert root level .gitmodules files or files with
270 270 160000 mode indicating a submodule. Default is False.
271 271
272 272 Perforce Source
273 273 ###############
274 274
275 275 The Perforce (P4) importer can be given a p4 depot path or a client
276 276 specification as source. It will convert all files in the source to a flat
277 277 Mercurial repository, ignoring labels, branches and integrations. Note
278 278 that when a depot path is given you then usually should specify a target
279 279 directory, because otherwise the target may be named "...-hg".
280 280
281 281 The following options can be set with "--config":
282 282
283 283 convert.p4.encoding
284 284 specify the encoding to use when decoding standard output of
285 285 the Perforce command line tool. The default is default
286 286 system encoding.
287 287 convert.p4.startrev
288 288 specify initial Perforce revision (a Perforce changelist
289 289 number).
290 290
291 291 Mercurial Destination
292 292 #####################
293 293
294 294 The Mercurial destination will recognize Mercurial subrepositories in the
295 295 destination directory, and update the .hgsubstate file automatically if
296 296 the destination subrepositories contain the <dest>/<sub>/.hg/shamap file.
297 297 Converting a repository with subrepositories requires converting a single
298 298 repository at a time, from the bottom up.
299 299
300 300 The following options are supported:
301 301
302 302 convert.hg.clonebranches
303 303 dispatch source branches in separate clones. The default is
304 304 False.
305 305 convert.hg.tagsbranch
306 306 branch name for tag revisions, defaults to "default".
307 307 convert.hg.usebranchnames
308 308 preserve branch names. The default is True.
309 309 convert.hg.sourcename
310 310 records the given string as a 'convert_source' extra value
311 311 on each commit made in the target repository. The default is
312 312 None.
313 313
314 314 All Destinations
315 315 ################
316 316
317 317 All destination types accept the following options:
318 318
319 319 convert.skiptags
320 320 does not convert tags from the source repo to the target
321 321 repo. The default is False.
322 322
323 323 options ([+] can be repeated):
324 324
325 325 -s --source-type TYPE source repository type
326 326 -d --dest-type TYPE destination repository type
327 327 -r --rev REV [+] import up to source revision REV
328 328 -A --authormap FILE remap usernames using this file
329 329 --filemap FILE remap file names using contents of file
330 330 --full apply filemap changes by converting all files again
331 331 --splicemap FILE splice synthesized history into place
332 332 --branchmap FILE change branch names while converting
333 333 --branchsort try to sort changesets by branches
334 334 --datesort try to sort changesets by date
335 335 --sourcesort preserve source changesets order
336 336 --closesort try to reorder closed revisions
337 337
338 338 (some details hidden, use --verbose to show complete help)
339 339 $ hg init a
340 340 $ cd a
341 341 $ echo a > a
342 342 $ hg ci -d'0 0' -Ama
343 343 adding a
344 344 $ hg cp a b
345 345 $ hg ci -d'1 0' -mb
346 346 $ hg rm a
347 347 $ hg ci -d'2 0' -mc
348 348 $ hg mv b a
349 349 $ hg ci -d'3 0' -md
350 350 $ echo a >> a
351 351 $ hg ci -d'4 0' -me
352 352 $ cd ..
353 353 $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded'
354 354 assuming destination a-hg
355 355 initializing destination a-hg repository
356 356 scanning source...
357 357 sorting...
358 358 converting...
359 359 4 a
360 360 3 b
361 361 2 c
362 362 1 d
363 363 0 e
364 364 $ hg --cwd a-hg pull ../a
365 365 pulling from ../a
366 366 searching for changes
367 367 no changes found
368 368
369 369 conversion to existing file should fail
370 370
371 371 $ touch bogusfile
372 372 $ hg convert a bogusfile
373 373 initializing destination bogusfile repository
374 374 abort: cannot create new bundle repository
375 375 [255]
376 376
377 377 #if unix-permissions no-root
378 378
379 379 conversion to dir without permissions should fail
380 380
381 381 $ mkdir bogusdir
382 382 $ chmod 000 bogusdir
383 383
384 384 $ hg convert a bogusdir
385 385 abort: Permission denied: 'bogusdir'
386 386 [255]
387 387
388 388 user permissions should succeed
389 389
390 390 $ chmod 700 bogusdir
391 391 $ hg convert a bogusdir
392 392 initializing destination bogusdir repository
393 393 scanning source...
394 394 sorting...
395 395 converting...
396 396 4 a
397 397 3 b
398 398 2 c
399 399 1 d
400 400 0 e
401 401
402 402 #endif
403 403
404 404 test pre and post conversion actions
405 405
406 406 $ echo 'include b' > filemap
407 407 $ hg convert --debug --filemap filemap a partialb | \
408 408 > grep 'run hg'
409 409 run hg source pre-conversion action
410 410 run hg sink pre-conversion action
411 411 run hg sink post-conversion action
412 412 run hg source post-conversion action
413 413
414 414 converting empty dir should fail "nicely
415 415
416 416 $ mkdir emptydir
417 417
418 418 override $PATH to ensure p4 not visible; use $PYTHON in case we're
419 419 running from a devel copy, not a temp installation
420 420
421 421 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir
422 422 assuming destination emptydir-hg
423 423 initializing destination emptydir-hg repository
424 424 emptydir does not look like a CVS checkout
425 425 emptydir does not look like a Git repository
426 426 emptydir does not look like a Subversion repository
427 427 emptydir is not a local Mercurial repository
428 428 emptydir does not look like a darcs repository
429 429 emptydir does not look like a monotone repository
430 430 emptydir does not look like a GNU Arch repository
431 431 emptydir does not look like a Bazaar repository
432 432 cannot find required "p4" tool
433 433 abort: emptydir: missing or unsupported repository
434 434 [255]
435 435
436 436 convert with imaginary source type
437 437
438 438 $ hg convert --source-type foo a a-foo
439 439 initializing destination a-foo repository
440 440 abort: foo: invalid source repository type
441 441 [255]
442 442
443 443 convert with imaginary sink type
444 444
445 445 $ hg convert --dest-type foo a a-foo
446 446 abort: foo: invalid destination repository type
447 447 [255]
448 448
449 449 testing: convert must not produce duplicate entries in fncache
450 450
451 451 $ hg convert a b
452 452 initializing destination b repository
453 453 scanning source...
454 454 sorting...
455 455 converting...
456 456 4 a
457 457 3 b
458 458 2 c
459 459 1 d
460 460 0 e
461 461
462 462 contents of fncache file:
463 463
464 464 $ cat b/.hg/store/fncache | sort
465 465 data/a.i
466 466 data/b.i
467 467
468 468 test bogus URL
469 469
470 470 $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz
471 471 abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository
472 472 [255]
473 473
474 474 test revset converted() lookup
475 475
476 476 $ hg --config convert.hg.saverev=True convert a c
477 477 initializing destination c repository
478 478 scanning source...
479 479 sorting...
480 480 converting...
481 481 4 a
482 482 3 b
483 483 2 c
484 484 1 d
485 485 0 e
486 486 $ echo f > c/f
487 487 $ hg -R c ci -d'0 0' -Amf
488 488 adding f
489 489 created new head
490 490 $ hg -R c log -r "converted(09d945a62ce6)"
491 491 changeset: 1:98c3dd46a874
492 492 user: test
493 493 date: Thu Jan 01 00:00:01 1970 +0000
494 494 summary: b
495 495
496 496 $ hg -R c log -r "converted()"
497 497 changeset: 0:31ed57b2037c
498 498 user: test
499 499 date: Thu Jan 01 00:00:00 1970 +0000
500 500 summary: a
501 501
502 502 changeset: 1:98c3dd46a874
503 503 user: test
504 504 date: Thu Jan 01 00:00:01 1970 +0000
505 505 summary: b
506 506
507 507 changeset: 2:3b9ca06ef716
508 508 user: test
509 509 date: Thu Jan 01 00:00:02 1970 +0000
510 510 summary: c
511 511
512 512 changeset: 3:4e0debd37cf2
513 513 user: test
514 514 date: Thu Jan 01 00:00:03 1970 +0000
515 515 summary: d
516 516
517 517 changeset: 4:9de3bc9349c5
518 518 user: test
519 519 date: Thu Jan 01 00:00:04 1970 +0000
520 520 summary: e
521 521
522 522
523 523 test specifying a sourcename
524 524 $ echo g > a/g
525 525 $ hg -R a ci -d'0 0' -Amg
526 526 adding g
527 527 $ hg --config convert.hg.sourcename=mysource --config convert.hg.saverev=True convert a c
528 528 scanning source...
529 529 sorting...
530 530 converting...
531 531 0 g
532 532 $ hg -R c log -r tip --template '{extras % "{extra}\n"}'
533 533 branch=default
534 534 convert_revision=a3bc6100aa8ec03e00aaf271f1f50046fb432072
535 535 convert_source=mysource
@@ -1,1224 +1,1224 b''
1 1 Test basic extension support
2 2
3 3 $ cat > foobar.py <<EOF
4 4 > import os
5 5 > from mercurial import cmdutil, commands
6 6 > cmdtable = {}
7 7 > command = cmdutil.command(cmdtable)
8 8 > def uisetup(ui):
9 9 > ui.write("uisetup called\\n")
10 10 > def reposetup(ui, repo):
11 11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
12 12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
13 13 > @command('foo', [], 'hg foo')
14 14 > def foo(ui, *args, **kwargs):
15 15 > ui.write("Foo\\n")
16 16 > @command('bar', [], 'hg bar', norepo=True)
17 17 > def bar(ui, *args, **kwargs):
18 18 > ui.write("Bar\\n")
19 19 > EOF
20 20 $ abspath=`pwd`/foobar.py
21 21
22 22 $ mkdir barfoo
23 23 $ cp foobar.py barfoo/__init__.py
24 24 $ barfoopath=`pwd`/barfoo
25 25
26 26 $ hg init a
27 27 $ cd a
28 28 $ echo foo > file
29 29 $ hg add file
30 30 $ hg commit -m 'add file'
31 31
32 32 $ echo '[extensions]' >> $HGRCPATH
33 33 $ echo "foobar = $abspath" >> $HGRCPATH
34 34 $ hg foo
35 35 uisetup called
36 36 reposetup called for a
37 37 ui == repo.ui
38 38 Foo
39 39
40 40 $ cd ..
41 41 $ hg clone a b
42 42 uisetup called
43 43 reposetup called for a
44 44 ui == repo.ui
45 45 reposetup called for b
46 46 ui == repo.ui
47 47 updating to branch default
48 48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 49
50 50 $ hg bar
51 51 uisetup called
52 52 Bar
53 53 $ echo 'foobar = !' >> $HGRCPATH
54 54
55 55 module/__init__.py-style
56 56
57 57 $ echo "barfoo = $barfoopath" >> $HGRCPATH
58 58 $ cd a
59 59 $ hg foo
60 60 uisetup called
61 61 reposetup called for a
62 62 ui == repo.ui
63 63 Foo
64 64 $ echo 'barfoo = !' >> $HGRCPATH
65 65
66 66 Check that extensions are loaded in phases:
67 67
68 68 $ cat > foo.py <<EOF
69 69 > import os
70 70 > name = os.path.basename(__file__).rsplit('.', 1)[0]
71 71 > print "1) %s imported" % name
72 72 > def uisetup(ui):
73 73 > print "2) %s uisetup" % name
74 74 > def extsetup():
75 75 > print "3) %s extsetup" % name
76 76 > def reposetup(ui, repo):
77 77 > print "4) %s reposetup" % name
78 78 > EOF
79 79
80 80 $ cp foo.py bar.py
81 81 $ echo 'foo = foo.py' >> $HGRCPATH
82 82 $ echo 'bar = bar.py' >> $HGRCPATH
83 83
84 84 Command with no output, we just want to see the extensions loaded:
85 85
86 86 $ hg paths
87 87 1) foo imported
88 88 1) bar imported
89 89 2) foo uisetup
90 90 2) bar uisetup
91 91 3) foo extsetup
92 92 3) bar extsetup
93 93 4) foo reposetup
94 94 4) bar reposetup
95 95
96 96 Check hgweb's load order:
97 97
98 98 $ cat > hgweb.cgi <<EOF
99 99 > #!/usr/bin/env python
100 100 > from mercurial import demandimport; demandimport.enable()
101 101 > from mercurial.hgweb import hgweb
102 102 > from mercurial.hgweb import wsgicgi
103 103 > application = hgweb('.', 'test repo')
104 104 > wsgicgi.launch(application)
105 105 > EOF
106 106
107 107 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
108 108 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
109 109 > | grep '^[0-9]) ' # ignores HTML output
110 110 1) foo imported
111 111 1) bar imported
112 112 2) foo uisetup
113 113 2) bar uisetup
114 114 3) foo extsetup
115 115 3) bar extsetup
116 116 4) foo reposetup
117 117 4) bar reposetup
118 118
119 119 $ echo 'foo = !' >> $HGRCPATH
120 120 $ echo 'bar = !' >> $HGRCPATH
121 121
122 122 Check "from __future__ import absolute_import" support for external libraries
123 123
124 124 #if windows
125 125 $ PATHSEP=";"
126 126 #else
127 127 $ PATHSEP=":"
128 128 #endif
129 129 $ export PATHSEP
130 130
131 131 $ mkdir $TESTTMP/libroot
132 132 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
133 133 $ mkdir $TESTTMP/libroot/mod
134 134 $ touch $TESTTMP/libroot/mod/__init__.py
135 135 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
136 136
137 137 #if absimport
138 138 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
139 139 > from __future__ import absolute_import
140 140 > import ambig # should load "libroot/ambig.py"
141 141 > s = ambig.s
142 142 > EOF
143 143 $ cat > loadabs.py <<EOF
144 144 > import mod.ambigabs as ambigabs
145 145 > def extsetup():
146 146 > print 'ambigabs.s=%s' % ambigabs.s
147 147 > EOF
148 148 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
149 149 ambigabs.s=libroot/ambig.py
150 150 $TESTTMP/a (glob)
151 151 #endif
152 152
153 153 #if no-py3k
154 154 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
155 155 > import ambig # should load "libroot/mod/ambig.py"
156 156 > s = ambig.s
157 157 > EOF
158 158 $ cat > loadrel.py <<EOF
159 159 > import mod.ambigrel as ambigrel
160 160 > def extsetup():
161 161 > print 'ambigrel.s=%s' % ambigrel.s
162 162 > EOF
163 163 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
164 164 ambigrel.s=libroot/mod/ambig.py
165 165 $TESTTMP/a (glob)
166 166 #endif
167 167
168 168 Check absolute/relative import of extension specific modules
169 169
170 170 $ mkdir $TESTTMP/extroot
171 171 $ cat > $TESTTMP/extroot/bar.py <<EOF
172 172 > s = 'this is extroot.bar'
173 173 > EOF
174 174 $ mkdir $TESTTMP/extroot/sub1
175 175 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
176 176 > s = 'this is extroot.sub1.__init__'
177 177 > EOF
178 178 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
179 179 > s = 'this is extroot.sub1.baz'
180 180 > EOF
181 181 $ cat > $TESTTMP/extroot/__init__.py <<EOF
182 182 > s = 'this is extroot.__init__'
183 183 > import foo
184 184 > def extsetup(ui):
185 185 > ui.write('(extroot) ', foo.func(), '\n')
186 186 > EOF
187 187
188 188 $ cat > $TESTTMP/extroot/foo.py <<EOF
189 189 > # test absolute import
190 190 > buf = []
191 191 > def func():
192 192 > # "not locals" case
193 193 > import extroot.bar
194 194 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
195 195 > return '\n(extroot) '.join(buf)
196 196 > # "fromlist == ('*',)" case
197 197 > from extroot.bar import *
198 198 > buf.append('from extroot.bar import *: %s' % s)
199 199 > # "not fromlist" and "if '.' in name" case
200 200 > import extroot.sub1.baz
201 201 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
202 202 > # "not fromlist" and NOT "if '.' in name" case
203 203 > import extroot
204 204 > buf.append('import extroot: %s' % extroot.s)
205 205 > # NOT "not fromlist" and NOT "level != -1" case
206 206 > from extroot.bar import s
207 207 > buf.append('from extroot.bar import s: %s' % s)
208 208 > EOF
209 209 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
210 210 (extroot) from extroot.bar import *: this is extroot.bar
211 211 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
212 212 (extroot) import extroot: this is extroot.__init__
213 213 (extroot) from extroot.bar import s: this is extroot.bar
214 214 (extroot) import extroot.bar in func(): this is extroot.bar
215 215 $TESTTMP/a (glob)
216 216
217 217 #if no-py3k
218 218 $ rm "$TESTTMP"/extroot/foo.*
219 219 $ cat > $TESTTMP/extroot/foo.py <<EOF
220 220 > # test relative import
221 221 > buf = []
222 222 > def func():
223 223 > # "not locals" case
224 224 > import bar
225 225 > buf.append('import bar in func(): %s' % bar.s)
226 226 > return '\n(extroot) '.join(buf)
227 227 > # "fromlist == ('*',)" case
228 228 > from bar import *
229 229 > buf.append('from bar import *: %s' % s)
230 230 > # "not fromlist" and "if '.' in name" case
231 231 > import sub1.baz
232 232 > buf.append('import sub1.baz: %s' % sub1.baz.s)
233 233 > # "not fromlist" and NOT "if '.' in name" case
234 234 > import sub1
235 235 > buf.append('import sub1: %s' % sub1.s)
236 236 > # NOT "not fromlist" and NOT "level != -1" case
237 237 > from bar import s
238 238 > buf.append('from bar import s: %s' % s)
239 239 > EOF
240 240 $ hg --config extensions.extroot=$TESTTMP/extroot root
241 241 (extroot) from bar import *: this is extroot.bar
242 242 (extroot) import sub1.baz: this is extroot.sub1.baz
243 243 (extroot) import sub1: this is extroot.sub1.__init__
244 244 (extroot) from bar import s: this is extroot.bar
245 245 (extroot) import bar in func(): this is extroot.bar
246 246 $TESTTMP/a (glob)
247 247 #endif
248 248
249 249 $ cd ..
250 250
251 251 hide outer repo
252 252 $ hg init
253 253
254 254 $ cat > empty.py <<EOF
255 255 > '''empty cmdtable
256 256 > '''
257 257 > cmdtable = {}
258 258 > EOF
259 259 $ emptypath=`pwd`/empty.py
260 260 $ echo "empty = $emptypath" >> $HGRCPATH
261 261 $ hg help empty
262 262 empty extension - empty cmdtable
263 263
264 264 no commands defined
265 265
266 266
267 267 $ echo 'empty = !' >> $HGRCPATH
268 268
269 269 $ cat > debugextension.py <<EOF
270 270 > '''only debugcommands
271 271 > '''
272 272 > from mercurial import cmdutil
273 273 > cmdtable = {}
274 274 > command = cmdutil.command(cmdtable)
275 275 > @command('debugfoobar', [], 'hg debugfoobar')
276 276 > def debugfoobar(ui, repo, *args, **opts):
277 277 > "yet another debug command"
278 278 > pass
279 279 > @command('foo', [], 'hg foo')
280 280 > def foo(ui, repo, *args, **opts):
281 281 > """yet another foo command
282 282 > This command has been DEPRECATED since forever.
283 283 > """
284 284 > pass
285 285 > EOF
286 286 $ debugpath=`pwd`/debugextension.py
287 287 $ echo "debugextension = $debugpath" >> $HGRCPATH
288 288
289 289 $ hg help debugextension
290 290 hg debugextensions
291 291
292 292 show information about active extensions
293 293
294 294 options:
295 295
296 296 (some details hidden, use --verbose to show complete help)
297 297
298 298
299 299 $ hg --verbose help debugextension
300 300 hg debugextensions
301 301
302 302 show information about active extensions
303 303
304 304 options:
305 305
306 306 -T --template TEMPLATE display with template (EXPERIMENTAL)
307 307
308 308 global options ([+] can be repeated):
309 309
310 310 -R --repository REPO repository root directory or name of overlay bundle
311 311 file
312 312 --cwd DIR change working directory
313 313 -y --noninteractive do not prompt, automatically pick the first choice for
314 314 all prompts
315 315 -q --quiet suppress output
316 316 -v --verbose enable additional output
317 317 --config CONFIG [+] set/override config option (use 'section.name=value')
318 318 --debug enable debugging output
319 319 --debugger start debugger
320 320 --encoding ENCODE set the charset encoding (default: ascii)
321 321 --encodingmode MODE set the charset encoding mode (default: strict)
322 322 --traceback always print a traceback on exception
323 323 --time time how long the command takes
324 324 --profile print command execution profile
325 325 --version output version information and exit
326 326 -h --help display help and exit
327 327 --hidden consider hidden changesets
328 328
329 329
330 330
331 331
332 332
333 333
334 334 $ hg --debug help debugextension
335 335 hg debugextensions
336 336
337 337 show information about active extensions
338 338
339 339 options:
340 340
341 341 -T --template TEMPLATE display with template (EXPERIMENTAL)
342 342
343 343 global options ([+] can be repeated):
344 344
345 345 -R --repository REPO repository root directory or name of overlay bundle
346 346 file
347 347 --cwd DIR change working directory
348 348 -y --noninteractive do not prompt, automatically pick the first choice for
349 349 all prompts
350 350 -q --quiet suppress output
351 351 -v --verbose enable additional output
352 352 --config CONFIG [+] set/override config option (use 'section.name=value')
353 353 --debug enable debugging output
354 354 --debugger start debugger
355 355 --encoding ENCODE set the charset encoding (default: ascii)
356 356 --encodingmode MODE set the charset encoding mode (default: strict)
357 357 --traceback always print a traceback on exception
358 358 --time time how long the command takes
359 359 --profile print command execution profile
360 360 --version output version information and exit
361 361 -h --help display help and exit
362 362 --hidden consider hidden changesets
363 363
364 364
365 365
366 366
367 367
368 368 $ echo 'debugextension = !' >> $HGRCPATH
369 369
370 370 Asking for help about a deprecated extension should do something useful:
371 371
372 372 $ hg help glog
373 373 'glog' is provided by the following extension:
374 374
375 375 graphlog command to view revision graphs from a shell (DEPRECATED)
376 376
377 377 (use "hg help extensions" for information on enabling extensions)
378 378
379 379 Extension module help vs command help:
380 380
381 381 $ echo 'extdiff =' >> $HGRCPATH
382 382 $ hg help extdiff
383 383 hg extdiff [OPT]... [FILE]...
384 384
385 385 use external program to diff repository (or selected files)
386 386
387 387 Show differences between revisions for the specified files, using an
388 388 external program. The default program used is diff, with default options
389 389 "-Npru".
390 390
391 391 To select a different program, use the -p/--program option. The program
392 392 will be passed the names of two directories to compare. To pass additional
393 393 options to the program, use -o/--option. These will be passed before the
394 394 names of the directories to compare.
395 395
396 396 When two revision arguments are given, then changes are shown between
397 397 those revisions. If only one revision is specified then that revision is
398 398 compared to the working directory, and, when no revisions are specified,
399 399 the working directory files are compared to its parent.
400 400
401 401 (use "hg help -e extdiff" to show help for the extdiff extension)
402 402
403 403 options ([+] can be repeated):
404 404
405 405 -p --program CMD comparison program to run
406 406 -o --option OPT [+] pass option to comparison program
407 407 -r --rev REV [+] revision
408 408 -c --change REV change made by revision
409 409 --patch compare patches for two revisions
410 410 -I --include PATTERN [+] include names matching the given patterns
411 411 -X --exclude PATTERN [+] exclude names matching the given patterns
412 412 -S --subrepos recurse into subrepositories
413 413
414 414 (some details hidden, use --verbose to show complete help)
415 415
416 416
417 417
418 418
419 419
420 420
421 421
422 422
423 423
424 424
425 425 $ hg help --extension extdiff
426 426 extdiff extension - command to allow external programs to compare revisions
427 427
428 428 The extdiff Mercurial extension allows you to use external programs to compare
429 429 revisions, or revision with working directory. The external diff programs are
430 430 called with a configurable set of options and two non-option arguments: paths
431 431 to directories containing snapshots of files to compare.
432 432
433 433 The extdiff extension also allows you to configure new diff commands, so you
434 do not need to type "hg extdiff -p kdiff3" always.
434 do not need to type 'hg extdiff -p kdiff3' always.
435 435
436 436 [extdiff]
437 437 # add new command that runs GNU diff(1) in 'context diff' mode
438 438 cdiff = gdiff -Nprc5
439 439 ## or the old way:
440 440 #cmd.cdiff = gdiff
441 441 #opts.cdiff = -Nprc5
442 442
443 443 # add new command called meld, runs meld (no need to name twice). If
444 444 # the meld executable is not available, the meld tool in [merge-tools]
445 445 # will be used, if available
446 446 meld =
447 447
448 448 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
449 449 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
450 450 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
451 451 # your .vimrc
452 452 vimdiff = gvim -f "+next" \
453 453 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
454 454
455 455 Tool arguments can include variables that are expanded at runtime:
456 456
457 457 $parent1, $plabel1 - filename, descriptive label of first parent
458 458 $child, $clabel - filename, descriptive label of child revision
459 459 $parent2, $plabel2 - filename, descriptive label of second parent
460 460 $root - repository root
461 461 $parent is an alias for $parent1.
462 462
463 463 The extdiff extension will look in your [diff-tools] and [merge-tools]
464 464 sections for diff tool arguments, when none are specified in [extdiff].
465 465
466 466 [extdiff]
467 467 kdiff3 =
468 468
469 469 [diff-tools]
470 470 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
471 471
472 You can use -I/-X and list of file or directory names like normal "hg diff"
472 You can use -I/-X and list of file or directory names like normal 'hg diff'
473 473 command. The extdiff extension makes snapshots of only needed files, so
474 474 running the external diff program will actually be pretty fast (at least
475 475 faster than having to compare the entire tree).
476 476
477 477 list of commands:
478 478
479 479 extdiff use external program to diff repository (or selected files)
480 480
481 481 (use "hg help -v -e extdiff" to show built-in aliases and global options)
482 482
483 483
484 484
485 485
486 486
487 487
488 488
489 489
490 490
491 491
492 492
493 493
494 494
495 495
496 496
497 497
498 498 $ echo 'extdiff = !' >> $HGRCPATH
499 499
500 500 Test help topic with same name as extension
501 501
502 502 $ cat > multirevs.py <<EOF
503 503 > from mercurial import cmdutil, commands
504 504 > cmdtable = {}
505 505 > command = cmdutil.command(cmdtable)
506 506 > """multirevs extension
507 507 > Big multi-line module docstring."""
508 508 > @command('multirevs', [], 'ARG', norepo=True)
509 509 > def multirevs(ui, repo, arg, *args, **opts):
510 510 > """multirevs command"""
511 511 > pass
512 512 > EOF
513 513 $ echo "multirevs = multirevs.py" >> $HGRCPATH
514 514
515 515 $ hg help multirevs
516 516 Specifying Multiple Revisions
517 517 """""""""""""""""""""""""""""
518 518
519 519 When Mercurial accepts more than one revision, they may be specified
520 520 individually, or provided as a topologically continuous range, separated
521 521 by the ":" character.
522 522
523 523 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
524 524 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
525 525 specified, it defaults to revision number 0. If END is not specified, it
526 526 defaults to the tip. The range ":" thus means "all revisions".
527 527
528 528 If BEGIN is greater than END, revisions are treated in reverse order.
529 529
530 530 A range acts as a closed interval. This means that a range of 3:5 gives 3,
531 531 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
532 532
533 533 use "hg help -c multirevs" to see help for the multirevs command
534 534
535 535
536 536
537 537
538 538
539 539
540 540 $ hg help -c multirevs
541 541 hg multirevs ARG
542 542
543 543 multirevs command
544 544
545 545 (some details hidden, use --verbose to show complete help)
546 546
547 547
548 548
549 549 $ hg multirevs
550 550 hg multirevs: invalid arguments
551 551 hg multirevs ARG
552 552
553 553 multirevs command
554 554
555 555 (use "hg multirevs -h" to show more help)
556 556 [255]
557 557
558 558
559 559
560 560 $ echo "multirevs = !" >> $HGRCPATH
561 561
562 562 Issue811: Problem loading extensions twice (by site and by user)
563 563
564 564 $ cat <<EOF >> $HGRCPATH
565 565 > mq =
566 566 > strip =
567 567 > hgext.mq =
568 568 > hgext/mq =
569 569 > EOF
570 570
571 571 Show extensions:
572 572 (note that mq force load strip, also checking it's not loaded twice)
573 573
574 574 $ hg debugextensions
575 575 mq
576 576 strip
577 577
578 578 For extensions, which name matches one of its commands, help
579 579 message should ask '-v -e' to get list of built-in aliases
580 580 along with extension help itself
581 581
582 582 $ mkdir $TESTTMP/d
583 583 $ cat > $TESTTMP/d/dodo.py <<EOF
584 584 > """
585 585 > This is an awesome 'dodo' extension. It does nothing and
586 586 > writes 'Foo foo'
587 587 > """
588 588 > from mercurial import cmdutil, commands
589 589 > cmdtable = {}
590 590 > command = cmdutil.command(cmdtable)
591 591 > @command('dodo', [], 'hg dodo')
592 592 > def dodo(ui, *args, **kwargs):
593 593 > """Does nothing"""
594 594 > ui.write("I do nothing. Yay\\n")
595 595 > @command('foofoo', [], 'hg foofoo')
596 596 > def foofoo(ui, *args, **kwargs):
597 597 > """Writes 'Foo foo'"""
598 598 > ui.write("Foo foo\\n")
599 599 > EOF
600 600 $ dodopath=$TESTTMP/d/dodo.py
601 601
602 602 $ echo "dodo = $dodopath" >> $HGRCPATH
603 603
604 604 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
605 605 $ hg help -e dodo
606 606 dodo extension -
607 607
608 608 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
609 609
610 610 list of commands:
611 611
612 612 dodo Does nothing
613 613 foofoo Writes 'Foo foo'
614 614
615 615 (use "hg help -v -e dodo" to show built-in aliases and global options)
616 616
617 617 Make sure that '-v -e' prints list of built-in aliases along with
618 618 extension help itself
619 619 $ hg help -v -e dodo
620 620 dodo extension -
621 621
622 622 This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
623 623
624 624 list of commands:
625 625
626 626 dodo Does nothing
627 627 foofoo Writes 'Foo foo'
628 628
629 629 global options ([+] can be repeated):
630 630
631 631 -R --repository REPO repository root directory or name of overlay bundle
632 632 file
633 633 --cwd DIR change working directory
634 634 -y --noninteractive do not prompt, automatically pick the first choice for
635 635 all prompts
636 636 -q --quiet suppress output
637 637 -v --verbose enable additional output
638 638 --config CONFIG [+] set/override config option (use 'section.name=value')
639 639 --debug enable debugging output
640 640 --debugger start debugger
641 641 --encoding ENCODE set the charset encoding (default: ascii)
642 642 --encodingmode MODE set the charset encoding mode (default: strict)
643 643 --traceback always print a traceback on exception
644 644 --time time how long the command takes
645 645 --profile print command execution profile
646 646 --version output version information and exit
647 647 -h --help display help and exit
648 648 --hidden consider hidden changesets
649 649
650 650 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
651 651 $ hg help -v dodo
652 652 hg dodo
653 653
654 654 Does nothing
655 655
656 656 (use "hg help -e dodo" to show help for the dodo extension)
657 657
658 658 options:
659 659
660 660 --mq operate on patch repository
661 661
662 662 global options ([+] can be repeated):
663 663
664 664 -R --repository REPO repository root directory or name of overlay bundle
665 665 file
666 666 --cwd DIR change working directory
667 667 -y --noninteractive do not prompt, automatically pick the first choice for
668 668 all prompts
669 669 -q --quiet suppress output
670 670 -v --verbose enable additional output
671 671 --config CONFIG [+] set/override config option (use 'section.name=value')
672 672 --debug enable debugging output
673 673 --debugger start debugger
674 674 --encoding ENCODE set the charset encoding (default: ascii)
675 675 --encodingmode MODE set the charset encoding mode (default: strict)
676 676 --traceback always print a traceback on exception
677 677 --time time how long the command takes
678 678 --profile print command execution profile
679 679 --version output version information and exit
680 680 -h --help display help and exit
681 681 --hidden consider hidden changesets
682 682
683 683 In case when extension name doesn't match any of its commands,
684 684 help message should ask for '-v' to get list of built-in aliases
685 685 along with extension help
686 686 $ cat > $TESTTMP/d/dudu.py <<EOF
687 687 > """
688 688 > This is an awesome 'dudu' extension. It does something and
689 689 > also writes 'Beep beep'
690 690 > """
691 691 > from mercurial import cmdutil, commands
692 692 > cmdtable = {}
693 693 > command = cmdutil.command(cmdtable)
694 694 > @command('something', [], 'hg something')
695 695 > def something(ui, *args, **kwargs):
696 696 > """Does something"""
697 697 > ui.write("I do something. Yaaay\\n")
698 698 > @command('beep', [], 'hg beep')
699 699 > def beep(ui, *args, **kwargs):
700 700 > """Writes 'Beep beep'"""
701 701 > ui.write("Beep beep\\n")
702 702 > EOF
703 703 $ dudupath=$TESTTMP/d/dudu.py
704 704
705 705 $ echo "dudu = $dudupath" >> $HGRCPATH
706 706
707 707 $ hg help -e dudu
708 708 dudu extension -
709 709
710 710 This is an awesome 'dudu' extension. It does something and also writes 'Beep
711 711 beep'
712 712
713 713 list of commands:
714 714
715 715 beep Writes 'Beep beep'
716 716 something Does something
717 717
718 718 (use "hg help -v dudu" to show built-in aliases and global options)
719 719
720 720 In case when extension name doesn't match any of its commands,
721 721 help options '-v' and '-v -e' should be equivalent
722 722 $ hg help -v dudu
723 723 dudu extension -
724 724
725 725 This is an awesome 'dudu' extension. It does something and also writes 'Beep
726 726 beep'
727 727
728 728 list of commands:
729 729
730 730 beep Writes 'Beep beep'
731 731 something Does something
732 732
733 733 global options ([+] can be repeated):
734 734
735 735 -R --repository REPO repository root directory or name of overlay bundle
736 736 file
737 737 --cwd DIR change working directory
738 738 -y --noninteractive do not prompt, automatically pick the first choice for
739 739 all prompts
740 740 -q --quiet suppress output
741 741 -v --verbose enable additional output
742 742 --config CONFIG [+] set/override config option (use 'section.name=value')
743 743 --debug enable debugging output
744 744 --debugger start debugger
745 745 --encoding ENCODE set the charset encoding (default: ascii)
746 746 --encodingmode MODE set the charset encoding mode (default: strict)
747 747 --traceback always print a traceback on exception
748 748 --time time how long the command takes
749 749 --profile print command execution profile
750 750 --version output version information and exit
751 751 -h --help display help and exit
752 752 --hidden consider hidden changesets
753 753
754 754 $ hg help -v -e dudu
755 755 dudu extension -
756 756
757 757 This is an awesome 'dudu' extension. It does something and also writes 'Beep
758 758 beep'
759 759
760 760 list of commands:
761 761
762 762 beep Writes 'Beep beep'
763 763 something Does something
764 764
765 765 global options ([+] can be repeated):
766 766
767 767 -R --repository REPO repository root directory or name of overlay bundle
768 768 file
769 769 --cwd DIR change working directory
770 770 -y --noninteractive do not prompt, automatically pick the first choice for
771 771 all prompts
772 772 -q --quiet suppress output
773 773 -v --verbose enable additional output
774 774 --config CONFIG [+] set/override config option (use 'section.name=value')
775 775 --debug enable debugging output
776 776 --debugger start debugger
777 777 --encoding ENCODE set the charset encoding (default: ascii)
778 778 --encodingmode MODE set the charset encoding mode (default: strict)
779 779 --traceback always print a traceback on exception
780 780 --time time how long the command takes
781 781 --profile print command execution profile
782 782 --version output version information and exit
783 783 -h --help display help and exit
784 784 --hidden consider hidden changesets
785 785
786 786 Disabled extension commands:
787 787
788 788 $ ORGHGRCPATH=$HGRCPATH
789 789 $ HGRCPATH=
790 790 $ export HGRCPATH
791 791 $ hg help email
792 792 'email' is provided by the following extension:
793 793
794 794 patchbomb command to send changesets as (a series of) patch emails
795 795
796 796 (use "hg help extensions" for information on enabling extensions)
797 797
798 798
799 799 $ hg qdel
800 800 hg: unknown command 'qdel'
801 801 'qdelete' is provided by the following extension:
802 802
803 803 mq manage a stack of patches
804 804
805 805 (use "hg help extensions" for information on enabling extensions)
806 806 [255]
807 807
808 808
809 809 $ hg churn
810 810 hg: unknown command 'churn'
811 811 'churn' is provided by the following extension:
812 812
813 813 churn command to display statistics about repository history
814 814
815 815 (use "hg help extensions" for information on enabling extensions)
816 816 [255]
817 817
818 818
819 819
820 820 Disabled extensions:
821 821
822 822 $ hg help churn
823 823 churn extension - command to display statistics about repository history
824 824
825 825 (use "hg help extensions" for information on enabling extensions)
826 826
827 827 $ hg help patchbomb
828 828 patchbomb extension - command to send changesets as (a series of) patch emails
829 829
830 830 (use "hg help extensions" for information on enabling extensions)
831 831
832 832
833 833 Broken disabled extension and command:
834 834
835 835 $ mkdir hgext
836 836 $ echo > hgext/__init__.py
837 837 $ cat > hgext/broken.py <<EOF
838 838 > "broken extension'
839 839 > EOF
840 840 $ cat > path.py <<EOF
841 841 > import os, sys
842 842 > sys.path.insert(0, os.environ['HGEXTPATH'])
843 843 > EOF
844 844 $ HGEXTPATH=`pwd`
845 845 $ export HGEXTPATH
846 846
847 847 $ hg --config extensions.path=./path.py help broken
848 848 broken extension - (no help text available)
849 849
850 850 (use "hg help extensions" for information on enabling extensions)
851 851
852 852
853 853 $ cat > hgext/forest.py <<EOF
854 854 > cmdtable = None
855 855 > EOF
856 856 $ hg --config extensions.path=./path.py help foo > /dev/null
857 857 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
858 858 abort: no such help topic: foo
859 859 (try "hg help --keyword foo")
860 860 [255]
861 861
862 862 $ cat > throw.py <<EOF
863 863 > from mercurial import cmdutil, commands, util
864 864 > cmdtable = {}
865 865 > command = cmdutil.command(cmdtable)
866 866 > class Bogon(Exception): pass
867 867 > @command('throw', [], 'hg throw', norepo=True)
868 868 > def throw(ui, **opts):
869 869 > """throws an exception"""
870 870 > raise Bogon()
871 871 > EOF
872 872
873 873 No declared supported version, extension complains:
874 874 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
875 875 ** Unknown exception encountered with possibly-broken third-party extension throw
876 876 ** which supports versions unknown of Mercurial.
877 877 ** Please disable throw and try your action again.
878 878 ** If that fixes the bug please report it to the extension author.
879 879 ** Python * (glob)
880 880 ** Mercurial Distributed SCM * (glob)
881 881 ** Extensions loaded: throw
882 882
883 883 empty declaration of supported version, extension complains:
884 884 $ echo "testedwith = ''" >> throw.py
885 885 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
886 886 ** Unknown exception encountered with possibly-broken third-party extension throw
887 887 ** which supports versions unknown of Mercurial.
888 888 ** Please disable throw and try your action again.
889 889 ** If that fixes the bug please report it to the extension author.
890 890 ** Python * (glob)
891 891 ** Mercurial Distributed SCM (*) (glob)
892 892 ** Extensions loaded: throw
893 893
894 894 If the extension specifies a buglink, show that:
895 895 $ echo 'buglink = "http://example.com/bts"' >> throw.py
896 896 $ rm -f throw.pyc throw.pyo
897 897 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
898 898 ** Unknown exception encountered with possibly-broken third-party extension throw
899 899 ** which supports versions unknown of Mercurial.
900 900 ** Please disable throw and try your action again.
901 901 ** If that fixes the bug please report it to http://example.com/bts
902 902 ** Python * (glob)
903 903 ** Mercurial Distributed SCM (*) (glob)
904 904 ** Extensions loaded: throw
905 905
906 906 If the extensions declare outdated versions, accuse the older extension first:
907 907 $ echo "from mercurial import util" >> older.py
908 908 $ echo "util.version = lambda:'2.2'" >> older.py
909 909 $ echo "testedwith = '1.9.3'" >> older.py
910 910 $ echo "testedwith = '2.1.1'" >> throw.py
911 911 $ rm -f throw.pyc throw.pyo
912 912 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
913 913 > throw 2>&1 | egrep '^\*\*'
914 914 ** Unknown exception encountered with possibly-broken third-party extension older
915 915 ** which supports versions 1.9 of Mercurial.
916 916 ** Please disable older and try your action again.
917 917 ** If that fixes the bug please report it to the extension author.
918 918 ** Python * (glob)
919 919 ** Mercurial Distributed SCM (version 2.2)
920 920 ** Extensions loaded: throw, older
921 921
922 922 One extension only tested with older, one only with newer versions:
923 923 $ echo "util.version = lambda:'2.1'" >> older.py
924 924 $ rm -f older.pyc older.pyo
925 925 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
926 926 > throw 2>&1 | egrep '^\*\*'
927 927 ** Unknown exception encountered with possibly-broken third-party extension older
928 928 ** which supports versions 1.9 of Mercurial.
929 929 ** Please disable older and try your action again.
930 930 ** If that fixes the bug please report it to the extension author.
931 931 ** Python * (glob)
932 932 ** Mercurial Distributed SCM (version 2.1)
933 933 ** Extensions loaded: throw, older
934 934
935 935 Older extension is tested with current version, the other only with newer:
936 936 $ echo "util.version = lambda:'1.9.3'" >> older.py
937 937 $ rm -f older.pyc older.pyo
938 938 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
939 939 > throw 2>&1 | egrep '^\*\*'
940 940 ** Unknown exception encountered with possibly-broken third-party extension throw
941 941 ** which supports versions 2.1 of Mercurial.
942 942 ** Please disable throw and try your action again.
943 943 ** If that fixes the bug please report it to http://example.com/bts
944 944 ** Python * (glob)
945 945 ** Mercurial Distributed SCM (version 1.9.3)
946 946 ** Extensions loaded: throw, older
947 947
948 948 Ability to point to a different point
949 949 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
950 950 > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*'
951 951 ** unknown exception encountered, please report by visiting
952 952 ** Your Local Goat Lenders
953 953 ** Python * (glob)
954 954 ** Mercurial Distributed SCM (*) (glob)
955 955 ** Extensions loaded: throw, older
956 956
957 957 Declare the version as supporting this hg version, show regular bts link:
958 958 $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'`
959 959 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
960 960 $ if [ -z "$hgver" ]; then
961 961 > echo "unable to fetch a mercurial version. Make sure __version__ is correct";
962 962 > fi
963 963 $ rm -f throw.pyc throw.pyo
964 964 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
965 965 ** unknown exception encountered, please report by visiting
966 966 ** https://mercurial-scm.org/wiki/BugTracker
967 967 ** Python * (glob)
968 968 ** Mercurial Distributed SCM (*) (glob)
969 969 ** Extensions loaded: throw
970 970
971 971 Patch version is ignored during compatibility check
972 972 $ echo "testedwith = '3.2'" >> throw.py
973 973 $ echo "util.version = lambda:'3.2.2'" >> throw.py
974 974 $ rm -f throw.pyc throw.pyo
975 975 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
976 976 ** unknown exception encountered, please report by visiting
977 977 ** https://mercurial-scm.org/wiki/BugTracker
978 978 ** Python * (glob)
979 979 ** Mercurial Distributed SCM (*) (glob)
980 980 ** Extensions loaded: throw
981 981
982 982 Test version number support in 'hg version':
983 983 $ echo '__version__ = (1, 2, 3)' >> throw.py
984 984 $ rm -f throw.pyc throw.pyo
985 985 $ hg version -v
986 986 Mercurial Distributed SCM (version *) (glob)
987 987 (see https://mercurial-scm.org for more information)
988 988
989 989 Copyright (C) 2005-* Matt Mackall and others (glob)
990 990 This is free software; see the source for copying conditions. There is NO
991 991 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
992 992
993 993 Enabled extensions:
994 994
995 995
996 996 $ hg version -v --config extensions.throw=throw.py
997 997 Mercurial Distributed SCM (version *) (glob)
998 998 (see https://mercurial-scm.org for more information)
999 999
1000 1000 Copyright (C) 2005-* Matt Mackall and others (glob)
1001 1001 This is free software; see the source for copying conditions. There is NO
1002 1002 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1003 1003
1004 1004 Enabled extensions:
1005 1005
1006 1006 throw 1.2.3
1007 1007 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
1008 1008 $ rm -f throw.pyc throw.pyo
1009 1009 $ hg version -v --config extensions.throw=throw.py
1010 1010 Mercurial Distributed SCM (version *) (glob)
1011 1011 (see https://mercurial-scm.org for more information)
1012 1012
1013 1013 Copyright (C) 2005-* Matt Mackall and others (glob)
1014 1014 This is free software; see the source for copying conditions. There is NO
1015 1015 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1016 1016
1017 1017 Enabled extensions:
1018 1018
1019 1019 throw 1.twentythree
1020 1020
1021 1021 Refuse to load extensions with minimum version requirements
1022 1022
1023 1023 $ cat > minversion1.py << EOF
1024 1024 > from mercurial import util
1025 1025 > util.version = lambda: '3.5.2'
1026 1026 > minimumhgversion = '3.6'
1027 1027 > EOF
1028 1028 $ hg --config extensions.minversion=minversion1.py version
1029 1029 (third party extension minversion requires version 3.6 or newer of Mercurial; disabling)
1030 1030 Mercurial Distributed SCM (version 3.5.2)
1031 1031 (see https://mercurial-scm.org for more information)
1032 1032
1033 1033 Copyright (C) 2005-* Matt Mackall and others (glob)
1034 1034 This is free software; see the source for copying conditions. There is NO
1035 1035 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1036 1036
1037 1037 $ cat > minversion2.py << EOF
1038 1038 > from mercurial import util
1039 1039 > util.version = lambda: '3.6'
1040 1040 > minimumhgversion = '3.7'
1041 1041 > EOF
1042 1042 $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third'
1043 1043 (third party extension minversion requires version 3.7 or newer of Mercurial; disabling)
1044 1044
1045 1045 Can load version that is only off by point release
1046 1046
1047 1047 $ cat > minversion2.py << EOF
1048 1048 > from mercurial import util
1049 1049 > util.version = lambda: '3.6.1'
1050 1050 > minimumhgversion = '3.6'
1051 1051 > EOF
1052 1052 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1053 1053 [1]
1054 1054
1055 1055 Can load minimum version identical to current
1056 1056
1057 1057 $ cat > minversion3.py << EOF
1058 1058 > from mercurial import util
1059 1059 > util.version = lambda: '3.5'
1060 1060 > minimumhgversion = '3.5'
1061 1061 > EOF
1062 1062 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1063 1063 [1]
1064 1064
1065 1065 Restore HGRCPATH
1066 1066
1067 1067 $ HGRCPATH=$ORGHGRCPATH
1068 1068 $ export HGRCPATH
1069 1069
1070 1070 Commands handling multiple repositories at a time should invoke only
1071 1071 "reposetup()" of extensions enabling in the target repository.
1072 1072
1073 1073 $ mkdir reposetup-test
1074 1074 $ cd reposetup-test
1075 1075
1076 1076 $ cat > $TESTTMP/reposetuptest.py <<EOF
1077 1077 > from mercurial import extensions
1078 1078 > def reposetup(ui, repo):
1079 1079 > ui.write('reposetup() for %s\n' % (repo.root))
1080 1080 > EOF
1081 1081 $ hg init src
1082 1082 $ echo a > src/a
1083 1083 $ hg -R src commit -Am '#0 at src/a'
1084 1084 adding a
1085 1085 $ echo '[extensions]' >> src/.hg/hgrc
1086 1086 $ echo '# enable extension locally' >> src/.hg/hgrc
1087 1087 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
1088 1088 $ hg -R src status
1089 1089 reposetup() for $TESTTMP/reposetup-test/src (glob)
1090 1090
1091 1091 $ hg clone -U src clone-dst1
1092 1092 reposetup() for $TESTTMP/reposetup-test/src (glob)
1093 1093 $ hg init push-dst1
1094 1094 $ hg -q -R src push push-dst1
1095 1095 reposetup() for $TESTTMP/reposetup-test/src (glob)
1096 1096 $ hg init pull-src1
1097 1097 $ hg -q -R pull-src1 pull src
1098 1098 reposetup() for $TESTTMP/reposetup-test/src (glob)
1099 1099
1100 1100 $ cat <<EOF >> $HGRCPATH
1101 1101 > [extensions]
1102 1102 > # disable extension globally and explicitly
1103 1103 > reposetuptest = !
1104 1104 > EOF
1105 1105 $ hg clone -U src clone-dst2
1106 1106 reposetup() for $TESTTMP/reposetup-test/src (glob)
1107 1107 $ hg init push-dst2
1108 1108 $ hg -q -R src push push-dst2
1109 1109 reposetup() for $TESTTMP/reposetup-test/src (glob)
1110 1110 $ hg init pull-src2
1111 1111 $ hg -q -R pull-src2 pull src
1112 1112 reposetup() for $TESTTMP/reposetup-test/src (glob)
1113 1113
1114 1114 $ cat <<EOF >> $HGRCPATH
1115 1115 > [extensions]
1116 1116 > # enable extension globally
1117 1117 > reposetuptest = $TESTTMP/reposetuptest.py
1118 1118 > EOF
1119 1119 $ hg clone -U src clone-dst3
1120 1120 reposetup() for $TESTTMP/reposetup-test/src (glob)
1121 1121 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
1122 1122 $ hg init push-dst3
1123 1123 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1124 1124 $ hg -q -R src push push-dst3
1125 1125 reposetup() for $TESTTMP/reposetup-test/src (glob)
1126 1126 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
1127 1127 $ hg init pull-src3
1128 1128 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1129 1129 $ hg -q -R pull-src3 pull src
1130 1130 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
1131 1131 reposetup() for $TESTTMP/reposetup-test/src (glob)
1132 1132
1133 1133 $ echo '[extensions]' >> src/.hg/hgrc
1134 1134 $ echo '# disable extension locally' >> src/.hg/hgrc
1135 1135 $ echo 'reposetuptest = !' >> src/.hg/hgrc
1136 1136 $ hg clone -U src clone-dst4
1137 1137 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
1138 1138 $ hg init push-dst4
1139 1139 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1140 1140 $ hg -q -R src push push-dst4
1141 1141 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
1142 1142 $ hg init pull-src4
1143 1143 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1144 1144 $ hg -q -R pull-src4 pull src
1145 1145 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
1146 1146
1147 1147 disabling in command line overlays with all configuration
1148 1148 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
1149 1149 $ hg --config extensions.reposetuptest=! init push-dst5
1150 1150 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
1151 1151 $ hg --config extensions.reposetuptest=! init pull-src5
1152 1152 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
1153 1153
1154 1154 $ cat <<EOF >> $HGRCPATH
1155 1155 > [extensions]
1156 1156 > # disable extension globally and explicitly
1157 1157 > reposetuptest = !
1158 1158 > EOF
1159 1159 $ hg init parent
1160 1160 $ hg init parent/sub1
1161 1161 $ echo 1 > parent/sub1/1
1162 1162 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
1163 1163 adding 1
1164 1164 $ hg init parent/sub2
1165 1165 $ hg init parent/sub2/sub21
1166 1166 $ echo 21 > parent/sub2/sub21/21
1167 1167 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
1168 1168 adding 21
1169 1169 $ cat > parent/sub2/.hgsub <<EOF
1170 1170 > sub21 = sub21
1171 1171 > EOF
1172 1172 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
1173 1173 adding .hgsub
1174 1174 $ hg init parent/sub3
1175 1175 $ echo 3 > parent/sub3/3
1176 1176 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
1177 1177 adding 3
1178 1178 $ cat > parent/.hgsub <<EOF
1179 1179 > sub1 = sub1
1180 1180 > sub2 = sub2
1181 1181 > sub3 = sub3
1182 1182 > EOF
1183 1183 $ hg -R parent commit -Am '#0 at parent'
1184 1184 adding .hgsub
1185 1185 $ echo '[extensions]' >> parent/.hg/hgrc
1186 1186 $ echo '# enable extension locally' >> parent/.hg/hgrc
1187 1187 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
1188 1188 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
1189 1189 $ hg -R parent status -S -A
1190 1190 reposetup() for $TESTTMP/reposetup-test/parent (glob)
1191 1191 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
1192 1192 C .hgsub
1193 1193 C .hgsubstate
1194 1194 C sub1/1
1195 1195 C sub2/.hgsub
1196 1196 C sub2/.hgsubstate
1197 1197 C sub2/sub21/21
1198 1198 C sub3/3
1199 1199
1200 1200 $ cd ..
1201 1201
1202 1202 Test synopsis and docstring extending
1203 1203
1204 1204 $ hg init exthelp
1205 1205 $ cat > exthelp.py <<EOF
1206 1206 > from mercurial import commands, extensions
1207 1207 > def exbookmarks(orig, *args, **opts):
1208 1208 > return orig(*args, **opts)
1209 1209 > def uisetup(ui):
1210 1210 > synopsis = ' GREPME [--foo] [-x]'
1211 1211 > docstring = '''
1212 1212 > GREPME make sure that this is in the help!
1213 1213 > '''
1214 1214 > extensions.wrapcommand(commands.table, 'bookmarks', exbookmarks,
1215 1215 > synopsis, docstring)
1216 1216 > EOF
1217 1217 $ abspath=`pwd`/exthelp.py
1218 1218 $ echo '[extensions]' >> $HGRCPATH
1219 1219 $ echo "exthelp = $abspath" >> $HGRCPATH
1220 1220 $ cd exthelp
1221 1221 $ hg help bookmarks | grep GREPME
1222 1222 hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x]
1223 1223 GREPME make sure that this is in the help!
1224 1224
@@ -1,2986 +1,2986 b''
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 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks create a new bookmark or list existing bookmarks
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a changegroup file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 config show combined config settings from all hgrc files
66 66 copy mark files as copied for the next commit
67 67 diff diff repository (or selected files)
68 68 export dump the header and diffs for one or more changesets
69 69 files list tracked files
70 70 forget forget the specified files on the next commit
71 71 graft copy changes from other branches onto the current branch
72 72 grep search for a pattern in specified files and revisions
73 73 heads show branch heads
74 74 help show help for a given topic or a help overview
75 75 identify identify the working directory or specified revision
76 76 import import an ordered set of patches
77 77 incoming show new changesets found in source
78 78 init create a new repository in the given directory
79 79 log show revision history of entire repository or files
80 80 manifest output the current or given revision of the project manifest
81 81 merge merge another revision into working directory
82 82 outgoing show changesets not found in the destination
83 83 paths show aliases for remote repositories
84 84 phase set or show the current phase name
85 85 pull pull changes from the specified source
86 86 push push changes to the specified destination
87 87 recover roll back an interrupted transaction
88 88 remove remove the specified files on the next commit
89 89 rename rename files; equivalent of copy + remove
90 90 resolve redo merges or set/view the merge status of files
91 91 revert restore files to their checkout state
92 92 root print the root (top) of the current working directory
93 93 serve start stand-alone webserver
94 94 status show changed files in the working directory
95 95 summary summarize working directory state
96 96 tag add one or more tags for the current or given revision
97 97 tags list repository tags
98 98 unbundle apply one or more changegroup files
99 99 update update working directory (or switch revisions)
100 100 verify verify the integrity of the repository
101 101 version output version and copyright information
102 102
103 103 additional help topics:
104 104
105 105 config Configuration Files
106 106 dates Date Formats
107 107 diffs Diff Formats
108 108 environment Environment Variables
109 109 extensions Using Additional Features
110 110 filesets Specifying File Sets
111 111 glossary Glossary
112 112 hgignore Syntax for Mercurial Ignore Files
113 113 hgweb Configuring hgweb
114 114 internals Technical implementation topics
115 115 merge-tools Merge Tools
116 116 multirevs Specifying Multiple Revisions
117 117 patterns File Name Patterns
118 118 phases Working with Phases
119 119 revisions Specifying Single Revisions
120 120 revsets Specifying Revision Sets
121 121 scripting Using Mercurial from scripts and automation
122 122 subrepos Subrepositories
123 123 templating Template Usage
124 124 urls URL Paths
125 125
126 126 (use "hg help -v" to show built-in aliases and global options)
127 127
128 128 $ hg -q help
129 129 add add the specified files on the next commit
130 130 addremove add all new files, delete all missing files
131 131 annotate show changeset information by line for each file
132 132 archive create an unversioned archive of a repository revision
133 133 backout reverse effect of earlier changeset
134 134 bisect subdivision search of changesets
135 135 bookmarks create a new bookmark or list existing bookmarks
136 136 branch set or show the current branch name
137 137 branches list repository named branches
138 138 bundle create a changegroup file
139 139 cat output the current or given revision of files
140 140 clone make a copy of an existing repository
141 141 commit commit the specified files or all outstanding changes
142 142 config show combined config settings from all hgrc files
143 143 copy mark files as copied for the next commit
144 144 diff diff repository (or selected files)
145 145 export dump the header and diffs for one or more changesets
146 146 files list tracked files
147 147 forget forget the specified files on the next commit
148 148 graft copy changes from other branches onto the current branch
149 149 grep search for a pattern in specified files and revisions
150 150 heads show branch heads
151 151 help show help for a given topic or a help overview
152 152 identify identify the working directory or specified revision
153 153 import import an ordered set of patches
154 154 incoming show new changesets found in source
155 155 init create a new repository in the given directory
156 156 log show revision history of entire repository or files
157 157 manifest output the current or given revision of the project manifest
158 158 merge merge another revision into working directory
159 159 outgoing show changesets not found in the destination
160 160 paths show aliases for remote repositories
161 161 phase set or show the current phase name
162 162 pull pull changes from the specified source
163 163 push push changes to the specified destination
164 164 recover roll back an interrupted transaction
165 165 remove remove the specified files on the next commit
166 166 rename rename files; equivalent of copy + remove
167 167 resolve redo merges or set/view the merge status of files
168 168 revert restore files to their checkout state
169 169 root print the root (top) of the current working directory
170 170 serve start stand-alone webserver
171 171 status show changed files in the working directory
172 172 summary summarize working directory state
173 173 tag add one or more tags for the current or given revision
174 174 tags list repository tags
175 175 unbundle apply one or more changegroup files
176 176 update update working directory (or switch revisions)
177 177 verify verify the integrity of the repository
178 178 version output version and copyright information
179 179
180 180 additional help topics:
181 181
182 182 config Configuration Files
183 183 dates Date Formats
184 184 diffs Diff Formats
185 185 environment Environment Variables
186 186 extensions Using Additional Features
187 187 filesets Specifying File Sets
188 188 glossary Glossary
189 189 hgignore Syntax for Mercurial Ignore Files
190 190 hgweb Configuring hgweb
191 191 internals Technical implementation topics
192 192 merge-tools Merge Tools
193 193 multirevs Specifying Multiple Revisions
194 194 patterns File Name Patterns
195 195 phases Working with Phases
196 196 revisions Specifying Single Revisions
197 197 revsets Specifying Revision Sets
198 198 scripting Using Mercurial from scripts and automation
199 199 subrepos Subrepositories
200 200 templating Template Usage
201 201 urls URL Paths
202 202
203 203 Test extension help:
204 204 $ hg help extensions --config extensions.rebase= --config extensions.children=
205 205 Using Additional Features
206 206 """""""""""""""""""""""""
207 207
208 208 Mercurial has the ability to add new features through the use of
209 209 extensions. Extensions may add new commands, add options to existing
210 210 commands, change the default behavior of commands, or implement hooks.
211 211
212 212 To enable the "foo" extension, either shipped with Mercurial or in the
213 213 Python search path, create an entry for it in your configuration file,
214 214 like this:
215 215
216 216 [extensions]
217 217 foo =
218 218
219 219 You may also specify the full path to an extension:
220 220
221 221 [extensions]
222 222 myfeature = ~/.hgext/myfeature.py
223 223
224 See "hg help config" for more information on configuration files.
224 See 'hg help config' for more information on configuration files.
225 225
226 226 Extensions are not loaded by default for a variety of reasons: they can
227 227 increase startup overhead; they may be meant for advanced usage only; they
228 228 may provide potentially dangerous abilities (such as letting you destroy
229 229 or modify history); they might not be ready for prime time; or they may
230 230 alter some usual behaviors of stock Mercurial. It is thus up to the user
231 231 to activate extensions as needed.
232 232
233 233 To explicitly disable an extension enabled in a configuration file of
234 234 broader scope, prepend its path with !:
235 235
236 236 [extensions]
237 237 # disabling extension bar residing in /path/to/extension/bar.py
238 238 bar = !/path/to/extension/bar.py
239 239 # ditto, but no path was supplied for extension baz
240 240 baz = !
241 241
242 242 enabled extensions:
243 243
244 244 children command to display child changesets (DEPRECATED)
245 245 rebase command to move sets of revisions to a different ancestor
246 246
247 247 disabled extensions:
248 248
249 249 acl hooks for controlling repository access
250 250 blackbox log repository events to a blackbox for debugging
251 251 bugzilla hooks for integrating with the Bugzilla bug tracker
252 252 censor erase file content at a given revision
253 253 churn command to display statistics about repository history
254 254 clonebundles advertise pre-generated bundles to seed clones
255 255 (experimental)
256 256 color colorize output from some commands
257 257 convert import revisions from foreign VCS repositories into
258 258 Mercurial
259 259 eol automatically manage newlines in repository files
260 260 extdiff command to allow external programs to compare revisions
261 261 factotum http authentication with factotum
262 262 gpg commands to sign and verify changesets
263 263 hgcia hooks for integrating with the CIA.vc notification service
264 264 hgk browse the repository in a graphical way
265 265 highlight syntax highlighting for hgweb (requires Pygments)
266 266 histedit interactive history editing
267 267 keyword expand keywords in tracked files
268 268 largefiles track large binary files
269 269 mq manage a stack of patches
270 270 notify hooks for sending email push notifications
271 271 pager browse command output with an external pager
272 272 patchbomb command to send changesets as (a series of) patch emails
273 273 purge command to delete untracked files from the working
274 274 directory
275 275 record commands to interactively select changes for
276 276 commit/qrefresh
277 277 relink recreates hardlinks between repository clones
278 278 schemes extend schemes with shortcuts to repository swarms
279 279 share share a common history between several working directories
280 280 shelve save and restore changes to the working directory
281 281 strip strip changesets and their descendants from history
282 282 transplant command to transplant changesets from another branch
283 283 win32mbcs allow the use of MBCS paths with problematic encodings
284 284 zeroconf discover and advertise repositories on the local network
285 285
286 286 Verify that extension keywords appear in help templates
287 287
288 288 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
289 289
290 290 Test short command list with verbose option
291 291
292 292 $ hg -v help shortlist
293 293 Mercurial Distributed SCM
294 294
295 295 basic commands:
296 296
297 297 add add the specified files on the next commit
298 298 annotate, blame
299 299 show changeset information by line for each file
300 300 clone make a copy of an existing repository
301 301 commit, ci commit the specified files or all outstanding changes
302 302 diff diff repository (or selected files)
303 303 export dump the header and diffs for one or more changesets
304 304 forget forget the specified files on the next commit
305 305 init create a new repository in the given directory
306 306 log, history show revision history of entire repository or files
307 307 merge merge another revision into working directory
308 308 pull pull changes from the specified source
309 309 push push changes to the specified destination
310 310 remove, rm remove the specified files on the next commit
311 311 serve start stand-alone webserver
312 312 status, st show changed files in the working directory
313 313 summary, sum summarize working directory state
314 314 update, up, checkout, co
315 315 update working directory (or switch revisions)
316 316
317 317 global options ([+] can be repeated):
318 318
319 319 -R --repository REPO repository root directory or name of overlay bundle
320 320 file
321 321 --cwd DIR change working directory
322 322 -y --noninteractive do not prompt, automatically pick the first choice for
323 323 all prompts
324 324 -q --quiet suppress output
325 325 -v --verbose enable additional output
326 326 --config CONFIG [+] set/override config option (use 'section.name=value')
327 327 --debug enable debugging output
328 328 --debugger start debugger
329 329 --encoding ENCODE set the charset encoding (default: ascii)
330 330 --encodingmode MODE set the charset encoding mode (default: strict)
331 331 --traceback always print a traceback on exception
332 332 --time time how long the command takes
333 333 --profile print command execution profile
334 334 --version output version information and exit
335 335 -h --help display help and exit
336 336 --hidden consider hidden changesets
337 337
338 338 (use "hg help" for the full list of commands)
339 339
340 340 $ hg add -h
341 341 hg add [OPTION]... [FILE]...
342 342
343 343 add the specified files on the next commit
344 344
345 345 Schedule files to be version controlled and added to the repository.
346 346
347 347 The files will be added to the repository at the next commit. To undo an
348 add before that, see "hg forget".
348 add before that, see 'hg forget'.
349 349
350 350 If no names are given, add all files to the repository (except files
351 351 matching ".hgignore").
352 352
353 353 Returns 0 if all files are successfully added.
354 354
355 355 options ([+] can be repeated):
356 356
357 357 -I --include PATTERN [+] include names matching the given patterns
358 358 -X --exclude PATTERN [+] exclude names matching the given patterns
359 359 -S --subrepos recurse into subrepositories
360 360 -n --dry-run do not perform actions, just print output
361 361
362 362 (some details hidden, use --verbose to show complete help)
363 363
364 364 Verbose help for add
365 365
366 366 $ hg add -hv
367 367 hg add [OPTION]... [FILE]...
368 368
369 369 add the specified files on the next commit
370 370
371 371 Schedule files to be version controlled and added to the repository.
372 372
373 373 The files will be added to the repository at the next commit. To undo an
374 add before that, see "hg forget".
374 add before that, see 'hg forget'.
375 375
376 376 If no names are given, add all files to the repository (except files
377 377 matching ".hgignore").
378 378
379 379 Examples:
380 380
381 - New (unknown) files are added automatically by "hg add":
381 - New (unknown) files are added automatically by 'hg add':
382 382
383 383 $ ls
384 384 foo.c
385 385 $ hg status
386 386 ? foo.c
387 387 $ hg add
388 388 adding foo.c
389 389 $ hg status
390 390 A foo.c
391 391
392 392 - Specific files to be added can be specified:
393 393
394 394 $ ls
395 395 bar.c foo.c
396 396 $ hg status
397 397 ? bar.c
398 398 ? foo.c
399 399 $ hg add bar.c
400 400 $ hg status
401 401 A bar.c
402 402 ? foo.c
403 403
404 404 Returns 0 if all files are successfully added.
405 405
406 406 options ([+] can be repeated):
407 407
408 408 -I --include PATTERN [+] include names matching the given patterns
409 409 -X --exclude PATTERN [+] exclude names matching the given patterns
410 410 -S --subrepos recurse into subrepositories
411 411 -n --dry-run do not perform actions, just print output
412 412
413 413 global options ([+] can be repeated):
414 414
415 415 -R --repository REPO repository root directory or name of overlay bundle
416 416 file
417 417 --cwd DIR change working directory
418 418 -y --noninteractive do not prompt, automatically pick the first choice for
419 419 all prompts
420 420 -q --quiet suppress output
421 421 -v --verbose enable additional output
422 422 --config CONFIG [+] set/override config option (use 'section.name=value')
423 423 --debug enable debugging output
424 424 --debugger start debugger
425 425 --encoding ENCODE set the charset encoding (default: ascii)
426 426 --encodingmode MODE set the charset encoding mode (default: strict)
427 427 --traceback always print a traceback on exception
428 428 --time time how long the command takes
429 429 --profile print command execution profile
430 430 --version output version information and exit
431 431 -h --help display help and exit
432 432 --hidden consider hidden changesets
433 433
434 434 Test help option with version option
435 435
436 436 $ hg add -h --version
437 437 Mercurial Distributed SCM (version *) (glob)
438 438 (see https://mercurial-scm.org for more information)
439 439
440 440 Copyright (C) 2005-2015 Matt Mackall and others
441 441 This is free software; see the source for copying conditions. There is NO
442 442 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
443 443
444 444 $ hg add --skjdfks
445 445 hg add: option --skjdfks not recognized
446 446 hg add [OPTION]... [FILE]...
447 447
448 448 add the specified files on the next commit
449 449
450 450 options ([+] can be repeated):
451 451
452 452 -I --include PATTERN [+] include names matching the given patterns
453 453 -X --exclude PATTERN [+] exclude names matching the given patterns
454 454 -S --subrepos recurse into subrepositories
455 455 -n --dry-run do not perform actions, just print output
456 456
457 457 (use "hg add -h" to show more help)
458 458 [255]
459 459
460 460 Test ambiguous command help
461 461
462 462 $ hg help ad
463 463 list of commands:
464 464
465 465 add add the specified files on the next commit
466 466 addremove add all new files, delete all missing files
467 467
468 468 (use "hg help -v ad" to show built-in aliases and global options)
469 469
470 470 Test command without options
471 471
472 472 $ hg help verify
473 473 hg verify
474 474
475 475 verify the integrity of the repository
476 476
477 477 Verify the integrity of the current repository.
478 478
479 479 This will perform an extensive check of the repository's integrity,
480 480 validating the hashes and checksums of each entry in the changelog,
481 481 manifest, and tracked files, as well as the integrity of their crosslinks
482 482 and indices.
483 483
484 484 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
485 485 information about recovery from corruption of the repository.
486 486
487 487 Returns 0 on success, 1 if errors are encountered.
488 488
489 489 (some details hidden, use --verbose to show complete help)
490 490
491 491 $ hg help diff
492 492 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
493 493
494 494 diff repository (or selected files)
495 495
496 496 Show differences between revisions for the specified files.
497 497
498 498 Differences between files are shown using the unified diff format.
499 499
500 500 Note:
501 "hg diff" may generate unexpected results for merges, as it will
501 'hg diff' may generate unexpected results for merges, as it will
502 502 default to comparing against the working directory's first parent
503 503 changeset if no revisions are specified.
504 504
505 505 When two revision arguments are given, then changes are shown between
506 506 those revisions. If only one revision is specified then that revision is
507 507 compared to the working directory, and, when no revisions are specified,
508 508 the working directory files are compared to its first parent.
509 509
510 510 Alternatively you can specify -c/--change with a revision to see the
511 511 changes in that changeset relative to its first parent.
512 512
513 513 Without the -a/--text option, diff will avoid generating diffs of files it
514 514 detects as binary. With -a, diff will generate a diff anyway, probably
515 515 with undesirable results.
516 516
517 517 Use the -g/--git option to generate diffs in the git extended diff format.
518 For more information, read "hg help diffs".
518 For more information, read 'hg help diffs'.
519 519
520 520 Returns 0 on success.
521 521
522 522 options ([+] can be repeated):
523 523
524 524 -r --rev REV [+] revision
525 525 -c --change REV change made by revision
526 526 -a --text treat all files as text
527 527 -g --git use git extended diff format
528 528 --nodates omit dates from diff headers
529 529 --noprefix omit a/ and b/ prefixes from filenames
530 530 -p --show-function show which function each change is in
531 531 --reverse produce a diff that undoes the changes
532 532 -w --ignore-all-space ignore white space when comparing lines
533 533 -b --ignore-space-change ignore changes in the amount of white space
534 534 -B --ignore-blank-lines ignore changes whose lines are all blank
535 535 -U --unified NUM number of lines of context to show
536 536 --stat output diffstat-style summary of changes
537 537 --root DIR produce diffs relative to subdirectory
538 538 -I --include PATTERN [+] include names matching the given patterns
539 539 -X --exclude PATTERN [+] exclude names matching the given patterns
540 540 -S --subrepos recurse into subrepositories
541 541
542 542 (some details hidden, use --verbose to show complete help)
543 543
544 544 $ hg help status
545 545 hg status [OPTION]... [FILE]...
546 546
547 547 aliases: st
548 548
549 549 show changed files in the working directory
550 550
551 551 Show status of files in the repository. If names are given, only files
552 552 that match are shown. Files that are clean or ignored or the source of a
553 553 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
554 554 -C/--copies or -A/--all are given. Unless options described with "show
555 555 only ..." are given, the options -mardu are used.
556 556
557 557 Option -q/--quiet hides untracked (unknown and ignored) files unless
558 558 explicitly requested with -u/--unknown or -i/--ignored.
559 559
560 560 Note:
561 "hg status" may appear to disagree with diff if permissions have
561 'hg status' may appear to disagree with diff if permissions have
562 562 changed or a merge has occurred. The standard diff format does not
563 563 report permission changes and diff only reports changes relative to one
564 564 merge parent.
565 565
566 566 If one revision is given, it is used as the base revision. If two
567 567 revisions are given, the differences between them are shown. The --change
568 568 option can also be used as a shortcut to list the changed files of a
569 569 revision from its first parent.
570 570
571 571 The codes used to show the status of files are:
572 572
573 573 M = modified
574 574 A = added
575 575 R = removed
576 576 C = clean
577 577 ! = missing (deleted by non-hg command, but still tracked)
578 578 ? = not tracked
579 579 I = ignored
580 580 = origin of the previous file (with --copies)
581 581
582 582 Returns 0 on success.
583 583
584 584 options ([+] can be repeated):
585 585
586 586 -A --all show status of all files
587 587 -m --modified show only modified files
588 588 -a --added show only added files
589 589 -r --removed show only removed files
590 590 -d --deleted show only deleted (but tracked) files
591 591 -c --clean show only files without changes
592 592 -u --unknown show only unknown (not tracked) files
593 593 -i --ignored show only ignored files
594 594 -n --no-status hide status prefix
595 595 -C --copies show source of copied files
596 596 -0 --print0 end filenames with NUL, for use with xargs
597 597 --rev REV [+] show difference from revision
598 598 --change REV list the changed files of a revision
599 599 -I --include PATTERN [+] include names matching the given patterns
600 600 -X --exclude PATTERN [+] exclude names matching the given patterns
601 601 -S --subrepos recurse into subrepositories
602 602
603 603 (some details hidden, use --verbose to show complete help)
604 604
605 605 $ hg -q help status
606 606 hg status [OPTION]... [FILE]...
607 607
608 608 show changed files in the working directory
609 609
610 610 $ hg help foo
611 611 abort: no such help topic: foo
612 612 (try "hg help --keyword foo")
613 613 [255]
614 614
615 615 $ hg skjdfks
616 616 hg: unknown command 'skjdfks'
617 617 Mercurial Distributed SCM
618 618
619 619 basic commands:
620 620
621 621 add add the specified files on the next commit
622 622 annotate show changeset information by line for each file
623 623 clone make a copy of an existing repository
624 624 commit commit the specified files or all outstanding changes
625 625 diff diff repository (or selected files)
626 626 export dump the header and diffs for one or more changesets
627 627 forget forget the specified files on the next commit
628 628 init create a new repository in the given directory
629 629 log show revision history of entire repository or files
630 630 merge merge another revision into working directory
631 631 pull pull changes from the specified source
632 632 push push changes to the specified destination
633 633 remove remove the specified files on the next commit
634 634 serve start stand-alone webserver
635 635 status show changed files in the working directory
636 636 summary summarize working directory state
637 637 update update working directory (or switch revisions)
638 638
639 639 (use "hg help" for the full list of commands or "hg -v" for details)
640 640 [255]
641 641
642 642
643 643 Make sure that we don't run afoul of the help system thinking that
644 644 this is a section and erroring out weirdly.
645 645
646 646 $ hg .log
647 647 hg: unknown command '.log'
648 648 (did you mean log?)
649 649 [255]
650 650
651 651 $ hg log.
652 652 hg: unknown command 'log.'
653 653 (did you mean log?)
654 654 [255]
655 655 $ hg pu.lh
656 656 hg: unknown command 'pu.lh'
657 657 (did you mean one of pull, push?)
658 658 [255]
659 659
660 660 $ cat > helpext.py <<EOF
661 661 > import os
662 662 > from mercurial import cmdutil, commands
663 663 >
664 664 > cmdtable = {}
665 665 > command = cmdutil.command(cmdtable)
666 666 >
667 667 > @command('nohelp',
668 668 > [('', 'longdesc', 3, 'x'*90),
669 669 > ('n', '', None, 'normal desc'),
670 670 > ('', 'newline', '', 'line1\nline2')],
671 671 > 'hg nohelp',
672 672 > norepo=True)
673 673 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
674 674 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
675 675 > def nohelp(ui, *args, **kwargs):
676 676 > pass
677 677 >
678 678 > EOF
679 679 $ echo '[extensions]' >> $HGRCPATH
680 680 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
681 681
682 682 Test command with no help text
683 683
684 684 $ hg help nohelp
685 685 hg nohelp
686 686
687 687 (no help text available)
688 688
689 689 options:
690 690
691 691 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
692 692 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
693 693 -n -- normal desc
694 694 --newline VALUE line1 line2
695 695
696 696 (some details hidden, use --verbose to show complete help)
697 697
698 698 $ hg help -k nohelp
699 699 Commands:
700 700
701 701 nohelp hg nohelp
702 702
703 703 Extension Commands:
704 704
705 705 nohelp (no help text available)
706 706
707 707 Test that default list of commands omits extension commands
708 708
709 709 $ hg help
710 710 Mercurial Distributed SCM
711 711
712 712 list of commands:
713 713
714 714 add add the specified files on the next commit
715 715 addremove add all new files, delete all missing files
716 716 annotate show changeset information by line for each file
717 717 archive create an unversioned archive of a repository revision
718 718 backout reverse effect of earlier changeset
719 719 bisect subdivision search of changesets
720 720 bookmarks create a new bookmark or list existing bookmarks
721 721 branch set or show the current branch name
722 722 branches list repository named branches
723 723 bundle create a changegroup file
724 724 cat output the current or given revision of files
725 725 clone make a copy of an existing repository
726 726 commit commit the specified files or all outstanding changes
727 727 config show combined config settings from all hgrc files
728 728 copy mark files as copied for the next commit
729 729 diff diff repository (or selected files)
730 730 export dump the header and diffs for one or more changesets
731 731 files list tracked files
732 732 forget forget the specified files on the next commit
733 733 graft copy changes from other branches onto the current branch
734 734 grep search for a pattern in specified files and revisions
735 735 heads show branch heads
736 736 help show help for a given topic or a help overview
737 737 identify identify the working directory or specified revision
738 738 import import an ordered set of patches
739 739 incoming show new changesets found in source
740 740 init create a new repository in the given directory
741 741 log show revision history of entire repository or files
742 742 manifest output the current or given revision of the project manifest
743 743 merge merge another revision into working directory
744 744 outgoing show changesets not found in the destination
745 745 paths show aliases for remote repositories
746 746 phase set or show the current phase name
747 747 pull pull changes from the specified source
748 748 push push changes to the specified destination
749 749 recover roll back an interrupted transaction
750 750 remove remove the specified files on the next commit
751 751 rename rename files; equivalent of copy + remove
752 752 resolve redo merges or set/view the merge status of files
753 753 revert restore files to their checkout state
754 754 root print the root (top) of the current working directory
755 755 serve start stand-alone webserver
756 756 status show changed files in the working directory
757 757 summary summarize working directory state
758 758 tag add one or more tags for the current or given revision
759 759 tags list repository tags
760 760 unbundle apply one or more changegroup files
761 761 update update working directory (or switch revisions)
762 762 verify verify the integrity of the repository
763 763 version output version and copyright information
764 764
765 765 enabled extensions:
766 766
767 767 helpext (no help text available)
768 768
769 769 additional help topics:
770 770
771 771 config Configuration Files
772 772 dates Date Formats
773 773 diffs Diff Formats
774 774 environment Environment Variables
775 775 extensions Using Additional Features
776 776 filesets Specifying File Sets
777 777 glossary Glossary
778 778 hgignore Syntax for Mercurial Ignore Files
779 779 hgweb Configuring hgweb
780 780 internals Technical implementation topics
781 781 merge-tools Merge Tools
782 782 multirevs Specifying Multiple Revisions
783 783 patterns File Name Patterns
784 784 phases Working with Phases
785 785 revisions Specifying Single Revisions
786 786 revsets Specifying Revision Sets
787 787 scripting Using Mercurial from scripts and automation
788 788 subrepos Subrepositories
789 789 templating Template Usage
790 790 urls URL Paths
791 791
792 792 (use "hg help -v" to show built-in aliases and global options)
793 793
794 794
795 795 Test list of internal help commands
796 796
797 797 $ hg help debug
798 798 debug commands (internal and unsupported):
799 799
800 800 debugancestor
801 801 find the ancestor revision of two revisions in a given index
802 802 debugapplystreamclonebundle
803 803 apply a stream clone bundle file
804 804 debugbuilddag
805 805 builds a repo with a given DAG from scratch in the current
806 806 empty repo
807 807 debugbundle lists the contents of a bundle
808 808 debugcheckstate
809 809 validate the correctness of the current dirstate
810 810 debugcommands
811 811 list all available commands and options
812 812 debugcomplete
813 813 returns the completion list associated with the given command
814 814 debugcreatestreamclonebundle
815 815 create a stream clone bundle file
816 816 debugdag format the changelog or an index DAG as a concise textual
817 817 description
818 818 debugdata dump the contents of a data file revision
819 819 debugdate parse and display a date
820 820 debugdeltachain
821 821 dump information about delta chains in a revlog
822 822 debugdirstate
823 823 show the contents of the current dirstate
824 824 debugdiscovery
825 825 runs the changeset discovery protocol in isolation
826 826 debugextensions
827 827 show information about active extensions
828 828 debugfileset parse and apply a fileset specification
829 829 debugfsinfo show information detected about current filesystem
830 830 debuggetbundle
831 831 retrieves a bundle from a repo
832 832 debugignore display the combined ignore pattern and information about
833 833 ignored files
834 834 debugindex dump the contents of an index file
835 835 debugindexdot
836 836 dump an index DAG as a graphviz dot file
837 837 debuginstall test Mercurial installation
838 838 debugknown test whether node ids are known to a repo
839 839 debuglocks show or modify state of locks
840 840 debugmergestate
841 841 print merge state
842 842 debugnamecomplete
843 843 complete "names" - tags, open branch names, bookmark names
844 844 debugobsolete
845 845 create arbitrary obsolete marker
846 846 debugoptDEP (no help text available)
847 847 debugoptEXP (no help text available)
848 848 debugpathcomplete
849 849 complete part or all of a tracked path
850 850 debugpushkey access the pushkey key/value protocol
851 851 debugpvec (no help text available)
852 852 debugrebuilddirstate
853 853 rebuild the dirstate as it would look like for the given
854 854 revision
855 855 debugrebuildfncache
856 856 rebuild the fncache file
857 857 debugrename dump rename information
858 858 debugrevlog show data and statistics about a revlog
859 859 debugrevspec parse and apply a revision specification
860 860 debugsetparents
861 861 manually set the parents of the current working directory
862 862 debugsub (no help text available)
863 863 debugsuccessorssets
864 864 show set of successors for revision
865 865 debugwalk show how files match on given patterns
866 866 debugwireargs
867 867 (no help text available)
868 868
869 869 (use "hg help -v debug" to show built-in aliases and global options)
870 870
871 871 internals topic renders index of available sub-topics
872 872
873 873 $ hg help internals
874 874 Technical implementation topics
875 875 """""""""""""""""""""""""""""""
876 876
877 877 bundles container for exchange of repository data
878 878 changegroups representation of revlog data
879 879 revlogs revision storage mechanism
880 880
881 881 sub-topics can be accessed
882 882
883 883 $ hg help internals.changegroups
884 884 Changegroups
885 885 ============
886 886
887 887 Changegroups are representations of repository revlog data, specifically
888 888 the changelog, manifest, and filelogs.
889 889
890 890 There are 3 versions of changegroups: "1", "2", and "3". From a high-
891 891 level, versions "1" and "2" are almost exactly the same, with the only
892 892 difference being a header on entries in the changeset segment. Version "3"
893 893 adds support for exchanging treemanifests and includes revlog flags in the
894 894 delta header.
895 895
896 896 Changegroups consists of 3 logical segments:
897 897
898 898 +---------------------------------+
899 899 | | | |
900 900 | changeset | manifest | filelogs |
901 901 | | | |
902 902 +---------------------------------+
903 903
904 904 The principle building block of each segment is a *chunk*. A *chunk* is a
905 905 framed piece of data:
906 906
907 907 +---------------------------------------+
908 908 | | |
909 909 | length | data |
910 910 | (32 bits) | <length> bytes |
911 911 | | |
912 912 +---------------------------------------+
913 913
914 914 Each chunk starts with a 32-bit big-endian signed integer indicating the
915 915 length of the raw data that follows.
916 916
917 917 There is a special case chunk that has 0 length ("0x00000000"). We call
918 918 this an *empty chunk*.
919 919
920 920 Delta Groups
921 921 ------------
922 922
923 923 A *delta group* expresses the content of a revlog as a series of deltas,
924 924 or patches against previous revisions.
925 925
926 926 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
927 927 to signal the end of the delta group:
928 928
929 929 +------------------------------------------------------------------------+
930 930 | | | | | |
931 931 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
932 932 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
933 933 | | | | | |
934 934 +------------------------------------------------------------+-----------+
935 935
936 936 Each *chunk*'s data consists of the following:
937 937
938 938 +-----------------------------------------+
939 939 | | | |
940 940 | delta header | mdiff header | delta |
941 941 | (various) | (12 bytes) | (various) |
942 942 | | | |
943 943 +-----------------------------------------+
944 944
945 945 The *length* field is the byte length of the remaining 3 logical pieces of
946 946 data. The *delta* is a diff from an existing entry in the changelog.
947 947
948 948 The *delta header* is different between versions "1", "2", and "3" of the
949 949 changegroup format.
950 950
951 951 Version 1:
952 952
953 953 +------------------------------------------------------+
954 954 | | | | |
955 955 | node | p1 node | p2 node | link node |
956 956 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
957 957 | | | | |
958 958 +------------------------------------------------------+
959 959
960 960 Version 2:
961 961
962 962 +------------------------------------------------------------------+
963 963 | | | | | |
964 964 | node | p1 node | p2 node | base node | link node |
965 965 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
966 966 | | | | | |
967 967 +------------------------------------------------------------------+
968 968
969 969 Version 3:
970 970
971 971 +------------------------------------------------------------------------------+
972 972 | | | | | | |
973 973 | node | p1 node | p2 node | base node | link node | flags |
974 974 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
975 975 | | | | | | |
976 976 +------------------------------------------------------------------------------+
977 977
978 978 The *mdiff header* consists of 3 32-bit big-endian signed integers
979 979 describing offsets at which to apply the following delta content:
980 980
981 981 +-------------------------------------+
982 982 | | | |
983 983 | offset | old length | new length |
984 984 | (32 bits) | (32 bits) | (32 bits) |
985 985 | | | |
986 986 +-------------------------------------+
987 987
988 988 In version 1, the delta is always applied against the previous node from
989 989 the changegroup or the first parent if this is the first entry in the
990 990 changegroup.
991 991
992 992 In version 2, the delta base node is encoded in the entry in the
993 993 changegroup. This allows the delta to be expressed against any parent,
994 994 which can result in smaller deltas and more efficient encoding of data.
995 995
996 996 Changeset Segment
997 997 -----------------
998 998
999 999 The *changeset segment* consists of a single *delta group* holding
1000 1000 changelog data. It is followed by an *empty chunk* to denote the boundary
1001 1001 to the *manifests segment*.
1002 1002
1003 1003 Manifest Segment
1004 1004 ----------------
1005 1005
1006 1006 The *manifest segment* consists of a single *delta group* holding manifest
1007 1007 data. It is followed by an *empty chunk* to denote the boundary to the
1008 1008 *filelogs segment*.
1009 1009
1010 1010 Filelogs Segment
1011 1011 ----------------
1012 1012
1013 1013 The *filelogs* segment consists of multiple sub-segments, each
1014 1014 corresponding to an individual file whose data is being described:
1015 1015
1016 1016 +--------------------------------------+
1017 1017 | | | | |
1018 1018 | filelog0 | filelog1 | filelog2 | ... |
1019 1019 | | | | |
1020 1020 +--------------------------------------+
1021 1021
1022 1022 In version "3" of the changegroup format, filelogs may include directory
1023 1023 logs when treemanifests are in use. directory logs are identified by
1024 1024 having a trailing '/' on their filename (see below).
1025 1025
1026 1026 The final filelog sub-segment is followed by an *empty chunk* to denote
1027 1027 the end of the segment and the overall changegroup.
1028 1028
1029 1029 Each filelog sub-segment consists of the following:
1030 1030
1031 1031 +------------------------------------------+
1032 1032 | | | |
1033 1033 | filename size | filename | delta group |
1034 1034 | (32 bits) | (various) | (various) |
1035 1035 | | | |
1036 1036 +------------------------------------------+
1037 1037
1038 1038 That is, a *chunk* consisting of the filename (not terminated or padded)
1039 1039 followed by N chunks constituting the *delta group* for this file.
1040 1040
1041 1041 Test list of commands with command with no help text
1042 1042
1043 1043 $ hg help helpext
1044 1044 helpext extension - no help text available
1045 1045
1046 1046 list of commands:
1047 1047
1048 1048 nohelp (no help text available)
1049 1049
1050 1050 (use "hg help -v helpext" to show built-in aliases and global options)
1051 1051
1052 1052
1053 1053 test deprecated and experimental options are hidden in command help
1054 1054 $ hg help debugoptDEP
1055 1055 hg debugoptDEP
1056 1056
1057 1057 (no help text available)
1058 1058
1059 1059 options:
1060 1060
1061 1061 (some details hidden, use --verbose to show complete help)
1062 1062
1063 1063 $ hg help debugoptEXP
1064 1064 hg debugoptEXP
1065 1065
1066 1066 (no help text available)
1067 1067
1068 1068 options:
1069 1069
1070 1070 (some details hidden, use --verbose to show complete help)
1071 1071
1072 1072 test deprecated and experimental options is shown with -v
1073 1073 $ hg help -v debugoptDEP | grep dopt
1074 1074 --dopt option is (DEPRECATED)
1075 1075 $ hg help -v debugoptEXP | grep eopt
1076 1076 --eopt option is (EXPERIMENTAL)
1077 1077
1078 1078 #if gettext
1079 1079 test deprecated option is hidden with translation with untranslated description
1080 1080 (use many globy for not failing on changed transaction)
1081 1081 $ LANGUAGE=sv hg help debugoptDEP
1082 1082 hg debugoptDEP
1083 1083
1084 1084 (*) (glob)
1085 1085
1086 1086 options:
1087 1087
1088 1088 (some details hidden, use --verbose to show complete help)
1089 1089 #endif
1090 1090
1091 1091 Test commands that collide with topics (issue4240)
1092 1092
1093 1093 $ hg config -hq
1094 1094 hg config [-u] [NAME]...
1095 1095
1096 1096 show combined config settings from all hgrc files
1097 1097 $ hg showconfig -hq
1098 1098 hg config [-u] [NAME]...
1099 1099
1100 1100 show combined config settings from all hgrc files
1101 1101
1102 1102 Test a help topic
1103 1103
1104 1104 $ hg help revs
1105 1105 Specifying Single Revisions
1106 1106 """""""""""""""""""""""""""
1107 1107
1108 1108 Mercurial supports several ways to specify individual revisions.
1109 1109
1110 1110 A plain integer is treated as a revision number. Negative integers are
1111 1111 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1112 1112 denoting the revision prior to the tip, and so forth.
1113 1113
1114 1114 A 40-digit hexadecimal string is treated as a unique revision identifier.
1115 1115
1116 1116 A hexadecimal string less than 40 characters long is treated as a unique
1117 1117 revision identifier and is referred to as a short-form identifier. A
1118 1118 short-form identifier is only valid if it is the prefix of exactly one
1119 1119 full-length identifier.
1120 1120
1121 1121 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1122 1122 is a movable pointer to a revision. A tag is a permanent name associated
1123 1123 with a revision. A branch name denotes the tipmost open branch head of
1124 1124 that branch - or if they are all closed, the tipmost closed head of the
1125 1125 branch. Bookmark, tag, and branch names must not contain the ":"
1126 1126 character.
1127 1127
1128 1128 The reserved name "tip" always identifies the most recent revision.
1129 1129
1130 1130 The reserved name "null" indicates the null revision. This is the revision
1131 1131 of an empty repository, and the parent of revision 0.
1132 1132
1133 1133 The reserved name "." indicates the working directory parent. If no
1134 1134 working directory is checked out, it is equivalent to null. If an
1135 1135 uncommitted merge is in progress, "." is the revision of the first parent.
1136 1136
1137 1137 Test repeated config section name
1138 1138
1139 1139 $ hg help config.host
1140 1140 "http_proxy.host"
1141 1141 Host name and (optional) port of the proxy server, for example
1142 1142 "myproxy:8000".
1143 1143
1144 1144 "smtp.host"
1145 1145 Host name of mail server, e.g. "mail.example.com".
1146 1146
1147 1147 Unrelated trailing paragraphs shouldn't be included
1148 1148
1149 1149 $ hg help config.extramsg | grep '^$'
1150 1150
1151 1151
1152 1152 Test capitalized section name
1153 1153
1154 1154 $ hg help scripting.HGPLAIN > /dev/null
1155 1155
1156 1156 Help subsection:
1157 1157
1158 1158 $ hg help config.charsets |grep "Email example:" > /dev/null
1159 1159 [1]
1160 1160
1161 1161 Show nested definitions
1162 1162 ("profiling.type"[break]"ls"[break]"stat"[break])
1163 1163
1164 1164 $ hg help config.type | egrep '^$'|wc -l
1165 1165 \s*3 (re)
1166 1166
1167 1167 Separate sections from subsections
1168 1168
1169 1169 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1170 1170 "format"
1171 1171 --------
1172 1172
1173 1173 "usegeneraldelta"
1174 1174
1175 1175 "dotencode"
1176 1176
1177 1177 "usefncache"
1178 1178
1179 1179 "usestore"
1180 1180
1181 1181 "profiling"
1182 1182 -----------
1183 1183
1184 1184 "format"
1185 1185
1186 1186 "progress"
1187 1187 ----------
1188 1188
1189 1189 "format"
1190 1190
1191 1191
1192 1192 Last item in help config.*:
1193 1193
1194 1194 $ hg help config.`hg help config|grep '^ "'| \
1195 1195 > tail -1|sed 's![ "]*!!g'`| \
1196 1196 > grep "hg help -c config" > /dev/null
1197 1197 [1]
1198 1198
1199 1199 note to use help -c for general hg help config:
1200 1200
1201 1201 $ hg help config |grep "hg help -c config" > /dev/null
1202 1202
1203 1203 Test templating help
1204 1204
1205 1205 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1206 1206 desc String. The text of the changeset description.
1207 1207 diffstat String. Statistics of changes with the following format:
1208 1208 firstline Any text. Returns the first line of text.
1209 1209 nonempty Any text. Returns '(none)' if the string is empty.
1210 1210
1211 1211 Test deprecated items
1212 1212
1213 1213 $ hg help -v templating | grep currentbookmark
1214 1214 currentbookmark
1215 1215 $ hg help templating | (grep currentbookmark || true)
1216 1216
1217 1217 Test help hooks
1218 1218
1219 1219 $ cat > helphook1.py <<EOF
1220 1220 > from mercurial import help
1221 1221 >
1222 1222 > def rewrite(ui, topic, doc):
1223 1223 > return doc + '\nhelphook1\n'
1224 1224 >
1225 1225 > def extsetup(ui):
1226 1226 > help.addtopichook('revsets', rewrite)
1227 1227 > EOF
1228 1228 $ cat > helphook2.py <<EOF
1229 1229 > from mercurial import help
1230 1230 >
1231 1231 > def rewrite(ui, topic, doc):
1232 1232 > return doc + '\nhelphook2\n'
1233 1233 >
1234 1234 > def extsetup(ui):
1235 1235 > help.addtopichook('revsets', rewrite)
1236 1236 > EOF
1237 1237 $ echo '[extensions]' >> $HGRCPATH
1238 1238 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1239 1239 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1240 1240 $ hg help revsets | grep helphook
1241 1241 helphook1
1242 1242 helphook2
1243 1243
1244 1244 help -c should only show debug --debug
1245 1245
1246 1246 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1247 1247 [1]
1248 1248
1249 1249 help -c should only show deprecated for -v
1250 1250
1251 1251 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1252 1252 [1]
1253 1253
1254 1254 Test -e / -c / -k combinations
1255 1255
1256 1256 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1257 1257 Commands:
1258 1258 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1259 1259 Extensions:
1260 1260 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1261 1261 Topics:
1262 1262 Commands:
1263 1263 Extensions:
1264 1264 Extension Commands:
1265 1265 $ hg help -c schemes
1266 1266 abort: no such help topic: schemes
1267 1267 (try "hg help --keyword schemes")
1268 1268 [255]
1269 1269 $ hg help -e schemes |head -1
1270 1270 schemes extension - extend schemes with shortcuts to repository swarms
1271 1271 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1272 1272 Commands:
1273 1273 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1274 1274 Extensions:
1275 1275 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1276 1276 Extensions:
1277 1277 Commands:
1278 1278 $ hg help -c commit > /dev/null
1279 1279 $ hg help -e -c commit > /dev/null
1280 1280 $ hg help -e commit > /dev/null
1281 1281 abort: no such help topic: commit
1282 1282 (try "hg help --keyword commit")
1283 1283 [255]
1284 1284
1285 1285 Test keyword search help
1286 1286
1287 1287 $ cat > prefixedname.py <<EOF
1288 1288 > '''matched against word "clone"
1289 1289 > '''
1290 1290 > EOF
1291 1291 $ echo '[extensions]' >> $HGRCPATH
1292 1292 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1293 1293 $ hg help -k clone
1294 1294 Topics:
1295 1295
1296 1296 config Configuration Files
1297 1297 extensions Using Additional Features
1298 1298 glossary Glossary
1299 1299 phases Working with Phases
1300 1300 subrepos Subrepositories
1301 1301 urls URL Paths
1302 1302
1303 1303 Commands:
1304 1304
1305 1305 bookmarks create a new bookmark or list existing bookmarks
1306 1306 clone make a copy of an existing repository
1307 1307 paths show aliases for remote repositories
1308 1308 update update working directory (or switch revisions)
1309 1309
1310 1310 Extensions:
1311 1311
1312 1312 clonebundles advertise pre-generated bundles to seed clones (experimental)
1313 1313 prefixedname matched against word "clone"
1314 1314 relink recreates hardlinks between repository clones
1315 1315
1316 1316 Extension Commands:
1317 1317
1318 1318 qclone clone main and patch repository at same time
1319 1319
1320 1320 Test unfound topic
1321 1321
1322 1322 $ hg help nonexistingtopicthatwillneverexisteverever
1323 1323 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1324 1324 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1325 1325 [255]
1326 1326
1327 1327 Test unfound keyword
1328 1328
1329 1329 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1330 1330 abort: no matches
1331 1331 (try "hg help" for a list of topics)
1332 1332 [255]
1333 1333
1334 1334 Test omit indicating for help
1335 1335
1336 1336 $ cat > addverboseitems.py <<EOF
1337 1337 > '''extension to test omit indicating.
1338 1338 >
1339 1339 > This paragraph is never omitted (for extension)
1340 1340 >
1341 1341 > .. container:: verbose
1342 1342 >
1343 1343 > This paragraph is omitted,
1344 1344 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1345 1345 >
1346 1346 > This paragraph is never omitted, too (for extension)
1347 1347 > '''
1348 1348 >
1349 1349 > from mercurial import help, commands
1350 1350 > testtopic = """This paragraph is never omitted (for topic).
1351 1351 >
1352 1352 > .. container:: verbose
1353 1353 >
1354 1354 > This paragraph is omitted,
1355 1355 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1356 1356 >
1357 1357 > This paragraph is never omitted, too (for topic)
1358 1358 > """
1359 1359 > def extsetup(ui):
1360 1360 > help.helptable.append((["topic-containing-verbose"],
1361 1361 > "This is the topic to test omit indicating.",
1362 1362 > lambda ui: testtopic))
1363 1363 > EOF
1364 1364 $ echo '[extensions]' >> $HGRCPATH
1365 1365 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1366 1366 $ hg help addverboseitems
1367 1367 addverboseitems extension - extension to test omit indicating.
1368 1368
1369 1369 This paragraph is never omitted (for extension)
1370 1370
1371 1371 This paragraph is never omitted, too (for extension)
1372 1372
1373 1373 (some details hidden, use --verbose to show complete help)
1374 1374
1375 1375 no commands defined
1376 1376 $ hg help -v addverboseitems
1377 1377 addverboseitems extension - extension to test omit indicating.
1378 1378
1379 1379 This paragraph is never omitted (for extension)
1380 1380
1381 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1381 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1382 1382 extension)
1383 1383
1384 1384 This paragraph is never omitted, too (for extension)
1385 1385
1386 1386 no commands defined
1387 1387 $ hg help topic-containing-verbose
1388 1388 This is the topic to test omit indicating.
1389 1389 """"""""""""""""""""""""""""""""""""""""""
1390 1390
1391 1391 This paragraph is never omitted (for topic).
1392 1392
1393 1393 This paragraph is never omitted, too (for topic)
1394 1394
1395 1395 (some details hidden, use --verbose to show complete help)
1396 1396 $ hg help -v topic-containing-verbose
1397 1397 This is the topic to test omit indicating.
1398 1398 """"""""""""""""""""""""""""""""""""""""""
1399 1399
1400 1400 This paragraph is never omitted (for topic).
1401 1401
1402 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1402 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1403 1403 topic)
1404 1404
1405 1405 This paragraph is never omitted, too (for topic)
1406 1406
1407 1407 Test section lookup
1408 1408
1409 1409 $ hg help revset.merge
1410 1410 "merge()"
1411 1411 Changeset is a merge changeset.
1412 1412
1413 1413 $ hg help glossary.dag
1414 1414 DAG
1415 1415 The repository of changesets of a distributed version control system
1416 1416 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1417 1417 of nodes and edges, where nodes correspond to changesets and edges
1418 1418 imply a parent -> child relation. This graph can be visualized by
1419 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1419 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1420 1420 limited by the requirement for children to have at most two parents.
1421 1421
1422 1422
1423 1423 $ hg help hgrc.paths
1424 1424 "paths"
1425 1425 -------
1426 1426
1427 1427 Assigns symbolic names and behavior to repositories.
1428 1428
1429 1429 Options are symbolic names defining the URL or directory that is the
1430 1430 location of the repository. Example:
1431 1431
1432 1432 [paths]
1433 1433 my_server = https://example.com/my_repo
1434 1434 local_path = /home/me/repo
1435 1435
1436 1436 These symbolic names can be used from the command line. To pull from
1437 "my_server": "hg pull my_server". To push to "local_path": "hg push
1438 local_path".
1437 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1438 local_path'.
1439 1439
1440 1440 Options containing colons (":") denote sub-options that can influence
1441 1441 behavior for that specific path. Example:
1442 1442
1443 1443 [paths]
1444 1444 my_server = https://example.com/my_path
1445 1445 my_server:pushurl = ssh://example.com/my_path
1446 1446
1447 1447 The following sub-options can be defined:
1448 1448
1449 1449 "pushurl"
1450 1450 The URL to use for push operations. If not defined, the location
1451 1451 defined by the path's main entry is used.
1452 1452
1453 1453 The following special named paths exist:
1454 1454
1455 1455 "default"
1456 1456 The URL or directory to use when no source or remote is specified.
1457 1457
1458 "hg clone" will automatically define this path to the location the
1458 'hg clone' will automatically define this path to the location the
1459 1459 repository was cloned from.
1460 1460
1461 1461 "default-push"
1462 (deprecated) The URL or directory for the default "hg push" location.
1462 (deprecated) The URL or directory for the default 'hg push' location.
1463 1463 "default:pushurl" should be used instead.
1464 1464
1465 1465 $ hg help glossary.mcguffin
1466 1466 abort: help section not found
1467 1467 [255]
1468 1468
1469 1469 $ hg help glossary.mc.guffin
1470 1470 abort: help section not found
1471 1471 [255]
1472 1472
1473 1473 $ hg help template.files
1474 1474 files List of strings. All files modified, added, or removed by
1475 1475 this changeset.
1476 1476
1477 1477 Test dynamic list of merge tools only shows up once
1478 1478 $ hg help merge-tools
1479 1479 Merge Tools
1480 1480 """""""""""
1481 1481
1482 1482 To merge files Mercurial uses merge tools.
1483 1483
1484 1484 A merge tool combines two different versions of a file into a merged file.
1485 1485 Merge tools are given the two files and the greatest common ancestor of
1486 1486 the two file versions, so they can determine the changes made on both
1487 1487 branches.
1488 1488
1489 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1490 backout" and in several extensions.
1489 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1490 backout' and in several extensions.
1491 1491
1492 1492 Usually, the merge tool tries to automatically reconcile the files by
1493 1493 combining all non-overlapping changes that occurred separately in the two
1494 1494 different evolutions of the same initial base file. Furthermore, some
1495 1495 interactive merge programs make it easier to manually resolve conflicting
1496 1496 merges, either in a graphical way, or by inserting some conflict markers.
1497 1497 Mercurial does not include any interactive merge programs but relies on
1498 1498 external tools for that.
1499 1499
1500 1500 Available merge tools
1501 1501 =====================
1502 1502
1503 1503 External merge tools and their properties are configured in the merge-
1504 1504 tools configuration section - see hgrc(5) - but they can often just be
1505 1505 named by their executable.
1506 1506
1507 1507 A merge tool is generally usable if its executable can be found on the
1508 1508 system and if it can handle the merge. The executable is found if it is an
1509 1509 absolute or relative executable path or the name of an application in the
1510 1510 executable search path. The tool is assumed to be able to handle the merge
1511 1511 if it can handle symlinks if the file is a symlink, if it can handle
1512 1512 binary files if the file is binary, and if a GUI is available if the tool
1513 1513 requires a GUI.
1514 1514
1515 1515 There are some internal merge tools which can be used. The internal merge
1516 1516 tools are:
1517 1517
1518 1518 ":dump"
1519 1519 Creates three versions of the files to merge, containing the contents of
1520 1520 local, other and base. These files can then be used to perform a merge
1521 1521 manually. If the file to be merged is named "a.txt", these files will
1522 1522 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1523 1523 they will be placed in the same directory as "a.txt".
1524 1524
1525 1525 ":fail"
1526 1526 Rather than attempting to merge files that were modified on both
1527 1527 branches, it marks them as unresolved. The resolve command must be used
1528 1528 to resolve these conflicts.
1529 1529
1530 1530 ":local"
1531 1531 Uses the local version of files as the merged version.
1532 1532
1533 1533 ":merge"
1534 1534 Uses the internal non-interactive simple merge algorithm for merging
1535 1535 files. It will fail if there are any conflicts and leave markers in the
1536 1536 partially merged file. Markers will have two sections, one for each side
1537 1537 of merge.
1538 1538
1539 1539 ":merge-local"
1540 1540 Like :merge, but resolve all conflicts non-interactively in favor of the
1541 1541 local changes.
1542 1542
1543 1543 ":merge-other"
1544 1544 Like :merge, but resolve all conflicts non-interactively in favor of the
1545 1545 other changes.
1546 1546
1547 1547 ":merge3"
1548 1548 Uses the internal non-interactive simple merge algorithm for merging
1549 1549 files. It will fail if there are any conflicts and leave markers in the
1550 1550 partially merged file. Marker will have three sections, one from each
1551 1551 side of the merge and one for the base content.
1552 1552
1553 1553 ":other"
1554 1554 Uses the other version of files as the merged version.
1555 1555
1556 1556 ":prompt"
1557 1557 Asks the user which of the local or the other version to keep as the
1558 1558 merged version.
1559 1559
1560 1560 ":tagmerge"
1561 1561 Uses the internal tag merge algorithm (experimental).
1562 1562
1563 1563 ":union"
1564 1564 Uses the internal non-interactive simple merge algorithm for merging
1565 1565 files. It will use both left and right sides for conflict regions. No
1566 1566 markers are inserted.
1567 1567
1568 1568 Internal tools are always available and do not require a GUI but will by
1569 1569 default not handle symlinks or binary files.
1570 1570
1571 1571 Choosing a merge tool
1572 1572 =====================
1573 1573
1574 1574 Mercurial uses these rules when deciding which merge tool to use:
1575 1575
1576 1576 1. If a tool has been specified with the --tool option to merge or
1577 1577 resolve, it is used. If it is the name of a tool in the merge-tools
1578 1578 configuration, its configuration is used. Otherwise the specified tool
1579 1579 must be executable by the shell.
1580 1580 2. If the "HGMERGE" environment variable is present, its value is used and
1581 1581 must be executable by the shell.
1582 1582 3. If the filename of the file to be merged matches any of the patterns in
1583 1583 the merge-patterns configuration section, the first usable merge tool
1584 1584 corresponding to a matching pattern is used. Here, binary capabilities
1585 1585 of the merge tool are not considered.
1586 1586 4. If ui.merge is set it will be considered next. If the value is not the
1587 1587 name of a configured tool, the specified value is used and must be
1588 1588 executable by the shell. Otherwise the named tool is used if it is
1589 1589 usable.
1590 1590 5. If any usable merge tools are present in the merge-tools configuration
1591 1591 section, the one with the highest priority is used.
1592 1592 6. If a program named "hgmerge" can be found on the system, it is used -
1593 1593 but it will by default not be used for symlinks and binary files.
1594 1594 7. If the file to be merged is not binary and is not a symlink, then
1595 1595 internal ":merge" is used.
1596 1596 8. The merge of the file fails and must be resolved before commit.
1597 1597
1598 1598 Note:
1599 1599 After selecting a merge program, Mercurial will by default attempt to
1600 1600 merge the files using a simple merge algorithm first. Only if it
1601 1601 doesn't succeed because of conflicting changes Mercurial will actually
1602 1602 execute the merge program. Whether to use the simple merge algorithm
1603 1603 first can be controlled by the premerge setting of the merge tool.
1604 1604 Premerge is enabled by default unless the file is binary or a symlink.
1605 1605
1606 1606 See the merge-tools and ui sections of hgrc(5) for details on the
1607 1607 configuration of merge tools.
1608 1608
1609 1609 Test usage of section marks in help documents
1610 1610
1611 1611 $ cd "$TESTDIR"/../doc
1612 1612 $ python check-seclevel.py
1613 1613 $ cd $TESTTMP
1614 1614
1615 1615 #if serve
1616 1616
1617 1617 Test the help pages in hgweb.
1618 1618
1619 1619 Dish up an empty repo; serve it cold.
1620 1620
1621 1621 $ hg init "$TESTTMP/test"
1622 1622 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1623 1623 $ cat hg.pid >> $DAEMON_PIDS
1624 1624
1625 1625 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1626 1626 200 Script output follows
1627 1627
1628 1628 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1629 1629 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1630 1630 <head>
1631 1631 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1632 1632 <meta name="robots" content="index, nofollow" />
1633 1633 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1634 1634 <script type="text/javascript" src="/static/mercurial.js"></script>
1635 1635
1636 1636 <title>Help: Index</title>
1637 1637 </head>
1638 1638 <body>
1639 1639
1640 1640 <div class="container">
1641 1641 <div class="menu">
1642 1642 <div class="logo">
1643 1643 <a href="https://mercurial-scm.org/">
1644 1644 <img src="/static/hglogo.png" alt="mercurial" /></a>
1645 1645 </div>
1646 1646 <ul>
1647 1647 <li><a href="/shortlog">log</a></li>
1648 1648 <li><a href="/graph">graph</a></li>
1649 1649 <li><a href="/tags">tags</a></li>
1650 1650 <li><a href="/bookmarks">bookmarks</a></li>
1651 1651 <li><a href="/branches">branches</a></li>
1652 1652 </ul>
1653 1653 <ul>
1654 1654 <li class="active">help</li>
1655 1655 </ul>
1656 1656 </div>
1657 1657
1658 1658 <div class="main">
1659 1659 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1660 1660 <form class="search" action="/log">
1661 1661
1662 1662 <p><input name="rev" id="search1" type="text" size="30" /></p>
1663 1663 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1664 1664 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1665 1665 </form>
1666 1666 <table class="bigtable">
1667 1667 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1668 1668
1669 1669 <tr><td>
1670 1670 <a href="/help/config">
1671 1671 config
1672 1672 </a>
1673 1673 </td><td>
1674 1674 Configuration Files
1675 1675 </td></tr>
1676 1676 <tr><td>
1677 1677 <a href="/help/dates">
1678 1678 dates
1679 1679 </a>
1680 1680 </td><td>
1681 1681 Date Formats
1682 1682 </td></tr>
1683 1683 <tr><td>
1684 1684 <a href="/help/diffs">
1685 1685 diffs
1686 1686 </a>
1687 1687 </td><td>
1688 1688 Diff Formats
1689 1689 </td></tr>
1690 1690 <tr><td>
1691 1691 <a href="/help/environment">
1692 1692 environment
1693 1693 </a>
1694 1694 </td><td>
1695 1695 Environment Variables
1696 1696 </td></tr>
1697 1697 <tr><td>
1698 1698 <a href="/help/extensions">
1699 1699 extensions
1700 1700 </a>
1701 1701 </td><td>
1702 1702 Using Additional Features
1703 1703 </td></tr>
1704 1704 <tr><td>
1705 1705 <a href="/help/filesets">
1706 1706 filesets
1707 1707 </a>
1708 1708 </td><td>
1709 1709 Specifying File Sets
1710 1710 </td></tr>
1711 1711 <tr><td>
1712 1712 <a href="/help/glossary">
1713 1713 glossary
1714 1714 </a>
1715 1715 </td><td>
1716 1716 Glossary
1717 1717 </td></tr>
1718 1718 <tr><td>
1719 1719 <a href="/help/hgignore">
1720 1720 hgignore
1721 1721 </a>
1722 1722 </td><td>
1723 1723 Syntax for Mercurial Ignore Files
1724 1724 </td></tr>
1725 1725 <tr><td>
1726 1726 <a href="/help/hgweb">
1727 1727 hgweb
1728 1728 </a>
1729 1729 </td><td>
1730 1730 Configuring hgweb
1731 1731 </td></tr>
1732 1732 <tr><td>
1733 1733 <a href="/help/internals">
1734 1734 internals
1735 1735 </a>
1736 1736 </td><td>
1737 1737 Technical implementation topics
1738 1738 </td></tr>
1739 1739 <tr><td>
1740 1740 <a href="/help/merge-tools">
1741 1741 merge-tools
1742 1742 </a>
1743 1743 </td><td>
1744 1744 Merge Tools
1745 1745 </td></tr>
1746 1746 <tr><td>
1747 1747 <a href="/help/multirevs">
1748 1748 multirevs
1749 1749 </a>
1750 1750 </td><td>
1751 1751 Specifying Multiple Revisions
1752 1752 </td></tr>
1753 1753 <tr><td>
1754 1754 <a href="/help/patterns">
1755 1755 patterns
1756 1756 </a>
1757 1757 </td><td>
1758 1758 File Name Patterns
1759 1759 </td></tr>
1760 1760 <tr><td>
1761 1761 <a href="/help/phases">
1762 1762 phases
1763 1763 </a>
1764 1764 </td><td>
1765 1765 Working with Phases
1766 1766 </td></tr>
1767 1767 <tr><td>
1768 1768 <a href="/help/revisions">
1769 1769 revisions
1770 1770 </a>
1771 1771 </td><td>
1772 1772 Specifying Single Revisions
1773 1773 </td></tr>
1774 1774 <tr><td>
1775 1775 <a href="/help/revsets">
1776 1776 revsets
1777 1777 </a>
1778 1778 </td><td>
1779 1779 Specifying Revision Sets
1780 1780 </td></tr>
1781 1781 <tr><td>
1782 1782 <a href="/help/scripting">
1783 1783 scripting
1784 1784 </a>
1785 1785 </td><td>
1786 1786 Using Mercurial from scripts and automation
1787 1787 </td></tr>
1788 1788 <tr><td>
1789 1789 <a href="/help/subrepos">
1790 1790 subrepos
1791 1791 </a>
1792 1792 </td><td>
1793 1793 Subrepositories
1794 1794 </td></tr>
1795 1795 <tr><td>
1796 1796 <a href="/help/templating">
1797 1797 templating
1798 1798 </a>
1799 1799 </td><td>
1800 1800 Template Usage
1801 1801 </td></tr>
1802 1802 <tr><td>
1803 1803 <a href="/help/urls">
1804 1804 urls
1805 1805 </a>
1806 1806 </td><td>
1807 1807 URL Paths
1808 1808 </td></tr>
1809 1809 <tr><td>
1810 1810 <a href="/help/topic-containing-verbose">
1811 1811 topic-containing-verbose
1812 1812 </a>
1813 1813 </td><td>
1814 1814 This is the topic to test omit indicating.
1815 1815 </td></tr>
1816 1816
1817 1817
1818 1818 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1819 1819
1820 1820 <tr><td>
1821 1821 <a href="/help/add">
1822 1822 add
1823 1823 </a>
1824 1824 </td><td>
1825 1825 add the specified files on the next commit
1826 1826 </td></tr>
1827 1827 <tr><td>
1828 1828 <a href="/help/annotate">
1829 1829 annotate
1830 1830 </a>
1831 1831 </td><td>
1832 1832 show changeset information by line for each file
1833 1833 </td></tr>
1834 1834 <tr><td>
1835 1835 <a href="/help/clone">
1836 1836 clone
1837 1837 </a>
1838 1838 </td><td>
1839 1839 make a copy of an existing repository
1840 1840 </td></tr>
1841 1841 <tr><td>
1842 1842 <a href="/help/commit">
1843 1843 commit
1844 1844 </a>
1845 1845 </td><td>
1846 1846 commit the specified files or all outstanding changes
1847 1847 </td></tr>
1848 1848 <tr><td>
1849 1849 <a href="/help/diff">
1850 1850 diff
1851 1851 </a>
1852 1852 </td><td>
1853 1853 diff repository (or selected files)
1854 1854 </td></tr>
1855 1855 <tr><td>
1856 1856 <a href="/help/export">
1857 1857 export
1858 1858 </a>
1859 1859 </td><td>
1860 1860 dump the header and diffs for one or more changesets
1861 1861 </td></tr>
1862 1862 <tr><td>
1863 1863 <a href="/help/forget">
1864 1864 forget
1865 1865 </a>
1866 1866 </td><td>
1867 1867 forget the specified files on the next commit
1868 1868 </td></tr>
1869 1869 <tr><td>
1870 1870 <a href="/help/init">
1871 1871 init
1872 1872 </a>
1873 1873 </td><td>
1874 1874 create a new repository in the given directory
1875 1875 </td></tr>
1876 1876 <tr><td>
1877 1877 <a href="/help/log">
1878 1878 log
1879 1879 </a>
1880 1880 </td><td>
1881 1881 show revision history of entire repository or files
1882 1882 </td></tr>
1883 1883 <tr><td>
1884 1884 <a href="/help/merge">
1885 1885 merge
1886 1886 </a>
1887 1887 </td><td>
1888 1888 merge another revision into working directory
1889 1889 </td></tr>
1890 1890 <tr><td>
1891 1891 <a href="/help/pull">
1892 1892 pull
1893 1893 </a>
1894 1894 </td><td>
1895 1895 pull changes from the specified source
1896 1896 </td></tr>
1897 1897 <tr><td>
1898 1898 <a href="/help/push">
1899 1899 push
1900 1900 </a>
1901 1901 </td><td>
1902 1902 push changes to the specified destination
1903 1903 </td></tr>
1904 1904 <tr><td>
1905 1905 <a href="/help/remove">
1906 1906 remove
1907 1907 </a>
1908 1908 </td><td>
1909 1909 remove the specified files on the next commit
1910 1910 </td></tr>
1911 1911 <tr><td>
1912 1912 <a href="/help/serve">
1913 1913 serve
1914 1914 </a>
1915 1915 </td><td>
1916 1916 start stand-alone webserver
1917 1917 </td></tr>
1918 1918 <tr><td>
1919 1919 <a href="/help/status">
1920 1920 status
1921 1921 </a>
1922 1922 </td><td>
1923 1923 show changed files in the working directory
1924 1924 </td></tr>
1925 1925 <tr><td>
1926 1926 <a href="/help/summary">
1927 1927 summary
1928 1928 </a>
1929 1929 </td><td>
1930 1930 summarize working directory state
1931 1931 </td></tr>
1932 1932 <tr><td>
1933 1933 <a href="/help/update">
1934 1934 update
1935 1935 </a>
1936 1936 </td><td>
1937 1937 update working directory (or switch revisions)
1938 1938 </td></tr>
1939 1939
1940 1940
1941 1941
1942 1942 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1943 1943
1944 1944 <tr><td>
1945 1945 <a href="/help/addremove">
1946 1946 addremove
1947 1947 </a>
1948 1948 </td><td>
1949 1949 add all new files, delete all missing files
1950 1950 </td></tr>
1951 1951 <tr><td>
1952 1952 <a href="/help/archive">
1953 1953 archive
1954 1954 </a>
1955 1955 </td><td>
1956 1956 create an unversioned archive of a repository revision
1957 1957 </td></tr>
1958 1958 <tr><td>
1959 1959 <a href="/help/backout">
1960 1960 backout
1961 1961 </a>
1962 1962 </td><td>
1963 1963 reverse effect of earlier changeset
1964 1964 </td></tr>
1965 1965 <tr><td>
1966 1966 <a href="/help/bisect">
1967 1967 bisect
1968 1968 </a>
1969 1969 </td><td>
1970 1970 subdivision search of changesets
1971 1971 </td></tr>
1972 1972 <tr><td>
1973 1973 <a href="/help/bookmarks">
1974 1974 bookmarks
1975 1975 </a>
1976 1976 </td><td>
1977 1977 create a new bookmark or list existing bookmarks
1978 1978 </td></tr>
1979 1979 <tr><td>
1980 1980 <a href="/help/branch">
1981 1981 branch
1982 1982 </a>
1983 1983 </td><td>
1984 1984 set or show the current branch name
1985 1985 </td></tr>
1986 1986 <tr><td>
1987 1987 <a href="/help/branches">
1988 1988 branches
1989 1989 </a>
1990 1990 </td><td>
1991 1991 list repository named branches
1992 1992 </td></tr>
1993 1993 <tr><td>
1994 1994 <a href="/help/bundle">
1995 1995 bundle
1996 1996 </a>
1997 1997 </td><td>
1998 1998 create a changegroup file
1999 1999 </td></tr>
2000 2000 <tr><td>
2001 2001 <a href="/help/cat">
2002 2002 cat
2003 2003 </a>
2004 2004 </td><td>
2005 2005 output the current or given revision of files
2006 2006 </td></tr>
2007 2007 <tr><td>
2008 2008 <a href="/help/config">
2009 2009 config
2010 2010 </a>
2011 2011 </td><td>
2012 2012 show combined config settings from all hgrc files
2013 2013 </td></tr>
2014 2014 <tr><td>
2015 2015 <a href="/help/copy">
2016 2016 copy
2017 2017 </a>
2018 2018 </td><td>
2019 2019 mark files as copied for the next commit
2020 2020 </td></tr>
2021 2021 <tr><td>
2022 2022 <a href="/help/files">
2023 2023 files
2024 2024 </a>
2025 2025 </td><td>
2026 2026 list tracked files
2027 2027 </td></tr>
2028 2028 <tr><td>
2029 2029 <a href="/help/graft">
2030 2030 graft
2031 2031 </a>
2032 2032 </td><td>
2033 2033 copy changes from other branches onto the current branch
2034 2034 </td></tr>
2035 2035 <tr><td>
2036 2036 <a href="/help/grep">
2037 2037 grep
2038 2038 </a>
2039 2039 </td><td>
2040 2040 search for a pattern in specified files and revisions
2041 2041 </td></tr>
2042 2042 <tr><td>
2043 2043 <a href="/help/heads">
2044 2044 heads
2045 2045 </a>
2046 2046 </td><td>
2047 2047 show branch heads
2048 2048 </td></tr>
2049 2049 <tr><td>
2050 2050 <a href="/help/help">
2051 2051 help
2052 2052 </a>
2053 2053 </td><td>
2054 2054 show help for a given topic or a help overview
2055 2055 </td></tr>
2056 2056 <tr><td>
2057 2057 <a href="/help/identify">
2058 2058 identify
2059 2059 </a>
2060 2060 </td><td>
2061 2061 identify the working directory or specified revision
2062 2062 </td></tr>
2063 2063 <tr><td>
2064 2064 <a href="/help/import">
2065 2065 import
2066 2066 </a>
2067 2067 </td><td>
2068 2068 import an ordered set of patches
2069 2069 </td></tr>
2070 2070 <tr><td>
2071 2071 <a href="/help/incoming">
2072 2072 incoming
2073 2073 </a>
2074 2074 </td><td>
2075 2075 show new changesets found in source
2076 2076 </td></tr>
2077 2077 <tr><td>
2078 2078 <a href="/help/manifest">
2079 2079 manifest
2080 2080 </a>
2081 2081 </td><td>
2082 2082 output the current or given revision of the project manifest
2083 2083 </td></tr>
2084 2084 <tr><td>
2085 2085 <a href="/help/nohelp">
2086 2086 nohelp
2087 2087 </a>
2088 2088 </td><td>
2089 2089 (no help text available)
2090 2090 </td></tr>
2091 2091 <tr><td>
2092 2092 <a href="/help/outgoing">
2093 2093 outgoing
2094 2094 </a>
2095 2095 </td><td>
2096 2096 show changesets not found in the destination
2097 2097 </td></tr>
2098 2098 <tr><td>
2099 2099 <a href="/help/paths">
2100 2100 paths
2101 2101 </a>
2102 2102 </td><td>
2103 2103 show aliases for remote repositories
2104 2104 </td></tr>
2105 2105 <tr><td>
2106 2106 <a href="/help/phase">
2107 2107 phase
2108 2108 </a>
2109 2109 </td><td>
2110 2110 set or show the current phase name
2111 2111 </td></tr>
2112 2112 <tr><td>
2113 2113 <a href="/help/recover">
2114 2114 recover
2115 2115 </a>
2116 2116 </td><td>
2117 2117 roll back an interrupted transaction
2118 2118 </td></tr>
2119 2119 <tr><td>
2120 2120 <a href="/help/rename">
2121 2121 rename
2122 2122 </a>
2123 2123 </td><td>
2124 2124 rename files; equivalent of copy + remove
2125 2125 </td></tr>
2126 2126 <tr><td>
2127 2127 <a href="/help/resolve">
2128 2128 resolve
2129 2129 </a>
2130 2130 </td><td>
2131 2131 redo merges or set/view the merge status of files
2132 2132 </td></tr>
2133 2133 <tr><td>
2134 2134 <a href="/help/revert">
2135 2135 revert
2136 2136 </a>
2137 2137 </td><td>
2138 2138 restore files to their checkout state
2139 2139 </td></tr>
2140 2140 <tr><td>
2141 2141 <a href="/help/root">
2142 2142 root
2143 2143 </a>
2144 2144 </td><td>
2145 2145 print the root (top) of the current working directory
2146 2146 </td></tr>
2147 2147 <tr><td>
2148 2148 <a href="/help/tag">
2149 2149 tag
2150 2150 </a>
2151 2151 </td><td>
2152 2152 add one or more tags for the current or given revision
2153 2153 </td></tr>
2154 2154 <tr><td>
2155 2155 <a href="/help/tags">
2156 2156 tags
2157 2157 </a>
2158 2158 </td><td>
2159 2159 list repository tags
2160 2160 </td></tr>
2161 2161 <tr><td>
2162 2162 <a href="/help/unbundle">
2163 2163 unbundle
2164 2164 </a>
2165 2165 </td><td>
2166 2166 apply one or more changegroup files
2167 2167 </td></tr>
2168 2168 <tr><td>
2169 2169 <a href="/help/verify">
2170 2170 verify
2171 2171 </a>
2172 2172 </td><td>
2173 2173 verify the integrity of the repository
2174 2174 </td></tr>
2175 2175 <tr><td>
2176 2176 <a href="/help/version">
2177 2177 version
2178 2178 </a>
2179 2179 </td><td>
2180 2180 output version and copyright information
2181 2181 </td></tr>
2182 2182
2183 2183
2184 2184 </table>
2185 2185 </div>
2186 2186 </div>
2187 2187
2188 2188 <script type="text/javascript">process_dates()</script>
2189 2189
2190 2190
2191 2191 </body>
2192 2192 </html>
2193 2193
2194 2194
2195 2195 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2196 2196 200 Script output follows
2197 2197
2198 2198 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2199 2199 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2200 2200 <head>
2201 2201 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2202 2202 <meta name="robots" content="index, nofollow" />
2203 2203 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2204 2204 <script type="text/javascript" src="/static/mercurial.js"></script>
2205 2205
2206 2206 <title>Help: add</title>
2207 2207 </head>
2208 2208 <body>
2209 2209
2210 2210 <div class="container">
2211 2211 <div class="menu">
2212 2212 <div class="logo">
2213 2213 <a href="https://mercurial-scm.org/">
2214 2214 <img src="/static/hglogo.png" alt="mercurial" /></a>
2215 2215 </div>
2216 2216 <ul>
2217 2217 <li><a href="/shortlog">log</a></li>
2218 2218 <li><a href="/graph">graph</a></li>
2219 2219 <li><a href="/tags">tags</a></li>
2220 2220 <li><a href="/bookmarks">bookmarks</a></li>
2221 2221 <li><a href="/branches">branches</a></li>
2222 2222 </ul>
2223 2223 <ul>
2224 2224 <li class="active"><a href="/help">help</a></li>
2225 2225 </ul>
2226 2226 </div>
2227 2227
2228 2228 <div class="main">
2229 2229 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2230 2230 <h3>Help: add</h3>
2231 2231
2232 2232 <form class="search" action="/log">
2233 2233
2234 2234 <p><input name="rev" id="search1" type="text" size="30" /></p>
2235 2235 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2236 2236 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2237 2237 </form>
2238 2238 <div id="doc">
2239 2239 <p>
2240 2240 hg add [OPTION]... [FILE]...
2241 2241 </p>
2242 2242 <p>
2243 2243 add the specified files on the next commit
2244 2244 </p>
2245 2245 <p>
2246 2246 Schedule files to be version controlled and added to the
2247 2247 repository.
2248 2248 </p>
2249 2249 <p>
2250 2250 The files will be added to the repository at the next commit. To
2251 undo an add before that, see &quot;hg forget&quot;.
2251 undo an add before that, see 'hg forget'.
2252 2252 </p>
2253 2253 <p>
2254 2254 If no names are given, add all files to the repository (except
2255 2255 files matching &quot;.hgignore&quot;).
2256 2256 </p>
2257 2257 <p>
2258 2258 Examples:
2259 2259 </p>
2260 2260 <ul>
2261 <li> New (unknown) files are added automatically by &quot;hg add&quot;:
2261 <li> New (unknown) files are added automatically by 'hg add':
2262 2262 <pre>
2263 2263 \$ ls (re)
2264 2264 foo.c
2265 2265 \$ hg status (re)
2266 2266 ? foo.c
2267 2267 \$ hg add (re)
2268 2268 adding foo.c
2269 2269 \$ hg status (re)
2270 2270 A foo.c
2271 2271 </pre>
2272 2272 <li> Specific files to be added can be specified:
2273 2273 <pre>
2274 2274 \$ ls (re)
2275 2275 bar.c foo.c
2276 2276 \$ hg status (re)
2277 2277 ? bar.c
2278 2278 ? foo.c
2279 2279 \$ hg add bar.c (re)
2280 2280 \$ hg status (re)
2281 2281 A bar.c
2282 2282 ? foo.c
2283 2283 </pre>
2284 2284 </ul>
2285 2285 <p>
2286 2286 Returns 0 if all files are successfully added.
2287 2287 </p>
2288 2288 <p>
2289 2289 options ([+] can be repeated):
2290 2290 </p>
2291 2291 <table>
2292 2292 <tr><td>-I</td>
2293 2293 <td>--include PATTERN [+]</td>
2294 2294 <td>include names matching the given patterns</td></tr>
2295 2295 <tr><td>-X</td>
2296 2296 <td>--exclude PATTERN [+]</td>
2297 2297 <td>exclude names matching the given patterns</td></tr>
2298 2298 <tr><td>-S</td>
2299 2299 <td>--subrepos</td>
2300 2300 <td>recurse into subrepositories</td></tr>
2301 2301 <tr><td>-n</td>
2302 2302 <td>--dry-run</td>
2303 2303 <td>do not perform actions, just print output</td></tr>
2304 2304 </table>
2305 2305 <p>
2306 2306 global options ([+] can be repeated):
2307 2307 </p>
2308 2308 <table>
2309 2309 <tr><td>-R</td>
2310 2310 <td>--repository REPO</td>
2311 2311 <td>repository root directory or name of overlay bundle file</td></tr>
2312 2312 <tr><td></td>
2313 2313 <td>--cwd DIR</td>
2314 2314 <td>change working directory</td></tr>
2315 2315 <tr><td>-y</td>
2316 2316 <td>--noninteractive</td>
2317 2317 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2318 2318 <tr><td>-q</td>
2319 2319 <td>--quiet</td>
2320 2320 <td>suppress output</td></tr>
2321 2321 <tr><td>-v</td>
2322 2322 <td>--verbose</td>
2323 2323 <td>enable additional output</td></tr>
2324 2324 <tr><td></td>
2325 2325 <td>--config CONFIG [+]</td>
2326 2326 <td>set/override config option (use 'section.name=value')</td></tr>
2327 2327 <tr><td></td>
2328 2328 <td>--debug</td>
2329 2329 <td>enable debugging output</td></tr>
2330 2330 <tr><td></td>
2331 2331 <td>--debugger</td>
2332 2332 <td>start debugger</td></tr>
2333 2333 <tr><td></td>
2334 2334 <td>--encoding ENCODE</td>
2335 2335 <td>set the charset encoding (default: ascii)</td></tr>
2336 2336 <tr><td></td>
2337 2337 <td>--encodingmode MODE</td>
2338 2338 <td>set the charset encoding mode (default: strict)</td></tr>
2339 2339 <tr><td></td>
2340 2340 <td>--traceback</td>
2341 2341 <td>always print a traceback on exception</td></tr>
2342 2342 <tr><td></td>
2343 2343 <td>--time</td>
2344 2344 <td>time how long the command takes</td></tr>
2345 2345 <tr><td></td>
2346 2346 <td>--profile</td>
2347 2347 <td>print command execution profile</td></tr>
2348 2348 <tr><td></td>
2349 2349 <td>--version</td>
2350 2350 <td>output version information and exit</td></tr>
2351 2351 <tr><td>-h</td>
2352 2352 <td>--help</td>
2353 2353 <td>display help and exit</td></tr>
2354 2354 <tr><td></td>
2355 2355 <td>--hidden</td>
2356 2356 <td>consider hidden changesets</td></tr>
2357 2357 </table>
2358 2358
2359 2359 </div>
2360 2360 </div>
2361 2361 </div>
2362 2362
2363 2363 <script type="text/javascript">process_dates()</script>
2364 2364
2365 2365
2366 2366 </body>
2367 2367 </html>
2368 2368
2369 2369
2370 2370 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2371 2371 200 Script output follows
2372 2372
2373 2373 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2374 2374 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2375 2375 <head>
2376 2376 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2377 2377 <meta name="robots" content="index, nofollow" />
2378 2378 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2379 2379 <script type="text/javascript" src="/static/mercurial.js"></script>
2380 2380
2381 2381 <title>Help: remove</title>
2382 2382 </head>
2383 2383 <body>
2384 2384
2385 2385 <div class="container">
2386 2386 <div class="menu">
2387 2387 <div class="logo">
2388 2388 <a href="https://mercurial-scm.org/">
2389 2389 <img src="/static/hglogo.png" alt="mercurial" /></a>
2390 2390 </div>
2391 2391 <ul>
2392 2392 <li><a href="/shortlog">log</a></li>
2393 2393 <li><a href="/graph">graph</a></li>
2394 2394 <li><a href="/tags">tags</a></li>
2395 2395 <li><a href="/bookmarks">bookmarks</a></li>
2396 2396 <li><a href="/branches">branches</a></li>
2397 2397 </ul>
2398 2398 <ul>
2399 2399 <li class="active"><a href="/help">help</a></li>
2400 2400 </ul>
2401 2401 </div>
2402 2402
2403 2403 <div class="main">
2404 2404 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2405 2405 <h3>Help: remove</h3>
2406 2406
2407 2407 <form class="search" action="/log">
2408 2408
2409 2409 <p><input name="rev" id="search1" type="text" size="30" /></p>
2410 2410 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2411 2411 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2412 2412 </form>
2413 2413 <div id="doc">
2414 2414 <p>
2415 2415 hg remove [OPTION]... FILE...
2416 2416 </p>
2417 2417 <p>
2418 2418 aliases: rm
2419 2419 </p>
2420 2420 <p>
2421 2421 remove the specified files on the next commit
2422 2422 </p>
2423 2423 <p>
2424 2424 Schedule the indicated files for removal from the current branch.
2425 2425 </p>
2426 2426 <p>
2427 2427 This command schedules the files to be removed at the next commit.
2428 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2429 files, see &quot;hg forget&quot;.
2428 To undo a remove before that, see 'hg revert'. To undo added
2429 files, see 'hg forget'.
2430 2430 </p>
2431 2431 <p>
2432 2432 -A/--after can be used to remove only files that have already
2433 2433 been deleted, -f/--force can be used to force deletion, and -Af
2434 2434 can be used to remove files from the next revision without
2435 2435 deleting them from the working directory.
2436 2436 </p>
2437 2437 <p>
2438 2438 The following table details the behavior of remove for different
2439 2439 file states (columns) and option combinations (rows). The file
2440 2440 states are Added [A], Clean [C], Modified [M] and Missing [!]
2441 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2441 (as reported by 'hg status'). The actions are Warn, Remove
2442 2442 (from branch) and Delete (from disk):
2443 2443 </p>
2444 2444 <table>
2445 2445 <tr><td>opt/state</td>
2446 2446 <td>A</td>
2447 2447 <td>C</td>
2448 2448 <td>M</td>
2449 2449 <td>!</td></tr>
2450 2450 <tr><td>none</td>
2451 2451 <td>W</td>
2452 2452 <td>RD</td>
2453 2453 <td>W</td>
2454 2454 <td>R</td></tr>
2455 2455 <tr><td>-f</td>
2456 2456 <td>R</td>
2457 2457 <td>RD</td>
2458 2458 <td>RD</td>
2459 2459 <td>R</td></tr>
2460 2460 <tr><td>-A</td>
2461 2461 <td>W</td>
2462 2462 <td>W</td>
2463 2463 <td>W</td>
2464 2464 <td>R</td></tr>
2465 2465 <tr><td>-Af</td>
2466 2466 <td>R</td>
2467 2467 <td>R</td>
2468 2468 <td>R</td>
2469 2469 <td>R</td></tr>
2470 2470 </table>
2471 2471 <p>
2472 2472 <b>Note:</b>
2473 2473 </p>
2474 2474 <p>
2475 &quot;hg remove&quot; never deletes files in Added [A] state from the
2475 'hg remove' never deletes files in Added [A] state from the
2476 2476 working directory, not even if &quot;--force&quot; is specified.
2477 2477 </p>
2478 2478 <p>
2479 2479 Returns 0 on success, 1 if any warnings encountered.
2480 2480 </p>
2481 2481 <p>
2482 2482 options ([+] can be repeated):
2483 2483 </p>
2484 2484 <table>
2485 2485 <tr><td>-A</td>
2486 2486 <td>--after</td>
2487 2487 <td>record delete for missing files</td></tr>
2488 2488 <tr><td>-f</td>
2489 2489 <td>--force</td>
2490 2490 <td>remove (and delete) file even if added or modified</td></tr>
2491 2491 <tr><td>-S</td>
2492 2492 <td>--subrepos</td>
2493 2493 <td>recurse into subrepositories</td></tr>
2494 2494 <tr><td>-I</td>
2495 2495 <td>--include PATTERN [+]</td>
2496 2496 <td>include names matching the given patterns</td></tr>
2497 2497 <tr><td>-X</td>
2498 2498 <td>--exclude PATTERN [+]</td>
2499 2499 <td>exclude names matching the given patterns</td></tr>
2500 2500 </table>
2501 2501 <p>
2502 2502 global options ([+] can be repeated):
2503 2503 </p>
2504 2504 <table>
2505 2505 <tr><td>-R</td>
2506 2506 <td>--repository REPO</td>
2507 2507 <td>repository root directory or name of overlay bundle file</td></tr>
2508 2508 <tr><td></td>
2509 2509 <td>--cwd DIR</td>
2510 2510 <td>change working directory</td></tr>
2511 2511 <tr><td>-y</td>
2512 2512 <td>--noninteractive</td>
2513 2513 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2514 2514 <tr><td>-q</td>
2515 2515 <td>--quiet</td>
2516 2516 <td>suppress output</td></tr>
2517 2517 <tr><td>-v</td>
2518 2518 <td>--verbose</td>
2519 2519 <td>enable additional output</td></tr>
2520 2520 <tr><td></td>
2521 2521 <td>--config CONFIG [+]</td>
2522 2522 <td>set/override config option (use 'section.name=value')</td></tr>
2523 2523 <tr><td></td>
2524 2524 <td>--debug</td>
2525 2525 <td>enable debugging output</td></tr>
2526 2526 <tr><td></td>
2527 2527 <td>--debugger</td>
2528 2528 <td>start debugger</td></tr>
2529 2529 <tr><td></td>
2530 2530 <td>--encoding ENCODE</td>
2531 2531 <td>set the charset encoding (default: ascii)</td></tr>
2532 2532 <tr><td></td>
2533 2533 <td>--encodingmode MODE</td>
2534 2534 <td>set the charset encoding mode (default: strict)</td></tr>
2535 2535 <tr><td></td>
2536 2536 <td>--traceback</td>
2537 2537 <td>always print a traceback on exception</td></tr>
2538 2538 <tr><td></td>
2539 2539 <td>--time</td>
2540 2540 <td>time how long the command takes</td></tr>
2541 2541 <tr><td></td>
2542 2542 <td>--profile</td>
2543 2543 <td>print command execution profile</td></tr>
2544 2544 <tr><td></td>
2545 2545 <td>--version</td>
2546 2546 <td>output version information and exit</td></tr>
2547 2547 <tr><td>-h</td>
2548 2548 <td>--help</td>
2549 2549 <td>display help and exit</td></tr>
2550 2550 <tr><td></td>
2551 2551 <td>--hidden</td>
2552 2552 <td>consider hidden changesets</td></tr>
2553 2553 </table>
2554 2554
2555 2555 </div>
2556 2556 </div>
2557 2557 </div>
2558 2558
2559 2559 <script type="text/javascript">process_dates()</script>
2560 2560
2561 2561
2562 2562 </body>
2563 2563 </html>
2564 2564
2565 2565
2566 2566 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2567 2567 200 Script output follows
2568 2568
2569 2569 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2570 2570 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2571 2571 <head>
2572 2572 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2573 2573 <meta name="robots" content="index, nofollow" />
2574 2574 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2575 2575 <script type="text/javascript" src="/static/mercurial.js"></script>
2576 2576
2577 2577 <title>Help: revisions</title>
2578 2578 </head>
2579 2579 <body>
2580 2580
2581 2581 <div class="container">
2582 2582 <div class="menu">
2583 2583 <div class="logo">
2584 2584 <a href="https://mercurial-scm.org/">
2585 2585 <img src="/static/hglogo.png" alt="mercurial" /></a>
2586 2586 </div>
2587 2587 <ul>
2588 2588 <li><a href="/shortlog">log</a></li>
2589 2589 <li><a href="/graph">graph</a></li>
2590 2590 <li><a href="/tags">tags</a></li>
2591 2591 <li><a href="/bookmarks">bookmarks</a></li>
2592 2592 <li><a href="/branches">branches</a></li>
2593 2593 </ul>
2594 2594 <ul>
2595 2595 <li class="active"><a href="/help">help</a></li>
2596 2596 </ul>
2597 2597 </div>
2598 2598
2599 2599 <div class="main">
2600 2600 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2601 2601 <h3>Help: revisions</h3>
2602 2602
2603 2603 <form class="search" action="/log">
2604 2604
2605 2605 <p><input name="rev" id="search1" type="text" size="30" /></p>
2606 2606 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2607 2607 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2608 2608 </form>
2609 2609 <div id="doc">
2610 2610 <h1>Specifying Single Revisions</h1>
2611 2611 <p>
2612 2612 Mercurial supports several ways to specify individual revisions.
2613 2613 </p>
2614 2614 <p>
2615 2615 A plain integer is treated as a revision number. Negative integers are
2616 2616 treated as sequential offsets from the tip, with -1 denoting the tip,
2617 2617 -2 denoting the revision prior to the tip, and so forth.
2618 2618 </p>
2619 2619 <p>
2620 2620 A 40-digit hexadecimal string is treated as a unique revision
2621 2621 identifier.
2622 2622 </p>
2623 2623 <p>
2624 2624 A hexadecimal string less than 40 characters long is treated as a
2625 2625 unique revision identifier and is referred to as a short-form
2626 2626 identifier. A short-form identifier is only valid if it is the prefix
2627 2627 of exactly one full-length identifier.
2628 2628 </p>
2629 2629 <p>
2630 2630 Any other string is treated as a bookmark, tag, or branch name. A
2631 2631 bookmark is a movable pointer to a revision. A tag is a permanent name
2632 2632 associated with a revision. A branch name denotes the tipmost open branch head
2633 2633 of that branch - or if they are all closed, the tipmost closed head of the
2634 2634 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2635 2635 </p>
2636 2636 <p>
2637 2637 The reserved name &quot;tip&quot; always identifies the most recent revision.
2638 2638 </p>
2639 2639 <p>
2640 2640 The reserved name &quot;null&quot; indicates the null revision. This is the
2641 2641 revision of an empty repository, and the parent of revision 0.
2642 2642 </p>
2643 2643 <p>
2644 2644 The reserved name &quot;.&quot; indicates the working directory parent. If no
2645 2645 working directory is checked out, it is equivalent to null. If an
2646 2646 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2647 2647 parent.
2648 2648 </p>
2649 2649
2650 2650 </div>
2651 2651 </div>
2652 2652 </div>
2653 2653
2654 2654 <script type="text/javascript">process_dates()</script>
2655 2655
2656 2656
2657 2657 </body>
2658 2658 </html>
2659 2659
2660 2660
2661 2661 Sub-topic indexes rendered properly
2662 2662
2663 2663 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2664 2664 200 Script output follows
2665 2665
2666 2666 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2667 2667 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2668 2668 <head>
2669 2669 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2670 2670 <meta name="robots" content="index, nofollow" />
2671 2671 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2672 2672 <script type="text/javascript" src="/static/mercurial.js"></script>
2673 2673
2674 2674 <title>Help: internals</title>
2675 2675 </head>
2676 2676 <body>
2677 2677
2678 2678 <div class="container">
2679 2679 <div class="menu">
2680 2680 <div class="logo">
2681 2681 <a href="https://mercurial-scm.org/">
2682 2682 <img src="/static/hglogo.png" alt="mercurial" /></a>
2683 2683 </div>
2684 2684 <ul>
2685 2685 <li><a href="/shortlog">log</a></li>
2686 2686 <li><a href="/graph">graph</a></li>
2687 2687 <li><a href="/tags">tags</a></li>
2688 2688 <li><a href="/bookmarks">bookmarks</a></li>
2689 2689 <li><a href="/branches">branches</a></li>
2690 2690 </ul>
2691 2691 <ul>
2692 2692 <li><a href="/help">help</a></li>
2693 2693 </ul>
2694 2694 </div>
2695 2695
2696 2696 <div class="main">
2697 2697 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2698 2698 <form class="search" action="/log">
2699 2699
2700 2700 <p><input name="rev" id="search1" type="text" size="30" /></p>
2701 2701 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2702 2702 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2703 2703 </form>
2704 2704 <table class="bigtable">
2705 2705 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2706 2706
2707 2707 <tr><td>
2708 2708 <a href="/help/internals.bundles">
2709 2709 bundles
2710 2710 </a>
2711 2711 </td><td>
2712 2712 container for exchange of repository data
2713 2713 </td></tr>
2714 2714 <tr><td>
2715 2715 <a href="/help/internals.changegroups">
2716 2716 changegroups
2717 2717 </a>
2718 2718 </td><td>
2719 2719 representation of revlog data
2720 2720 </td></tr>
2721 2721 <tr><td>
2722 2722 <a href="/help/internals.revlogs">
2723 2723 revlogs
2724 2724 </a>
2725 2725 </td><td>
2726 2726 revision storage mechanism
2727 2727 </td></tr>
2728 2728
2729 2729
2730 2730
2731 2731
2732 2732
2733 2733 </table>
2734 2734 </div>
2735 2735 </div>
2736 2736
2737 2737 <script type="text/javascript">process_dates()</script>
2738 2738
2739 2739
2740 2740 </body>
2741 2741 </html>
2742 2742
2743 2743
2744 2744 Sub-topic topics rendered properly
2745 2745
2746 2746 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2747 2747 200 Script output follows
2748 2748
2749 2749 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2750 2750 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2751 2751 <head>
2752 2752 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2753 2753 <meta name="robots" content="index, nofollow" />
2754 2754 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2755 2755 <script type="text/javascript" src="/static/mercurial.js"></script>
2756 2756
2757 2757 <title>Help: internals.changegroups</title>
2758 2758 </head>
2759 2759 <body>
2760 2760
2761 2761 <div class="container">
2762 2762 <div class="menu">
2763 2763 <div class="logo">
2764 2764 <a href="https://mercurial-scm.org/">
2765 2765 <img src="/static/hglogo.png" alt="mercurial" /></a>
2766 2766 </div>
2767 2767 <ul>
2768 2768 <li><a href="/shortlog">log</a></li>
2769 2769 <li><a href="/graph">graph</a></li>
2770 2770 <li><a href="/tags">tags</a></li>
2771 2771 <li><a href="/bookmarks">bookmarks</a></li>
2772 2772 <li><a href="/branches">branches</a></li>
2773 2773 </ul>
2774 2774 <ul>
2775 2775 <li class="active"><a href="/help">help</a></li>
2776 2776 </ul>
2777 2777 </div>
2778 2778
2779 2779 <div class="main">
2780 2780 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2781 2781 <h3>Help: internals.changegroups</h3>
2782 2782
2783 2783 <form class="search" action="/log">
2784 2784
2785 2785 <p><input name="rev" id="search1" type="text" size="30" /></p>
2786 2786 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2787 2787 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2788 2788 </form>
2789 2789 <div id="doc">
2790 2790 <h1>representation of revlog data</h1>
2791 2791 <h2>Changegroups</h2>
2792 2792 <p>
2793 2793 Changegroups are representations of repository revlog data, specifically
2794 2794 the changelog, manifest, and filelogs.
2795 2795 </p>
2796 2796 <p>
2797 2797 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2798 2798 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2799 2799 the only difference being a header on entries in the changeset
2800 2800 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2801 2801 includes revlog flags in the delta header.
2802 2802 </p>
2803 2803 <p>
2804 2804 Changegroups consists of 3 logical segments:
2805 2805 </p>
2806 2806 <pre>
2807 2807 +---------------------------------+
2808 2808 | | | |
2809 2809 | changeset | manifest | filelogs |
2810 2810 | | | |
2811 2811 +---------------------------------+
2812 2812 </pre>
2813 2813 <p>
2814 2814 The principle building block of each segment is a *chunk*. A *chunk*
2815 2815 is a framed piece of data:
2816 2816 </p>
2817 2817 <pre>
2818 2818 +---------------------------------------+
2819 2819 | | |
2820 2820 | length | data |
2821 2821 | (32 bits) | &lt;length&gt; bytes |
2822 2822 | | |
2823 2823 +---------------------------------------+
2824 2824 </pre>
2825 2825 <p>
2826 2826 Each chunk starts with a 32-bit big-endian signed integer indicating
2827 2827 the length of the raw data that follows.
2828 2828 </p>
2829 2829 <p>
2830 2830 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2831 2831 call this an *empty chunk*.
2832 2832 </p>
2833 2833 <h3>Delta Groups</h3>
2834 2834 <p>
2835 2835 A *delta group* expresses the content of a revlog as a series of deltas,
2836 2836 or patches against previous revisions.
2837 2837 </p>
2838 2838 <p>
2839 2839 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2840 2840 to signal the end of the delta group:
2841 2841 </p>
2842 2842 <pre>
2843 2843 +------------------------------------------------------------------------+
2844 2844 | | | | | |
2845 2845 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2846 2846 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2847 2847 | | | | | |
2848 2848 +------------------------------------------------------------+-----------+
2849 2849 </pre>
2850 2850 <p>
2851 2851 Each *chunk*'s data consists of the following:
2852 2852 </p>
2853 2853 <pre>
2854 2854 +-----------------------------------------+
2855 2855 | | | |
2856 2856 | delta header | mdiff header | delta |
2857 2857 | (various) | (12 bytes) | (various) |
2858 2858 | | | |
2859 2859 +-----------------------------------------+
2860 2860 </pre>
2861 2861 <p>
2862 2862 The *length* field is the byte length of the remaining 3 logical pieces
2863 2863 of data. The *delta* is a diff from an existing entry in the changelog.
2864 2864 </p>
2865 2865 <p>
2866 2866 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2867 2867 &quot;3&quot; of the changegroup format.
2868 2868 </p>
2869 2869 <p>
2870 2870 Version 1:
2871 2871 </p>
2872 2872 <pre>
2873 2873 +------------------------------------------------------+
2874 2874 | | | | |
2875 2875 | node | p1 node | p2 node | link node |
2876 2876 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2877 2877 | | | | |
2878 2878 +------------------------------------------------------+
2879 2879 </pre>
2880 2880 <p>
2881 2881 Version 2:
2882 2882 </p>
2883 2883 <pre>
2884 2884 +------------------------------------------------------------------+
2885 2885 | | | | | |
2886 2886 | node | p1 node | p2 node | base node | link node |
2887 2887 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2888 2888 | | | | | |
2889 2889 +------------------------------------------------------------------+
2890 2890 </pre>
2891 2891 <p>
2892 2892 Version 3:
2893 2893 </p>
2894 2894 <pre>
2895 2895 +------------------------------------------------------------------------------+
2896 2896 | | | | | | |
2897 2897 | node | p1 node | p2 node | base node | link node | flags |
2898 2898 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2899 2899 | | | | | | |
2900 2900 +------------------------------------------------------------------------------+
2901 2901 </pre>
2902 2902 <p>
2903 2903 The *mdiff header* consists of 3 32-bit big-endian signed integers
2904 2904 describing offsets at which to apply the following delta content:
2905 2905 </p>
2906 2906 <pre>
2907 2907 +-------------------------------------+
2908 2908 | | | |
2909 2909 | offset | old length | new length |
2910 2910 | (32 bits) | (32 bits) | (32 bits) |
2911 2911 | | | |
2912 2912 +-------------------------------------+
2913 2913 </pre>
2914 2914 <p>
2915 2915 In version 1, the delta is always applied against the previous node from
2916 2916 the changegroup or the first parent if this is the first entry in the
2917 2917 changegroup.
2918 2918 </p>
2919 2919 <p>
2920 2920 In version 2, the delta base node is encoded in the entry in the
2921 2921 changegroup. This allows the delta to be expressed against any parent,
2922 2922 which can result in smaller deltas and more efficient encoding of data.
2923 2923 </p>
2924 2924 <h3>Changeset Segment</h3>
2925 2925 <p>
2926 2926 The *changeset segment* consists of a single *delta group* holding
2927 2927 changelog data. It is followed by an *empty chunk* to denote the
2928 2928 boundary to the *manifests segment*.
2929 2929 </p>
2930 2930 <h3>Manifest Segment</h3>
2931 2931 <p>
2932 2932 The *manifest segment* consists of a single *delta group* holding
2933 2933 manifest data. It is followed by an *empty chunk* to denote the boundary
2934 2934 to the *filelogs segment*.
2935 2935 </p>
2936 2936 <h3>Filelogs Segment</h3>
2937 2937 <p>
2938 2938 The *filelogs* segment consists of multiple sub-segments, each
2939 2939 corresponding to an individual file whose data is being described:
2940 2940 </p>
2941 2941 <pre>
2942 2942 +--------------------------------------+
2943 2943 | | | | |
2944 2944 | filelog0 | filelog1 | filelog2 | ... |
2945 2945 | | | | |
2946 2946 +--------------------------------------+
2947 2947 </pre>
2948 2948 <p>
2949 2949 In version &quot;3&quot; of the changegroup format, filelogs may include
2950 2950 directory logs when treemanifests are in use. directory logs are
2951 2951 identified by having a trailing '/' on their filename (see below).
2952 2952 </p>
2953 2953 <p>
2954 2954 The final filelog sub-segment is followed by an *empty chunk* to denote
2955 2955 the end of the segment and the overall changegroup.
2956 2956 </p>
2957 2957 <p>
2958 2958 Each filelog sub-segment consists of the following:
2959 2959 </p>
2960 2960 <pre>
2961 2961 +------------------------------------------+
2962 2962 | | | |
2963 2963 | filename size | filename | delta group |
2964 2964 | (32 bits) | (various) | (various) |
2965 2965 | | | |
2966 2966 +------------------------------------------+
2967 2967 </pre>
2968 2968 <p>
2969 2969 That is, a *chunk* consisting of the filename (not terminated or padded)
2970 2970 followed by N chunks constituting the *delta group* for this file.
2971 2971 </p>
2972 2972
2973 2973 </div>
2974 2974 </div>
2975 2975 </div>
2976 2976
2977 2977 <script type="text/javascript">process_dates()</script>
2978 2978
2979 2979
2980 2980 </body>
2981 2981 </html>
2982 2982
2983 2983
2984 2984 $ killdaemons.py
2985 2985
2986 2986 #endif
@@ -1,806 +1,806 b''
1 1 == paragraphs ==
2 2 60 column format:
3 3 ----------------------------------------------------------------------
4 4 This is some text in the first paragraph.
5 5
6 6 A small indented paragraph. It is followed by some lines
7 7 containing random whitespace.
8 8
9 9 The third and final paragraph.
10 10 ----------------------------------------------------------------------
11 11
12 12 30 column format:
13 13 ----------------------------------------------------------------------
14 14 This is some text in the first
15 15 paragraph.
16 16
17 17 A small indented paragraph.
18 18 It is followed by some lines
19 19 containing random
20 20 whitespace.
21 21
22 22 The third and final paragraph.
23 23 ----------------------------------------------------------------------
24 24
25 25 html format:
26 26 ----------------------------------------------------------------------
27 27 <p>
28 28 This is some text in the first paragraph.
29 29 </p>
30 30 <p>
31 31 A small indented paragraph.
32 32 It is followed by some lines
33 33 containing random whitespace.
34 34 </p>
35 35 <p>
36 36 The third and final paragraph.
37 37 </p>
38 38 ----------------------------------------------------------------------
39 39
40 40 == definitions ==
41 41 60 column format:
42 42 ----------------------------------------------------------------------
43 43 A Term
44 44 Definition. The indented lines make up the definition.
45 45
46 46 Another Term
47 47 Another definition. The final line in the definition
48 48 determines the indentation, so this will be indented
49 49 with four spaces.
50 50
51 51 A Nested/Indented Term
52 52 Definition.
53 53 ----------------------------------------------------------------------
54 54
55 55 30 column format:
56 56 ----------------------------------------------------------------------
57 57 A Term
58 58 Definition. The indented
59 59 lines make up the
60 60 definition.
61 61
62 62 Another Term
63 63 Another definition. The
64 64 final line in the
65 65 definition determines the
66 66 indentation, so this will
67 67 be indented with four
68 68 spaces.
69 69
70 70 A Nested/Indented Term
71 71 Definition.
72 72 ----------------------------------------------------------------------
73 73
74 74 html format:
75 75 ----------------------------------------------------------------------
76 76 <dl>
77 77 <dt>A Term
78 78 <dd>Definition. The indented lines make up the definition.
79 79 <dt>Another Term
80 80 <dd>Another definition. The final line in the definition determines the indentation, so this will be indented with four spaces.
81 81 <dt>A Nested/Indented Term
82 82 <dd>Definition.
83 83 </dl>
84 84 ----------------------------------------------------------------------
85 85
86 86 == literals ==
87 87 60 column format:
88 88 ----------------------------------------------------------------------
89 89 The fully minimized form is the most convenient form:
90 90
91 91 Hello
92 92 literal
93 93 world
94 94
95 95 In the partially minimized form a paragraph simply ends with
96 96 space-double-colon.
97 97
98 98 ////////////////////////////////////////
99 99 long un-wrapped line in a literal block
100 100 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
101 101
102 102 This literal block is started with '::',
103 103 the so-called expanded form. The paragraph
104 104 with '::' disappears in the final output.
105 105 ----------------------------------------------------------------------
106 106
107 107 30 column format:
108 108 ----------------------------------------------------------------------
109 109 The fully minimized form is
110 110 the most convenient form:
111 111
112 112 Hello
113 113 literal
114 114 world
115 115
116 116 In the partially minimized
117 117 form a paragraph simply ends
118 118 with space-double-colon.
119 119
120 120 ////////////////////////////////////////
121 121 long un-wrapped line in a literal block
122 122 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
123 123
124 124 This literal block is started with '::',
125 125 the so-called expanded form. The paragraph
126 126 with '::' disappears in the final output.
127 127 ----------------------------------------------------------------------
128 128
129 129 html format:
130 130 ----------------------------------------------------------------------
131 131 <p>
132 132 The fully minimized form is the most
133 133 convenient form:
134 134 </p>
135 135 <pre>
136 136 Hello
137 137 literal
138 138 world
139 139 </pre>
140 140 <p>
141 141 In the partially minimized form a paragraph
142 142 simply ends with space-double-colon.
143 143 </p>
144 144 <pre>
145 145 ////////////////////////////////////////
146 146 long un-wrapped line in a literal block
147 147 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
148 148 </pre>
149 149 <pre>
150 150 This literal block is started with '::',
151 151 the so-called expanded form. The paragraph
152 152 with '::' disappears in the final output.
153 153 </pre>
154 154 ----------------------------------------------------------------------
155 155
156 156 == lists ==
157 157 60 column format:
158 158 ----------------------------------------------------------------------
159 159 - This is the first list item.
160 160
161 161 Second paragraph in the first list item.
162 162
163 163 - List items need not be separated by a blank line.
164 164 - And will be rendered without one in any case.
165 165
166 166 We can have indented lists:
167 167
168 168 - This is an indented list item
169 169 - Another indented list item:
170 170
171 171 - A literal block in the middle
172 172 of an indented list.
173 173
174 174 (The above is not a list item since we are in the literal block.)
175 175
176 176 Literal block with no indentation (apart from
177 177 the two spaces added to all literal blocks).
178 178
179 179 1. This is an enumerated list (first item).
180 180 2. Continuing with the second item.
181 181 (1) foo
182 182 (2) bar
183 183 1) Another
184 184 2) List
185 185
186 186 Line blocks are also a form of list:
187 187
188 188 This is the first line. The line continues here.
189 189 This is the second line.
190 190 ----------------------------------------------------------------------
191 191
192 192 30 column format:
193 193 ----------------------------------------------------------------------
194 194 - This is the first list item.
195 195
196 196 Second paragraph in the
197 197 first list item.
198 198
199 199 - List items need not be
200 200 separated by a blank line.
201 201 - And will be rendered without
202 202 one in any case.
203 203
204 204 We can have indented lists:
205 205
206 206 - This is an indented list
207 207 item
208 208 - Another indented list
209 209 item:
210 210
211 211 - A literal block in the middle
212 212 of an indented list.
213 213
214 214 (The above is not a list item since we are in the literal block.)
215 215
216 216 Literal block with no indentation (apart from
217 217 the two spaces added to all literal blocks).
218 218
219 219 1. This is an enumerated list
220 220 (first item).
221 221 2. Continuing with the second
222 222 item.
223 223 (1) foo
224 224 (2) bar
225 225 1) Another
226 226 2) List
227 227
228 228 Line blocks are also a form of
229 229 list:
230 230
231 231 This is the first line. The
232 232 line continues here.
233 233 This is the second line.
234 234 ----------------------------------------------------------------------
235 235
236 236 html format:
237 237 ----------------------------------------------------------------------
238 238 <ul>
239 239 <li> This is the first list item.
240 240 <p>
241 241 Second paragraph in the first list item.
242 242 </p>
243 243 <li> List items need not be separated by a blank line.
244 244 <li> And will be rendered without one in any case.
245 245 </ul>
246 246 <p>
247 247 We can have indented lists:
248 248 </p>
249 249 <ul>
250 250 <li> This is an indented list item
251 251 <li> Another indented list item:
252 252 <pre>
253 253 - A literal block in the middle
254 254 of an indented list.
255 255 </pre>
256 256 <pre>
257 257 (The above is not a list item since we are in the literal block.)
258 258 </pre>
259 259 </ul>
260 260 <pre>
261 261 Literal block with no indentation (apart from
262 262 the two spaces added to all literal blocks).
263 263 </pre>
264 264 <ol>
265 265 <li> This is an enumerated list (first item).
266 266 <li> Continuing with the second item.
267 267 <li> foo
268 268 <li> bar
269 269 <li> Another
270 270 <li> List
271 271 </ol>
272 272 <p>
273 273 Line blocks are also a form of list:
274 274 </p>
275 275 <ol>
276 276 <li> This is the first line. The line continues here.
277 277 <li> This is the second line.
278 278 </ol>
279 279 ----------------------------------------------------------------------
280 280
281 281 == options ==
282 282 60 column format:
283 283 ----------------------------------------------------------------------
284 284 There is support for simple option lists, but only with long
285 285 options:
286 286
287 287 -X --exclude filter an option with a short and long option
288 288 with an argument
289 289 -I --include an option with both a short option and
290 290 a long option
291 291 --all Output all.
292 292 --both Output both (this description is quite
293 293 long).
294 294 --long Output all day long.
295 295 --par This option has two paragraphs in its
296 296 description. This is the first.
297 297
298 298 This is the second. Blank lines may
299 299 be omitted between options (as above)
300 300 or left in (as here).
301 301
302 302 The next paragraph looks like an option list, but lacks the
303 303 two-space marker after the option. It is treated as a normal
304 304 paragraph:
305 305
306 306 --foo bar baz
307 307 ----------------------------------------------------------------------
308 308
309 309 30 column format:
310 310 ----------------------------------------------------------------------
311 311 There is support for simple
312 312 option lists, but only with
313 313 long options:
314 314
315 315 -X --exclude filter an
316 316 option
317 317 with a
318 318 short
319 319 and
320 320 long
321 321 option
322 322 with an
323 323 argumen
324 324 t
325 325 -I --include an
326 326 option
327 327 with
328 328 both a
329 329 short
330 330 option
331 331 and a
332 332 long
333 333 option
334 334 --all Output
335 335 all.
336 336 --both Output
337 337 both
338 338 (this d
339 339 escript
340 340 ion is
341 341 quite
342 342 long).
343 343 --long Output
344 344 all day
345 345 long.
346 346 --par This
347 347 option
348 348 has two
349 349 paragra
350 350 phs in
351 351 its des
352 352 criptio
353 353 n. This
354 354 is the
355 355 first.
356 356
357 357 This is
358 358 the
359 359 second.
360 360 Blank
361 361 lines
362 362 may be
363 363 omitted
364 364 between
365 365 options
366 366 (as
367 367 above)
368 368 or left
369 369 in (as
370 370 here).
371 371
372 372 The next paragraph looks like
373 373 an option list, but lacks the
374 374 two-space marker after the
375 375 option. It is treated as a
376 376 normal paragraph:
377 377
378 378 --foo bar baz
379 379 ----------------------------------------------------------------------
380 380
381 381 html format:
382 382 ----------------------------------------------------------------------
383 383 <p>
384 384 There is support for simple option lists,
385 385 but only with long options:
386 386 </p>
387 387 <dl>
388 388 <dt>-X --exclude filter
389 389 <dd>an option with a short and long option with an argument
390 390 <dt>-I --include
391 391 <dd>an option with both a short option and a long option
392 392 <dt> --all
393 393 <dd>Output all.
394 394 <dt> --both
395 395 <dd>Output both (this description is quite long).
396 396 <dt> --long
397 397 <dd>Output all day long.
398 398 <dt> --par
399 399 <dd>This option has two paragraphs in its description. This is the first.
400 400 <p>
401 401 This is the second. Blank lines may be omitted between
402 402 options (as above) or left in (as here).
403 403 </p>
404 404 </dl>
405 405 <p>
406 406 The next paragraph looks like an option list, but lacks the two-space
407 407 marker after the option. It is treated as a normal paragraph:
408 408 </p>
409 409 <p>
410 410 --foo bar baz
411 411 </p>
412 412 ----------------------------------------------------------------------
413 413
414 414 == fields ==
415 415 60 column format:
416 416 ----------------------------------------------------------------------
417 417 a First item.
418 418 ab Second item. Indentation and wrapping is
419 419 handled automatically.
420 420
421 421 Next list:
422 422
423 423 small The larger key below triggers full indentation
424 424 here.
425 425 much too large
426 426 This key is big enough to get its own line.
427 427 ----------------------------------------------------------------------
428 428
429 429 30 column format:
430 430 ----------------------------------------------------------------------
431 431 a First item.
432 432 ab Second item.
433 433 Indentation and
434 434 wrapping is
435 435 handled
436 436 automatically.
437 437
438 438 Next list:
439 439
440 440 small The larger key
441 441 below triggers
442 442 full indentation
443 443 here.
444 444 much too large
445 445 This key is big
446 446 enough to get
447 447 its own line.
448 448 ----------------------------------------------------------------------
449 449
450 450 html format:
451 451 ----------------------------------------------------------------------
452 452 <dl>
453 453 <dt>a
454 454 <dd>First item.
455 455 <dt>ab
456 456 <dd>Second item. Indentation and wrapping is handled automatically.
457 457 </dl>
458 458 <p>
459 459 Next list:
460 460 </p>
461 461 <dl>
462 462 <dt>small
463 463 <dd>The larger key below triggers full indentation here.
464 464 <dt>much too large
465 465 <dd>This key is big enough to get its own line.
466 466 </dl>
467 467 ----------------------------------------------------------------------
468 468
469 469 == containers (normal) ==
470 470 60 column format:
471 471 ----------------------------------------------------------------------
472 472 Normal output.
473 473 ----------------------------------------------------------------------
474 474
475 475 30 column format:
476 476 ----------------------------------------------------------------------
477 477 Normal output.
478 478 ----------------------------------------------------------------------
479 479
480 480 html format:
481 481 ----------------------------------------------------------------------
482 482 <p>
483 483 Normal output.
484 484 </p>
485 485 ----------------------------------------------------------------------
486 486
487 487 == containers (verbose) ==
488 488 60 column format:
489 489 ----------------------------------------------------------------------
490 490 Normal output.
491 491
492 492 Verbose output.
493 493 ----------------------------------------------------------------------
494 494 ['debug', 'debug']
495 495 ----------------------------------------------------------------------
496 496
497 497 30 column format:
498 498 ----------------------------------------------------------------------
499 499 Normal output.
500 500
501 501 Verbose output.
502 502 ----------------------------------------------------------------------
503 503 ['debug', 'debug']
504 504 ----------------------------------------------------------------------
505 505
506 506 html format:
507 507 ----------------------------------------------------------------------
508 508 <p>
509 509 Normal output.
510 510 </p>
511 511 <p>
512 512 Verbose output.
513 513 </p>
514 514 ----------------------------------------------------------------------
515 515 ['debug', 'debug']
516 516 ----------------------------------------------------------------------
517 517
518 518 == containers (debug) ==
519 519 60 column format:
520 520 ----------------------------------------------------------------------
521 521 Normal output.
522 522
523 523 Initial debug output.
524 524 ----------------------------------------------------------------------
525 525 ['verbose']
526 526 ----------------------------------------------------------------------
527 527
528 528 30 column format:
529 529 ----------------------------------------------------------------------
530 530 Normal output.
531 531
532 532 Initial debug output.
533 533 ----------------------------------------------------------------------
534 534 ['verbose']
535 535 ----------------------------------------------------------------------
536 536
537 537 html format:
538 538 ----------------------------------------------------------------------
539 539 <p>
540 540 Normal output.
541 541 </p>
542 542 <p>
543 543 Initial debug output.
544 544 </p>
545 545 ----------------------------------------------------------------------
546 546 ['verbose']
547 547 ----------------------------------------------------------------------
548 548
549 549 == containers (verbose debug) ==
550 550 60 column format:
551 551 ----------------------------------------------------------------------
552 552 Normal output.
553 553
554 554 Initial debug output.
555 555
556 556 Verbose output.
557 557
558 558 Debug output.
559 559 ----------------------------------------------------------------------
560 560 []
561 561 ----------------------------------------------------------------------
562 562
563 563 30 column format:
564 564 ----------------------------------------------------------------------
565 565 Normal output.
566 566
567 567 Initial debug output.
568 568
569 569 Verbose output.
570 570
571 571 Debug output.
572 572 ----------------------------------------------------------------------
573 573 []
574 574 ----------------------------------------------------------------------
575 575
576 576 html format:
577 577 ----------------------------------------------------------------------
578 578 <p>
579 579 Normal output.
580 580 </p>
581 581 <p>
582 582 Initial debug output.
583 583 </p>
584 584 <p>
585 585 Verbose output.
586 586 </p>
587 587 <p>
588 588 Debug output.
589 589 </p>
590 590 ----------------------------------------------------------------------
591 591 []
592 592 ----------------------------------------------------------------------
593 593
594 594 == roles ==
595 595 60 column format:
596 596 ----------------------------------------------------------------------
597 Please see "hg add".
597 Please see 'hg add'.
598 598 ----------------------------------------------------------------------
599 599
600 600 30 column format:
601 601 ----------------------------------------------------------------------
602 Please see "hg add".
602 Please see 'hg add'.
603 603 ----------------------------------------------------------------------
604 604
605 605 html format:
606 606 ----------------------------------------------------------------------
607 607 <p>
608 Please see &quot;hg add&quot;.
608 Please see 'hg add'.
609 609 </p>
610 610 ----------------------------------------------------------------------
611 611
612 612 == sections ==
613 613 60 column format:
614 614 ----------------------------------------------------------------------
615 615 Title
616 616 =====
617 617
618 618 Section
619 619 -------
620 620
621 621 Subsection
622 622 ''''''''''
623 623
624 Markup: "foo" and "hg help"
624 Markup: "foo" and 'hg help'
625 625 ---------------------------
626 626 ----------------------------------------------------------------------
627 627
628 628 30 column format:
629 629 ----------------------------------------------------------------------
630 630 Title
631 631 =====
632 632
633 633 Section
634 634 -------
635 635
636 636 Subsection
637 637 ''''''''''
638 638
639 Markup: "foo" and "hg help"
639 Markup: "foo" and 'hg help'
640 640 ---------------------------
641 641 ----------------------------------------------------------------------
642 642
643 643 html format:
644 644 ----------------------------------------------------------------------
645 645 <h1>Title</h1>
646 646 <h2>Section</h2>
647 647 <h3>Subsection</h3>
648 <h2>Markup: &quot;foo&quot; and &quot;hg help&quot;</h2>
648 <h2>Markup: &quot;foo&quot; and 'hg help'</h2>
649 649 ----------------------------------------------------------------------
650 650
651 651 == admonitions ==
652 652 60 column format:
653 653 ----------------------------------------------------------------------
654 654 Note:
655 655 This is a note
656 656
657 657 - Bullet 1
658 658 - Bullet 2
659 659
660 660 Warning!
661 661 This is a warning Second input line of warning
662 662
663 663 !Danger!
664 664 This is danger
665 665 ----------------------------------------------------------------------
666 666
667 667 30 column format:
668 668 ----------------------------------------------------------------------
669 669 Note:
670 670 This is a note
671 671
672 672 - Bullet 1
673 673 - Bullet 2
674 674
675 675 Warning!
676 676 This is a warning Second
677 677 input line of warning
678 678
679 679 !Danger!
680 680 This is danger
681 681 ----------------------------------------------------------------------
682 682
683 683 html format:
684 684 ----------------------------------------------------------------------
685 685 <p>
686 686 <b>Note:</b>
687 687 </p>
688 688 <p>
689 689 This is a note
690 690 </p>
691 691 <ul>
692 692 <li> Bullet 1
693 693 <li> Bullet 2
694 694 </ul>
695 695 <p>
696 696 <b>Warning!</b> This is a warning Second input line of warning
697 697 </p>
698 698 <p>
699 699 <b>!Danger!</b> This is danger
700 700 </p>
701 701 ----------------------------------------------------------------------
702 702
703 703 == comments ==
704 704 60 column format:
705 705 ----------------------------------------------------------------------
706 706 Some text.
707 707
708 708 Some indented text.
709 709
710 710 Empty comment above
711 711 ----------------------------------------------------------------------
712 712
713 713 30 column format:
714 714 ----------------------------------------------------------------------
715 715 Some text.
716 716
717 717 Some indented text.
718 718
719 719 Empty comment above
720 720 ----------------------------------------------------------------------
721 721
722 722 html format:
723 723 ----------------------------------------------------------------------
724 724 <p>
725 725 Some text.
726 726 </p>
727 727 <p>
728 728 Some indented text.
729 729 </p>
730 730 <p>
731 731 Empty comment above
732 732 </p>
733 733 ----------------------------------------------------------------------
734 734
735 735 === === ========================================
736 736 a b c
737 737 === === ========================================
738 738 1 2 3
739 739 foo bar baz this list is very very very long man
740 740 === === ========================================
741 741
742 742 == table ==
743 743 60 column format:
744 744 ----------------------------------------------------------------------
745 745 a b c
746 746 ------------------------------------------------
747 747 1 2 3
748 748 foo bar baz this list is very very very long man
749 749 ----------------------------------------------------------------------
750 750
751 751 30 column format:
752 752 ----------------------------------------------------------------------
753 753 a b c
754 754 ------------------------------
755 755 1 2 3
756 756 foo bar baz this list is
757 757 very very very long
758 758 man
759 759 ----------------------------------------------------------------------
760 760
761 761 html format:
762 762 ----------------------------------------------------------------------
763 763 <table>
764 764 <tr><td>a</td>
765 765 <td>b</td>
766 766 <td>c</td></tr>
767 767 <tr><td>1</td>
768 768 <td>2</td>
769 769 <td>3</td></tr>
770 770 <tr><td>foo</td>
771 771 <td>bar</td>
772 772 <td>baz this list is very very very long man</td></tr>
773 773 </table>
774 774 ----------------------------------------------------------------------
775 775
776 776 = ==== ======================================
777 777 s long line goes on here
778 778 xy tried to fix here by indenting
779 779 = ==== ======================================
780 780
781 781 == table+nl ==
782 782 60 column format:
783 783 ----------------------------------------------------------------------
784 784 s long line goes on here
785 785 xy tried to fix here by indenting
786 786 ----------------------------------------------------------------------
787 787
788 788 30 column format:
789 789 ----------------------------------------------------------------------
790 790 s long line goes on here
791 791 xy tried to fix here by
792 792 indenting
793 793 ----------------------------------------------------------------------
794 794
795 795 html format:
796 796 ----------------------------------------------------------------------
797 797 <table>
798 798 <tr><td>s</td>
799 799 <td>long</td>
800 800 <td>line goes on here</td></tr>
801 801 <tr><td></td>
802 802 <td>xy</td>
803 803 <td>tried to fix here by indenting</td></tr>
804 804 </table>
805 805 ----------------------------------------------------------------------
806 806
@@ -1,1612 +1,1612 b''
1 1 $ checkundo()
2 2 > {
3 3 > if [ -f .hg/store/undo ]; then
4 4 > echo ".hg/store/undo still exists after $1"
5 5 > fi
6 6 > }
7 7
8 8 $ cat <<EOF >> $HGRCPATH
9 9 > [extensions]
10 10 > mq =
11 11 > [mq]
12 12 > plain = true
13 13 > EOF
14 14
15 15
16 16 help
17 17
18 18 $ hg help mq
19 19 mq extension - manage a stack of patches
20 20
21 21 This extension lets you work with a stack of patches in a Mercurial
22 22 repository. It manages two stacks of patches - all known patches, and applied
23 23 patches (subset of known patches).
24 24
25 25 Known patches are represented as patch files in the .hg/patches directory.
26 26 Applied patches are both patch files and changesets.
27 27
28 Common tasks (use "hg help command" for more details):
28 Common tasks (use 'hg help command' for more details):
29 29
30 30 create new patch qnew
31 31 import existing patch qimport
32 32
33 33 print patch series qseries
34 34 print applied patches qapplied
35 35
36 36 add known patch to applied stack qpush
37 37 remove patch from applied stack qpop
38 38 refresh contents of top applied patch qrefresh
39 39
40 40 By default, mq will automatically use git patches when required to avoid
41 41 losing file mode changes, copy records, binary files or empty files creations
42 42 or deletions. This behavior can be configured with:
43 43
44 44 [mq]
45 45 git = auto/keep/yes/no
46 46
47 47 If set to 'keep', mq will obey the [diff] section configuration while
48 48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
49 49 will override the [diff] section and always generate git or regular patches,
50 50 possibly losing data in the second case.
51 51
52 It may be desirable for mq changesets to be kept in the secret phase (see "hg
53 help phases"), which can be enabled with the following setting:
52 It may be desirable for mq changesets to be kept in the secret phase (see 'hg
53 help phases'), which can be enabled with the following setting:
54 54
55 55 [mq]
56 56 secret = True
57 57
58 58 You will by default be managing a patch queue named "patches". You can create
59 other, independent patch queues with the "hg qqueue" command.
59 other, independent patch queues with the 'hg qqueue' command.
60 60
61 61 If the working directory contains uncommitted files, qpush, qpop and qgoto
62 62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
63 63
64 64 [mq]
65 65 keepchanges = True
66 66
67 67 make them behave as if --keep-changes were passed, and non-conflicting local
68 68 changes will be tolerated and preserved. If incompatible options such as
69 69 -f/--force or --exact are passed, this setting is ignored.
70 70
71 71 This extension used to provide a strip command. This command now lives in the
72 72 strip extension.
73 73
74 74 list of commands:
75 75
76 76 qapplied print the patches already applied
77 77 qclone clone main and patch repository at same time
78 78 qdelete remove patches from queue
79 79 qdiff diff of the current patch and subsequent modifications
80 80 qfinish move applied patches into repository history
81 81 qfold fold the named patches into the current patch
82 82 qgoto push or pop patches until named patch is at top of stack
83 83 qguard set or print guards for a patch
84 84 qheader print the header of the topmost or specified patch
85 85 qimport import a patch or existing changeset
86 86 qnew create a new patch
87 87 qnext print the name of the next pushable patch
88 88 qpop pop the current patch off the stack
89 89 qprev print the name of the preceding applied patch
90 90 qpush push the next patch onto the stack
91 91 qqueue manage multiple patch queues
92 92 qrefresh update the current patch
93 93 qrename rename a patch
94 94 qselect set or print guarded patches to push
95 95 qseries print the entire series file
96 96 qtop print the name of the current patch
97 97 qunapplied print the patches not yet applied
98 98
99 99 (use "hg help -v mq" to show built-in aliases and global options)
100 100
101 101 $ hg init a
102 102 $ cd a
103 103 $ echo a > a
104 104 $ hg ci -Ama
105 105 adding a
106 106
107 107 $ hg clone . ../k
108 108 updating to branch default
109 109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 110
111 111 $ mkdir b
112 112 $ echo z > b/z
113 113 $ hg ci -Ama
114 114 adding b/z
115 115
116 116
117 117 qinit
118 118
119 119 $ hg qinit
120 120
121 121 $ cd ..
122 122 $ hg init b
123 123
124 124
125 125 -R qinit
126 126
127 127 $ hg -R b qinit
128 128
129 129 $ hg init c
130 130
131 131
132 132 qinit -c
133 133
134 134 $ hg --cwd c qinit -c
135 135 $ hg -R c/.hg/patches st
136 136 A .hgignore
137 137 A series
138 138
139 139
140 140 qinit; qinit -c
141 141
142 142 $ hg init d
143 143 $ cd d
144 144 $ hg qinit
145 145 $ hg qinit -c
146 146
147 147 qinit -c should create both files if they don't exist
148 148
149 149 $ cat .hg/patches/.hgignore
150 150 ^\.hg
151 151 ^\.mq
152 152 syntax: glob
153 153 status
154 154 guards
155 155 $ cat .hg/patches/series
156 156 $ hg qinit -c
157 157 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
158 158 [255]
159 159 $ cd ..
160 160
161 161 $ echo '% qinit; <stuff>; qinit -c'
162 162 % qinit; <stuff>; qinit -c
163 163 $ hg init e
164 164 $ cd e
165 165 $ hg qnew A
166 166 $ checkundo qnew
167 167 $ echo foo > foo
168 168 $ hg phase -r qbase
169 169 0: draft
170 170 $ hg add foo
171 171 $ hg qrefresh
172 172 $ hg phase -r qbase
173 173 0: draft
174 174 $ hg qnew B
175 175 $ echo >> foo
176 176 $ hg qrefresh
177 177 $ echo status >> .hg/patches/.hgignore
178 178 $ echo bleh >> .hg/patches/.hgignore
179 179 $ hg qinit -c
180 180 adding .hg/patches/A (glob)
181 181 adding .hg/patches/B (glob)
182 182 $ hg -R .hg/patches status
183 183 A .hgignore
184 184 A A
185 185 A B
186 186 A series
187 187
188 188 qinit -c shouldn't touch these files if they already exist
189 189
190 190 $ cat .hg/patches/.hgignore
191 191 status
192 192 bleh
193 193 $ cat .hg/patches/series
194 194 A
195 195 B
196 196
197 197 add an untracked file
198 198
199 199 $ echo >> .hg/patches/flaf
200 200
201 201 status --mq with color (issue2096)
202 202
203 203 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
204 204 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
205 205 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
206 206 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
207 207 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
208 208 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
209 209
210 210 try the --mq option on a command provided by an extension
211 211
212 212 $ hg purge --mq --verbose --config extensions.purge=
213 213 removing file flaf
214 214
215 215 $ cd ..
216 216
217 217 #if no-outer-repo
218 218
219 219 init --mq without repo
220 220
221 221 $ mkdir f
222 222 $ cd f
223 223 $ hg init --mq
224 224 abort: there is no Mercurial repository here (.hg not found)
225 225 [255]
226 226 $ cd ..
227 227
228 228 #endif
229 229
230 230 init --mq with repo path
231 231
232 232 $ hg init g
233 233 $ hg init --mq g
234 234 $ test -d g/.hg/patches/.hg
235 235
236 236 init --mq with nonexistent directory
237 237
238 238 $ hg init --mq nonexistentdir
239 239 abort: repository nonexistentdir not found!
240 240 [255]
241 241
242 242
243 243 init --mq with bundle (non "local")
244 244
245 245 $ hg -R a bundle --all a.bundle >/dev/null
246 246 $ hg init --mq a.bundle
247 247 abort: only a local queue repository may be initialized
248 248 [255]
249 249
250 250 $ cd a
251 251
252 252 $ hg qnew -m 'foo bar' test.patch
253 253
254 254 $ echo '# comment' > .hg/patches/series.tmp
255 255 $ echo >> .hg/patches/series.tmp # empty line
256 256 $ cat .hg/patches/series >> .hg/patches/series.tmp
257 257 $ mv .hg/patches/series.tmp .hg/patches/series
258 258
259 259
260 260 qrefresh
261 261
262 262 $ echo a >> a
263 263 $ hg qrefresh
264 264 $ cat .hg/patches/test.patch
265 265 foo bar
266 266
267 267 diff -r [a-f0-9]* a (re)
268 268 --- a/a\t(?P<date>.*) (re)
269 269 \+\+\+ b/a\t(?P<date2>.*) (re)
270 270 @@ -1,1 +1,2 @@
271 271 a
272 272 +a
273 273
274 274 empty qrefresh
275 275
276 276 $ hg qrefresh -X a
277 277
278 278 revision:
279 279
280 280 $ hg diff -r -2 -r -1
281 281
282 282 patch:
283 283
284 284 $ cat .hg/patches/test.patch
285 285 foo bar
286 286
287 287
288 288 working dir diff:
289 289
290 290 $ hg diff --nodates -q
291 291 --- a/a
292 292 +++ b/a
293 293 @@ -1,1 +1,2 @@
294 294 a
295 295 +a
296 296
297 297 restore things
298 298
299 299 $ hg qrefresh
300 300 $ checkundo qrefresh
301 301
302 302
303 303 qpop
304 304
305 305 $ hg qpop
306 306 popping test.patch
307 307 patch queue now empty
308 308 $ checkundo qpop
309 309
310 310
311 311 qpush with dump of tag cache
312 312 Dump the tag cache to ensure that it has exactly one head after qpush.
313 313
314 314 $ rm -f .hg/cache/tags2-visible
315 315 $ hg tags > /dev/null
316 316
317 317 .hg/cache/tags2-visible (pre qpush):
318 318
319 319 $ cat .hg/cache/tags2-visible
320 320 1 [\da-f]{40} (re)
321 321 $ hg qpush
322 322 applying test.patch
323 323 now at: test.patch
324 324 $ hg phase -r qbase
325 325 2: draft
326 326 $ hg tags > /dev/null
327 327
328 328 .hg/cache/tags2-visible (post qpush):
329 329
330 330 $ cat .hg/cache/tags2-visible
331 331 2 [\da-f]{40} (re)
332 332 $ checkundo qpush
333 333 $ cd ..
334 334
335 335
336 336 pop/push outside repo
337 337 $ hg -R a qpop
338 338 popping test.patch
339 339 patch queue now empty
340 340 $ hg -R a qpush
341 341 applying test.patch
342 342 now at: test.patch
343 343
344 344 $ cd a
345 345 $ hg qnew test2.patch
346 346
347 347 qrefresh in subdir
348 348
349 349 $ cd b
350 350 $ echo a > a
351 351 $ hg add a
352 352 $ hg qrefresh
353 353
354 354 pop/push -a in subdir
355 355
356 356 $ hg qpop -a
357 357 popping test2.patch
358 358 popping test.patch
359 359 patch queue now empty
360 360 $ hg --traceback qpush -a
361 361 applying test.patch
362 362 applying test2.patch
363 363 now at: test2.patch
364 364
365 365
366 366 setting columns & formatted tests truncating (issue1912)
367 367
368 368 $ COLUMNS=4 hg qseries --config ui.formatted=true
369 369 test.patch
370 370 test2.patch
371 371 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
372 372 0 A test.patch: f...
373 373 1 A test2.patch:
374 374 $ hg qpop
375 375 popping test2.patch
376 376 now at: test.patch
377 377 $ hg qseries -vs
378 378 0 A test.patch: foo bar
379 379 1 U test2.patch:
380 380 $ hg sum | grep mq
381 381 mq: 1 applied, 1 unapplied
382 382 $ hg qpush
383 383 applying test2.patch
384 384 now at: test2.patch
385 385 $ hg sum | grep mq
386 386 mq: 2 applied
387 387 $ hg qapplied
388 388 test.patch
389 389 test2.patch
390 390 $ hg qtop
391 391 test2.patch
392 392
393 393
394 394 prev
395 395
396 396 $ hg qapp -1
397 397 test.patch
398 398
399 399 next
400 400
401 401 $ hg qunapp -1
402 402 all patches applied
403 403 [1]
404 404
405 405 $ hg qpop
406 406 popping test2.patch
407 407 now at: test.patch
408 408
409 409 commit should fail
410 410
411 411 $ hg commit
412 412 abort: cannot commit over an applied mq patch
413 413 [255]
414 414
415 415 push should fail if draft
416 416
417 417 $ hg push ../../k
418 418 pushing to ../../k
419 419 abort: source has mq patches applied
420 420 [255]
421 421
422 422
423 423 import should fail
424 424
425 425 $ hg st .
426 426 $ echo foo >> ../a
427 427 $ hg diff > ../../import.diff
428 428 $ hg revert --no-backup ../a
429 429 $ hg import ../../import.diff
430 430 abort: cannot import over an applied patch
431 431 [255]
432 432 $ hg st
433 433
434 434 import --no-commit should succeed
435 435
436 436 $ hg import --no-commit ../../import.diff
437 437 applying ../../import.diff
438 438 $ hg st
439 439 M a
440 440 $ hg revert --no-backup ../a
441 441
442 442
443 443 qunapplied
444 444
445 445 $ hg qunapplied
446 446 test2.patch
447 447
448 448
449 449 qpush/qpop with index
450 450
451 451 $ hg qnew test1b.patch
452 452 $ echo 1b > 1b
453 453 $ hg add 1b
454 454 $ hg qrefresh
455 455 $ hg qpush 2
456 456 applying test2.patch
457 457 now at: test2.patch
458 458 $ hg qpop 0
459 459 popping test2.patch
460 460 popping test1b.patch
461 461 now at: test.patch
462 462 $ hg qpush test.patch+1
463 463 applying test1b.patch
464 464 now at: test1b.patch
465 465 $ hg qpush test.patch+2
466 466 applying test2.patch
467 467 now at: test2.patch
468 468 $ hg qpop test2.patch-1
469 469 popping test2.patch
470 470 now at: test1b.patch
471 471 $ hg qpop test2.patch-2
472 472 popping test1b.patch
473 473 now at: test.patch
474 474 $ hg qpush test1b.patch+1
475 475 applying test1b.patch
476 476 applying test2.patch
477 477 now at: test2.patch
478 478
479 479
480 480 qpush --move
481 481
482 482 $ hg qpop -a
483 483 popping test2.patch
484 484 popping test1b.patch
485 485 popping test.patch
486 486 patch queue now empty
487 487 $ hg qguard test1b.patch -- -negguard
488 488 $ hg qguard test2.patch -- +posguard
489 489 $ hg qpush --move test2.patch # can't move guarded patch
490 490 cannot push 'test2.patch' - guarded by '+posguard'
491 491 [1]
492 492 $ hg qselect posguard
493 493 number of unguarded, unapplied patches has changed from 2 to 3
494 494 $ hg qpush --move test2.patch # move to front
495 495 applying test2.patch
496 496 now at: test2.patch
497 497 $ hg qpush --move test1b.patch # negative guard unselected
498 498 applying test1b.patch
499 499 now at: test1b.patch
500 500 $ hg qpush --move test.patch # noop move
501 501 applying test.patch
502 502 now at: test.patch
503 503 $ hg qseries -v
504 504 0 A test2.patch
505 505 1 A test1b.patch
506 506 2 A test.patch
507 507 $ hg qpop -a
508 508 popping test.patch
509 509 popping test1b.patch
510 510 popping test2.patch
511 511 patch queue now empty
512 512
513 513 cleaning up
514 514
515 515 $ hg qselect --none
516 516 guards deactivated
517 517 number of unguarded, unapplied patches has changed from 3 to 2
518 518 $ hg qguard --none test1b.patch
519 519 $ hg qguard --none test2.patch
520 520 $ hg qpush --move test.patch
521 521 applying test.patch
522 522 now at: test.patch
523 523 $ hg qpush --move test1b.patch
524 524 applying test1b.patch
525 525 now at: test1b.patch
526 526 $ hg qpush --move bogus # nonexistent patch
527 527 abort: patch bogus not in series
528 528 [255]
529 529 $ hg qpush --move # no patch
530 530 abort: please specify the patch to move
531 531 [255]
532 532 $ hg qpush --move test.patch # already applied
533 533 abort: cannot push to a previous patch: test.patch
534 534 [255]
535 535 $ sed '2i\
536 536 > # make qtip index different in series and fullseries
537 537 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
538 538 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
539 539 $ cat `hg root`/.hg/patches/series
540 540 # comment
541 541 # make qtip index different in series and fullseries
542 542
543 543 test.patch
544 544 test1b.patch
545 545 test2.patch
546 546 $ hg qpush --move test2.patch
547 547 applying test2.patch
548 548 now at: test2.patch
549 549
550 550
551 551 series after move
552 552
553 553 $ cat `hg root`/.hg/patches/series
554 554 # comment
555 555 # make qtip index different in series and fullseries
556 556
557 557 test.patch
558 558 test1b.patch
559 559 test2.patch
560 560
561 561
562 562 pop, qapplied, qunapplied
563 563
564 564 $ hg qseries -v
565 565 0 A test.patch
566 566 1 A test1b.patch
567 567 2 A test2.patch
568 568
569 569 qapplied -1 test.patch
570 570
571 571 $ hg qapplied -1 test.patch
572 572 only one patch applied
573 573 [1]
574 574
575 575 qapplied -1 test1b.patch
576 576
577 577 $ hg qapplied -1 test1b.patch
578 578 test.patch
579 579
580 580 qapplied -1 test2.patch
581 581
582 582 $ hg qapplied -1 test2.patch
583 583 test1b.patch
584 584
585 585 qapplied -1
586 586
587 587 $ hg qapplied -1
588 588 test1b.patch
589 589
590 590 qapplied
591 591
592 592 $ hg qapplied
593 593 test.patch
594 594 test1b.patch
595 595 test2.patch
596 596
597 597 qapplied test1b.patch
598 598
599 599 $ hg qapplied test1b.patch
600 600 test.patch
601 601 test1b.patch
602 602
603 603 qunapplied -1
604 604
605 605 $ hg qunapplied -1
606 606 all patches applied
607 607 [1]
608 608
609 609 qunapplied
610 610
611 611 $ hg qunapplied
612 612
613 613 popping
614 614
615 615 $ hg qpop
616 616 popping test2.patch
617 617 now at: test1b.patch
618 618
619 619 qunapplied -1
620 620
621 621 $ hg qunapplied -1
622 622 test2.patch
623 623
624 624 qunapplied
625 625
626 626 $ hg qunapplied
627 627 test2.patch
628 628
629 629 qunapplied test2.patch
630 630
631 631 $ hg qunapplied test2.patch
632 632
633 633 qunapplied -1 test2.patch
634 634
635 635 $ hg qunapplied -1 test2.patch
636 636 all patches applied
637 637 [1]
638 638
639 639 popping -a
640 640
641 641 $ hg qpop -a
642 642 popping test1b.patch
643 643 popping test.patch
644 644 patch queue now empty
645 645
646 646 qapplied
647 647
648 648 $ hg qapplied
649 649
650 650 qapplied -1
651 651
652 652 $ hg qapplied -1
653 653 no patches applied
654 654 [1]
655 655 $ hg qpush
656 656 applying test.patch
657 657 now at: test.patch
658 658
659 659
660 660 push should succeed
661 661
662 662 $ hg qpop -a
663 663 popping test.patch
664 664 patch queue now empty
665 665 $ hg push ../../k
666 666 pushing to ../../k
667 667 searching for changes
668 668 adding changesets
669 669 adding manifests
670 670 adding file changes
671 671 added 1 changesets with 1 changes to 1 files
672 672
673 673
674 674 we want to start with some patches applied
675 675
676 676 $ hg qpush -a
677 677 applying test.patch
678 678 applying test1b.patch
679 679 applying test2.patch
680 680 now at: test2.patch
681 681
682 682 % pops all patches and succeeds
683 683
684 684 $ hg qpop -a
685 685 popping test2.patch
686 686 popping test1b.patch
687 687 popping test.patch
688 688 patch queue now empty
689 689
690 690 % does nothing and succeeds
691 691
692 692 $ hg qpop -a
693 693 no patches applied
694 694
695 695 % fails - nothing else to pop
696 696
697 697 $ hg qpop
698 698 no patches applied
699 699 [1]
700 700
701 701 % pushes a patch and succeeds
702 702
703 703 $ hg qpush
704 704 applying test.patch
705 705 now at: test.patch
706 706
707 707 % pops a patch and succeeds
708 708
709 709 $ hg qpop
710 710 popping test.patch
711 711 patch queue now empty
712 712
713 713 % pushes up to test1b.patch and succeeds
714 714
715 715 $ hg qpush test1b.patch
716 716 applying test.patch
717 717 applying test1b.patch
718 718 now at: test1b.patch
719 719
720 720 % does nothing and succeeds
721 721
722 722 $ hg qpush test1b.patch
723 723 qpush: test1b.patch is already at the top
724 724
725 725 % does nothing and succeeds
726 726
727 727 $ hg qpop test1b.patch
728 728 qpop: test1b.patch is already at the top
729 729
730 730 % fails - can't push to this patch
731 731
732 732 $ hg qpush test.patch
733 733 abort: cannot push to a previous patch: test.patch
734 734 [255]
735 735
736 736 % fails - can't pop to this patch
737 737
738 738 $ hg qpop test2.patch
739 739 abort: patch test2.patch is not applied
740 740 [255]
741 741
742 742 % pops up to test.patch and succeeds
743 743
744 744 $ hg qpop test.patch
745 745 popping test1b.patch
746 746 now at: test.patch
747 747
748 748 % pushes all patches and succeeds
749 749
750 750 $ hg qpush -a
751 751 applying test1b.patch
752 752 applying test2.patch
753 753 now at: test2.patch
754 754
755 755 % does nothing and succeeds
756 756
757 757 $ hg qpush -a
758 758 all patches are currently applied
759 759
760 760 % fails - nothing else to push
761 761
762 762 $ hg qpush
763 763 patch series already fully applied
764 764 [1]
765 765
766 766 % does nothing and succeeds
767 767
768 768 $ hg qpush test2.patch
769 769 qpush: test2.patch is already at the top
770 770
771 771 strip
772 772
773 773 $ cd ../../b
774 774 $ echo x>x
775 775 $ hg ci -Ama
776 776 adding x
777 777 $ hg strip tip
778 778 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
779 779 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
780 780 $ hg unbundle .hg/strip-backup/*
781 781 adding changesets
782 782 adding manifests
783 783 adding file changes
784 784 added 1 changesets with 1 changes to 1 files
785 785 (run 'hg update' to get a working copy)
786 786
787 787
788 788 strip with local changes, should complain
789 789
790 790 $ hg up
791 791 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
792 792 $ echo y>y
793 793 $ hg add y
794 794 $ hg strip tip
795 795 abort: local changes found
796 796 [255]
797 797
798 798 --force strip with local changes
799 799
800 800 $ hg strip -f tip
801 801 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
802 802 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg (glob)
803 803 $ cd ..
804 804
805 805
806 806 cd b; hg qrefresh
807 807
808 808 $ hg init refresh
809 809 $ cd refresh
810 810 $ echo a > a
811 811 $ hg ci -Ama
812 812 adding a
813 813 $ hg qnew -mfoo foo
814 814 $ echo a >> a
815 815 $ hg qrefresh
816 816 $ mkdir b
817 817 $ cd b
818 818 $ echo f > f
819 819 $ hg add f
820 820 $ hg qrefresh
821 821 $ cat ../.hg/patches/foo
822 822 foo
823 823
824 824 diff -r cb9a9f314b8b a
825 825 --- a/a\t(?P<date>.*) (re)
826 826 \+\+\+ b/a\t(?P<date>.*) (re)
827 827 @@ -1,1 +1,2 @@
828 828 a
829 829 +a
830 830 diff -r cb9a9f314b8b b/f
831 831 --- /dev/null\t(?P<date>.*) (re)
832 832 \+\+\+ b/b/f\t(?P<date>.*) (re)
833 833 @@ -0,0 +1,1 @@
834 834 +f
835 835
836 836 hg qrefresh .
837 837
838 838 $ hg qrefresh .
839 839 $ cat ../.hg/patches/foo
840 840 foo
841 841
842 842 diff -r cb9a9f314b8b b/f
843 843 --- /dev/null\t(?P<date>.*) (re)
844 844 \+\+\+ b/b/f\t(?P<date>.*) (re)
845 845 @@ -0,0 +1,1 @@
846 846 +f
847 847 $ hg status
848 848 M a
849 849
850 850
851 851 qpush failure
852 852
853 853 $ cd ..
854 854 $ hg qrefresh
855 855 $ hg qnew -mbar bar
856 856 $ echo foo > foo
857 857 $ echo bar > bar
858 858 $ hg add foo bar
859 859 $ hg qrefresh
860 860 $ hg qpop -a
861 861 popping bar
862 862 popping foo
863 863 patch queue now empty
864 864 $ echo bar > foo
865 865 $ hg qpush -a
866 866 applying foo
867 867 applying bar
868 868 file foo already exists
869 869 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
870 870 patch failed, unable to continue (try -v)
871 871 patch failed, rejects left in working directory
872 872 errors during apply, please fix and qrefresh bar
873 873 [2]
874 874 $ hg st
875 875 ? foo
876 876 ? foo.rej
877 877
878 878
879 879 mq tags
880 880
881 881 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
882 882 0 qparent
883 883 1 foo qbase
884 884 2 bar qtip tip
885 885
886 886 mq revset
887 887
888 888 $ hg log -r 'mq()' --template '{rev}\n'
889 889 1
890 890 2
891 891 $ hg help revsets | grep -i mq
892 892 "mq()"
893 893 Changesets managed by MQ.
894 894
895 895 bad node in status
896 896
897 897 $ hg qpop
898 898 popping bar
899 899 now at: foo
900 900 $ hg strip -qn tip
901 901 $ hg tip
902 902 changeset: 0:cb9a9f314b8b
903 903 tag: tip
904 904 user: test
905 905 date: Thu Jan 01 00:00:00 1970 +0000
906 906 summary: a
907 907
908 908 $ hg branches
909 909 default 0:cb9a9f314b8b
910 910 $ hg qpop
911 911 no patches applied
912 912 [1]
913 913
914 914 $ cd ..
915 915
916 916
917 917 git patches
918 918
919 919 $ cat >>$HGRCPATH <<EOF
920 920 > [diff]
921 921 > git = True
922 922 > EOF
923 923 $ hg init git
924 924 $ cd git
925 925 $ hg qinit
926 926
927 927 $ hg qnew -m'new file' new
928 928 $ echo foo > new
929 929 #if execbit
930 930 $ chmod +x new
931 931 #endif
932 932 $ hg add new
933 933 $ hg qrefresh
934 934 #if execbit
935 935 $ cat .hg/patches/new
936 936 new file
937 937
938 938 diff --git a/new b/new
939 939 new file mode 100755
940 940 --- /dev/null
941 941 +++ b/new
942 942 @@ -0,0 +1,1 @@
943 943 +foo
944 944 #else
945 945 $ cat .hg/patches/new
946 946 new file
947 947
948 948 diff --git a/new b/new
949 949 new file mode 100644
950 950 --- /dev/null
951 951 +++ b/new
952 952 @@ -0,0 +1,1 @@
953 953 +foo
954 954 #endif
955 955
956 956 $ hg qnew -m'copy file' copy
957 957 $ hg cp new copy
958 958 $ hg qrefresh
959 959 $ cat .hg/patches/copy
960 960 copy file
961 961
962 962 diff --git a/new b/copy
963 963 copy from new
964 964 copy to copy
965 965
966 966 $ hg qpop
967 967 popping copy
968 968 now at: new
969 969 $ hg qpush
970 970 applying copy
971 971 now at: copy
972 972 $ hg qdiff
973 973 diff --git a/new b/copy
974 974 copy from new
975 975 copy to copy
976 976 $ cat >>$HGRCPATH <<EOF
977 977 > [diff]
978 978 > git = False
979 979 > EOF
980 980 $ hg qdiff --git
981 981 diff --git a/new b/copy
982 982 copy from new
983 983 copy to copy
984 984 $ cd ..
985 985
986 986 empty lines in status
987 987
988 988 $ hg init emptystatus
989 989 $ cd emptystatus
990 990 $ hg qinit
991 991 $ printf '\n\n' > .hg/patches/status
992 992 $ hg qser
993 993 $ cd ..
994 994
995 995 bad line in status (without ":")
996 996
997 997 $ hg init badstatus
998 998 $ cd badstatus
999 999 $ hg qinit
1000 1000 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1001 1001 $ hg qser
1002 1002 malformated mq status line: ['babar has no colon in this line']
1003 1003 $ cd ..
1004 1004
1005 1005
1006 1006 test file addition in slow path
1007 1007
1008 1008 $ hg init slow
1009 1009 $ cd slow
1010 1010 $ hg qinit
1011 1011 $ echo foo > foo
1012 1012 $ hg add foo
1013 1013 $ hg ci -m 'add foo'
1014 1014 $ hg qnew bar
1015 1015 $ echo bar > bar
1016 1016 $ hg add bar
1017 1017 $ hg mv foo baz
1018 1018 $ hg qrefresh --git
1019 1019 $ hg up -C 0
1020 1020 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1021 1021 $ echo >> foo
1022 1022 $ hg ci -m 'change foo'
1023 1023 created new head
1024 1024 $ hg up -C 1
1025 1025 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1026 1026 $ hg qrefresh --git
1027 1027 $ cat .hg/patches/bar
1028 1028 diff --git a/bar b/bar
1029 1029 new file mode 100644
1030 1030 --- /dev/null
1031 1031 +++ b/bar
1032 1032 @@ -0,0 +1,1 @@
1033 1033 +bar
1034 1034 diff --git a/foo b/baz
1035 1035 rename from foo
1036 1036 rename to baz
1037 1037 $ hg log -v --template '{rev} {file_copies}\n' -r .
1038 1038 2 baz (foo)
1039 1039 $ hg qrefresh --git
1040 1040 $ cat .hg/patches/bar
1041 1041 diff --git a/bar b/bar
1042 1042 new file mode 100644
1043 1043 --- /dev/null
1044 1044 +++ b/bar
1045 1045 @@ -0,0 +1,1 @@
1046 1046 +bar
1047 1047 diff --git a/foo b/baz
1048 1048 rename from foo
1049 1049 rename to baz
1050 1050 $ hg log -v --template '{rev} {file_copies}\n' -r .
1051 1051 2 baz (foo)
1052 1052 $ hg qrefresh
1053 1053 $ grep 'diff --git' .hg/patches/bar
1054 1054 diff --git a/bar b/bar
1055 1055 diff --git a/foo b/baz
1056 1056
1057 1057
1058 1058 test file move chains in the slow path
1059 1059
1060 1060 $ hg up -C 1
1061 1061 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1062 1062 $ echo >> foo
1063 1063 $ hg ci -m 'change foo again'
1064 1064 $ hg up -C 2
1065 1065 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1066 1066 $ hg mv bar quux
1067 1067 $ hg mv baz bleh
1068 1068 $ hg qrefresh --git
1069 1069 $ cat .hg/patches/bar
1070 1070 diff --git a/foo b/bleh
1071 1071 rename from foo
1072 1072 rename to bleh
1073 1073 diff --git a/quux b/quux
1074 1074 new file mode 100644
1075 1075 --- /dev/null
1076 1076 +++ b/quux
1077 1077 @@ -0,0 +1,1 @@
1078 1078 +bar
1079 1079 $ hg log -v --template '{rev} {file_copies}\n' -r .
1080 1080 3 bleh (foo)
1081 1081 $ hg mv quux fred
1082 1082 $ hg mv bleh barney
1083 1083 $ hg qrefresh --git
1084 1084 $ cat .hg/patches/bar
1085 1085 diff --git a/foo b/barney
1086 1086 rename from foo
1087 1087 rename to barney
1088 1088 diff --git a/fred b/fred
1089 1089 new file mode 100644
1090 1090 --- /dev/null
1091 1091 +++ b/fred
1092 1092 @@ -0,0 +1,1 @@
1093 1093 +bar
1094 1094 $ hg log -v --template '{rev} {file_copies}\n' -r .
1095 1095 3 barney (foo)
1096 1096
1097 1097
1098 1098 refresh omitting an added file
1099 1099
1100 1100 $ hg qnew baz
1101 1101 $ echo newfile > newfile
1102 1102 $ hg add newfile
1103 1103 $ hg qrefresh
1104 1104 $ hg st -A newfile
1105 1105 C newfile
1106 1106 $ hg qrefresh -X newfile
1107 1107 $ hg st -A newfile
1108 1108 A newfile
1109 1109 $ hg revert newfile
1110 1110 $ rm newfile
1111 1111 $ hg qpop
1112 1112 popping baz
1113 1113 now at: bar
1114 1114
1115 1115 test qdel/qrm
1116 1116
1117 1117 $ hg qdel baz
1118 1118 $ echo p >> .hg/patches/series
1119 1119 $ hg qrm p
1120 1120 $ hg qser
1121 1121 bar
1122 1122
1123 1123 create a git patch
1124 1124
1125 1125 $ echo a > alexander
1126 1126 $ hg add alexander
1127 1127 $ hg qnew -f --git addalexander
1128 1128 $ grep diff .hg/patches/addalexander
1129 1129 diff --git a/alexander b/alexander
1130 1130
1131 1131
1132 1132 create a git binary patch
1133 1133
1134 1134 $ cat > writebin.py <<EOF
1135 1135 > import sys
1136 1136 > path = sys.argv[1]
1137 1137 > open(path, 'wb').write('BIN\x00ARY')
1138 1138 > EOF
1139 1139 $ python writebin.py bucephalus
1140 1140
1141 1141 $ python "$TESTDIR/md5sum.py" bucephalus
1142 1142 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1143 1143 $ hg add bucephalus
1144 1144 $ hg qnew -f --git addbucephalus
1145 1145 $ grep diff .hg/patches/addbucephalus
1146 1146 diff --git a/bucephalus b/bucephalus
1147 1147
1148 1148
1149 1149 check binary patches can be popped and pushed
1150 1150
1151 1151 $ hg qpop
1152 1152 popping addbucephalus
1153 1153 now at: addalexander
1154 1154 $ test -f bucephalus && echo % bucephalus should not be there
1155 1155 [1]
1156 1156 $ hg qpush
1157 1157 applying addbucephalus
1158 1158 now at: addbucephalus
1159 1159 $ test -f bucephalus
1160 1160 $ python "$TESTDIR/md5sum.py" bucephalus
1161 1161 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1162 1162
1163 1163
1164 1164
1165 1165 strip again
1166 1166
1167 1167 $ cd ..
1168 1168 $ hg init strip
1169 1169 $ cd strip
1170 1170 $ touch foo
1171 1171 $ hg add foo
1172 1172 $ hg ci -m 'add foo'
1173 1173 $ echo >> foo
1174 1174 $ hg ci -m 'change foo 1'
1175 1175 $ hg up -C 0
1176 1176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1177 1177 $ echo 1 >> foo
1178 1178 $ hg ci -m 'change foo 2'
1179 1179 created new head
1180 1180 $ HGMERGE=true hg merge
1181 1181 merging foo
1182 1182 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1183 1183 (branch merge, don't forget to commit)
1184 1184 $ hg ci -m merge
1185 1185 $ hg log
1186 1186 changeset: 3:99615015637b
1187 1187 tag: tip
1188 1188 parent: 2:20cbbe65cff7
1189 1189 parent: 1:d2871fc282d4
1190 1190 user: test
1191 1191 date: Thu Jan 01 00:00:00 1970 +0000
1192 1192 summary: merge
1193 1193
1194 1194 changeset: 2:20cbbe65cff7
1195 1195 parent: 0:53245c60e682
1196 1196 user: test
1197 1197 date: Thu Jan 01 00:00:00 1970 +0000
1198 1198 summary: change foo 2
1199 1199
1200 1200 changeset: 1:d2871fc282d4
1201 1201 user: test
1202 1202 date: Thu Jan 01 00:00:00 1970 +0000
1203 1203 summary: change foo 1
1204 1204
1205 1205 changeset: 0:53245c60e682
1206 1206 user: test
1207 1207 date: Thu Jan 01 00:00:00 1970 +0000
1208 1208 summary: add foo
1209 1209
1210 1210 $ hg strip 1
1211 1211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1212 1212 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1213 1213 $ checkundo strip
1214 1214 $ hg log
1215 1215 changeset: 1:20cbbe65cff7
1216 1216 tag: tip
1217 1217 user: test
1218 1218 date: Thu Jan 01 00:00:00 1970 +0000
1219 1219 summary: change foo 2
1220 1220
1221 1221 changeset: 0:53245c60e682
1222 1222 user: test
1223 1223 date: Thu Jan 01 00:00:00 1970 +0000
1224 1224 summary: add foo
1225 1225
1226 1226 $ cd ..
1227 1227
1228 1228
1229 1229 qclone
1230 1230
1231 1231 $ qlog()
1232 1232 > {
1233 1233 > echo 'main repo:'
1234 1234 > hg log --template ' rev {rev}: {desc}\n'
1235 1235 > echo 'patch repo:'
1236 1236 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1237 1237 > }
1238 1238 $ hg init qclonesource
1239 1239 $ cd qclonesource
1240 1240 $ echo foo > foo
1241 1241 $ hg add foo
1242 1242 $ hg ci -m 'add foo'
1243 1243 $ hg qinit
1244 1244 $ hg qnew patch1
1245 1245 $ echo bar >> foo
1246 1246 $ hg qrefresh -m 'change foo'
1247 1247 $ cd ..
1248 1248
1249 1249
1250 1250 repo with unversioned patch dir
1251 1251
1252 1252 $ hg qclone qclonesource failure
1253 1253 abort: versioned patch repository not found (see init --mq)
1254 1254 [255]
1255 1255
1256 1256 $ cd qclonesource
1257 1257 $ hg qinit -c
1258 1258 adding .hg/patches/patch1 (glob)
1259 1259 $ hg qci -m checkpoint
1260 1260 $ qlog
1261 1261 main repo:
1262 1262 rev 1: change foo
1263 1263 rev 0: add foo
1264 1264 patch repo:
1265 1265 rev 0: checkpoint
1266 1266 $ cd ..
1267 1267
1268 1268
1269 1269 repo with patches applied
1270 1270
1271 1271 $ hg qclone qclonesource qclonedest
1272 1272 updating to branch default
1273 1273 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1274 1274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1275 1275 $ cd qclonedest
1276 1276 $ qlog
1277 1277 main repo:
1278 1278 rev 0: add foo
1279 1279 patch repo:
1280 1280 rev 0: checkpoint
1281 1281 $ cd ..
1282 1282
1283 1283
1284 1284 repo with patches unapplied
1285 1285
1286 1286 $ cd qclonesource
1287 1287 $ hg qpop -a
1288 1288 popping patch1
1289 1289 patch queue now empty
1290 1290 $ qlog
1291 1291 main repo:
1292 1292 rev 0: add foo
1293 1293 patch repo:
1294 1294 rev 0: checkpoint
1295 1295 $ cd ..
1296 1296 $ hg qclone qclonesource qclonedest2
1297 1297 updating to branch default
1298 1298 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1299 1299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1300 1300 $ cd qclonedest2
1301 1301 $ qlog
1302 1302 main repo:
1303 1303 rev 0: add foo
1304 1304 patch repo:
1305 1305 rev 0: checkpoint
1306 1306 $ cd ..
1307 1307
1308 1308
1309 1309 Issue1033: test applying on an empty file
1310 1310
1311 1311 $ hg init empty
1312 1312 $ cd empty
1313 1313 $ touch a
1314 1314 $ hg ci -Am addempty
1315 1315 adding a
1316 1316 $ echo a > a
1317 1317 $ hg qnew -f -e changea
1318 1318 $ hg qpop
1319 1319 popping changea
1320 1320 patch queue now empty
1321 1321 $ hg qpush
1322 1322 applying changea
1323 1323 now at: changea
1324 1324 $ cd ..
1325 1325
1326 1326 test qpush with --force, issue1087
1327 1327
1328 1328 $ hg init forcepush
1329 1329 $ cd forcepush
1330 1330 $ echo hello > hello.txt
1331 1331 $ echo bye > bye.txt
1332 1332 $ hg ci -Ama
1333 1333 adding bye.txt
1334 1334 adding hello.txt
1335 1335 $ hg qnew -d '0 0' empty
1336 1336 $ hg qpop
1337 1337 popping empty
1338 1338 patch queue now empty
1339 1339 $ echo world >> hello.txt
1340 1340
1341 1341
1342 1342 qpush should fail, local changes
1343 1343
1344 1344 $ hg qpush
1345 1345 abort: local changes found
1346 1346 [255]
1347 1347
1348 1348
1349 1349 apply force, should not discard changes with empty patch
1350 1350
1351 1351 $ hg qpush -f
1352 1352 applying empty
1353 1353 patch empty is empty
1354 1354 now at: empty
1355 1355 $ hg diff --config diff.nodates=True
1356 1356 diff -r d58265112590 hello.txt
1357 1357 --- a/hello.txt
1358 1358 +++ b/hello.txt
1359 1359 @@ -1,1 +1,2 @@
1360 1360 hello
1361 1361 +world
1362 1362 $ hg qdiff --config diff.nodates=True
1363 1363 diff -r 9ecee4f634e3 hello.txt
1364 1364 --- a/hello.txt
1365 1365 +++ b/hello.txt
1366 1366 @@ -1,1 +1,2 @@
1367 1367 hello
1368 1368 +world
1369 1369 $ hg log -l1 -p
1370 1370 changeset: 1:d58265112590
1371 1371 tag: empty
1372 1372 tag: qbase
1373 1373 tag: qtip
1374 1374 tag: tip
1375 1375 user: test
1376 1376 date: Thu Jan 01 00:00:00 1970 +0000
1377 1377 summary: imported patch empty
1378 1378
1379 1379
1380 1380 $ hg qref -d '0 0'
1381 1381 $ hg qpop
1382 1382 popping empty
1383 1383 patch queue now empty
1384 1384 $ echo universe >> hello.txt
1385 1385 $ echo universe >> bye.txt
1386 1386
1387 1387
1388 1388 qpush should fail, local changes
1389 1389
1390 1390 $ hg qpush
1391 1391 abort: local changes found
1392 1392 [255]
1393 1393
1394 1394
1395 1395 apply force, should discard changes in hello, but not bye
1396 1396
1397 1397 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1398 1398 applying empty
1399 1399 creating directory: $TESTTMP/forcepush/.hg/origbackups (glob)
1400 1400 saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt.orig (glob)
1401 1401 patching file hello.txt
1402 1402 committing files:
1403 1403 hello.txt
1404 1404 committing manifest
1405 1405 committing changelog
1406 1406 now at: empty
1407 1407 $ hg st
1408 1408 M bye.txt
1409 1409 $ hg diff --config diff.nodates=True
1410 1410 diff -r ba252371dbc1 bye.txt
1411 1411 --- a/bye.txt
1412 1412 +++ b/bye.txt
1413 1413 @@ -1,1 +1,2 @@
1414 1414 bye
1415 1415 +universe
1416 1416 $ hg qdiff --config diff.nodates=True
1417 1417 diff -r 9ecee4f634e3 bye.txt
1418 1418 --- a/bye.txt
1419 1419 +++ b/bye.txt
1420 1420 @@ -1,1 +1,2 @@
1421 1421 bye
1422 1422 +universe
1423 1423 diff -r 9ecee4f634e3 hello.txt
1424 1424 --- a/hello.txt
1425 1425 +++ b/hello.txt
1426 1426 @@ -1,1 +1,3 @@
1427 1427 hello
1428 1428 +world
1429 1429 +universe
1430 1430
1431 1431 test that the previous call to qpush with -f (--force) and --config actually put
1432 1432 the orig files out of the working copy
1433 1433 $ ls .hg/origbackups
1434 1434 hello.txt.orig
1435 1435
1436 1436 test popping revisions not in working dir ancestry
1437 1437
1438 1438 $ hg qseries -v
1439 1439 0 A empty
1440 1440 $ hg up qparent
1441 1441 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1442 1442 $ hg qpop
1443 1443 popping empty
1444 1444 patch queue now empty
1445 1445
1446 1446 $ cd ..
1447 1447 $ hg init deletion-order
1448 1448 $ cd deletion-order
1449 1449
1450 1450 $ touch a
1451 1451 $ hg ci -Aqm0
1452 1452
1453 1453 $ hg qnew rename-dir
1454 1454 $ hg rm a
1455 1455 $ hg qrefresh
1456 1456
1457 1457 $ mkdir a b
1458 1458 $ touch a/a b/b
1459 1459 $ hg add -q a b
1460 1460 $ hg qrefresh
1461 1461
1462 1462
1463 1463 test popping must remove files added in subdirectories first
1464 1464
1465 1465 $ hg qpop
1466 1466 popping rename-dir
1467 1467 patch queue now empty
1468 1468 $ cd ..
1469 1469
1470 1470
1471 1471 test case preservation through patch pushing especially on case
1472 1472 insensitive filesystem
1473 1473
1474 1474 $ hg init casepreserve
1475 1475 $ cd casepreserve
1476 1476
1477 1477 $ hg qnew add-file1
1478 1478 $ echo a > TeXtFiLe.TxT
1479 1479 $ hg add TeXtFiLe.TxT
1480 1480 $ hg qrefresh
1481 1481
1482 1482 $ hg qnew add-file2
1483 1483 $ echo b > AnOtHeRFiLe.TxT
1484 1484 $ hg add AnOtHeRFiLe.TxT
1485 1485 $ hg qrefresh
1486 1486
1487 1487 $ hg qnew modify-file
1488 1488 $ echo c >> AnOtHeRFiLe.TxT
1489 1489 $ hg qrefresh
1490 1490
1491 1491 $ hg qapplied
1492 1492 add-file1
1493 1493 add-file2
1494 1494 modify-file
1495 1495 $ hg qpop -a
1496 1496 popping modify-file
1497 1497 popping add-file2
1498 1498 popping add-file1
1499 1499 patch queue now empty
1500 1500
1501 1501 this qpush causes problems below, if case preservation on case
1502 1502 insensitive filesystem is not enough:
1503 1503 (1) unexpected "adding ..." messages are shown
1504 1504 (2) patching fails in modification of (1) files
1505 1505
1506 1506 $ hg qpush -a
1507 1507 applying add-file1
1508 1508 applying add-file2
1509 1509 applying modify-file
1510 1510 now at: modify-file
1511 1511
1512 1512 Proper phase default with mq:
1513 1513
1514 1514 1. mq.secret=false
1515 1515
1516 1516 $ rm .hg/store/phaseroots
1517 1517 $ hg phase 'qparent::'
1518 1518 -1: public
1519 1519 0: draft
1520 1520 1: draft
1521 1521 2: draft
1522 1522 $ echo '[mq]' >> $HGRCPATH
1523 1523 $ echo 'secret=true' >> $HGRCPATH
1524 1524 $ rm -f .hg/store/phaseroots
1525 1525 $ hg phase 'qparent::'
1526 1526 -1: public
1527 1527 0: secret
1528 1528 1: secret
1529 1529 2: secret
1530 1530
1531 1531 Test that qfinish change phase when mq.secret=true
1532 1532
1533 1533 $ hg qfinish qbase
1534 1534 patch add-file1 finalized without changeset message
1535 1535 $ hg phase 'all()'
1536 1536 0: draft
1537 1537 1: secret
1538 1538 2: secret
1539 1539
1540 1540 Test that qfinish respect phases.new-commit setting
1541 1541
1542 1542 $ echo '[phases]' >> $HGRCPATH
1543 1543 $ echo 'new-commit=secret' >> $HGRCPATH
1544 1544 $ hg qfinish qbase
1545 1545 patch add-file2 finalized without changeset message
1546 1546 $ hg phase 'all()'
1547 1547 0: draft
1548 1548 1: secret
1549 1549 2: secret
1550 1550
1551 1551 (restore env for next test)
1552 1552
1553 1553 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1554 1554 $ cp $TESTTMP/sedtmp $HGRCPATH
1555 1555 $ hg qimport -r 1 --name add-file2
1556 1556
1557 1557 Test that qfinish preserve phase when mq.secret=false
1558 1558
1559 1559 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1560 1560 $ cp $TESTTMP/sedtmp $HGRCPATH
1561 1561 $ hg qfinish qbase
1562 1562 patch add-file2 finalized without changeset message
1563 1563 $ hg phase 'all()'
1564 1564 0: draft
1565 1565 1: secret
1566 1566 2: secret
1567 1567
1568 1568 Test that secret mq patch does not break hgweb
1569 1569
1570 1570 $ cat > hgweb.cgi <<HGWEB
1571 1571 > from mercurial import demandimport; demandimport.enable()
1572 1572 > from mercurial.hgweb import hgweb
1573 1573 > from mercurial.hgweb import wsgicgi
1574 1574 > import cgitb
1575 1575 > cgitb.enable()
1576 1576 > app = hgweb('.', 'test')
1577 1577 > wsgicgi.launch(app)
1578 1578 > HGWEB
1579 1579 $ . "$TESTDIR/cgienv"
1580 1580 #if msys
1581 1581 $ PATH_INFO=//tags; export PATH_INFO
1582 1582 #else
1583 1583 $ PATH_INFO=/tags; export PATH_INFO
1584 1584 #endif
1585 1585 $ QUERY_STRING='style=raw'
1586 1586 $ python hgweb.cgi | grep '^tip'
1587 1587 tip [0-9a-f]{40} (re)
1588 1588
1589 1589 $ cd ..
1590 1590
1591 1591 Test interaction with revset (issue4426)
1592 1592
1593 1593 $ hg init issue4426
1594 1594 $ cd issue4426
1595 1595
1596 1596 $ echo a > a
1597 1597 $ hg ci -Am a
1598 1598 adding a
1599 1599 $ echo a >> a
1600 1600 $ hg ci -m a
1601 1601 $ echo a >> a
1602 1602 $ hg ci -m a
1603 1603 $ hg qimport -r 0::
1604 1604
1605 1605 reimport things
1606 1606
1607 1607 $ hg qimport -r 1::
1608 1608 abort: revision 2 is already managed
1609 1609 [255]
1610 1610
1611 1611
1612 1612 $ cd ..
@@ -1,555 +1,555 b''
1 1
2 2 $ cat <<EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > notify=
5 5 >
6 6 > [hooks]
7 7 > incoming.notify = python:hgext.notify.hook
8 8 >
9 9 > [notify]
10 10 > sources = pull
11 11 > diffstat = False
12 12 >
13 13 > [usersubs]
14 14 > foo@bar = *
15 15 >
16 16 > [reposubs]
17 17 > * = baz
18 18 > EOF
19 19 $ hg help notify
20 20 notify extension - hooks for sending email push notifications
21 21
22 22 This extension implements hooks to send email notifications when changesets
23 23 are sent from or received by the local repository.
24 24
25 First, enable the extension as explained in "hg help extensions", and register
25 First, enable the extension as explained in 'hg help extensions', and register
26 26 the hook you want to run. "incoming" and "changegroup" hooks are run when
27 27 changesets are received, while "outgoing" hooks are for changesets sent to
28 28 another repository:
29 29
30 30 [hooks]
31 31 # one email for each incoming changeset
32 32 incoming.notify = python:hgext.notify.hook
33 33 # one email for all incoming changesets
34 34 changegroup.notify = python:hgext.notify.hook
35 35
36 36 # one email for all outgoing changesets
37 37 outgoing.notify = python:hgext.notify.hook
38 38
39 39 This registers the hooks. To enable notification, subscribers must be assigned
40 40 to repositories. The "[usersubs]" section maps multiple repositories to a
41 41 given recipient. The "[reposubs]" section maps multiple recipients to a single
42 42 repository:
43 43
44 44 [usersubs]
45 45 # key is subscriber email, value is a comma-separated list of repo patterns
46 46 user@host = pattern
47 47
48 48 [reposubs]
49 49 # key is repo pattern, value is a comma-separated list of subscriber emails
50 50 pattern = user@host
51 51
52 52 A "pattern" is a "glob" matching the absolute path to a repository, optionally
53 53 combined with a revset expression. A revset expression, if present, is
54 54 separated from the glob by a hash. Example:
55 55
56 56 [reposubs]
57 57 */widgets#branch(release) = qa-team@example.com
58 58
59 59 This sends to "qa-team@example.com" whenever a changeset on the "release"
60 60 branch triggers a notification in any repository ending in "widgets".
61 61
62 62 In order to place them under direct user management, "[usersubs]" and
63 63 "[reposubs]" sections may be placed in a separate "hgrc" file and incorporated
64 64 by reference:
65 65
66 66 [notify]
67 67 config = /path/to/subscriptionsfile
68 68
69 69 Notifications will not be sent until the "notify.test" value is set to
70 70 "False"; see below.
71 71
72 72 Notifications content can be tweaked with the following configuration entries:
73 73
74 74 notify.test
75 75 If "True", print messages to stdout instead of sending them. Default: True.
76 76
77 77 notify.sources
78 78 Space-separated list of change sources. Notifications are activated only
79 79 when a changeset's source is in this list. Sources may be:
80 80
81 81 "serve" changesets received via http or ssh
82 82 "pull" changesets received via "hg pull"
83 83 "unbundle" changesets received via "hg unbundle"
84 84 "push" changesets sent or received via "hg push"
85 85 "bundle" changesets sent via "hg unbundle"
86 86
87 87 Default: serve.
88 88
89 89 notify.strip
90 90 Number of leading slashes to strip from url paths. By default, notifications
91 91 reference repositories with their absolute path. "notify.strip" lets you
92 92 turn them into relative paths. For example, "notify.strip=3" will change
93 93 "/long/path/repository" into "repository". Default: 0.
94 94
95 95 notify.domain
96 96 Default email domain for sender or recipients with no explicit domain.
97 97
98 98 notify.style
99 99 Style file to use when formatting emails.
100 100
101 101 notify.template
102 102 Template to use when formatting emails.
103 103
104 104 notify.incoming
105 105 Template to use when run as an incoming hook, overriding "notify.template".
106 106
107 107 notify.outgoing
108 108 Template to use when run as an outgoing hook, overriding "notify.template".
109 109
110 110 notify.changegroup
111 111 Template to use when running as a changegroup hook, overriding
112 112 "notify.template".
113 113
114 114 notify.maxdiff
115 115 Maximum number of diff lines to include in notification email. Set to 0 to
116 116 disable the diff, or -1 to include all of it. Default: 300.
117 117
118 118 notify.maxsubject
119 119 Maximum number of characters in email's subject line. Default: 67.
120 120
121 121 notify.diffstat
122 122 Set to True to include a diffstat before diff content. Default: True.
123 123
124 124 notify.merge
125 125 If True, send notifications for merge changesets. Default: True.
126 126
127 127 notify.mbox
128 128 If set, append mails to this mbox file instead of sending. Default: None.
129 129
130 130 notify.fromauthor
131 131 If set, use the committer of the first changeset in a changegroup for the
132 132 "From" field of the notification mail. If not set, take the user from the
133 133 pushing repo. Default: False.
134 134
135 135 If set, the following entries will also be used to customize the
136 136 notifications:
137 137
138 138 email.from
139 139 Email "From" address to use if none can be found in the generated email
140 140 content.
141 141
142 142 web.baseurl
143 143 Root repository URL to combine with repository paths when making references.
144 144 See also "notify.strip".
145 145
146 146 no commands defined
147 147 $ hg init a
148 148 $ echo a > a/a
149 149
150 150 commit
151 151
152 152 $ hg --cwd a commit -Ama -d '0 0'
153 153 adding a
154 154
155 155
156 156 clone
157 157
158 158 $ hg --traceback clone a b
159 159 updating to branch default
160 160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 161 $ echo a >> a/a
162 162
163 163 commit
164 164
165 165 $ hg --traceback --cwd a commit -Amb -d '1 0'
166 166
167 167 on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
168 168
169 169 $ cat <<EOF >> $HGRCPATH
170 170 > [notify]
171 171 > maxsubject = 200
172 172 > EOF
173 173
174 174 the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
175 175 of the very long subject line
176 176 pull (minimal config)
177 177
178 178 $ hg --traceback --cwd b pull ../a | \
179 179 > $PYTHON -c 'import sys,re; print re.sub("\n[\t ]", " ", sys.stdin.read()),'
180 180 pulling from ../a
181 181 searching for changes
182 182 adding changesets
183 183 adding manifests
184 184 adding file changes
185 185 added 1 changesets with 1 changes to 1 files
186 186 Content-Type: text/plain; charset="us-ascii"
187 187 MIME-Version: 1.0
188 188 Content-Transfer-Encoding: 7bit
189 189 Date: * (glob)
190 190 Subject: changeset in $TESTTMP/b: b
191 191 From: test
192 192 X-Hg-Notification: changeset 0647d048b600
193 193 Message-Id: <*> (glob)
194 194 To: baz, foo@bar
195 195
196 196 changeset 0647d048b600 in $TESTTMP/b (glob)
197 197 details: $TESTTMP/b?cmd=changeset;node=0647d048b600
198 198 description: b
199 199
200 200 diffs (6 lines):
201 201
202 202 diff -r cb9a9f314b8b -r 0647d048b600 a
203 203 --- a/a Thu Jan 01 00:00:00 1970 +0000
204 204 +++ b/a Thu Jan 01 00:00:01 1970 +0000
205 205 @@ -1,1 +1,2 @@ a
206 206 +a
207 207 (run 'hg update' to get a working copy)
208 208 $ cat <<EOF >> $HGRCPATH
209 209 > [notify]
210 210 > config = `pwd`/.notify.conf
211 211 > domain = test.com
212 212 > strip = 42
213 213 > template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
214 214 >
215 215 > [web]
216 216 > baseurl = http://test/
217 217 > EOF
218 218
219 219 fail for config file is missing
220 220
221 221 $ hg --cwd b rollback
222 222 repository tip rolled back to revision 0 (undo pull)
223 223 $ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
224 224 pull failed
225 225 $ touch ".notify.conf"
226 226
227 227 pull
228 228
229 229 $ hg --cwd b rollback
230 230 repository tip rolled back to revision 0 (undo pull)
231 231 $ hg --traceback --cwd b pull ../a | \
232 232 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
233 233 pulling from ../a
234 234 searching for changes
235 235 adding changesets
236 236 adding manifests
237 237 adding file changes
238 238 added 1 changesets with 1 changes to 1 files
239 239 Content-Type: text/plain; charset="us-ascii"
240 240 MIME-Version: 1.0
241 241 Content-Transfer-Encoding: 7bit
242 242 X-Test: foo
243 243 Date: * (glob)
244 244 Subject: b
245 245 From: test@test.com
246 246 X-Hg-Notification: changeset 0647d048b600
247 247 Message-Id: <*> (glob)
248 248 To: baz@test.com, foo@bar
249 249
250 250 changeset 0647d048b600 in b
251 251 description: b
252 252 diffs (6 lines):
253 253
254 254 diff -r cb9a9f314b8b -r 0647d048b600 a
255 255 --- a/a Thu Jan 01 00:00:00 1970 +0000
256 256 +++ b/a Thu Jan 01 00:00:01 1970 +0000
257 257 @@ -1,1 +1,2 @@
258 258 a
259 259 +a
260 260 (run 'hg update' to get a working copy)
261 261
262 262 $ cat << EOF >> $HGRCPATH
263 263 > [hooks]
264 264 > incoming.notify = python:hgext.notify.hook
265 265 >
266 266 > [notify]
267 267 > sources = pull
268 268 > diffstat = True
269 269 > EOF
270 270
271 271 pull
272 272
273 273 $ hg --cwd b rollback
274 274 repository tip rolled back to revision 0 (undo pull)
275 275 $ hg --traceback --cwd b pull ../a | \
276 276 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
277 277 pulling from ../a
278 278 searching for changes
279 279 adding changesets
280 280 adding manifests
281 281 adding file changes
282 282 added 1 changesets with 1 changes to 1 files
283 283 Content-Type: text/plain; charset="us-ascii"
284 284 MIME-Version: 1.0
285 285 Content-Transfer-Encoding: 7bit
286 286 X-Test: foo
287 287 Date: * (glob)
288 288 Subject: b
289 289 From: test@test.com
290 290 X-Hg-Notification: changeset 0647d048b600
291 291 Message-Id: <*> (glob)
292 292 To: baz@test.com, foo@bar
293 293
294 294 changeset 0647d048b600 in b
295 295 description: b
296 296 diffstat:
297 297
298 298 a | 1 +
299 299 1 files changed, 1 insertions(+), 0 deletions(-)
300 300
301 301 diffs (6 lines):
302 302
303 303 diff -r cb9a9f314b8b -r 0647d048b600 a
304 304 --- a/a Thu Jan 01 00:00:00 1970 +0000
305 305 +++ b/a Thu Jan 01 00:00:01 1970 +0000
306 306 @@ -1,1 +1,2 @@
307 307 a
308 308 +a
309 309 (run 'hg update' to get a working copy)
310 310
311 311 test merge
312 312
313 313 $ cd a
314 314 $ hg up -C 0
315 315 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 316 $ echo a >> a
317 317 $ hg ci -Am adda2 -d '2 0'
318 318 created new head
319 319 $ hg merge
320 320 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
321 321 (branch merge, don't forget to commit)
322 322 $ hg ci -m merge -d '3 0'
323 323 $ cd ..
324 324 $ hg --traceback --cwd b pull ../a | \
325 325 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
326 326 pulling from ../a
327 327 searching for changes
328 328 adding changesets
329 329 adding manifests
330 330 adding file changes
331 331 added 2 changesets with 0 changes to 0 files
332 332 Content-Type: text/plain; charset="us-ascii"
333 333 MIME-Version: 1.0
334 334 Content-Transfer-Encoding: 7bit
335 335 X-Test: foo
336 336 Date: * (glob)
337 337 Subject: adda2
338 338 From: test@test.com
339 339 X-Hg-Notification: changeset 0a184ce6067f
340 340 Message-Id: <*> (glob)
341 341 To: baz@test.com, foo@bar
342 342
343 343 changeset 0a184ce6067f in b
344 344 description: adda2
345 345 diffstat:
346 346
347 347 a | 1 +
348 348 1 files changed, 1 insertions(+), 0 deletions(-)
349 349
350 350 diffs (6 lines):
351 351
352 352 diff -r cb9a9f314b8b -r 0a184ce6067f a
353 353 --- a/a Thu Jan 01 00:00:00 1970 +0000
354 354 +++ b/a Thu Jan 01 00:00:02 1970 +0000
355 355 @@ -1,1 +1,2 @@
356 356 a
357 357 +a
358 358 Content-Type: text/plain; charset="us-ascii"
359 359 MIME-Version: 1.0
360 360 Content-Transfer-Encoding: 7bit
361 361 X-Test: foo
362 362 Date: * (glob)
363 363 Subject: merge
364 364 From: test@test.com
365 365 X-Hg-Notification: changeset 6a0cf76b2701
366 366 Message-Id: <*> (glob)
367 367 To: baz@test.com, foo@bar
368 368
369 369 changeset 6a0cf76b2701 in b
370 370 description: merge
371 371 (run 'hg update' to get a working copy)
372 372
373 373 non-ascii content and truncation of multi-byte subject
374 374
375 375 $ cat <<EOF >> $HGRCPATH
376 376 > [notify]
377 377 > maxsubject = 4
378 378 > EOF
379 379 $ echo a >> a/a
380 380 $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
381 381 > -m `$PYTHON -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'`
382 382 $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
383 383 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
384 384 pulling from ../a
385 385 searching for changes
386 386 adding changesets
387 387 adding manifests
388 388 adding file changes
389 389 added 1 changesets with 1 changes to 1 files
390 390 Content-Type: text/plain; charset="us-ascii"
391 391 MIME-Version: 1.0
392 392 Content-Transfer-Encoding: 8bit
393 393 X-Test: foo
394 394 Date: * (glob)
395 395 Subject: \xc3\xa0... (esc)
396 396 From: test@test.com
397 397 X-Hg-Notification: changeset 7ea05ad269dc
398 398 Message-Id: <*> (glob)
399 399 To: baz@test.com, foo@bar
400 400
401 401 changeset 7ea05ad269dc in b
402 402 description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc)
403 403 diffstat:
404 404
405 405 a | 1 +
406 406 1 files changed, 1 insertions(+), 0 deletions(-)
407 407
408 408 diffs (7 lines):
409 409
410 410 diff -r 6a0cf76b2701 -r 7ea05ad269dc a
411 411 --- a/a Thu Jan 01 00:00:03 1970 +0000
412 412 +++ b/a Thu Jan 01 00:00:00 1970 +0000
413 413 @@ -1,2 +1,3 @@
414 414 a
415 415 a
416 416 +a
417 417 (run 'hg update' to get a working copy)
418 418
419 419 long lines
420 420
421 421 $ cat <<EOF >> $HGRCPATH
422 422 > [notify]
423 423 > maxsubject = 67
424 424 > test = False
425 425 > mbox = mbox
426 426 > EOF
427 427 $ $PYTHON -c 'file("a/a", "ab").write("no" * 500 + "\n")'
428 428 $ hg --cwd a commit -A -m "long line"
429 429 $ hg --traceback --cwd b pull ../a
430 430 pulling from ../a
431 431 searching for changes
432 432 adding changesets
433 433 adding manifests
434 434 adding file changes
435 435 added 1 changesets with 1 changes to 1 files
436 436 notify: sending 2 subscribers 1 changes
437 437 (run 'hg update' to get a working copy)
438 438 $ $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", file("b/mbox").read()),'
439 439 From test@test.com ... ... .. ..:..:.. .... (re)
440 440 Content-Type: text/plain; charset="us-ascii"
441 441 MIME-Version: 1.0
442 442 Content-Transfer-Encoding: quoted-printable
443 443 X-Test: foo
444 444 Date: * (glob)
445 445 Subject: long line
446 446 From: test@test.com
447 447 X-Hg-Notification: changeset e0be44cf638b
448 448 Message-Id: <hg.e0be44cf638b.*.*@*> (glob)
449 449 To: baz@test.com, foo@bar
450 450
451 451 changeset e0be44cf638b in b
452 452 description: long line
453 453 diffstat:
454 454
455 455 a | 1 +
456 456 1 files changed, 1 insertions(+), 0 deletions(-)
457 457
458 458 diffs (8 lines):
459 459
460 460 diff -r 7ea05ad269dc -r e0be44cf638b a
461 461 --- a/a Thu Jan 01 00:00:00 1970 +0000
462 462 +++ b/a Thu Jan 01 00:00:00 1970 +0000
463 463 @@ -1,3 +1,4 @@
464 464 a
465 465 a
466 466 a
467 467 +nonononononononononononononononononononononononononononononononononononono=
468 468 nononononononononononononononononononononononononononononononononononononon=
469 469 ononononononononononononononononononononononononononononononononononononono=
470 470 nononononononononononononononononononononononononononononononononononononon=
471 471 ononononononononononononononononononononononononononononononononononononono=
472 472 nononononononononononononononononononononononononononononononononononononon=
473 473 ononononononononononononononononononononononononononononononononononononono=
474 474 nononononononononononononononononononononononononononononononononononononon=
475 475 ononononononononononononononononononononononononononononononononononononono=
476 476 nononononononononononononononononononononononononononononononononononononon=
477 477 ononononononononononononononononononononononononononononononononononononono=
478 478 nononononononononononononononononononononononononononononononononononononon=
479 479 ononononononononononononononononononononononononononononononononononononono=
480 480 nonononononononononononono
481 481
482 482 revset selection: send to address that matches branch and repo
483 483
484 484 $ cat << EOF >> $HGRCPATH
485 485 > [hooks]
486 486 > incoming.notify = python:hgext.notify.hook
487 487 >
488 488 > [notify]
489 489 > sources = pull
490 490 > test = True
491 491 > diffstat = False
492 492 > maxdiff = 0
493 493 >
494 494 > [reposubs]
495 495 > */a#branch(test) = will_no_be_send@example.com
496 496 > */b#branch(test) = notify@example.com
497 497 > EOF
498 498 $ hg --cwd a branch test
499 499 marked working directory as branch test
500 500 (branches are permanent and global, did you want a bookmark?)
501 501 $ echo a >> a/a
502 502 $ hg --cwd a ci -m test -d '1 0'
503 503 $ hg --traceback --cwd b pull ../a | \
504 504 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
505 505 pulling from ../a
506 506 searching for changes
507 507 adding changesets
508 508 adding manifests
509 509 adding file changes
510 510 added 1 changesets with 1 changes to 1 files
511 511 Content-Type: text/plain; charset="us-ascii"
512 512 MIME-Version: 1.0
513 513 Content-Transfer-Encoding: 7bit
514 514 X-Test: foo
515 515 Date: * (glob)
516 516 Subject: test
517 517 From: test@test.com
518 518 X-Hg-Notification: changeset fbbcbc516f2f
519 519 Message-Id: <hg.fbbcbc516f2f.*.*@*> (glob)
520 520 To: baz@test.com, foo@bar, notify@example.com
521 521
522 522 changeset fbbcbc516f2f in b
523 523 description: test
524 524 (run 'hg update' to get a working copy)
525 525
526 526 revset selection: don't send to address that waits for mails
527 527 from different branch
528 528
529 529 $ hg --cwd a update default
530 530 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 531 $ echo a >> a/a
532 532 $ hg --cwd a ci -m test -d '1 0'
533 533 $ hg --traceback --cwd b pull ../a | \
534 534 > $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
535 535 pulling from ../a
536 536 searching for changes
537 537 adding changesets
538 538 adding manifests
539 539 adding file changes
540 540 added 1 changesets with 0 changes to 0 files (+1 heads)
541 541 Content-Type: text/plain; charset="us-ascii"
542 542 MIME-Version: 1.0
543 543 Content-Transfer-Encoding: 7bit
544 544 X-Test: foo
545 545 Date: * (glob)
546 546 Subject: test
547 547 From: test@test.com
548 548 X-Hg-Notification: changeset 38b42fa092de
549 549 Message-Id: <hg.38b42fa092de.*.*@*> (glob)
550 550 To: baz@test.com, foo@bar
551 551
552 552 changeset 38b42fa092de in b
553 553 description: test
554 554 (run 'hg heads' to see heads)
555 555
@@ -1,409 +1,409 b''
1 1 Create configuration
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "interactive=true" >> $HGRCPATH
5 5
6 6 help record (no record)
7 7
8 8 $ hg help record
9 9 record extension - commands to interactively select changes for
10 10 commit/qrefresh
11 11
12 12 (use "hg help extensions" for information on enabling extensions)
13 13
14 14 help qrecord (no record)
15 15
16 16 $ hg help qrecord
17 17 'qrecord' is provided by the following extension:
18 18
19 19 record commands to interactively select changes for commit/qrefresh
20 20
21 21 (use "hg help extensions" for information on enabling extensions)
22 22
23 23 $ echo "[extensions]" >> $HGRCPATH
24 24 $ echo "record=" >> $HGRCPATH
25 25
26 26 help record (record)
27 27
28 28 $ hg help record
29 29 hg record [OPTION]... [FILE]...
30 30
31 31 interactively select changes to commit
32 32
33 If a list of files is omitted, all changes reported by "hg status" will be
33 If a list of files is omitted, all changes reported by 'hg status' will be
34 34 candidates for recording.
35 35
36 See "hg help dates" for a list of formats valid for -d/--date.
36 See 'hg help dates' for a list of formats valid for -d/--date.
37 37
38 38 You will be prompted for whether to record changes to each modified file,
39 39 and for files with multiple changes, for each change to use. For each
40 40 query, the following responses are possible:
41 41
42 42 y - record this change
43 43 n - skip this change
44 44 e - edit this change manually
45 45
46 46 s - skip remaining changes to this file
47 47 f - record remaining changes to this file
48 48
49 49 d - done, skip remaining changes and files
50 50 a - record all changes to all remaining files
51 51 q - quit, recording no changes
52 52
53 53 ? - display help
54 54
55 55 This command is not available when committing a merge.
56 56
57 57 options ([+] can be repeated):
58 58
59 59 -A --addremove mark new/missing files as added/removed before
60 60 committing
61 61 --close-branch mark a branch head as closed
62 62 --amend amend the parent of the working directory
63 63 -s --secret use the secret phase for committing
64 64 -e --edit invoke editor on commit messages
65 65 -I --include PATTERN [+] include names matching the given patterns
66 66 -X --exclude PATTERN [+] exclude names matching the given patterns
67 67 -m --message TEXT use text as commit message
68 68 -l --logfile FILE read commit message from file
69 69 -d --date DATE record the specified date as commit date
70 70 -u --user USER record the specified user as committer
71 71 -S --subrepos recurse into subrepositories
72 72 -w --ignore-all-space ignore white space when comparing lines
73 73 -b --ignore-space-change ignore changes in the amount of white space
74 74 -B --ignore-blank-lines ignore changes whose lines are all blank
75 75
76 76 (some details hidden, use --verbose to show complete help)
77 77
78 78 help (no mq, so no qrecord)
79 79
80 80 $ hg help qrecord
81 81 hg qrecord [OPTION]... PATCH [FILE]...
82 82
83 83 interactively record a new patch
84 84
85 See "hg help qnew" & "hg help record" for more information and usage.
85 See 'hg help qnew' & 'hg help record' for more information and usage.
86 86
87 87 (some details hidden, use --verbose to show complete help)
88 88
89 89 $ hg init a
90 90
91 91 qrecord (mq not present)
92 92
93 93 $ hg -R a qrecord
94 94 hg qrecord: invalid arguments
95 95 hg qrecord [OPTION]... PATCH [FILE]...
96 96
97 97 interactively record a new patch
98 98
99 99 (use "hg qrecord -h" to show more help)
100 100 [255]
101 101
102 102 qrecord patch (mq not present)
103 103
104 104 $ hg -R a qrecord patch
105 105 abort: 'mq' extension not loaded
106 106 [255]
107 107
108 108 help (bad mq)
109 109
110 110 $ echo "mq=nonexistent" >> $HGRCPATH
111 111 $ hg help qrecord
112 112 *** failed to import extension mq from nonexistent: [Errno *] * (glob)
113 113 hg qrecord [OPTION]... PATCH [FILE]...
114 114
115 115 interactively record a new patch
116 116
117 See "hg help qnew" & "hg help record" for more information and usage.
117 See 'hg help qnew' & 'hg help record' for more information and usage.
118 118
119 119 (some details hidden, use --verbose to show complete help)
120 120
121 121 help (mq present)
122 122
123 123 $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp
124 124 $ mv hgrc.tmp $HGRCPATH
125 125
126 126 $ hg help qrecord
127 127 hg qrecord [OPTION]... PATCH [FILE]...
128 128
129 129 interactively record a new patch
130 130
131 See "hg help qnew" & "hg help record" for more information and usage.
131 See 'hg help qnew' & 'hg help record' for more information and usage.
132 132
133 133 options ([+] can be repeated):
134 134
135 135 -e --edit invoke editor on commit messages
136 136 -g --git use git extended diff format
137 137 -U --currentuser add "From: <current user>" to patch
138 138 -u --user USER add "From: <USER>" to patch
139 139 -D --currentdate add "Date: <current date>" to patch
140 140 -d --date DATE add "Date: <DATE>" to patch
141 141 -I --include PATTERN [+] include names matching the given patterns
142 142 -X --exclude PATTERN [+] exclude names matching the given patterns
143 143 -m --message TEXT use text as commit message
144 144 -l --logfile FILE read commit message from file
145 145 -w --ignore-all-space ignore white space when comparing lines
146 146 -b --ignore-space-change ignore changes in the amount of white space
147 147 -B --ignore-blank-lines ignore changes whose lines are all blank
148 148 --mq operate on patch repository
149 149
150 150 (some details hidden, use --verbose to show complete help)
151 151
152 152 $ cd a
153 153
154 154 Base commit
155 155
156 156 $ cat > 1.txt <<EOF
157 157 > 1
158 158 > 2
159 159 > 3
160 160 > 4
161 161 > 5
162 162 > EOF
163 163 $ cat > 2.txt <<EOF
164 164 > a
165 165 > b
166 166 > c
167 167 > d
168 168 > e
169 169 > f
170 170 > EOF
171 171
172 172 $ mkdir dir
173 173 $ cat > dir/a.txt <<EOF
174 174 > hello world
175 175 >
176 176 > someone
177 177 > up
178 178 > there
179 179 > loves
180 180 > me
181 181 > EOF
182 182
183 183 $ hg add 1.txt 2.txt dir/a.txt
184 184 $ hg commit -m 'initial checkin'
185 185
186 186 Changing files
187 187
188 188 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
189 189 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
190 190 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
191 191
192 192 $ mv -f 1.txt.new 1.txt
193 193 $ mv -f 2.txt.new 2.txt
194 194 $ mv -f dir/a.txt.new dir/a.txt
195 195
196 196 Whole diff
197 197
198 198 $ hg diff --nodates
199 199 diff -r 1057167b20ef 1.txt
200 200 --- a/1.txt
201 201 +++ b/1.txt
202 202 @@ -1,5 +1,5 @@
203 203 1
204 204 -2
205 205 +2 2
206 206 3
207 207 -4
208 208 +4 4
209 209 5
210 210 diff -r 1057167b20ef 2.txt
211 211 --- a/2.txt
212 212 +++ b/2.txt
213 213 @@ -1,5 +1,5 @@
214 214 a
215 215 -b
216 216 +b b
217 217 c
218 218 d
219 219 e
220 220 diff -r 1057167b20ef dir/a.txt
221 221 --- a/dir/a.txt
222 222 +++ b/dir/a.txt
223 223 @@ -1,4 +1,4 @@
224 224 -hello world
225 225 +hello world!
226 226
227 227 someone
228 228 up
229 229
230 230 qrecord with bad patch name, should abort before prompting
231 231
232 232 $ hg qrecord .hg
233 233 abort: patch name cannot begin with ".hg"
234 234 [255]
235 235
236 236 qrecord a.patch
237 237
238 238 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
239 239 > y
240 240 > y
241 241 > n
242 242 > y
243 243 > y
244 244 > n
245 245 > EOF
246 246 diff --git a/1.txt b/1.txt
247 247 2 hunks, 2 lines changed
248 248 examine changes to '1.txt'? [Ynesfdaq?] y
249 249
250 250 @@ -1,3 +1,3 @@
251 251 1
252 252 -2
253 253 +2 2
254 254 3
255 255 record change 1/4 to '1.txt'? [Ynesfdaq?] y
256 256
257 257 @@ -3,3 +3,3 @@
258 258 3
259 259 -4
260 260 +4 4
261 261 5
262 262 record change 2/4 to '1.txt'? [Ynesfdaq?] n
263 263
264 264 diff --git a/2.txt b/2.txt
265 265 1 hunks, 1 lines changed
266 266 examine changes to '2.txt'? [Ynesfdaq?] y
267 267
268 268 @@ -1,5 +1,5 @@
269 269 a
270 270 -b
271 271 +b b
272 272 c
273 273 d
274 274 e
275 275 record change 3/4 to '2.txt'? [Ynesfdaq?] y
276 276
277 277 diff --git a/dir/a.txt b/dir/a.txt
278 278 1 hunks, 1 lines changed
279 279 examine changes to 'dir/a.txt'? [Ynesfdaq?] n
280 280
281 281
282 282 After qrecord a.patch 'tip'"
283 283
284 284 $ hg tip -p
285 285 changeset: 1:5d1ca63427ee
286 286 tag: a.patch
287 287 tag: qbase
288 288 tag: qtip
289 289 tag: tip
290 290 user: test
291 291 date: Thu Jan 01 00:00:00 1970 +0000
292 292 summary: aaa
293 293
294 294 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
295 295 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
296 296 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
297 297 @@ -1,5 +1,5 @@
298 298 1
299 299 -2
300 300 +2 2
301 301 3
302 302 4
303 303 5
304 304 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
305 305 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
306 306 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
307 307 @@ -1,5 +1,5 @@
308 308 a
309 309 -b
310 310 +b b
311 311 c
312 312 d
313 313 e
314 314
315 315
316 316 After qrecord a.patch 'diff'"
317 317
318 318 $ hg diff --nodates
319 319 diff -r 5d1ca63427ee 1.txt
320 320 --- a/1.txt
321 321 +++ b/1.txt
322 322 @@ -1,5 +1,5 @@
323 323 1
324 324 2 2
325 325 3
326 326 -4
327 327 +4 4
328 328 5
329 329 diff -r 5d1ca63427ee dir/a.txt
330 330 --- a/dir/a.txt
331 331 +++ b/dir/a.txt
332 332 @@ -1,4 +1,4 @@
333 333 -hello world
334 334 +hello world!
335 335
336 336 someone
337 337 up
338 338
339 339 qrecord b.patch
340 340
341 341 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
342 342 > y
343 343 > y
344 344 > y
345 345 > y
346 346 > EOF
347 347 diff --git a/1.txt b/1.txt
348 348 1 hunks, 1 lines changed
349 349 examine changes to '1.txt'? [Ynesfdaq?] y
350 350
351 351 @@ -1,5 +1,5 @@
352 352 1
353 353 2 2
354 354 3
355 355 -4
356 356 +4 4
357 357 5
358 358 record change 1/2 to '1.txt'? [Ynesfdaq?] y
359 359
360 360 diff --git a/dir/a.txt b/dir/a.txt
361 361 1 hunks, 1 lines changed
362 362 examine changes to 'dir/a.txt'? [Ynesfdaq?] y
363 363
364 364 @@ -1,4 +1,4 @@
365 365 -hello world
366 366 +hello world!
367 367
368 368 someone
369 369 up
370 370 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y
371 371
372 372
373 373 After qrecord b.patch 'tip'
374 374
375 375 $ hg tip -p
376 376 changeset: 2:b056198bf878
377 377 tag: b.patch
378 378 tag: qtip
379 379 tag: tip
380 380 user: test
381 381 date: Thu Jan 01 00:00:00 1970 +0000
382 382 summary: bbb
383 383
384 384 diff -r 5d1ca63427ee -r b056198bf878 1.txt
385 385 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
386 386 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
387 387 @@ -1,5 +1,5 @@
388 388 1
389 389 2 2
390 390 3
391 391 -4
392 392 +4 4
393 393 5
394 394 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
395 395 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
396 396 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
397 397 @@ -1,4 +1,4 @@
398 398 -hello world
399 399 +hello world!
400 400
401 401 someone
402 402 up
403 403
404 404
405 405 After qrecord b.patch 'diff'
406 406
407 407 $ hg diff --nodates
408 408
409 409 $ cd ..
@@ -1,87 +1,87 b''
1 1 Set up a repo
2 2
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [ui]
5 5 > interactive = true
6 6 > [extensions]
7 7 > record =
8 8 > EOF
9 9
10 10 $ hg init a
11 11 $ cd a
12 12
13 13 Record help
14 14
15 15 $ hg record -h
16 16 hg record [OPTION]... [FILE]...
17 17
18 18 interactively select changes to commit
19 19
20 If a list of files is omitted, all changes reported by "hg status" will be
20 If a list of files is omitted, all changes reported by 'hg status' will be
21 21 candidates for recording.
22 22
23 See "hg help dates" for a list of formats valid for -d/--date.
23 See 'hg help dates' for a list of formats valid for -d/--date.
24 24
25 25 You will be prompted for whether to record changes to each modified file,
26 26 and for files with multiple changes, for each change to use. For each
27 27 query, the following responses are possible:
28 28
29 29 y - record this change
30 30 n - skip this change
31 31 e - edit this change manually
32 32
33 33 s - skip remaining changes to this file
34 34 f - record remaining changes to this file
35 35
36 36 d - done, skip remaining changes and files
37 37 a - record all changes to all remaining files
38 38 q - quit, recording no changes
39 39
40 40 ? - display help
41 41
42 42 This command is not available when committing a merge.
43 43
44 44 options ([+] can be repeated):
45 45
46 46 -A --addremove mark new/missing files as added/removed before
47 47 committing
48 48 --close-branch mark a branch head as closed
49 49 --amend amend the parent of the working directory
50 50 -s --secret use the secret phase for committing
51 51 -e --edit invoke editor on commit messages
52 52 -I --include PATTERN [+] include names matching the given patterns
53 53 -X --exclude PATTERN [+] exclude names matching the given patterns
54 54 -m --message TEXT use text as commit message
55 55 -l --logfile FILE read commit message from file
56 56 -d --date DATE record the specified date as commit date
57 57 -u --user USER record the specified user as committer
58 58 -S --subrepos recurse into subrepositories
59 59 -w --ignore-all-space ignore white space when comparing lines
60 60 -b --ignore-space-change ignore changes in the amount of white space
61 61 -B --ignore-blank-lines ignore changes whose lines are all blank
62 62
63 63 (some details hidden, use --verbose to show complete help)
64 64
65 65 Select no files
66 66
67 67 $ touch empty-rw
68 68 $ hg add empty-rw
69 69
70 70 $ hg record empty-rw<<EOF
71 71 > n
72 72 > EOF
73 73 diff --git a/empty-rw b/empty-rw
74 74 new file mode 100644
75 75 examine changes to 'empty-rw'? [Ynesfdaq?] n
76 76
77 77 no changes to record
78 78
79 79 $ hg tip -p
80 80 changeset: -1:000000000000
81 81 tag: tip
82 82 user:
83 83 date: Thu Jan 01 00:00:00 1970 +0000
84 84
85 85
86 86
87 87
General Comments 0
You need to be logged in to leave comments. Login now