diff mercurial/subrepo.py @ 10199:c2e2a5e6c36b

subrepo: force en_US.UTF-8 locale when calling svn Parser only knows about en_US output. Forcing the encoding to UTF-8 might not be the best thing to do since the caller may receive some of the subversion output, but at least it should prevent conversion errors from svn client.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 02 Jan 2010 16:42:00 +0100
parents 29e3c4a7699b
children 192c39586787
line wrap: on
line diff
--- a/mercurial/subrepo.py	Sat Jan 02 16:03:29 2010 +0100
+++ b/mercurial/subrepo.py	Sat Jan 02 16:42:00 2010 +0100
@@ -261,7 +261,10 @@
         cmd = ['svn'] + commands + [self._path]
         cmd = [util.shellquote(arg) for arg in cmd]
         cmd = util.quotecommand(' '.join(cmd))
-        write, read, err = util.popen3(cmd, newlines=True)
+        env = dict(os.environ)
+        for k in ('LANGUAGE', 'LANG', 'LC_ALL', 'LC_MESSAGES'):
+            env[k] = 'en_US.UTF-8'
+        write, read, err = util.popen3(cmd, env=env, newlines=True)
         retdata = read.read()
         err = err.read().strip()
         if err: