view tests/test-rebase-cache @ 12252:4481f8a93c7a stable

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.)
author Brodie Rao <brodie@bitheap.org>
date Fri, 10 Sep 2010 09:30:50 -0500
parents 2313dc4d9817
children
line wrap: on
line source

#!/bin/sh

. $TESTDIR/helpers.sh

createrepo() {
    rm -rf repo
    hg init repo
    cd repo

    echo "a" > a
    hg commit -d '0 0' -A -m 'A'

    hg branch branch1
    hg commit -d '1 0' -m 'Branch1'

    echo "b" > b
    hg commit -A -d '2 0' -m 'B'

    hg up 0
    hg branch branch2
    hg commit -d '3 0' -m 'Branch2'

    echo "c" > C
    hg commit -A -d '4 0' -m 'C'

    hg up 2
    hg branch -f branch2
    echo "d" > d
    hg commit -A -d '5 0' -m 'D'

    echo "e" > e
    hg commit -A -d '6 0' -m 'E'

    hg update default

    hg branch branch3
    hg commit -d '7 0' -m 'Branch3'

    echo "f" > f
    hg commit -A -d '8 0' -m 'F'
}

echo
createrepo > /dev/null 2>&1
hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'

echo
echo '% Branches'
hg branches

echo
echo '% Heads'
hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'

echo
echo '% Rebase part of branch2 (5-6) onto branch3 (8)'
hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 | hidebackup

echo
echo '% Branches'
hg branches

echo
echo '% Heads'
hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'

echo
hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'

echo
echo '% Rebase head of branch3 (8) onto branch2 (6)'
createrepo > /dev/null 2>&1
hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'

hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 | hidebackup

echo
echo '% Branches'
hg branches

echo
echo '% Heads'
hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'

echo
hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
hg verify -q

echo
echo '% Rebase entire branch3 (7-8) onto branch2 (6)'
createrepo > /dev/null 2>&1
hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'

hg --config extensions.hgext.rebase= rebase --detach -s 7 -d 6 | hidebackup

echo
echo '% Branches'
hg branches

echo
echo '% Heads'
hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n'

echo
hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n'
hg verify -q