tests/test-eol-hook.t
author Martin Geisler <mg@lazybytes.net>
Sat, 23 Oct 2010 18:33:57 +0200
branchstable
changeset 12839 d85e30889f26
parent 12423 10c3385fa89e
child 13501 50b825c1adb1
permissions -rw-r--r--
patchbomb: fix stray backslash in docstring While both '\ ' and '\\ ' parse the same in Python, the difference trips up hggettext so that it cannot find the docstring in the source file and thus cannot write the right line number to i18n/hg.pot. While the line number is not essential, it can be used to lookup the original message.
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
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    24
  > **.txt = native
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    25
  > EOF
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    26
  $ hg add .hgeol
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    27
  $ hg commit -m 'Commit .hgeol'
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    28
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    29
  $ printf "first\nsecond\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    30
  $ hg add a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    31
  $ hg commit -m 'LF a.txt'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    32
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    33
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    34
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    35
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    36
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    37
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    38
  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
    39
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    40
  $ printf "first\r\nsecond\r\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    41
  $ hg commit -m 'CRLF a.txt'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    42
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    43
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    44
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    45
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    46
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    47
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    48
  added 1 changesets with 1 changes to 1 files
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    49
  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
    50
  transaction abort!
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    51
  rollback completed
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    52
  abort: a.txt should not have CRLF line endings
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    53
  [255]
11249
0bb67503ad4b eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    54
12423
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    55
  $ printf "first\nsecond\nthird\n" > a.txt
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    56
  $ hg commit -m 'LF a.txt (fixed)'
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    57
  $ hg push ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    58
  pushing to ../main
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    59
  searching for changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    60
  adding changesets
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    61
  adding manifests
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    62
  adding file changes
10c3385fa89e tests: unify test-eol-hook
Matt Mackall <mpm@selenic.com>
parents: 11249
diff changeset
    63
  added 2 changesets with 2 changes to 1 files