Show More
@@ -2456,6 +2456,8 b" def debugcomplete(ui, cmd=b'', **opts):" | |||
|
2456 | 2456 | b'diff', |
|
2457 | 2457 | [ |
|
2458 | 2458 | (b'r', b'rev', [], _(b'revision'), _(b'REV')), |
|
2459 | (b'', b'from', b'', _(b'revision to diff from'), _(b'REV')), | |
|
2460 | (b'', b'to', b'', _(b'revision to diff to'), _(b'REV')), | |
|
2459 | 2461 | (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')), |
|
2460 | 2462 | ] |
|
2461 | 2463 | + diffopts |
@@ -2530,13 +2532,23 b' def diff(ui, repo, *pats, **opts):' | |||
|
2530 | 2532 | opts = pycompat.byteskwargs(opts) |
|
2531 | 2533 | revs = opts.get(b'rev') |
|
2532 | 2534 | change = opts.get(b'change') |
|
2535 | from_rev = opts.get(b'from') | |
|
2536 | to_rev = opts.get(b'to') | |
|
2533 | 2537 | stat = opts.get(b'stat') |
|
2534 | 2538 | reverse = opts.get(b'reverse') |
|
2535 | 2539 | |
|
2540 | cmdutil.check_incompatible_arguments(opts, b'from', [b'rev', b'change']) | |
|
2541 | cmdutil.check_incompatible_arguments(opts, b'to', [b'rev', b'change']) | |
|
2536 | 2542 | if change: |
|
2537 | 2543 | repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn') |
|
2538 | 2544 | ctx2 = scmutil.revsingle(repo, change, None) |
|
2539 | 2545 | ctx1 = ctx2.p1() |
|
2546 | elif from_rev or to_rev: | |
|
2547 | repo = scmutil.unhidehashlikerevs( | |
|
2548 | repo, [from_rev] + [to_rev], b'nowarn' | |
|
2549 | ) | |
|
2550 | ctx1 = scmutil.revsingle(repo, from_rev, None) | |
|
2551 | ctx2 = scmutil.revsingle(repo, to_rev, None) | |
|
2540 | 2552 | else: |
|
2541 | 2553 | repo = scmutil.unhidehashlikerevs(repo, revs, b'nowarn') |
|
2542 | 2554 | ctx1, ctx2 = scmutil.revpair(repo, revs) |
@@ -20,6 +20,9 b'' | |||
|
20 | 20 | * `hg strip`, from the strip extension, is now a core command, `hg |
|
21 | 21 | debugstrip`. The extension remains for compatibility. |
|
22 | 22 | |
|
23 | * `hg diff` now supports `--from <rev>` and `--to <rev>` arguments as | |
|
24 | clearer alternatives to `-r <revs>`. | |
|
25 | ||
|
23 | 26 | * The memory footprint per changeset during pull/unbundle |
|
24 | 27 | operations has been further reduced. |
|
25 | 28 |
@@ -333,7 +333,7 b' Show all commands + options' | |||
|
333 | 333 | debugwhyunstable: |
|
334 | 334 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
335 | 335 | debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure |
|
336 | diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos | |
|
336 | diff: rev, from, to, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos | |
|
337 | 337 | export: bookmark, output, switch-parent, rev, text, git, binary, nodates, template |
|
338 | 338 | files: rev, print0, include, exclude, template, subrepos |
|
339 | 339 | forget: interactive, include, exclude, dry-run |
@@ -1,4 +1,4 b'' | |||
|
1 | Testing diff --change | |
|
1 | Testing diff --change, --from, --to | |
|
2 | 2 | |
|
3 | 3 | $ hg init a |
|
4 | 4 | $ cd a |
@@ -29,6 +29,59 b' Testing diff --change' | |||
|
29 | 29 | -first |
|
30 | 30 | +second |
|
31 | 31 | |
|
32 | Test --from and --to | |
|
33 | ||
|
34 | $ hg diff --from . --rev . | |
|
35 | abort: cannot specify both --from and --rev | |
|
36 | [10] | |
|
37 | $ hg diff --to . --rev . | |
|
38 | abort: cannot specify both --to and --rev | |
|
39 | [10] | |
|
40 | $ hg diff --from . --change . | |
|
41 | abort: cannot specify both --from and --change | |
|
42 | [10] | |
|
43 | $ hg diff --to . --change . | |
|
44 | abort: cannot specify both --to and --change | |
|
45 | [10] | |
|
46 | $ echo dirty > file.txt | |
|
47 | $ hg diff --from . | |
|
48 | diff -r bf5ff72eb7e0 file.txt | |
|
49 | --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
50 | +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
51 | @@ -1,1 +1,1 @@ | |
|
52 | -third | |
|
53 | +dirty | |
|
54 | $ hg diff --from . --reverse | |
|
55 | diff -r bf5ff72eb7e0 file.txt | |
|
56 | --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
57 | +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
58 | @@ -1,1 +1,1 @@ | |
|
59 | -dirty | |
|
60 | +third | |
|
61 | $ hg diff --to . | |
|
62 | diff -r bf5ff72eb7e0 file.txt | |
|
63 | --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
64 | +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
65 | @@ -1,1 +1,1 @@ | |
|
66 | -dirty | |
|
67 | +third | |
|
68 | $ hg diff --from 0 --to 2 | |
|
69 | diff -r 4bb65dda5db4 -r bf5ff72eb7e0 file.txt | |
|
70 | --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
71 | +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
72 | @@ -1,1 +1,1 @@ | |
|
73 | -first | |
|
74 | +third | |
|
75 | $ hg diff --from 2 --to 0 | |
|
76 | diff -r bf5ff72eb7e0 -r 4bb65dda5db4 file.txt | |
|
77 | --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
78 | +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 | |
|
79 | @@ -1,1 +1,1 @@ | |
|
80 | -third | |
|
81 | +first | |
|
82 | $ hg co -C . | |
|
83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
84 | ||
|
32 | 85 |
$ |
|
33 | 86 | |
|
34 | 87 | Test dumb revspecs: top-level "x:y", "x:", ":y" and ":" ranges should be handled |
@@ -662,6 +662,8 b' Test command without options' | |||
|
662 | 662 | options ([+] can be repeated): |
|
663 | 663 | |
|
664 | 664 | -r --rev REV [+] revision |
|
665 | --from REV revision to diff from | |
|
666 | --to REV revision to diff to | |
|
665 | 667 | -c --change REV change made by revision |
|
666 | 668 | -a --text treat all files as text |
|
667 | 669 | -g --git use git extended diff format |
General Comments 0
You need to be logged in to leave comments.
Login now