15 import sys |
15 import sys |
16 |
16 |
17 from PyQt6.QtCore import QProcess, pyqtSignal |
17 from PyQt6.QtCore import QProcess, pyqtSignal |
18 from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit |
18 from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit |
19 |
19 |
20 from eric7 import Globals, Preferences, Utilities |
20 from eric7 import Preferences, Utilities |
21 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
21 from eric7.EricWidgets import EricFileDialog, EricMessageBox |
22 from eric7.EricWidgets.EricApplication import ericApp |
22 from eric7.EricWidgets.EricApplication import ericApp |
23 from eric7.QScintilla.MiniEditor import MiniEditor |
23 from eric7.QScintilla.MiniEditor import MiniEditor |
|
24 from eric7.SystemUtilities import FileSystemUtilities, PythonUtilities |
24 from eric7.VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog |
25 from eric7.VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog |
25 from eric7.VCS.VersionControl import VersionControl |
26 from eric7.VCS.VersionControl import VersionControl |
26 |
27 |
27 from .GitDialog import GitDialog |
28 from .GitDialog import GitDialog |
28 |
29 |
1189 """ |
1190 """ |
1190 patterns = self.__plugin.getPreferences("CleanupPatterns").split() |
1191 patterns = self.__plugin.getPreferences("CleanupPatterns").split() |
1191 |
1192 |
1192 entries = [] |
1193 entries = [] |
1193 for pat in patterns: |
1194 for pat in patterns: |
1194 entries.extend(Utilities.direntries(name, True, pat)) |
1195 entries.extend(FileSystemUtilities.direntries(name, True, pat)) |
1195 |
1196 |
1196 for entry in entries: |
1197 for entry in entries: |
1197 with contextlib.suppress(OSError): |
1198 with contextlib.suppress(OSError): |
1198 os.remove(entry) |
1199 os.remove(entry) |
1199 |
1200 |
1848 repodir = self.findRepoRoot(dname) |
1849 repodir = self.findRepoRoot(dname) |
1849 if not repodir: |
1850 if not repodir: |
1850 return |
1851 return |
1851 |
1852 |
1852 editor = sys.argv[0].replace(".py", "_editor.py") |
1853 editor = sys.argv[0].replace(".py", "_editor.py") |
1853 env = {"GIT_EDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} |
1854 env = { |
|
1855 "GIT_EDITOR": "{0} {1}".format( |
|
1856 PythonUtilities.getPythonExecutable(), editor |
|
1857 ) |
|
1858 } |
1854 |
1859 |
1855 args = self.initCommand("commit") |
1860 args = self.initCommand("commit") |
1856 |
1861 |
1857 dia = GitDialog(self.tr("Committing failed merge"), self) |
1862 dia = GitDialog(self.tr("Committing failed merge"), self) |
1858 res = dia.startProcess(args, repodir, environment=env) |
1863 res = dia.startProcess(args, repodir, environment=env) |
3246 repodir = self.findRepoRoot(projectDir) |
3251 repodir = self.findRepoRoot(projectDir) |
3247 if not repodir: |
3252 if not repodir: |
3248 return False |
3253 return False |
3249 |
3254 |
3250 editor = sys.argv[0].replace(".py", "_editor.py") |
3255 editor = sys.argv[0].replace(".py", "_editor.py") |
3251 env = {"GIT_EDITOR": "{0} {1}".format(Globals.getPythonExecutable(), editor)} |
3256 env = { |
|
3257 "GIT_EDITOR": "{0} {1}".format( |
|
3258 PythonUtilities.getPythonExecutable(), editor |
|
3259 ) |
|
3260 } |
3252 |
3261 |
3253 args = self.initCommand("cherry-pick") |
3262 args = self.initCommand("cherry-pick") |
3254 args.append("--continue") |
3263 args.append("--continue") |
3255 |
3264 |
3256 dia = GitDialog(self.tr("Copy Changesets (Continue)"), self) |
3265 dia = GitDialog(self.tr("Copy Changesets (Continue)"), self) |
3879 commit, archiveFormat, fileName, prefix = dlg.getData() |
3888 commit, archiveFormat, fileName, prefix = dlg.getData() |
3880 args = self.initCommand("archive") |
3889 args = self.initCommand("archive") |
3881 args.append("--format={0}".format(archiveFormat)) |
3890 args.append("--format={0}".format(archiveFormat)) |
3882 args.append("--output={0}".format(fileName)) |
3891 args.append("--output={0}".format(fileName)) |
3883 if prefix: |
3892 if prefix: |
3884 prefix = Utilities.fromNativeSeparators(prefix) |
3893 prefix = FileSystemUtilities.fromNativeSeparators(prefix) |
3885 if not prefix.endswith("/"): |
3894 if not prefix.endswith("/"): |
3886 prefix += "/" |
3895 prefix += "/" |
3887 args.append("--prefix={0}".format(prefix)) |
3896 args.append("--prefix={0}".format(prefix)) |
3888 args.append(commit) |
3897 args.append(commit) |
3889 |
3898 |