tests/test-diff-unified.t
author Sune Foldager <cryo@cyanite.org>
Mon, 13 Sep 2010 16:25:13 +0200
changeset 12278 c4c2ba553401
parent 12141 5f44daa8fbd0
child 12316 4134686b83e1
permissions -rw-r--r--
merge with stable
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'
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    49
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    51
  $ hg diff --nodates -U 2
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    52
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    53
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    54
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    55
  @@ -3,5 +3,5 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    56
   a
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
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    59
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    60
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    61
   a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    63
  $ hg --config diff.unified=2 diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    64
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    65
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    66
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    67
  @@ -3,5 +3,5 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    68
   a
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
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    71
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    72
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    73
   a
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    74
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    75
  $ hg diff --nodates -U 1
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    76
  diff -r cf9f4ba66af2 a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    77
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    78
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    79
  @@ -4,3 +4,3 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    80
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    81
  -b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    82
  +dd
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    83
   a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    84
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    85
invalid diff.unified
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    86
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    87
  $ hg --config diff.unified=foo diff --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    88
  abort: diff context lines count must be an integer, not 'foo'
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    89
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    90
test off-by-one error with diff -p
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    91
12141
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    92
  $ hg init diffp
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    93
  $ cd diffp
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    94
  $ echo a > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    95
  $ hg ci -Ama
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    96
  adding a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    97
  $ rm a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    98
  $ echo b > a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
    99
  $ echo a >> a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   100
  $ echo c >> a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   101
  $ hg diff -U0 -p --nodates
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   102
  diff -r cb9a9f314b8b a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   103
  --- a/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   104
  +++ b/a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   105
  @@ -1,0 +1,1 @@
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   106
  +b
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   107
  @@ -2,0 +3,1 @@ a
5f44daa8fbd0 tests: unify test-diff-unified
Adrian Buehlmann <adrian@cadifra.com>
parents: 7440
diff changeset
   108
  +c
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   109