Plugins/VcsPlugins/vcsMercurial/HgUtilities.py

changeset 2816
05aab5164d64
parent 2302
f29e9405c851
child 2847
1843ef6e2656
child 3160
209a07d7e401
equal deleted inserted replaced
2815:53c1d1f9ec86 2816:05aab5164d64
6 """ 6 """
7 Module implementing some common utility functions for the Mercurial package. 7 Module implementing some common utility functions for the Mercurial package.
8 """ 8 """
9 9
10 import os 10 import os
11
12 from PyQt4.QtCore import QProcessEnvironment
11 13
12 import Utilities 14 import Utilities
13 15
14 16
15 def getConfigPath(): 17 def getConfigPath():
22 userprofile = os.environ["USERPROFILE"] 24 userprofile = os.environ["USERPROFILE"]
23 return os.path.join(userprofile, "Mercurial.ini") 25 return os.path.join(userprofile, "Mercurial.ini")
24 else: 26 else:
25 homedir = Utilities.getHomeDir() 27 homedir = Utilities.getHomeDir()
26 return os.path.join(homedir, ".hgrc") 28 return os.path.join(homedir, ".hgrc")
29
30
31 def prepareProcess(proc, encoding="", language=""):
32 """
33 Public method to prepare the given process.
34
35 @param proc reference to the proces to be prepared (QProcess)
36 @param encoding encoding to be used by the process (string)
37 @param language language to be set (string)
38 """
39 env = QProcessEnvironment.systemEnvironment()
40 env.insert("HGPLAIN", '1')
41
42 # set the encoding for the process
43 if encoding:
44 env.insert("HGENCODING", encoding)
45
46 # set the language for the process
47 if language:
48 env.insert("LANGUAGE", language)
49
50 proc.setProcessEnvironment(env)

eric ide

mercurial