41 @param parent parent widget (QWidget) |
41 @param parent parent widget (QWidget) |
42 """ |
42 """ |
43 super(HgSummaryDialog, self).__init__(parent) |
43 super(HgSummaryDialog, self).__init__(parent) |
44 self.setupUi(self) |
44 self.setupUi(self) |
45 |
45 |
46 self.refreshButton = \ |
46 self.refreshButton = self.buttonBox.addButton( |
47 self.buttonBox.addButton(self.trUtf8("Refresh"), QDialogButtonBox.ActionRole) |
47 self.trUtf8("Refresh"), QDialogButtonBox.ActionRole) |
48 self.refreshButton.setToolTip(self.trUtf8("Press to refresh the summary display")) |
48 self.refreshButton.setToolTip( |
|
49 self.trUtf8("Press to refresh the summary display")) |
49 self.refreshButton.setEnabled(False) |
50 self.refreshButton.setEnabled(False) |
50 |
51 |
51 self.process = None |
52 self.process = None |
52 self.vcs = vcs |
53 self.vcs = vcs |
53 self.vcs.committed.connect(self.__committed) |
54 self.vcs.committed.connect(self.__committed) |
93 |
94 |
94 if self.process: |
95 if self.process: |
95 self.process.kill() |
96 self.process.kill() |
96 else: |
97 else: |
97 self.process = QProcess() |
98 self.process = QProcess() |
98 prepareProcess(self.process, Preferences.getSystem("IOEncoding"), "C") |
99 prepareProcess(self.process, Preferences.getSystem("IOEncoding"), |
|
100 "C") |
99 self.process.finished.connect(self.__procFinished) |
101 self.process.finished.connect(self.__procFinished) |
100 self.process.readyReadStandardOutput.connect(self.__readStdout) |
102 self.process.readyReadStandardOutput.connect(self.__readStdout) |
101 self.process.readyReadStandardError.connect(self.__readStderr) |
103 self.process.readyReadStandardError.connect(self.__readStderr) |
102 |
104 |
103 self.process.setWorkingDirectory(repodir) |
105 self.process.setWorkingDirectory(repodir) |
317 pindex = 0 |
320 pindex = 0 |
318 for rev, node, tags, message, remarks in infoDict["parent"]: |
321 for rev, node, tags, message, remarks in infoDict["parent"]: |
319 pindex += 1 |
322 pindex += 1 |
320 changeset = "{0}:{1}".format(rev, node) |
323 changeset = "{0}:{1}".format(rev, node) |
321 if len(infoDict["parent"]) > 1: |
324 if len(infoDict["parent"]) > 1: |
322 info.append( |
325 info.append(self.trUtf8( |
323 self.trUtf8("<tr><td><b>Parent #{0}</b></td><td>{1}</td></tr>") |
326 "<tr><td><b>Parent #{0}</b></td><td>{1}</td></tr>") |
324 .format(pindex, changeset)) |
327 .format(pindex, changeset)) |
325 else: |
328 else: |
326 info.append( |
329 info.append(self.trUtf8( |
327 self.trUtf8("<tr><td><b>Parent</b></td><td>{0}</td></tr>") |
330 "<tr><td><b>Parent</b></td><td>{0}</td></tr>") |
328 .format(changeset)) |
331 .format(changeset)) |
329 if tags: |
332 if tags: |
330 info.append(self.trUtf8("<tr><td><b>Tags</b></td><td>{0}</td></tr>") |
333 info.append(self.trUtf8( |
331 .format('<br/>'.join(tags.split()))) |
334 "<tr><td><b>Tags</b></td><td>{0}</td></tr>") |
|
335 .format('<br/>'.join(tags.split()))) |
332 if message: |
336 if message: |
333 info.append( |
337 info.append(self.trUtf8( |
334 self.trUtf8("<tr><td><b>Commit Message</b></td><td>{0}</td></tr>") |
338 "<tr><td><b>Commit Message</b></td><td>{0}</td></tr>") |
335 .format(message)) |
339 .format(message)) |
336 if remarks: |
340 if remarks: |
337 rem = [] |
341 rem = [] |
338 if "@EMPTY@" in remarks: |
342 if "@EMPTY@" in remarks: |
339 rem.append(self.trUtf8("empty repository")) |
343 rem.append(self.trUtf8("empty repository")) |
340 if "@NO_REVISION@" in remarks: |
344 if "@NO_REVISION@" in remarks: |
341 rem.append(self.trUtf8("no revision checked out")) |
345 rem.append(self.trUtf8("no revision checked out")) |
342 info.append( |
346 info.append(self.trUtf8( |
343 self.trUtf8("<tr><td><b>Remarks</b></td><td>{0}</td></tr>") |
347 "<tr><td><b>Remarks</b></td><td>{0}</td></tr>") |
344 .format(", ".join(rem))) |
348 .format(", ".join(rem))) |
345 if "branch" in infoDict: |
349 if "branch" in infoDict: |
346 info.append(self.trUtf8("<tr><td><b>Branch</b></td><td>{0}</td></tr>") |
350 info.append(self.trUtf8( |
347 .format(infoDict["branch"])) |
351 "<tr><td><b>Branch</b></td><td>{0}</td></tr>") |
|
352 .format(infoDict["branch"])) |
348 if "bookmarks" in infoDict: |
353 if "bookmarks" in infoDict: |
349 bookmarks = infoDict["bookmarks"].split() |
354 bookmarks = infoDict["bookmarks"].split() |
350 for i in range(len(bookmarks)): |
355 for i in range(len(bookmarks)): |
351 if bookmarks[i].startswith("*"): |
356 if bookmarks[i].startswith("*"): |
352 bookmarks[i] = "<b>{0}</b>".format(bookmarks[i]) |
357 bookmarks[i] = "<b>{0}</b>".format(bookmarks[i]) |
353 info.append(self.trUtf8("<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>") |
358 info.append(self.trUtf8( |
354 .format('<br/>'.join(bookmarks))) |
359 "<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>") |
|
360 .format('<br/>'.join(bookmarks))) |
355 if "commit" in infoDict: |
361 if "commit" in infoDict: |
356 cinfo = [] |
362 cinfo = [] |
357 for category, count in infoDict["commit"][0].items(): |
363 for category, count in infoDict["commit"][0].items(): |
358 if category == "modified": |
364 if category == "modified": |
359 cinfo.append(self.trUtf8("{0} modified").format(count)) |
365 cinfo.append(self.trUtf8("{0} modified").format(count)) |
370 elif category == "unknown": |
376 elif category == "unknown": |
371 cinfo.append(self.trUtf8("{0} unknown").format(count)) |
377 cinfo.append(self.trUtf8("{0} unknown").format(count)) |
372 elif category == "ignored": |
378 elif category == "ignored": |
373 cinfo.append(self.trUtf8("{0} ignored").format(count)) |
379 cinfo.append(self.trUtf8("{0} ignored").format(count)) |
374 elif category == "unresolved": |
380 elif category == "unresolved": |
375 cinfo.append(self.trUtf8("{0} unresolved").format(count)) |
381 cinfo.append( |
|
382 self.trUtf8("{0} unresolved").format(count)) |
376 elif category == "subrepos": |
383 elif category == "subrepos": |
377 cinfo.append(self.trUtf8("{0} subrepos").format(count)) |
384 cinfo.append(self.trUtf8("{0} subrepos").format(count)) |
378 remark = infoDict["commit"][1] |
385 remark = infoDict["commit"][1] |
379 if remark == "merge": |
386 if remark == "merge": |
380 cinfo.append(self.trUtf8("Merge needed")) |
387 cinfo.append(self.trUtf8("Merge needed")) |
384 cinfo.append(self.trUtf8("Head is closed")) |
391 cinfo.append(self.trUtf8("Head is closed")) |
385 elif remark == "clean": |
392 elif remark == "clean": |
386 cinfo.append(self.trUtf8("No commit required")) |
393 cinfo.append(self.trUtf8("No commit required")) |
387 elif remark == "new branch head": |
394 elif remark == "new branch head": |
388 cinfo.append(self.trUtf8("New Branch Head")) |
395 cinfo.append(self.trUtf8("New Branch Head")) |
389 info.append( |
396 info.append(self.trUtf8( |
390 self.trUtf8("<tr><td><b>Commit Status</b></td><td>{0}</td></tr>") |
397 "<tr><td><b>Commit Status</b></td><td>{0}</td></tr>") |
391 .format("<br/>".join(cinfo))) |
398 .format("<br/>".join(cinfo))) |
392 if "update" in infoDict: |
399 if "update" in infoDict: |
393 if infoDict["update"][0] == "@CURRENT@": |
400 if infoDict["update"][0] == "@CURRENT@": |
394 uinfo = self.trUtf8("current") |
401 uinfo = self.trUtf8("current") |
395 elif infoDict["update"][0] == "@UPDATE@": |
402 elif infoDict["update"][0] == "@UPDATE@": |
396 uinfo = self.trUtf8("%n new changeset(s)<br/>Update required", "", |
403 uinfo = self.trUtf8( |
|
404 "%n new changeset(s)<br/>Update required", "", |
397 infoDict["update"][1]) |
405 infoDict["update"][1]) |
398 elif infoDict["update"][0] == "@MERGE@": |
406 elif infoDict["update"][0] == "@MERGE@": |
399 uinfo1 = self.trUtf8("%n new changeset(s)", "", infoDict["update"][1]) |
407 uinfo1 = self.trUtf8( |
400 uinfo2 = self.trUtf8("%n branch head(s)", "", infoDict["update"][2]) |
408 "%n new changeset(s)", "", infoDict["update"][1]) |
401 uinfo = self.trUtf8("{0}<br/>{1}<br/>Merge required", |
409 uinfo2 = self.trUtf8( |
|
410 "%n branch head(s)", "", infoDict["update"][2]) |
|
411 uinfo = self.trUtf8( |
|
412 "{0}<br/>{1}<br/>Merge required", |
402 "0 is changesets, 1 is branch heads")\ |
413 "0 is changesets, 1 is branch heads")\ |
403 .format(uinfo1, uinfo2) |
414 .format(uinfo1, uinfo2) |
404 else: |
415 else: |
405 uinfo = self.trUtf8("unknown status") |
416 uinfo = self.trUtf8("unknown status") |
406 info.append( |
417 info.append(self.trUtf8( |
407 self.trUtf8("<tr><td><b>Update Status</b></td><td>{0}</td></tr>") |
418 "<tr><td><b>Update Status</b></td><td>{0}</td></tr>") |
408 .format(uinfo)) |
419 .format(uinfo)) |
409 if "remote" in infoDict: |
420 if "remote" in infoDict: |
410 if infoDict["remote"] == (0, 0, 0, 0): |
421 if infoDict["remote"] == (0, 0, 0, 0): |
411 rinfo = self.trUtf8("synched") |
422 rinfo = self.trUtf8("synched") |
412 else: |
423 else: |
421 infoDict["remote"][2])) |
432 infoDict["remote"][2])) |
422 if infoDict["remote"][3]: |
433 if infoDict["remote"][3]: |
423 l.append(self.trUtf8("%n outgoing bookmark(s)", "", |
434 l.append(self.trUtf8("%n outgoing bookmark(s)", "", |
424 infoDict["remote"][3])) |
435 infoDict["remote"][3])) |
425 rinfo = "<br/>".join(l) |
436 rinfo = "<br/>".join(l) |
426 info.append( |
437 info.append(self.trUtf8( |
427 self.trUtf8("<tr><td><b>Remote Status</b></td><td>{0}</td></tr>") |
438 "<tr><td><b>Remote Status</b></td><td>{0}</td></tr>") |
428 .format(rinfo)) |
439 .format(rinfo)) |
429 if "mq" in infoDict: |
440 if "mq" in infoDict: |
430 if infoDict["mq"] == (0, 0): |
441 if infoDict["mq"] == (0, 0): |
431 qinfo = self.trUtf8("empty queue") |
442 qinfo = self.trUtf8("empty queue") |
432 else: |
443 else: |
433 l = [] |
444 l = [] |
434 if infoDict["mq"][0]: |
445 if infoDict["mq"][0]: |
435 l.append(self.trUtf8("{0} applied").format(infoDict["mq"][0])) |
446 l.append(self.trUtf8("{0} applied") |
|
447 .format(infoDict["mq"][0])) |
436 if infoDict["mq"][1]: |
448 if infoDict["mq"][1]: |
437 l.append(self.trUtf8("{0} unapplied").format(infoDict["mq"][1])) |
449 l.append(self.trUtf8("{0} unapplied") |
|
450 .format(infoDict["mq"][1])) |
438 qinfo = "<br/>".join(l) |
451 qinfo = "<br/>".join(l) |
439 info.append( |
452 info.append(self.trUtf8( |
440 self.trUtf8("<tr><td><b>Queues Status</b></td><td>{0}</td></tr>") |
453 "<tr><td><b>Queues Status</b></td><td>{0}</td></tr>") |
441 .format(qinfo)) |
454 .format(qinfo)) |
442 info.append("</table>") |
455 info.append("</table>") |
443 else: |
456 else: |
444 info = [self.trUtf8("<p>No status information available.</p>")] |
457 info = [self.trUtf8("<p>No status information available.</p>")] |
445 |
458 |