tests/test-archive-symlinks
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 02 Aug 2007 01:56:08 -0300
changeset 5053 47a8ea1eb2c3
parent 4862 6f08bc1bd00b
child 5085 92d7ce0da063
permissions -rwxr-xr-x
del transaction before lock before wlock This way rollbacks happen while the repo is still locked. Deleting lock before wlock is not strictly necessary, but is more consistent with the locking order.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4862
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
origdir=`pwd`
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
cat >> readlink.py <<EOF
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
import os
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
import sys
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
for f in sys.argv[1:]:
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
    print f, '->', os.readlink(f)
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
EOF
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
hg init repo
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
cd repo
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    15
ln -s nothing dangling
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
hg ci -qAm 'add symlink'
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
hg archive -t files ../archive
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
hg archive -t tar -p tar ../archive.tar
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
hg archive -t zip -p zip ../archive.zip
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
echo '% files'
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
cd "$origdir"
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
cd archive
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
python ../readlink.py dangling
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
echo '% tar'
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
cd "$origdir"
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
tar xf archive.tar
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
cd tar
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
python ../readlink.py dangling
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    32
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    33
echo '% zip'
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    34
cd "$origdir"
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    35
unzip archive.zip > /dev/null
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    36
cd zip
6f08bc1bd00b archive: add symlink support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    37
python ../readlink.py dangling