tests/test-hardlinks-safety
author Matt Mackall <mpm@selenic.com>
Fri, 12 Jun 2009 02:19:51 -0500
changeset 8798 92fc57c9f9d1
parent 6920 7e5e13bee8f4
permissions -rwxr-xr-x
remoteui: properly create dst with copy()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     1
#!/bin/sh
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
6920
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     3
# some implementations of cp can't create hardlinks
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     4
cat > cp.py <<EOF
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     5
from mercurial import util
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     6
import sys
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     7
util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     8
EOF
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
     9
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    10
# test hardlinking outside hg
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    11
mkdir x
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    12
echo foo > x/a
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    13
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    14
python cp.py x y
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    15
echo bar >> y/a
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    16
echo % no diff if hardlink
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    17
diff x/a y/a
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    18
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    19
# test mq hardlinking
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    20
echo "[extensions]" >> $HGRCPATH
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    21
echo "mq=" >> $HGRCPATH
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    22
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    23
echo % init
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    24
hg init a
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    25
cd a
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    26
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    27
hg qimport -n foo - << EOF
6869
b49e01863202 Make test-hardlinks-safety repeatable and executable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6835
diff changeset
    28
# HG changeset patch
b49e01863202 Make test-hardlinks-safety repeatable and executable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6835
diff changeset
    29
# Date 1 0
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    30
diff -r 2588a8b53d66 a
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    32
+++ b/a	Wed Jul 23 15:54:29 2008 +0200
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    33
@@ -0,0 +1,1 @@
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    34
+a
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    35
EOF
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    36
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    37
hg qpush
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    38
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    39
cd ..
6920
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    40
python cp.py a b
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    41
cd b
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    42
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    43
hg qimport -n bar - << EOF
6869
b49e01863202 Make test-hardlinks-safety repeatable and executable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6835
diff changeset
    44
# HG changeset patch
b49e01863202 Make test-hardlinks-safety repeatable and executable
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6835
diff changeset
    45
# Date 2 0
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    46
diff -r 2588a8b53d66 a
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    47
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    48
+++ b/b	Wed Jul 23 15:54:29 2008 +0200
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    49
@@ -0,0 +1,1 @@
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    50
+b
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    51
EOF
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    52
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    53
hg qpush
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    54
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    55
cat .hg/patches/status
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    56
echo %
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    57
cat .hg/patches/series
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    58
echo %%%
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    59
cat ../a/.hg/patches/status
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    60
echo %
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    61
cat ../a/.hg/patches/series
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    62
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    63
# test tags hardlinking
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    64
hg qdel -r qbase:qtip
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    65
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    66
hg tag -l lfoo
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    67
hg tag foo
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    68
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    69
cd ..
6920
7e5e13bee8f4 Make test-hardlinks-safety portable
Christian Ebert <blacktrash@gmx.net>
parents: 6869
diff changeset
    70
python cp.py b c
6835
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    71
cd c
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    72
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    73
hg tag -l -r 0 lbar
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    74
hg tag -r 0 bar
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    75
echo %%%
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    76
cat .hgtags
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    77
echo %
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    78
cat .hg/localtags
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    79
echo %%%
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    80
cat ../b/.hgtags
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    81
echo %
08d9e0f974d9 make mq and tags hardlink safe
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    82
cat ../b/.hg/localtags