tests/test-repair-strip
author Patrick Mezard <pmezard@gmail.com>
Mon, 15 Jun 2009 00:03:26 +0200
changeset 8810 ac92775b3b80
parent 8293 f00573bc93f8
child 9284 4a1b24dbf753
permissions -rwxr-xr-x
Add patch.eol to ignore EOLs when patching (issue1019) The intent is to fix many issues involving patching when win32ext is enabled. With win32ext, the working directory and repository files EOLs are not the same which means that patches made on a non-win32ext host do not apply cleanly because of EOLs discrepancies. A theorically correct approach would be transform either the patched file or the patch content with the encoding/decoding filters used by win32ext. This solution is tricky to implement and invasive, instead we prefer to address the win32ext case, by offering a way to ignore input EOLs when patching and rewriting them when saving the patched result.
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