| 1 |
$ hg init repo |
| 2 |
$ cd repo |
| 3 |
$ i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=`expr $i + 1`; done |
| 4 |
$ hg add a |
| 5 |
$ cp a b |
| 6 |
$ hg add b |
| 7 |
|
| 8 |
Wide diffstat: |
| 9 |
|
| 10 |
$ hg diff --stat |
| 11 |
a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 12 |
b | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 13 |
2 files changed, 426 insertions(+), 0 deletions(-) |
| 14 |
|
| 15 |
diffstat width: |
| 16 |
|
| 17 |
$ COLUMNS=24 hg diff --config ui.interactive=true --stat |
| 18 |
a | 213 ++++++++++++++ |
| 19 |
b | 213 ++++++++++++++ |
| 20 |
2 files changed, 426 insertions(+), 0 deletions(-) |
| 21 |
|
| 22 |
$ hg ci -m adda |
| 23 |
|
| 24 |
$ cat >> a <<EOF |
| 25 |
> a |
| 26 |
> a |
| 27 |
> a |
| 28 |
> EOF |
| 29 |
|
| 30 |
Narrow diffstat: |
| 31 |
|
| 32 |
$ hg diff --stat |
| 33 |
a | 3 +++ |
| 34 |
1 files changed, 3 insertions(+), 0 deletions(-) |
| 35 |
|
| 36 |
$ hg ci -m appenda |
| 37 |
|
| 38 |
>>> open("c", "wb").write(b"\0") and None |
| 39 |
$ touch d |
| 40 |
$ hg add c d |
| 41 |
|
| 42 |
Binary diffstat: |
| 43 |
|
| 44 |
$ hg diff --stat |
| 45 |
c | Bin |
| 46 |
1 files changed, 0 insertions(+), 0 deletions(-) |
| 47 |
|
| 48 |
Binary git diffstat: |
| 49 |
|
| 50 |
$ hg diff --stat --git |
| 51 |
c | Bin |
| 52 |
d | 0 |
| 53 |
2 files changed, 0 insertions(+), 0 deletions(-) |
| 54 |
|
| 55 |
$ hg ci -m createb |
| 56 |
|
| 57 |
>>> open("file with spaces", "wb").write(b"\0") and None |
| 58 |
$ hg add "file with spaces" |
| 59 |
|
| 60 |
Filename with spaces diffstat: |
| 61 |
|
| 62 |
$ hg diff --stat |
| 63 |
file with spaces | Bin |
| 64 |
1 files changed, 0 insertions(+), 0 deletions(-) |
| 65 |
|
| 66 |
Filename with spaces git diffstat: |
| 67 |
|
| 68 |
$ hg diff --stat --git |
| 69 |
file with spaces | Bin |
| 70 |
1 files changed, 0 insertions(+), 0 deletions(-) |
| 71 |
|
| 72 |
Filename without "a/" or "b/" (issue5759): |
| 73 |
|
| 74 |
$ hg diff --config 'diff.noprefix=1' -c1 --stat --git |
| 75 |
a | 3 +++ |
| 76 |
1 files changed, 3 insertions(+), 0 deletions(-) |
| 77 |
$ hg diff --config 'diff.noprefix=1' -c2 --stat --git |
| 78 |
c | Bin |
| 79 |
d | 0 |
| 80 |
2 files changed, 0 insertions(+), 0 deletions(-) |
| 81 |
|
| 82 |
$ hg log --config 'diff.noprefix=1' -r '1:' -p --stat --git |
| 83 |
changeset: 1:3a95b07bb77f |
| 84 |
user: test |
| 85 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 86 |
summary: appenda |
| 87 |
|
| 88 |
a | 3 +++ |
| 89 |
1 files changed, 3 insertions(+), 0 deletions(-) |
| 90 |
|
| 91 |
diff --git a a |
| 92 |
--- a |
| 93 |
+++ a |
| 94 |
@@ -211,3 +211,6 @@ |
| 95 |
a |
| 96 |
a |
| 97 |
a |
| 98 |
+a |
| 99 |
+a |
| 100 |
+a |
| 101 |
|
| 102 |
changeset: 2:c60a6c753773 |
| 103 |
tag: tip |
| 104 |
user: test |
| 105 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 106 |
summary: createb |
| 107 |
|
| 108 |
c | Bin |
| 109 |
d | 0 |
| 110 |
2 files changed, 0 insertions(+), 0 deletions(-) |
| 111 |
|
| 112 |
diff --git c c |
| 113 |
new file mode 100644 |
| 114 |
index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d |
| 115 |
GIT binary patch |
| 116 |
literal 1 |
| 117 |
Ic${MZ000310RR91 |
| 118 |
|
| 119 |
diff --git d d |
| 120 |
new file mode 100644 |
| 121 |
|
| 122 |
|
| 123 |
diffstat within directories: |
| 124 |
|
| 125 |
$ hg rm -f 'file with spaces' |
| 126 |
|
| 127 |
$ mkdir dir1 dir2 |
| 128 |
$ echo new1 > dir1/new |
| 129 |
$ echo new2 > dir2/new |
| 130 |
$ hg add dir1/new dir2/new |
| 131 |
$ hg diff --stat |
| 132 |
dir1/new | 1 + |
| 133 |
dir2/new | 1 + |
| 134 |
2 files changed, 2 insertions(+), 0 deletions(-) |
| 135 |
|
| 136 |
$ hg diff --stat --root dir1 |
| 137 |
new | 1 + |
| 138 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 139 |
|
| 140 |
$ hg diff --stat --root dir1 dir2 |
| 141 |
warning: dir2 not inside relative root dir1 |
| 142 |
|
| 143 |
$ hg diff --stat --root dir1 -I dir1/old |
| 144 |
|
| 145 |
$ cd dir1 |
| 146 |
$ hg diff --stat . |
| 147 |
dir1/new | 1 + |
| 148 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 149 |
$ hg diff --stat . --config ui.relative-paths=yes |
| 150 |
new | 1 + |
| 151 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 152 |
$ hg diff --stat --root . |
| 153 |
new | 1 + |
| 154 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 155 |
|
| 156 |
$ hg diff --stat --root . --config ui.relative-paths=yes |
| 157 |
new | 1 + |
| 158 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 159 |
--root trumps ui.relative-paths |
| 160 |
$ hg diff --stat --root .. --config ui.relative-paths=yes |
| 161 |
new | 1 + |
| 162 |
../dir2/new | 1 + |
| 163 |
2 files changed, 2 insertions(+), 0 deletions(-) |
| 164 |
$ hg diff --stat --root ../dir1 ../dir2 |
| 165 |
warning: ../dir2 not inside relative root . |
| 166 |
|
| 167 |
$ hg diff --stat --root . -I old |
| 168 |
|
| 169 |
$ cd .. |
| 170 |
|
| 171 |
Files with lines beginning with '--' or '++' should be properly counted in diffstat |
| 172 |
|
| 173 |
$ hg up -Cr tip |
| 174 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 175 |
$ rm dir1/new |
| 176 |
$ rm dir2/new |
| 177 |
$ rm "file with spaces" |
| 178 |
$ cat > file << EOF |
| 179 |
> line 1 |
| 180 |
> line 2 |
| 181 |
> line 3 |
| 182 |
> EOF |
| 183 |
$ hg commit -Am file |
| 184 |
adding file |
| 185 |
|
| 186 |
Lines added starting with '--' should count as additions |
| 187 |
$ cat > file << EOF |
| 188 |
> line 1 |
| 189 |
> -- line 2, with dashes |
| 190 |
> line 3 |
| 191 |
> EOF |
| 192 |
|
| 193 |
$ hg diff --root . |
| 194 |
diff -r be1569354b24 file |
| 195 |
--- a/file Thu Jan 01 00:00:00 1970 +0000 |
| 196 |
+++ b/file * (glob) |
| 197 |
@@ -1,3 +1,3 @@ |
| 198 |
line 1 |
| 199 |
-line 2 |
| 200 |
+-- line 2, with dashes |
| 201 |
line 3 |
| 202 |
|
| 203 |
$ hg diff --root . --stat |
| 204 |
file | 2 +- |
| 205 |
1 files changed, 1 insertions(+), 1 deletions(-) |
| 206 |
|
| 207 |
Lines changed starting with '--' should count as deletions |
| 208 |
$ hg commit -m filev2 |
| 209 |
$ cat > file << EOF |
| 210 |
> line 1 |
| 211 |
> -- line 2, with dashes, changed again |
| 212 |
> line 3 |
| 213 |
> EOF |
| 214 |
|
| 215 |
$ hg diff --root . |
| 216 |
diff -r 160f7c034df6 file |
| 217 |
--- a/file Thu Jan 01 00:00:00 1970 +0000 |
| 218 |
+++ b/file * (glob) |
| 219 |
@@ -1,3 +1,3 @@ |
| 220 |
line 1 |
| 221 |
--- line 2, with dashes |
| 222 |
+-- line 2, with dashes, changed again |
| 223 |
line 3 |
| 224 |
|
| 225 |
$ hg diff --root . --stat |
| 226 |
file | 2 +- |
| 227 |
1 files changed, 1 insertions(+), 1 deletions(-) |
| 228 |
|
| 229 |
Lines changed starting with '--' should count as deletions |
| 230 |
and starting with '++' should count as additions |
| 231 |
$ cat > file << EOF |
| 232 |
> line 1 |
| 233 |
> ++ line 2, switched dashes to plusses |
| 234 |
> line 3 |
| 235 |
> EOF |
| 236 |
|
| 237 |
$ hg diff --root . |
| 238 |
diff -r 160f7c034df6 file |
| 239 |
--- a/file Thu Jan 01 00:00:00 1970 +0000 |
| 240 |
+++ b/file * (glob) |
| 241 |
@@ -1,3 +1,3 @@ |
| 242 |
line 1 |
| 243 |
--- line 2, with dashes |
| 244 |
+++ line 2, switched dashes to plusses |
| 245 |
line 3 |
| 246 |
|
| 247 |
$ hg diff --root . --stat |
| 248 |
file | 2 +- |
| 249 |
1 files changed, 1 insertions(+), 1 deletions(-) |
| 250 |
|
| 251 |
When a file is renamed, --git shouldn't loss the info about old file |
| 252 |
$ hg init issue6025 |
| 253 |
$ cd issue6025 |
| 254 |
$ echo > a |
| 255 |
$ hg ci -Am 'add a' |
| 256 |
adding a |
| 257 |
$ hg mv a b |
| 258 |
$ hg diff --git |
| 259 |
diff --git a/a b/b |
| 260 |
rename from a |
| 261 |
rename to b |
| 262 |
$ hg diff --stat |
| 263 |
a | 1 - |
| 264 |
b | 1 + |
| 265 |
2 files changed, 1 insertions(+), 1 deletions(-) |
| 266 |
$ hg diff --stat --git |
| 267 |
a => b | 0 |
| 268 |
1 files changed, 0 insertions(+), 0 deletions(-) |
| 269 |
-- filename may contain whitespaces |
| 270 |
$ echo > c |
| 271 |
$ hg ci -Am 'add c' |
| 272 |
adding c |
| 273 |
$ hg mv c 'new c' |
| 274 |
$ hg diff --git |
| 275 |
diff --git a/c b/new c |
| 276 |
rename from c |
| 277 |
rename to new c |
| 278 |
$ hg diff --stat |
| 279 |
c | 1 - |
| 280 |
new c | 1 + |
| 281 |
2 files changed, 1 insertions(+), 1 deletions(-) |
| 282 |
$ hg diff --stat --git |
| 283 |
c => new c | 0 |
| 284 |
1 files changed, 0 insertions(+), 0 deletions(-) |
| 285 |
|
| 286 |
Make sure `diff --stat -q --config diff.git-0` shows stat (issue4037) |
| 287 |
|
| 288 |
$ hg status |
| 289 |
A new c |
| 290 |
R c |
| 291 |
$ hg diff --stat -q |
| 292 |
c | 1 - |
| 293 |
new c | 1 + |
| 294 |
2 files changed, 1 insertions(+), 1 deletions(-) |