tests/test-diff-unified.t
author Siddharth Agarwal <sid0@fb.com>
Thu, 13 Nov 2014 00:08:44 -0800
changeset 23297 d7abae94a7a0
parent 16912 6ef3107c661e
child 23298 dc4d0c7b7d94
permissions -rw-r--r--
patch.diffopts: add support for noprefix In an upcoming patch we'll enable support as an option to 'hg diff' as well. The tests reflect the current state of the world -- as we add support we'll see changes in the test output.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     1
  $ hg init repo
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     2
  $ cd repo
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     3
  $ cat > a <<EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     4
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     5
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     6
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     7
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     8
  > b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
     9
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    10
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    11
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    12
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    13
  > EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    14
  $ hg ci -Am adda
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    15
  adding a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    17
  $ cat > a <<EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    18
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    19
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    20
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    21
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    22
  > dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    23
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    24
  > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    25
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    26
  > c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    27
  > EOF
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    28
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    29
default context
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    30
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    31
  $ hg diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    32
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    33
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    34
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    35
  @@ -2,7 +2,7 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    36
   c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    37
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    38
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    39
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    40
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    41
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    42
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    43
   c
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    44
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    45
invalid --unified
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    46
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    47
  $ hg diff --nodates -U foo
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    48
  abort: diff context lines count must be an integer, not 'foo'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12141
diff changeset
    49
  [255]
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    50
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    52
  $ hg diff --nodates -U 2
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    53
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    54
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    55
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    56
  @@ -3,5 +3,5 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    57
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    58
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    59
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    60
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    61
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    62
   a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    64
  $ hg --config diff.unified=2 diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    65
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    66
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    67
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    68
  @@ -3,5 +3,5 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    69
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    70
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    71
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    72
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    73
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    74
   a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    76
  $ hg diff --nodates -U 1
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    77
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    78
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    79
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    80
  @@ -4,3 +4,3 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    81
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    82
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    83
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    84
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    85
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    86
invalid diff.unified
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    87
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    88
  $ hg --config diff.unified=foo diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    89
  abort: diff context lines count must be an integer, not 'foo'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12141
diff changeset
    90
  [255]
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    91
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    92
noprefix config
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    93
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    94
  $ hg --config diff.noprefix=True diff --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    95
  diff -r cf9f4ba66af2 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    96
  --- a/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    97
  +++ b/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    98
  @@ -2,7 +2,7 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
    99
   c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   100
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   101
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   102
  -b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   103
  +dd
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   104
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   105
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   106
   c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   107
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   108
noprefix disabled in plain mode
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   109
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   110
  $ HGPLAIN=1 hg --config diff.noprefix=True diff --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   111
  diff -r cf9f4ba66af2 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   112
  --- a/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   113
  +++ b/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   114
  @@ -2,7 +2,7 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   115
   c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   116
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   117
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   118
  -b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   119
  +dd
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   120
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   121
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   122
   c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   123
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   124
  $ cd ..
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   125
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   126
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   127
0 lines of context hunk header matches gnu diff hunk header
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   128
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   129
  $ hg init diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   130
  $ cd diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   131
  $ cat > f1 << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   132
  > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   133
  > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   134
  > c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   135
  > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   136
  $ hg commit -Am0
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   137
  adding f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   138
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   139
  $ cat > f2 << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   140
  > c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   141
  > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   142
  > c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   143
  > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   144
  > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   145
  $ mv f2 f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   146
  $ hg diff -U0 --nodates
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   147
  diff -r 55d8ff78db23 f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   148
  --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   149
  +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   150
  @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   151
  +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   152
  @@ -1,0 +3,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   153
  +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   154
  @@ -3,1 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   155
  -c5
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   156
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   157
  $ hg diff -U0 --nodates --git
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   158
  diff --git a/f1 b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   159
  --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   160
  +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   161
  @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   162
  +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   163
  @@ -1,0 +3,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   164
  +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   165
  @@ -3,1 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   166
  -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   167
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   168
  $ hg diff -U0 --nodates -p
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   169
  diff -r 55d8ff78db23 f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   170
  --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   171
  +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   172
  @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   173
  +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   174
  @@ -1,0 +3,1 @@ c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   175
  +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   176
  @@ -3,1 +4,0 @@ c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   177
  -c5
16362
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   178
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   179
  $ echo a > f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   180
  $ hg ci -m movef2
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   181
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   182
Test diff headers terminating with TAB when necessary (issue3357)
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   183
Regular diff --nodates, file creation
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   184
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   185
  $ hg mv f1 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   186
  $ echo b > 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   187
  $ hg diff --nodates 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   188
  diff -r 7574207d0d15 f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   189
  --- /dev/null
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   190
  +++ b/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   191
  @@ -0,0 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   192
  +b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   193
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   194
Git diff, adding space
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   195
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   196
  $ hg diff --git
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   197
  diff --git a/f1 b/f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   198
  rename from f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   199
  rename to f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   200
  --- a/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   201
  +++ b/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   202
  @@ -1,1 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   203
  -a
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   204
  +b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   205
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   206
Git diff with noprefix
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   207
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   208
  $ hg --config diff.noprefix=True diff --git --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   209
  diff --git a/f1 b/f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   210
  rename from f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   211
  rename to f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   212
  --- a/f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   213
  +++ b/f 1	
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   214
  @@ -1,1 +1,1 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   215
  -a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   216
  +b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   217
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   218
noprefix config disabled in plain mode
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   219
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   220
  $ HGPLAIN=1 hg --config diff.noprefix=True diff --git --nodates
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   221
  diff --git a/f1 b/f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   222
  rename from f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   223
  rename to f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   224
  --- a/f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   225
  +++ b/f 1	
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   226
  @@ -1,1 +1,1 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   227
  -a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   228
  +b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   229
16362
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   230
Regular diff --nodates, file deletion
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   231
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   232
  $ hg ci -m addspace
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   233
  $ hg mv 'f 1' f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   234
  $ echo a > f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   235
  $ hg diff --nodates 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   236
  diff -r ca50fe67c9c7 f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   237
  --- a/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   238
  +++ /dev/null
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   239
  @@ -1,1 +0,0 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   240
  -b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   241
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   242
Git diff, removing space
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   243
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   244
  $ hg diff --git
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   245
  diff --git a/f 1 b/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   246
  rename from f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   247
  rename to f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   248
  --- a/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   249
  +++ b/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   250
  @@ -1,1 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   251
  -b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   252
  +a
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   253
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   254
  $ cd ..