--- a/Plugins/VcsPlugins/vcsMercurial/HgUtilities.py Mon Aug 12 19:41:53 2013 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/HgUtilities.py Mon Aug 12 22:21:53 2013 +0200 @@ -11,6 +11,8 @@ import os +from PyQt4.QtCore import QProcessEnvironment + import Utilities @@ -26,3 +28,25 @@ else: homedir = Utilities.getHomeDir() return os.path.join(homedir, ".hgrc") + + +def prepareProcess(proc, encoding="", language=""): + """ + Public method to prepare the given process. + + @param proc reference to the proces to be prepared (QProcess) + @param encoding encoding to be used by the process (string) + @param language language to be set (string) + """ + env = QProcessEnvironment.systemEnvironment() + env.insert("HGPLAIN", '1') + + # set the encoding for the process + if encoding: + env.insert("HGENCODING", encoding) + + # set the language for the process + if language: + env.insert("LANGUAGE", language) + + proc.setProcessEnvironment(env)