subrepo: setting LC_MESSAGES only works if LC_ALL is empty or unset stable
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 04 Oct 2012 16:30:40 +0200
branchstable
changeset 17705 6929b9c70be9
parent 17703 4a07d2ff7c66
child 17706 70efdc22b188
child 17735 605fe310691f
subrepo: setting LC_MESSAGES only works if LC_ALL is empty or unset For example LC_ALL=de_DE.utf-8 would cause the version check to fail, because "svn, Version 1.6.12 (r955767)" with a capital "V" will be printed. Using "svn --version --quiet" would only print the version number, but then matching other messages, e.g. "Committed revision" would fail.
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Tue Oct 02 09:26:42 2012 +0200
+++ b/mercurial/subrepo.py	Thu Oct 04 16:30:40 2012 +0200
@@ -655,6 +655,10 @@
             cmd.append(path)
         env = dict(os.environ)
         # Avoid localized output, preserve current locale for everything else.
+        lc_all = env.get('LC_ALL')
+        if lc_all:
+            env['LANG'] = lc_all
+            del env['LC_ALL']
         env['LC_MESSAGES'] = 'C'
         p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds,
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE,