view tests/test-fastimport-nonascii @ 100:3f2bf6a7830a default tip

Added tag 0.1.1 for changeset a90da62aa705
author Roy Marples <roy@marples.name>
date Mon, 15 Feb 2021 12:06:38 +0000
parents 7ff36dc9f0b1
children
line wrap: on
line source

#!/bin/sh

# Test dumps with non-ASCII characters in various places.
#
# This file, including the fastimport dumps in it and the
# associated .out file, are all encoded in UTF-8.

. $TESTDIR/fastimport-common

echo "% import dump with non-ASCII committer"
cat > committer.dump <<__EOF__
commit refs/heads/master
mark :1
committer Jean-Fran??ois <jf@example.com> 1007132290 +0000
data 4
foo

__EOF__

# N.B. it's import to run fastimport without overriding HGENCODING,
# because we need to be sure that UTF-8 metadata is correctly converted
# even when the default encoding is ASCII.  The catch is that the
# converted commit messages will be mangled as they are printed to
# stdout.  That's OK.  The real test is when we run hg log, and there we
# set HGENCODING to ensure that hg accurately prints what's in the
# repository.

hg init committer
cd committer
hg --traceback fastimport ../committer.dump
echo "% log with non-ASCII committer"
HGENCODING=utf-8 hg log
cd ..

echo "% import dump with non-ASCII author"
cat > author.dump <<__EOF__
commit refs/heads/master
mark :1
author J??rgen <juergen@example.org> 1250000000 +0400
committer Dave <dave@example.org> 1250000030 +0400
data 5
blah

__EOF__

hg init author
cd author
hg --traceback fastimport ../author.dump
echo "% log with non-ASCII author"
HGENCODING=utf-8 hg log
cd ..

echo "% import dump with non-ASCII message"
cat > message.dump <<__EOF__
commit refs/heads/master
mark :1
committer Dave <dave@example.org> 1250000030 +0400
data 60
fix na??ve implementation that ??le threw together for ???5

M 644 inline foo.txt
data 6
hello


__EOF__

hg init message
cd message
hg --traceback fastimport ../message.dump | sed "s|$HGTMP|HGTMP|g"
echo "% log with non-ASCII message"
HGENCODING=utf-8 hg log
echo "% manifest"
hg manifest -r0
echo "% contents of foo.txt"
hg cat -r0 foo.txt
cd ..