Plugins/VcsPlugins/vcsMercurial/HgUtilities.py

changeset 2816
05aab5164d64
parent 2302
f29e9405c851
child 2847
1843ef6e2656
child 3160
209a07d7e401
--- a/Plugins/VcsPlugins/vcsMercurial/HgUtilities.py	Mon Jul 22 20:08:29 2013 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgUtilities.py	Tue Jul 23 18:34:55 2013 +0200
@@ -9,6 +9,8 @@
 
 import os
 
+from PyQt4.QtCore import QProcessEnvironment
+
 import Utilities
 
 
@@ -24,3 +26,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)

eric ide

mercurial