comparison tests/test-convert-darcs @ 12717:89df79b3c011 stable

convert/darcs: support changelogs with bytes 0x7F-0xFF (issue2411) This is a followup to 4481f8a93c7a, which only fixed the conversion of patches with UTF-8 metadata. This patch allows a changelog to have any bytes with values 0x7F-0xFF. It parses the XML changelog as Latin-1 and uses converter_source.recode() to decode the data as UTF-8/Latin-1. Caveats: - Since the convert extension doesn't provide any way to specify the source encoding, users are still limited to UTF-8 and Latin-1. - etree will still complain if the changelog has bytes with values 0x00-0x19. XML only allows printable characters.
author Brodie Rao <brodie@bitheap.org>
date Fri, 01 Oct 2010 10:15:04 -0500
parents 84ceedcfeb6a
children
comparison
equal deleted inserted replaced
12614:f314723f36f5 12717:89df79b3c011
63 echo % test utf-8 commit message and author 63 echo % test utf-8 commit message and author
64 echo g > g 64 echo g > g
65 # darcs is encoding agnostic, so it takes whatever bytes it's given 65 # darcs is encoding agnostic, so it takes whatever bytes it's given
66 darcs record -a -l -m 'p4: desc ñ' -A 'author ñ' 66 darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
67 67
68 echo % test latin-1 commit message
69 echo h > h
70 printf "p5: desc " > ../p5
71 python -c 'print "".join([chr(i) for i in range(128, 256)])' >> ../p5
72 darcs record -a -l --logfile ../p5
73
68 glog() 74 glog()
69 { 75 {
70 HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@" 76 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
71 } 77 }
72 78
73 cd .. 79 cd ..
74 hg convert darcs-repo darcs-repo-hg 80 hg convert darcs-repo darcs-repo-hg
75 # The converter does not currently handle patch conflicts very well. 81 # The converter does not currently handle patch conflicts very well.
76 # When they occur, it reverts *all* changes and moves forward, 82 # When they occur, it reverts *all* changes and moves forward,
77 # letting the conflict resolving patch fix collisions. 83 # letting the conflict resolving patch fix collisions.
78 # Unfortunately, non-conflicting changes, like the addition of the 84 # Unfortunately, non-conflicting changes, like the addition of the
79 # "c" file in p1.1 patch are reverted too. 85 # "c" file in p1.1 patch are reverted too.
80 # Just to say that manifest not listing "c" here is a bug. 86 # Just to say that manifest not listing "c" here is a bug.
81 glog -R darcs-repo-hg 87 HGENCODING=latin-1 glog -R darcs-repo-hg -r 6 | "$TESTDIR"/printrepr.py
88 HGENCODING=utf-8 glog -R darcs-repo-hg -r 0:5 | "$TESTDIR"/printrepr.py
82 hg up -q -R darcs-repo-hg 89 hg up -q -R darcs-repo-hg
83 hg -R darcs-repo-hg manifest --debug 90 hg -R darcs-repo-hg manifest --debug