##// END OF EJS Templates
extdiff: add --from/--to and deprecate -r, as was done for `hg diff`...
Martin von Zweigbergk -
r46749:0a4d47f4 default
parent child Browse files
Show More
@@ -552,12 +552,21 b' def dodiff(ui, repo, cmdline, pats, opts'
552 552
553 553 cmdutil.check_at_most_one_arg(opts, b'rev', b'change')
554 554 revs = opts.get(b'rev')
555 from_rev = opts.get(b'from')
556 to_rev = opts.get(b'to')
555 557 change = opts.get(b'change')
556 558 do3way = b'$parent2' in cmdline
557 559
558 560 if change:
559 561 ctx2 = scmutil.revsingle(repo, change, None)
560 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 570 else:
562 571 ctx1a, ctx2 = scmutil.revpair(repo, revs)
563 572 if not revs:
@@ -615,7 +624,9 b' extdiffopts = ('
615 624 _(b'pass option to comparison program'),
616 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 630 (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')),
620 631 (
621 632 b'',
@@ -659,11 +670,8 b' def extdiff(ui, repo, *pats, **opts):'
659 670 additional options to the program, use -o/--option. These will be
660 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
663 between those revisions. If only one revision is specified then
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.
673 The --from, --to, and --change options work the same way they do for
674 :hg:`diff`.
667 675
668 676 The --per-file option runs the external program repeatedly on each
669 677 file to diff, instead of once on two directories. By default,
@@ -50,7 +50,8 b' Should diff cloned directories:'
50 50 options ([+] can be repeated):
51 51
52 52 -o --option OPT [+] pass option to comparison program
53 -r --rev REV [+] revision
53 --from REV1 revision to diff from
54 --to REV2 revision to diff to
54 55 -c --change REV change made by revision
55 56 --per-file compare each file instead of revision snapshots
56 57 --confirm prompt user before each external program invocation
@@ -68,14 +69,14 b' Should diff cloned directories:'
68 69
69 70 Should diff cloned files directly:
70 71
71 $ hg falabala -r 0:1
72 $ hg falabala --from 0 --to 1
72 73 diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) (windows !)
73 74 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) (no-windows !)
74 75 [1]
75 76
76 77 Can show diff from working copy:
77 78 $ echo c >> a
78 $ hg falabala -r 'wdir()' -r 1
79 $ hg falabala --to 1
79 80 diffing "*\\extdiff.*\\a" "a.34eed99112ab\\a" (glob) (windows !)
80 81 diffing */extdiff.*/a a.34eed99112ab/a (glob) (no-windows !)
81 82 [1]
@@ -139,7 +140,7 b' issue3153: ensure using extdiff with rem'
139 140 $ hg ci -Sm "adding subrepo"
140 141 $ echo > .hgsub
141 142 $ hg ci -m "removing subrepo"
142 $ hg falabala -r 4 -r 5 -S
143 $ hg falabala --from 4 --to 5 -S
143 144 diffing a.398e36faf9c6 a.5ab95fb166c4
144 145 [1]
145 146
@@ -292,7 +293,7 b' Empty argument must be quoted'
292 293 > kdiff3.diffargs=--L1 \$plabel1 --L2 \$clabel \$parent \$child
293 294 > EOF
294 295
295 $ hg --debug kdiff3 -r0 | grep '^running'
296 $ hg --debug kdiff3 --from 0 | grep '^running'
296 297 running 'echo --L1 "@0" --L2 "" a.8a5febb7f867 a' in * (glob) (windows !)
297 298 running "echo --L1 '@0' --L2 '' a.8a5febb7f867 a" in * (glob) (no-windows !)
298 299
@@ -496,7 +497,7 b' Test symlinks handling (issue1909)'
496 497 $ echo a >> a
497 498 $ ln -s missing linka
498 499 $ hg add linka
499 $ hg falabala -r 0 --traceback
500 $ hg falabala --from 0 --traceback
500 501 diffing testsymlinks.07f494440405 testsymlinks
501 502 [1]
502 503 $ cd ..
@@ -836,10 +836,8 b' Extension module help vs command help:'
836 836 program, use -o/--option. These will be passed before the names of the
837 837 directories or files to compare.
838 838
839 When two revision arguments are given, then changes are shown between
840 those revisions. If only one revision is specified then that revision is
841 compared to the working directory, and, when no revisions are specified,
842 the working directory files are compared to its parent.
839 The --from, --to, and --change options work the same way they do for 'hg
840 diff'.
843 841
844 842 The --per-file option runs the external program repeatedly on each file to
845 843 diff, instead of once on two directories. By default, this happens one by
@@ -859,7 +857,8 b' Extension module help vs command help:'
859 857
860 858 -p --program CMD comparison program to run
861 859 -o --option OPT [+] pass option to comparison program
862 -r --rev REV [+] revision
860 --from REV1 revision to diff from
861 --to REV2 revision to diff to
863 862 -c --change REV change made by revision
864 863 --per-file compare each file instead of revision snapshots
865 864 --confirm prompt user before each external program invocation
General Comments 0
You need to be logged in to leave comments. Login now