tests/test-strip-cross
author Maxim Dounin <mdounin@mdounin.ru>
Wed, 07 May 2008 14:32:00 +0400
changeset 6651 7f0dd352fb4d
parent 5914 8e7796a990c5
child 11200 12e5149cafca
permissions -rwxr-xr-x
addremove: correctly handle intermediate symlinks This fixes problems mentioned in issue660 comments (unrelated to original issue) where directory was renamed, and symlink was added instead. In such situation addremove wasn't able to correctly detect that old files no longer here, but tried to add symlink (and failed due collision with old files).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5909
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
# test stripping of filelogs where the linkrev doesn't always increase
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
echo '[extensions]' >> $HGRCPATH
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
echo 'hgext.mq =' >> $HGRCPATH
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
hg init orig
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
cd orig
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
hidefilename()
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
{
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
    sed -e 's/saving bundle to .*strip-backup/saving bundle to strip-backup/'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
}
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    15
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
commit()
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
{
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
    hg up -qC null
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
    count=1
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
    for i in "$@"; do
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
	for f in $i; do
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
	    echo $count > $f
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
	done
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
	count=`expr $count + 1`
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
    done
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
    hg commit -qAm "$*"
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
}
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
# 2 1 0 2 0 1 2
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
commit '201 210'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    32
commit '102 120' '210'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    33
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    34
commit '021'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    35
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    36
commit '201' '021 120'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    37
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    38
commit '012 021' '102 201' '120 210'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    39
5912
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    40
commit 'manifest-file'
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    41
5909
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
commit '102 120' '012 210' '021 201'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    44
commit '201 210' '021 120' '012 102'
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    45
5914
8e7796a990c5 fix test-strip-cross on solaris
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5912
diff changeset
    46
HGUSER=another-user; export HGUSER
8e7796a990c5 fix test-strip-cross on solaris
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5912
diff changeset
    47
commit 'manifest-file'
5912
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    48
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    49
commit '012' 'manifest-file'
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    50
5909
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    51
cd ..
5912
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    52
hg clone -q -U -r -1 -r -2 -r -3 -r -4 -r -6 orig crossed
5909
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    53
5911
2296ecefa223 Fix test-strip-cross on Solaris
Richard Lowe <richlowe@richlowe.net>
parents: 5909
diff changeset
    54
for i in crossed/.hg/store/00manifest.i crossed/.hg/store/data/*.i; do
5909
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    55
    echo $i
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    56
    hg debugindex $i
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    57
    echo
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    58
done
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    59
5912
d67cfe0d4714 test-strip-cross: test handling of linkrev crosses in the manifest
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5911
diff changeset
    60
for i in 0 1 2 3 4; do
5909
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    61
    hg clone -q -U --pull crossed $i
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    62
    echo "% Trying to strip revision $i"
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    63
    hg --cwd $i strip $i 2>&1 | hidefilename
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    64
    echo "% Verifying"
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    65
    hg --cwd $i verify
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    66
    echo
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    67
done
f45f7390c1c5 strip: calculate list of extra nodes to save and pass it to changegroupsubset
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    68