129 self.trUtf8("Bookmarks")) |
129 self.trUtf8("Bookmarks")) |
130 if self.vcs.version < (2, 1): |
130 if self.vcs.version < (2, 1): |
131 self.logTree.setColumnHidden(self.PhaseColumn, True) |
131 self.logTree.setColumnHidden(self.PhaseColumn, True) |
132 self.phaseLine.hide() |
132 self.phaseLine.hide() |
133 self.phaseButton.hide() |
133 self.phaseButton.hide() |
|
134 if self.vcs.version < (2, 0): |
|
135 self.graftButton.setEnabled(False) |
|
136 self.graftButton.hide() |
|
137 if self.phaseButton.isHidden() and \ |
|
138 self.graftButton.isHidden(): |
|
139 self.phaseLine.hide() |
134 |
140 |
135 def __initData(self): |
141 def __initData(self): |
136 """ |
142 """ |
137 Private method to (re-)initialize some data. |
143 Private method to (re-)initialize some data. |
138 """ |
144 """ |
455 E5MessageBox.critical(self, |
462 E5MessageBox.critical(self, |
456 self.trUtf8("Mercurial Error"), |
463 self.trUtf8("Mercurial Error"), |
457 errMsg) |
464 errMsg) |
458 |
465 |
459 if output: |
466 if output: |
460 self.__projectRevision = output.strip() |
467 outputList = output.strip().split() |
461 if self.__projectRevision.endswith("+"): |
468 if len(outputList) == 2: |
462 self.__projectRevision = self.__projectRevision[:-1] |
469 self.__projectRevision = outputList[0].strip() |
|
470 if self.__projectRevision.endswith("+"): |
|
471 self.__projectRevision = self.__projectRevision[:-1] |
|
472 self.__projectBranch = outputList[1].strip() |
463 |
473 |
464 def __getClosedBranches(self): |
474 def __getClosedBranches(self): |
465 """ |
475 """ |
466 Private method to get the list of closed branches. |
476 Private method to get the list of closed branches. |
467 """ |
477 """ |
1011 (secret == 0 and draft > 0)): |
1021 (secret == 0 and draft > 0)): |
1012 self.phaseButton.setEnabled(True) |
1022 self.phaseButton.setEnabled(True) |
1013 else: |
1023 else: |
1014 self.phaseButton.setEnabled(False) |
1024 self.phaseButton.setEnabled(False) |
1015 |
1025 |
|
1026 def __updateGraftButton(self): |
|
1027 """ |
|
1028 Private slot to update the status of the graft button. |
|
1029 """ |
|
1030 if self.graftButton.isVisible(): |
|
1031 # step 1: count selected entries not belonging to the current branch |
|
1032 otherBranches = 0 |
|
1033 for itm in self.logTree.selectedItems(): |
|
1034 branch = itm.text(self.BranchColumn) |
|
1035 if branch != self.__projectBranch: |
|
1036 otherBranches += 1 |
|
1037 |
|
1038 # step 2: set the status of the graft button |
|
1039 self.graftButton.setEnabled(otherBranches > 0) |
|
1040 |
1016 def __updateGui(self, itm): |
1041 def __updateGui(self, itm): |
1017 """ |
1042 """ |
1018 Private slot to update GUI elements except the diff and phase buttons. |
1043 Private slot to update GUI elements except the diff and phase buttons. |
1019 |
1044 |
1020 @param itm reference to the item the update should be based on (QTreeWidgetItem) |
1045 @param itm reference to the item the update should be based on (QTreeWidgetItem) |
1043 @param previous reference to the old current item (QTreeWidgetItem) |
1068 @param previous reference to the old current item (QTreeWidgetItem) |
1044 """ |
1069 """ |
1045 self.__updateGui(current) |
1070 self.__updateGui(current) |
1046 self.__updateDiffButtons() |
1071 self.__updateDiffButtons() |
1047 self.__updatePhaseButton() |
1072 self.__updatePhaseButton() |
|
1073 self.__updateGraftButton() |
1048 |
1074 |
1049 @pyqtSlot() |
1075 @pyqtSlot() |
1050 def on_logTree_itemSelectionChanged(self): |
1076 def on_logTree_itemSelectionChanged(self): |
1051 """ |
1077 """ |
1052 Private slot called, when the selection has changed. |
1078 Private slot called, when the selection has changed. |
1054 if len(self.logTree.selectedItems()) == 1: |
1080 if len(self.logTree.selectedItems()) == 1: |
1055 self.__updateGui(self.logTree.selectedItems()[0]) |
1081 self.__updateGui(self.logTree.selectedItems()[0]) |
1056 |
1082 |
1057 self.__updateDiffButtons() |
1083 self.__updateDiffButtons() |
1058 self.__updatePhaseButton() |
1084 self.__updatePhaseButton() |
|
1085 self.__updateGraftButton() |
1059 |
1086 |
1060 @pyqtSlot() |
1087 @pyqtSlot() |
1061 def on_nextButton_clicked(self): |
1088 def on_nextButton_clicked(self): |
1062 """ |
1089 """ |
1063 Private slot to handle the Next button. |
1090 Private slot to handle the Next button. |
1304 data = (revs, "d", False) |
1331 data = (revs, "d", False) |
1305 res = self.vcs.hgPhase(self.repodir, data) |
1332 res = self.vcs.hgPhase(self.repodir, data) |
1306 if res: |
1333 if res: |
1307 for itm in self.logTree.selectedItems(): |
1334 for itm in self.logTree.selectedItems(): |
1308 itm.setText(self.PhaseColumn, newPhase) |
1335 itm.setText(self.PhaseColumn, newPhase) |
|
1336 |
|
1337 @pyqtSlot() |
|
1338 def on_graftButton_clicked(self): |
|
1339 """ |
|
1340 Private slot to handle the Copy Changesets button. |
|
1341 """ |
|
1342 revs = [] |
|
1343 |
|
1344 for itm in self.logTree.selectedItems(): |
|
1345 branch = itm.text(self.BranchColumn) |
|
1346 if branch != self.__projectBranch: |
|
1347 revs.append(itm.text(self.RevisionColumn).strip().split(":", 1)[0]) |
|
1348 |
|
1349 if revs: |
|
1350 shouldReopen = self.vcs.hgGraft(self.repodir, revs) |
|
1351 if shouldReopen: |
|
1352 res = E5MessageBox.yesNo(None, |
|
1353 self.trUtf8("Copy Changesets"), |
|
1354 self.trUtf8("""The project should be reread. Do this now?"""), |
|
1355 yesDefault=True) |
|
1356 if res: |
|
1357 e5App().getObject("Project").reopenProject() |
|
1358 else: |
|
1359 self.on_refreshButton_clicked() |