tests/test-eol-hook.t
author Wagner Bruna <wbruna@softwareexpress.com.br>
Wed, 09 Mar 2011 15:29:50 -0300
branchstable
changeset 13573 aa1f3be38ab1
parent 13501 50b825c1adb1
child 13519 43b3b761d9d1
permissions -rw-r--r--
i18n-pt_BR: synchronized with 66d65bccbf06
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
  $ cat > $HGRCPATH <<EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     4
  > [diff]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     5
  > git = True
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     6
  > EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     7
  $ hg init main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     8
  $ cat > main/.hg/hgrc <<EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
     9
  > [extensions]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    10
  > eol =
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    11
  > 
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    12
  > [hooks]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    13
  > pretxnchangegroup = python:hgext.eol.hook
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    14
  > EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    15
  $ hg clone main fork
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    16
  updating to branch default
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    17
  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
    18
  $ cd fork
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    19
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    20
Create repo
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    21
  $ cat > .hgeol <<EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    22
  > [patterns]
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    23
  > mixed.txt = BIN
13501
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    24
  > crlf.txt = CRLF
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    25
  > **.txt = native
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    26
  > EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    27
  $ hg add .hgeol
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    28
  $ hg commit -m 'Commit .hgeol'
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    29
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    30
  $ printf "first\nsecond\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    31
  $ hg add a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    32
  $ hg commit -m 'LF a.txt'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    33
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    34
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    35
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    36
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    37
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    38
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    39
  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
    40
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    41
  $ printf "first\r\nsecond\r\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    42
  $ hg commit -m 'CRLF a.txt'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    43
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    44
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    45
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    46
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    47
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    48
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    49
  added 1 changesets with 1 changes to 1 files
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    50
  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
    51
  transaction abort!
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    52
  rollback completed
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    53
  abort: a.txt should not have CRLF line endings
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    54
  [255]
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    55
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    56
  $ printf "first\nsecond\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    57
  $ hg commit -m 'LF a.txt (fixed)'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    58
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    59
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    60
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    61
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    62
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    63
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    64
  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
    65
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    66
  $ 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
    67
  $ hg add crlf.txt
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    68
  $ 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
    69
  $ hg push ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    70
  pushing to ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    71
  searching for changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    72
  adding changesets
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    73
  adding manifests
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    74
  adding file changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    75
  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
    76
  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
    77
  transaction abort!
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    78
  rollback completed
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    79
  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
    80
  [255]
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    81
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    82
  $ 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
    83
  $ 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
    84
  $ hg push ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    85
  pushing to ../main
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    86
  searching for changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    87
  adding changesets
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    88
  adding manifests
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    89
  adding file changes
50b825c1adb1 eol: stop after first matched rule in hook (issue2660)
Antoine Pitrou <solipsis@pitrou.net>
parents: 12423
diff changeset
    90
  added 2 changesets with 2 changes to 1 files