tests/test-fncache
author Brodie Rao <brodie@bitheap.org>
Fri, 10 Sep 2010 09:30:50 -0500
branchstable
changeset 12252 4481f8a93c7a
parent 8721 2816239e0020
permissions -rwxr-xr-x
convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354) Given a commit author or message with non-ASCII characters in a darcs repo, convert would raise a UnicodeEncodeError when adding changesets to the hg changelog. This happened because etree returns back unicode objects for any text it can't encode into ASCII. convert was passing these objects to changelog.add(), which would then attempt encoding.fromlocal() on them. This patch ensures converter_source.recode() is called on each piece of commit data returned by etree. (Also note that darcs is currently encoding agnostic and will print out whatever is in a patch's metadata byte-for-byte, even in the XML changelog.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     1
#!/bin/sh
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     2
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     3
echo "% init repo1"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     4
hg init repo1
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     5
cd repo1
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     6
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     7
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     8
echo "% add a; ci"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     9
echo "some text" > a
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    10
hg add
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7290
diff changeset
    11
hg ci -m first
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    12
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    13
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    14
echo "% cat .hg/store/fncache"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    15
cat .hg/store/fncache
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    16
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    17
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    18
echo "% add a.i/b; ci"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    19
mkdir a.i
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    20
echo "some other text" > a.i/b
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    21
hg add
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7290
diff changeset
    22
hg ci -m second
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    23
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    24
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    25
echo "% cat .hg/store/fncache"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    26
cat .hg/store/fncache
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    27
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    28
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    29
echo "% add a.i.hg/c; ci"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    30
mkdir a.i.hg
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    31
echo "yet another text" > a.i.hg/c
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    32
hg add
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7290
diff changeset
    33
hg ci -m third
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    34
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    35
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    36
echo "% cat .hg/store/fncache"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    37
cat .hg/store/fncache
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    38
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    39
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    40
echo "% hg verify"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    41
hg verify
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    42
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    43
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    44
echo "% rm .hg/store/fncache"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    45
rm .hg/store/fncache
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    46
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    47
echo
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    48
echo "% hg verify"
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    49
hg verify
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    50
8633
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    51
# try non store repo encoding
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    52
cd ..
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    53
echo % non store repo
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    54
hg --config format.usestore=False init foo
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    55
cd foo
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    56
mkdir tst.d
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    57
echo foo > tst.d/foo
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    58
hg ci -Amfoo
8721
2816239e0020 test-fncache: Use find instead of ls -R.
Will Maier <willmaier@ml1.net>
parents: 8633
diff changeset
    59
find .hg | sort
8633
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    60
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    61
cd ..
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    62
echo % non fncache repo
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    63
hg --config format.usefncache=False init bar
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    64
cd bar
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    65
mkdir tst.d
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    66
echo foo > tst.d/Foo
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    67
hg ci -Amfoo
8721
2816239e0020 test-fncache: Use find instead of ls -R.
Will Maier <willmaier@ml1.net>
parents: 8633
diff changeset
    68
find .hg | sort
8633
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
    69
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    70
exit 0