eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 7971
ff2971513d6d
parent 7970
c4ee8a81584c
child 8043
0acf98cd089a
child 8143
2c730d5fd177
equal deleted inserted replaced
7970:c4ee8a81584c 7971:ff2971513d6d
592 592
593 self.__revs = nextRevs 593 self.__revs = nextRevs
594 return col, color, edges 594 return col, color, edges
595 595
596 def __generateIcon(self, column, color, bottomedges, topedges, dotColor, 596 def __generateIcon(self, column, color, bottomedges, topedges, dotColor,
597 currentRev, closed, isDraft): 597 currentRev, closed, isPushableDraft):
598 """ 598 """
599 Private method to generate an icon containing the revision tree for the 599 Private method to generate an icon containing the revision tree for the
600 given data. 600 given data.
601 601
602 @param column column index of the revision 602 @param column column index of the revision
613 current revision 613 current revision
614 @type bool 614 @type bool
615 @param closed flag indicating to draw an icon for a closed 615 @param closed flag indicating to draw an icon for a closed
616 branch 616 branch
617 @type bool 617 @type bool
618 @param isDraft flag indicating an entry of phase 'draft' 618 @param isPushableDraft flag indicating an entry of phase 'draft',
619 that can by pushed
619 @type bool 620 @type bool
620 @return icon for the node 621 @return icon for the node
621 @rtype QIcon 622 @rtype QIcon
622 """ 623 """
623 def col2x(col, radius): 624 def col2x(col, radius):
690 QPoint(dot_x + offset, dot_y), 691 QPoint(dot_x + offset, dot_y),
691 QPoint(dot_x, dot_y + 2 * offset), 692 QPoint(dot_x, dot_y + 2 * offset),
692 QPoint(dot_x + 2 * offset, dot_y + 2 * offset) 693 QPoint(dot_x + 2 * offset, dot_y + 2 * offset)
693 ) 694 )
694 else: 695 else:
695 if isDraft: 696 if isPushableDraft:
696 # 'draft' phase: draw an up arrow like outgoing 697 # 'draft' phase: draw an up arrow like outgoing,
698 # if it can be pushed
697 offset = radius // 2 699 offset = radius // 2
698 painter.drawConvexPolygon( 700 painter.drawConvexPolygon(
699 QPoint(dot_x + offset, dot_y), 701 QPoint(dot_x + offset, dot_y),
700 QPoint(dot_x, dot_y + 2 * offset), 702 QPoint(dot_x, dot_y + 2 * offset),
701 QPoint(dot_x + 2 * offset, dot_y + 2 * offset) 703 QPoint(dot_x + 2 * offset, dot_y + 2 * offset)
857 859
858 return res 860 return res
859 861
860 def __generateLogItem(self, author, date, message, revision, changedPaths, 862 def __generateLogItem(self, author, date, message, revision, changedPaths,
861 parents, branches, tags, phase, bookmarks, 863 parents, branches, tags, phase, bookmarks,
862 latestTag): 864 latestTag, canPush=False):
863 """ 865 """
864 Private method to generate a log tree entry. 866 Private method to generate a log tree entry.
865 867
866 @param author author info (string) 868 @param author author info
867 @param date date info (string) 869 @type str
868 @param message text of the log message (list of strings) 870 @param date date info
869 @param revision revision info (string) 871 @type str
872 @param message text of the log message
873 @type list of str
874 @param revision revision info
875 @type str
870 @param changedPaths list of dictionary objects containing 876 @param changedPaths list of dictionary objects containing
871 info about the changed files/directories 877 info about the changed files/directories
872 @param parents list of parent revisions (list of integers) 878 @type dict
873 @param branches list of branches (list of strings) 879 @param parents list of parent revisions
874 @param tags list of tags (string) 880 @type list of int
875 @param phase phase of the entry (string) 881 @param branches list of branches
876 @param bookmarks list of bookmarks (string) 882 @type list of str
883 @param tags list of tags
884 @type str
885 @param phase phase of the entry
886 @type str
887 @param bookmarks list of bookmarks
888 @type str
877 @param latestTag the latest tag(s) reachable from the changeset 889 @param latestTag the latest tag(s) reachable from the changeset
878 (list of strings) 890 @type list of str
879 @return reference to the generated item (QTreeWidgetItem) 891 @param canPush flag indicating that changesets can be pushed
892 @type bool
893 @return reference to the generated item
894 @rtype QTreeWidgetItem
880 """ 895 """
881 logMessageColumnWidth = self.vcs.getPlugin().getPreferences( 896 logMessageColumnWidth = self.vcs.getPlugin().getPreferences(
882 "LogMessageColumnWidth") 897 "LogMessageColumnWidth")
883 msgtxt = "" 898 msgtxt = ""
884 for line in message: 899 for line in message:
943 958
944 icon = self.__generateIcon(column, color, edges, topedges, 959 icon = self.__generateIcon(column, color, edges, topedges,
945 QColor(self.__branchColor(branches[0])), 960 QColor(self.__branchColor(branches[0])),
946 rev in self.__projectWorkingDirParents, 961 rev in self.__projectWorkingDirParents,
947 rev in self.__closedBranchesRevs, 962 rev in self.__closedBranchesRevs,
948 phase == "draft") 963 phase == "draft" and canPush)
949 itm.setIcon(0, icon) 964 itm.setIcon(0, icon)
950 965
951 try: 966 try:
952 self.__lastRev = int(revision.split(":")[0]) 967 self.__lastRev = int(revision.split(":")[0])
953 except ValueError: 968 except ValueError:
1129 noEntries = 0 1144 noEntries = 0
1130 log = {"message": [], "bookmarks": None, "phase": ""} 1145 log = {"message": [], "bookmarks": None, "phase": ""}
1131 changedPaths = [] 1146 changedPaths = []
1132 initialText = True 1147 initialText = True
1133 fileCopies = {} 1148 fileCopies = {}
1149 canPush = self.vcs.canPush()
1134 for s in self.buf: 1150 for s in self.buf:
1135 if s != "@@@\n": 1151 if s != "@@@\n":
1136 try: 1152 try:
1137 key, value = s.split("|", 1) 1153 key, value = s.split("|", 1)
1138 except ValueError: 1154 except ValueError:
1218 if len(log) > 1: 1234 if len(log) > 1:
1219 self.__generateLogItem( 1235 self.__generateLogItem(
1220 log["author"], log["date"], 1236 log["author"], log["date"],
1221 log["message"], log["revision"], changedPaths, 1237 log["message"], log["revision"], changedPaths,
1222 log["parents"], log["branches"], log["tags"], 1238 log["parents"], log["branches"], log["tags"],
1223 log["phase"], log["bookmarks"], log["latesttag"]) 1239 log["phase"], log["bookmarks"], log["latesttag"],
1240 canPush=canPush)
1224 dt = QDate.fromString(log["date"], Qt.ISODate) 1241 dt = QDate.fromString(log["date"], Qt.ISODate)
1225 if ( 1242 if (
1226 not self.__maxDate.isValid() and 1243 not self.__maxDate.isValid() and
1227 not self.__minDate.isValid() 1244 not self.__minDate.isValid()
1228 ): 1245 ):

eric ide

mercurial