550 - just invoke the diff for a single file in the working dir |
550 - just invoke the diff for a single file in the working dir |
551 """ |
551 """ |
552 |
552 |
553 cmdutil.check_at_most_one_arg(opts, b'rev', b'change') |
553 cmdutil.check_at_most_one_arg(opts, b'rev', b'change') |
554 revs = opts.get(b'rev') |
554 revs = opts.get(b'rev') |
|
555 from_rev = opts.get(b'from') |
|
556 to_rev = opts.get(b'to') |
555 change = opts.get(b'change') |
557 change = opts.get(b'change') |
556 do3way = b'$parent2' in cmdline |
558 do3way = b'$parent2' in cmdline |
557 |
559 |
558 if change: |
560 if change: |
559 ctx2 = scmutil.revsingle(repo, change, None) |
561 ctx2 = scmutil.revsingle(repo, change, None) |
560 ctx1a, ctx1b = ctx2.p1(), ctx2.p2() |
562 ctx1a, ctx1b = ctx2.p1(), ctx2.p2() |
|
563 elif from_rev or to_rev: |
|
564 repo = scmutil.unhidehashlikerevs( |
|
565 repo, [from_rev] + [to_rev], b'nowarn' |
|
566 ) |
|
567 ctx1a = scmutil.revsingle(repo, from_rev, None) |
|
568 ctx1b = repo[nullid] |
|
569 ctx2 = scmutil.revsingle(repo, to_rev, None) |
561 else: |
570 else: |
562 ctx1a, ctx2 = scmutil.revpair(repo, revs) |
571 ctx1a, ctx2 = scmutil.revpair(repo, revs) |
563 if not revs: |
572 if not revs: |
564 ctx1b = repo[None].p2() |
573 ctx1b = repo[None].p2() |
565 else: |
574 else: |
613 b'option', |
622 b'option', |
614 [], |
623 [], |
615 _(b'pass option to comparison program'), |
624 _(b'pass option to comparison program'), |
616 _(b'OPT'), |
625 _(b'OPT'), |
617 ), |
626 ), |
618 (b'r', b'rev', [], _(b'revision'), _(b'REV')), |
627 (b'r', b'rev', [], _(b'revision (DEPRECATED)'), _(b'REV')), |
|
628 (b'', b'from', b'', _(b'revision to diff from'), _(b'REV1')), |
|
629 (b'', b'to', b'', _(b'revision to diff to'), _(b'REV2')), |
619 (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')), |
630 (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')), |
620 ( |
631 ( |
621 b'', |
632 b'', |
622 b'per-file', |
633 b'per-file', |
623 False, |
634 False, |
657 program will be passed the names of two directories to compare, |
668 program will be passed the names of two directories to compare, |
658 unless the --per-file option is specified (see below). To pass |
669 unless the --per-file option is specified (see below). To pass |
659 additional options to the program, use -o/--option. These will be |
670 additional options to the program, use -o/--option. These will be |
660 passed before the names of the directories or files to compare. |
671 passed before the names of the directories or files to compare. |
661 |
672 |
662 When two revision arguments are given, then changes are shown |
673 The --from, --to, and --change options work the same way they do for |
663 between those revisions. If only one revision is specified then |
674 :hg:`diff`. |
664 that revision is compared to the working directory, and, when no |
|
665 revisions are specified, the working directory files are compared |
|
666 to its parent. |
|
667 |
675 |
668 The --per-file option runs the external program repeatedly on each |
676 The --per-file option runs the external program repeatedly on each |
669 file to diff, instead of once on two directories. By default, |
677 file to diff, instead of once on two directories. By default, |
670 this happens one by one, where the next file diff is open in the |
678 this happens one by one, where the next file diff is open in the |
671 external program only once the previous external program (for the |
679 external program only once the previous external program (for the |