Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2911
ce77f0b1ee67
parent 3008
7848489bcb92
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
28 import Preferences 28 import Preferences
29 29
30 30
31 class HgLogDialog(QWidget, Ui_HgLogDialog): 31 class HgLogDialog(QWidget, Ui_HgLogDialog):
32 """ 32 """
33 Class implementing a dialog to show the output of the hg log command process. 33 Class implementing a dialog to show the output of the hg log command
34 process.
34 35
35 The dialog is nonmodal. Clicking a link in the upper text pane shows 36 The dialog is nonmodal. Clicking a link in the upper text pane shows
36 a diff of the revisions. 37 a diff of the revisions.
37 """ 38 """
38 def __init__(self, vcs, mode="log", bundle=None, isFile=False, parent=None): 39 def __init__(self, vcs, mode="log", bundle=None, isFile=False,
40 parent=None):
39 """ 41 """
40 Constructor 42 Constructor
41 43
42 @param vcs reference to the vcs object 44 @param vcs reference to the vcs object
43 @param mode mode of the dialog (string; one of log, incoming, outgoing) 45 @param mode mode of the dialog (string; one of log, incoming, outgoing)
199 'Ensure, that it is in the search path.' 201 'Ensure, that it is in the search path.'
200 ).format('hg')) 202 ).format('hg'))
201 203
202 def __getParents(self, rev): 204 def __getParents(self, rev):
203 """ 205 """
204 Private method to get the parents of the currently viewed file/directory. 206 Private method to get the parents of the currently viewed
207 file/directory.
205 208
206 @param rev revision number to get parents for (string) 209 @param rev revision number to get parents for (string)
207 @return list of parent revisions (list of strings) 210 @return list of parent revisions (list of strings)
208 """ 211 """
209 errMsg = "" 212 errMsg = ""
214 args.append("parents") 217 args.append("parents")
215 if self.mode == "incoming": 218 if self.mode == "incoming":
216 if self.bundle: 219 if self.bundle:
217 args.append("--repository") 220 args.append("--repository")
218 args.append(self.bundle) 221 args.append(self.bundle)
219 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile): 222 elif self.vcs.bundleFile and \
223 os.path.exists(self.vcs.bundleFile):
220 args.append("--repository") 224 args.append("--repository")
221 args.append(self.vcs.bundleFile) 225 args.append(self.vcs.bundleFile)
222 args.append("--template") 226 args.append("--template")
223 args.append("{rev}:{node|short}\n") 227 args.append("{rev}:{node|short}\n")
224 args.append("-r") 228 args.append("-r")
267 """ 271 """
268 self.__finish() 272 self.__finish()
269 273
270 def __finish(self): 274 def __finish(self):
271 """ 275 """
272 Private slot called when the process finished or the user pressed the button. 276 Private slot called when the process finished or the user pressed
277 the button.
273 """ 278 """
274 self.inputGroup.setEnabled(False) 279 self.inputGroup.setEnabled(False)
275 self.inputGroup.hide() 280 self.inputGroup.hide()
276 281
277 self.contents.clear() 282 self.contents.clear()
317 ) 322 )
318 dstr += '<br />\n' 323 dstr += '<br />\n'
319 html += dstr 324 html += dstr
320 325
321 if "phase" in entry: 326 if "phase" in entry:
322 html += self.trUtf8("Phase: {0}<br />\n").format(entry["phase"]) 327 html += self.trUtf8("Phase: {0}<br />\n")\
323 328 .format(entry["phase"])
324 html += self.trUtf8("Branches: {0}<br />\n").format(entry["branches"]) 329
330 html += self.trUtf8("Branches: {0}<br />\n")\
331 .format(entry["branches"])
325 332
326 html += self.trUtf8("Tags: {0}<br />\n").format(entry["tags"]) 333 html += self.trUtf8("Tags: {0}<br />\n").format(entry["tags"])
327 334
328 if "bookmarks" in entry: 335 if "bookmarks" in entry:
329 html += self.trUtf8("Bookmarks: {0}<br />\n").format(entry["bookmarks"]) 336 html += self.trUtf8("Bookmarks: {0}<br />\n")\
330 337 .format(entry["bookmarks"])
331 html += self.trUtf8("Parents: {0}<br />\n").format(entry["parents"]) 338
332 339 html += self.trUtf8("Parents: {0}<br />\n")\
333 html += self.trUtf8('<i>Author: {0}</i><br />\n').format(entry["user"]) 340 .format(entry["parents"])
341
342 html += self.trUtf8('<i>Author: {0}</i><br />\n')\
343 .format(entry["user"])
334 344
335 date, time = entry["date"].split()[:2] 345 date, time = entry["date"].split()[:2]
336 html += self.trUtf8('<i>Date: {0}, {1}</i><br />\n').format(date, time) 346 html += self.trUtf8('<i>Date: {0}, {1}</i><br />\n')\
347 .format(date, time)
337 348
338 for line in entry["description"]: 349 for line in entry["description"]:
339 html += Utilities.html_encode(line.strip()) 350 html += Utilities.html_encode(line.strip())
340 html += '<br />\n' 351 html += '<br />\n'
341 352
342 if entry["file_adds"]: 353 if entry["file_adds"]:
343 html += '<br />\n' 354 html += '<br />\n'
344 for f in entry["file_adds"].strip().split(", "): 355 for f in entry["file_adds"].strip().split(", "):
345 if f in fileCopies: 356 if f in fileCopies:
346 html += self.trUtf8('Added {0} (copied from {1})<br />\n')\ 357 html += self.trUtf8(
347 .format(Utilities.html_encode(f), 358 'Added {0} (copied from {1})<br />\n')\
348 Utilities.html_encode(fileCopies[f])) 359 .format(Utilities.html_encode(f),
360 Utilities.html_encode(fileCopies[f]))
349 else: 361 else:
350 html += self.trUtf8('Added {0}<br />\n')\ 362 html += self.trUtf8('Added {0}<br />\n')\
351 .format(Utilities.html_encode(f)) 363 .format(Utilities.html_encode(f))
352 364
353 if entry["files_mods"]: 365 if entry["files_mods"]:

eric ide

mercurial