author | Patrick Mezard <pmezard@gmail.com> |
Tue, 28 Sep 2010 00:41:08 +0200 | |
branch | stable |
changeset 12576 | 1c9bb7e00f71 |
parent 12575 | 9b3913baba0c |
permissions | -rwxr-xr-x |
10189
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/sh |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 |
echo "[extensions]" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
echo "autodiff=$TESTDIR/autodiff.py" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
echo "[diff]" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 |
echo "nodates=1" >> $HGRCPATH |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 |
hg init repo |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
cd repo |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 |
echo '% make a combination of new, changed and deleted file' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 |
echo regular > regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 |
echo rmregular > rmregular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 |
touch rmempty |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
echo exec > exec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 |
chmod +x exec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 |
echo rmexec > rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 |
chmod +x rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 |
echo setexec > setexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 |
echo unsetexec > unsetexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 |
chmod +x unsetexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 |
echo binary > binary |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 |
python -c "file('rmbinary', 'wb').write('\0')" |
12576
1c9bb7e00f71
patch: test and document a bit binary to regular file upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
12575
diff
changeset
|
23 |
python -c "file('bintoregular', 'wb').write('\0')" |
10189
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 |
hg ci -Am addfiles |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 |
echo regular >> regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 |
echo newregular >> newregular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 |
rm rmempty |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 |
touch newempty |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 |
rm rmregular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 |
echo exec >> exec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 |
echo newexec > newexec |
12576
1c9bb7e00f71
patch: test and document a bit binary to regular file upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
12575
diff
changeset
|
32 |
echo bintoregular > bintoregular |
10189
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 |
chmod +x newexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 |
rm rmexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 |
chmod +x setexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 |
chmod -x unsetexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 |
python -c "file('binary', 'wb').write('\0\0')" |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 |
python -c "file('newbinary', 'wb').write('\0')" |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 |
rm rmbinary |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 |
hg addremove |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 |
echo '% git=no: regular diff for all files' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 |
hg autodiff --git=no |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 |
echo '% git=no: git diff for single regular file' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 |
hg autodiff --git=yes regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 |
|
12575
9b3913baba0c
patch: upgrade to git patch when removing binary file
Patrick Mezard <pmezard@gmail.com>
parents:
10189
diff
changeset
|
48 |
echo '% git=auto: regular diff for regular files and non-binary removals' |
9b3913baba0c
patch: upgrade to git patch when removing binary file
Patrick Mezard <pmezard@gmail.com>
parents:
10189
diff
changeset
|
49 |
hg autodiff --git=auto regular newregular rmregular rmexec |
10189
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 |
|
12576
1c9bb7e00f71
patch: test and document a bit binary to regular file upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
12575
diff
changeset
|
51 |
for f in exec newexec setexec unsetexec binary newbinary newempty rmempty \ |
1c9bb7e00f71
patch: test and document a bit binary to regular file upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
12575
diff
changeset
|
52 |
rmbinary bintoregular; do |
10189
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 |
echo '% git=auto: git diff for' $f |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 |
hg autodiff --git=auto $f |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 |
done |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 |
echo '% git=warn: regular diff with data loss warnings' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 |
hg autodiff --git=warn |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 |
echo '% git=abort: fail on execute bit change' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 |
hg autodiff --git=abort regular setexec |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
63 |
echo '% git=abort: succeed on regular file' |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
64 |
hg autodiff --git=abort regular |
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
65 |
|
e451e599fbcf
patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
66 |
cd .. |