Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 3008
7848489bcb92
parent 2962
d6c9d1ca2da4
child 3020
542e97d4ecb3
child 3057
10516539f238
equal deleted inserted replaced
3007:bad2e89047e7 3008:7848489bcb92
39 AuthorColumn = 4 39 AuthorColumn = 4
40 DateColumn = 5 40 DateColumn = 5
41 MessageColumn = 6 41 MessageColumn = 6
42 TagsColumn = 7 42 TagsColumn = 7
43 43
44 def __init__(self, vcs, mode="log", bundle=None, isFile=False, parent=None): 44 def __init__(self, vcs, mode="log", bundle=None, isFile=False,
45 parent=None):
45 """ 46 """
46 Constructor 47 Constructor
47 48
48 @param vcs reference to the vcs object 49 @param vcs reference to the vcs object
49 @param mode mode of the dialog (string; one of log, incoming, outgoing) 50 @param mode mode of the dialog (string; one of log, incoming, outgoing)
65 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 66 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
66 67
67 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") 68 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "")
68 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) 69 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder)
69 70
70 self.refreshButton = \ 71 self.refreshButton = self.buttonBox.addButton(
71 self.buttonBox.addButton(self.trUtf8("&Refresh"), QDialogButtonBox.ActionRole) 72 self.trUtf8("&Refresh"), QDialogButtonBox.ActionRole)
72 self.refreshButton.setToolTip( 73 self.refreshButton.setToolTip(
73 self.trUtf8("Press to refresh the list of changesets")) 74 self.trUtf8("Press to refresh the list of changesets"))
74 self.refreshButton.setEnabled(False) 75 self.refreshButton.setEnabled(False)
75 76
76 self.sbsCheckBox.setEnabled(isFile) 77 self.sbsCheckBox.setEnabled(isFile)
387 args.append("parents") 388 args.append("parents")
388 if self.commandMode == "incoming": 389 if self.commandMode == "incoming":
389 if self.bundle: 390 if self.bundle:
390 args.append("--repository") 391 args.append("--repository")
391 args.append(self.bundle) 392 args.append(self.bundle)
392 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile): 393 elif self.vcs.bundleFile and \
394 os.path.exists(self.vcs.bundleFile):
393 args.append("--repository") 395 args.append("--repository")
394 args.append(self.vcs.bundleFile) 396 args.append(self.vcs.bundleFile)
395 args.append("--template") 397 args.append("--template")
396 args.append("{rev}\n") 398 args.append("{rev}\n")
397 args.append("-r") 399 args.append("-r")
658 if self.commandMode == "log": 660 if self.commandMode == "log":
659 args.append('--copies') 661 args.append('--copies')
660 args.append('--style') 662 args.append('--style')
661 if self.vcs.version >= (2, 1): 663 if self.vcs.version >= (2, 1):
662 args.append(os.path.join(os.path.dirname(__file__), 664 args.append(os.path.join(os.path.dirname(__file__),
663 "styles", "logBrowserBookmarkPhase.style")) 665 "styles",
666 "logBrowserBookmarkPhase.style"))
664 elif self.vcs.version >= (1, 8): 667 elif self.vcs.version >= (1, 8):
665 args.append(os.path.join(os.path.dirname(__file__), 668 args.append(os.path.join(os.path.dirname(__file__),
666 "styles", "logBrowserBookmark.style")) 669 "styles",
670 "logBrowserBookmark.style"))
667 else: 671 else:
668 args.append(os.path.join(os.path.dirname(__file__), 672 args.append(os.path.join(os.path.dirname(__file__),
669 "styles", "logBrowser.style")) 673 "styles",
674 "logBrowser.style"))
670 if self.commandMode == "incoming": 675 if self.commandMode == "incoming":
671 if self.bundle: 676 if self.bundle:
672 args.append(self.bundle) 677 args.append(self.bundle)
673 elif not self.vcs.hasSubrepositories(): 678 elif not self.vcs.hasSubrepositories():
674 project = e5App().getObject("Project") 679 project = e5App().getObject("Project")
1043 """ 1048 """
1044 Private slot to update the status of the graft button. 1049 Private slot to update the status of the graft button.
1045 """ 1050 """
1046 if self.graftButton.isVisible(): 1051 if self.graftButton.isVisible():
1047 if self.initialCommandMode == "log": 1052 if self.initialCommandMode == "log":
1048 # step 1: count selected entries not belonging to the current branch 1053 # step 1: count selected entries not belonging to the
1054 # current branch
1049 otherBranches = 0 1055 otherBranches = 0
1050 for itm in self.logTree.selectedItems(): 1056 for itm in self.logTree.selectedItems():
1051 branch = itm.text(self.BranchColumn) 1057 branch = itm.text(self.BranchColumn)
1052 if branch != self.__projectBranch: 1058 if branch != self.__projectBranch:
1053 otherBranches += 1 1059 otherBranches += 1
1059 1065
1060 def __updateGui(self, itm): 1066 def __updateGui(self, itm):
1061 """ 1067 """
1062 Private slot to update GUI elements except the diff and phase buttons. 1068 Private slot to update GUI elements except the diff and phase buttons.
1063 1069
1064 @param itm reference to the item the update should be based on (QTreeWidgetItem) 1070 @param itm reference to the item the update should be based on
1071 (QTreeWidgetItem)
1065 """ 1072 """
1066 self.messageEdit.clear() 1073 self.messageEdit.clear()
1067 self.filesTree.clear() 1074 self.filesTree.clear()
1068 1075
1069 if itm is not None: 1076 if itm is not None:
1342 """ 1349 """
1343 currentPhase = self.logTree.selectedItems()[0].text(self.PhaseColumn) 1350 currentPhase = self.logTree.selectedItems()[0].text(self.PhaseColumn)
1344 revs = [] 1351 revs = []
1345 for itm in self.logTree.selectedItems(): 1352 for itm in self.logTree.selectedItems():
1346 if itm.text(self.PhaseColumn) == currentPhase: 1353 if itm.text(self.PhaseColumn) == currentPhase:
1347 revs.append(itm.text(self.RevisionColumn).split(":")[0].strip()) 1354 revs.append(
1355 itm.text(self.RevisionColumn).split(":")[0].strip())
1348 1356
1349 if not revs: 1357 if not revs:
1350 self.phaseButton.setEnabled(False) 1358 self.phaseButton.setEnabled(False)
1351 return 1359 return
1352 1360
1369 revs = [] 1377 revs = []
1370 1378
1371 for itm in self.logTree.selectedItems(): 1379 for itm in self.logTree.selectedItems():
1372 branch = itm.text(self.BranchColumn) 1380 branch = itm.text(self.BranchColumn)
1373 if branch != self.__projectBranch: 1381 if branch != self.__projectBranch:
1374 revs.append(itm.text(self.RevisionColumn).strip().split(":", 1)[0]) 1382 revs.append(
1383 itm.text(self.RevisionColumn).strip().split(":", 1)[0])
1375 1384
1376 if revs: 1385 if revs:
1377 shouldReopen = self.vcs.hgGraft(self.repodir, revs) 1386 shouldReopen = self.vcs.hgGraft(self.repodir, revs)
1378 if shouldReopen: 1387 if shouldReopen:
1379 res = E5MessageBox.yesNo(None, 1388 res = E5MessageBox.yesNo(None,
1380 self.trUtf8("Copy Changesets"), 1389 self.trUtf8("Copy Changesets"),
1381 self.trUtf8("""The project should be reread. Do this now?"""), 1390 self.trUtf8(
1391 """The project should be reread. Do this now?"""),
1382 yesDefault=True) 1392 yesDefault=True)
1383 if res: 1393 if res:
1384 e5App().getObject("Project").reopenProject() 1394 e5App().getObject("Project").reopenProject()
1385 else: 1395 else:
1386 self.on_refreshButton_clicked() 1396 self.on_refreshButton_clicked()

eric ide

mercurial