tests/test-diff-upgrade
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 21 Feb 2010 22:16:35 +0100
branchstable
changeset 10521 bde1bb250fc2
parent 10189 e451e599fbcf
child 11551 4484a7b661f2
child 12575 9b3913baba0c
permissions -rwxr-xr-x
Do not use osutil.c with python 2.4 and Windows (issue1364) Windows python 2.4 os.stat() reports times including DST offset, while osutil.c reports the correct value, which makes status() systematically compare files content. This bug is fixed in python 2.5. Using osutil.py instead of osutil.c is 4x times slower on large repositories but current code is completely unusable. Given few people are likely to use python 2.4 on Windows this solution was considered a good trade-off compared to more invasive solutions trying to address the offset issue.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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')"
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
hg ci -Am addfiles
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
echo regular >> regular
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
echo newregular >> newregular
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
rm rmempty
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
touch newempty
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
rm rmregular
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
echo exec >> exec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
echo newexec > newexec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
chmod +x newexec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
rm rmexec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
chmod +x setexec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
chmod -x unsetexec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
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
    36
python -c "file('newbinary', 'wb').write('\0')"
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
rm rmbinary
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
hg addremove
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
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
    41
hg autodiff --git=no
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
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
    44
hg autodiff --git=yes regular
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
echo '% git=auto: regular diff for regular files and removals'
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
hg autodiff --git=auto regular newregular rmregular rmbinary rmexec
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
for f in exec newexec setexec unsetexec binary newbinary newempty rmempty; do
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
    echo '% git=auto: git diff for' $f
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
    hg autodiff --git=auto $f
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
done
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
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
    55
hg autodiff --git=warn
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=abort: fail on execute bit change'
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
hg autodiff --git=abort regular setexec
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: succeed on regular file'
e451e599fbcf patch: support diff data loss detection and upgrade
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
hg autodiff --git=abort regular
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
cd ..