src/eric7/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py

branch
eric7
changeset 10438
4cd7e5a8b3cf
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10437:2f70ca07f0af 10438:4cd7e5a8b3cf
34 def __init__(self, vcs, parent=None): 34 def __init__(self, vcs, parent=None):
35 """ 35 """
36 Constructor 36 Constructor
37 37
38 @param vcs reference to the vcs object 38 @param vcs reference to the vcs object
39 @param parent parent widget (QWidget) 39 @type Git
40 @param parent parent widget
41 @type QWidget
40 """ 42 """
41 super().__init__(parent) 43 super().__init__(parent)
42 self.setupUi(self) 44 self.setupUi(self)
43 45
44 self.refreshButton = self.buttonBox.addButton( 46 self.refreshButton = self.buttonBox.addButton(
92 94
93 def closeEvent(self, e): 95 def closeEvent(self, e):
94 """ 96 """
95 Protected slot implementing a close event handler. 97 Protected slot implementing a close event handler.
96 98
97 @param e close event (QCloseEvent) 99 @param e close event
100 @type QCloseEvent
98 """ 101 """
99 self.__diffGenerator.stopProcesses() 102 self.__diffGenerator.stopProcesses()
100 e.accept() 103 e.accept()
101 104
102 def start( 105 def start(
103 self, fn, versions=None, diffMode="work2repo", stashName="", refreshable=False 106 self, fn, versions=None, diffMode="work2repo", stashName="", refreshable=False
104 ): 107 ):
105 """ 108 """
106 Public slot to start the git diff command. 109 Public slot to start the git diff command.
107 110
108 @param fn filename to be diffed (string) 111 @param fn filename to be diffed
109 @param versions list of versions to be diffed (list of up to 2 strings 112 @type str
110 or None) 113 @param versions list of versions to be diffed
114 @type list of up to 2 str or None
111 @param diffMode indication for the type of diff to be performed ( 115 @param diffMode indication for the type of diff to be performed (
112 'work2repo' compares the working tree with the HEAD commit, 116 'work2repo' compares the working tree with the HEAD commit,
113 'work2stage' compares the working tree with the staging area, 117 'work2stage' compares the working tree with the staging area,
114 'stage2repo' compares the staging area with the HEAD commit, 118 'stage2repo' compares the staging area with the HEAD commit,
115 'work2stage2repo' compares the working tree with the staging area 119 'work2stage2repo' compares the working tree with the staging area
116 and the staging area with the HEAD commit, 120 and the staging area with the HEAD commit,
117 'stash' shows the diff for a stash) 121 'stash' shows the diff for a stash)
118 @param stashName name of the stash to show a diff for (string) 122 @type str
119 @param refreshable flag indicating a refreshable diff (boolean) 123 @param stashName name of the stash to show a diff for
124 @type str
125 @param refreshable flag indicating a refreshable diff
126 @type bool
120 @exception ValueError raised to indicate a bad value for the 'diffMode' 127 @exception ValueError raised to indicate a bad value for the 'diffMode'
121 parameter. 128 parameter.
122 """ 129 """
123 if diffMode not in [ 130 if diffMode not in [
124 "work2repo", 131 "work2repo",
228 def __mergeFileSeparators(self, fileSeparators): 235 def __mergeFileSeparators(self, fileSeparators):
229 """ 236 """
230 Private method to merge the file separator entries. 237 Private method to merge the file separator entries.
231 238
232 @param fileSeparators list of file separator entries to be merged 239 @param fileSeparators list of file separator entries to be merged
240 @type list of str
233 @return merged list of file separator entries 241 @return merged list of file separator entries
242 @rtype list of str
234 """ 243 """
235 separators = {} 244 separators = {}
236 for oldFile, newFile, pos1, pos2 in sorted(fileSeparators): 245 for oldFile, newFile, pos1, pos2 in sorted(fileSeparators):
237 if (oldFile, newFile) not in separators: 246 if (oldFile, newFile) not in separators:
238 separators[(oldFile, newFile)] = [oldFile, newFile, pos1, pos2] 247 separators[(oldFile, newFile)] = [oldFile, newFile, pos1, pos2]
245 254
246 def on_buttonBox_clicked(self, button): 255 def on_buttonBox_clicked(self, button):
247 """ 256 """
248 Private slot called by a button of the button box clicked. 257 Private slot called by a button of the button box clicked.
249 258
250 @param button button that was clicked (QAbstractButton) 259 @param button button that was clicked
260 @type QAbstractButton
251 """ 261 """
252 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Save): 262 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Save):
253 self.on_saveButton_clicked() 263 self.on_saveButton_clicked()
254 elif button == self.refreshButton: 264 elif button == self.refreshButton:
255 self.on_refreshButton_clicked() 265 self.on_refreshButton_clicked()
257 @pyqtSlot(int) 267 @pyqtSlot(int)
258 def on_filesCombo_activated(self, index): 268 def on_filesCombo_activated(self, index):
259 """ 269 """
260 Private slot to handle the selection of a file. 270 Private slot to handle the selection of a file.
261 271
262 @param index activated row (integer) 272 @param index activated row
273 @type int
263 """ 274 """
264 para1, para2 = self.filesCombo.itemData(index) 275 para1, para2 = self.filesCombo.itemData(index)
265 276
266 for para, contents in [(para1, self.contents), (para2, self.contents2)]: 277 for para, contents in [(para1, self.contents), (para2, self.contents2)]:
267 if para == 0: 278 if para == 0:

eric ide

mercurial