19 from .SvnDialogMixin import SvnDialogMixin |
19 from .SvnDialogMixin import SvnDialogMixin |
20 from .Ui_SvnLogDialog import Ui_SvnLogDialog |
20 from .Ui_SvnLogDialog import Ui_SvnLogDialog |
21 from .SvnDiffDialog import SvnDiffDialog |
21 from .SvnDiffDialog import SvnDiffDialog |
22 |
22 |
23 import Utilities |
23 import Utilities |
|
24 |
24 |
25 |
25 class SvnLogDialog(QWidget, SvnDialogMixin, Ui_SvnLogDialog): |
26 class SvnLogDialog(QWidget, SvnDialogMixin, Ui_SvnLogDialog): |
26 """ |
27 """ |
27 Class implementing a dialog to show the output of the svn log command. |
28 Class implementing a dialog to show the output of the svn log command. |
28 |
29 |
29 The dialog is nonmodal. Clicking a link in the upper text pane shows |
30 The dialog is nonmodal. Clicking a link in the upper text pane shows |
30 a diff of the versions. |
31 a diff of the versions. |
31 """ |
32 """ |
32 def __init__(self, vcs, parent = None): |
33 def __init__(self, vcs, parent=None): |
33 """ |
34 """ |
34 Constructor |
35 Constructor |
35 |
36 |
36 @param vcs reference to the vcs object |
37 @param vcs reference to the vcs object |
37 @param parent parent widget (QWidget) |
38 @param parent parent widget (QWidget) |
49 self.trUtf8('<b>Processing your request, please wait...</b>')) |
50 self.trUtf8('<b>Processing your request, please wait...</b>')) |
50 |
51 |
51 self.contents.anchorClicked.connect(self.__sourceChanged) |
52 self.contents.anchorClicked.connect(self.__sourceChanged) |
52 |
53 |
53 self.flags = { |
54 self.flags = { |
54 'A' : self.trUtf8('Added'), |
55 'A': self.trUtf8('Added'), |
55 'D' : self.trUtf8('Deleted'), |
56 'D': self.trUtf8('Deleted'), |
56 'M' : self.trUtf8('Modified') |
57 'M': self.trUtf8('Modified') |
57 } |
58 } |
58 |
59 |
59 self.revString = self.trUtf8('revision') |
60 self.revString = self.trUtf8('revision') |
60 self.diff = None |
61 self.diff = None |
61 |
62 |
65 self.client.callback_get_login = \ |
66 self.client.callback_get_login = \ |
66 self._clientLoginCallback |
67 self._clientLoginCallback |
67 self.client.callback_ssl_server_trust_prompt = \ |
68 self.client.callback_ssl_server_trust_prompt = \ |
68 self._clientSslServerTrustPromptCallback |
69 self._clientSslServerTrustPromptCallback |
69 |
70 |
70 def start(self, fn, noEntries = 0): |
71 def start(self, fn, noEntries=0): |
71 """ |
72 """ |
72 Public slot to start the svn log command. |
73 Public slot to start the svn log command. |
73 |
74 |
74 @param fn filename to show the log for (string) |
75 @param fn filename to show the log for (string) |
75 @param noEntries number of entries to show (integer) |
76 @param noEntries number of entries to show (integer) |
103 if fetched == 0: |
104 if fetched == 0: |
104 revstart = pysvn.Revision(pysvn.opt_revision_kind.head) |
105 revstart = pysvn.Revision(pysvn.opt_revision_kind.head) |
105 else: |
106 else: |
106 revstart = pysvn.Revision( |
107 revstart = pysvn.Revision( |
107 pysvn.opt_revision_kind.number, nextRev) |
108 pysvn.opt_revision_kind.number, nextRev) |
108 allLogs = self.client.log(fname, |
109 allLogs = self.client.log(fname, |
109 revision_start = revstart, |
110 revision_start=revstart, |
110 discover_changed_paths = verbose, |
111 discover_changed_paths=verbose, |
111 limit = flimit + 1, |
112 limit=flimit + 1, |
112 strict_node_history = False) |
113 strict_node_history=False) |
113 if len(allLogs) <= flimit or self._clientCancelCallback(): |
114 if len(allLogs) <= flimit or self._clientCancelCallback(): |
114 logs.extend(allLogs) |
115 logs.extend(allLogs) |
115 break |
116 break |
116 else: |
117 else: |
117 logs.extend(allLogs[:-1]) |
118 logs.extend(allLogs[:-1]) |
157 |
158 |
158 if len(log['changed_paths']) > 0: |
159 if len(log['changed_paths']) > 0: |
159 self.contents.insertHtml('<br />\n') |
160 self.contents.insertHtml('<br />\n') |
160 for changeInfo in log['changed_paths']: |
161 for changeInfo in log['changed_paths']: |
161 dstr = '{0} {1}'\ |
162 dstr = '{0} {1}'\ |
162 .format(self.flags[changeInfo["action"]], |
163 .format(self.flags[changeInfo["action"]], |
163 changeInfo["path"]) |
164 changeInfo["path"]) |
164 if changeInfo["copyfrom_path"] is not None: |
165 if changeInfo["copyfrom_path"] is not None: |
165 dstr += self.trUtf8(" (copied from {0}, revision {1})")\ |
166 dstr += self.trUtf8(" (copied from {0}, revision {1})")\ |
166 .format(changeInfo["copyfrom_path"], |
167 .format(changeInfo["copyfrom_path"], |
167 changeInfo["copyfrom_revision"].number) |
168 changeInfo["copyfrom_revision"].number) |
168 dstr += '<br />\n' |
169 dstr += '<br />\n' |
169 self.contents.insertHtml(dstr) |
170 self.contents.insertHtml(dstr) |
170 |
171 |
171 self.contents.insertHtml('<hr /><br />\n') |
172 self.contents.insertHtml('<hr /><br />\n') |
227 self.contents.scrollToAnchor(ver) |
228 self.contents.scrollToAnchor(ver) |
228 |
229 |
229 if self.diff is None: |
230 if self.diff is None: |
230 self.diff = SvnDiffDialog(self.vcs) |
231 self.diff = SvnDiffDialog(self.vcs) |
231 self.diff.show() |
232 self.diff.show() |
232 self.diff.start(filename, [v1, v2], pegRev = self.__pegRev) |
233 self.diff.start(filename, [v1, v2], pegRev=self.__pegRev) |
233 |
234 |
234 def __showError(self, msg): |
235 def __showError(self, msg): |
235 """ |
236 """ |
236 Private slot to show an error message. |
237 Private slot to show an error message. |
237 |
238 |