25 class SvnInfoDialog(QDialog, SvnDialogMixin, Ui_VcsRepositoryInfoDialog): |
25 class SvnInfoDialog(QDialog, SvnDialogMixin, Ui_VcsRepositoryInfoDialog): |
26 """ |
26 """ |
27 Class implementing a dialog to show repository related information |
27 Class implementing a dialog to show repository related information |
28 for a file/directory. |
28 for a file/directory. |
29 """ |
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) |
36 """ |
37 """ |
37 super().__init__(parent) |
38 super().__init__(parent) |
38 self.setupUi(self) |
39 self.setupUi(self) |
39 SvnDialogMixin.__init__(self) |
40 SvnDialogMixin.__init__(self) |
40 self.setWindowFlags(Qt.WindowType.Window) |
41 self.setWindowFlags(Qt.WindowType.Window) |
41 |
42 |
42 self.vcs = vcs |
43 self.vcs = vcs |
43 |
44 |
44 self.client = self.vcs.getClient() |
45 self.client = self.vcs.getClient() |
45 self.client.callback_cancel = self._clientCancelCallback |
46 self.client.callback_cancel = self._clientCancelCallback |
46 self.client.callback_get_login = self._clientLoginCallback |
47 self.client.callback_get_login = self._clientLoginCallback |
47 self.client.callback_ssl_server_trust_prompt = ( |
48 self.client.callback_ssl_server_trust_prompt = ( |
48 self._clientSslServerTrustPromptCallback |
49 self._clientSslServerTrustPromptCallback |
49 ) |
50 ) |
50 |
51 |
51 self.show() |
52 self.show() |
52 QApplication.processEvents() |
53 QApplication.processEvents() |
53 |
54 |
54 def start(self, projectPath, fn): |
55 def start(self, projectPath, fn): |
55 """ |
56 """ |
56 Public slot to start the svn info command. |
57 Public slot to start the svn info command. |
57 |
58 |
58 @param projectPath path name of the project (string) |
59 @param projectPath path name of the project (string) |
59 @param fn file or directory name relative to the project (string) |
60 @param fn file or directory name relative to the project (string) |
60 """ |
61 """ |
61 cwd = os.getcwd() |
62 cwd = os.getcwd() |
62 os.chdir(projectPath) |
63 os.chdir(projectPath) |
65 entries = self.client.info2(fn, recurse=False) |
66 entries = self.client.info2(fn, recurse=False) |
66 infoStr = "<table>" |
67 infoStr = "<table>" |
67 for path, info in entries: |
68 for path, info in entries: |
68 infoStr += self.tr( |
69 infoStr += self.tr( |
69 "<tr><td><b>Path (relative to project):</b></td>" |
70 "<tr><td><b>Path (relative to project):</b></td>" |
70 "<td>{0}</td></tr>").format(path) |
71 "<td>{0}</td></tr>" |
71 if info['URL']: |
72 ).format(path) |
|
73 if info["URL"]: |
72 infoStr += self.tr( |
74 infoStr += self.tr( |
73 "<tr><td><b>Url:</b></td><td>{0}</td></tr>" |
75 "<tr><td><b>Url:</b></td><td>{0}</td></tr>" |
74 ).format(info['URL']) |
76 ).format(info["URL"]) |
75 if info['rev']: |
77 if info["rev"]: |
76 infoStr += self.tr( |
78 infoStr += self.tr( |
77 "<tr><td><b>Revision:</b></td><td>{0}</td></tr>" |
79 "<tr><td><b>Revision:</b></td><td>{0}</td></tr>" |
78 ).format(info['rev'].number) |
80 ).format(info["rev"].number) |
79 if info['repos_root_URL']: |
81 if info["repos_root_URL"]: |
80 infoStr += self.tr( |
82 infoStr += self.tr( |
81 "<tr><td><b>Repository root URL:</b></td>" |
83 "<tr><td><b>Repository root URL:</b></td>" "<td>{0}</td></tr>" |
82 "<td>{0}</td></tr>" |
84 ).format(info["repos_root_URL"]) |
83 ).format(info['repos_root_URL']) |
85 if info["repos_UUID"]: |
84 if info['repos_UUID']: |
|
85 infoStr += self.tr( |
86 infoStr += self.tr( |
86 "<tr><td><b>Repository UUID:</b></td>" |
87 "<tr><td><b>Repository UUID:</b></td>" "<td>{0}</td></tr>" |
87 "<td>{0}</td></tr>" |
88 ).format(info["repos_UUID"]) |
88 ).format(info['repos_UUID']) |
89 if info["last_changed_author"]: |
89 if info['last_changed_author']: |
|
90 infoStr += self.tr( |
90 infoStr += self.tr( |
91 "<tr><td><b>Last changed author:</b></td>" |
91 "<tr><td><b>Last changed author:</b></td>" "<td>{0}</td></tr>" |
92 "<td>{0}</td></tr>" |
92 ).format(info["last_changed_author"]) |
93 ).format(info['last_changed_author']) |
93 if info["last_changed_date"]: |
94 if info['last_changed_date']: |
|
95 infoStr += self.tr( |
94 infoStr += self.tr( |
96 "<tr><td><b>Last Changed Date:</b></td>" |
95 "<tr><td><b>Last Changed Date:</b></td>" "<td>{0}</td></tr>" |
97 "<td>{0}</td></tr>" |
96 ).format(formatTime(info["last_changed_date"])) |
98 ).format(formatTime(info['last_changed_date'])) |
|
99 if ( |
97 if ( |
100 info['last_changed_rev'] and |
98 info["last_changed_rev"] |
101 info['last_changed_rev'].kind == |
99 and info["last_changed_rev"].kind == pysvn.opt_revision_kind.number |
102 pysvn.opt_revision_kind.number |
|
103 ): |
100 ): |
104 infoStr += self.tr( |
101 infoStr += self.tr( |
105 "<tr><td><b>Last changed revision:</b></td>" |
102 "<tr><td><b>Last changed revision:</b></td>" "<td>{0}</td></tr>" |
106 "<td>{0}</td></tr>" |
103 ).format(info["last_changed_rev"].number) |
107 ).format(info['last_changed_rev'].number) |
104 if info["kind"]: |
108 if info['kind']: |
105 if info["kind"] == pysvn.node_kind.file: |
109 if info['kind'] == pysvn.node_kind.file: |
|
110 nodeKind = self.tr("file") |
106 nodeKind = self.tr("file") |
111 elif info['kind'] == pysvn.node_kind.dir: |
107 elif info["kind"] == pysvn.node_kind.dir: |
112 nodeKind = self.tr("directory") |
108 nodeKind = self.tr("directory") |
113 elif info['kind'] == pysvn.node_kind.none: |
109 elif info["kind"] == pysvn.node_kind.none: |
114 nodeKind = self.tr("none") |
110 nodeKind = self.tr("none") |
115 else: |
111 else: |
116 nodeKind = self.tr("unknown") |
112 nodeKind = self.tr("unknown") |
117 infoStr += self.tr( |
113 infoStr += self.tr( |
118 "<tr><td><b>Node kind:</b></td><td>{0}</td></tr>" |
114 "<tr><td><b>Node kind:</b></td><td>{0}</td></tr>" |
119 ).format(nodeKind) |
115 ).format(nodeKind) |
120 if info['lock']: |
116 if info["lock"]: |
121 lockInfo = info['lock'] |
117 lockInfo = info["lock"] |
122 infoStr += self.tr( |
118 infoStr += self.tr( |
123 "<tr><td><b>Lock Owner:</b></td><td>{0}</td></tr>" |
119 "<tr><td><b>Lock Owner:</b></td><td>{0}</td></tr>" |
124 ).format(lockInfo['owner']) |
120 ).format(lockInfo["owner"]) |
125 infoStr += self.tr( |
121 infoStr += self.tr( |
126 "<tr><td><b>Lock Creation Date:</b></td>" |
122 "<tr><td><b>Lock Creation Date:</b></td>" "<td>{0}</td></tr>" |
127 "<td>{0}</td></tr>" |
123 ).format(formatTime(lockInfo["creation_date"])) |
128 ).format(formatTime(lockInfo['creation_date'])) |
124 if lockInfo["expiration_date"] is not None: |
129 if lockInfo['expiration_date'] is not None: |
|
130 infoStr += self.tr( |
125 infoStr += self.tr( |
131 "<tr><td><b>Lock Expiration Date:</b></td>" |
126 "<tr><td><b>Lock Expiration Date:</b></td>" |
132 "<td>{0}</td></tr>" |
127 "<td>{0}</td></tr>" |
133 ).format(formatTime(lockInfo['expiration_date'])) |
128 ).format(formatTime(lockInfo["expiration_date"])) |
134 infoStr += self.tr( |
129 infoStr += self.tr( |
135 "<tr><td><b>Lock Token:</b></td><td>{0}</td></tr>" |
130 "<tr><td><b>Lock Token:</b></td><td>{0}</td></tr>" |
136 ).format(lockInfo['token']) |
131 ).format(lockInfo["token"]) |
137 infoStr += self.tr( |
132 infoStr += self.tr( |
138 "<tr><td><b>Lock Comment:</b></td><td>{0}</td></tr>" |
133 "<tr><td><b>Lock Comment:</b></td><td>{0}</td></tr>" |
139 ).format(lockInfo['comment']) |
134 ).format(lockInfo["comment"]) |
140 if info['wc_info']: |
135 if info["wc_info"]: |
141 wcInfo = info['wc_info'] |
136 wcInfo = info["wc_info"] |
142 if wcInfo['schedule']: |
137 if wcInfo["schedule"]: |
143 if wcInfo['schedule'] == pysvn.wc_schedule.normal: |
138 if wcInfo["schedule"] == pysvn.wc_schedule.normal: |
144 schedule = self.tr("normal") |
139 schedule = self.tr("normal") |
145 elif wcInfo['schedule'] == pysvn.wc_schedule.add: |
140 elif wcInfo["schedule"] == pysvn.wc_schedule.add: |
146 schedule = self.tr("add") |
141 schedule = self.tr("add") |
147 elif wcInfo['schedule'] == pysvn.wc_schedule.delete: |
142 elif wcInfo["schedule"] == pysvn.wc_schedule.delete: |
148 schedule = self.tr("delete") |
143 schedule = self.tr("delete") |
149 elif wcInfo['schedule'] == pysvn.wc_schedule.replace: |
144 elif wcInfo["schedule"] == pysvn.wc_schedule.replace: |
150 schedule = self.tr("replace") |
145 schedule = self.tr("replace") |
151 infoStr += self.tr( |
146 infoStr += self.tr( |
152 "<tr><td><b>Schedule:</b></td><td>{0}</td></tr>" |
147 "<tr><td><b>Schedule:</b></td><td>{0}</td></tr>" |
153 ).format(schedule) |
148 ).format(schedule) |
154 if wcInfo['copyfrom_url']: |
149 if wcInfo["copyfrom_url"]: |
155 infoStr += self.tr( |
150 infoStr += self.tr( |
156 "<tr><td><b>Copied From URL:</b></td>" |
151 "<tr><td><b>Copied From URL:</b></td>" "<td>{0}</td></tr>" |
157 "<td>{0}</td></tr>" |
152 ).format(wcInfo["copyfrom_url"]) |
158 ).format(wcInfo['copyfrom_url']) |
|
159 infoStr += self.tr( |
153 infoStr += self.tr( |
160 "<tr><td><b>Copied From Rev:</b></td>" |
154 "<tr><td><b>Copied From Rev:</b></td>" "<td>{0}</td></tr>" |
161 "<td>{0}</td></tr>" |
155 ).format(wcInfo["copyfrom_rev"].number) |
162 ).format(wcInfo['copyfrom_rev'].number) |
156 if wcInfo["text_time"]: |
163 if wcInfo['text_time']: |
|
164 infoStr += self.tr( |
157 infoStr += self.tr( |
165 "<tr><td><b>Text Last Updated:</b></td>" |
158 "<tr><td><b>Text Last Updated:</b></td>" "<td>{0}</td></tr>" |
166 "<td>{0}</td></tr>" |
159 ).format(formatTime(wcInfo["text_time"])) |
167 ).format(formatTime(wcInfo['text_time'])) |
160 if wcInfo["prop_time"]: |
168 if wcInfo['prop_time']: |
|
169 infoStr += self.tr( |
161 infoStr += self.tr( |
170 "<tr><td><b>Properties Last Updated:</b></td>" |
162 "<tr><td><b>Properties Last Updated:</b></td>" |
171 "<td>{0}</td></tr>" |
163 "<td>{0}</td></tr>" |
172 ).format(formatTime(wcInfo['prop_time'])) |
164 ).format(formatTime(wcInfo["prop_time"])) |
173 if wcInfo['checksum']: |
165 if wcInfo["checksum"]: |
174 infoStr += self.tr( |
166 infoStr += self.tr( |
175 "<tr><td><b>Checksum:</b></td><td>{0}</td></tr>" |
167 "<tr><td><b>Checksum:</b></td><td>{0}</td></tr>" |
176 ).format(wcInfo['checksum']) |
168 ).format(wcInfo["checksum"]) |
177 infoStr += "</table>" |
169 infoStr += "</table>" |
178 self.infoBrowser.setHtml(infoStr) |
170 self.infoBrowser.setHtml(infoStr) |
179 except pysvn.ClientError as e: |
171 except pysvn.ClientError as e: |
180 self.__showError(e.args[0]) |
172 self.__showError(e.args[0]) |
181 os.chdir(cwd) |
173 os.chdir(cwd) |
182 |
174 |
183 def __showError(self, msg): |
175 def __showError(self, msg): |
184 """ |
176 """ |
185 Private slot to show an error message. |
177 Private slot to show an error message. |
186 |
178 |
187 @param msg error message to show (string) |
179 @param msg error message to show (string) |
188 """ |
180 """ |
189 infoStr = "<p>{0}</p>".format(msg) |
181 infoStr = "<p>{0}</p>".format(msg) |
190 self.infoBrowser.setHtml(infoStr) |
182 self.infoBrowser.setHtml(infoStr) |