Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 1017
919147f2b518
parent 945
8cd4d08fa9f6
child 1019
d8a9697f78d1
equal deleted inserted replaced
1016:72b6b0778e06 1017:919147f2b518
128 self.__branchColors = {} 128 self.__branchColors = {}
129 self.__allBranchesFilter = self.trUtf8("All") 129 self.__allBranchesFilter = self.trUtf8("All")
130 130
131 self.logTree.setIconSize( 131 self.logTree.setIconSize(
132 QSize(100 * self.__rowHeight, self.__rowHeight)) 132 QSize(100 * self.__rowHeight, self.__rowHeight))
133 if self.vcs.versionStr >= "1.8":
134 self.logTree.headerItem().setText(self.logTree.columnCount(),
135 self.trUtf8("Bookmarks"))
133 136
134 self.__projectRevision = -1 137 self.__projectRevision = -1
135 138
136 def closeEvent(self, e): 139 def closeEvent(self, e):
137 """ 140 """
460 E5MessageBox.critical(self, 463 E5MessageBox.critical(self,
461 self.trUtf8("Mercurial Error"), 464 self.trUtf8("Mercurial Error"),
462 errMsg) 465 errMsg)
463 466
464 def __generateLogItem(self, author, date, message, revision, changedPaths, 467 def __generateLogItem(self, author, date, message, revision, changedPaths,
465 parents, branches, tags): 468 parents, branches, tags, bookmarks=None):
466 """ 469 """
467 Private method to generate a log tree entry. 470 Private method to generate a log tree entry.
468 471
469 @param author author info (string) 472 @param author author info (string)
470 @param date date info (string) 473 @param date date info (string)
473 @param changedPaths list of dictionary objects containing 476 @param changedPaths list of dictionary objects containing
474 info about the changed files/directories 477 info about the changed files/directories
475 @param parents list of parent revisions (list of integers) 478 @param parents list of parent revisions (list of integers)
476 @param branches list of branches (list of strings) 479 @param branches list of branches (list of strings)
477 @param tags list of tags (string) 480 @param tags list of tags (string)
481 @param bookmarks list of bookmarks (string)
478 @return reference to the generated item (QTreeWidgetItem) 482 @return reference to the generated item (QTreeWidgetItem)
479 """ 483 """
480 msg = [] 484 msg = []
481 for line in message: 485 for line in message:
482 msg.append(line.strip()) 486 msg.append(line.strip())
487 else: 491 else:
488 closedStr = "" 492 closedStr = ""
489 msgtxt = msg[0] 493 msgtxt = msg[0]
490 if len(msgtxt) > 30: 494 if len(msgtxt) > 30:
491 msgtxt = "{0}...".format(msgtxt[:30]) 495 msgtxt = "{0}...".format(msgtxt[:30])
492 itm = QTreeWidgetItem(self.logTree, [ 496 columnLabels = [
493 "", 497 "",
494 branches[0] + closedStr, 498 branches[0] + closedStr,
495 "{0:>7}:{1}".format(rev, node), 499 "{0:>7}:{1}".format(rev, node),
496 author, 500 author,
497 date, 501 date,
498 msgtxt, 502 msgtxt,
499 ", ".join(tags), 503 ", ".join(tags),
500 ]) 504 ]
505 if bookmarks is not None:
506 columnLabels.append(", ".join(bookmarks))
507 itm = QTreeWidgetItem(self.logTree, columnLabels)
501 508
502 itm.setForeground(self.BranchColumn, 509 itm.setForeground(self.BranchColumn,
503 QBrush(QColor(self.__branchColor(branches[0])))) 510 QBrush(QColor(self.__branchColor(branches[0]))))
504 511
505 if not self.projectMode: 512 if not self.projectMode:
593 not self.stopCheckBox.isChecked(): 600 not self.stopCheckBox.isChecked():
594 args.append('--follow') 601 args.append('--follow')
595 if self.commandMode == "log": 602 if self.commandMode == "log":
596 args.append('--copies') 603 args.append('--copies')
597 args.append('--style') 604 args.append('--style')
598 args.append(os.path.join(os.path.dirname(__file__), 605 if self.vcs.versionStr >= "1.8":
599 "styles", "logBrowser.style")) 606 args.append(os.path.join(os.path.dirname(__file__),
607 "styles", "logBrowserBookmark.style"))
608 else:
609 args.append(os.path.join(os.path.dirname(__file__),
610 "styles", "logBrowser.style"))
600 if self.commandMode == "incoming": 611 if self.commandMode == "incoming":
601 if self.bundle: 612 if self.bundle:
602 args.append(self.bundle) 613 args.append(self.bundle)
603 else: 614 else:
604 project = e5App().getObject("Project") 615 project = e5App().getObject("Project")
685 def __processBuffer(self): 696 def __processBuffer(self):
686 """ 697 """
687 Private method to process the buffered output of the hg log command. 698 Private method to process the buffered output of the hg log command.
688 """ 699 """
689 noEntries = 0 700 noEntries = 0
690 log = {"message": []} 701 log = {"message": [], "bookmarks": None}
691 changedPaths = [] 702 changedPaths = []
692 initialText = True 703 initialText = True
693 fileCopies = {} 704 fileCopies = {}
694 for s in self.buf: 705 for s in self.buf:
695 if s != "@@@\n": 706 if s != "@@@\n":
752 log["branches"] = value.strip().split(", ") 763 log["branches"] = value.strip().split(", ")
753 else: 764 else:
754 log["branches"] = ["default"] 765 log["branches"] = ["default"]
755 elif key == "tags": 766 elif key == "tags":
756 log["tags"] = value.strip().split(", ") 767 log["tags"] = value.strip().split(", ")
768 elif key == "bookmarks":
769 log["bookmarks"] = value.strip().split()
757 else: 770 else:
758 if initialText: 771 if initialText:
759 continue 772 continue
760 if value.strip(): 773 if value.strip():
761 log["message"].append(value.strip()) 774 log["message"].append(value.strip())
762 else: 775 else:
763 if len(log) > 1: 776 if len(log) > 1:
764 self.__generateLogItem(log["author"], log["date"], 777 self.__generateLogItem(log["author"], log["date"],
765 log["message"], log["revision"], changedPaths, 778 log["message"], log["revision"], changedPaths,
766 log["parents"], log["branches"], log["tags"]) 779 log["parents"], log["branches"], log["tags"],
780 log["bookmarks"])
767 dt = QDate.fromString(log["date"], Qt.ISODate) 781 dt = QDate.fromString(log["date"], Qt.ISODate)
768 if not self.__maxDate.isValid() and \ 782 if not self.__maxDate.isValid() and \
769 not self.__minDate.isValid(): 783 not self.__minDate.isValid():
770 self.__maxDate = dt 784 self.__maxDate = dt
771 self.__minDate = dt 785 self.__minDate = dt
773 if self.__maxDate < dt: 787 if self.__maxDate < dt:
774 self.__maxDate = dt 788 self.__maxDate = dt
775 if self.__minDate > dt: 789 if self.__minDate > dt:
776 self.__minDate = dt 790 self.__minDate = dt
777 noEntries += 1 791 noEntries += 1
778 log = {"message": []} 792 log = {"message": [], "bookmarks": None}
779 changedPaths = [] 793 changedPaths = []
780 fileCopies = {} 794 fileCopies = {}
781 795
782 self.logTree.doItemsLayout() 796 self.logTree.doItemsLayout()
783 self.__resizeColumnsLog() 797 self.__resizeColumnsLog()

eric ide

mercurial