[Svnmerge] Encoding problem in svnmerge commit message file
rocketraman at fastmail.fm
Mon Dec 31 09:50:21 PST 2007
Romulo A. Ceccon wrote:
> On Dec 7, 2007 11:19 PM, Raman Gupta <rocketraman at fastmail.fm> wrote:
>> It would be really helpful if you could create a test in
>> svnmerge_test.py. That would make it easier for people to test this
> Ok. The patch is attached.
> Note that I had to change TestCase_SvnMerge.svnmerge to use a
> different StringIO object, since it replaces sys.stdout with a version
> which doesn't provide the "encoding" property. That property is
> required by svnmerge.py in my proposed patch.
Awesome, thanks for the test case!
Note that the patch causes 13 tests to fail on my machine. I believe
the reason is that svnmerge.py currently sets os.environ["LC_ALL"] =
"C" and that, at least on my machine, causes
locale.getdefaultlocale() to return None, which then causes the
call to encode to fail:
Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, locale
>>> locale.setlocale(locale.LC_ALL, '')
>>> locale.setlocale(locale.LC_ALL, 'C')
>>> os.environ["LC_ALL"] = "C"
So it seems to be specifically the os.environ setting (added in rev
23305) that is causing problems on my machine, whereas the
"equivalent" python call to setlocale 'C' is ok. I think os.environ is
needed for svn though, so... anybody out there that understands what
is going on?
More information about the Svnmerge