151 self.__defaultConfigured = False |
151 self.__defaultConfigured = False |
152 self.__defaultPushConfigured = False |
152 self.__defaultPushConfigured = False |
153 |
153 |
154 # instantiate the extensions |
154 # instantiate the extensions |
155 self.__extensions = { |
155 self.__extensions = { |
156 "mq": Queues(self), |
156 "mq": Queues(self, ui=self.__ui), |
157 "purge": Purge(self), |
157 "purge": Purge(self, ui=self.__ui), |
158 "gpg": Gpg(self), |
158 "gpg": Gpg(self, ui=self.__ui), |
159 "rebase": Rebase(self), |
159 "rebase": Rebase(self, ui=self.__ui), |
160 "shelve": Shelve(self), |
160 "shelve": Shelve(self, ui=self.__ui), |
161 "largefiles": Largefiles(self), |
161 "largefiles": Largefiles(self, ui=self.__ui), |
162 "strip": Strip(self), |
162 "strip": Strip(self, ui=self.__ui), |
163 "histedit": Histedit(self), |
163 "histedit": Histedit(self, ui=self.__ui), |
164 "closehead": Closehead(self), |
164 "closehead": Closehead(self, ui=self.__ui), |
165 } |
165 } |
166 |
166 |
167 def getPlugin(self): |
167 def getPlugin(self): |
168 """ |
168 """ |
169 Public method to get a reference to the plugin object. |
169 Public method to get a reference to the plugin object. |
329 if not msg: |
329 if not msg: |
330 msg = "***" |
330 msg = "***" |
331 |
331 |
332 args = self.initCommand("init") |
332 args = self.initCommand("init") |
333 args.append(projectDir) |
333 args.append(projectDir) |
334 dia = HgDialog(self.tr("Creating Mercurial repository"), self) |
334 dia = HgDialog( |
|
335 self.tr("Creating Mercurial repository"), hg=self, parent=self.__ui |
|
336 ) |
335 res = dia.startProcess(args) |
337 res = dia.startProcess(args) |
336 if res: |
338 if res: |
337 dia.exec() |
339 dia.exec() |
338 status = dia.normalExit() |
340 status = dia.normalExit() |
339 |
341 |
348 if status and addAll: |
350 if status and addAll: |
349 args = self.initCommand("commit") |
351 args = self.initCommand("commit") |
350 args.append("--addremove") |
352 args.append("--addremove") |
351 args.append("--message") |
353 args.append("--message") |
352 args.append(msg) |
354 args.append(msg) |
353 dia = HgDialog(self.tr("Initial commit to Mercurial repository"), self) |
355 dia = HgDialog( |
|
356 self.tr("Initial commit to Mercurial repository"), |
|
357 hg=self, |
|
358 parent=self.__ui, |
|
359 ) |
354 res = dia.startProcess(args) |
360 res = dia.startProcess(args) |
355 if res: |
361 if res: |
356 dia.exec() |
362 dia.exec() |
357 status = dia.normalExit() |
363 status = dia.normalExit() |
358 |
364 |
561 if isinstance(name, list): |
571 if isinstance(name, list): |
562 self.addArguments(args, name) |
572 self.addArguments(args, name) |
563 else: |
573 else: |
564 args.append(name) |
574 args.append(name) |
565 |
575 |
566 dia = HgDialog(self.tr("Committing changes to Mercurial repository"), self) |
576 dia = HgDialog( |
|
577 self.tr("Committing changes to Mercurial repository"), |
|
578 hg=self, |
|
579 parent=self.__ui, |
|
580 ) |
567 res = dia.startProcess(args) |
581 res = dia.startProcess(args) |
568 if res: |
582 if res: |
569 dia.exec() |
583 dia.exec() |
570 self.committed.emit() |
584 self.committed.emit() |
571 if self.__forgotNames: |
585 if self.__forgotNames: |
656 |
670 |
657 if noDialog: |
671 if noDialog: |
658 _out, err = self.__client.runcommand(args) |
672 _out, err = self.__client.runcommand(args) |
659 res = False |
673 res = False |
660 else: |
674 else: |
661 dia = HgDialog(self.tr("Synchronizing with the Mercurial repository"), self) |
675 dia = HgDialog( |
|
676 self.tr("Synchronizing with the Mercurial repository"), |
|
677 hg=self, |
|
678 parent=self.__ui, |
|
679 ) |
662 res = dia.startProcess(args) |
680 res = dia.startProcess(args) |
663 if res: |
681 if res: |
664 dia.exec() |
682 dia.exec() |
665 res = dia.hasAddOrDelete() |
683 res = dia.hasAddOrDelete() |
666 self.checkVCSStatus() |
684 self.checkVCSStatus() |
899 @return flag indicating a performed tag action |
922 @return flag indicating a performed tag action |
900 @rtype bool |
923 @rtype bool |
901 """ |
924 """ |
902 from .HgTagDialog import HgTagDialog, HgTagOperation |
925 from .HgTagDialog import HgTagDialog, HgTagOperation |
903 |
926 |
904 dlg = HgTagDialog(self.hgGetTagsList(withType=True), revision, tagName) |
927 dlg = HgTagDialog( |
|
928 self.hgGetTagsList(withType=True), revision, tagName, parent=self.__ui |
|
929 ) |
905 if dlg.exec() == QDialog.DialogCode.Accepted: |
930 if dlg.exec() == QDialog.DialogCode.Accepted: |
906 tag, revision, tagOp, force = dlg.getParameters() |
931 tag, revision, tagOp, force = dlg.getParameters() |
907 else: |
932 else: |
908 return False |
933 return False |
909 |
934 |
930 args.append("Created {1}tag <{0}>.".format(tag, msgPart)) |
955 args.append("Created {1}tag <{0}>.".format(tag, msgPart)) |
931 else: |
956 else: |
932 args.append("Removed {1}tag <{0}>.".format(tag, msgPart)) |
957 args.append("Removed {1}tag <{0}>.".format(tag, msgPart)) |
933 args.append(tag) |
958 args.append(tag) |
934 |
959 |
935 dia = HgDialog(self.tr("Tagging in the Mercurial repository"), self) |
960 dia = HgDialog( |
|
961 self.tr("Tagging in the Mercurial repository"), hg=self, parent=self.__ui |
|
962 ) |
936 res = dia.startProcess(args) |
963 res = dia.startProcess(args) |
937 if res: |
964 if res: |
938 dia.exec() |
965 dia.exec() |
939 |
966 |
940 return True |
967 return True |
983 """Do you really want to revert all changes of""" |
1010 """Do you really want to revert all changes of""" |
984 """ the project?""" |
1011 """ the project?""" |
985 ), |
1012 ), |
986 ) |
1013 ) |
987 if yes: |
1014 if yes: |
988 dia = HgDialog(self.tr("Reverting changes"), self) |
1015 dia = HgDialog(self.tr("Reverting changes"), hg=self, parent=self.__ui) |
989 res = dia.startProcess(args) |
1016 res = dia.startProcess(args) |
990 if res: |
1017 if res: |
991 dia.exec() |
1018 dia.exec() |
992 res = dia.hasAddOrDelete() |
1019 res = dia.hasAddOrDelete() |
993 self.checkVCSStatus() |
1020 self.checkVCSStatus() |
1010 if not rev: |
1037 if not rev: |
1011 dlg = HgMergeDialog( |
1038 dlg = HgMergeDialog( |
1012 self.hgGetTagsList(), |
1039 self.hgGetTagsList(), |
1013 self.hgGetBranchesList(), |
1040 self.hgGetBranchesList(), |
1014 self.hgGetBookmarksList(), |
1041 self.hgGetBookmarksList(), |
|
1042 parent=self.__ui, |
1015 ) |
1043 ) |
1016 if dlg.exec() == QDialog.DialogCode.Accepted: |
1044 if dlg.exec() == QDialog.DialogCode.Accepted: |
1017 rev, force = dlg.getParameters() |
1045 rev, force = dlg.getParameters() |
1018 else: |
1046 else: |
1019 return |
1047 return |
1028 args.append("internal:merge") |
1056 args.append("internal:merge") |
1029 if rev: |
1057 if rev: |
1030 args.append("--rev") |
1058 args.append("--rev") |
1031 args.append(rev) |
1059 args.append(rev) |
1032 |
1060 |
1033 dia = HgDialog(self.tr("Merging"), self) |
1061 dia = HgDialog(self.tr("Merging"), hg=self, parent=self.__ui) |
1034 res = dia.startProcess(args) |
1062 res = dia.startProcess(args) |
1035 if res: |
1063 if res: |
1036 dia.exec() |
1064 dia.exec() |
1037 self.checkVCSStatus() |
1065 self.checkVCSStatus() |
1038 |
1066 |
1071 None, |
1099 None, |
1072 self.tr("Re-Merge"), |
1100 self.tr("Re-Merge"), |
1073 self.tr("""Do you really want to re-merge the project?"""), |
1101 self.tr("""Do you really want to re-merge the project?"""), |
1074 ) |
1102 ) |
1075 if yes: |
1103 if yes: |
1076 dia = HgDialog(self.tr("Re-Merging").format(name), self) |
1104 dia = HgDialog( |
|
1105 self.tr("Re-Merging").format(name), hg=self, parent=self.__ui |
|
1106 ) |
1077 res = dia.startProcess(args) |
1107 res = dia.startProcess(args) |
1078 if res: |
1108 if res: |
1079 dia.exec() |
1109 dia.exec() |
1080 self.checkVCSStatus() |
1110 self.checkVCSStatus() |
1081 |
1111 |
1094 dlg = HgRevisionSelectionDialog( |
1124 dlg = HgRevisionSelectionDialog( |
1095 self.hgGetTagsList(), |
1125 self.hgGetTagsList(), |
1096 self.hgGetBranchesList(), |
1126 self.hgGetBranchesList(), |
1097 bookmarksList=self.hgGetBookmarksList(), |
1127 bookmarksList=self.hgGetBookmarksList(), |
1098 noneLabel=self.tr("Current branch tip"), |
1128 noneLabel=self.tr("Current branch tip"), |
|
1129 parent=self.__ui, |
1099 ) |
1130 ) |
1100 if dlg.exec() == QDialog.DialogCode.Accepted: |
1131 if dlg.exec() == QDialog.DialogCode.Accepted: |
1101 rev = dlg.getRevision() |
1132 rev = dlg.getRevision() |
1102 return self.vcsUpdate(name, revision=rev) |
1133 return self.vcsUpdate(name, revision=rev) |
1103 |
1134 |
1261 @param name directory name of the working directory |
1292 @param name directory name of the working directory |
1262 @type str |
1293 @type str |
1263 """ |
1294 """ |
1264 from .HgCommandDialog import HgCommandDialog |
1295 from .HgCommandDialog import HgCommandDialog |
1265 |
1296 |
1266 dlg = HgCommandDialog(self.commandHistory, name) |
1297 dlg = HgCommandDialog(self.commandHistory, name, parent=self.__ui) |
1267 if dlg.exec() == QDialog.DialogCode.Accepted: |
1298 if dlg.exec() == QDialog.DialogCode.Accepted: |
1268 command = dlg.getData() |
1299 command = dlg.getData() |
1269 commandList = Utilities.parseOptionString(command) |
1300 commandList = Utilities.parseOptionString(command) |
1270 |
1301 |
1271 # This moves any previous occurrence of these arguments to the head |
1302 # This moves any previous occurrence of these arguments to the head |
1275 self.commandHistory.insert(0, command) |
1306 self.commandHistory.insert(0, command) |
1276 |
1307 |
1277 args = [] |
1308 args = [] |
1278 self.addArguments(args, commandList) |
1309 self.addArguments(args, commandList) |
1279 |
1310 |
1280 dia = HgDialog(self.tr("Mercurial command"), self) |
1311 dia = HgDialog(self.tr("Mercurial command"), hg=self, parent=self.__ui) |
1281 res = dia.startProcess(args) |
1312 res = dia.startProcess(args) |
1282 if res: |
1313 if res: |
1283 dia.exec() |
1314 dia.exec() |
1284 |
1315 |
1285 def vcsOptionsDialog( |
1316 def vcsOptionsDialog( |
1442 @return flag indicating successful operation |
1473 @return flag indicating successful operation |
1443 @rtype bool |
1474 @rtype bool |
1444 """ |
1475 """ |
1445 from .HgCopyDialog import HgCopyDialog |
1476 from .HgCopyDialog import HgCopyDialog |
1446 |
1477 |
1447 dlg = HgCopyDialog(name) |
1478 dlg = HgCopyDialog(name, parent=self.__ui) |
1448 res = False |
1479 res = False |
1449 if dlg.exec() == QDialog.DialogCode.Accepted: |
1480 if dlg.exec() == QDialog.DialogCode.Accepted: |
1450 target, force = dlg.getData() |
1481 target, force = dlg.getData() |
1451 |
1482 |
1452 args = self.initCommand("copy") |
1483 args = self.initCommand("copy") |
1453 args.append("-v") |
1484 args.append("-v") |
1454 args.append(name) |
1485 args.append(name) |
1455 args.append(target) |
1486 args.append(target) |
1456 |
1487 |
1457 dia = HgDialog(self.tr("Copying {0}").format(name), self) |
1488 dia = HgDialog( |
|
1489 self.tr("Copying {0}").format(name), hg=self, parent=self.__ui |
|
1490 ) |
1458 res = dia.startProcess(args) |
1491 res = dia.startProcess(args) |
1459 if res: |
1492 if res: |
1460 dia.exec() |
1493 dia.exec() |
1461 res = dia.normalExit() |
1494 res = dia.normalExit() |
1462 if res and target.startswith(project.getProjectPath()): |
1495 if res and target.startswith(project.getProjectPath()): |
1624 |
1657 |
1625 dlg = HgRevisionsSelectionDialog( |
1658 dlg = HgRevisionsSelectionDialog( |
1626 self.hgGetTagsList(), |
1659 self.hgGetTagsList(), |
1627 self.hgGetBranchesList(), |
1660 self.hgGetBranchesList(), |
1628 bookmarksList=self.hgGetBookmarksList(), |
1661 bookmarksList=self.hgGetBookmarksList(), |
|
1662 parent=self.__ui, |
1629 ) |
1663 ) |
1630 if dlg.exec() == QDialog.DialogCode.Accepted: |
1664 if dlg.exec() == QDialog.DialogCode.Accepted: |
1631 revisions = dlg.getRevisions() |
1665 revisions = dlg.getRevisions() |
1632 if self.diff is None: |
1666 if self.diff is None: |
1633 self.diff = HgDiffDialog(self) |
1667 self.diff = HgDiffDialog(self) |
1681 if extended: |
1715 if extended: |
1682 dlg = HgRevisionsSelectionDialog( |
1716 dlg = HgRevisionsSelectionDialog( |
1683 self.hgGetTagsList(), |
1717 self.hgGetTagsList(), |
1684 self.hgGetBranchesList(), |
1718 self.hgGetBranchesList(), |
1685 bookmarksList=self.hgGetBookmarksList(), |
1719 bookmarksList=self.hgGetBookmarksList(), |
|
1720 parent=self.__ui, |
1686 ) |
1721 ) |
1687 if dlg.exec() == QDialog.DialogCode.Accepted: |
1722 if dlg.exec() == QDialog.DialogCode.Accepted: |
1688 rev1, rev2 = dlg.getRevisions() |
1723 rev1, rev2 = dlg.getRevisions() |
1689 else: |
1724 else: |
1690 return |
1725 return |
1808 if revisions: |
1843 if revisions: |
1809 for rev in revisions: |
1844 for rev in revisions: |
1810 args.append("--rev") |
1845 args.append("--rev") |
1811 args.append(rev) |
1846 args.append(rev) |
1812 |
1847 |
1813 dia = HgDialog(title, self) |
1848 dia = HgDialog(title, hg=self, parent=self.__ui) |
1814 res = dia.startProcess(args) |
1849 res = dia.startProcess(args) |
1815 if res: |
1850 if res: |
1816 dia.exec() |
1851 dia.exec() |
1817 res = dia.hasAddOrDelete() |
1852 res = dia.hasAddOrDelete() |
1818 if self.bundleFile and os.path.exists(self.bundleFile): |
1853 if self.bundleFile and os.path.exists(self.bundleFile): |
1943 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
1982 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
1944 """</table></p>""", |
1983 """</table></p>""", |
1945 ).format(author, cdate, ctime) |
1984 ).format(author, cdate, ctime) |
1946 ) |
1985 ) |
1947 |
1986 |
1948 dlg = VcsRepositoryInfoDialog(None, "\n".join(info)) |
1987 dlg = VcsRepositoryInfoDialog(self.__ui, "\n".join(info)) |
1949 dlg.exec() |
1988 dlg.exec() |
1950 |
1989 |
1951 def hgConflicts(self): |
1990 def hgConflicts(self): |
1952 """ |
1991 """ |
1953 Public method used to show a list of files containing conflicts. |
1992 Public method used to show a list of files containing conflicts. |
1984 title = ( |
2023 title = ( |
1985 self.tr("Marking as 'unresolved'") |
2024 self.tr("Marking as 'unresolved'") |
1986 if unresolve |
2025 if unresolve |
1987 else self.tr("Marking as 'resolved'") |
2026 else self.tr("Marking as 'resolved'") |
1988 ) |
2027 ) |
1989 dia = HgDialog(title, self) |
2028 dia = HgDialog(title, hg=self, parent=self.__ui) |
1990 res = dia.startProcess(args) |
2029 res = dia.startProcess(args) |
1991 if res: |
2030 if res: |
1992 dia.exec() |
2031 dia.exec() |
1993 self.checkVCSStatus() |
2032 self.checkVCSStatus() |
1994 |
2033 |
2004 args.append("--abort") |
2043 args.append("--abort") |
2005 else: |
2044 else: |
2006 args = self.initCommand("update") |
2045 args = self.initCommand("update") |
2007 args.append("--clean") |
2046 args.append("--clean") |
2008 |
2047 |
2009 dia = HgDialog(self.tr("Aborting uncommitted merge"), self) |
2048 dia = HgDialog(self.tr("Aborting uncommitted merge"), hg=self, parent=self.__ui) |
2010 res = dia.startProcess(args, showArgs=False) |
2049 res = dia.startProcess(args, showArgs=False) |
2011 if res: |
2050 if res: |
2012 dia.exec() |
2051 dia.exec() |
2013 res = dia.hasAddOrDelete() |
2052 res = dia.hasAddOrDelete() |
2014 self.checkVCSStatus() |
2053 self.checkVCSStatus() |
2018 """ |
2057 """ |
2019 Public method used to create a branch in the Mercurial repository. |
2058 Public method used to create a branch in the Mercurial repository. |
2020 """ |
2059 """ |
2021 from .HgBranchInputDialog import HgBranchInputDialog |
2060 from .HgBranchInputDialog import HgBranchInputDialog |
2022 |
2061 |
2023 dlg = HgBranchInputDialog(self.hgGetBranchesList()) |
2062 dlg = HgBranchInputDialog(self.hgGetBranchesList(), parent=self.__ui) |
2024 if dlg.exec() == QDialog.DialogCode.Accepted: |
2063 if dlg.exec() == QDialog.DialogCode.Accepted: |
2025 name, commit, force = dlg.getData() |
2064 name, commit, force = dlg.getData() |
2026 name = name.strip().replace(" ", "_") |
2065 name = name.strip().replace(" ", "_") |
2027 args = self.initCommand("branch") |
2066 args = self.initCommand("branch") |
2028 if force: |
2067 if force: |
2029 args.append("--force") |
2068 args.append("--force") |
2030 args.append(name) |
2069 args.append(name) |
2031 |
2070 |
2032 dia = HgDialog(self.tr("Creating branch in the Mercurial repository"), self) |
2071 dia = HgDialog( |
|
2072 self.tr("Creating branch in the Mercurial repository"), |
|
2073 hg=self, |
|
2074 parent=self.__ui, |
|
2075 ) |
2033 res = dia.startProcess(args) |
2076 res = dia.startProcess(args) |
2034 if res: |
2077 if res: |
2035 dia.exec() |
2078 dia.exec() |
2036 if commit: |
2079 if commit: |
2037 project = ericApp().getObject("Project") |
2080 project = ericApp().getObject("Project") |
2044 """ |
2087 """ |
2045 Public method used to show the current branch of the working directory. |
2088 Public method used to show the current branch of the working directory. |
2046 """ |
2089 """ |
2047 args = self.initCommand("branch") |
2090 args = self.initCommand("branch") |
2048 |
2091 |
2049 dia = HgDialog(self.tr("Showing current branch"), self) |
2092 dia = HgDialog(self.tr("Showing current branch"), hg=self, parent=self.__ui) |
2050 res = dia.startProcess(args, showArgs=False) |
2093 res = dia.startProcess(args, showArgs=False) |
2051 if res: |
2094 if res: |
2052 dia.exec() |
2095 dia.exec() |
2053 |
2096 |
2054 def hgGetCurrentBranch(self): |
2097 def hgGetCurrentBranch(self): |
2068 """ |
2111 """ |
2069 Public method used to edit the user configuration file. |
2112 Public method used to edit the user configuration file. |
2070 """ |
2113 """ |
2071 from .HgUserConfigDialog import HgUserConfigDialog |
2114 from .HgUserConfigDialog import HgUserConfigDialog |
2072 |
2115 |
2073 dlg = HgUserConfigDialog(version=self.version) |
2116 dlg = HgUserConfigDialog(version=self.version, parent=self.__ui) |
2074 dlg.exec() |
2117 dlg.exec() |
2075 |
2118 |
2076 def hgEditConfig(self, repoName=None, withLargefiles=True, largefilesData=None): |
2119 def hgEditConfig(self, repoName=None, withLargefiles=True, largefilesData=None): |
2077 """ |
2120 """ |
2078 Public method used to edit the repository configuration file. |
2121 Public method used to edit the repository configuration file. |
2094 cfgFile = os.path.join(repoName, self.adminDir, "hgrc") |
2137 cfgFile = os.path.join(repoName, self.adminDir, "hgrc") |
2095 if not os.path.exists(cfgFile): |
2138 if not os.path.exists(cfgFile): |
2096 # open dialog to enter the initial data |
2139 # open dialog to enter the initial data |
2097 withLargefiles = self.isExtensionActive("largefiles") and withLargefiles |
2140 withLargefiles = self.isExtensionActive("largefiles") and withLargefiles |
2098 dlg = HgRepoConfigDataDialog( |
2141 dlg = HgRepoConfigDataDialog( |
2099 withLargefiles=withLargefiles, largefilesData=largefilesData |
2142 withLargefiles=withLargefiles, |
|
2143 largefilesData=largefilesData, |
|
2144 parent=self.__ui, |
2100 ) |
2145 ) |
2101 if dlg.exec() == QDialog.DialogCode.Accepted: |
2146 if dlg.exec() == QDialog.DialogCode.Accepted: |
2102 createContents = True |
2147 createContents = True |
2103 defaultUrl, defaultPushUrl = dlg.getData() |
2148 defaultUrl, defaultPushUrl = dlg.getData() |
2104 if withLargefiles: |
2149 if withLargefiles: |
2144 Public method to show the combined configuration. |
2191 Public method to show the combined configuration. |
2145 """ |
2192 """ |
2146 args = self.initCommand("showconfig") |
2193 args = self.initCommand("showconfig") |
2147 args.append("--untrusted") |
2194 args.append("--untrusted") |
2148 |
2195 |
2149 dia = HgDialog(self.tr("Showing the combined configuration settings"), self) |
2196 dia = HgDialog( |
|
2197 self.tr("Showing the combined configuration settings"), |
|
2198 hg=self, |
|
2199 parent=self.__ui, |
|
2200 ) |
2150 res = dia.startProcess(args, showArgs=False) |
2201 res = dia.startProcess(args, showArgs=False) |
2151 if res: |
2202 if res: |
2152 dia.exec() |
2203 dia.exec() |
2153 |
2204 |
2154 def hgShowPaths(self): |
2205 def hgShowPaths(self): |
2155 """ |
2206 """ |
2156 Public method to show the path aliases for remote repositories. |
2207 Public method to show the path aliases for remote repositories. |
2157 """ |
2208 """ |
2158 args = self.initCommand("paths") |
2209 args = self.initCommand("paths") |
2159 |
2210 |
2160 dia = HgDialog(self.tr("Showing aliases for remote repositories"), self) |
2211 dia = HgDialog( |
|
2212 self.tr("Showing aliases for remote repositories"), |
|
2213 hg=self, |
|
2214 parent=self.__ui, |
|
2215 ) |
2161 res = dia.startProcess(args, showArgs=False) |
2216 res = dia.startProcess(args, showArgs=False) |
2162 if res: |
2217 if res: |
2163 dia.exec() |
2218 dia.exec() |
2164 |
2219 |
2165 def hgRecover(self): |
2220 def hgRecover(self): |
2166 """ |
2221 """ |
2167 Public method to recover an interrupted transaction. |
2222 Public method to recover an interrupted transaction. |
2168 """ |
2223 """ |
2169 args = self.initCommand("recover") |
2224 args = self.initCommand("recover") |
2170 |
2225 |
2171 dia = HgDialog(self.tr("Recovering from interrupted transaction"), self) |
2226 dia = HgDialog( |
|
2227 self.tr("Recovering from interrupted transaction"), |
|
2228 hg=self, |
|
2229 parent=self.__ui, |
|
2230 ) |
2172 res = dia.startProcess(args, showArgs=False) |
2231 res = dia.startProcess(args, showArgs=False) |
2173 if res: |
2232 if res: |
2174 dia.exec() |
2233 dia.exec() |
2175 |
2234 |
2176 def hgIdentify(self): |
2235 def hgIdentify(self): |
2177 """ |
2236 """ |
2178 Public method to identify the current working directory. |
2237 Public method to identify the current working directory. |
2179 """ |
2238 """ |
2180 args = self.initCommand("identify") |
2239 args = self.initCommand("identify") |
2181 |
2240 |
2182 dia = HgDialog(self.tr("Identifying project directory"), self) |
2241 dia = HgDialog( |
|
2242 self.tr("Identifying project directory"), hg=self, parent=self.__ui |
|
2243 ) |
2183 res = dia.startProcess(args, showArgs=False) |
2244 res = dia.startProcess(args, showArgs=False) |
2184 if res: |
2245 if res: |
2185 dia.exec() |
2246 dia.exec() |
2186 |
2247 |
2187 def hgCreateIgnoreFile(self, name, autoAdd=False): |
2248 def hgCreateIgnoreFile(self, name, autoAdd=False): |
2264 dlg = HgBundleDialog( |
2325 dlg = HgBundleDialog( |
2265 self.hgGetTagsList(), |
2326 self.hgGetTagsList(), |
2266 self.hgGetBranchesList(), |
2327 self.hgGetBranchesList(), |
2267 self.hgGetBookmarksList(), |
2328 self.hgGetBookmarksList(), |
2268 version=self.version, |
2329 version=self.version, |
|
2330 parent=self.__ui, |
2269 ) |
2331 ) |
2270 if dlg.exec() != QDialog.DialogCode.Accepted: |
2332 if dlg.exec() != QDialog.DialogCode.Accepted: |
2271 return |
2333 return |
2272 |
2334 |
2273 revs, baseRevs, compression, bundleAll = dlg.getParameters() |
2335 revs, baseRevs, compression, bundleAll = dlg.getParameters() |
2324 if compression: |
2386 if compression: |
2325 args.append("--type") |
2387 args.append("--type") |
2326 args.append(compression) |
2388 args.append(compression) |
2327 args.append(str(fpath)) |
2389 args.append(str(fpath)) |
2328 |
2390 |
2329 dia = HgDialog(self.tr("Create changegroup"), self) |
2391 dia = HgDialog(self.tr("Create changegroup"), hg=self, parent=self.__ui) |
2330 res = dia.startProcess(args) |
2392 res = dia.startProcess(args) |
2331 if res: |
2393 if res: |
2332 dia.exec() |
2394 dia.exec() |
2333 |
2395 |
2334 def hgPreviewBundle(self): |
2396 def hgPreviewBundle(self): |
2386 if update: |
2448 if update: |
2387 args.append("--update") |
2449 args.append("--update") |
2388 args.append("--verbose") |
2450 args.append("--verbose") |
2389 args.extend(files) |
2451 args.extend(files) |
2390 |
2452 |
2391 dia = HgDialog(self.tr("Apply changegroups"), self) |
2453 dia = HgDialog(self.tr("Apply changegroups"), hg=self, parent=self.__ui) |
2392 res = dia.startProcess(args) |
2454 res = dia.startProcess(args) |
2393 if res: |
2455 if res: |
2394 dia.exec() |
2456 dia.exec() |
2395 res = dia.hasAddOrDelete() |
2457 res = dia.hasAddOrDelete() |
2396 self.checkVCSStatus() |
2458 self.checkVCSStatus() |
2417 if subcommand in ("good", "bad", "skip"): |
2479 if subcommand in ("good", "bad", "skip"): |
2418 dlg = HgRevisionSelectionDialog( |
2480 dlg = HgRevisionSelectionDialog( |
2419 self.hgGetTagsList(), |
2481 self.hgGetTagsList(), |
2420 self.hgGetBranchesList(), |
2482 self.hgGetBranchesList(), |
2421 bookmarksList=self.hgGetBookmarksList(), |
2483 bookmarksList=self.hgGetBookmarksList(), |
|
2484 parent=self.__ui, |
2422 ) |
2485 ) |
2423 if dlg.exec() == QDialog.DialogCode.Accepted: |
2486 if dlg.exec() == QDialog.DialogCode.Accepted: |
2424 rev = dlg.getRevision() |
2487 rev = dlg.getRevision() |
2425 else: |
2488 else: |
2426 return |
2489 return |
2428 args = self.initCommand("bisect") |
2491 args = self.initCommand("bisect") |
2429 args.append("--{0}".format(subcommand)) |
2492 args.append("--{0}".format(subcommand)) |
2430 if rev: |
2493 if rev: |
2431 args.append(rev) |
2494 args.append(rev) |
2432 |
2495 |
2433 dia = HgDialog(self.tr("Mercurial Bisect ({0})").format(subcommand), self) |
2496 dia = HgDialog( |
|
2497 self.tr("Mercurial Bisect ({0})").format(subcommand), |
|
2498 hg=self, |
|
2499 parent=self.__ui, |
|
2500 ) |
2434 res = dia.startProcess(args) |
2501 res = dia.startProcess(args) |
2435 if res: |
2502 if res: |
2436 dia.exec() |
2503 dia.exec() |
2437 |
2504 |
2438 def vcsForget(self, name): |
2505 def vcsForget(self, name): |
2469 repository. |
2538 repository. |
2470 """ |
2539 """ |
2471 from .HgBackoutDialog import HgBackoutDialog |
2540 from .HgBackoutDialog import HgBackoutDialog |
2472 |
2541 |
2473 dlg = HgBackoutDialog( |
2542 dlg = HgBackoutDialog( |
2474 self.hgGetTagsList(), self.hgGetBranchesList(), self.hgGetBookmarksList() |
2543 self.hgGetTagsList(), |
|
2544 self.hgGetBranchesList(), |
|
2545 self.hgGetBookmarksList(), |
|
2546 parent=self.__ui, |
2475 ) |
2547 ) |
2476 if dlg.exec() == QDialog.DialogCode.Accepted: |
2548 if dlg.exec() == QDialog.DialogCode.Accepted: |
2477 rev, merge, date, user, message = dlg.getParameters() |
2549 rev, merge, date, user, message = dlg.getParameters() |
2478 if not rev: |
2550 if not rev: |
2479 EricMessageBox.warning( |
2551 EricMessageBox.warning( |
2495 args.append(user) |
2567 args.append(user) |
2496 args.append("--message") |
2568 args.append("--message") |
2497 args.append(message) |
2569 args.append(message) |
2498 args.append(rev) |
2570 args.append(rev) |
2499 |
2571 |
2500 dia = HgDialog(self.tr("Backing out changeset"), self) |
2572 dia = HgDialog(self.tr("Backing out changeset"), hg=self, parent=self.__ui) |
2501 res = dia.startProcess(args) |
2573 res = dia.startProcess(args) |
2502 if res: |
2574 if res: |
2503 dia.exec() |
2575 dia.exec() |
2504 |
2576 |
2505 def hgRollback(self): |
2577 def hgRollback(self): |
2511 self.tr("Rollback last transaction"), |
2583 self.tr("Rollback last transaction"), |
2512 self.tr("""Are you sure you want to rollback the last transaction?"""), |
2584 self.tr("""Are you sure you want to rollback the last transaction?"""), |
2513 icon=EricMessageBox.Warning, |
2585 icon=EricMessageBox.Warning, |
2514 ) |
2586 ) |
2515 if res: |
2587 if res: |
2516 dia = HgDialog(self.tr("Rollback last transaction"), self) |
2588 dia = HgDialog( |
|
2589 self.tr("Rollback last transaction"), hg=self, parent=self.__ui |
|
2590 ) |
2517 res = dia.startProcess(["rollback"]) |
2591 res = dia.startProcess(["rollback"]) |
2518 if res: |
2592 if res: |
2519 dia.exec() |
2593 dia.exec() |
2520 |
2594 |
2521 def hgServe(self, repoPath): |
2595 def hgServe(self, repoPath): |
2574 args.append("--force") |
2648 args.append("--force") |
2575 if withSecret: |
2649 if withSecret: |
2576 args.append("--secret") |
2650 args.append("--secret") |
2577 args.append(patchFile) |
2651 args.append(patchFile) |
2578 |
2652 |
2579 dia = HgDialog(self.tr("Import Patch"), self) |
2653 dia = HgDialog(self.tr("Import Patch"), hg=self, parent=self.__ui) |
2580 res = dia.startProcess(args) |
2654 res = dia.startProcess(args) |
2581 if res: |
2655 if res: |
2582 dia.exec() |
2656 dia.exec() |
2583 res = dia.hasAddOrDelete() |
2657 res = dia.hasAddOrDelete() |
2584 self.checkVCSStatus() |
2658 self.checkVCSStatus() |
2591 """ |
2665 """ |
2592 Public method to export patches to files. |
2666 Public method to export patches to files. |
2593 """ |
2667 """ |
2594 from .HgExportDialog import HgExportDialog |
2668 from .HgExportDialog import HgExportDialog |
2595 |
2669 |
2596 dlg = HgExportDialog(self.hgGetBookmarksList(), self.version >= (4, 7, 0)) |
2670 dlg = HgExportDialog( |
|
2671 self.hgGetBookmarksList(), self.version >= (4, 7, 0), parent=self.__ui |
|
2672 ) |
2597 if dlg.exec() == QDialog.DialogCode.Accepted: |
2673 if dlg.exec() == QDialog.DialogCode.Accepted: |
2598 ( |
2674 ( |
2599 filePattern, |
2675 filePattern, |
2600 revisions, |
2676 revisions, |
2601 bookmark, |
2677 bookmark, |
2622 args.append(bookmark) |
2698 args.append(bookmark) |
2623 else: |
2699 else: |
2624 for rev in revisions: |
2700 for rev in revisions: |
2625 args.append(rev) |
2701 args.append(rev) |
2626 |
2702 |
2627 dia = HgDialog(self.tr("Export Patches"), self) |
2703 dia = HgDialog(self.tr("Export Patches"), hg=self, parent=self.__ui) |
2628 res = dia.startProcess(args) |
2704 res = dia.startProcess(args) |
2629 if res: |
2705 if res: |
2630 dia.exec() |
2706 dia.exec() |
2631 |
2707 |
2632 def hgPhase(self, data=None): |
2708 def hgPhase(self, data=None): |
2641 @exception ValueError raised to indicate an invalid phase |
2717 @exception ValueError raised to indicate an invalid phase |
2642 """ |
2718 """ |
2643 from .HgPhaseDialog import HgPhaseDialog |
2719 from .HgPhaseDialog import HgPhaseDialog |
2644 |
2720 |
2645 if data is None: |
2721 if data is None: |
2646 dlg = HgPhaseDialog() |
2722 dlg = HgPhaseDialog(parent=self.__ui) |
2647 if dlg.exec() == QDialog.DialogCode.Accepted: |
2723 if dlg.exec() == QDialog.DialogCode.Accepted: |
2648 data = dlg.getData() |
2724 data = dlg.getData() |
2649 |
2725 |
2650 if data: |
2726 if data: |
2651 revs, phase, force = data |
2727 revs, phase, force = data |
2686 @rtype bool |
2762 @rtype bool |
2687 """ |
2763 """ |
2688 from .HgGraftDialog import HgGraftDialog |
2764 from .HgGraftDialog import HgGraftDialog |
2689 |
2765 |
2690 res = False |
2766 res = False |
2691 dlg = HgGraftDialog(self, revs) |
2767 dlg = HgGraftDialog(self, revs, parent=self.__ui) |
2692 if dlg.exec() == QDialog.DialogCode.Accepted: |
2768 if dlg.exec() == QDialog.DialogCode.Accepted: |
2693 ( |
2769 ( |
2694 revs, |
2770 revs, |
2695 (userData, currentUser, userName), |
2771 (userData, currentUser, userName), |
2696 (dateData, currentDate, dateStr), |
2772 (dateData, currentDate, dateStr), |
2719 args.append("--dry-run") |
2795 args.append("--dry-run") |
2720 if noCommit: |
2796 if noCommit: |
2721 args.append("--no-commit") |
2797 args.append("--no-commit") |
2722 args.extend(revs) |
2798 args.extend(revs) |
2723 |
2799 |
2724 dia = HgDialog(self.tr("Copy Changesets"), self) |
2800 dia = HgDialog(self.tr("Copy Changesets"), hg=self, parent=self.__ui) |
2725 res = dia.startProcess(args) |
2801 res = dia.startProcess(args) |
2726 if res: |
2802 if res: |
2727 dia.exec() |
2803 dia.exec() |
2728 res = dia.hasAddOrDelete() |
2804 res = dia.hasAddOrDelete() |
2729 self.checkVCSStatus() |
2805 self.checkVCSStatus() |
2742 """ |
2818 """ |
2743 args = self.initCommand("graft") |
2819 args = self.initCommand("graft") |
2744 args.append(subcommand) |
2820 args.append(subcommand) |
2745 args.append("--verbose") |
2821 args.append("--verbose") |
2746 |
2822 |
2747 dia = HgDialog(title, self) |
2823 dia = HgDialog(title, hg=self, parent=self.__ui) |
2748 res = dia.startProcess(args) |
2824 res = dia.startProcess(args) |
2749 if res: |
2825 if res: |
2750 dia.exec() |
2826 dia.exec() |
2751 res = dia.hasAddOrDelete() |
2827 res = dia.hasAddOrDelete() |
2752 self.checkVCSStatus() |
2828 self.checkVCSStatus() |
2786 """ |
2862 """ |
2787 Public method to create an unversioned archive from the repository. |
2863 Public method to create an unversioned archive from the repository. |
2788 """ |
2864 """ |
2789 from .HgArchiveDialog import HgArchiveDialog |
2865 from .HgArchiveDialog import HgArchiveDialog |
2790 |
2866 |
2791 dlg = HgArchiveDialog(self) |
2867 dlg = HgArchiveDialog(self, parent=self.__ui) |
2792 if dlg.exec() == QDialog.DialogCode.Accepted: |
2868 if dlg.exec() == QDialog.DialogCode.Accepted: |
2793 archive, type_, prefix, subrepos = dlg.getData() |
2869 archive, type_, prefix, subrepos = dlg.getData() |
2794 |
2870 |
2795 args = self.initCommand("archive") |
2871 args = self.initCommand("archive") |
2796 if type_: |
2872 if type_: |
2801 args.append(prefix) |
2877 args.append(prefix) |
2802 if subrepos: |
2878 if subrepos: |
2803 args.append("--subrepos") |
2879 args.append("--subrepos") |
2804 args.append(archive) |
2880 args.append(archive) |
2805 |
2881 |
2806 dia = HgDialog(self.tr("Create Unversioned Archive"), self) |
2882 dia = HgDialog( |
|
2883 self.tr("Create Unversioned Archive"), hg=self, parent=self.__ui |
|
2884 ) |
2807 res = dia.startProcess(args) |
2885 res = dia.startProcess(args) |
2808 if res: |
2886 if res: |
2809 dia.exec() |
2887 dia.exec() |
2810 |
2888 |
2811 def hgDeleteBackups(self): |
2889 def hgDeleteBackups(self): |
2857 """ |
2935 """ |
2858 from .HgAddSubrepositoryDialog import HgAddSubrepositoryDialog |
2936 from .HgAddSubrepositoryDialog import HgAddSubrepositoryDialog |
2859 |
2937 |
2860 ppath = self.__projectHelper.getProject().getProjectPath() |
2938 ppath = self.__projectHelper.getProject().getProjectPath() |
2861 hgsub = self.getHgSubPath() |
2939 hgsub = self.getHgSubPath() |
2862 dlg = HgAddSubrepositoryDialog(ppath) |
2940 dlg = HgAddSubrepositoryDialog(ppath, parent=self.__ui) |
2863 if dlg.exec() == QDialog.DialogCode.Accepted: |
2941 if dlg.exec() == QDialog.DialogCode.Accepted: |
2864 relPath, subrepoType, subrepoUrl = dlg.getData() |
2942 relPath, subrepoType, subrepoUrl = dlg.getData() |
2865 if subrepoType == "hg": |
2943 if subrepoType == "hg": |
2866 url = subrepoUrl |
2944 url = subrepoUrl |
2867 else: |
2945 else: |
2953 """ be read.</p><p>Reason: {0}</p>""" |
3031 """ be read.</p><p>Reason: {0}</p>""" |
2954 ).format(str(err)), |
3032 ).format(str(err)), |
2955 ) |
3033 ) |
2956 return |
3034 return |
2957 |
3035 |
2958 dlg = HgRemoveSubrepositoriesDialog(subrepositories) |
3036 dlg = HgRemoveSubrepositoriesDialog(subrepositories, parent=self.__ui) |
2959 if dlg.exec() == QDialog.DialogCode.Accepted: |
3037 if dlg.exec() == QDialog.DialogCode.Accepted: |
2960 subrepositories, removedSubrepos, deleteSubrepos = dlg.getData() |
3038 subrepositories, removedSubrepos, deleteSubrepos = dlg.getData() |
2961 contents = "\n".join(subrepositories) + "\n" |
3039 contents = "\n".join(subrepositories) + "\n" |
2962 try: |
3040 try: |
2963 with open(hgsub, "w") as f: |
3041 with open(hgsub, "w") as f: |
3310 dlg = HgBookmarkDialog( |
3388 dlg = HgBookmarkDialog( |
3311 HgBookmarkAction.DEFINE, |
3389 HgBookmarkAction.DEFINE, |
3312 self.hgGetTagsList(), |
3390 self.hgGetTagsList(), |
3313 self.hgGetBranchesList(), |
3391 self.hgGetBranchesList(), |
3314 self.hgGetBookmarksList(), |
3392 self.hgGetBookmarksList(), |
|
3393 parent=self.__ui, |
3315 ) |
3394 ) |
3316 if dlg.exec() == QDialog.DialogCode.Accepted: |
3395 if dlg.exec() == QDialog.DialogCode.Accepted: |
3317 revision, bookmark = dlg.getData() |
3396 revision, bookmark = dlg.getData() |
3318 ok = True |
3397 ok = True |
3319 else: |
3398 else: |
3324 if revision: |
3403 if revision: |
3325 args.append("--rev") |
3404 args.append("--rev") |
3326 args.append(revision) |
3405 args.append(revision) |
3327 args.append(bookmark) |
3406 args.append(bookmark) |
3328 |
3407 |
3329 dia = HgDialog(self.tr("Mercurial Bookmark"), self) |
3408 dia = HgDialog(self.tr("Mercurial Bookmark"), hg=self, parent=self.__ui) |
3330 res = dia.startProcess(args) |
3409 res = dia.startProcess(args) |
3331 if res: |
3410 if res: |
3332 dia.exec() |
3411 dia.exec() |
3333 |
3412 |
3334 def hgBookmarkDelete(self, bookmark=None): |
3413 def hgBookmarkDelete(self, bookmark=None): |
3352 if ok and bookmark: |
3431 if ok and bookmark: |
3353 args = self.initCommand("bookmarks") |
3432 args = self.initCommand("bookmarks") |
3354 args.append("--delete") |
3433 args.append("--delete") |
3355 args.append(bookmark) |
3434 args.append(bookmark) |
3356 |
3435 |
3357 dia = HgDialog(self.tr("Delete Mercurial Bookmark"), self) |
3436 dia = HgDialog( |
|
3437 self.tr("Delete Mercurial Bookmark"), hg=self, parent=self.__ui |
|
3438 ) |
3358 res = dia.startProcess(args) |
3439 res = dia.startProcess(args) |
3359 if res: |
3440 if res: |
3360 dia.exec() |
3441 dia.exec() |
3361 |
3442 |
3362 def hgBookmarkRename(self, renameInfo=None): |
3443 def hgBookmarkRename(self, renameInfo=None): |
3367 @type tuple of str and str |
3448 @type tuple of str and str |
3368 """ |
3449 """ |
3369 from .HgBookmarkRenameDialog import HgBookmarkRenameDialog |
3450 from .HgBookmarkRenameDialog import HgBookmarkRenameDialog |
3370 |
3451 |
3371 if not renameInfo: |
3452 if not renameInfo: |
3372 dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList()) |
3453 dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList(), parent=self.__ui) |
3373 if dlg.exec() == QDialog.DialogCode.Accepted: |
3454 if dlg.exec() == QDialog.DialogCode.Accepted: |
3374 renameInfo = dlg.getData() |
3455 renameInfo = dlg.getData() |
3375 |
3456 |
3376 if renameInfo: |
3457 if renameInfo: |
3377 args = self.initCommand("bookmarks") |
3458 args = self.initCommand("bookmarks") |
3378 args.append("--rename") |
3459 args.append("--rename") |
3379 args.append(renameInfo[0]) |
3460 args.append(renameInfo[0]) |
3380 args.append(renameInfo[1]) |
3461 args.append(renameInfo[1]) |
3381 |
3462 |
3382 dia = HgDialog(self.tr("Rename Mercurial Bookmark"), self) |
3463 dia = HgDialog( |
|
3464 self.tr("Rename Mercurial Bookmark"), hg=self, parent=self.__ui |
|
3465 ) |
3383 res = dia.startProcess(args) |
3466 res = dia.startProcess(args) |
3384 if res: |
3467 if res: |
3385 dia.exec() |
3468 dia.exec() |
3386 |
3469 |
3387 def hgBookmarkMove(self, revision=None, bookmark=None): |
3470 def hgBookmarkMove(self, revision=None, bookmark=None): |
3401 dlg = HgBookmarkDialog( |
3484 dlg = HgBookmarkDialog( |
3402 HgBookmarkAction.MOVE, |
3485 HgBookmarkAction.MOVE, |
3403 self.hgGetTagsList(), |
3486 self.hgGetTagsList(), |
3404 self.hgGetBranchesList(), |
3487 self.hgGetBranchesList(), |
3405 self.hgGetBookmarksList(), |
3488 self.hgGetBookmarksList(), |
|
3489 parent=self.__ui, |
3406 ) |
3490 ) |
3407 if dlg.exec() == QDialog.DialogCode.Accepted: |
3491 if dlg.exec() == QDialog.DialogCode.Accepted: |
3408 revision, bookmark = dlg.getData() |
3492 revision, bookmark = dlg.getData() |
3409 ok = True |
3493 ok = True |
3410 else: |
3494 else: |
3416 if revision: |
3500 if revision: |
3417 args.append("--rev") |
3501 args.append("--rev") |
3418 args.append(revision) |
3502 args.append(revision) |
3419 args.append(bookmark) |
3503 args.append(bookmark) |
3420 |
3504 |
3421 dia = HgDialog(self.tr("Move Mercurial Bookmark"), self) |
3505 dia = HgDialog( |
|
3506 self.tr("Move Mercurial Bookmark"), hg=self, parent=self.__ui |
|
3507 ) |
3422 res = dia.startProcess(args) |
3508 res = dia.startProcess(args) |
3423 if res: |
3509 if res: |
3424 dia.exec() |
3510 dia.exec() |
3425 |
3511 |
3426 def hgBookmarkIncoming(self): |
3512 def hgBookmarkIncoming(self): |
3510 args = self.initCommand("pull") |
3596 args = self.initCommand("pull") |
3511 args.append("--bookmark") |
3597 args.append("--bookmark") |
3512 args.append(bookmark) |
3598 args.append(bookmark) |
3513 |
3599 |
3514 dia = HgDialog( |
3600 dia = HgDialog( |
3515 self.tr("Pulling bookmark from a remote Mercurial repository"), self |
3601 self.tr("Pulling bookmark from a remote Mercurial repository"), |
|
3602 hg=self, |
|
3603 parent=self.__ui, |
3516 ) |
3604 ) |
3517 res = dia.startProcess(args) |
3605 res = dia.startProcess(args) |
3518 if res: |
3606 if res: |
3519 dia.exec() |
3607 dia.exec() |
3520 |
3608 |