Sat, 26 Apr 2025 12:34:32 +0200
MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11006
diff
changeset
|
3 | # Copyright (c) 2014 - 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the version control systems interface to Git. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9421
diff
changeset
|
10 | import contextlib |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import os |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9421
diff
changeset
|
12 | import pathlib |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | import re |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9421
diff
changeset
|
14 | import shutil |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
15 | import sys |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
17 | from PyQt6.QtCore import QProcess, pyqtSignal |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8314
diff
changeset
|
18 | from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
20 | from eric7 import Preferences, Utilities |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9421
diff
changeset
|
21 | from eric7.EricWidgets import EricFileDialog, EricMessageBox |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9318
diff
changeset
|
22 | from eric7.EricWidgets.EricApplication import ericApp |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9318
diff
changeset
|
23 | from eric7.QScintilla.MiniEditor import MiniEditor |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
24 | from eric7.SystemUtilities import FileSystemUtilities, PythonUtilities |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9421
diff
changeset
|
25 | from eric7.VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
26 | from eric7.VCS.VersionControl import VersionControl, VersionControlState |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | from .GitDialog import GitDialog |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | class Git(VersionControl): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | Class implementing the version control systems interface to Git. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
34 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | @signal committed() emitted after the commit action has completed |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
37 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | committed = pyqtSignal() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
39 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | IgnoreFileName = ".gitignore" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
41 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | def __init__(self, plugin, parent=None, name=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
45 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | @param plugin reference to the plugin object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
47 | @type VcsGitPlugin |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
48 | @param parent parent widget |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
49 | @type QWidget |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
50 | @param name name of this object |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
51 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | VersionControl.__init__(self, parent, name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.defaultOptions = { |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | "global": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | "commit": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | "checkout": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | "update": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | "add": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | "remove": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | "diff": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
62 | "log": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
63 | "history": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
64 | "status": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | "tag": [""], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | "export": [""], |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | self.__plugin = plugin |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | self.__ui = parent |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | self.options = self.defaultOptions |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.tagTypeList = [ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | "tags", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | "branches", |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | ] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.commandHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
81 | self.adminDirOrFile = ".git" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | self.log = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.logBrowser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.reflogBrowser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | self.diff = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | self.sbsDiff = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | self.tagbranchList = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.status = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | self.remotesDialog = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | self.describeDialog = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | self.blame = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | self.stashBrowser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | self.repoEditor = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | self.userEditor = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | self.bisectlogBrowser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | self.bisectReplayEditor = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.patchStatisticsDialog = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | self.submoduleStatusDialog = None |
9620
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
100 | self.worktreeDialog = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
101 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | self.__lastBundlePath = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | self.__lastReplayPath = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
104 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.statusCache = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | self.__commitData = {} |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | self.__commitDialog = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
109 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | self.__patchCheckData = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | |
7034
ca42317bb307
git, hg: added code to handle situations where the project helper object has not been created yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
112 | self.__projectHelper = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | def getPlugin(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | Public method to get a reference to the plugin object. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
117 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
118 | @return reference to the plugin object |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
119 | @rtype VcsGitPlugin |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | return self.__plugin |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
122 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | def vcsShutdown(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | Public method used to shutdown the Git interface. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | if self.log is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | self.log.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | if self.logBrowser is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | self.logBrowser.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | if self.reflogBrowser is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | self.reflogBrowser.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | if self.diff is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | self.diff.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | if self.sbsDiff is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | self.sbsDiff.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | if self.tagbranchList is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | self.tagbranchList.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | if self.status is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | self.status.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | if self.remotesDialog is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.remotesDialog.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | if self.describeDialog is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | self.describeDialog.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | if self.blame is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | self.blame.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | if self.stashBrowser is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | self.stashBrowser.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | if self.bisectlogBrowser is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | self.bisectlogBrowser.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | if self.bisectReplayEditor is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | self.bisectReplayEditor.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | if self.repoEditor is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | self.repoEditor.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | if self.userEditor is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | self.userEditor.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | if self.patchStatisticsDialog is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | self.patchStatisticsDialog.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | if self.submoduleStatusDialog is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.submoduleStatusDialog.close() |
9620
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
161 | if self.worktreeDialog is not None: |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
162 | self.worktreeDialog.close() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
163 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | # shut down the project helpers |
7034
ca42317bb307
git, hg: added code to handle situations where the project helper object has not been created yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
165 | if self.__projectHelper is not None: |
ca42317bb307
git, hg: added code to handle situations where the project helper object has not been created yet.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
166 | self.__projectHelper.shutdown() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
167 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | def initCommand(self, command): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | Public method to initialize a command arguments list. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
171 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
172 | @param command command name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
173 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
174 | @return list of command options |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
175 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | args = [command] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | return args |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
179 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | def vcsExists(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | Public method used to test for the presence of the git executable. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
183 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
184 | @return flag indicating the existance and an error message |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
185 | @rtype tuple of (bool, str) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | self.versionStr = "" |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | errMsg = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | ioEncoding = Preferences.getSystem("IOEncoding") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | args = self.initCommand("version") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | process = QProcess() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
193 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
198 | output = str(process.readAllStandardOutput(), ioEncoding, "replace") |
6508
51897256fc83
git: fixed an issue determining the git version number.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6324
diff
changeset
|
199 | versionLine = output.splitlines()[0] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
200 | v = list( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
201 | re.match(r".*?(\d+)\.(\d+)\.?(\d+)?\.?(\d+)?", versionLine).groups() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | for i in range(4): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | v[i] = int(v[i]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | except TypeError: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | v[i] = 0 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | except IndexError: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | v.append(0) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | self.version = tuple(v) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | self.versionStr = ".".join([str(v) for v in self.version]) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | return True, errMsg |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | if finished: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | errMsg = self.tr( |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
216 | "The git process finished with the exit code {0}" |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
217 | ).format(process.exitCode()) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
219 | errMsg = self.tr("The git process did not finish within 30s.") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | errMsg = self.tr("Could not start the git executable.") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
222 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | return False, errMsg |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
225 | def vcsInit(self, _vcsDir, noDialog=False): # noqa: U-100 |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | Public method used to initialize the Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
228 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | The initialization is done, when a project is converted into a |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | Git controlled project. Therefore we always return TRUE without |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | doing anything. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
232 | |
10690
fab36645aa7d
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
233 | @param _vcsDir name of the VCS directory (unused) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
234 | @type str |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
235 | @param noDialog flag indicating quiet operations (unused) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
236 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
237 | @return always True |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
238 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
241 | |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
242 | def vcsConvertProject(self, vcsDataDict, project, addAll=True): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | Public method to convert an uncontrolled project to a version |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | controlled project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
246 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | @param vcsDataDict dictionary of data required for the conversion |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
248 | @type dict |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | @param project reference to the project object |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
250 | @type Project |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
251 | @param addAll flag indicating to add all files to the repository |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
252 | @type bool |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
253 | """ |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
254 | success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0] |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | if not success: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
256 | EricMessageBox.critical( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | self.tr("Create project repository"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
259 | self.tr("""The project repository could not be created."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
260 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | pfn = project.pfile |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | if not os.path.isfile(pfn): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | pfn += "z" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | project.closeProject() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | project.openProject(pfn) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
268 | def vcsImport( |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
269 | self, vcsDataDict, projectDir, noDialog=False, addAll=True # noqa: U-100 |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
270 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | Public method used to import the project into the Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
273 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | @param vcsDataDict dictionary of data required for the import |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
275 | @type dict |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
276 | @param projectDir project directory |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
277 | @type str |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
278 | @param noDialog flag indicating quiet operations (unused) |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
279 | @type bool |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
280 | @param addAll flag indicating to add all files to the repository |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
281 | @type bool |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
282 | @return tuple containing a flag indicating an execution without errors |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
283 | and a flag indicating the version controll status |
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
284 | @rtype tuple of (bool, bool) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | msg = vcsDataDict["message"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | if not msg: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
288 | msg = "***" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
289 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | args = self.initCommand("init") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | args.append(projectDir) |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
292 | dia = GitDialog(self.tr("Creating Git repository"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | res = dia.startProcess(args) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
295 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | status = dia.normalExit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
297 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
298 | if status: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | ignoreName = os.path.join(projectDir, Git.IgnoreFileName) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | if not os.path.exists(ignoreName): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | status = self.gitCreateIgnoreFile(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
302 | |
7167
b3557e77314a
VCS: extended the vcsImport function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7034
diff
changeset
|
303 | if status and addAll: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | args = self.initCommand("add") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | args.append("-v") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | args.append(".") |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
307 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
308 | self.tr("Adding files to Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
309 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
310 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
311 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | res = dia.startProcess(args, projectDir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
314 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | status = dia.normalExit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
316 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | if status: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | args = self.initCommand("commit") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
319 | args.append("--message={0}".format(msg)) |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
320 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
321 | self.tr("Initial commit to Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
322 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
323 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
324 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | res = dia.startProcess(args, projectDir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
327 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | status = dia.normalExit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
329 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | return status, False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
331 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | Public method used to check the project out of a Git repository |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | (clone). |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
336 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | @param vcsDataDict dictionary of data required for the checkout |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
338 | @type dict |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
339 | @param projectDir project directory to create |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
340 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | @param noDialog flag indicating quiet operations |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
342 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
343 | @return flag indicating an execution without errors |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
344 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | noDialog = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | vcsUrl = self.gitNormalizeURL(vcsDataDict["url"]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
348 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | args = self.initCommand("clone") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
350 | args.append(vcsUrl) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | args.append(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
352 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | if noDialog: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
354 | return self.startSynchronizedProcess(QProcess(), "git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | else: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
356 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
357 | self.tr("Cloning project from a Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
358 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
359 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
360 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | res = dia.startProcess(args) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
363 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
364 | return dia.normalExit() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
365 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | def vcsExport(self, vcsDataDict, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
367 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
368 | Public method used to export a directory from the Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
369 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | @param vcsDataDict dictionary of data required for the checkout |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
371 | @type dict |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
372 | @param projectDir project directory to create |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
373 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
374 | @return flag indicating an execution without errors |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
375 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | status = self.vcsCheckout(vcsDataDict, projectDir) |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
378 | adminPath = os.path.join(projectDir, self.adminDirOrFile) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
379 | if os.path.isdir(adminPath): |
10403
ea3320d5e8e9
Changed code using "shutil.rmtree()" more readable by adding "ignore_errors=" where this parameter is non-default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10069
diff
changeset
|
380 | shutil.rmtree(adminPath, ignore_errors=True) |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
381 | else: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
382 | os.remove(adminPath) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | if os.path.exists(os.path.join(projectDir, Git.IgnoreFileName)): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | os.remove(os.path.join(projectDir, Git.IgnoreFileName)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | return status |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
386 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
387 | def vcsCommit(self, name, message="", noDialog=False, commitAll=True, amend=False): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | Public method used to make the change of a file/directory permanent |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | in the Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
391 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
392 | @param name file/directory name to be committed |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
393 | @type str or list of str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
394 | @param message message for this operation |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
395 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
396 | @param noDialog flag indicating quiet operations |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
397 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
398 | @param commitAll flag indicating to commit all local changes |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
399 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
400 | @param amend flag indicating to amend the HEAD commit |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
401 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
403 | from .GitCommitDialog import GitCommitDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
404 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | if not noDialog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | # call CommitDialog and get message from there |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | if self.__commitDialog is None: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
408 | self.__commitDialog = GitCommitDialog( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
409 | self, message, amend, commitAll, self.__ui |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
410 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | self.__commitDialog.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | self.__commitDialog.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | self.__commitDialog.activateWindow() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
415 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | self.__commitData["name"] = name |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | self.__commitData["msg"] = message |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | self.__commitData["noDialog"] = noDialog |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | self.__commitData["all"] = commitAll |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
420 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | if noDialog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | self.__vcsCommit_Step2() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
423 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | def __vcsCommit_Step2(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
426 | Private slot performing the second step of the commit action. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
427 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | name = self.__commitData["name"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | msg = self.__commitData["msg"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | noDialog = self.__commitData["noDialog"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | commitAll = self.__commitData["all"] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
432 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | if not noDialog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
434 | # check, if there are unsaved changes, that should be committed |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | nameList = name |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
438 | nameList = [name] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | ok = True |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
440 | for nam in nameList: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | # check for commit of the project |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | if os.path.isdir(nam): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
443 | project = ericApp().getObject("Project") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | if nam == project.getProjectPath(): |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
445 | ok &= ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
446 | project.checkAllScriptsDirty(reportSyntaxErrors=True) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
447 | and project.checkDirty() |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
448 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
449 | continue |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | elif os.path.isfile(nam): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
451 | editor = ericApp().getObject("ViewManager").getOpenEditor(nam) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | if editor: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | ok &= editor.checkDirty() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | break |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
456 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | if not ok: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
458 | res = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
459 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | self.tr("Commit Changes"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | """The commit affects files, that have unsaved""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
463 | """ changes. Shall the commit be continued?""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
464 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
465 | icon=EricMessageBox.Warning, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
466 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | if not res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
469 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | if self.__commitDialog is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | msg = self.__commitDialog.logMessage() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | amend = self.__commitDialog.amend() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
473 | resetAuthor = self.__commitDialog.resetAuthor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | commitAll = not self.__commitDialog.stagedOnly() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | self.__commitDialog.deleteLater() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | self.__commitDialog = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | amend = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | resetAuthor = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
480 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | if not msg and not amend: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
482 | msg = "***" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
483 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | args = self.initCommand("commit") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | if amend: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | args.append("--amend") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | if resetAuthor: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | args.append("--reset-author") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | if msg: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | args.append("--message") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
491 | args.append(msg) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
492 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
493 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
494 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
497 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
499 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
500 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
501 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
502 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | self.addArguments(args, fnames) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | if dname != repodir or fname != ".": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | args.append(fname) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | if commitAll: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | args.append("--all") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
513 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
514 | if noDialog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
515 | self.startSynchronizedProcess(QProcess(), "git", args, dname) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
516 | else: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
517 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
518 | self.tr("Committing changes to Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
519 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
520 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
521 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | res = dia.startProcess(args, dname) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
524 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | self.committed.emit() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
526 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
527 | |
8624
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
528 | def vcsCommitMessages(self): |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
529 | """ |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
530 | Public method to get the list of saved commit messages. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
531 | |
8624
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
532 | @return list of saved commit messages |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
533 | @rtype list of str |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
534 | """ |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
535 | # try per project commit history first |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
536 | messages = self._vcsProjectCommitMessages() |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
537 | if not messages: |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
538 | # empty list returned, try the vcs specific one |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
539 | messages = self.getPlugin().getPreferences("Commits") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
540 | |
8624
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
541 | return messages |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
542 | |
8624
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
543 | def vcsAddCommitMessage(self, message): |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
544 | """ |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
545 | Public method to add a commit message to the list of saved messages. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
546 | |
8624
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
547 | @param message message to be added |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
548 | @type str |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
549 | """ |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
550 | if not self._vcsAddProjectCommitMessage(message): |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
551 | commitMessages = self.vcsCommitMessages() |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
552 | if message in commitMessages: |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
553 | commitMessages.remove(message) |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
554 | commitMessages.insert(0, message) |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
555 | no = Preferences.getVCS("CommitMessages") |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
556 | del commitMessages[no:] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
557 | self.getPlugin().setPreferences("Commits", commitMessages) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
558 | |
8624
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
559 | def vcsClearCommitMessages(self): |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
560 | """ |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
561 | Public method to clear the list of saved messages. |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
562 | """ |
5192a2592324
Started implementing a 'Quick Commit' function for the new VCS Status List widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8621
diff
changeset
|
563 | if not self._vcsClearProjectCommitMessages(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
564 | self.getPlugin().setPreferences("Commits", []) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
565 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
566 | def vcsUpdate(self, name, noDialog=False, revision=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
567 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
568 | Public method used to update a file/directory with the Git |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
569 | repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
570 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
571 | @param name file/directory name to be updated |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
572 | @type str or list of str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
573 | @param noDialog flag indicating quiet operations |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
574 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
575 | @param revision revision to update to |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
576 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
577 | @return flag indicating, that the update contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
578 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
579 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
580 | args = self.initCommand("checkout") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
581 | if revision: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
582 | res = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
583 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
584 | self.tr("Switch"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
585 | self.tr( |
9573
9960d19d66b5
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9482
diff
changeset
|
586 | """<p>Do you really want to switch to <b>{0}</b>?</p>""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
587 | ).format(revision), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
588 | yesDefault=True, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
589 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
590 | if not res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
591 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
592 | args.append(revision) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
593 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
594 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
595 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
596 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
597 | self.addArguments(args, fnames) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
598 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
599 | dname, fname = self.splitPath(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
600 | if fname != ".": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
601 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
602 | args.append(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
603 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
604 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
605 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
606 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
607 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
608 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
609 | if noDialog: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
610 | self.startSynchronizedProcess(QProcess(), "git", args, repodir) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
611 | res = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
612 | else: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
613 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
614 | self.tr("Synchronizing with the Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
615 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
616 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
617 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
618 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
619 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
620 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
621 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
622 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
623 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
624 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
625 | def vcsAdd(self, name, isDir=False, noDialog=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
626 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
627 | Public method used to add a file/directory to the Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
628 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
629 | @param name file/directory name to be added |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
630 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
631 | @param isDir flag indicating name is a directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
632 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
633 | @param noDialog flag indicating quiet operations |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
634 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
635 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
636 | args = self.initCommand("add") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
637 | args.append("-v") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
638 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
639 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
640 | if isDir: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
641 | dname, fname = os.path.split(name[0]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
642 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
643 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
644 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
645 | if isDir: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
646 | dname, fname = os.path.split(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
648 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
649 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
651 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
652 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
653 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
654 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
655 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
656 | self.addArguments(args, name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
657 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
658 | args.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
659 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
660 | if noDialog: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
661 | self.startSynchronizedProcess(QProcess(), "git", args, repodir) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
663 | dia = GitDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
664 | self.tr("Adding files/directories to the Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
665 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
666 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
667 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
668 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
669 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
670 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
671 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
672 | def vcsAddBinary(self, name, isDir=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
674 | Public method used to add a file/directory in binary mode to the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
675 | Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
676 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
677 | @param name file/directory name to be added |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
678 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
679 | @param isDir flag indicating name is a directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
680 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
681 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
682 | self.vcsAdd(name, isDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
683 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
684 | def vcsAddTree(self, path): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
685 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
686 | Public method to add a directory tree rooted at path to the Git |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
687 | repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
688 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
689 | @param path root directory of the tree to be added |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
690 | @type str or list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
691 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
692 | self.vcsAdd(path, isDir=False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
693 | |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
694 | def vcsRemove( |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
695 | self, name, project=False, noDialog=False, stageOnly=False # noqa: U-100 |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
696 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
697 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
698 | Public method used to remove a file/directory from the Git |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
699 | repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
700 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
701 | The default operation is to remove the local copy as well. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
702 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
703 | @param name file/directory name to be removed |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
704 | @type str or list of str |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
705 | @param project flag indicating deletion of a project tree (unused) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
706 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
707 | @param noDialog flag indicating quiet operations |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
708 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
709 | @param stageOnly flag indicating to just remove the file from the |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
710 | staging area |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
711 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
712 | @return flag indicating successful operation |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
713 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
714 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
715 | args = self.initCommand("rm") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
716 | if noDialog and "--force" not in args: |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
717 | args.append("--force") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
718 | if stageOnly: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
719 | args.append("--cached") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
720 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
721 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
722 | if os.path.isdir(name[0]): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
723 | args.append("-r") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
724 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
725 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
726 | self.addArguments(args, name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
727 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
728 | if os.path.isdir(name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
729 | args.append("-r") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
730 | dname, fname = self.splitPath(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
731 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
732 | args.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
733 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
734 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
735 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
736 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
737 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
738 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
739 | if noDialog: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
740 | res = self.startSynchronizedProcess(QProcess(), "git", args, repodir) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
741 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
742 | dia = GitDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
743 | self.tr("Removing files/directories from the Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
744 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
745 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
746 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
747 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
748 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
749 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
750 | res = dia.normalExitWithoutErrors() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
751 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
752 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
753 | |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
754 | def vcsForget(self, name): |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
755 | """ |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
756 | Public method used to remove a file from the Mercurial repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
757 | |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
758 | This will not remove the file from the project directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
759 | |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
760 | @param name file/directory name to be removed |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
761 | @type str or list of str |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
762 | """ |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
763 | self.vcsRemove(name, stageOnly=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
764 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
765 | def vcsMove(self, name, project, target=None, noDialog=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
766 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
767 | Public method used to move a file/directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
768 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
769 | @param name file/directory name to be moved |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
770 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
771 | @param project reference to the project object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
772 | @type Project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
773 | @param target new name of the file/directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
774 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
775 | @param noDialog flag indicating quiet operations |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
776 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
777 | @return flag indicating successful operation |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
778 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
779 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
780 | from .GitCopyDialog import GitCopyDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
781 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
782 | isDir = os.path.isdir(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
783 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | res = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
785 | if noDialog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
786 | if target is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
787 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
788 | force = True |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
789 | accepted = True |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | else: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
791 | dlg = GitCopyDialog(name, parent=self.__ui, move=True) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
792 | accepted = dlg.exec() == QDialog.DialogCode.Accepted |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
793 | if accepted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
794 | target, force = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
795 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
796 | if accepted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
797 | args = self.initCommand("mv") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
798 | args.append("-v") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | if force: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
800 | args.append("--force") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
801 | args.append(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
802 | args.append(target) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
803 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | dname, fname = self.splitPath(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
805 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
806 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
807 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
808 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
809 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | if noDialog: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
811 | res = self.startSynchronizedProcess(QProcess(), "git", args, repodir) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
812 | else: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
813 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
814 | self.tr("Renaming {0}").format(name), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
815 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
816 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
818 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
819 | res = dia.normalExit() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | if res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
821 | if target.startswith(project.getProjectPath()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | if isDir: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | project.moveDirectory(name, target) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
824 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
825 | project.renameFileInPdata(name, target) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
826 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
827 | if isDir: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
828 | project.removeDirectory(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
829 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
830 | project.removeFile(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
831 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
832 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
833 | def vcsLogBrowser(self, name, isFile=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
834 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
835 | Public method used to browse the log of a file/directory from the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
836 | Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
837 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
838 | @param name file/directory name to show the log of |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
839 | @type str |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7836
diff
changeset
|
840 | @param isFile flag indicating log for a file is to be shown |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
841 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
842 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
843 | from .GitLogBrowserDialog import GitLogBrowserDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
844 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
845 | if self.logBrowser is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
846 | self.logBrowser = GitLogBrowserDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
847 | self.logBrowser.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
848 | self.logBrowser.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
849 | self.logBrowser.start(name, isFile=isFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
850 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
851 | def gitReflogBrowser(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
852 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
853 | Public method used to browse the reflog of the project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
854 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
855 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
856 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
857 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
858 | from .GitReflogBrowserDialog import GitReflogBrowserDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
859 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
860 | if self.reflogBrowser is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
861 | self.reflogBrowser = GitReflogBrowserDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
862 | self.reflogBrowser.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
863 | self.reflogBrowser.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
864 | self.reflogBrowser.start(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
865 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
866 | def vcsDiff(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
867 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
868 | Public method used to view the difference of a file/directory to the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
869 | Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
870 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
871 | If name is a directory and is the project directory, all project files |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
872 | are saved first. If name is a file (or list of files), which is/are |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
873 | being edited and has unsaved modification, they can be saved or the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
874 | operation may be aborted. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
875 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
876 | @param name file/directory name to be diffed |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
877 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
878 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
879 | from .GitDiffDialog import GitDiffDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
880 | |
8234
fcb6b4b96274
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8222
diff
changeset
|
881 | names = name[:] if isinstance(name, list) else [name] |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
882 | for nam in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
883 | if os.path.isfile(nam): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
884 | editor = ericApp().getObject("ViewManager").getOpenEditor(nam) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
885 | if editor and not editor.checkDirty(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
887 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
888 | project = ericApp().getObject("Project") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
889 | if nam == project.ppath and not project.saveAllScripts(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
890 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | if self.diff is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
892 | self.diff = GitDiffDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
893 | self.diff.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
894 | self.diff.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
895 | QApplication.processEvents() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | self.diff.start(name, diffMode="work2stage2repo", refreshable=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
897 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
898 | def vcsStatus(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
899 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
900 | Public method used to view the status of files/directories in the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
901 | Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
902 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
903 | @param name file/directory name(s) to show the status of |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
904 | @type str or list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
905 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
906 | from .GitStatusDialog import GitStatusDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
907 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
908 | if self.status is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
909 | self.status = GitStatusDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
910 | self.status.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
911 | self.status.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | self.status.start(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
913 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | def gitUnstage(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
915 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
916 | Public method used to unstage a file/directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
917 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
918 | @param name file/directory name to be reverted |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
919 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
920 | @return flag indicating, that the update contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
921 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
922 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
923 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
924 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
926 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
927 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
928 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
929 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
930 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
931 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
932 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
933 | args = self.initCommand("reset") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
934 | args.append("HEAD") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
935 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
936 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
937 | self.addArguments(args, name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
938 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
939 | args.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
940 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
941 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
942 | self.tr("Unstage files/directories"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
943 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
944 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
946 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
947 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
948 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
949 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
950 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
951 | |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
952 | def vcsRevert(self, name): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
953 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
954 | Public method used to revert changes made to a file/directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
955 | |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
956 | @param name file/directory name to be reverted |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
957 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
958 | @return flag indicating, that the update contained an add |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
959 | or delete |
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
960 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
961 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
962 | from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
963 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
964 | args = self.initCommand("checkout") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
965 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
966 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
967 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
968 | self.addArguments(args, name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
969 | names = name[:] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
970 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
971 | dname, fname = self.splitPath(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
972 | args.append(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
973 | names = [name] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
974 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
975 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
976 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
977 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
978 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
979 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
980 | project = ericApp().getObject("Project") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
981 | names = [project.getRelativePath(nam) for nam in names] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
982 | if names[0]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
983 | dlg = DeleteFilesConfirmationDialog( |
11218
43dfc40728d2
Modified the 'parent' handling for the DeleteFilesConfirmationDialog class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11148
diff
changeset
|
984 | self.__ui, |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
985 | self.tr("Revert changes"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
986 | self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | "Do you really want to revert all changes to these files" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
988 | " or directories?" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
989 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
990 | names, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
991 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
992 | yes = dlg.exec() == QDialog.DialogCode.Accepted |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
993 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
994 | yes = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
995 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
996 | self.tr("Revert changes"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
997 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
998 | """Do you really want to revert all changes of""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
999 | """ the project?""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1000 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1001 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1002 | if yes: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1003 | dia = GitDialog(self.tr("Reverting changes"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1004 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1005 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1006 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1007 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1008 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1009 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1010 | res = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1011 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1012 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1013 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1014 | def vcsMerge(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1015 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1016 | Public method used to merge a URL/revision into the local project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1017 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1018 | @param name file/directory name to be merged |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1019 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1020 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1021 | from .GitMergeDialog import GitMergeDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1022 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1023 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1024 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1025 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1026 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1027 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1028 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1029 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1030 | dlg = GitMergeDialog( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1031 | self.gitGetTagsList(repodir), |
9971
773ad1f1ed22
Performed some 'ethical' changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9734
diff
changeset
|
1032 | self.gitGetBranchesList(repodir), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1033 | self.gitGetCurrentBranch(repodir), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1034 | self.gitGetBranchesList(repodir, remotes=True), |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1035 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1036 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1037 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1038 | commit, doCommit, commitMessage, addLog, diffStat = dlg.getParameters() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1039 | args = self.initCommand("merge") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1040 | if doCommit: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1041 | args.append("--commit") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1042 | args.append("-m") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1043 | args.append(commitMessage) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1044 | if addLog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1045 | args.append("--log") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1046 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1047 | args.append("--no-log") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1048 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1049 | args.append("--no-commit") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1050 | if diffStat: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1051 | args.append("--stat") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1052 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1053 | args.append("--no-stat") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1054 | if commit: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1055 | args.append(commit) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1056 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1057 | dia = GitDialog(self.tr("Merging").format(name), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1058 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1059 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1060 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1061 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1062 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1063 | def vcsSwitch(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1064 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1065 | Public method used to switch a working directory to a different |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1066 | revision. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1067 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1068 | @param name directory name to be switched |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1069 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1070 | @return flag indicating, that the switch contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1071 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1072 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1073 | from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1074 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1075 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1076 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1077 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1078 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1079 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1080 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1081 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1082 | dlg = GitRevisionSelectionDialog( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1083 | self.gitGetTagsList(repodir), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1084 | self.gitGetBranchesList(repodir), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1085 | trackingBranchesList=self.gitGetBranchesList(repodir, remotes=True), |
9971
773ad1f1ed22
Performed some 'ethical' changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9734
diff
changeset
|
1086 | noneLabel=self.tr("Main branch head"), |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1087 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1088 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1089 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1090 | rev = dlg.getRevision() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1091 | return self.vcsUpdate(name, revision=rev) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1092 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1093 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1094 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1095 | def vcsRegisteredState(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1096 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1097 | Public method used to get the registered state of a file in the vcs. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1098 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1099 | @param name filename to check |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1100 | @type str |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1101 | @return registered state |
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1102 | @rtype VersionControlState |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1103 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1104 | if name.endswith(os.sep): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1105 | name = name[:-1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1106 | name = os.path.normcase(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1107 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1108 | |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1109 | if fname == "." and os.path.exists(os.path.join(dname, self.adminDirOrFile)): |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1110 | return VersionControlState.Controlled |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1111 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1112 | if name in self.statusCache: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1113 | return self.statusCache[name] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1114 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1115 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1116 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1117 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1118 | return 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1119 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1120 | args = self.initCommand("status") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1121 | args.append("--porcelain") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1122 | args.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1123 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1124 | ioEncoding = Preferences.getSystem("IOEncoding") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1125 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1126 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1127 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1128 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1129 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1130 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1131 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1132 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1133 | output = str(process.readAllStandardOutput(), ioEncoding, "replace") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1134 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1135 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1136 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1137 | if line and line[0] in " MADRCU!?": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1138 | flag = line[1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1139 | path = line[3:].split(" -> ")[-1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1140 | absname = os.path.join(repodir, os.path.normcase(path)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1141 | if absname.endswith(("/", "\\")): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1142 | absname = absname[:-1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1143 | if flag not in "?!": |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1144 | if fname == ".": |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1145 | if absname.startswith(dname + os.path.sep): |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1146 | return VersionControlState.Controlled |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1147 | if absname == dname: |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1148 | return VersionControlState.Controlled |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1149 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1150 | if absname == name: |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1151 | return VersionControlState.Controlled |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1152 | else: |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1153 | return VersionControlState.Controlled |
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1154 | |
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1155 | return VersionControlState.Uncontrolled |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1156 | |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
1157 | def vcsAllRegisteredStates(self, names, dname, shortcut=True): # noqa: U-100 |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1158 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1159 | Public method used to get the registered states of a number of files |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1160 | in the vcs. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1161 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1162 | <b>Note:</b> If a shortcut is to be taken, the code will only check, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1163 | if the named directory has been scanned already. If so, it is assumed, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1164 | that the states for all files have been populated by the previous run. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1165 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1166 | @param names dictionary with all filenames to be checked as keys |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1167 | @type dict |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1168 | @param dname directory to check in |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1169 | @type str |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
1170 | @param shortcut flag indicating a shortcut should be taken (unused) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1171 | @type bool |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1172 | @return the received dictionary completed with the VCS state or None in |
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1173 | order to signal an error |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1174 | @rtype dict |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1175 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1176 | if dname.endswith(os.sep): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1177 | dname = dname[:-1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1178 | dname = os.path.normcase(dname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1179 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1180 | # revert the logic because git status doesn't show unchanged files |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1181 | for name in names: |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1182 | names[name] = VersionControlState.Controlled |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1183 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1184 | found = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1185 | for name in self.statusCache: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1186 | if name in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1187 | found = True |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1188 | names[name] = self.statusCache[name] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1189 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1190 | if not found: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1191 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1192 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1193 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1194 | return names |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1195 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1196 | args = self.initCommand("status") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1197 | args.append("--porcelain") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1198 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1199 | ioEncoding = Preferences.getSystem("IOEncoding") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1200 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1201 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1202 | process.setWorkingDirectory(dname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1203 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1204 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1205 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1206 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1207 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1208 | output = str(process.readAllStandardOutput(), ioEncoding, "replace") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1209 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1210 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1211 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1212 | if line and line[0] in " MADRCU!?": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1213 | flag = line[1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1214 | path = line[3:].split(" -> ")[-1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1215 | name = os.path.normcase(os.path.join(repodir, path)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1216 | dirName = os.path.dirname(name) |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1217 | if name.startswith(dname) and flag in "?!": |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1218 | isDir = name.endswith(("/", "\\")) |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1219 | if isDir: |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1220 | name = name[:-1] |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1221 | if name in names: |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1222 | names[name] = VersionControlState.Uncontrolled |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1223 | if isDir: |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1224 | # it's a directory |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1225 | for nname in names: |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1226 | if nname.startswith(name): |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1227 | names[nname] = VersionControlState.Uncontrolled |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1228 | if flag not in "?!": |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1229 | self.statusCache[name] = VersionControlState.Controlled |
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1230 | self.statusCache[dirName] = VersionControlState.Controlled |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1231 | else: |
10491
acabc60b19a2
Version Control
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10489
diff
changeset
|
1232 | self.statusCache[name] = VersionControlState.Uncontrolled |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1233 | if dirName not in self.statusCache: |
10621
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10491
diff
changeset
|
1234 | self.statusCache[dirName] = ( |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10491
diff
changeset
|
1235 | VersionControlState.Uncontrolled |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10491
diff
changeset
|
1236 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1237 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1238 | return names |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1239 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1240 | def clearStatusCache(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1241 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1242 | Public method to clear the status cache. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1243 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1244 | self.statusCache = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1245 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1246 | def vcsName(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1247 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1248 | Public method returning the name of the vcs. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1249 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1250 | @return always 'Git' |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1251 | @rtype str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1252 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1253 | return "Git" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1254 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1255 | def vcsInitConfig(self, project): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1256 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1257 | Public method to initialize the VCS configuration. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1258 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1259 | This method ensures, that an ignore file exists. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1260 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1261 | @param project reference to the project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1262 | @type Project |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1263 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1264 | ppath = project.getProjectPath() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1265 | if ppath: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1266 | ignoreName = os.path.join(ppath, Git.IgnoreFileName) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1267 | if not os.path.exists(ignoreName): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1268 | self.gitCreateIgnoreFile(project.getProjectPath(), autoAdd=True) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1269 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1270 | def vcsCleanup(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1271 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1272 | Public method used to cleanup the working directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1273 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1274 | @param name directory name to be cleaned up |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1275 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1276 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1277 | patterns = self.__plugin.getPreferences("CleanupPatterns").split() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1278 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1279 | entries = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1280 | for pat in patterns: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
1281 | entries.extend(FileSystemUtilities.direntries(name, True, pat)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1282 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1283 | for entry in entries: |
8240
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8234
diff
changeset
|
1284 | with contextlib.suppress(OSError): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1285 | os.remove(entry) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1286 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1287 | def vcsCommandLine(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1288 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1289 | Public method used to execute arbitrary Git commands. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1290 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1291 | @param name directory name of the working directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1292 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1293 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1294 | from .GitCommandDialog import GitCommandDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1295 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1296 | dlg = GitCommandDialog(self.commandHistory, name, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1297 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1298 | command = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1299 | commandList = Utilities.parseOptionString(command) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1300 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1301 | # This moves any previous occurrence of these arguments to the head |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1302 | # of the list. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1303 | if command in self.commandHistory: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1304 | self.commandHistory.remove(command) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1305 | self.commandHistory.insert(0, command) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1306 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1307 | args = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1308 | self.addArguments(args, commandList) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1309 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1310 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1311 | repodir = self.findRepoRoot(name) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1312 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1313 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1314 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1315 | dia = GitDialog(self.tr("Git Command"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1316 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1317 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1318 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1319 | |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
1320 | def vcsOptionsDialog( |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
1321 | self, project, _archive, editable=False, parent=None # noqa: U-100 |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
1322 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1323 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1324 | Public method to get a dialog to enter repository info. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1325 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1326 | @param project reference to the project object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1327 | @type Project |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
1328 | @param _archive name of the project in the repository (unused) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1329 | @type str |
10683
779cda568acb
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
1330 | @param editable flag indicating that the project name is editable (unused) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1331 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1332 | @param parent parent widget |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1333 | @type QWidget |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1334 | @return reference to the instantiated options dialog |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1335 | @rtype GitOptionsDialog |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1336 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1337 | from .GitOptionsDialog import GitOptionsDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1338 | |
10690
fab36645aa7d
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10683
diff
changeset
|
1339 | return GitOptionsDialog(parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1340 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1341 | def vcsNewProjectOptionsDialog(self, parent=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1342 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1343 | Public method to get a dialog to enter repository info for getting a |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1344 | new project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1345 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1346 | @param parent parent widget |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1347 | @type QWidget |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1348 | @return reference to the instantiated options dialog |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1349 | @rtype GitNewProjectOptionsDialog |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1350 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1351 | from .GitNewProjectOptionsDialog import GitNewProjectOptionsDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1352 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1353 | return GitNewProjectOptionsDialog(self, parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1354 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1355 | def vcsRepositoryInfos(self, ppath): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1356 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1357 | Public method to retrieve information about the repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1358 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1359 | @param ppath local path to get the repository infos |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1360 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1361 | @return string with ready formated info for display |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1362 | @rtype str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1363 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1364 | formatTemplate = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1365 | "format:" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1366 | "%h%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1367 | "%p%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1368 | "%an%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1369 | "%ae%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1370 | "%ai%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1371 | "%cn%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1372 | "%ce%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1373 | "%ci%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1374 | "%d%n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1375 | "%s" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1376 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1377 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1378 | args = self.initCommand("show") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1379 | args.append("--abbrev-commit") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1380 | args.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1381 | "--abbrev={0}".format(self.__plugin.getPreferences("CommitIdLength")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1382 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1383 | args.append("--format={0}".format(formatTemplate)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1384 | args.append("--no-patch") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1385 | args.append("HEAD") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1386 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1387 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1388 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1389 | process.setWorkingDirectory(ppath) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1390 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1391 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1392 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1393 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1394 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1395 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1396 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1397 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1398 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1399 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1400 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1401 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1402 | info = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1403 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1404 | commit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1405 | parents, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1406 | author, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1407 | authorMail, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1408 | authorDate, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1409 | committer, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1410 | committerMail, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1411 | committerDate, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1412 | refs, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1413 | subject, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1414 | ) = output.splitlines() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1415 | tags = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1416 | branches = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1417 | for name in refs.strip()[1:-1].split(","): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1418 | name = name.strip() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1419 | if name: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1420 | if name.startswith("tag: "): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1421 | tags.append(name.split()[1]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1422 | elif name != "HEAD": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1423 | branches.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1424 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1425 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1426 | self.tr("<tr><td><b>Commit</b></td><td>{0}</td></tr>").format(commit) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1427 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1428 | if parents: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1429 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1430 | self.tr("<tr><td><b>Parents</b></td><td>{0}</td></tr>").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1431 | "<br/>".join(parents.strip().split()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1432 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1433 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1434 | if tags: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1435 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1436 | self.tr("<tr><td><b>Tags</b></td><td>{0}</td></tr>").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1437 | "<br/>".join(tags) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1438 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1439 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1440 | if branches: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1441 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1442 | self.tr("<tr><td><b>Branches</b></td><td>{0}</td></tr>").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1443 | "<br/>".join(branches) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1444 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1445 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1446 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1447 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1448 | "<tr><td><b>Author</b></td><td>{0} <{1}></td></tr>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1449 | ).format(author, authorMail) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1450 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1451 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1452 | self.tr("<tr><td><b>Date</b></td><td>{0}</td></tr>").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1453 | authorDate.rsplit(":", 1)[0] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1454 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1455 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1456 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1457 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1458 | "<tr><td><b>Committer</b></td><td>{0} <{1}></td></tr>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1459 | ).format(committer, committerMail) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1460 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1461 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1462 | self.tr("<tr><td><b>Committed Date</b></td><td>{0}</td></tr>").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1463 | committerDate.rsplit(":", 1)[0] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1464 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1465 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1466 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1467 | self.tr("<tr><td><b>Subject</b></td><td>{0}</td></tr>").format(subject) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1468 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1469 | infoStr = "\n".join(info) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1470 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1471 | infoStr = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1472 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1473 | return self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1474 | """<h3>Repository information</h3>\n""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1475 | """<p><table>\n""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1476 | """<tr><td><b>Git V.</b></td><td>{0}</td></tr>\n""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1477 | """<tr></tr>\n""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1478 | """{1}""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1479 | """</table></p>\n""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1480 | ).format(self.versionStr, infoStr) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1481 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1482 | def vcsSupportCommandOptions(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1483 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1484 | Public method to signal the support of user settable command options. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1485 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1486 | @return flag indicating the support of user settable command options |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1487 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1488 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1489 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1490 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1491 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1492 | ## Git specific methods are below. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1493 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1494 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1495 | def gitNormalizeURL(self, url): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1496 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1497 | Public method to normalize a url for Git. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1498 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1499 | @param url url string |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1500 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1501 | @return properly normalized url for git |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1502 | @rtype str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1503 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1504 | url = url.replace("\\", "/") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1505 | if url.endswith("/"): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1506 | url = url[:-1] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1507 | urll = url.split("//") |
6707
30f0ac20df50
Git Interface: changed code again to cope with 'scp like' repository URLs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6645
diff
changeset
|
1508 | if len(urll) > 1: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1509 | url = "{0}//{1}".format(urll[0], "/".join(urll[1:])) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1510 | |
6707
30f0ac20df50
Git Interface: changed code again to cope with 'scp like' repository URLs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6645
diff
changeset
|
1511 | return url |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1512 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1513 | def gitCreateIgnoreFile(self, name, autoAdd=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1514 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1515 | Public method to create the ignore file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1516 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1517 | @param name directory name to create the ignore file in |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1518 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1519 | @param autoAdd flag indicating to add it automatically |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1520 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1521 | @return flag indicating success |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1522 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1523 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1524 | status = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1525 | ignorePatterns = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1526 | ".eric6project/", |
8314
e3642a6a1e71
Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
1527 | ".eric7project/", |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1528 | ".ropeproject/", |
8653 | 1529 | ".jedi/", |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1530 | ".directory/", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1531 | "*.pyc", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1532 | "*.pyo", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1533 | "*.orig", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1534 | "*.bak", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1535 | "*.rej", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1536 | "*~", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1537 | "cur/", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1538 | "tmp/", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1539 | "__pycache__/", |
9734
74f7c9f5d094
Modified the 'gitCreateIgnoreFile()' and 'hgCreateIgnoreFile()' methods to support PEP 582 (i.e. '__pypackages__').
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
1540 | "__pypackages__", |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1541 | "*.DS_Store", |
9318
a47b5c46be3f
Added some more patterns to the .hgignore and .gitignore generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
1542 | ".pytest_cache/", |
a47b5c46be3f
Added some more patterns to the .hgignore and .gitignore generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
1543 | "venv/", |
a47b5c46be3f
Added some more patterns to the .hgignore and .gitignore generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
1544 | ".venv/", |
a47b5c46be3f
Added some more patterns to the .hgignore and .gitignore generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
1545 | "env/", |
a47b5c46be3f
Added some more patterns to the .hgignore and .gitignore generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
1546 | ".env/", |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1547 | ] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1548 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1549 | ignoreName = os.path.join(name, Git.IgnoreFileName) |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1550 | res = ( |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1551 | EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1552 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1553 | self.tr("Create {0} file").format(ignoreName), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1554 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1555 | """<p>The file <b>{0}</b> exists already.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1556 | """ Overwrite it?</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1557 | ).format(ignoreName), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1558 | icon=EricMessageBox.Warning, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1559 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1560 | if os.path.exists(ignoreName) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1561 | else True |
8259
2bbec88047dd
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8240
diff
changeset
|
1562 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1563 | if res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1564 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1565 | # create a .gitignore file |
7785
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
1566 | with open(ignoreName, "w") as ignore: |
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
1567 | ignore.write("\n".join(ignorePatterns)) |
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
1568 | ignore.write("\n") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1569 | status = True |
7836
2f0d208b8137
Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7785
diff
changeset
|
1570 | except OSError: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1571 | status = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1572 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1573 | if status and autoAdd: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1574 | self.vcsAdd(ignoreName, noDialog=True) |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1575 | project = ericApp().getObject("Project") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1576 | project.appendFile(ignoreName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1577 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1578 | return status |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1579 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1580 | def gitCopy(self, name, project): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1581 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1582 | Public method used to copy a file/directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1583 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1584 | @param name file/directory name to be copied |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1585 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1586 | @param project reference to the project object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1587 | @type Project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1588 | @return flag indicating successful operation |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1589 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1590 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1591 | from .GitCopyDialog import GitCopyDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1592 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1593 | dlg = GitCopyDialog(name, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1594 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1595 | target, force = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1596 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1597 | # step 1: copy the file/directory: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1598 | if os.path.isdir(name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1599 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1600 | shutil.copytree(name, target) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1601 | except (OSError, shutil.Error) as why: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1602 | EricMessageBox.critical( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1603 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1604 | self.tr("Git Copy"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1605 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1606 | """<p>Copying the directory <b>{0}</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1607 | """ failed.</p><p>Reason: {1}</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1608 | ).format(name, str(why)), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1609 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1610 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1611 | self.vcsAdd(target, isDir=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1612 | if target.startswith(project.getProjectPath()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1613 | project.copyDirectory(name, target) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1614 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1615 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1616 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1617 | shutil.copy2(name, target) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1618 | except (OSError, shutil.Error) as why: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1619 | EricMessageBox.critical( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1620 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1621 | self.tr("Git Copy"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1622 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1623 | """<p>Copying the file <b>{0}</b>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1624 | """ failed.</p><p>Reason: {1}</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1625 | ).format(name, str(why)), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1626 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1627 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1628 | self.vcsAdd(target, isDir=False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1629 | if target.startswith(project.getProjectPath()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1630 | project.appendFile(target) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1631 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1632 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1633 | |
9421
989ee2535d59
Git Interface and Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1634 | def gitBlame(self, name, skiplist=""): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1635 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1636 | Public method to show the output of the git blame command. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1637 | |
9421
989ee2535d59
Git Interface and Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1638 | @param name file name to show the annotations for |
989ee2535d59
Git Interface and Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1639 | @type str |
989ee2535d59
Git Interface and Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1640 | @param skiplist name of a skip list file |
989ee2535d59
Git Interface and Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1641 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1642 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1643 | from .GitBlameDialog import GitBlameDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1644 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1645 | if self.blame is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1646 | self.blame = GitBlameDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1647 | self.blame.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1648 | self.blame.raise_() |
9421
989ee2535d59
Git Interface and Mercurial Interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
1649 | self.blame.start(name, skiplist=skiplist) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1650 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1651 | def gitExtendedDiff(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1652 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1653 | Public method used to view the difference of a file/directory to the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1654 | Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1655 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1656 | If name is a directory and is the project directory, all project files |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1657 | are saved first. If name is a file (or list of files), which is/are |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1658 | being edited and has unsaved modification, they can be saved or the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1659 | operation may be aborted. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1660 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1661 | This method gives the chance to enter the revisions to be compared. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1662 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1663 | @param name file/directory name to be diffed |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1664 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1665 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1666 | from .GitDiffDialog import GitDiffDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1667 | from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1668 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1669 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1670 | dname, fnames = self.splitPathList(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1671 | names = name[:] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1672 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1673 | dname, fname = self.splitPath(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1674 | names = [name] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1675 | for nam in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1676 | if os.path.isfile(nam): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1677 | editor = ericApp().getObject("ViewManager").getOpenEditor(nam) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1678 | if editor and not editor.checkDirty(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1679 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1680 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1681 | project = ericApp().getObject("Project") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1682 | if nam == project.ppath and not project.saveAllScripts(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1683 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1684 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1685 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1686 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1687 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1688 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1689 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1690 | dlg = GitRevisionsSelectionDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1691 | self.gitGetTagsList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1692 | self.gitGetBranchesList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1693 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1694 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1695 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1696 | revisions = dlg.getRevisions() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1697 | if self.diff is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1698 | self.diff = GitDiffDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1699 | self.diff.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1700 | self.diff.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1701 | self.diff.start(name, revisions) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1702 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1703 | def __gitGetFileForRevision(self, name, rev=""): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1704 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1705 | Private method to get a file for a specific revision from the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1706 | repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1707 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1708 | @param name file name to get from the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1709 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1710 | @param rev revision to retrieve |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1711 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1712 | @return contents of the file (string) and an error message |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1713 | @rtype str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1714 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1715 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1716 | repodir = self.findRepoRoot(self.splitPath(name)[0]) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1717 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1718 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1719 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1720 | args = self.initCommand("cat-file") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1721 | args.append("blob") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1722 | args.append("{0}:{1}".format(rev, name.replace(repodir + os.sep, ""))) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1723 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1724 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1725 | error = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1726 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1727 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1728 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1729 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1730 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1731 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1732 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1733 | if finished: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1734 | if process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1735 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1736 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1737 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1738 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1739 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1740 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1741 | error = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1742 | process.readAllStandardError(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1743 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1744 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1745 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1746 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1747 | error = self.tr("The git process did not finish within 30s.") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1748 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1749 | error = self.tr( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1750 | "The process {0} could not be started. " |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1751 | "Ensure, that it is in the search path." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1752 | ).format("git") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1753 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1754 | # return file contents with 'universal newlines' |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1755 | return output.replace("\r\n", "\n").replace("\r", "\n"), error |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1756 | |
8621
8c9f41115c04
Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
1757 | def vcsSbsDiff(self, name, extended=False, revisions=None): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1758 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1759 | Public method used to view the difference of a file to the Git |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1760 | repository side-by-side. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1761 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1762 | @param name file name to be diffed |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1763 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1764 | @param extended flag indicating the extended variant |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1765 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1766 | @param revisions tuple of two revisions |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1767 | @type tuple of (str, str) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1768 | @exception ValueError raised to indicate an invalid name parameter |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1769 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1770 | from eric7.UI.CompareDialog import CompareDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1771 | |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1772 | from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1773 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1774 | if isinstance(name, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1775 | raise ValueError("Wrong parameter type") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1776 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1777 | if extended: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1778 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1779 | repodir = self.findRepoRoot(self.splitPath(name)[0]) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1780 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1781 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1782 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1783 | dlg = GitRevisionsSelectionDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1784 | self.gitGetTagsList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1785 | self.gitGetBranchesList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1786 | parent=self.__ui, |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
1787 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1788 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1789 | rev1, rev2 = dlg.getRevisions() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1790 | elif revisions: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1791 | rev1, rev2 = revisions[0], revisions[1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1792 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1793 | rev1, rev2 = "", "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1794 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1795 | output1, error = self.__gitGetFileForRevision(name, rev=rev1) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1796 | if error: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1797 | EricMessageBox.critical( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1798 | self.__ui, self.tr("Git Side-by-Side Difference"), error |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1799 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1800 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1801 | name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or "Stage") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1802 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1803 | if rev2: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1804 | if rev2 == "Stage": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1805 | rev2 = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1806 | output2, error = self.__gitGetFileForRevision(name, rev=rev2) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1807 | if error: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1808 | EricMessageBox.critical( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1809 | self.__ui, self.tr("Git Side-by-Side Difference"), error |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1810 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1811 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1812 | name2 = "{0} (rev. {1})".format(name, rev2) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1813 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1814 | try: |
7785
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
1815 | with open(name, "r", encoding="utf-8") as f1: |
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
1816 | output2 = f1.read() |
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
1817 | f1.close() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1818 | name2 = "{0} (Work)".format(name) |
7836
2f0d208b8137
Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7785
diff
changeset
|
1819 | except OSError: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1820 | EricMessageBox.critical( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1821 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1822 | self.tr("Git Side-by-Side Difference"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1823 | self.tr("""<p>The file <b>{0}</b> could not be read.</p>""").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1824 | name |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1825 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1826 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1827 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1828 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1829 | if self.sbsDiff is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1830 | self.sbsDiff = CompareDialog() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1831 | self.sbsDiff.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1832 | self.sbsDiff.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1833 | self.sbsDiff.compare(output1, output2, name1, name2) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1834 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1835 | def gitFetch(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1836 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1837 | Public method to fetch changes from a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1838 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1839 | @param name directory name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1840 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1841 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1842 | from .GitFetchDialog import GitFetchDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1843 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1844 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1845 | repodir = self.findRepoRoot(self.splitPath(name)[0]) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1846 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1847 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1848 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1849 | dlg = GitFetchDialog(self, repodir, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1850 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1851 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1852 | remote, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1853 | url, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1854 | remoteBranches, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1855 | localBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1856 | fetchAll, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1857 | prune, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1858 | includeTags, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1859 | ) = dlg.getData() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1860 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1861 | args = self.initCommand("fetch") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1862 | args.append("--verbose") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1863 | if prune: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1864 | args.append("--prune") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1865 | if includeTags: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1866 | args.append("--tags") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1867 | if fetchAll: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1868 | args.append("--all") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1869 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1870 | args.append(remote) if remote else args.append(url) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1871 | if len(remoteBranches) == 1 and localBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1872 | args.append(remoteBranches[0] + ":" + localBranch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1873 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1874 | args.extend(remoteBranches) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1875 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1876 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1877 | self.tr("Fetching from a remote Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1878 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1879 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1880 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1881 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1882 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1883 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1884 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1885 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1886 | def gitPull(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1887 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1888 | Public method used to pull changes from a remote Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1889 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1890 | @param name directory name of the project to be pulled to |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1891 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1892 | @return flag indicating, that the update contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1893 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1894 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1895 | from .GitPullDialog import GitPullDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1896 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1897 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1898 | repodir = self.findRepoRoot(self.splitPath(name)[0]) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1899 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1900 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1901 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1902 | dlg = GitPullDialog(self, repodir, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1903 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1904 | remote, url, branches, pullAll, prune = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1905 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1906 | args = self.initCommand("pull") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1907 | args.append("--no-commit") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1908 | args.append("--verbose") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1909 | if prune: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1910 | args.append("--prune") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1911 | if pullAll: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1912 | args.append("--all") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1913 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1914 | args.append(remote) if remote else args.append(url) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1915 | args.extend(branches) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1916 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1917 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1918 | self.tr("Pulling from a remote Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1919 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1920 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1921 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1922 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1923 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1924 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1925 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1926 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1927 | return res |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1928 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1929 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1930 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1931 | def gitPush(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1932 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1933 | Public method used to push changes to a remote Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1934 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1935 | @param name directory name of the project to be pushed from |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1936 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1937 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1938 | from .GitPushDialog import GitPushDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
1939 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1940 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1941 | repodir = self.findRepoRoot(self.splitPath(name)[0]) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1942 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1943 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1944 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1945 | dlg = GitPushDialog(self, repodir, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1946 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1947 | remote, refspecs, tags, tracking, submodule = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1948 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1949 | args = self.initCommand("push") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1950 | args.append("--verbose") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1951 | args.append("--porcelain") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1952 | if tags: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1953 | args.append("--tags") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1954 | if tracking: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1955 | args.append("--set-upstream") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1956 | if submodule: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1957 | args.append("--recurse-submodules={0}".format(submodule)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1958 | args.append(remote) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1959 | args.extend(refspecs) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1960 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1961 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1962 | self.tr("Pushing to a remote Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1963 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1964 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1965 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1966 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1967 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1968 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1969 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1970 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1971 | def gitCommitMerge(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1972 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1973 | Public method to commit a failed merge. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1974 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1975 | @param name file/directory name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
1976 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1977 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1978 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1979 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1980 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1981 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1982 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
1983 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1984 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1985 | editor = sys.argv[0].replace(".py", "_editor.py") |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
1986 | env = { |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
1987 | "GIT_EDITOR": "{0} {1}".format( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
1988 | PythonUtilities.getPythonExecutable(), editor |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
1989 | ) |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
1990 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1991 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1992 | args = self.initCommand("commit") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1993 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
1994 | dia = GitDialog(self.tr("Committing failed merge"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1995 | res = dia.startProcess(args, repodir, environment=env) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1996 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
1997 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1998 | self.committed.emit() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1999 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2000 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2001 | def gitCancelMerge(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2002 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2003 | Public method to cancel an uncommitted or failed merge. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2004 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2005 | @param name file/directory name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2006 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2007 | @return flag indicating, that the cancellation contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2008 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2009 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2010 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2011 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2012 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2013 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2014 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2015 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2016 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2017 | args = self.initCommand("merge") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2018 | args.append("--abort") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2019 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2020 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2021 | self.tr("Aborting uncommitted/failed merge"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2022 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2023 | res = dia.startProcess(args, repodir, False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2024 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2025 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2026 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2027 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2028 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2029 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2030 | def gitApply(self, repodir, patchFile, cached=False, reverse=False, noDialog=False): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2031 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2032 | Public method to apply a patch stored in a given file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2033 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2034 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2035 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2036 | @param patchFile name of the patch file |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2037 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2038 | @param cached flag indicating to apply the patch to the staging area |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2039 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2040 | @param reverse flag indicating to apply the patch in reverse |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2041 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2042 | @param noDialog flag indicating quiet operations |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2043 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2044 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2045 | args = self.initCommand("apply") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2046 | if cached: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2047 | args.append("--index") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2048 | args.append("--cached") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2049 | if reverse: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2050 | args.append("--reverse") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2051 | args.append(patchFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2052 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2053 | if noDialog: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2054 | self.startSynchronizedProcess(QProcess(), "git", args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2055 | else: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2056 | dia = GitDialog(self.tr("Applying patch"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2057 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2058 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2059 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2060 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2061 | def gitApplyCheckPatches(self, projectDir, check=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2062 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2063 | Public method to apply a list of patch files or check, if they would |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2064 | apply cleanly. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2065 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2066 | @param projectDir directory name of the project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2067 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2068 | @param check flag indicating to perform a check operation |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2069 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2070 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2071 | from .GitPatchFilesDialog import GitPatchFilesDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2072 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2073 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2074 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2075 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2076 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2077 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2078 | dlg = GitPatchFilesDialog(repodir, self.__patchCheckData, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2079 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2080 | patchFilesList, stripCount, inaccurateEof, recount = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2081 | if patchFilesList: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2082 | args = self.initCommand("apply") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2083 | if check: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2084 | args.append("--check") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2085 | self.__patchCheckData = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2086 | patchFilesList, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2087 | stripCount, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2088 | inaccurateEof, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2089 | recount, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2090 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2091 | title = self.tr("Check patch files") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2092 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2093 | self.__patchCheckData = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2094 | title = self.tr("Apply patch files") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2095 | if inaccurateEof: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2096 | args.append("--inaccurate-eof") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2097 | if recount: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2098 | args.append("--recount") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2099 | args.append("-p{0}".format(stripCount)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2100 | args.extend(patchFilesList) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2101 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2102 | dia = GitDialog(title, git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2103 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2104 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2105 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2106 | if not check: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2107 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2108 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2109 | def gitShowPatchesStatistics(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2110 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2111 | Public method to show statistics for a set of patch files. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2112 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2113 | @param projectDir directory name of the project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2114 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2115 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2116 | from .GitPatchStatisticsDialog import GitPatchStatisticsDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2117 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2118 | if self.patchStatisticsDialog is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2119 | self.patchStatisticsDialog = GitPatchStatisticsDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2120 | self.patchStatisticsDialog.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2121 | self.patchStatisticsDialog.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2122 | self.patchStatisticsDialog.start(projectDir, self.__patchCheckData) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2123 | self.__patchCheckData = self.patchStatisticsDialog.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2124 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2125 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2126 | ## Methods for tag handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2127 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2128 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2129 | def vcsTag(self, name, revision=None, tagName=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2130 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2131 | Public method used to set/remove a tag in the Git repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2132 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2133 | @param name file/directory name to determine the repo root from |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2134 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2135 | @param revision revision to set tag for |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2136 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2137 | @param tagName name of the tag |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2138 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2139 | @return flag indicating a performed tag action |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2140 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2141 | """ |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2142 | from .GitTagDialog import GitTagDialog, GitTagOperation, GitTagType |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2143 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2144 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2145 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2146 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2147 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2148 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2149 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2150 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2151 | dlg = GitTagDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2152 | self.gitGetTagsList(repodir), revision, tagName, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2153 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2154 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2155 | tag, revision, tagOp, tagType, force = dlg.getParameters() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2156 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2157 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2158 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2159 | args = self.initCommand("tag") |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2160 | if tagOp == GitTagOperation.Create: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2161 | msg = "Created tag <{0}>.".format(tag) |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2162 | if tagType == GitTagType.Annotated: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2163 | args.append("--annotate") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2164 | args.append("--message={0}".format(msg)) |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2165 | elif tagType == GitTagType.Signed: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2166 | args.append("--sign") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2167 | args.append("--message={0}".format(msg)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2168 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2169 | args.append("--force") |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2170 | elif tagOp == GitTagOperation.Delete: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2171 | args.append("--delete") |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2172 | elif tagOp == GitTagOperation.Verify: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2173 | args.append("--verify") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2174 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2175 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2176 | args.append(tag) |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
2177 | if tagOp == GitTagOperation.Create and revision: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2178 | args.append(revision) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2179 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2180 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2181 | self.tr("Tagging in the Git repository"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2182 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2183 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2184 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2185 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2186 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2187 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2188 | |
10069
435cc5875135
Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9972
diff
changeset
|
2189 | def gitGetTagsList(self, repodir): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2190 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2191 | Public method to get the list of tags. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2192 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2193 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2194 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2195 | @return list of tags or list of tuples of tag name and flag indicating |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2196 | a local tag, if withType is True |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2197 | @rtype list of str or list of tuple of (str, bool) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2198 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2199 | args = self.initCommand("tag") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2200 | args.append("--list") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2201 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2202 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2203 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2204 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2205 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2206 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2207 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2208 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2209 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2210 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2211 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2212 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2213 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2214 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2215 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2216 | tagsList = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2217 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2218 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2219 | name = line.strip() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2220 | tagsList.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2221 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2222 | return tagsList |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2223 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2224 | def gitListTagBranch(self, path, tags=True, listAll=True, merged=True): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2225 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2226 | Public method used to list the available tags or branches. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2227 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2228 | @param path directory name of the project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2229 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2230 | @param tags flag indicating listing of branches or tags |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2231 | (False = branches, True = tags) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2232 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2233 | @param listAll flag indicating to show all tags or branches |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2234 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2235 | @param merged flag indicating to show only merged or non-merged branches |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2236 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2237 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2238 | from .GitTagBranchListDialog import GitTagBranchListDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2239 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2240 | if self.tagbranchList is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2241 | self.tagbranchList = GitTagBranchListDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2242 | self.tagbranchList.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2243 | self.tagbranchList.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2244 | if tags: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2245 | self.tagbranchList.start(path, tags) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2246 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2247 | self.tagbranchList.start(path, tags, listAll, merged) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2248 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2249 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2250 | ## Methods for branch handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2251 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2252 | |
9972
68ac01294544
Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9971
diff
changeset
|
2253 | def gitGetBranchesList( |
68ac01294544
Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9971
diff
changeset
|
2254 | self, repodir, withMain=False, allBranches=False, remotes=False |
68ac01294544
Corrected some code style and formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9971
diff
changeset
|
2255 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2256 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2257 | Public method to get the list of branches. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2258 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2259 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2260 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2261 | @param withMain flag indicating to get 'main' as well |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2262 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2263 | @param allBranches flag indicating to return all branches |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2264 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2265 | @param remotes flag indicating to return remote branches only |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2266 | @type bool |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2267 | @return list of branches |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2268 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2269 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2270 | args = self.initCommand("branch") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2271 | args.append("--list") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2272 | if allBranches: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2273 | args.append("--all") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2274 | elif remotes: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2275 | args.append("--remotes") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2276 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2277 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2278 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2279 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2280 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2281 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2282 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2283 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2284 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2285 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2286 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2287 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2288 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2289 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2290 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2291 | branchesList = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2292 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2293 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2294 | name = line[2:].strip() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2295 | if ( |
9971
773ad1f1ed22
Performed some 'ethical' changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9734
diff
changeset
|
2296 | (name not in ("main", "master") or withMain) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2297 | and "->" not in name |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2298 | and not name.startswith("(") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2299 | and not name.endswith(")") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2300 | ): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2301 | branchesList.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2302 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2303 | return branchesList |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2304 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2305 | def gitGetCurrentBranch(self, repodir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2306 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2307 | Public method used to show the current branch of the working directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2308 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2309 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2310 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2311 | @return name of the current branch |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2312 | @rtype str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2313 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2314 | args = self.initCommand("branch") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2315 | args.append("--list") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2316 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2317 | branchName = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2318 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2319 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2320 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2321 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2322 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2323 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2324 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2325 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2326 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2327 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2328 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2329 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2330 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2331 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2332 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2333 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2334 | if line.startswith("* "): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2335 | branchName = line[2:].strip() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2336 | if branchName.startswith("(") and branchName.endswith(")"): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2337 | # not a valid branch name, probably detached head |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2338 | branchName = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2339 | break |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2340 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2341 | return branchName |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2342 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2343 | def gitBranch(self, name, revision=None, branchName=None, branchOp=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2344 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2345 | Public method used to create, delete or move a branch in the Git |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2346 | repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2347 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2348 | @param name file/directory name to be branched |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2349 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2350 | @param revision revision to set tag for |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2351 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2352 | @param branchName name of the branch |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2353 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2354 | @param branchOp desired branch operation |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2355 | @type int |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2356 | @return flag indicating a performed branch action and a flag indicating, |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2357 | that the branch operation contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2358 | @rtype tuple of (bool, bool) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2359 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2360 | from .GitBranchDialog import GitBranchDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2361 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2362 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2363 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2364 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2365 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2366 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2367 | return False, False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2368 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2369 | dlg = GitBranchDialog( |
9971
773ad1f1ed22
Performed some 'ethical' changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9734
diff
changeset
|
2370 | self.gitGetBranchesList(repodir, allBranches=True), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2371 | revision, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2372 | branchName, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2373 | branchOp, |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2374 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2375 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2376 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2377 | ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2378 | branchOp, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2379 | branch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2380 | revision, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2381 | newBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2382 | remoteBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2383 | force, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2384 | ) = dlg.getParameters() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2385 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2386 | return False, False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2387 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2388 | if branchOp in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2389 | GitBranchDialog.CreateBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2390 | GitBranchDialog.DeleteBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2391 | GitBranchDialog.RenameBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2392 | GitBranchDialog.SetTrackingBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2393 | GitBranchDialog.UnsetTrackingBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2394 | ]: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2395 | args = self.initCommand("branch") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2396 | if branchOp == GitBranchDialog.CreateBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2397 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2398 | args.append("--force") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2399 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2400 | if revision: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2401 | args.append(revision) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2402 | elif branchOp == GitBranchDialog.DeleteBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2403 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2404 | args.append("-D") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2405 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2406 | args.append("-d") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2407 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2408 | elif branchOp == GitBranchDialog.RenameBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2409 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2410 | args.append("-M") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2411 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2412 | args.append("-m") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2413 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2414 | args.append(newBranch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2415 | elif branchOp == GitBranchDialog.SetTrackingBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2416 | args.append("--set-upstream-to={0}".format(remoteBranch)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2417 | if branch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2418 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2419 | elif branchOp == GitBranchDialog.UnsetTrackingBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2420 | args.append("--unset-upstream") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2421 | if branch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2422 | args.append(branch) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2423 | elif branchOp in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2424 | GitBranchDialog.CreateSwitchBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2425 | GitBranchDialog.CreateTrackingBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2426 | ]: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2427 | args = self.initCommand("checkout") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2428 | if branchOp == GitBranchDialog.CreateSwitchBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2429 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2430 | args.append("-B") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2431 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2432 | args.append("-b") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2433 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2434 | if revision: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2435 | args.append(revision) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2436 | elif branchOp == GitBranchDialog.CreateTrackingBranch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2437 | args.append("--track") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2438 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2439 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2440 | return False, False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2441 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2442 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2443 | self.tr("Branching in the Git repository"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2444 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2445 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2446 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2447 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2448 | if branchOp in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2449 | GitBranchDialog.CreateSwitchBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2450 | GitBranchDialog.CreateTrackingBranch, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2451 | ]: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2452 | update = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2453 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2454 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2455 | update = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2456 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2457 | return True, update |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2458 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2459 | def gitDeleteRemoteBranch(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2460 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2461 | Public method to delete a branch from a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2462 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2463 | @param name file/directory name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2464 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2465 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2466 | from .GitBranchPushDialog import GitBranchPushDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2467 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2468 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2469 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2470 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2471 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2472 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2473 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2474 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2475 | dlg = GitBranchPushDialog( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2476 | self.gitGetBranchesList(repodir), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2477 | self.gitGetRemotesList(repodir), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2478 | delete=True, |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2479 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2480 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2481 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2482 | branchName, remoteName = dlg.getData()[:2] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2483 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2484 | args = self.initCommand("push") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2485 | args.append(remoteName) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2486 | args.append(":{0}".format(branchName)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2487 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2488 | dia = GitDialog(self.tr("Delete Remote Branch"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2489 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2490 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2491 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2492 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2493 | def gitShowBranch(self, name): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2494 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2495 | Public method used to show the current branch of the working directory. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2496 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2497 | @param name file/directory name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2498 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2499 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2500 | dname, fname = self.splitPath(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2501 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2502 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2503 | repodir = self.findRepoRoot(dname) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2504 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2505 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2506 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2507 | branchName = self.gitGetCurrentBranch(repodir) |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2508 | EricMessageBox.information( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2509 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2510 | self.tr("Current Branch"), |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
2511 | self.tr("""<p>The current branch is <b>{0}</b>.</p>""").format(branchName), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2512 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2513 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2514 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2515 | ## Methods for bundles handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2516 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2517 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2518 | def gitBundle(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2519 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2520 | Public method to create a bundle file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2521 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2522 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2523 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2524 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2525 | from .GitBundleDialog import GitBundleDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2526 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2527 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2528 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2529 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2530 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2531 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2532 | dlg = GitBundleDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2533 | self.gitGetTagsList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2534 | self.gitGetBranchesList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2535 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2536 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2537 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2538 | revs = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2539 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2540 | fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2541 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2542 | self.tr("Create Bundle"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2543 | self.__lastBundlePath or repodir, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2544 | self.tr("Git Bundle Files (*.bundle)"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2545 | None, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2546 | EricFileDialog.DontConfirmOverwrite, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2547 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2548 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2549 | if not fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2550 | return # user aborted |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2551 | |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2552 | fpath = pathlib.Path(fname) |
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2553 | if not fpath.suffix: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2554 | ex = selectedFilter.split("(*")[1].split(")")[0] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2555 | if ex: |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2556 | fpath = fpath.with_suffix(ex) |
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2557 | if fpath.exists(): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2558 | res = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2559 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2560 | self.tr("Create Bundle"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2561 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2562 | "<p>The Git bundle file <b>{0}</b> " |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2563 | "already exists. Overwrite it?</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2564 | ).format(fpath), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2565 | icon=EricMessageBox.Warning, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2566 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2567 | if not res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2568 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2569 | |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2570 | self.__lastBundlePath = str(fpath.parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2571 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2572 | args = self.initCommand("bundle") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2573 | args.append("create") |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2574 | args.append(str(fpath)) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2575 | for rev in revs: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2576 | args.append(rev) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2577 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2578 | dia = GitDialog(self.tr("Create Bundle"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2579 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2580 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2581 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2582 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2583 | def gitVerifyBundle(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2584 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2585 | Public method to verify a bundle file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2586 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2587 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2588 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2589 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2590 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2591 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2592 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2593 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2594 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2595 | fname = EricFileDialog.getOpenFileName( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2596 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2597 | self.tr("Verify Bundle"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2598 | self.__lastBundlePath or repodir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2599 | self.tr("Git Bundle Files (*.bundle);;All Files (*)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2600 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2601 | if fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2602 | self.__lastBundlePath = os.path.dirname(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2603 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2604 | args = self.initCommand("bundle") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2605 | args.append("verify") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2606 | args.append(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2607 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2608 | dia = GitDialog(self.tr("Verify Bundle"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2609 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2610 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2611 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2612 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2613 | def gitBundleListHeads(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2614 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2615 | Public method to list the heads contained in a bundle file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2616 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2617 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2618 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2619 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2620 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2621 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2622 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2623 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2624 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2625 | fname = EricFileDialog.getOpenFileName( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2626 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2627 | self.tr("List Bundle Heads"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2628 | self.__lastBundlePath or repodir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2629 | self.tr("Git Bundle Files (*.bundle);;All Files (*)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2630 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2631 | if fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2632 | self.__lastBundlePath = os.path.dirname(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2633 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2634 | args = self.initCommand("bundle") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2635 | args.append("list-heads") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2636 | args.append(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2637 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2638 | dia = GitDialog(self.tr("List Bundle Heads"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2639 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2640 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2641 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2642 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2643 | def gitGetBundleHeads(self, repodir, bundleFile): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2644 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2645 | Public method to get a list of heads contained in a bundle file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2646 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2647 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2648 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2649 | @param bundleFile file name of a git bundle file |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2650 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2651 | @return list of heads |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2652 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2653 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2654 | args = self.initCommand("bundle") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2655 | args.append("list-heads") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2656 | args.append(bundleFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2657 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2658 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2659 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2660 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2661 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2662 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2663 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2664 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2665 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2666 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2667 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2668 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2669 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2670 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2671 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2672 | heads = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2673 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2674 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2675 | head = line.strip().split(None, 1)[1] # commit id, head |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2676 | heads.append(head.replace("refs/heads/", "")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2677 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2678 | return heads |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2679 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2680 | def gitBundleFetch(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2681 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2682 | Public method to fetch a head of a bundle file into the local |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2683 | repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2684 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2685 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2686 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2687 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2688 | from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2689 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2690 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2691 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2692 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2693 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2694 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2695 | fname = EricFileDialog.getOpenFileName( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2696 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2697 | self.tr("Apply Bundle"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2698 | self.__lastBundlePath or repodir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2699 | self.tr("Git Bundle Files (*.bundle);;All Files (*)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2700 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2701 | if fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2702 | self.__lastBundlePath = os.path.dirname(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2703 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2704 | dlg = GitApplyBundleDataDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2705 | self.gitGetBundleHeads(repodir, fname), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2706 | self.gitGetBranchesList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2707 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2708 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2709 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2710 | bundleHead, branch = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2711 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2712 | args = self.initCommand("fetch") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2713 | args.append("--verbose") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2714 | args.append(fname) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2715 | if branch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2716 | args.append(bundleHead + ":" + branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2717 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2718 | args.append(bundleHead) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2719 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2720 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2721 | self.tr("Applying a bundle file (fetch)"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2722 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2723 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2724 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2725 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2726 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2727 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2728 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2729 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2730 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2731 | def gitBundlePull(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2732 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2733 | Public method to pull a head of a bundle file into the local |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2734 | repository and working area. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2735 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2736 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2737 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2738 | @return flag indicating, that the update contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2739 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2740 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2741 | from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2742 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2743 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2744 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2745 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2746 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2747 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2748 | res = False |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2749 | fname = EricFileDialog.getOpenFileName( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2750 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2751 | self.tr("Apply Bundle"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2752 | self.__lastBundlePath or repodir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2753 | self.tr("Git Bundle Files (*.bundle);;All Files (*)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2754 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2755 | if fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2756 | self.__lastBundlePath = os.path.dirname(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2757 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2758 | dlg = GitApplyBundleDataDialog( |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2759 | self.gitGetBundleHeads(repodir, fname), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2760 | self.gitGetBranchesList(repodir), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2761 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2762 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2763 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2764 | bundleHead, branch = dlg.getData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2765 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2766 | args = self.initCommand("pull") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2767 | args.append("--verbose") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2768 | args.append(fname) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2769 | if branch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2770 | args.append(bundleHead + ":" + branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2771 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2772 | args.append(bundleHead) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2773 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2774 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2775 | self.tr("Applying a bundle file (fetch)"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2776 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2777 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2778 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2779 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2780 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2781 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2782 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2783 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2784 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2785 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2786 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2787 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2788 | ## Methods for bisect handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2789 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2790 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2791 | def gitBisect(self, projectDir, subcommand): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2792 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2793 | Public method to perform bisect commands. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2794 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2795 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2796 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2797 | @param subcommand name of the subcommand (one of 'start', |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2798 | 'start_extended', 'good', 'bad', 'skip' or 'reset') |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2799 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2800 | @return flag indicating, that the update contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2801 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2802 | @exception ValueError raised to indicate an invalid bisect subcommand |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2803 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2804 | from .GitBisectStartDialog import GitBisectStartDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2805 | from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2806 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2807 | if subcommand not in ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2808 | "start", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2809 | "start_extended", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2810 | "good", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2811 | "bad", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2812 | "skip", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2813 | "reset", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2814 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2815 | raise ValueError( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2816 | self.tr("Bisect subcommand ({0}) invalid.").format(subcommand) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2817 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2818 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2819 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2820 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2821 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2822 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2823 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2824 | res = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2825 | rev = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2826 | if subcommand in ("good", "bad", "skip", "reset"): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2827 | showBranches = subcommand == "reset" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2828 | showHead = subcommand == "reset" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2829 | dlg = GitRevisionSelectionDialog( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2830 | self.gitGetTagsList(repodir), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2831 | self.gitGetBranchesList(repodir), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2832 | showBranches=showBranches, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2833 | showHead=showHead, |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2834 | parent=self.__ui, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2835 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2836 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2837 | rev = dlg.getRevision() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2838 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2839 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2840 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2841 | args = self.initCommand("bisect") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2842 | if subcommand == "start_extended": |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2843 | dlg = GitBisectStartDialog(parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
2844 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2845 | bad, good, noCheckout = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2846 | args.append("start") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2847 | if noCheckout: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2848 | args.append("--no-checkout") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2849 | args.append(bad) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2850 | args.extend(good) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2851 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2852 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2853 | return False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2854 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2855 | args.append(subcommand) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2856 | if rev: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2857 | args.extend(rev.split()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2858 | # treat rev as a list separated by whitespace |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2859 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2860 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2861 | self.tr("Git Bisect ({0})").format(subcommand), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2862 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2863 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
2864 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2865 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2866 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
2867 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2868 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2869 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2870 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2871 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2872 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2873 | def gitBisectLogBrowser(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2874 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2875 | Public method used to browse the bisect log of the project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2876 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2877 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2878 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2879 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2880 | from .GitBisectLogBrowserDialog import GitBisectLogBrowserDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
2881 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2882 | if self.bisectlogBrowser is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2883 | self.bisectlogBrowser = GitBisectLogBrowserDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2884 | self.bisectlogBrowser.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2885 | self.bisectlogBrowser.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2886 | self.bisectlogBrowser.start(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2887 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2888 | def gitBisectCreateReplayFile(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2889 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2890 | Public method used to create a bisect replay file for the project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2891 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2892 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2893 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2894 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2895 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2896 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2897 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2898 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2899 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2900 | args = self.initCommand("bisect") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2901 | args.append("log") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2902 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2903 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2904 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2905 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2906 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2907 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2908 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2909 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2910 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2911 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2912 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2913 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2914 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2915 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2916 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2917 | EricMessageBox.critical( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2918 | self, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2919 | self.tr("Process Generation Error"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2920 | self.tr( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2921 | "The process {0} could not be started. " |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2922 | "Ensure, that it is in the search path." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2923 | ).format("git"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2924 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2925 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2926 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2927 | if output: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2928 | fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2929 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2930 | self.tr("Create Bisect Replay File"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2931 | self.__lastBundlePath or repodir, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2932 | self.tr("Git Bisect Replay Files (*.replay)"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2933 | None, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2934 | EricFileDialog.DontConfirmOverwrite, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2935 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2936 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2937 | if not fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2938 | return # user aborted |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2939 | |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2940 | fpath = pathlib.Path(fname) |
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2941 | if not fpath.suffix: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2942 | ex = selectedFilter.split("(*")[1].split(")")[0] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2943 | if ex: |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2944 | fpath = fpath.with_suffix(ex) |
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2945 | if fpath.exists(): |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2946 | res = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2947 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2948 | self.tr("Create Bisect Replay File"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2949 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2950 | "<p>The Git bisect replay file <b>{0}</b> " |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2951 | "already exists. Overwrite it?</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2952 | ).format(fpath), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2953 | icon=EricMessageBox.Warning, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2954 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2955 | if not res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2956 | return |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2957 | self.__lastReplayPath = str(fpath.parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2958 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2959 | try: |
9153
506e35e424d5
Finished replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9016
diff
changeset
|
2960 | with fpath.open("w") as f: |
7785
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
2961 | f.write(output) |
7836
2f0d208b8137
Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7785
diff
changeset
|
2962 | except OSError as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2963 | EricMessageBox.critical( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2964 | self.__ui, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2965 | self.tr("Create Bisect Replay File"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2966 | self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2967 | """<p>The file <b>{0}</b> could not be written.</p>""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2968 | """<p>Reason: {1}</p>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2969 | ).format(fpath, str(err)), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2970 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2971 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2972 | def gitBisectEditReplayFile(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2973 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2974 | Public method used to edit a bisect replay file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2975 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2976 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
2977 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2978 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2979 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2980 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2981 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
2982 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2983 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
2984 | fname = EricFileDialog.getOpenFileName( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2985 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2986 | self.tr("Edit Bisect Replay File"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2987 | self.__lastReplayPath or repodir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2988 | self.tr("Git Bisect Replay Files (*.replay);;All Files (*)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2989 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2990 | if fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2991 | self.__lastReplayPath = os.path.dirname(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2992 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2993 | self.bisectReplayEditor = MiniEditor(fname) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2994 | self.bisectReplayEditor.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2995 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2996 | def gitBisectReplay(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2997 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2998 | Public method to replay a bisect session. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
2999 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3000 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3001 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3002 | @return flag indicating, that the update contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3003 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3004 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3005 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3006 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3007 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3008 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3009 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3010 | res = False |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
3011 | fname = EricFileDialog.getOpenFileName( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3012 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3013 | self.tr("Bisect Replay"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3014 | self.__lastReplayPath or repodir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3015 | self.tr("Git Bisect Replay Files (*.replay);;All Files (*)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3016 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3017 | if fname: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3018 | self.__lastReplayPath = os.path.dirname(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3019 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3020 | args = self.initCommand("bisect") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3021 | args.append("replay") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3022 | args.append(fname) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3023 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3024 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3025 | self.tr("Git Bisect ({0})").format("replay"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3026 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3027 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3028 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3029 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3030 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3031 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3032 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3033 | self.checkVCSStatus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3034 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3035 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3036 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3037 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3038 | ## Methods for remotes handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3039 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3040 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3041 | def gitGetRemotesList(self, repodir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3042 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3043 | Public method to get the list of remote repos. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3044 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3045 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3046 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3047 | @return list of remote repos |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3048 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3049 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3050 | args = self.initCommand("remote") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3051 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3052 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3053 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3054 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3055 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3056 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3057 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3058 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3059 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3060 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3061 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3062 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3063 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3064 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3065 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3066 | remotesList = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3067 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3068 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3069 | name = line.strip() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3070 | remotesList.append(name) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3071 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3072 | return remotesList |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3073 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3074 | def gitGetRemoteUrlsList(self, repodir, forFetch=True): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3075 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3076 | Public method to get the list of remote repos and their URLs. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3077 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3078 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3079 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3080 | @param forFetch flag indicating to get Fetch info |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3081 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3082 | @return list of tuples of remote repo name and repo URL |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3083 | @rtype list of [(str, str)] |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3084 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3085 | args = self.initCommand("remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3086 | args.append("--verbose") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3087 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3088 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3089 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3090 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3091 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3092 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3093 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3094 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3095 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3096 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3097 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3098 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3099 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3100 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3101 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3102 | remotesList = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3103 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3104 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3105 | name, urlmode = line.strip().split(None, 1) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3106 | url, mode = urlmode.rsplit(None, 1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3107 | if (forFetch and mode == "(fetch)") or ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3108 | (not forFetch) and mode == "(push)" |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
3109 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3110 | remotesList.append((name, url)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3111 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3112 | return remotesList |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3113 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3114 | def gitGetRemoteUrl(self, repodir, remoteName): |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3115 | """ |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3116 | Public method to get the URL of a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3117 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3118 | @param repodir directory name of the repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3119 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3120 | @param remoteName name of the remote repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3121 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3122 | @return URL of the remote repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3123 | @rtype str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3124 | """ |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3125 | args = self.initCommand("remote") |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3126 | args.append("get-url") |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3127 | args.append(remoteName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3128 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3129 | output = "" |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3130 | process = QProcess() |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3131 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3132 | process.start("git", args) |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3133 | procStarted = process.waitForStarted(5000) |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3134 | if procStarted: |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3135 | finished = process.waitForFinished(30000) |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3136 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3137 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3138 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3139 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3140 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3141 | ).strip() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3142 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3143 | return output |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3144 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3145 | def gitGetRemoteBranchesList(self, repodir, remote): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3146 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3147 | Public method to get the list of a remote repository branches. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3148 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3149 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3150 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3151 | @param remote remote repository name |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3152 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3153 | @return list of remote repository branches |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3154 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3155 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3156 | args = self.initCommand("ls-remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3157 | args.append("--heads") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3158 | args.append(remote) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3159 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3160 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3161 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3162 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3163 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3164 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3165 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3166 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3167 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3168 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3169 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3170 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3171 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3172 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3173 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3174 | remoteBranches = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3175 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3176 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3177 | branch = line.strip().split()[-1].split("/")[-1] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3178 | remoteBranches.append(branch) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3179 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3180 | return remoteBranches |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3181 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3182 | def gitShowRemote(self, projectDir, remoteName): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3183 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3184 | Public method to show information about a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3185 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3186 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3187 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3188 | @param remoteName name of the remote repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3189 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3190 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3191 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3192 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3193 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3194 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3195 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3196 | args = self.initCommand("remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3197 | args.append("show") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3198 | args.append(remoteName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3199 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3200 | dia = GitDialog(self.tr("Show Remote Info"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3201 | res = dia.startProcess(args, repodir, showArgs=False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3202 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3203 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3204 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3205 | def gitShowRemotes(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3206 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3207 | Public method to show available remote repositories. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3208 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3209 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3210 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3211 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3212 | from .GitRemoteRepositoriesDialog import GitRemoteRepositoriesDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3213 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3214 | if self.remotesDialog is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3215 | self.remotesDialog = GitRemoteRepositoriesDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3216 | self.remotesDialog.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3217 | self.remotesDialog.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3218 | self.remotesDialog.start(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3219 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3220 | def gitAddRemote(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3221 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3222 | Public method to add a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3223 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3224 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3225 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3226 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3227 | from .GitAddRemoteDialog import GitAddRemoteDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3228 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3229 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3230 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3231 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3232 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3233 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3234 | dlg = GitAddRemoteDialog(parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
3235 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3236 | name, url = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3237 | args = self.initCommand("remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3238 | args.append("add") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3239 | args.append(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3240 | args.append(url) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3241 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3242 | self.startSynchronizedProcess(QProcess(), "git", args, workingDir=repodir) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3243 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3244 | def gitRenameRemote(self, projectDir, remoteName): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3245 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3246 | Public method to rename a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3247 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3248 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3249 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3250 | @param remoteName name of the remote repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3251 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3252 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3253 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3254 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3255 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3256 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3257 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3258 | newName, ok = QInputDialog.getText( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3259 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3260 | self.tr("Rename Remote Repository"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3261 | self.tr("Enter new name for remote repository:"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3262 | QLineEdit.EchoMode.Normal, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3263 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3264 | if ok and newName and newName != remoteName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3265 | args = self.initCommand("remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3266 | args.append("rename") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3267 | args.append(remoteName) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3268 | args.append(newName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3269 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3270 | self.startSynchronizedProcess(QProcess(), "git", args, workingDir=repodir) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3271 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3272 | def gitChangeRemoteUrl(self, projectDir, remoteName, remoteUrl=""): |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3273 | """ |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3274 | Public method to change the URL of a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3275 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3276 | @param projectDir name of the project directory |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3277 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3278 | @param remoteName name of the remote repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3279 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3280 | @param remoteUrl URL of the remote repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3281 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3282 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3283 | from .GitChangeRemoteUrlDialog import GitChangeRemoteUrlDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3284 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3285 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3286 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3287 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3288 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3289 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3290 | if not remoteUrl: |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3291 | remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3292 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3293 | dlg = GitChangeRemoteUrlDialog(remoteName, remoteUrl, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
3294 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3295 | name, url = dlg.getData() |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3296 | if url != remoteUrl: |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3297 | args = self.initCommand("remote") |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3298 | args.append("set-url") |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3299 | args.append(name) |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3300 | args.append(url) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3301 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3302 | self.startSynchronizedProcess( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3303 | QProcess(), "git", args, workingDir=repodir |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3304 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3305 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3306 | def gitChangeRemoteCredentials(self, projectDir, remoteName, remoteUrl=""): |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3307 | """ |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3308 | Public method to change the user credentials of a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3309 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3310 | @param projectDir name of the project directory |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3311 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3312 | @param remoteName name of the remote repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3313 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3314 | @param remoteUrl URL of the remote repository |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3315 | @type str |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3316 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3317 | from .GitRemoteCredentialsDialog import GitRemoteCredentialsDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3318 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3319 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3320 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3321 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3322 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3323 | |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3324 | if not remoteUrl: |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3325 | remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3326 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3327 | dlg = GitRemoteCredentialsDialog(remoteName, remoteUrl, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
3328 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6324
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3329 | name, url = dlg.getData() |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3330 | if url != remoteUrl: |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3331 | args = self.initCommand("remote") |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3332 | args.append("set-url") |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3333 | args.append(name) |
b11c36cba2a1
Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6303
diff
changeset
|
3334 | args.append(url) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3335 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3336 | self.startSynchronizedProcess( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3337 | QProcess(), "git", args, workingDir=repodir |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3338 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3339 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3340 | def gitRemoveRemote(self, projectDir, remoteName): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3341 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3342 | Public method to remove a remote repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3343 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3344 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3345 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3346 | @param remoteName name of the remote repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3347 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3348 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3349 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3350 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3351 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3352 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3353 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3354 | args = self.initCommand("remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3355 | args.append("remove") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3356 | args.append(remoteName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3357 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3358 | self.startSynchronizedProcess(QProcess(), "git", args, workingDir=repodir) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3359 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3360 | def gitPruneRemote(self, projectDir, remoteName): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3361 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3362 | Public method to prune stale remote-tracking branches. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3363 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3364 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3365 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3366 | @param remoteName name of the remote repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3367 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3368 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3369 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3370 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3371 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3372 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3373 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3374 | args = self.initCommand("remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3375 | args.append("prune") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3376 | args.append(remoteName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3377 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3378 | dia = GitDialog(self.tr("Show Remote Info"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3379 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3380 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3381 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3382 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3383 | def gitShortlog(self, projectDir, commit): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3384 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3385 | Public method to show a short log suitable for inclusion in release |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3386 | announcements. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3387 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3388 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3389 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3390 | @param commit commit to start the log at |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3391 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3392 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3393 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3394 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3395 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3396 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3397 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3398 | args = self.initCommand("shortlog") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3399 | args.append("-w") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3400 | args.append(commit) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3401 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3402 | dia = GitDialog(self.tr("Show Shortlog"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3403 | res = dia.startProcess(args, repodir, showArgs=False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3404 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3405 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3406 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3407 | def gitDescribe(self, projectDir, commits): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3408 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3409 | Public method to find the most recent tag reachable from each commit. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3410 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3411 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3412 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3413 | @param commits list of commits to start the search from |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3414 | @type list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3415 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3416 | from .GitDescribeDialog import GitDescribeDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3417 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3418 | if self.describeDialog is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3419 | self.describeDialog = GitDescribeDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3420 | self.describeDialog.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3421 | self.describeDialog.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3422 | self.describeDialog.start(projectDir, commits) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3423 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3424 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3425 | ## Methods for cherry-pick handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3426 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3427 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3428 | def gitCherryPick(self, projectDir, commits=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3429 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3430 | Public method to cherry pick commits and apply them to the current |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3431 | branch. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3432 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3433 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3434 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3435 | @param commits list of commits to be applied |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3436 | @type list of str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3437 | @return flag indicating that the project should be reread |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3438 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3439 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3440 | from .GitCherryPickDialog import GitCherryPickDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3441 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3442 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3443 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3444 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3445 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3446 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3447 | res = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3448 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3449 | dlg = GitCherryPickDialog(commits, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
3450 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3451 | commits, cherrypickInfo, signoff, nocommit = dlg.getData() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3452 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3453 | args = self.initCommand("cherry-pick") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3454 | args.append("-Xpatience") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3455 | if cherrypickInfo: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3456 | args.append("-x") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3457 | if signoff: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3458 | args.append("--signoff") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3459 | if nocommit: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3460 | args.append("--no-commit") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3461 | args.extend(commits) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3462 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3463 | dia = GitDialog(self.tr("Cherry-pick"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3464 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3465 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3466 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3467 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3468 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3469 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3470 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3471 | def gitCherryPickContinue(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3472 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3473 | Public method to continue the last copying session after conflicts |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3474 | were resolved. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3475 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3476 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3477 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3478 | @return flag indicating that the project should be reread |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3479 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3480 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3481 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3482 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3483 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3484 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3485 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3486 | editor = sys.argv[0].replace(".py", "_editor.py") |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
3487 | env = { |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
3488 | "GIT_EDITOR": "{0} {1}".format( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
3489 | PythonUtilities.getPythonExecutable(), editor |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
3490 | ) |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
3491 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3492 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3493 | args = self.initCommand("cherry-pick") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3494 | args.append("--continue") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3495 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3496 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3497 | self.tr("Copy Changesets (Continue)"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3498 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3499 | res = dia.startProcess(args, repodir, environment=env) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3500 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3501 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3502 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3503 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3504 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3505 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3506 | def gitCherryPickQuit(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3507 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3508 | Public method to quit the current copying operation. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3509 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3510 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3511 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3512 | @return flag indicating that the project should be reread |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3513 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3514 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3515 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3516 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3517 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3518 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3519 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3520 | args = self.initCommand("cherry-pick") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3521 | args.append("--quit") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3522 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3523 | dia = GitDialog(self.tr("Copy Changesets (Quit)"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3524 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3525 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3526 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3527 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3528 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3529 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3530 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3531 | def gitCherryPickAbort(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3532 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3533 | Public method to cancel the last copying session and return to |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3534 | the previous state. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3535 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3536 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3537 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3538 | @return flag indicating that the project should be reread |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3539 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3540 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3541 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3542 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3543 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3544 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3545 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3546 | args = self.initCommand("cherry-pick") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3547 | args.append("--abort") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3548 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3549 | dia = GitDialog(self.tr("Copy Changesets (Cancel)"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3550 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3551 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3552 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3553 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3554 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3555 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3556 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3557 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3558 | ## Methods for stash handling. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3559 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3560 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3561 | def __gitGetStashesList(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3562 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3563 | Private method to get a list of stash names. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3564 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3565 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3566 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3567 | @return list of available stashes |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3568 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3569 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3570 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3571 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3572 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3573 | return [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3574 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3575 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3576 | args.append("list") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3577 | args.append("--format=format:%gd") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3578 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3579 | stashesList = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3580 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3581 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3582 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3583 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3584 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3585 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3586 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3587 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3588 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3589 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3590 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3591 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3592 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3593 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3594 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3595 | stashesList = output.strip().splitlines() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3596 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3597 | return stashesList |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3598 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3599 | def gitStashSave(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3600 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3601 | Public method to save the current changes to a new stash. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3602 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3603 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3604 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3605 | @return flag indicating, that the save contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3606 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3607 | """ |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
3608 | from .GitStashDataDialog import GitStashDataDialog, GitStashKind |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3609 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3610 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3611 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3612 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3613 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3614 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3615 | res = False |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3616 | dlg = GitStashDataDialog(parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
3617 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3618 | message, keepIndex, untracked = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3619 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3620 | args.append("save") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3621 | if keepIndex: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3622 | args.append("--keep-index") |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
3623 | if untracked == GitStashKind.UntrackedOnly: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3624 | args.append("--include-untracked") |
10489
1800956305ca
Changed some state/mode/type definitions to an enum.Enum class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
3625 | elif untracked == GitStashKind.UntrackedAndIgnored: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3626 | args.append("--all") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3627 | if message: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3628 | args.append(message) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3629 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3630 | dia = GitDialog(self.tr("Saving stash"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3631 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3632 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3633 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3634 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3635 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3636 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3637 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3638 | def gitStashBrowser(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3639 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3640 | Public method used to browse the stashed changes. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3641 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3642 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3643 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3644 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3645 | from .GitStashBrowserDialog import GitStashBrowserDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3646 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3647 | if self.stashBrowser is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3648 | self.stashBrowser = GitStashBrowserDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3649 | self.stashBrowser.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3650 | self.stashBrowser.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3651 | self.stashBrowser.start(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3652 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3653 | def gitStashShowPatch(self, projectDir, stashName=""): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3654 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3655 | Public method to show the contents of a stash. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3656 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3657 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3658 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3659 | @param stashName name of a stash |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3660 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3661 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3662 | from .GitDiffDialog import GitDiffDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3663 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3664 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3665 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3666 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3667 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3668 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3669 | if not stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3670 | availableStashes = self.__gitGetStashesList(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3671 | stashName, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3672 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3673 | self.tr("Show Stash"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3674 | self.tr("Select a stash (empty for latest stash):"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3675 | [""] + availableStashes, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3676 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3677 | False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3678 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3679 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3680 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3681 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3682 | if self.diff is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3683 | self.diff = GitDiffDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3684 | self.diff.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3685 | self.diff.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3686 | self.diff.start(repodir, diffMode="stash", stashName=stashName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3687 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3688 | def gitStashApply(self, projectDir, stashName=""): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3689 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3690 | Public method to apply a stash but keep it. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3691 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3692 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3693 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3694 | @param stashName name of a stash |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3695 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3696 | @return flag indicating, that the restore contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3697 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3698 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3699 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3700 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3701 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3702 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3703 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3704 | if not stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3705 | availableStashes = self.__gitGetStashesList(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3706 | stashName, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3707 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3708 | self.tr("Restore Stash"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3709 | self.tr("Select a stash (empty for latest stash):"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3710 | [""] + availableStashes, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3711 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3712 | False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3713 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3714 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3715 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3716 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3717 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3718 | args.append("apply") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3719 | if stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3720 | args.append(stashName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3721 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3722 | dia = GitDialog(self.tr("Restoring stash"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3723 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3724 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3725 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3726 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3727 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3728 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3729 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3730 | def gitStashPop(self, projectDir, stashName=""): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3731 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3732 | Public method to apply a stash and delete it. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3733 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3734 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3735 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3736 | @param stashName name of a stash |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3737 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3738 | @return flag indicating, that the restore contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3739 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3740 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3741 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3742 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3743 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3744 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3745 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3746 | if not stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3747 | availableStashes = self.__gitGetStashesList(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3748 | stashName, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3749 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3750 | self.tr("Restore Stash"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3751 | self.tr("Select a stash (empty for latest stash):"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3752 | [""] + availableStashes, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3753 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3754 | False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3755 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3756 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3757 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3758 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3759 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3760 | args.append("pop") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3761 | if stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3762 | args.append(stashName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3763 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3764 | dia = GitDialog(self.tr("Restoring stash"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3765 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3766 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3767 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3768 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3769 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3770 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3771 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3772 | def gitStashBranch(self, projectDir, stashName=""): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3773 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3774 | Public method to create a branch from a stash. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3775 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3776 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3777 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3778 | @param stashName name of a stash |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3779 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3780 | @return flag indicating, that the restore contained an add or delete |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3781 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3782 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3783 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3784 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3785 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3786 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3787 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3788 | branchName, ok = QInputDialog.getText( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3789 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3790 | self.tr("Create Branch"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3791 | self.tr("Enter a branch name to restore a stash to:"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3792 | QLineEdit.EchoMode.Normal, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3793 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3794 | if not ok or branchName == "": |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3795 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3796 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3797 | if not stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3798 | availableStashes = self.__gitGetStashesList(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3799 | stashName, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3800 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3801 | self.tr("Create Branch"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3802 | self.tr("Select a stash (empty for latest stash):"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3803 | [""] + availableStashes, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3804 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3805 | False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3806 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3807 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3808 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3809 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3810 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3811 | args.append("branch") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3812 | args.append(branchName) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3813 | if stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3814 | args.append(stashName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3815 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3816 | dia = GitDialog(self.tr("Creating branch"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3817 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3818 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3819 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3820 | res = dia.hasAddOrDelete() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3821 | self.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3822 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3823 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3824 | def gitStashDrop(self, projectDir, stashName=""): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3825 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3826 | Public method to delete a stash. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3827 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3828 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3829 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3830 | @param stashName name of a stash |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3831 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3832 | @return flag indicating a successful deletion |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3833 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3834 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3835 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3836 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3837 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3838 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3839 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3840 | if not stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3841 | availableStashes = self.__gitGetStashesList(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3842 | stashName, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3843 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3844 | self.tr("Show Stash"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3845 | self.tr("Select a stash (empty for latest stash):"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3846 | [""] + availableStashes, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3847 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3848 | False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3849 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3850 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3851 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3852 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
3853 | res = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3854 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3855 | self.tr("Delete Stash"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3856 | self.tr("""Do you really want to delete the stash <b>{0}</b>?""").format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3857 | stashName |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3858 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3859 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3860 | if res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3861 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3862 | args.append("drop") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3863 | if stashName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3864 | args.append(stashName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3865 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3866 | dia = GitDialog(self.tr("Deleting stash"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3867 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3868 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3869 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3870 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3871 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3872 | def gitStashClear(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3873 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3874 | Public method to delete all stashes. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3875 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3876 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3877 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3878 | @return flag indicating a successful deletion |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3879 | @rtype bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3880 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3881 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3882 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3883 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3884 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3885 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
3886 | res = EricMessageBox.yesNo( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3887 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3888 | self.tr("Delete All Stashes"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3889 | self.tr("""Do you really want to delete all stashes?"""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3890 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3891 | if res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3892 | args = self.initCommand("stash") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3893 | args.append("clear") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3894 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3895 | dia = GitDialog(self.tr("Deleting all stashes"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3896 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3897 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3898 | dia.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3899 | return res |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3900 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3901 | def gitEditConfig(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3902 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3903 | Public method used to edit the repository configuration file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3904 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3905 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3906 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3907 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3908 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3909 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3910 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3911 | return |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3912 | |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3913 | cfgFile = os.path.join(repodir, self.adminDirOrFile, "config") |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3914 | if not os.path.exists(cfgFile): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3915 | # create an empty one |
8240
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8234
diff
changeset
|
3916 | with contextlib.suppress(OSError), open(cfgFile, "w"): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3917 | pass |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3918 | self.repoEditor = MiniEditor(cfgFile, "Properties") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3919 | self.repoEditor.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3920 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3921 | def gitEditUserConfig(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3922 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3923 | Public method used to edit the user configuration file. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3924 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3925 | from .GitUserConfigDataDialog import GitUserConfigDataDialog |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3926 | from .GitUtilities import getConfigPath |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3927 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3928 | cfgFile = getConfigPath() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3929 | if not os.path.exists(cfgFile): |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3930 | dlg = GitUserConfigDataDialog(parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
3931 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3932 | firstName, lastName, email = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3933 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3934 | firstName, lastName, email = ("Firstname", "Lastname", "email_address") |
8240
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8234
diff
changeset
|
3935 | with contextlib.suppress(OSError), open(cfgFile, "w") as f: |
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8234
diff
changeset
|
3936 | f.write("[user]\n") |
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8234
diff
changeset
|
3937 | f.write(" name = {0} {1}\n".format(firstName, lastName)) |
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8234
diff
changeset
|
3938 | f.write(" email = {0}\n".format(email)) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3939 | self.userEditor = MiniEditor(cfgFile, "Properties") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3940 | self.userEditor.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3941 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3942 | def gitShowConfig(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3943 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3944 | Public method to show the combined configuration. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3945 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3946 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3947 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3948 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3949 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3950 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3951 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3952 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3953 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3954 | args = self.initCommand("config") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3955 | args.append("--list") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3956 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3957 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3958 | self.tr("Showing the combined configuration settings"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3959 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3960 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3961 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3962 | res = dia.startProcess(args, repodir, False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3963 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3964 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3965 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3966 | def gitVerify(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3967 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3968 | Public method to verify the connectivity and validity of objects |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3969 | of the database. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3970 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3971 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3972 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3973 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3974 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3975 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3976 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
3977 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3978 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3979 | args = self.initCommand("fsck") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3980 | args.append("--strict") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3981 | args.append("--full") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3982 | args.append("--cache") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3983 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3984 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3985 | self.tr("Verifying the integrity of the Git repository"), |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3986 | git=self, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3987 | parent=self.__ui, |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
3988 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3989 | res = dia.startProcess(args, repodir, False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3990 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
3991 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3992 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3993 | def gitHouseKeeping(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3994 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3995 | Public method to cleanup and optimize the local repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
3996 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3997 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
3998 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3999 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4000 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4001 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4002 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4003 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4004 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4005 | args = self.initCommand("gc") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4006 | args.append("--prune") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4007 | if self.__plugin.getPreferences("AggressiveGC"): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4008 | args.append("--aggressive") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4009 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4010 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4011 | self.tr("Performing Repository Housekeeping"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4012 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4013 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4014 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4015 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4016 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4017 | def gitStatistics(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4018 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4019 | Public method to show some statistics of the local repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4020 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4021 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4022 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4023 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4024 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4025 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4026 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4027 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4028 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4029 | args = self.initCommand("count-objects") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4030 | args.append("-v") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4031 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4032 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4033 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4034 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4035 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4036 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4037 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4038 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4039 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4040 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4041 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4042 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4043 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4044 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4045 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4046 | info = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4047 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4048 | statistics = {} |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4049 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4050 | key, value = line.strip().split(": ", 1) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4051 | statistics[key] = value |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4052 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4053 | info.append("""<p><table>""") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4054 | info.append(self.tr("""<tr><td><b>Statistics</b></td></tr>""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4055 | info.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4056 | self.tr( |
9573
9960d19d66b5
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9482
diff
changeset
|
4057 | """<tr><td>Number of loose objects: </td><td>{0}</td></tr>""" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4058 | ).format(statistics["count"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4059 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4060 | info.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4061 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4062 | """<tr><td>Disk space used by loose objects: </td>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4063 | """<td>{0} KiB</td></tr>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4064 | ).format(statistics["size"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4065 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4066 | info.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4067 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4068 | """<tr><td>Number of packed objects: </td>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4069 | """<td>{0}</td></tr>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4070 | ).format(statistics["in-pack"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4071 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4072 | info.append( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
4073 | self.tr("""<tr><td>Number of packs: </td><td>{0}</td></tr>""").format( |
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
4074 | statistics["packs"] |
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
4075 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4076 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4077 | info.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4078 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4079 | """<tr><td>Disk space used by packed objects: </td>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4080 | """<td>{0} KiB</td></tr>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4081 | ).format(statistics["size-pack"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4082 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4083 | info.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4084 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4085 | """<tr><td>Packed objects waiting for pruning: </td>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4086 | """<td>{0}</td></tr>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4087 | ).format(statistics["prune-packable"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4088 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4089 | info.append( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
4090 | self.tr("""<tr><td>Garbage files: </td><td>{0}</td></tr>""").format( |
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
4091 | statistics["garbage"] |
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9573
diff
changeset
|
4092 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4093 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4094 | info.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4095 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4096 | """<tr><td>Disk space used by garbage files: </td>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4097 | """<td>{0} KiB</td></tr>""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4098 | ).format(statistics["size-garbage"]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4099 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4100 | info.append("""</table></p>""") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4101 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4102 | info.append(self.tr("<p><b>No statistics available.</b></p>")) |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4103 | dlg = VcsRepositoryInfoDialog(self.__ui, "\n".join(info)) |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4104 | dlg.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4105 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4106 | def gitGetArchiveFormats(self, repodir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4107 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4108 | Public method to get a list of supported archive formats. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4109 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4110 | @param repodir directory name of the repository |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4111 | @type str |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4112 | @return list of supported archive formats |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4113 | @rtype list of str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4114 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4115 | args = self.initCommand("archive") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4116 | args.append("--list") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4117 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4118 | output = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4119 | process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4120 | process.setWorkingDirectory(repodir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4121 | process.start("git", args) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4122 | procStarted = process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4123 | if procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4124 | finished = process.waitForFinished(30000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4125 | if finished and process.exitCode() == 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4126 | output = str( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4127 | process.readAllStandardOutput(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4128 | Preferences.getSystem("IOEncoding"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4129 | "replace", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4130 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4131 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4132 | archiveFormats = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4133 | if output: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4134 | for line in output.splitlines(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4135 | archiveFormat = line.strip() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4136 | archiveFormats.append(archiveFormat) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4137 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4138 | return archiveFormats |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4139 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4140 | def gitCreateArchive(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4141 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4142 | Public method to show some statistics of the local repository. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4143 | |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4144 | @param projectDir name of the project directory |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4145 | @type str |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4146 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4147 | from .GitArchiveDataDialog import GitArchiveDataDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4148 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4149 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4150 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4151 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4152 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4153 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4154 | dlg = GitArchiveDataDialog( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4155 | self.gitGetTagsList(repodir), |
9971
773ad1f1ed22
Performed some 'ethical' changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9734
diff
changeset
|
4156 | self.gitGetBranchesList(repodir), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4157 | self.gitGetArchiveFormats(repodir), |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4158 | parent=self.__ui, |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4159 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4160 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4161 | commit, archiveFormat, fileName, prefix = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4162 | args = self.initCommand("archive") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4163 | args.append("--format={0}".format(archiveFormat)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4164 | args.append("--output={0}".format(fileName)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4165 | if prefix: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9620
diff
changeset
|
4166 | prefix = FileSystemUtilities.fromNativeSeparators(prefix) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4167 | if not prefix.endswith("/"): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4168 | prefix += "/" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4169 | args.append("--prefix={0}".format(prefix)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4170 | args.append(commit) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4171 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4172 | dia = GitDialog(self.tr("Creating Archive"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4173 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4174 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4175 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4176 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4177 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4178 | ## Methods related to submodules. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4179 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4180 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4181 | def gitSubmoduleAdd(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4182 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4183 | Public method to add a submodule to the project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4184 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4185 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4186 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4187 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4188 | from .GitSubmoduleAddDialog import GitSubmoduleAddDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4189 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4190 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4191 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4192 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4193 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4194 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4195 | dlg = GitSubmoduleAddDialog(self, repodir, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4196 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4197 | repo, branch, name, path, force = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4198 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4199 | args.append("add") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4200 | if branch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4201 | args.append("--branch") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4202 | args.append(branch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4203 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4204 | args.append("--force") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4205 | if name: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4206 | args.append("--name") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4207 | args.append(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4208 | args.append(repo) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4209 | if path: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4210 | args.append(path) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4211 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4212 | dia = GitDialog(self.tr("Add Submodule"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4213 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4214 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4215 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4216 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4217 | def __gitSubmodulesList(self, repodir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4218 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4219 | Private method to get the data of defined submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4220 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4221 | @param repodir name of the directory containing the repo subdirectory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4222 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4223 | @return list of dictionaries with submodule name, path, URL and branch |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4224 | @rtype list of dict |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4225 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4226 | submodulesFile = os.path.join(repodir, ".gitmodules") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4227 | if not os.path.exists(submodulesFile): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4228 | return [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4229 | |
6078
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4230 | try: |
7785
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
4231 | with open(submodulesFile, "r") as modulesFile: |
9978016560ec
Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
4232 | contents = modulesFile.readlines() |
6078
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4233 | except OSError: |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4234 | # silently ignore them |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4235 | return [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4236 | |
6078
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4237 | submodules = [] |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4238 | submoduleDict = None |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4239 | for line in contents: |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4240 | line = line.strip() |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4241 | if line.startswith("[submodule"): |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4242 | if submoduleDict: |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4243 | if "branch" not in submoduleDict: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4244 | submoduleDict["branch"] = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4245 | submodules.append(submoduleDict) |
6078
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4246 | submoduleDict = {"name": line.split(None, 1)[1][1:-2]} |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4247 | elif "=" in line: |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4248 | option, value = line.split("=", 1) |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4249 | submoduleDict[option.strip()] = value.strip() |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4250 | if submoduleDict: |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4251 | if "branch" not in submoduleDict: |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4252 | submoduleDict["branch"] = "" |
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4253 | submodules.append(submoduleDict) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4254 | |
6078
bbdc284c1bfc
Changed the code reading a GIT submodules file because Python2 config parser cannot handle option = value lines starting with whitespace.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
4255 | return submodules |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4256 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4257 | def gitSubmoduleList(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4258 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4259 | Public method to show a list of all submodules of the project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4260 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4261 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4262 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4263 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4264 | from .GitSubmodulesListDialog import GitSubmodulesListDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4265 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4266 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4267 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4268 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4269 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4270 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4271 | submodulesList = self.__gitSubmodulesList(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4272 | if submodulesList: |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4273 | dlg = GitSubmodulesListDialog(submodulesList, parent=self.__ui) |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4274 | dlg.exec() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4275 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
4276 | EricMessageBox.information( |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4277 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4278 | self.tr("List Submodules"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4279 | self.tr("""No submodules defined for the project."""), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4280 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4281 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4282 | def __selectSubmodulePath(self, repodir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4283 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4284 | Private method to select a submodule path. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4285 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4286 | @param repodir name of the directory containing the repo subdirectory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4287 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4288 | @return tuple of selected submodule path and flag indicating |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4289 | a cancellation |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4290 | @rtype tuple of (str, bool) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4291 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4292 | allEntry = self.tr("All") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4293 | paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4294 | submodulePath, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4295 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4296 | self.tr("Submodule Path"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4297 | self.tr("Select a submodule path:"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4298 | [allEntry] + sorted(paths), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4299 | 0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4300 | False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4301 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4302 | if submodulePath == allEntry: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4303 | submodulePath = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4304 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4305 | return submodulePath, ok |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4306 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4307 | def __selectSubmodulePaths(self, repodir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4308 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4309 | Private method to select a list of submodule paths. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4310 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4311 | @param repodir name of the directory containing the repo subdirectory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4312 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4313 | @return tuple of selected submodule paths and flag indicating |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4314 | a cancellation |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4315 | @rtype tuple of (list of str, bool) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4316 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4317 | from .GitListDialog import GitListDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4318 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4319 | paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4320 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4321 | dlg = GitListDialog(sorted(paths), parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4322 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4323 | selectedPaths = dlg.getSelection() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4324 | return selectedPaths, True |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4325 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4326 | return [], False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4327 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4328 | def gitSubmoduleInit(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4329 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4330 | Public method to initialize one or all submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4331 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4332 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4333 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4334 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4335 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4336 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4337 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4338 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4339 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4340 | submodulePaths, ok = self.__selectSubmodulePaths(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4341 | if ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4342 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4343 | args.append("init") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4344 | args.extend(submodulePaths) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4345 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4346 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4347 | self.tr("Initialize Submodules"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4348 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4349 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4350 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4351 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4352 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4353 | def gitSubmoduleDeinit(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4354 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4355 | Public method to unregister submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4356 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4357 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4358 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4359 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4360 | from .GitSubmodulesDeinitDialog import GitSubmodulesDeinitDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4361 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4362 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4363 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4364 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4365 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4366 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4367 | paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4368 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4369 | dlg = GitSubmodulesDeinitDialog(paths, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4370 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6026
4773c9469880
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6020
diff
changeset
|
4371 | deinitAll, submodulePaths, force = dlg.getData() |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4372 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4373 | args.append("deinit") |
6026
4773c9469880
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6020
diff
changeset
|
4374 | if deinitAll: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4375 | args.append("--all") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4376 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4377 | args.extend(submodulePaths) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4378 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4379 | args.append("--force") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4380 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4381 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4382 | self.tr("Unregister Submodules"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4383 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4384 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4385 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4386 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4387 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4388 | def gitSubmoduleUpdate(self, projectDir, initialize=False, remote=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4389 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4390 | Public method to update submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4391 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4392 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4393 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4394 | @param initialize flag indicating an initialize and update operation |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4395 | @type bool |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4396 | @param remote flag indicating a fetch and update operation |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4397 | @type bool |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4398 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4399 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4400 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4401 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4402 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4403 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4404 | submodulePaths, ok = self.__selectSubmodulePaths(repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4405 | if ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4406 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4407 | args.append("update") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4408 | if initialize: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4409 | args.append("--init") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4410 | if remote: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4411 | args.append("--remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4412 | args.extend(submodulePaths) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4413 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4414 | dia = GitDialog(self.tr("Update Submodules"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4415 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4416 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4417 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4418 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4419 | def gitSubmoduleUpdateWithOptions(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4420 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4421 | Public method to update submodules offering a dialog to select the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4422 | update options. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4423 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4424 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4425 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4426 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4427 | from .GitSubmodulesUpdateOptionsDialog import GitSubmodulesUpdateOptionsDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4428 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4429 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4430 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4431 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4432 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4433 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4434 | paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4435 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4436 | dlg = GitSubmodulesUpdateOptionsDialog(paths, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4437 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4438 | procedure, init, remote, noFetch, force, submodulePaths = dlg.getData() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4439 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4440 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4441 | args.append("update") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4442 | args.append(procedure) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4443 | if init: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4444 | args.append("--init") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4445 | if remote: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4446 | args.append("--remote") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4447 | if noFetch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4448 | args.append("--no-fetch") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4449 | if force: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4450 | args.append("--force") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4451 | args.extend(submodulePaths) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4452 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4453 | dia = GitDialog(self.tr("Update Submodules"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4454 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4455 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4456 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4457 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4458 | def gitSubmoduleSync(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4459 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4460 | Public method to synchronize submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4461 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4462 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4463 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4464 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4465 | from .GitSubmodulesSyncDialog import GitSubmodulesSyncDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4466 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4467 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4468 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4469 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4470 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4471 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4472 | paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4473 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4474 | dlg = GitSubmodulesSyncDialog(paths, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4475 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4476 | submodulePaths, recursive = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4477 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4478 | args.append("sync") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4479 | if recursive: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4480 | args.append("--recursive") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4481 | args.extend(submodulePaths) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4482 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4483 | dia = GitDialog( |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4484 | self.tr("Synchronize Submodules"), git=self, parent=self.__ui |
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4485 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4486 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4487 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4488 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4489 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4490 | def gitSubmoduleStatus(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4491 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4492 | Public method to show the status of the submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4493 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4494 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4495 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4496 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4497 | from .GitSubmodulesStatusDialog import GitSubmodulesStatusDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4498 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4499 | if self.submoduleStatusDialog is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4500 | self.submoduleStatusDialog = GitSubmodulesStatusDialog(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4501 | self.submoduleStatusDialog.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4502 | self.submoduleStatusDialog.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4503 | self.submoduleStatusDialog.start(projectDir) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4504 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4505 | def gitSubmoduleSummary(self, projectDir): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4506 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4507 | Public method to show the status of the submodules. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4508 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4509 | @param projectDir name of the project directory |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4510 | @type str |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4511 | """ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4512 | from .GitSubmodulesSummaryOptionsDialog import GitSubmodulesSummaryOptionsDialog |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
4513 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4514 | # find the root of the repo |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4515 | repodir = self.findRepoRoot(projectDir) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4516 | if not repodir: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4517 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4518 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4519 | paths = [submodule["path"] for submodule in self.__gitSubmodulesList(repodir)] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4520 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4521 | dlg = GitSubmodulesSummaryOptionsDialog(paths, parent=self.__ui) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
4522 | if dlg.exec() == QDialog.DialogCode.Accepted: |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4523 | submodulePaths, superProject, index, commit, limit = dlg.getData() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4524 | args = self.initCommand("submodule") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4525 | args.append("summary") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4526 | if superProject: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4527 | args.append("--files") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4528 | if index: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4529 | args.append("--cached") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4530 | if limit > -1: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4531 | args.append("--summary-limit") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4532 | args.append(str(limit)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4533 | if commit: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4534 | args.append(commit) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4535 | if submodulePaths: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4536 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4537 | args.extend(submodulePaths) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4538 | |
11006
a671918232f3
Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10690
diff
changeset
|
4539 | dia = GitDialog(self.tr("Submodules Summary"), git=self, parent=self.__ui) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4540 | res = dia.startProcess(args, repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4541 | if res: |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
4542 | dia.exec() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4543 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4544 | ########################################################################### |
9620
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4545 | ## Methods for worktree management are below.. |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4546 | ########################################################################### |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4547 | |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4548 | def gitWorktreeManagement(self, projectDir): |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4549 | """ |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4550 | Public method to show the worktree list/management dialog. |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4551 | |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4552 | @param projectDir name of the project directory |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4553 | @type str |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4554 | """ |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4555 | from .GitWorktreeDialog import GitWorktreeDialog |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4556 | |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4557 | if self.worktreeDialog is None: |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4558 | self.worktreeDialog = GitWorktreeDialog(self) |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4559 | self.worktreeDialog.show() |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4560 | self.worktreeDialog.raise_() |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4561 | self.worktreeDialog.start(projectDir) |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4562 | |
9563c83ce83d
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9617
diff
changeset
|
4563 | ########################################################################### |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4564 | ## Methods to get the helper objects are below. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4565 | ########################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4566 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4567 | def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser=False): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4568 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4569 | Public method to instantiate a helper object for the different |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4570 | project browsers. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4571 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4572 | @param browser reference to the project browser object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4573 | @type ProjectBaseBrowser |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4574 | @param project reference to the project object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4575 | @type Project |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4576 | @param isTranslationsBrowser flag indicating, the helper is requested |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4577 | for the translations browser (this needs some special treatment) |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4578 | @type bool |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4579 | @return the project browser helper object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4580 | @rtype GitProjectBrowserHelper |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4581 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4582 | from .ProjectBrowserHelper import GitProjectBrowserHelper |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4583 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4584 | return GitProjectBrowserHelper(self, browser, project, isTranslationsBrowser) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4585 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4586 | def vcsGetProjectHelper(self, project): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4587 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4588 | Public method to instantiate a helper object for the project. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4589 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4590 | @param project reference to the project object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4591 | @type Project |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4592 | @return the project helper object |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4593 | @rtype GitProjectHelper |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4594 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4595 | self.__projectHelper = self.__plugin.getProjectHelper() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4596 | self.__projectHelper.setObjects(self, project) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4597 | return self.__projectHelper |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4598 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4599 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4600 | ## Status Monitor Thread methods |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4601 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4602 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4603 | def _createStatusMonitorThread(self, interval, project): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4604 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4605 | Protected method to create an instance of the VCS status monitor |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4606 | thread. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4607 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4608 | @param interval check interval for the monitor thread in seconds |
10438
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4609 | @type int |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4610 | @param project reference to the project object |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4611 | @type Project |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4612 | @return reference to the monitor thread |
4cd7e5a8b3cf
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10403
diff
changeset
|
4613 | @rtype GitStatusMonitorThread |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4614 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4615 | from .GitStatusMonitorThread import GitStatusMonitorThread |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
4616 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4617 | return GitStatusMonitorThread(interval, project, self) |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4618 | |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4619 | ########################################################################### |
9636
926cb5408961
Added a guard against non-existent Git admin dir or file when searching for the repository root.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
4620 | ## Method to find the repository root |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4621 | ########################################################################### |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4622 | |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4623 | def findRepoRoot(self, start): |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4624 | """ |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4625 | Public method to find the repository root directory given a start. |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4626 | |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4627 | @param start start directory name |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4628 | @type str |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4629 | @return directory name of the repository root or None, if it was not found |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4630 | @rtype str or None |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4631 | """ |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4632 | repoRoot = start |
9636
926cb5408961
Added a guard against non-existent Git admin dir or file when searching for the repository root.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
4633 | while repoRoot and not os.path.exists( |
926cb5408961
Added a guard against non-existent Git admin dir or file when searching for the repository root.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
4634 | os.path.join(repoRoot, self.adminDirOrFile) |
926cb5408961
Added a guard against non-existent Git admin dir or file when searching for the repository root.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
4635 | ): |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4636 | repoRoot = os.path.dirname(repoRoot) |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4637 | if os.path.splitdrive(repoRoot)[1] == os.sep: |
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4638 | repoRoot = None |
9636
926cb5408961
Added a guard against non-existent Git admin dir or file when searching for the repository root.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
4639 | break |
926cb5408961
Added a guard against non-existent Git admin dir or file when searching for the repository root.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9624
diff
changeset
|
4640 | |
9616
13aa04c979d7
Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9576
diff
changeset
|
4641 | return repoRoot |