annotate tests/test-diffstat.t @ 32320:0e29ce16ec38

diffstat: properly count lines starting in '--' or '++' (issue5479) Lines that start in '--' or '++' were previously not counted as deletions or additions in diffstat, resulting in incorrect addition/deletion counts. The bug was present if the start of the line, combined with the diff character resulted in '---' or '+++'. diffstatdata will now track, for each file, if it has moved pas the header section by looking for a line beginning with '@@'. Once that has happened, lines beginning with '-' or '+' will be counted for deletions and additions. Once a line beginning with 'diff' is found, the process starts over.
author Andrew Zwicky <andrew.zwicky@gmail.com>
date Wed, 17 May 2017 20:51:17 -0500
parents 2e0301ac5c91
children 4441705b7111 058c725925e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
1 $ hg init repo
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
2 $ cd repo
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
3 $ i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=`expr $i + 1`; done
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
4 $ hg add a
14437
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
5 $ cp a b
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
6 $ hg add b
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
7
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
8 Wide diffstat:
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
9
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
10 $ hg diff --stat
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
11 a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14437
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
12 b | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
13 2 files changed, 426 insertions(+), 0 deletions(-)
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
14
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
15 diffstat width:
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
16
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
17 $ COLUMNS=24 hg diff --config ui.interactive=true --stat
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
18 a | 213 ++++++++++++++
14437
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
19 b | 213 ++++++++++++++
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
20 2 files changed, 426 insertions(+), 0 deletions(-)
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
21
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
22 $ hg ci -m adda
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
23
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
24 $ cat >> a <<EOF
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
25 > a
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
26 > a
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
27 > a
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
28 > EOF
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
29
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
30 Narrow diffstat:
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
31
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
32 $ hg diff --stat
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
33 a | 3 +++
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
34 1 files changed, 3 insertions(+), 0 deletions(-)
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
35
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
36 $ hg ci -m appenda
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
37
16098
c6c9b83a1e8a tests: tighten checks for octal escapes in shell printf.
Jim Hague <jim.hague@acm.org>
parents: 15363
diff changeset
38 >>> open("c", "wb").write("\0")
15363
628a4a9e411d diffstat: be more picky when marking file as 'binary' (issue2816)
Patrick Mezard <pmezard@gmail.com>
parents: 14437
diff changeset
39 $ touch d
628a4a9e411d diffstat: be more picky when marking file as 'binary' (issue2816)
Patrick Mezard <pmezard@gmail.com>
parents: 14437
diff changeset
40 $ hg add c d
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
41
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
42 Binary diffstat:
9640
9e76232fbfbe diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
diff changeset
43
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
44 $ hg diff --stat
15363
628a4a9e411d diffstat: be more picky when marking file as 'binary' (issue2816)
Patrick Mezard <pmezard@gmail.com>
parents: 14437
diff changeset
45 c | Bin
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
46 1 files changed, 0 insertions(+), 0 deletions(-)
9642
7d17794f08a9 diffstat: with --git, mark binary files with Bin
Brodie Rao <me+hg@dackz.net>
parents: 9640
diff changeset
47
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
48 Binary git diffstat:
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
49
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
50 $ hg diff --stat --git
14437
cbe13e6bdc34 patch: restore the previous output of 'diff --stat'
Steven Brown <StevenGBrown@gmail.com>
parents: 13395
diff changeset
51 c | Bin
15363
628a4a9e411d diffstat: be more picky when marking file as 'binary' (issue2816)
Patrick Mezard <pmezard@gmail.com>
parents: 14437
diff changeset
52 d | 0
628a4a9e411d diffstat: be more picky when marking file as 'binary' (issue2816)
Patrick Mezard <pmezard@gmail.com>
parents: 14437
diff changeset
53 2 files changed, 0 insertions(+), 0 deletions(-)
12147
2b171fe378c0 tests: unify test-diffstat
Adrian Buehlmann <adrian@cadifra.com>
parents: 9799
diff changeset
54
13395
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
55 $ hg ci -m createb
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
56
16098
c6c9b83a1e8a tests: tighten checks for octal escapes in shell printf.
Jim Hague <jim.hague@acm.org>
parents: 15363
diff changeset
57 >>> open("file with spaces", "wb").write("\0")
13395
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
58 $ hg add "file with spaces"
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
59
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
60 Filename with spaces diffstat:
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
61
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
62 $ hg diff --stat
15363
628a4a9e411d diffstat: be more picky when marking file as 'binary' (issue2816)
Patrick Mezard <pmezard@gmail.com>
parents: 14437
diff changeset
63 file with spaces | Bin
13395
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
64 1 files changed, 0 insertions(+), 0 deletions(-)
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
65
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
66 Filename with spaces git diffstat:
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
67
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
68 $ hg diff --stat --git
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
69 file with spaces | Bin
104c9ed93fc5 diffstat: fix parsing of filenames with spaces
Gastón Kleiman <gaston.kleiman@gmail.com>
parents: 12147
diff changeset
70 1 files changed, 0 insertions(+), 0 deletions(-)
17346
2944a6d35158 check-code: fix check for trailing whitespace on empty lines
Mads Kiilerich <mads@kiilerich.com>
parents: 16913
diff changeset
71
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
72 diffstat within directories:
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
73
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
74 $ hg rm -f 'file with spaces'
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
75
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
76 $ mkdir dir1 dir2
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
77 $ echo new1 > dir1/new
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
78 $ echo new2 > dir2/new
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
79 $ hg add dir1/new dir2/new
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
80 $ hg diff --stat
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
81 dir1/new | 1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
82 dir2/new | 1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
83 2 files changed, 2 insertions(+), 0 deletions(-)
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
84
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
85 $ hg diff --stat --root dir1
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
86 new | 1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
87 1 files changed, 1 insertions(+), 0 deletions(-)
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
88
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
89 $ hg diff --stat --root dir1 dir2
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
90 warning: dir2 not inside relative root dir1
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
91
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
92 $ hg diff --stat --root dir1 -I dir1/old
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
93
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
94 $ cd dir1
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
95 $ hg diff --stat .
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
96 dir1/new | 1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
97 1 files changed, 1 insertions(+), 0 deletions(-)
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
98 $ hg diff --stat --root .
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
99 new | 1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
100 1 files changed, 1 insertions(+), 0 deletions(-)
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
101
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
102 $ hg diff --stat --root ../dir1 ../dir2
24497
2e0301ac5c91 test-diffstat: add a glob the test runner wants on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 24455
diff changeset
103 warning: ../dir2 not inside relative root . (glob)
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
104
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
105 $ hg diff --stat --root . -I old
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
106
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16098
diff changeset
107 $ cd ..
32320
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
108
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
109 Files with lines beginning with '--' or '++' should be properly counted in diffstat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
110
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
111 $ hg up -Cr tip
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
112 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
113 $ rm dir1/new
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
114 $ rm dir2/new
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
115 $ rm "file with spaces"
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
116 $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
117 > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
118 > line 2
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
119 > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
120 > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
121 $ hg commit -Am file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
122 adding file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
123
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
124 Lines added starting with '--' should count as additions
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
125 $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
126 > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
127 > -- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
128 > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
129 > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
130
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
131 $ hg diff --root .
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
132 diff -r be1569354b24 file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
133 --- a/file Thu Jan 01 00:00:00 1970 +0000
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
134 +++ b/file * (glob)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
135 @@ -1,3 +1,3 @@
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
136 line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
137 -line 2
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
138 +-- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
139 line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
140
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
141 $ hg diff --root . --stat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
142 file | 2 +-
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
143 1 files changed, 1 insertions(+), 1 deletions(-)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
144
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
145 Lines changed starting with '--' should count as deletions
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
146 $ hg commit -m filev2
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
147 $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
148 > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
149 > -- line 2, with dashes, changed again
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
150 > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
151 > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
152
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
153 $ hg diff --root .
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
154 diff -r 160f7c034df6 file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
155 --- a/file Thu Jan 01 00:00:00 1970 +0000
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
156 +++ b/file * (glob)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
157 @@ -1,3 +1,3 @@
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
158 line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
159 --- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
160 +-- line 2, with dashes, changed again
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
161 line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
162
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
163 $ hg diff --root . --stat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
164 file | 2 +-
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
165 1 files changed, 1 insertions(+), 1 deletions(-)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
166
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
167 Lines changed starting with '--' should count as deletions
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
168 and starting with '++' should count as additions
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
169 $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
170 > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
171 > ++ line 2, switched dashes to plusses
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
172 > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
173 > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
174
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
175 $ hg diff --root .
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
176 diff -r 160f7c034df6 file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
177 --- a/file Thu Jan 01 00:00:00 1970 +0000
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
178 +++ b/file * (glob)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
179 @@ -1,3 +1,3 @@
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
180 line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
181 --- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
182 +++ line 2, switched dashes to plusses
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
183 line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
184
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
185 $ hg diff --root . --stat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
186 file | 2 +-
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
187 1 files changed, 1 insertions(+), 1 deletions(-)