Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-diff-ignore-whitespace @ 5192:33015dac5df5
convert: fix mercurial_sink.putcommit
Changeset 4ebc8693ce72 added some code to putcommit to avoid creating a
revision that touches no files, but this can break regular conversions
from some repositories:
- conceptually, since we're converting a repo, we should try to make
the new hg repo as similar as possible to the original repo - we
should create a new changeset, even if the original revision didn't
touch any files (maybe the commit message had some important bit);
- even if a "regular" revision that doesn't touch any file may seem
weird (and maybe even broken), it's completely legitimate for a merge
revision to not touch any file, and, if we just skip it, the
converted repo will end up with wrong history and possibly an extra
head.
As an example, say the crew and main hg repos are sync'ed. Somebody
sends an important patch to the mailing list. Matt quickly applies
and pushes it. But at the same time somebody also applies it to crew
and pushes it. Suppose the commit message ended up being a bit
different (say, there was a typo and somebody didn't fix it) or that
the date ended up being different (because of different patch-applying
scripts): the changeset hashes will be different, but the manifests
will be the same.
Since both changesets were pushed to public repos, it's hard to recall
them. If both are merged, the manifest from the resulting merge
revision will have the exact same contents as its parents - i.e. the
merge revision really doesn't touch any file at all.
To keep the file filtering stuff "working", the generic code was changed
to skip empty revisions if we're filtering the repo, fixing a bug in the
process (we want parents[0] instead of tip).
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 17 Aug 2007 20:18:05 -0300 |
parents | 372d93f03d3a |
children |
rev | line source |
---|---|
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
3 # GNU diff is the reference for all of these results. |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
4 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
5 hgdiff() { |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
6 echo hg diff $@ |
3192
096f1c73cdc3
Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents:
2610
diff
changeset
|
7 hg diff --nodates "$@" |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
8 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
9 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
10 test_added_blank_lines() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
11 printf '\nhello world\n\ngoodbye world\n\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
12 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
13 echo '>>> two diffs showing three added lines <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
14 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
16 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
17 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
18 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
19 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
20 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
21 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
22 test_added_horizontal_space_first_on_a_line() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
23 printf '\t hello world\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
24 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 echo '>>> four diffs showing added space first on the first line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
26 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
27 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
28 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
29 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
30 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
31 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
32 test_added_horizontal_space_last_on_a_line() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
33 printf 'hello world\t \ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
34 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
35 echo '>>> two diffs showing space appended to the first line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
36 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
37 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
38 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
39 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
40 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
41 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
42 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
43 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
44 test_added_horizontal_space_in_the_middle_of_a_word() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
45 printf 'hello world\ngood bye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
46 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
47 echo '>>> four diffs showing space inserted into "goodbye" <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
48 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
49 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
50 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
51 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
52 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
53 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
54 test_increased_horizontal_whitespace_amount() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
55 printf 'hello world\ngoodbye\t\t \tworld\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
56 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
57 echo '>>> two diffs showing changed whitespace amount in the last line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
58 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
59 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
60 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
61 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
62 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
63 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
64 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
65 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
66 test_added_blank_line_with_horizontal_whitespace() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
67 printf 'hello world\n \t\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
68 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
69 echo '>>> four diffs showing added blank line w/horizontal space <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
70 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
71 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
72 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
73 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
74 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
75 |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
76 test_added_blank_line_with_other_whitespace() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
77 printf 'hello world\n \t\ngoodbye world \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
78 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
79 echo '>>> three diffs showing added blank line w/other space <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
80 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
81 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
82 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
83 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
84 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
85 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
86 test_whitespace_changes() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
87 printf 'helloworld\ngoodbye\tworld \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
88 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
89 echo '>>> four diffs showing changed whitespace <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
90 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
91 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
92 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
93 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
94 hgdiff -w |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
95 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
96 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
97 test_whitespace_changes_and_blank_lines() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
98 printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
99 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
100 echo '>>> five diffs showing changed whitespace <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
101 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
102 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
103 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
104 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
105 hgdiff -w |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
106 hgdiff -wB |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
107 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
108 |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
109 hg init |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
110 printf 'hello world\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
111 hg ci -Amfoo -ufoo -d '0 0' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
112 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
113 test_added_blank_lines |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
114 test_added_horizontal_space_first_on_a_line |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
115 test_added_horizontal_space_last_on_a_line |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
116 test_added_horizontal_space_in_the_middle_of_a_word |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
117 test_increased_horizontal_whitespace_amount |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
118 test_added_blank_line_with_horizontal_whitespace |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
119 test_added_blank_line_with_other_whitespace |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
120 test_whitespace_changes |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3192
diff
changeset
|
121 test_whitespace_changes_and_blank_lines |