17 from .Ui_SvnLogDialog import Ui_SvnLogDialog |
17 from .Ui_SvnLogDialog import Ui_SvnLogDialog |
18 from .SvnDiffDialog import SvnDiffDialog |
18 from .SvnDiffDialog import SvnDiffDialog |
19 |
19 |
20 import Utilities |
20 import Utilities |
21 import Preferences |
21 import Preferences |
|
22 |
22 |
23 |
23 class SvnLogDialog(QWidget, Ui_SvnLogDialog): |
24 class SvnLogDialog(QWidget, Ui_SvnLogDialog): |
24 """ |
25 """ |
25 Class implementing a dialog to show the output of the svn log command process. |
26 Class implementing a dialog to show the output of the svn log command process. |
26 |
27 |
27 The dialog is nonmodal. Clicking a link in the upper text pane shows |
28 The dialog is nonmodal. Clicking a link in the upper text pane shows |
28 a diff of the versions. |
29 a diff of the versions. |
29 """ |
30 """ |
30 def __init__(self, vcs, parent = None): |
31 def __init__(self, vcs, parent=None): |
31 """ |
32 """ |
32 Constructor |
33 Constructor |
33 |
34 |
34 @param vcs reference to the vcs object |
35 @param vcs reference to the vcs object |
35 @param parent parent widget (QWidget) |
36 @param parent parent widget (QWidget) |
64 self.rx_flags = QRegExp(' ([ADM])( .*)\\s*') |
65 self.rx_flags = QRegExp(' ([ADM])( .*)\\s*') |
65 # three blanks followed by A or D or M |
66 # three blanks followed by A or D or M |
66 self.rx_changed = QRegExp('Changed .*\\s*') |
67 self.rx_changed = QRegExp('Changed .*\\s*') |
67 |
68 |
68 self.flags = { |
69 self.flags = { |
69 'A' : self.trUtf8('Added'), |
70 'A': self.trUtf8('Added'), |
70 'D' : self.trUtf8('Deleted'), |
71 'D': self.trUtf8('Deleted'), |
71 'M' : self.trUtf8('Modified') |
72 'M': self.trUtf8('Modified') |
72 } |
73 } |
73 |
74 |
74 self.revisions = [] # stack of remembered revisions |
75 self.revisions = [] # stack of remembered revisions |
75 self.revString = self.trUtf8('revision') |
76 self.revString = self.trUtf8('revision') |
76 |
77 |
89 QTimer.singleShot(2000, self.process.kill) |
90 QTimer.singleShot(2000, self.process.kill) |
90 self.process.waitForFinished(3000) |
91 self.process.waitForFinished(3000) |
91 |
92 |
92 e.accept() |
93 e.accept() |
93 |
94 |
94 def start(self, fn, noEntries = 0): |
95 def start(self, fn, noEntries=0): |
95 """ |
96 """ |
96 Public slot to start the cvs log command. |
97 Public slot to start the cvs log command. |
97 |
98 |
98 @param fn filename to show the log for (string) |
99 @param fn filename to show the log for (string) |
99 @param noEntries number of entries to show (integer) |
100 @param noEntries number of entries to show (integer) |
168 url.setPath(self.filename) |
169 url.setPath(self.filename) |
169 query = QByteArray() |
170 query = QByteArray() |
170 query.append(lv).append('_').append(ver) |
171 query.append(lv).append('_').append(ver) |
171 url.setEncodedQuery(query) |
172 url.setEncodedQuery(query) |
172 dstr += ' [<a href="{0}" name="{1}">{2}</a>]'.format( |
173 dstr += ' [<a href="{0}" name="{1}">{2}</a>]'.format( |
173 url.toString(), |
174 url.toString(), |
174 query, |
175 query, |
175 self.trUtf8('diff to {0}').format(lv), |
176 self.trUtf8('diff to {0}').format(lv), |
176 ) |
177 ) |
177 except IndexError: |
178 except IndexError: |
178 pass |
179 pass |
179 dstr += '<br />\n' |
180 dstr += '<br />\n' |
180 self.contents.insertHtml(dstr) |
181 self.contents.insertHtml(dstr) |
210 self.contents.setTextCursor(tc) |
211 self.contents.setTextCursor(tc) |
211 self.contents.ensureCursorVisible() |
212 self.contents.ensureCursorVisible() |
212 |
213 |
213 def __readStdout(self): |
214 def __readStdout(self): |
214 """ |
215 """ |
215 Private slot to handle the readyReadStandardOutput signal. |
216 Private slot to handle the readyReadStandardOutput signal. |
216 |
217 |
217 It reads the output of the process and inserts it into a buffer. |
218 It reads the output of the process and inserts it into a buffer. |
218 """ |
219 """ |
219 self.process.setReadChannel(QProcess.StandardOutput) |
220 self.process.setReadChannel(QProcess.StandardOutput) |
220 |
221 |
221 while self.process.canReadLine(): |
222 while self.process.canReadLine(): |
222 line = str(self.process.readLine(), |
223 line = str(self.process.readLine(), |
223 Preferences.getSystem("IOEncoding"), |
224 Preferences.getSystem("IOEncoding"), |
224 'replace') |
225 'replace') |
225 self.buf.append(line) |
226 self.buf.append(line) |
226 if self.rx_rev.exactMatch(line): |
227 if self.rx_rev.exactMatch(line): |
227 ver = self.rx_rev.cap(1) |
228 ver = self.rx_rev.cap(1) |
228 # save revision number for later use |
229 # save revision number for later use |
239 It reads the error output of the process and inserts it into the |
240 It reads the error output of the process and inserts it into the |
240 error pane. |
241 error pane. |
241 """ |
242 """ |
242 if self.process is not None: |
243 if self.process is not None: |
243 self.errorGroup.show() |
244 self.errorGroup.show() |
244 s = str(self.process.readAllStandardError(), |
245 s = str(self.process.readAllStandardError(), |
245 Preferences.getSystem("IOEncoding"), |
246 Preferences.getSystem("IOEncoding"), |
246 'replace') |
247 'replace') |
247 self.errors.insertPlainText(s) |
248 self.errors.insertPlainText(s) |
248 self.errors.ensureCursorVisible() |
249 self.errors.ensureCursorVisible() |
249 |
250 |
250 def __sourceChanged(self, url): |
251 def __sourceChanged(self, url): |