tests/test-repair-strip
author Matt Mackall <mpm@selenic.com>
Mon, 15 Jun 2009 02:51:10 -0500
changeset 8816 a7c4eb0cc0ed
parent 8293 f00573bc93f8
child 9284 4a1b24dbf753
permissions -rwxr-xr-x
subrepo: add a test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8073
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     1
#!/bin/sh
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     2
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     4
echo "mq=">> $HGRCPATH
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     5
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     6
teststrip() {
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     7
    hg -q up -C $1
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     8
    echo % before update $1, strip $2
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     9
    hg parents
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    10
    chmod -$3 $4
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    11
    hg strip $2 2>&1 | sed 's/\(saving bundle to \).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    12
    echo % after update $1, strip $2
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    13
    chmod +$3 $4
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    14
    hg verify
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    15
    echo % journal contents
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    16
    cat .hg/store/journal | sed 's/\.i[^\n]*/\.i/'
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    17
    ls .hg/store/journal >/dev/null 2>&1 && hg recover
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    18
    ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q .hg/strip-backup/*
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    19
    rm -rf .hg/strip-backup
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    20
}
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    21
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    22
hg init test
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    23
cd test
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    24
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    25
echo a > a
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    26
hg -q ci -m "a" -A
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    27
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    28
echo b > b
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    29
hg -q ci -m "b" -A
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    30
8293
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    31
echo b2 >> b
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    32
hg -q ci -m "b2" -A
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    33
8073
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    34
echo c > c
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    35
hg -q ci -m "c" -A
8293
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    36
 
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    37
teststrip 0 2 w .hg/store/data/b.i
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    38
teststrip 0 2 r .hg/store/data/b.i
f00573bc93f8 test: change repair strip test to illustrate manifest errors
Henrik Stuart <henrik.stuart@edlund.dk>
parents: 8073
diff changeset
    39
teststrip 0 2 w .hg/store/00manifest.i
8073
e8a28556a0a8 strip: make repair.strip transactional to avoid repository corruption
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    40