tests/test-eol-hook.t
author Patrick Mezard <pmezard@gmail.com>
Sun, 06 Mar 2011 15:30:39 +0100
changeset 13542 6e3bf361f70c
parent 13521 c1629963158a
child 13615 686dec753b52
permissions -rw-r--r--
Merge with stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     1
Test the EOL hook
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     2
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     3
  $ hg init main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     4
  $ cat > main/.hg/hgrc <<EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     5
  > [extensions]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     6
  > eol =
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     7
  > 
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     8
  > [hooks]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     9
  > pretxnchangegroup = python:hgext.eol.hook
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    10
  > EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    11
  $ hg clone main fork
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    12
  updating to branch default
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    13
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    14
  $ cd fork
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    15
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    16
Create repo
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    17
  $ cat > .hgeol <<EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    18
  > [patterns]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    19
  > mixed.txt = BIN
13501
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    20
  > crlf.txt = CRLF
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    21
  > **.txt = native
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    22
  > EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    23
  $ hg add .hgeol
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    24
  $ hg commit -m 'Commit .hgeol'
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    25
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    26
  $ printf "first\nsecond\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    27
  $ hg add a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    28
  $ hg commit -m 'LF a.txt'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    29
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    30
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    31
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    32
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    33
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    34
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    35
  added 2 changesets with 2 changes to 2 files
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    36
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    37
  $ printf "first\r\nsecond\r\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    38
  $ hg commit -m 'CRLF a.txt'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    39
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    40
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    41
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    42
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    43
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    44
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    45
  added 1 changesets with 1 changes to 1 files
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    46
  error: pretxnchangegroup hook failed: a.txt should not have CRLF line endings
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    47
  transaction abort!
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    48
  rollback completed
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    49
  abort: a.txt should not have CRLF line endings
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    50
  [255]
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    51
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    52
  $ printf "first\nsecond\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    53
  $ hg commit -m 'LF a.txt (fixed)'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    54
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    55
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    56
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    57
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    58
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    59
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    60
  added 2 changesets with 2 changes to 1 files
13501
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    61
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    62
  $ printf "first\nsecond\nthird\n" > crlf.txt
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    63
  $ hg add crlf.txt
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    64
  $ hg commit -m 'LF crlf.txt'
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    65
  $ hg push ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    66
  pushing to ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    67
  searching for changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    68
  adding changesets
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    69
  adding manifests
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    70
  adding file changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    71
  added 1 changesets with 1 changes to 1 files
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    72
  error: pretxnchangegroup hook failed: crlf.txt should not have LF line endings
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    73
  transaction abort!
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    74
  rollback completed
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    75
  abort: crlf.txt should not have LF line endings
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    76
  [255]
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    77
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    78
  $ printf "first\r\nsecond\r\nthird\r\n" > crlf.txt
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    79
  $ hg commit -m 'CRLF crlf.txt (fixed)'
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    80
  $ hg push ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    81
  pushing to ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    82
  searching for changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    83
  adding changesets
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    84
  adding manifests
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    85
  adding file changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    86
  added 2 changesets with 2 changes to 1 files