##// 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 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:
@@ -615,7 +624,9 b' extdiffopts = ('
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'',
@@ -659,11 +670,8 b' def extdiff(ui, repo, *pats, **opts):'
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,
@@ -50,7 +50,8 b' Should diff cloned directories:'
50 options ([+] can be repeated):
50 options ([+] can be repeated):
51
51
52 -o --option OPT [+] pass option to comparison program
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 -c --change REV change made by revision
55 -c --change REV change made by revision
55 --per-file compare each file instead of revision snapshots
56 --per-file compare each file instead of revision snapshots
56 --confirm prompt user before each external program invocation
57 --confirm prompt user before each external program invocation
@@ -68,14 +69,14 b' Should diff cloned directories:'
68
69
69 Should diff cloned files directly:
70 Should diff cloned files directly:
70
71
71 $ hg falabala -r 0:1
72 $ hg falabala --from 0 --to 1
72 diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) (windows !)
73 diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) (windows !)
73 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) (no-windows !)
74 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) (no-windows !)
74 [1]
75 [1]
75
76
76 Can show diff from working copy:
77 Can show diff from working copy:
77 $ echo c >> a
78 $ echo c >> a
78 $ hg falabala -r 'wdir()' -r 1
79 $ hg falabala --to 1
79 diffing "*\\extdiff.*\\a" "a.34eed99112ab\\a" (glob) (windows !)
80 diffing "*\\extdiff.*\\a" "a.34eed99112ab\\a" (glob) (windows !)
80 diffing */extdiff.*/a a.34eed99112ab/a (glob) (no-windows !)
81 diffing */extdiff.*/a a.34eed99112ab/a (glob) (no-windows !)
81 [1]
82 [1]
@@ -139,7 +140,7 b' issue3153: ensure using extdiff with rem'
139 $ hg ci -Sm "adding subrepo"
140 $ hg ci -Sm "adding subrepo"
140 $ echo > .hgsub
141 $ echo > .hgsub
141 $ hg ci -m "removing subrepo"
142 $ hg ci -m "removing subrepo"
142 $ hg falabala -r 4 -r 5 -S
143 $ hg falabala --from 4 --to 5 -S
143 diffing a.398e36faf9c6 a.5ab95fb166c4
144 diffing a.398e36faf9c6 a.5ab95fb166c4
144 [1]
145 [1]
145
146
@@ -292,7 +293,7 b' Empty argument must be quoted'
292 > kdiff3.diffargs=--L1 \$plabel1 --L2 \$clabel \$parent \$child
293 > kdiff3.diffargs=--L1 \$plabel1 --L2 \$clabel \$parent \$child
293 > EOF
294 > EOF
294
295
295 $ hg --debug kdiff3 -r0 | grep '^running'
296 $ hg --debug kdiff3 --from 0 | grep '^running'
296 running 'echo --L1 "@0" --L2 "" a.8a5febb7f867 a' in * (glob) (windows !)
297 running 'echo --L1 "@0" --L2 "" a.8a5febb7f867 a' in * (glob) (windows !)
297 running "echo --L1 '@0' --L2 '' a.8a5febb7f867 a" in * (glob) (no-windows !)
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 $ echo a >> a
497 $ echo a >> a
497 $ ln -s missing linka
498 $ ln -s missing linka
498 $ hg add linka
499 $ hg add linka
499 $ hg falabala -r 0 --traceback
500 $ hg falabala --from 0 --traceback
500 diffing testsymlinks.07f494440405 testsymlinks
501 diffing testsymlinks.07f494440405 testsymlinks
501 [1]
502 [1]
502 $ cd ..
503 $ cd ..
@@ -836,10 +836,8 b' Extension module help vs command help:'
836 program, use -o/--option. These will be passed before the names of the
836 program, use -o/--option. These will be passed before the names of the
837 directories or files to compare.
837 directories or files to compare.
838
838
839 When two revision arguments are given, then changes are shown between
839 The --from, --to, and --change options work the same way they do for 'hg
840 those revisions. If only one revision is specified then that revision is
840 diff'.
841 compared to the working directory, and, when no revisions are specified,
842 the working directory files are compared to its parent.
843
841
844 The --per-file option runs the external program repeatedly on each file to
842 The --per-file option runs the external program repeatedly on each file to
845 diff, instead of once on two directories. By default, this happens one by
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 -p --program CMD comparison program to run
858 -p --program CMD comparison program to run
861 -o --option OPT [+] pass option to comparison program
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 -c --change REV change made by revision
862 -c --change REV change made by revision
864 --per-file compare each file instead of revision snapshots
863 --per-file compare each file instead of revision snapshots
865 --confirm prompt user before each external program invocation
864 --confirm prompt user before each external program invocation
General Comments 0
You need to be logged in to leave comments. Login now