10 import os |
10 import os |
11 import re |
11 import re |
12 |
12 |
13 from PyQt6.QtCore import QCoreApplication, QProcess, QProcessEnvironment |
13 from PyQt6.QtCore import QCoreApplication, QProcess, QProcessEnvironment |
14 |
14 |
15 from eric7 import Utilities |
15 from eric7.SystemUtilities import OSUtilities, PythonUtilities |
16 from eric7.Globals import isWindowsPlatform |
|
17 |
16 |
18 |
17 |
19 def getHgExecutable(): |
18 def getHgExecutable(): |
20 """ |
19 """ |
21 Function to get the full path of the Mercurial executable. |
20 Function to get the full path of the Mercurial executable. |
26 from eric7.Plugins.PluginVcsMercurial import VcsMercurialPlugin |
25 from eric7.Plugins.PluginVcsMercurial import VcsMercurialPlugin |
27 |
26 |
28 exe = VcsMercurialPlugin.getPreferences("MercurialExecutablePath") |
27 exe = VcsMercurialPlugin.getPreferences("MercurialExecutablePath") |
29 if not exe: |
28 if not exe: |
30 program = "hg" |
29 program = "hg" |
31 if isWindowsPlatform(): |
30 if OSUtilities.isWindowsPlatform(): |
32 program += ".exe" |
31 program += ".exe" |
33 |
32 |
34 progPath = os.path.join(Utilities.getPythonScriptsDirectory(), program) |
33 progPath = os.path.join(PythonUtilities.getPythonScriptsDirectory(), program) |
35 if os.path.exists(progPath): |
34 if os.path.exists(progPath): |
36 exe = progPath |
35 exe = progPath |
37 |
36 |
38 if not exe: |
37 if not exe: |
39 exe = program |
38 exe = program |
46 Function to get the filename of the config file. |
45 Function to get the filename of the config file. |
47 |
46 |
48 @return filename of the config file |
47 @return filename of the config file |
49 @rtype str |
48 @rtype str |
50 """ |
49 """ |
51 if Utilities.isWindowsPlatform(): |
50 if OSUtilities.isWindowsPlatform(): |
52 userprofile = os.environ["USERPROFILE"] |
51 userprofile = os.environ["USERPROFILE"] |
53 return os.path.join(userprofile, "Mercurial.ini") |
52 return os.path.join(userprofile, "Mercurial.ini") |
54 else: |
53 else: |
55 homedir = Utilities.getHomeDir() |
54 homedir = OSUtilities.getHomeDir() |
56 return os.path.join(homedir, ".hgrc") |
55 return os.path.join(homedir, ".hgrc") |
57 |
56 |
58 |
57 |
59 def prepareProcess(proc, encoding="", language=""): |
58 def prepareProcess(proc, encoding="", language=""): |
60 """ |
59 """ |