Show More
@@ -371,6 +371,13 b' def addremove(ui, repo, *pats, **opts):' | |||||
371 | _(b'revset to not display (EXPERIMENTAL)'), |
|
371 | _(b'revset to not display (EXPERIMENTAL)'), | |
372 | _(b'REV'), |
|
372 | _(b'REV'), | |
373 | ), |
|
373 | ), | |
|
374 | ( | |||
|
375 | b'L', | |||
|
376 | b'line-range', | |||
|
377 | [], | |||
|
378 | _(b'follow line range of specified file (EXPERIMENTAL)'), | |||
|
379 | _(b'FILE,RANGE'), | |||
|
380 | ), | |||
374 | ] |
|
381 | ] | |
375 | + diffwsopts |
|
382 | + diffwsopts | |
376 | + walkopts |
|
383 | + walkopts | |
@@ -399,6 +406,13 b' def annotate(ui, repo, *pats, **opts):' | |||||
399 |
|
406 | |||
400 | .. container:: verbose |
|
407 | .. container:: verbose | |
401 |
|
408 | |||
|
409 | Use -L/--line-range FILE,M:N options to filter the output to the lines | |||
|
410 | from M to N in FILE. This option is incompatible with --no-follow and | |||
|
411 | cannot be combined with file pattern arguments. When combined with --rev | |||
|
412 | the line ranges refer to the state of the file at the requested revision. | |||
|
413 | ||||
|
414 | .. container:: verbose | |||
|
415 | ||||
402 | Template: |
|
416 | Template: | |
403 |
|
417 | |||
404 | The following keywords are supported in addition to the common template |
|
418 | The following keywords are supported in addition to the common template | |
@@ -419,7 +433,20 b' def annotate(ui, repo, *pats, **opts):' | |||||
419 | Returns 0 on success. |
|
433 | Returns 0 on success. | |
420 | """ |
|
434 | """ | |
421 | opts = pycompat.byteskwargs(opts) |
|
435 | opts = pycompat.byteskwargs(opts) | |
422 | if not pats: |
|
436 | ||
|
437 | linerange = opts.get(b'line_range') | |||
|
438 | ||||
|
439 | if linerange and opts.get(b'no_follow'): | |||
|
440 | raise error.InputError( | |||
|
441 | _(b'--line-range is incompatible with --no-follow') | |||
|
442 | ) | |||
|
443 | ||||
|
444 | if pats and linerange: | |||
|
445 | raise error.InputError( | |||
|
446 | _(b'cannot combine filename or pattern and --line-range') | |||
|
447 | ) | |||
|
448 | ||||
|
449 | if not pats and not linerange: | |||
423 | raise error.InputError( |
|
450 | raise error.InputError( | |
424 | _(b'at least one filename or pattern is required') |
|
451 | _(b'at least one filename or pattern is required') | |
425 | ) |
|
452 | ) | |
@@ -450,6 +477,12 b' def annotate(ui, repo, *pats, **opts):' | |||||
450 | repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn') |
|
477 | repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn') | |
451 | ctx = logcmdutil.revsingle(repo, rev) |
|
478 | ctx = logcmdutil.revsingle(repo, rev) | |
452 |
|
479 | |||
|
480 | if not pats: | |||
|
481 | pats = [ | |||
|
482 | fname | |||
|
483 | for fname, _ranges in logcmdutil._parselinerangeopt(repo, opts) | |||
|
484 | ] | |||
|
485 | ||||
453 | ui.pager(b'annotate') |
|
486 | ui.pager(b'annotate') | |
454 | rootfm = ui.formatter(b'annotate', opts) |
|
487 | rootfm = ui.formatter(b'annotate', opts) | |
455 | if ui.debugflag: |
|
488 | if ui.debugflag: | |
@@ -554,6 +587,16 b' def annotate(ui, repo, *pats, **opts):' | |||||
554 | lines = fctx.annotate( |
|
587 | lines = fctx.annotate( | |
555 | follow=follow, skiprevs=skiprevs, diffopts=diffopts |
|
588 | follow=follow, skiprevs=skiprevs, diffopts=diffopts | |
556 | ) |
|
589 | ) | |
|
590 | if linerange: | |||
|
591 | _fname, (line_start, line_end) = list( | |||
|
592 | logcmdutil._parselinerangeopt(repo, opts) | |||
|
593 | )[0] | |||
|
594 | lines = [ | |||
|
595 | line | |||
|
596 | for no, line in enumerate(lines) | |||
|
597 | if line_start <= no < line_end | |||
|
598 | ] | |||
|
599 | ||||
557 | if not lines: |
|
600 | if not lines: | |
558 | fm.end() |
|
601 | fm.end() | |
559 | continue |
|
602 | continue | |
@@ -1359,7 +1402,6 b' def branch(ui, repo, label=None, **opts)' | |||||
1359 | repo.dirstate.setbranch(label, repo.currenttransaction()) |
|
1402 | repo.dirstate.setbranch(label, repo.currenttransaction()) | |
1360 | ui.status(_(b'reset working directory to branch %s\n') % label) |
|
1403 | ui.status(_(b'reset working directory to branch %s\n') % label) | |
1361 | elif label: |
|
1404 | elif label: | |
1362 |
|
||||
1363 | scmutil.checknewlabel(repo, label, b'branch') |
|
1405 | scmutil.checknewlabel(repo, label, b'branch') | |
1364 | if revs: |
|
1406 | if revs: | |
1365 | return cmdutil.changebranch(ui, repo, revs, label, **opts) |
|
1407 | return cmdutil.changebranch(ui, repo, revs, label, **opts) |
@@ -430,6 +430,69 b' linkrev vs rev with -l' | |||||
430 | 1:2: a |
|
430 | 1:2: a | |
431 | 1:3: a |
|
431 | 1:3: a | |
432 |
|
432 | |||
|
433 | annotate line-range | |||
|
434 | ||||
|
435 | $ hg annotate -l -L b,8:10 | |||
|
436 | 8: 8: more | |||
|
437 | 9: 9: more | |||
|
438 | 10:10: more | |||
|
439 | ||||
|
440 | annotate line-range beyond last line | |||
|
441 | ||||
|
442 | $ hg annotate -l -L b,8:13 | |||
|
443 | 8: 8: more | |||
|
444 | 9: 9: more | |||
|
445 | 10:10: more | |||
|
446 | ||||
|
447 | annotate line-range before first line | |||
|
448 | ||||
|
449 | $ hg annotate -l -L b,0:2 | |||
|
450 | hg: parse error: fromline must be strictly positive | |||
|
451 | [10] | |||
|
452 | ||||
|
453 | annotate line-range with --rev | |||
|
454 | $ hg annotate -l -L b,5:7 | |||
|
455 | 4:5: c | |||
|
456 | 3:5: b5 | |||
|
457 | 7:7: d | |||
|
458 | $ sed 's/d/x/' b > b.new | |||
|
459 | $ mv b.new b | |||
|
460 | $ hg annotate --rev 'wdir()' -l -L b,5:7 | |||
|
461 | 4 :5: c | |||
|
462 | 3 :5: b5 | |||
|
463 | 10+:7: x | |||
|
464 | $ hg annotate -l -L b,5:7 | |||
|
465 | 4:5: c | |||
|
466 | 3:5: b5 | |||
|
467 | 7:7: d | |||
|
468 | $ hg revert --no-backup b | |||
|
469 | $ hg annotate --rev 3 -l b | |||
|
470 | 0:1: a | |||
|
471 | 1:2: a | |||
|
472 | 1:3: a | |||
|
473 | 3:4: b4 | |||
|
474 | 3:5: b5 | |||
|
475 | 3:6: b6 | |||
|
476 | $ hg annotate --rev 3 -l -L b,5:7 | |||
|
477 | 3:5: b5 | |||
|
478 | 3:6: b6 | |||
|
479 | ||||
|
480 | annotate line-range invalid combination of options | |||
|
481 | ||||
|
482 | $ hg annotate --no-follow -L b,5:7 | |||
|
483 | abort: --line-range is incompatible with --no-follow | |||
|
484 | [10] | |||
|
485 | $ hg annotate -L b,5:7 a | |||
|
486 | abort: cannot combine filename or pattern and --line-range | |||
|
487 | [10] | |||
|
488 | ||||
|
489 | annote line-range with glob patterns | |||
|
490 | ||||
|
491 | $ hg annotate -l -L glob:b*,5:7 | |||
|
492 | 4:5: c | |||
|
493 | 3:5: b5 | |||
|
494 | 7:7: d | |||
|
495 | ||||
433 | Issue589: "undelete" sequence leads to crash |
|
496 | Issue589: "undelete" sequence leads to crash | |
434 |
|
497 | |||
435 | annotate was crashing when trying to --follow something |
|
498 | annotate was crashing when trying to --follow something |
@@ -260,7 +260,7 b' Show all commands + options' | |||||
260 | add: include, exclude, subrepos, dry-run |
|
260 | add: include, exclude, subrepos, dry-run | |
261 | addremove: similarity, subrepos, include, exclude, dry-run |
|
261 | addremove: similarity, subrepos, include, exclude, dry-run | |
262 | admin::verify: check, option |
|
262 | admin::verify: check, option | |
263 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template |
|
263 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, line-range, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template | |
264 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
264 | archive: no-decode, prefix, rev, type, subrepos, include, exclude | |
265 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user |
|
265 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user | |
266 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
266 | bisect: reset, good, bad, skip, extend, command, noupdate |
General Comments 0
You need to be logged in to leave comments.
Login now