tests/test-diff-unified.t
author Yuya Nishihara <yuya@tcha.org>
Sat, 13 Jun 2015 19:49:54 +0900
changeset 25596 c1975809a6b5
parent 24496 9a4ef1b18cae
child 29948 e40343ce9c4c
permissions -rw-r--r--
templater: take any string literals as template, but not for rawstring (BC) This patch series is intended to unify the interpretation of string literals. It is breaking change that boldly assumes a. string literal "..." never contains template-like fragment or it is intended to be a template b. we tend to use raw string literal r"..." for regexp pattern in which "{" should have different meaning Currently, we don't have a comprehensible rule how string literals are evaluated in template functions. For example, fill() takes "initialindent" and "hangindent" as templates, but not for "text", whereas "text" is a template in pad() function. date(date, fmt) diff(includepattern, excludepattern) fill(text, width, initialident: T, hangindent: T) get(dict, key) if(expr, then: T, else: T) ifcontains(search, thing, then: T, else: T) ifeq(expr1, expr2, then: T, else: T) indent(text, indentchars, firstline) join(list, sep) label(label: T, expr: T) pad(text: T, width, fillchar, right) revset(query, formatargs...]) rstdoc(text, style) shortest(node, minlength) startswith(pattern, text) strip(text, chars) sub(pattern, replacement, expression: T) word(number, text, separator) expr % template: T T: interpret "string" or r"rawstring" as template This patch series adjusts the rule as follows: a. string literal, '' or "", starts template processing (BC) b. raw string literal, r'' or r"", disables both \-escape and template processing (BC, done by subsequent patches) c. fragment not surrounded by {} is non-templated string "ccc{'aaa'}{r'bbb'}" ------------------ *: template --- c: string --- a: template --- b: rawstring Because this can eliminate the compilation of template arguments from the evaluation phase, "hg log -Tdefault" gets faster. % cd mozilla-central % LANG=C HGRCPATH=/dev/null hg log -Tdefault -r0:10000 --time > /dev/null before: real 4.870 secs (user 4.860+0.000 sys 0.010+0.000) after: real 3.480 secs (user 3.440+0.000 sys 0.030+0.000) Also, this will allow us to parse nested templates at once for better error indication.
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
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
    92
noprefix config and option
23297
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
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
    96
  --- a
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
    97
  +++ a
23297
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
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   107
  $ hg diff --noprefix --nodates
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   108
  diff -r cf9f4ba66af2 a
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   109
  --- a
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   110
  +++ a
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   111
  @@ -2,7 +2,7 @@
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   112
   c
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   113
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   114
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   115
  -b
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   116
  +dd
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   117
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   118
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   119
   c
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   120
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   121
noprefix config disabled in plain mode, but option still enabled
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   122
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   123
  $ 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
   124
  diff -r cf9f4ba66af2 a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   125
  --- a/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   126
  +++ b/a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   127
  @@ -2,7 +2,7 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   128
   c
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   129
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   130
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   131
  -b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   132
  +dd
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   133
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   134
   a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   135
   c
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   136
  $ HGPLAIN=1 hg diff --noprefix --nodates
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   137
  diff -r cf9f4ba66af2 a
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   138
  --- a
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   139
  +++ a
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   140
  @@ -2,7 +2,7 @@
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   141
   c
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   142
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   143
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   144
  -b
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   145
  +dd
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   146
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   147
   a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   148
   c
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   149
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   150
  $ cd ..
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   151
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   152
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   153
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
   154
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   155
  $ 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
   156
  $ cd diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   157
  $ 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
   158
  > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   159
  > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   160
  > c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   161
  > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   162
  $ 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
   163
  adding f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   164
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   165
  $ 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
   166
  > c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   167
  > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   168
  > c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   169
  > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   170
  > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   171
  $ 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
   172
  $ 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
   173
  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
   174
  --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   175
  +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   176
  @@ -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
   177
  +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   178
  @@ -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
   179
  +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   180
  @@ -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
   181
  -c5
6467
65029a3aafc2 Let --unified default to diff.unified (issue 1076)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   182
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   183
  $ 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
   184
  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
   185
  --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   186
  +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   187
  @@ -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
   188
  +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   189
  @@ -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
   190
  +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   191
  @@ -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
   192
  -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   193
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   194
  $ 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
   195
  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
   196
  --- a/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   197
  +++ b/f1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   198
  @@ -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
   199
  +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   200
  @@ -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
   201
  +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 12316
diff changeset
   202
  @@ -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
   203
  -c5
16362
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   204
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   205
  $ echo a > f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   206
  $ hg ci -m movef2
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   207
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   208
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
   209
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
   210
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   211
  $ 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
   212
  $ echo b > 'f 1'
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   213
  $ 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
   214
  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
   215
  --- /dev/null
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   216
  +++ b/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   217
  @@ -0,0 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   218
  +b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   219
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   220
Git diff, adding space
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   221
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   222
  $ hg diff --git
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   223
  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
   224
  rename from f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   225
  rename to f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   226
  --- a/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   227
  +++ b/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   228
  @@ -1,1 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   229
  -a
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   230
  +b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   231
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   232
Git diff with noprefix
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   233
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   234
  $ hg --config diff.noprefix=True diff --git --nodates
23300
f8b5c3e77d4b patch.trydiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23299
diff changeset
   235
  diff --git f1 f 1
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   236
  rename from f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   237
  rename to f 1
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   238
  --- f1
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   239
  +++ f 1	
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   240
  @@ -1,1 +1,1 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   241
  -a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   242
  +b
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   243
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   244
noprefix config disabled in plain mode, but option still enabled
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   245
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   246
  $ 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
   247
  diff --git a/f1 b/f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   248
  rename from f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   249
  rename to f 1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   250
  --- a/f1
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   251
  +++ b/f 1	
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   252
  @@ -1,1 +1,1 @@
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   253
  -a
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   254
  +b
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   255
  $ HGPLAIN=1 hg diff --git --noprefix --nodates
23300
f8b5c3e77d4b patch.trydiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23299
diff changeset
   256
  diff --git f1 f 1
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   257
  rename from f1
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   258
  rename to f 1
23299
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   259
  --- f1
1f510efcd5f3 mdiff.unidiff: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 23298
diff changeset
   260
  +++ f 1	
23298
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   261
  @@ -1,1 +1,1 @@
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   262
  -a
dc4d0c7b7d94 diff: add a --noprefix option
Siddharth Agarwal <sid0@fb.com>
parents: 23297
diff changeset
   263
  +b
23297
d7abae94a7a0 patch.diffopts: add support for noprefix
Siddharth Agarwal <sid0@fb.com>
parents: 16912
diff changeset
   264
16362
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   265
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
   266
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   267
  $ hg ci -m addspace
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   268
  $ 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
   269
  $ echo a > f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   270
  $ 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
   271
  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
   272
  --- a/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   273
  +++ /dev/null
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   274
  @@ -1,1 +0,0 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   275
  -b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   276
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   277
Git diff, removing space
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   278
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   279
  $ hg diff --git
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   280
  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
   281
  rename from f 1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   282
  rename to f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   283
  --- a/f 1	
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   284
  +++ b/f1
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   285
  @@ -1,1 +1,1 @@
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   286
  -b
16b75661828e mdiff: fix diff header generation for files with spaces (issue3357)
Patrick Mezard <patrick@mezard.eu>
parents: 16012
diff changeset
   287
  +a
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   288
24496
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   289
showfunc diff
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   290
  $ cat > f1 << EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   291
  > int main() {
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   292
  >     int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   293
  >     int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   294
  >     int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   295
  >     int d = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   296
  >     return a + b + c + d;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   297
  > }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   298
  > EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   299
  $ hg commit -m addfunction
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   300
  $ cat > f1 << EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   301
  > int main() {
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   302
  >     int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   303
  >     int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   304
  >     int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   305
  >     int e = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   306
  >     return a + b + c + e;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   307
  > }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   308
  > EOF
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   309
  $ hg diff --git
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   310
  diff --git a/f1 b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   311
  --- a/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   312
  +++ b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   313
  @@ -2,6 +2,6 @@
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   314
       int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   315
       int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   316
       int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   317
  -    int d = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   318
  -    return a + b + c + d;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   319
  +    int e = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   320
  +    return a + b + c + e;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   321
   }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   322
  $ hg diff --config diff.showfunc=True --git
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   323
  diff --git a/f1 b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   324
  --- a/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   325
  +++ b/f1
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   326
  @@ -2,6 +2,6 @@ int main() {
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   327
       int a = 0;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   328
       int b = 1;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   329
       int c = 2;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   330
  -    int d = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   331
  -    return a + b + c + d;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   332
  +    int e = 3;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   333
  +    return a + b + c + e;
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   334
   }
9a4ef1b18cae tests: add testing for diff.showfunc
Mathias De Maré <mathias.demare@gmail.com>
parents: 23300
diff changeset
   335
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16362
diff changeset
   336
  $ cd ..