src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py

branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9573
9960d19d66b5
equal deleted inserted replaced
9481:0b936ff1bbb9 9482:a2bc06a54d9d
49 49
50 @param plugin reference to the plugin object 50 @param plugin reference to the plugin object
51 @param parent parent widget (QWidget) 51 @param parent parent widget (QWidget)
52 @param name name of this object (string) 52 @param name name of this object (string)
53 """ 53 """
54 from .CloseheadExtension.closehead import Closehead
55 from .GpgExtension.gpg import Gpg
56 from .HgUtilities import getConfigPath
57 from .HisteditExtension.histedit import Histedit
58 from .LargefilesExtension.largefiles import Largefiles
59 from .PurgeExtension.purge import Purge
60 from .QueuesExtension.queues import Queues
61 from .RebaseExtension.rebase import Rebase
62 from .ShelveExtension.shelve import Shelve
63 from .StripExtension.strip import Strip
64
54 VersionControl.__init__(self, parent, name) 65 VersionControl.__init__(self, parent, name)
55 self.defaultOptions = { 66 self.defaultOptions = {
56 "global": [""], 67 "global": [""],
57 "commit": [""], 68 "commit": [""],
58 "checkout": [""], 69 "checkout": [""],
115 126
116 self.__forgotNames = [] 127 self.__forgotNames = []
117 128
118 self.__activeExtensions = [] 129 self.__activeExtensions = []
119 130
120 from .HgUtilities import getConfigPath
121
122 self.__iniWatcher = QFileSystemWatcher(self) 131 self.__iniWatcher = QFileSystemWatcher(self)
123 self.__iniWatcher.fileChanged.connect(self.__iniFileChanged) 132 self.__iniWatcher.fileChanged.connect(self.__iniFileChanged)
124 cfgFile = getConfigPath() 133 cfgFile = getConfigPath()
125 if os.path.exists(cfgFile): 134 if os.path.exists(cfgFile):
126 self.__iniWatcher.addPath(cfgFile) 135 self.__iniWatcher.addPath(cfgFile)
133 self.__repoIniFile = "" 142 self.__repoIniFile = ""
134 self.__defaultConfigured = False 143 self.__defaultConfigured = False
135 self.__defaultPushConfigured = False 144 self.__defaultPushConfigured = False
136 145
137 # instantiate the extensions 146 # instantiate the extensions
138 from .CloseheadExtension.closehead import Closehead
139 from .GpgExtension.gpg import Gpg
140 from .HisteditExtension.histedit import Histedit
141 from .LargefilesExtension.largefiles import Largefiles
142 from .PurgeExtension.purge import Purge
143 from .QueuesExtension.queues import Queues
144 from .RebaseExtension.rebase import Rebase
145 from .ShelveExtension.shelve import Shelve
146 from .StripExtension.strip import Strip
147
148 self.__extensions = { 147 self.__extensions = {
149 "mq": Queues(self), 148 "mq": Queues(self),
150 "purge": Purge(self), 149 "purge": Purge(self),
151 "gpg": Gpg(self), 150 "gpg": Gpg(self),
152 "rebase": Rebase(self), 151 "rebase": Rebase(self),
398 @param noDialog flag indicating quiet operations 397 @param noDialog flag indicating quiet operations
399 @param closeBranch flag indicating a close branch commit (boolean) 398 @param closeBranch flag indicating a close branch commit (boolean)
400 @param mq flag indicating a queue commit (boolean) 399 @param mq flag indicating a queue commit (boolean)
401 @param merge flag indicating a merge commit (boolean) 400 @param merge flag indicating a merge commit (boolean)
402 """ 401 """
402 from .HgCommitDialog import HgCommitDialog
403
403 msg = message 404 msg = message
404 405
405 if mq or merge: 406 if mq or merge:
406 # ensure dialog is shown for a queue commit 407 # ensure dialog is shown for a queue commit
407 noDialog = False 408 noDialog = False
408 409
409 if not noDialog: 410 if not noDialog:
410 # call CommitDialog and get message from there 411 # call CommitDialog and get message from there
411 if self.__commitDialog is None: 412 if self.__commitDialog is None:
412 from .HgCommitDialog import HgCommitDialog
413
414 self.__commitDialog = HgCommitDialog(self, msg, mq, merge, self.__ui) 413 self.__commitDialog = HgCommitDialog(self, msg, mq, merge, self.__ui)
415 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2) 414 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2)
416 self.__commitDialog.show() 415 self.__commitDialog.show()
417 self.__commitDialog.raise_() 416 self.__commitDialog.raise_()
418 self.__commitDialog.activateWindow() 417 self.__commitDialog.activateWindow()
721 @param project reference to the project object 720 @param project reference to the project object
722 @param target new name of the file/directory (string) 721 @param target new name of the file/directory (string)
723 @param noDialog flag indicating quiet operations 722 @param noDialog flag indicating quiet operations
724 @return flag indicating successfull operation (boolean) 723 @return flag indicating successfull operation (boolean)
725 """ 724 """
725 from .HgCopyDialog import HgCopyDialog
726
726 isDir = os.path.isdir(name) 727 isDir = os.path.isdir(name)
727 728
728 res = False 729 res = False
729 if noDialog: 730 if noDialog:
730 if target is None: 731 if target is None:
731 return False 732 return False
732 force = True 733 force = True
733 accepted = True 734 accepted = True
734 else: 735 else:
735 from .HgCopyDialog import HgCopyDialog
736
737 dlg = HgCopyDialog(name, None, True) 736 dlg = HgCopyDialog(name, None, True)
738 accepted = dlg.exec() == QDialog.DialogCode.Accepted 737 accepted = dlg.exec() == QDialog.DialogCode.Accepted
739 if accepted: 738 if accepted:
740 target, force = dlg.getData() 739 target, force = dlg.getData()
741 740
779 being edited and has unsaved modification, they can be saved or the 778 being edited and has unsaved modification, they can be saved or the
780 operation may be aborted. 779 operation may be aborted.
781 780
782 @param name file/directory name to be diffed (string) 781 @param name file/directory name to be diffed (string)
783 """ 782 """
783 from .HgDiffDialog import HgDiffDialog
784
784 names = name[:] if isinstance(name, list) else [name] 785 names = name[:] if isinstance(name, list) else [name]
785 for nam in names: 786 for nam in names:
786 if os.path.isfile(nam): 787 if os.path.isfile(nam):
787 editor = ericApp().getObject("ViewManager").getOpenEditor(nam) 788 editor = ericApp().getObject("ViewManager").getOpenEditor(nam)
788 if editor and not editor.checkDirty(): 789 if editor and not editor.checkDirty():
790 else: 791 else:
791 project = ericApp().getObject("Project") 792 project = ericApp().getObject("Project")
792 if nam == project.ppath and not project.saveAllScripts(): 793 if nam == project.ppath and not project.saveAllScripts():
793 return 794 return
794 if self.diff is None: 795 if self.diff is None:
795 from .HgDiffDialog import HgDiffDialog
796
797 self.diff = HgDiffDialog(self) 796 self.diff = HgDiffDialog(self)
798 self.diff.show() 797 self.diff.show()
799 self.diff.raise_() 798 self.diff.raise_()
800 QApplication.processEvents() 799 QApplication.processEvents()
801 self.diff.start(name, refreshable=True) 800 self.diff.start(name, refreshable=True)
806 Mercurial repository. 805 Mercurial repository.
807 806
808 @param name file/directory name(s) to show the status of 807 @param name file/directory name(s) to show the status of
809 (string or list of strings) 808 (string or list of strings)
810 """ 809 """
810 from .HgStatusDialog import HgStatusDialog
811
811 if self.status is None: 812 if self.status is None:
812 from .HgStatusDialog import HgStatusDialog
813
814 self.status = HgStatusDialog(self) 813 self.status = HgStatusDialog(self)
815 self.status.show() 814 self.status.show()
816 self.status.raise_() 815 self.status.raise_()
817 self.status.start(name) 816 self.status.start(name)
818 817
823 822
824 @param mq flag indicating to show the queue status as well (boolean) 823 @param mq flag indicating to show the queue status as well (boolean)
825 @param largefiles flag indicating to show the largefiles status as 824 @param largefiles flag indicating to show the largefiles status as
826 well (boolean) 825 well (boolean)
827 """ 826 """
827 from .HgSummaryDialog import HgSummaryDialog
828
828 if self.summary is None: 829 if self.summary is None:
829 from .HgSummaryDialog import HgSummaryDialog
830
831 self.summary = HgSummaryDialog(self) 830 self.summary = HgSummaryDialog(self)
832 self.summary.show() 831 self.summary.show()
833 self.summary.raise_() 832 self.summary.raise_()
834 self.summary.start(mq=mq, largefiles=largefiles) 833 self.summary.start(mq=mq, largefiles=largefiles)
835 834
891 @type str 890 @type str
892 @return flag indicating, that the update contained an add 891 @return flag indicating, that the update contained an add
893 or delete 892 or delete
894 @rtype bool 893 @rtype bool
895 """ 894 """
895 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
896
896 args = self.initCommand("revert") 897 args = self.initCommand("revert")
897 if not self.getPlugin().getPreferences("CreateBackup"): 898 if not self.getPlugin().getPreferences("CreateBackup"):
898 args.append("--no-backup") 899 args.append("--no-backup")
899 args.append("-v") 900 args.append("-v")
900 if isinstance(name, list): 901 if isinstance(name, list):
905 names = [name] 906 names = [name]
906 907
907 project = ericApp().getObject("Project") 908 project = ericApp().getObject("Project")
908 names = [project.getRelativePath(nam) for nam in names] 909 names = [project.getRelativePath(nam) for nam in names]
909 if names[0]: 910 if names[0]:
910 from eric7.UI.DeleteFilesConfirmationDialog import (
911 DeleteFilesConfirmationDialog,
912 )
913
914 dlg = DeleteFilesConfirmationDialog( 911 dlg = DeleteFilesConfirmationDialog(
915 self.parent(), 912 self.parent(),
916 self.tr("Revert changes"), 913 self.tr("Revert changes"),
917 self.tr( 914 self.tr(
918 "Do you really want to revert all changes to these files" 915 "Do you really want to revert all changes to these files"
949 @param name file/directory name to be merged 946 @param name file/directory name to be merged
950 @type str 947 @type str
951 @param rev revision to merge with 948 @param rev revision to merge with
952 @type str 949 @type str
953 """ 950 """
951 from .HgMergeDialog import HgMergeDialog
952
954 if not rev: 953 if not rev:
955 from .HgMergeDialog import HgMergeDialog
956
957 dlg = HgMergeDialog( 954 dlg = HgMergeDialog(
958 self.hgGetTagsList(), 955 self.hgGetTagsList(),
959 self.hgGetBranchesList(), 956 self.hgGetBranchesList(),
960 self.hgGetBookmarksList(), 957 self.hgGetBookmarksList(),
961 ) 958 )
986 """ 983 """
987 Public method used to merge a URL/revision into the local project. 984 Public method used to merge a URL/revision into the local project.
988 985
989 @param name file/directory name to be merged (string) 986 @param name file/directory name to be merged (string)
990 """ 987 """
988 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
989
991 args = self.initCommand("resolve") 990 args = self.initCommand("resolve")
992 if self.getPlugin().getPreferences("InternalMerge"): 991 if self.getPlugin().getPreferences("InternalMerge"):
993 args.append("--tool") 992 args.append("--tool")
994 args.append("internal:merge") 993 args.append("internal:merge")
995 if isinstance(name, list): 994 if isinstance(name, list):
1000 names = [name] 999 names = [name]
1001 1000
1002 project = ericApp().getObject("Project") 1001 project = ericApp().getObject("Project")
1003 names = [project.getRelativePath(nam) for nam in names] 1002 names = [project.getRelativePath(nam) for nam in names]
1004 if names[0]: 1003 if names[0]:
1005 from eric7.UI.DeleteFilesConfirmationDialog import (
1006 DeleteFilesConfirmationDialog,
1007 )
1008
1009 dlg = DeleteFilesConfirmationDialog( 1004 dlg = DeleteFilesConfirmationDialog(
1010 self.parent(), 1005 self.parent(),
1011 self.tr("Re-Merge"), 1006 self.tr("Re-Merge"),
1012 self.tr( 1007 self.tr(
1013 "Do you really want to re-merge these files" " or directories?" 1008 "Do you really want to re-merge these files" " or directories?"
1484 @param name file name to show the annotations for 1479 @param name file name to show the annotations for
1485 @type str 1480 @type str
1486 @param skiplist name of a skip list file 1481 @param skiplist name of a skip list file
1487 @type str 1482 @type str
1488 """ 1483 """
1484 from .HgAnnotateDialog import HgAnnotateDialog
1485
1489 if self.annotate is None: 1486 if self.annotate is None:
1490 from .HgAnnotateDialog import HgAnnotateDialog
1491
1492 self.annotate = HgAnnotateDialog(self) 1487 self.annotate = HgAnnotateDialog(self)
1493 self.annotate.show() 1488 self.annotate.show()
1494 self.annotate.raise_() 1489 self.annotate.raise_()
1495 self.annotate.start(name, skiplist=skiplist) 1490 self.annotate.start(name, skiplist=skiplist)
1496 1491
1506 1501
1507 This method gives the chance to enter the revisions to be compared. 1502 This method gives the chance to enter the revisions to be compared.
1508 1503
1509 @param name file/directory name to be diffed (string) 1504 @param name file/directory name to be diffed (string)
1510 """ 1505 """
1506 from .HgDiffDialog import HgDiffDialog
1507 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog
1508
1511 names = name[:] if isinstance(name, list) else [name] 1509 names = name[:] if isinstance(name, list) else [name]
1512 for nam in names: 1510 for nam in names:
1513 if os.path.isfile(nam): 1511 if os.path.isfile(nam):
1514 editor = ericApp().getObject("ViewManager").getOpenEditor(nam) 1512 editor = ericApp().getObject("ViewManager").getOpenEditor(nam)
1515 if editor and not editor.checkDirty(): 1513 if editor and not editor.checkDirty():
1517 else: 1515 else:
1518 project = ericApp().getObject("Project") 1516 project = ericApp().getObject("Project")
1519 if nam == project.ppath and not project.saveAllScripts(): 1517 if nam == project.ppath and not project.saveAllScripts():
1520 return 1518 return
1521 1519
1522 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog
1523
1524 dlg = HgRevisionsSelectionDialog( 1520 dlg = HgRevisionsSelectionDialog(
1525 self.hgGetTagsList(), 1521 self.hgGetTagsList(),
1526 self.hgGetBranchesList(), 1522 self.hgGetBranchesList(),
1527 bookmarksList=self.hgGetBookmarksList(), 1523 bookmarksList=self.hgGetBookmarksList(),
1528 ) 1524 )
1529 if dlg.exec() == QDialog.DialogCode.Accepted: 1525 if dlg.exec() == QDialog.DialogCode.Accepted:
1530 revisions = dlg.getRevisions() 1526 revisions = dlg.getRevisions()
1531 if self.diff is None: 1527 if self.diff is None:
1532 from .HgDiffDialog import HgDiffDialog
1533
1534 self.diff = HgDiffDialog(self) 1528 self.diff = HgDiffDialog(self)
1535 self.diff.show() 1529 self.diff.show()
1536 self.diff.raise_() 1530 self.diff.raise_()
1537 self.diff.start(name, revisions) 1531 self.diff.start(name, revisions)
1538 1532
1564 @param name file name to be diffed (string) 1558 @param name file name to be diffed (string)
1565 @param extended flag indicating the extended variant (boolean) 1559 @param extended flag indicating the extended variant (boolean)
1566 @param revisions tuple of two revisions (tuple of strings) 1560 @param revisions tuple of two revisions (tuple of strings)
1567 @exception ValueError raised to indicate an invalid name parameter 1561 @exception ValueError raised to indicate an invalid name parameter
1568 """ 1562 """
1563 from eric7.UI.CompareDialog import CompareDialog
1564
1565 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog
1566
1569 if isinstance(name, list): 1567 if isinstance(name, list):
1570 raise ValueError("Wrong parameter type") 1568 raise ValueError("Wrong parameter type")
1571 1569
1572 if extended: 1570 if extended:
1573 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog
1574
1575 dlg = HgRevisionsSelectionDialog( 1571 dlg = HgRevisionsSelectionDialog(
1576 self.hgGetTagsList(), 1572 self.hgGetTagsList(),
1577 self.hgGetBranchesList(), 1573 self.hgGetBranchesList(),
1578 bookmarksList=self.hgGetBookmarksList(), 1574 bookmarksList=self.hgGetBookmarksList(),
1579 ) 1575 )
1616 ), 1612 ),
1617 ) 1613 )
1618 return 1614 return
1619 1615
1620 if self.sbsDiff is None: 1616 if self.sbsDiff is None:
1621 from eric7.UI.CompareDialog import CompareDialog
1622
1623 self.sbsDiff = CompareDialog() 1617 self.sbsDiff = CompareDialog()
1624 self.sbsDiff.show() 1618 self.sbsDiff.show()
1625 self.sbsDiff.raise_() 1619 self.sbsDiff.raise_()
1626 self.sbsDiff.compare(output1, output2, name1, name2) 1620 self.sbsDiff.compare(output1, output2, name1, name2)
1627 1621
1632 1626
1633 @param name file/directory name to show the log of (string) 1627 @param name file/directory name to show the log of (string)
1634 @param isFile flag indicating log for a file is to be shown 1628 @param isFile flag indicating log for a file is to be shown
1635 (boolean) 1629 (boolean)
1636 """ 1630 """
1631 from .HgLogBrowserDialog import HgLogBrowserDialog
1632
1637 if name == self.getClient().getRepository(): 1633 if name == self.getClient().getRepository():
1638 name = None 1634 name = None
1639 1635
1640 if self.logBrowser is None: 1636 if self.logBrowser is None:
1641 from .HgLogBrowserDialog import HgLogBrowserDialog
1642
1643 self.logBrowser = HgLogBrowserDialog(self) 1637 self.logBrowser = HgLogBrowserDialog(self)
1644 self.logBrowser.show() 1638 self.logBrowser.show()
1645 self.logBrowser.raise_() 1639 self.logBrowser.raise_()
1646 self.logBrowser.start(name=name, isFile=isFile) 1640 self.logBrowser.start(name=name, isFile=isFile)
1647 1641
1648 def hgIncoming(self): 1642 def hgIncoming(self):
1649 """ 1643 """
1650 Public method used to view the log of incoming changes from the 1644 Public method used to view the log of incoming changes from the
1651 Mercurial repository. 1645 Mercurial repository.
1652 """ 1646 """
1647 from .HgLogBrowserDialog import HgLogBrowserDialog
1648
1653 if self.logBrowserIncoming is None: 1649 if self.logBrowserIncoming is None:
1654 from .HgLogBrowserDialog import HgLogBrowserDialog
1655
1656 self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming") 1650 self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming")
1657 self.logBrowserIncoming.show() 1651 self.logBrowserIncoming.show()
1658 self.logBrowserIncoming.raise_() 1652 self.logBrowserIncoming.raise_()
1659 self.logBrowserIncoming.start() 1653 self.logBrowserIncoming.start()
1660 1654
1661 def hgOutgoing(self): 1655 def hgOutgoing(self):
1662 """ 1656 """
1663 Public method used to view the log of outgoing changes from the 1657 Public method used to view the log of outgoing changes from the
1664 Mercurial repository. 1658 Mercurial repository.
1665 """ 1659 """
1660 from .HgLogBrowserDialog import HgLogBrowserDialog
1661
1666 if self.logBrowserOutgoing is None: 1662 if self.logBrowserOutgoing is None:
1667 from .HgLogBrowserDialog import HgLogBrowserDialog
1668
1669 self.logBrowserOutgoing = HgLogBrowserDialog(self, mode="outgoing") 1663 self.logBrowserOutgoing = HgLogBrowserDialog(self, mode="outgoing")
1670 self.logBrowserOutgoing.show() 1664 self.logBrowserOutgoing.show()
1671 self.logBrowserOutgoing.raise_() 1665 self.logBrowserOutgoing.raise_()
1672 self.logBrowserOutgoing.start() 1666 self.logBrowserOutgoing.start()
1673 1667
1841 1835
1842 def hgConflicts(self): 1836 def hgConflicts(self):
1843 """ 1837 """
1844 Public method used to show a list of files containing conflicts. 1838 Public method used to show a list of files containing conflicts.
1845 """ 1839 """
1840 from .HgConflictsListDialog import HgConflictsListDialog
1841
1846 if self.conflictsDlg is None: 1842 if self.conflictsDlg is None:
1847 from .HgConflictsListDialog import HgConflictsListDialog
1848
1849 self.conflictsDlg = HgConflictsListDialog(self) 1843 self.conflictsDlg = HgConflictsListDialog(self)
1850 self.conflictsDlg.show() 1844 self.conflictsDlg.show()
1851 self.conflictsDlg.raise_() 1845 self.conflictsDlg.raise_()
1852 self.conflictsDlg.start() 1846 self.conflictsDlg.start()
1853 1847
1973 @type bool 1967 @type bool
1974 @param largefilesData dictionary with data for the largefiles 1968 @param largefilesData dictionary with data for the largefiles
1975 section of the data dialog 1969 section of the data dialog
1976 @type dict 1970 @type dict
1977 """ 1971 """
1972 from .HgRepoConfigDataDialog import HgRepoConfigDataDialog
1973
1978 if repoName is None: 1974 if repoName is None:
1979 repoName = self.getClient().getRepository() 1975 repoName = self.getClient().getRepository()
1980 1976
1981 cfgFile = os.path.join(repoName, self.adminDir, "hgrc") 1977 cfgFile = os.path.join(repoName, self.adminDir, "hgrc")
1982 if not os.path.exists(cfgFile): 1978 if not os.path.exists(cfgFile):
1983 # open dialog to enter the initial data 1979 # open dialog to enter the initial data
1984 withLargefiles = self.isExtensionActive("largefiles") and withLargefiles 1980 withLargefiles = self.isExtensionActive("largefiles") and withLargefiles
1985 from .HgRepoConfigDataDialog import HgRepoConfigDataDialog
1986
1987 dlg = HgRepoConfigDataDialog( 1981 dlg = HgRepoConfigDataDialog(
1988 withLargefiles=withLargefiles, largefilesData=largefilesData 1982 withLargefiles=withLargefiles, largefilesData=largefilesData
1989 ) 1983 )
1990 if dlg.exec() == QDialog.DialogCode.Accepted: 1984 if dlg.exec() == QDialog.DialogCode.Accepted:
1991 createContents = True 1985 createContents = True
2141 Public method to create a changegroup file. 2135 Public method to create a changegroup file.
2142 2136
2143 @param bundleData dictionary containing the bundle creation information 2137 @param bundleData dictionary containing the bundle creation information
2144 @type dict 2138 @type dict
2145 """ 2139 """
2140 from .HgBundleDialog import HgBundleDialog
2141
2146 if bundleData is None: 2142 if bundleData is None:
2147 from .HgBundleDialog import HgBundleDialog
2148
2149 dlg = HgBundleDialog( 2143 dlg = HgBundleDialog(
2150 self.hgGetTagsList(), 2144 self.hgGetTagsList(),
2151 self.hgGetBranchesList(), 2145 self.hgGetBranchesList(),
2152 self.hgGetBookmarksList(), 2146 self.hgGetBookmarksList(),
2153 version=self.version, 2147 version=self.version,
2219 def hgPreviewBundle(self): 2213 def hgPreviewBundle(self):
2220 """ 2214 """
2221 Public method used to view the log of incoming changes from a 2215 Public method used to view the log of incoming changes from a
2222 changegroup file. 2216 changegroup file.
2223 """ 2217 """
2218 from .HgLogBrowserDialog import HgLogBrowserDialog
2219
2224 file = EricFileDialog.getOpenFileName( 2220 file = EricFileDialog.getOpenFileName(
2225 None, 2221 None,
2226 self.tr("Preview changegroup"), 2222 self.tr("Preview changegroup"),
2227 self.__lastChangeGroupPath, 2223 self.__lastChangeGroupPath,
2228 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)"), 2224 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)"),
2229 ) 2225 )
2230 if file: 2226 if file:
2231 self.__lastChangeGroupPath = os.path.dirname(file) 2227 self.__lastChangeGroupPath = os.path.dirname(file)
2232 2228
2233 if self.logBrowserIncoming is None: 2229 if self.logBrowserIncoming is None:
2234 from .HgLogBrowserDialog import HgLogBrowserDialog
2235
2236 self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming") 2230 self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming")
2237 self.logBrowserIncoming.show() 2231 self.logBrowserIncoming.show()
2238 self.logBrowserIncoming.raise_() 2232 self.logBrowserIncoming.raise_()
2239 self.logBrowserIncoming.start(bundle=file) 2233 self.logBrowserIncoming.start(bundle=file)
2240 2234
2289 @param subcommand name of the subcommand (one of 'good', 'bad', 2283 @param subcommand name of the subcommand (one of 'good', 'bad',
2290 'skip' or 'reset') 2284 'skip' or 'reset')
2291 @type str 2285 @type str
2292 @exception ValueError raised to indicate an invalid bisect subcommand 2286 @exception ValueError raised to indicate an invalid bisect subcommand
2293 """ 2287 """
2288 from .HgRevisionSelectionDialog import HgRevisionSelectionDialog
2289
2294 if subcommand not in ("good", "bad", "skip", "reset"): 2290 if subcommand not in ("good", "bad", "skip", "reset"):
2295 raise ValueError( 2291 raise ValueError(
2296 self.tr("Bisect subcommand ({0}) invalid.").format(subcommand) 2292 self.tr("Bisect subcommand ({0}) invalid.").format(subcommand)
2297 ) 2293 )
2298 2294
2299 rev = "" 2295 rev = ""
2300 if subcommand in ("good", "bad", "skip"): 2296 if subcommand in ("good", "bad", "skip"):
2301 from .HgRevisionSelectionDialog import HgRevisionSelectionDialog
2302
2303 dlg = HgRevisionSelectionDialog( 2297 dlg = HgRevisionSelectionDialog(
2304 self.hgGetTagsList(), 2298 self.hgGetTagsList(),
2305 self.hgGetBranchesList(), 2299 self.hgGetBranchesList(),
2306 bookmarksList=self.hgGetBookmarksList(), 2300 bookmarksList=self.hgGetBookmarksList(),
2307 ) 2301 )
2522 @param data tuple giving phase data (list of revisions, phase, flag 2516 @param data tuple giving phase data (list of revisions, phase, flag
2523 indicating a forced operation) (list of strings, string, boolean) 2517 indicating a forced operation) (list of strings, string, boolean)
2524 @return flag indicating success (boolean) 2518 @return flag indicating success (boolean)
2525 @exception ValueError raised to indicate an invalid phase 2519 @exception ValueError raised to indicate an invalid phase
2526 """ 2520 """
2521 from .HgPhaseDialog import HgPhaseDialog
2522
2527 if data is None: 2523 if data is None:
2528 from .HgPhaseDialog import HgPhaseDialog
2529
2530 dlg = HgPhaseDialog() 2524 dlg = HgPhaseDialog()
2531 if dlg.exec() == QDialog.DialogCode.Accepted: 2525 if dlg.exec() == QDialog.DialogCode.Accepted:
2532 data = dlg.getData() 2526 data = dlg.getData()
2533 2527
2534 if data: 2528 if data:
2804 2798
2805 def hgRemoveSubrepositories(self): 2799 def hgRemoveSubrepositories(self):
2806 """ 2800 """
2807 Public method to remove sub-repositories. 2801 Public method to remove sub-repositories.
2808 """ 2802 """
2803 from .HgRemoveSubrepositoriesDialog import HgRemoveSubrepositoriesDialog
2804
2809 hgsub = self.getHgSubPath() 2805 hgsub = self.getHgSubPath()
2810 2806
2811 subrepositories = [] 2807 subrepositories = []
2812 if not os.path.isfile(hgsub): 2808 if not os.path.isfile(hgsub):
2813 EricMessageBox.critical( 2809 EricMessageBox.critical(
2831 """<p>The sub-repositories file .hgsub could not""" 2827 """<p>The sub-repositories file .hgsub could not"""
2832 """ be read.</p><p>Reason: {0}</p>""" 2828 """ be read.</p><p>Reason: {0}</p>"""
2833 ).format(str(err)), 2829 ).format(str(err)),
2834 ) 2830 )
2835 return 2831 return
2836
2837 from .HgRemoveSubrepositoriesDialog import HgRemoveSubrepositoriesDialog
2838 2832
2839 dlg = HgRemoveSubrepositoriesDialog(subrepositories) 2833 dlg = HgRemoveSubrepositoriesDialog(subrepositories)
2840 if dlg.exec() == QDialog.DialogCode.Accepted: 2834 if dlg.exec() == QDialog.DialogCode.Accepted:
2841 subrepositories, removedSubrepos, deleteSubrepos = dlg.getData() 2835 subrepositories, removedSubrepos, deleteSubrepos = dlg.getData()
2842 contents = "\n".join(subrepositories) + "\n" 2836 contents = "\n".join(subrepositories) + "\n"
3113 3107
3114 def hgListBookmarks(self): 3108 def hgListBookmarks(self):
3115 """ 3109 """
3116 Public method used to list the available bookmarks. 3110 Public method used to list the available bookmarks.
3117 """ 3111 """
3112 from .HgBookmarksListDialog import HgBookmarksListDialog
3113
3118 self.bookmarksList = [] 3114 self.bookmarksList = []
3119 3115
3120 if self.bookmarksListDlg is None: 3116 if self.bookmarksListDlg is None:
3121 from .HgBookmarksListDialog import HgBookmarksListDialog
3122
3123 self.bookmarksListDlg = HgBookmarksListDialog(self) 3117 self.bookmarksListDlg = HgBookmarksListDialog(self)
3124 self.bookmarksListDlg.show() 3118 self.bookmarksListDlg.show()
3125 self.bookmarksListDlg.raise_() 3119 self.bookmarksListDlg.raise_()
3126 self.bookmarksListDlg.start(self.bookmarksList) 3120 self.bookmarksListDlg.start(self.bookmarksList)
3127 3121
3154 Public method to define a bookmark. 3148 Public method to define a bookmark.
3155 3149
3156 @param revision revision to set bookmark for (string) 3150 @param revision revision to set bookmark for (string)
3157 @param bookmark name of the bookmark (string) 3151 @param bookmark name of the bookmark (string)
3158 """ 3152 """
3153 from .HgBookmarkDialog import HgBookmarkDialog
3154
3159 if bool(revision) and bool(bookmark): 3155 if bool(revision) and bool(bookmark):
3160 ok = True 3156 ok = True
3161 else: 3157 else:
3162 from .HgBookmarkDialog import HgBookmarkDialog
3163
3164 dlg = HgBookmarkDialog( 3158 dlg = HgBookmarkDialog(
3165 HgBookmarkDialog.DEFINE_MODE, 3159 HgBookmarkDialog.DEFINE_MODE,
3166 self.hgGetTagsList(), 3160 self.hgGetTagsList(),
3167 self.hgGetBranchesList(), 3161 self.hgGetBranchesList(),
3168 self.hgGetBookmarksList(), 3162 self.hgGetBookmarksList(),
3217 Public method to rename a bookmark. 3211 Public method to rename a bookmark.
3218 3212
3219 @param renameInfo old and new names of the bookmark 3213 @param renameInfo old and new names of the bookmark
3220 @type tuple of str and str 3214 @type tuple of str and str
3221 """ 3215 """
3216 from .HgBookmarkRenameDialog import HgBookmarkRenameDialog
3217
3222 if not renameInfo: 3218 if not renameInfo:
3223 from .HgBookmarkRenameDialog import HgBookmarkRenameDialog
3224
3225 dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList()) 3219 dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList())
3226 if dlg.exec() == QDialog.DialogCode.Accepted: 3220 if dlg.exec() == QDialog.DialogCode.Accepted:
3227 renameInfo = dlg.getData() 3221 renameInfo = dlg.getData()
3228 3222
3229 if renameInfo: 3223 if renameInfo:
3242 Public method to move a bookmark. 3236 Public method to move a bookmark.
3243 3237
3244 @param revision revision to set bookmark for (string) 3238 @param revision revision to set bookmark for (string)
3245 @param bookmark name of the bookmark (string) 3239 @param bookmark name of the bookmark (string)
3246 """ 3240 """
3241 from .HgBookmarkDialog import HgBookmarkDialog
3242
3247 if bool(revision) and bool(bookmark): 3243 if bool(revision) and bool(bookmark):
3248 ok = True 3244 ok = True
3249 else: 3245 else:
3250 from .HgBookmarkDialog import HgBookmarkDialog
3251
3252 dlg = HgBookmarkDialog( 3246 dlg = HgBookmarkDialog(
3253 HgBookmarkDialog.MOVE_MODE, 3247 HgBookmarkDialog.MOVE_MODE,
3254 self.hgGetTagsList(), 3248 self.hgGetTagsList(),
3255 self.hgGetBranchesList(), 3249 self.hgGetBranchesList(),
3256 self.hgGetBookmarksList(), 3250 self.hgGetBookmarksList(),

eric ide

mercurial