39 Constructor |
39 Constructor |
40 |
40 |
41 @param vcs reference to the vcs object |
41 @param vcs reference to the vcs object |
42 @param parent parent widget (QWidget) |
42 @param parent parent widget (QWidget) |
43 """ |
43 """ |
44 super(SvnDiffDialog, self).__init__(parent) |
44 super().__init__(parent) |
45 self.setupUi(self) |
45 self.setupUi(self) |
46 SvnDialogMixin.__init__(self) |
46 SvnDialogMixin.__init__(self) |
47 |
47 |
48 self.refreshButton = self.buttonBox.addButton( |
48 self.refreshButton = self.buttonBox.addButton( |
49 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
49 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
86 elif version.startswith("{"): |
86 elif version.startswith("{"): |
87 dateStr = version[1:-1] |
87 dateStr = version[1:-1] |
88 secs = QDateTime.fromString( |
88 secs = QDateTime.fromString( |
89 dateStr, Qt.DateFormat.ISODate).toTime_t() |
89 dateStr, Qt.DateFormat.ISODate).toTime_t() |
90 return pysvn.Revision(pysvn.opt_revision_kind.date, secs) |
90 return pysvn.Revision(pysvn.opt_revision_kind.date, secs) |
91 elif version == "HEAD": |
91 else: |
92 return pysvn.Revision(pysvn.opt_revision_kind.head) |
92 return { |
93 elif version == "COMMITTED": |
93 "HEAD": pysvn.Revision(pysvn.opt_revision_kind.head), |
94 return pysvn.Revision(pysvn.opt_revision_kind.committed) |
94 "COMMITTED": pysvn.Revision(pysvn.opt_revision_kind.committed), |
95 elif version == "BASE": |
95 "BASE": pysvn.Revision(pysvn.opt_revision_kind.base), |
96 return pysvn.Revision(pysvn.opt_revision_kind.base) |
96 "WORKING": pysvn.Revision(pysvn.opt_revision_kind.working), |
97 elif version == "WORKING": |
97 "PREV": pysvn.Revision(pysvn.opt_revision_kind.previous), |
98 return pysvn.Revision(pysvn.opt_revision_kind.working) |
98 }.get(version, pysvn.Revision(pysvn.opt_revision_kind.unspecified)) |
99 elif version == "PREV": |
99 |
100 return pysvn.Revision(pysvn.opt_revision_kind.previous) |
|
101 else: |
|
102 return pysvn.Revision(pysvn.opt_revision_kind.unspecified) |
|
103 |
|
104 def __getDiffSummaryKind(self, summaryKind): |
100 def __getDiffSummaryKind(self, summaryKind): |
105 """ |
101 """ |
106 Private method to get a string descripion of the diff summary. |
102 Private method to get a string descripion of the diff summary. |
107 |
103 |
108 @param summaryKind (pysvn.diff_summarize.summarize_kind) |
104 @param summaryKind (pysvn.diff_summarize.summarize_kind) |
250 else: |
246 else: |
251 diffText = self.client.diff( |
247 diffText = self.client.diff( |
252 tmpdir, name, |
248 tmpdir, name, |
253 revision1=rev1, revision2=rev2, |
249 revision1=rev1, revision2=rev2, |
254 recurse=recurse) |
250 recurse=recurse) |
255 counter = 0 |
251 for counter, line in enumerate(diffText.splitlines()): |
256 for line in diffText.splitlines(): |
|
257 if ( |
252 if ( |
258 line.startswith("--- ") or |
253 line.startswith("--- ") or |
259 line.startswith("+++ ") |
254 line.startswith("+++ ") |
260 ): |
255 ): |
261 self.__processFileLine(line) |
256 self.__processFileLine(line) |
262 |
257 |
263 self.__appendText( |
258 self.__appendText( |
264 "{0}{1}".format(line, os.linesep)) |
259 "{0}{1}".format(line, os.linesep)) |
265 counter += 1 |
260 if ( |
266 if counter == 30: |
261 counter % 30 == 0 and |
|
262 self._clientCancelCallback() |
|
263 ): |
267 # check for cancel every 30 lines |
264 # check for cancel every 30 lines |
268 counter = 0 |
265 break |
269 if self._clientCancelCallback(): |
|
270 break |
|
271 if self._clientCancelCallback(): |
266 if self._clientCancelCallback(): |
272 break |
267 break |
273 except pysvn.ClientError as e: |
268 except pysvn.ClientError as e: |
274 self.__showError(e.args[0]) |
269 self.__showError(e.args[0]) |
275 os.chdir(cwd) |
270 os.chdir(cwd) |