Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2911
ce77f0b1ee67
parent 3008
7848489bcb92
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
45 AuthorColumn = 4 45 AuthorColumn = 4
46 DateColumn = 5 46 DateColumn = 5
47 MessageColumn = 6 47 MessageColumn = 6
48 TagsColumn = 7 48 TagsColumn = 7
49 49
50 def __init__(self, vcs, mode="log", bundle=None, isFile=False, parent=None): 50 def __init__(self, vcs, mode="log", bundle=None, isFile=False,
51 parent=None):
51 """ 52 """
52 Constructor 53 Constructor
53 54
54 @param vcs reference to the vcs object 55 @param vcs reference to the vcs object
55 @param mode mode of the dialog (string; one of log, incoming, outgoing) 56 @param mode mode of the dialog (string; one of log, incoming, outgoing)
71 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 72 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
72 73
73 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") 74 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
74 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) 75 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
75 76
76 self.refreshButton = \ 77 self.refreshButton = self.buttonBox.addButton(
77 self.buttonBox.addButton(self.trUtf8("&Refresh"), QDialogButtonBox.ActionRole) 78 self.trUtf8("&Refresh"), QDialogButtonBox.ActionRole)
78 self.refreshButton.setToolTip( 79 self.refreshButton.setToolTip(
79 self.trUtf8("Press to refresh the list of changesets")) 80 self.trUtf8("Press to refresh the list of changesets"))
80 self.refreshButton.setEnabled(False) 81 self.refreshButton.setEnabled(False)
81 82
82 self.sbsCheckBox.setEnabled(isFile) 83 self.sbsCheckBox.setEnabled(isFile)
393 args.append("parents") 394 args.append("parents")
394 if self.commandMode == "incoming": 395 if self.commandMode == "incoming":
395 if self.bundle: 396 if self.bundle:
396 args.append("--repository") 397 args.append("--repository")
397 args.append(self.bundle) 398 args.append(self.bundle)
398 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile): 399 elif self.vcs.bundleFile and \
400 os.path.exists(self.vcs.bundleFile):
399 args.append("--repository") 401 args.append("--repository")
400 args.append(self.vcs.bundleFile) 402 args.append(self.vcs.bundleFile)
401 args.append("--template") 403 args.append("--template")
402 args.append("{rev}\n") 404 args.append("{rev}\n")
403 args.append("-r") 405 args.append("-r")
664 if self.commandMode == "log": 666 if self.commandMode == "log":
665 args.append('--copies') 667 args.append('--copies')
666 args.append('--style') 668 args.append('--style')
667 if self.vcs.version >= (2, 1): 669 if self.vcs.version >= (2, 1):
668 args.append(os.path.join(os.path.dirname(__file__), 670 args.append(os.path.join(os.path.dirname(__file__),
669 "styles", "logBrowserBookmarkPhase.style")) 671 "styles",
672 "logBrowserBookmarkPhase.style"))
670 elif self.vcs.version >= (1, 8): 673 elif self.vcs.version >= (1, 8):
671 args.append(os.path.join(os.path.dirname(__file__), 674 args.append(os.path.join(os.path.dirname(__file__),
672 "styles", "logBrowserBookmark.style")) 675 "styles",
676 "logBrowserBookmark.style"))
673 else: 677 else:
674 args.append(os.path.join(os.path.dirname(__file__), 678 args.append(os.path.join(os.path.dirname(__file__),
675 "styles", "logBrowser.style")) 679 "styles",
680 "logBrowser.style"))
676 if self.commandMode == "incoming": 681 if self.commandMode == "incoming":
677 if self.bundle: 682 if self.bundle:
678 args.append(self.bundle) 683 args.append(self.bundle)
679 elif not self.vcs.hasSubrepositories(): 684 elif not self.vcs.hasSubrepositories():
680 project = e5App().getObject("Project") 685 project = e5App().getObject("Project")
1049 """ 1054 """
1050 Private slot to update the status of the graft button. 1055 Private slot to update the status of the graft button.
1051 """ 1056 """
1052 if self.graftButton.isVisible(): 1057 if self.graftButton.isVisible():
1053 if self.initialCommandMode == "log": 1058 if self.initialCommandMode == "log":
1054 # step 1: count selected entries not belonging to the current branch 1059 # step 1: count selected entries not belonging to the
1060 # current branch
1055 otherBranches = 0 1061 otherBranches = 0
1056 for itm in self.logTree.selectedItems(): 1062 for itm in self.logTree.selectedItems():
1057 branch = itm.text(self.BranchColumn) 1063 branch = itm.text(self.BranchColumn)
1058 if branch != self.__projectBranch: 1064 if branch != self.__projectBranch:
1059 otherBranches += 1 1065 otherBranches += 1
1065 1071
1066 def __updateGui(self, itm): 1072 def __updateGui(self, itm):
1067 """ 1073 """
1068 Private slot to update GUI elements except the diff and phase buttons. 1074 Private slot to update GUI elements except the diff and phase buttons.
1069 1075
1070 @param itm reference to the item the update should be based on (QTreeWidgetItem) 1076 @param itm reference to the item the update should be based on
1077 (QTreeWidgetItem)
1071 """ 1078 """
1072 self.messageEdit.clear() 1079 self.messageEdit.clear()
1073 self.filesTree.clear() 1080 self.filesTree.clear()
1074 1081
1075 if itm is not None: 1082 if itm is not None:
1261 self.filesTree.clear() 1268 self.filesTree.clear()
1262 1269
1263 @pyqtSlot(bool) 1270 @pyqtSlot(bool)
1264 def on_stopCheckBox_clicked(self, checked): 1271 def on_stopCheckBox_clicked(self, checked):
1265 """ 1272 """
1266 Private slot called, when the stop on copy/move checkbox is clicked 1273 Private slot called, when the stop on copy/move checkbox is clicked.
1274
1275 @param checked flag indicating the state of the check box (boolean)
1267 """ 1276 """
1268 self.vcs.getPlugin().setPreferences("StopLogOnCopy", 1277 self.vcs.getPlugin().setPreferences("StopLogOnCopy",
1269 self.stopCheckBox.isChecked()) 1278 self.stopCheckBox.isChecked())
1270 self.nextButton.setEnabled(True) 1279 self.nextButton.setEnabled(True)
1271 self.limitSpinBox.setEnabled(True) 1280 self.limitSpinBox.setEnabled(True)
1346 """ 1355 """
1347 currentPhase = self.logTree.selectedItems()[0].text(self.PhaseColumn) 1356 currentPhase = self.logTree.selectedItems()[0].text(self.PhaseColumn)
1348 revs = [] 1357 revs = []
1349 for itm in self.logTree.selectedItems(): 1358 for itm in self.logTree.selectedItems():
1350 if itm.text(self.PhaseColumn) == currentPhase: 1359 if itm.text(self.PhaseColumn) == currentPhase:
1351 revs.append(itm.text(self.RevisionColumn).split(":")[0].strip()) 1360 revs.append(
1361 itm.text(self.RevisionColumn).split(":")[0].strip())
1352 1362
1353 if not revs: 1363 if not revs:
1354 self.phaseButton.setEnabled(False) 1364 self.phaseButton.setEnabled(False)
1355 return 1365 return
1356 1366
1373 revs = [] 1383 revs = []
1374 1384
1375 for itm in self.logTree.selectedItems(): 1385 for itm in self.logTree.selectedItems():
1376 branch = itm.text(self.BranchColumn) 1386 branch = itm.text(self.BranchColumn)
1377 if branch != self.__projectBranch: 1387 if branch != self.__projectBranch:
1378 revs.append(itm.text(self.RevisionColumn).strip().split(":", 1)[0]) 1388 revs.append(
1389 itm.text(self.RevisionColumn).strip().split(":", 1)[0])
1379 1390
1380 if revs: 1391 if revs:
1381 shouldReopen = self.vcs.hgGraft(self.repodir, revs) 1392 shouldReopen = self.vcs.hgGraft(self.repodir, revs)
1382 if shouldReopen: 1393 if shouldReopen:
1383 res = E5MessageBox.yesNo(None, 1394 res = E5MessageBox.yesNo(None,
1384 self.trUtf8("Copy Changesets"), 1395 self.trUtf8("Copy Changesets"),
1385 self.trUtf8("""The project should be reread. Do this now?"""), 1396 self.trUtf8(
1397 """The project should be reread. Do this now?"""),
1386 yesDefault=True) 1398 yesDefault=True)
1387 if res: 1399 if res:
1388 e5App().getObject("Project").reopenProject() 1400 e5App().getObject("Project").reopenProject()
1389 else: 1401 else:
1390 self.on_refreshButton_clicked() 1402 self.on_refreshButton_clicked()

eric ide

mercurial