tests/test-diffstat.t
author Simon Sapin <simon.sapin@octobus.net>
Mon, 11 Oct 2021 18:23:17 +0200
changeset 48188 77fc340acad7
parent 46548 0492002560f3
permissions -rw-r--r--
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes This file format modification was previously left incomplete because of planned upcoming changes. Not all of these changes have been made yet, but documenting what exists today will help talking more widely about it. Differential Revision: https://phab.mercurial-scm.org/D11625
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
37367
87c4253bebdb py3: suppress the output of open() using `and None`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35570
diff changeset
    38
  >>> open("c", "wb").write(b"\0") and None
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
37367
87c4253bebdb py3: suppress the output of open() using `and None`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35570
diff changeset
    57
  >>> open("file with spaces", "wb").write(b"\0") and None
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
35430
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    72
Filename without "a/" or "b/" (issue5759):
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    73
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    74
  $ hg diff --config 'diff.noprefix=1' -c1 --stat --git
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    75
   a |  3 +++
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    76
   1 files changed, 3 insertions(+), 0 deletions(-)
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    77
  $ hg diff --config 'diff.noprefix=1' -c2 --stat --git
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    78
   c |  Bin 
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    79
   d |    0 
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    80
   2 files changed, 0 insertions(+), 0 deletions(-)
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    81
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    82
  $ hg log --config 'diff.noprefix=1' -r '1:' -p --stat --git
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    83
  changeset:   1:3a95b07bb77f
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    84
  user:        test
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    85
  date:        Thu Jan 01 00:00:00 1970 +0000
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    86
  summary:     appenda
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    87
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    88
   a |  3 +++
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    89
   1 files changed, 3 insertions(+), 0 deletions(-)
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    90
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    91
  diff --git a a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    92
  --- a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    93
  +++ a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    94
  @@ -211,3 +211,6 @@
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    95
   a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    96
   a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    97
   a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    98
  +a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
    99
  +a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   100
  +a
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   101
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   102
  changeset:   2:c60a6c753773
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   103
  tag:         tip
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   104
  user:        test
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   105
  date:        Thu Jan 01 00:00:00 1970 +0000
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   106
  summary:     createb
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   107
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   108
   c |  Bin 
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   109
   d |    0 
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   110
   2 files changed, 0 insertions(+), 0 deletions(-)
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   111
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   112
  diff --git c c
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   113
  new file mode 100644
46548
0492002560f3 tests: accept output changes by 33350debb480
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 41784
diff changeset
   114
  index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d
35430
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   115
  GIT binary patch
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   116
  literal 1
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   117
  Ic${MZ000310RR91
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   118
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   119
  diff --git d d
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   120
  new file mode 100644
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   121
  
058c725925e3 diff: disable diff.noprefix option for diffstat (issue5759)
Yuya Nishihara <yuya@tcha.org>
parents: 32320
diff changeset
   122
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   123
diffstat within directories:
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   124
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   125
  $ 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
   126
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   127
  $ mkdir dir1 dir2
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   128
  $ echo new1 > dir1/new
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   129
  $ echo new2 > dir2/new
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   130
  $ 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
   131
  $ hg diff --stat
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   132
   dir1/new |  1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   133
   dir2/new |  1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   134
   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
   135
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
   136
  $ 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
   137
   new |  1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   138
   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
   139
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
   140
  $ 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
   141
  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
   142
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
   143
  $ 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
   144
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   145
  $ cd dir1
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   146
  $ hg diff --stat .
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   147
   dir1/new |  1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   148
   1 files changed, 1 insertions(+), 0 deletions(-)
41670
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   149
  $ hg diff --stat . --config ui.relative-paths=yes
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   150
   new |  1 +
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   151
   1 files changed, 1 insertions(+), 0 deletions(-)
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
   152
  $ 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
   153
   new |  1 +
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   154
   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
   155
41670
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   156
  $ hg diff --stat --root . --config ui.relative-paths=yes
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   157
   new |  1 +
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   158
   1 files changed, 1 insertions(+), 0 deletions(-)
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   159
--root trumps ui.relative-paths
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   160
  $ hg diff --stat --root .. --config ui.relative-paths=yes
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   161
   new         |  1 +
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   162
   ../dir2/new |  1 +
db69a763bc89 diff: make --stat respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 41401
diff changeset
   163
   2 files changed, 2 insertions(+), 0 deletions(-)
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
   164
  $ hg diff --stat --root ../dir1 ../dir2
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 32320
diff changeset
   165
  warning: ../dir2 not inside relative root .
24432
e22248f6d257 commands.diff: add support for diffs relative to a subdirectory
Siddharth Agarwal <sid0@fb.com>
parents: 17346
diff changeset
   166
24455
16961d43dc89 diff: rename --relative option to --root
Sean Farley <sean@farley.io>
parents: 24432
diff changeset
   167
  $ 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
   168
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16098
diff changeset
   169
  $ cd ..
32320
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   170
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   171
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
   172
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   173
  $ hg up -Cr tip
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   174
  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
   175
  $ rm dir1/new
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   176
  $ rm dir2/new
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   177
  $ rm "file with spaces"
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   178
  $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   179
  > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   180
  > line 2
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   181
  > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   182
  > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   183
  $ hg commit -Am file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   184
  adding file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   185
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   186
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
   187
  $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   188
  > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   189
  > -- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   190
  > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   191
  > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   192
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   193
  $ hg diff --root .
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   194
  diff -r be1569354b24 file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   195
  --- 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
   196
  +++ b/file	* (glob)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   197
  @@ -1,3 +1,3 @@
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   198
   line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   199
  -line 2
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   200
  +-- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   201
   line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   202
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   203
  $ hg diff --root . --stat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   204
   file |  2 +-
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   205
   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
   206
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   207
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
   208
  $ hg commit -m filev2
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   209
  $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   210
  > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   211
  > -- 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
   212
  > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   213
  > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   214
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   215
  $ hg diff --root .
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   216
  diff -r 160f7c034df6 file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   217
  --- 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
   218
  +++ b/file	* (glob)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   219
  @@ -1,3 +1,3 @@
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   220
   line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   221
  --- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   222
  +-- 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
   223
   line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   224
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   225
  $ hg diff --root . --stat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   226
   file |  2 +-
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   227
   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
   228
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   229
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
   230
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
   231
  $ cat > file << EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   232
  > line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   233
  > ++ 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
   234
  > line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   235
  > EOF
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   236
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   237
  $ hg diff --root .
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   238
  diff -r 160f7c034df6 file
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   239
  --- 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
   240
  +++ b/file	* (glob)
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   241
  @@ -1,3 +1,3 @@
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   242
   line 1
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   243
  --- line 2, with dashes
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   244
  +++ 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
   245
   line 3
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   246
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   247
  $ hg diff --root . --stat
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   248
   file |  2 +-
0e29ce16ec38 diffstat: properly count lines starting in '--' or '++' (issue5479)
Andrew Zwicky <andrew.zwicky@gmail.com>
parents: 24497
diff changeset
   249
   1 files changed, 1 insertions(+), 1 deletions(-)
41375
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   250
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   251
When a file is renamed, --git shouldn't loss the info about old file
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   252
  $ hg init issue6025
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   253
  $ cd issue6025
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   254
  $ echo > a
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   255
  $ hg ci -Am 'add a'
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   256
  adding a
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   257
  $ hg mv a b
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   258
  $ hg diff --git
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   259
  diff --git a/a b/b
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   260
  rename from a
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   261
  rename to b
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   262
  $ hg diff --stat
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   263
   a |  1 -
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   264
   b |  1 +
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   265
   2 files changed, 1 insertions(+), 1 deletions(-)
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   266
  $ hg diff --stat --git
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   267
   a => b |  0 
f1b0d9988825 diffstat: make --git work properly on renames (issue6025)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 37367
diff changeset
   268
   1 files changed, 0 insertions(+), 0 deletions(-)
41401
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   269
-- filename may contain whitespaces
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   270
  $ echo > c
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   271
  $ hg ci -Am 'add c'
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   272
  adding c
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   273
  $ hg mv c 'new c'
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   274
  $ hg diff --git
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   275
  diff --git a/c b/new c
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   276
  rename from c
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   277
  rename to new c
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   278
  $ hg diff --stat
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   279
   c     |  1 -
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   280
   new c |  1 +
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   281
   2 files changed, 1 insertions(+), 1 deletions(-)
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   282
  $ hg diff --stat --git
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   283
   c => new c |  0 
4a33a6bf2b52 diffstat: support filenames with whitespaces on renames
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41375
diff changeset
   284
   1 files changed, 0 insertions(+), 0 deletions(-)
41783
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   285
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   286
Make sure `diff --stat -q --config diff.git-0` shows stat (issue4037)
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   287
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   288
  $ hg status
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   289
  A new c
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   290
  R c
7b04b1154c15 tests: add test to demonstrate issue4037
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41670
diff changeset
   291
  $ hg diff --stat -q
41784
251332dbf33d diff: make sure we output stat even when --git is not passed (issue4037) (BC)
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41783
diff changeset
   292
   c     |  1 -
251332dbf33d diff: make sure we output stat even when --git is not passed (issue4037) (BC)
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41783
diff changeset
   293
   new c |  1 +
251332dbf33d diff: make sure we output stat even when --git is not passed (issue4037) (BC)
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 41783
diff changeset
   294
   2 files changed, 1 insertions(+), 1 deletions(-)