Mercurial > hg
diff tests/test-convert-darcs @ 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 | bb5ea66789e3 |
children | 84ceedcfeb6a |
line wrap: on
line diff
--- a/tests/test-convert-darcs Sat Sep 11 00:39:34 2010 +0200 +++ b/tests/test-convert-darcs Fri Sep 10 09:30:50 2010 -0500 @@ -56,13 +56,18 @@ rm dir/d2 darcs mv dir dir2 darcs record -a -l -m p3 -cd .. + +echo % test utf-8 commit message and author +echo g > g +# darcs is encoding agnostic, so it takes whatever bytes it's given +darcs record -a -l -m 'p4: desc ñ' -A 'author ñ' glog() { - hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" + HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@" } +cd .. hg convert darcs-repo darcs-repo-hg # The converter does not currently handle patch conflicts very well. # When they occur, it reverts *all* changes and moves forward,