Mercurial > hg
annotate tests/test-eol @ 11988:8380ed691df8
util: add an interpolate() function to for replacing multiple values
util.interpolate can be used to replace multiple items in a string all at once
(and optionally apply a function to the replacement), without worrying about
recursing:
>>> import util
>>> s = '$foo, $spam'
>>> util.interpolate(r'\$', { 'foo': 'bar', 'spam': 'eggs' }, s)
'bar, eggs'
>>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s)
'spam, foo'
>>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s, lambda s: s.upper())
'SPAM, FOO'
The patch also changes filemerge.py to use this new function.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Wed, 18 Aug 2010 18:18:26 -0400 |
parents | 0bb67503ad4b |
children |
rev | line source |
---|---|
11249
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
1 #!/bin/sh |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
2 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
3 cat > $HGRCPATH <<EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
4 [diff] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
5 git = True |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
6 EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
7 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
8 cat > switch-eol.py <<EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
9 import sys |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
10 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
11 try: |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
12 import os, msvcrt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
13 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
14 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
15 except ImportError: |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
16 pass |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
17 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
18 (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n') |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
19 print "%% switching encoding from %r to %r" % (old, new) |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
20 for path in sys.argv[2:]: |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
21 data = file(path, 'rb').read() |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
22 data = data.replace(old, new) |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
23 file(path, 'wb').write(data) |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
24 EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
25 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
26 seteol () { |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
27 if [ $1 = "LF" ]; then |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
28 EOL='\n' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
29 else |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
30 EOL='\r\n' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
31 fi |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
32 } |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
33 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
34 makerepo () { |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
35 seteol $1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
36 echo "% setup $1 repository" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
37 hg init repo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
38 cd repo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
39 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
40 cat > .hgeol <<EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
41 [repository] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
42 native = $1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
43 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
44 [patterns] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
45 mixed.txt = BIN |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
46 **.txt = native |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
47 EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
48 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
49 printf "first${EOL}second${EOL}third${EOL}" > a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
50 hg commit --addremove -m 'checkin' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
51 echo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
52 cd .. |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
53 } |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
54 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
55 dotest () { |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
56 seteol $1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
57 echo "% hg clone repo repo-$1" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
58 hg clone --noupdate repo repo-$1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
59 cd repo-$1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
60 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
61 cat > .hg/hgrc <<EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
62 [extensions] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
63 eol = |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
64 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
65 [eol] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
66 native = $1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
67 EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
68 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
69 hg update |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
70 echo '% printrepr.py a.txt' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
71 python $TESTDIR/printrepr.py < a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
72 echo '% hg cat a.txt' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
73 hg cat a.txt | python $TESTDIR/printrepr.py |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
74 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
75 printf "fourth${EOL}" >> a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
76 echo '% printrepr.py a.txt' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
77 python $TESTDIR/printrepr.py < a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
78 hg diff | python $TESTDIR/printrepr.py |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
79 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
80 python ../switch-eol.py $1 a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
81 echo '% hg diff only reports a single changed line:' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
82 hg diff | python $TESTDIR/printrepr.py |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
83 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
84 echo "% reverting back to $1 format" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
85 hg revert a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
86 python $TESTDIR/printrepr.py < a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
87 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
88 printf "first\r\nsecond\n" > mixed.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
89 hg add mixed.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
90 echo "% hg commit of inconsistent .txt file marked as binary (should work)" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
91 hg commit -m 'binary file' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
92 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
93 echo "% hg commit of inconsistent .txt file marked as native (should fail)" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
94 printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
95 hg commit -m 'inconsistent file' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
96 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
97 echo "% hg commit --config eol.only-consistent=False (should work)" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
98 hg commit --config eol.only-consistent=False -m 'inconsistent file' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
99 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
100 echo "% hg commit of binary .txt file marked as native (binary files always okay)" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
101 printf "first${EOL}\0${EOL}third${EOL}" > a.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
102 hg commit -m 'binary file' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
103 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
104 cd .. |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
105 rm -r repo-$1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
106 } |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
107 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
108 makerepo LF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
109 dotest LF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
110 dotest CRLF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
111 rm -r repo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
112 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
113 makerepo CRLF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
114 dotest LF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
115 dotest CRLF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
116 rm -r repo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
117 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
118 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
119 makemixedrepo () { |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
120 echo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
121 echo "# setup $1 repository" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
122 hg init mixed |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
123 cd mixed |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
124 printf "foo\r\nbar\r\nbaz\r\n" > win.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
125 printf "foo\nbar\nbaz\n" > unix.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
126 #printf "foo\r\nbar\nbaz\r\n" > mixed.txt |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
127 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
128 hg commit --addremove -m 'created mixed files' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
129 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
130 echo "# setting repository-native EOLs to $1" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
131 cat > .hgeol <<EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
132 [repository] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
133 native = $1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
134 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
135 [patterns] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
136 **.txt = native |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
137 EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
138 hg commit --addremove -m 'added .hgeol' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
139 cd .. |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
140 } |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
141 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
142 testmixed () { |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
143 echo |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
144 echo "% hg clone mixed mixed-$1" |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
145 hg clone mixed mixed-$1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
146 cd mixed-$1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
147 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
148 echo '% hg status (eol extension not yet activated)' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
149 hg status |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
150 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
151 cat > .hg/hgrc <<EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
152 [extensions] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
153 eol = |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
154 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
155 [eol] |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
156 native = $1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
157 EOF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
158 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
159 echo '% hg status (eol activated)' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
160 hg status |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
161 echo '% hg commit' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
162 hg commit -m 'synchronized EOLs' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
163 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
164 echo '% hg status' |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
165 hg status |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
166 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
167 cd .. |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
168 rm -r mixed-$1 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
169 } |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
170 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
171 makemixedrepo LF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
172 testmixed LF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
173 testmixed CRLF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
174 rm -r mixed |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
175 |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
176 makemixedrepo CRLF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
177 testmixed LF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
178 testmixed CRLF |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
179 rm -r mixed |
0bb67503ad4b
eol: extension for managing file EOLs
Martin Geisler <mg@lazybytes.net>
parents:
diff
changeset
|
180 |