277 args = self.initCommand("init") |
277 args = self.initCommand("init") |
278 args.append(projectDir) |
278 args.append(projectDir) |
279 dia = GitDialog(self.tr('Creating Git repository'), self) |
279 dia = GitDialog(self.tr('Creating Git repository'), self) |
280 res = dia.startProcess(args) |
280 res = dia.startProcess(args) |
281 if res: |
281 if res: |
282 dia.exec_() |
282 dia.exec() |
283 status = dia.normalExit() |
283 status = dia.normalExit() |
284 |
284 |
285 if status: |
285 if status: |
286 ignoreName = os.path.join(projectDir, Git.IgnoreFileName) |
286 ignoreName = os.path.join(projectDir, Git.IgnoreFileName) |
287 if not os.path.exists(ignoreName): |
287 if not os.path.exists(ignoreName): |
294 dia = GitDialog( |
294 dia = GitDialog( |
295 self.tr('Adding files to Git repository'), |
295 self.tr('Adding files to Git repository'), |
296 self) |
296 self) |
297 res = dia.startProcess(args, projectDir) |
297 res = dia.startProcess(args, projectDir) |
298 if res: |
298 if res: |
299 dia.exec_() |
299 dia.exec() |
300 status = dia.normalExit() |
300 status = dia.normalExit() |
301 |
301 |
302 if status: |
302 if status: |
303 args = self.initCommand("commit") |
303 args = self.initCommand("commit") |
304 args.append('--message={0}'.format(msg)) |
304 args.append('--message={0}'.format(msg)) |
305 dia = GitDialog( |
305 dia = GitDialog( |
306 self.tr('Initial commit to Git repository'), |
306 self.tr('Initial commit to Git repository'), |
307 self) |
307 self) |
308 res = dia.startProcess(args, projectDir) |
308 res = dia.startProcess(args, projectDir) |
309 if res: |
309 if res: |
310 dia.exec_() |
310 dia.exec() |
311 status = dia.normalExit() |
311 status = dia.normalExit() |
312 |
312 |
313 return status, False |
313 return status, False |
314 |
314 |
315 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): |
315 def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): |
335 dia = GitDialog( |
335 dia = GitDialog( |
336 self.tr('Cloning project from a Git repository'), |
336 self.tr('Cloning project from a Git repository'), |
337 self) |
337 self) |
338 res = dia.startProcess(args) |
338 res = dia.startProcess(args) |
339 if res: |
339 if res: |
340 dia.exec_() |
340 dia.exec() |
341 return dia.normalExit() |
341 return dia.normalExit() |
342 |
342 |
343 def vcsExport(self, vcsDataDict, projectDir): |
343 def vcsExport(self, vcsDataDict, projectDir): |
344 """ |
344 """ |
345 Public method used to export a directory from the Git repository. |
345 Public method used to export a directory from the Git repository. |
485 dia = GitDialog( |
485 dia = GitDialog( |
486 self.tr('Committing changes to Git repository'), |
486 self.tr('Committing changes to Git repository'), |
487 self) |
487 self) |
488 res = dia.startProcess(args, dname) |
488 res = dia.startProcess(args, dname) |
489 if res: |
489 if res: |
490 dia.exec_() |
490 dia.exec() |
491 self.committed.emit() |
491 self.committed.emit() |
492 self.checkVCSStatus() |
492 self.checkVCSStatus() |
493 |
493 |
494 def vcsUpdate(self, name, noDialog=False, revision=None): |
494 def vcsUpdate(self, name, noDialog=False, revision=None): |
495 """ |
495 """ |
539 dia = GitDialog(self.tr( |
539 dia = GitDialog(self.tr( |
540 'Synchronizing with the Git repository'), |
540 'Synchronizing with the Git repository'), |
541 self) |
541 self) |
542 res = dia.startProcess(args, repodir) |
542 res = dia.startProcess(args, repodir) |
543 if res: |
543 if res: |
544 dia.exec_() |
544 dia.exec() |
545 res = dia.hasAddOrDelete() |
545 res = dia.hasAddOrDelete() |
546 self.checkVCSStatus() |
546 self.checkVCSStatus() |
547 return res |
547 return res |
548 |
548 |
549 def vcsAdd(self, name, isDir=False, noDialog=False): |
549 def vcsAdd(self, name, isDir=False, noDialog=False): |
587 self.tr( |
587 self.tr( |
588 'Adding files/directories to the Git repository'), |
588 'Adding files/directories to the Git repository'), |
589 self) |
589 self) |
590 res = dia.startProcess(args, repodir) |
590 res = dia.startProcess(args, repodir) |
591 if res: |
591 if res: |
592 dia.exec_() |
592 dia.exec() |
593 |
593 |
594 def vcsAddBinary(self, name, isDir=False): |
594 def vcsAddBinary(self, name, isDir=False): |
595 """ |
595 """ |
596 Public method used to add a file/directory in binary mode to the |
596 Public method used to add a file/directory in binary mode to the |
597 Git repository. |
597 Git repository. |
662 'Removing files/directories from the Git' |
662 'Removing files/directories from the Git' |
663 ' repository'), |
663 ' repository'), |
664 self) |
664 self) |
665 res = dia.startProcess(args, repodir) |
665 res = dia.startProcess(args, repodir) |
666 if res: |
666 if res: |
667 dia.exec_() |
667 dia.exec() |
668 res = dia.normalExitWithoutErrors() |
668 res = dia.normalExitWithoutErrors() |
669 |
669 |
670 return res |
670 return res |
671 |
671 |
672 def vcsMove(self, name, project, target=None, noDialog=False): |
672 def vcsMove(self, name, project, target=None, noDialog=False): |
688 force = True |
688 force = True |
689 accepted = True |
689 accepted = True |
690 else: |
690 else: |
691 from .GitCopyDialog import GitCopyDialog |
691 from .GitCopyDialog import GitCopyDialog |
692 dlg = GitCopyDialog(name, None, True) |
692 dlg = GitCopyDialog(name, None, True) |
693 accepted = dlg.exec_() == QDialog.Accepted |
693 accepted = dlg.exec() == QDialog.Accepted |
694 if accepted: |
694 if accepted: |
695 target, force = dlg.getData() |
695 target, force = dlg.getData() |
696 |
696 |
697 if accepted: |
697 if accepted: |
698 args = self.initCommand("mv") |
698 args = self.initCommand("mv") |
715 QProcess(), 'git', args, repodir) |
715 QProcess(), 'git', args, repodir) |
716 else: |
716 else: |
717 dia = GitDialog(self.tr('Renaming {0}').format(name), self) |
717 dia = GitDialog(self.tr('Renaming {0}').format(name), self) |
718 res = dia.startProcess(args, repodir) |
718 res = dia.startProcess(args, repodir) |
719 if res: |
719 if res: |
720 dia.exec_() |
720 dia.exec() |
721 res = dia.normalExit() |
721 res = dia.normalExit() |
722 if res: |
722 if res: |
723 if target.startswith(project.getProjectPath()): |
723 if target.startswith(project.getProjectPath()): |
724 if isDir: |
724 if isDir: |
725 project.moveDirectory(name, target) |
725 project.moveDirectory(name, target) |
885 self.tr("Revert changes"), |
885 self.tr("Revert changes"), |
886 self.tr( |
886 self.tr( |
887 "Do you really want to revert all changes to these files" |
887 "Do you really want to revert all changes to these files" |
888 " or directories?"), |
888 " or directories?"), |
889 names) |
889 names) |
890 yes = dlg.exec_() == QDialog.Accepted |
890 yes = dlg.exec() == QDialog.Accepted |
891 else: |
891 else: |
892 yes = E5MessageBox.yesNo( |
892 yes = E5MessageBox.yesNo( |
893 None, |
893 None, |
894 self.tr("Revert changes"), |
894 self.tr("Revert changes"), |
895 self.tr("""Do you really want to revert all changes of""" |
895 self.tr("""Do you really want to revert all changes of""" |
896 """ the project?""")) |
896 """ the project?""")) |
897 if yes: |
897 if yes: |
898 dia = GitDialog(self.tr('Reverting changes'), self) |
898 dia = GitDialog(self.tr('Reverting changes'), self) |
899 res = dia.startProcess(args, repodir) |
899 res = dia.startProcess(args, repodir) |
900 if res: |
900 if res: |
901 dia.exec_() |
901 dia.exec() |
902 res = dia.hasAddOrDelete() |
902 res = dia.hasAddOrDelete() |
903 self.checkVCSStatus() |
903 self.checkVCSStatus() |
904 else: |
904 else: |
905 res = False |
905 res = False |
906 |
906 |
924 from .GitMergeDialog import GitMergeDialog |
924 from .GitMergeDialog import GitMergeDialog |
925 dlg = GitMergeDialog(self.gitGetTagsList(repodir), |
925 dlg = GitMergeDialog(self.gitGetTagsList(repodir), |
926 self.gitGetBranchesList(repodir, withMaster=True), |
926 self.gitGetBranchesList(repodir, withMaster=True), |
927 self.gitGetCurrentBranch(repodir), |
927 self.gitGetCurrentBranch(repodir), |
928 self.gitGetBranchesList(repodir, remotes=True)) |
928 self.gitGetBranchesList(repodir, remotes=True)) |
929 if dlg.exec_() == QDialog.Accepted: |
929 if dlg.exec() == QDialog.Accepted: |
930 commit, doCommit, commitMessage, addLog, diffStat = ( |
930 commit, doCommit, commitMessage, addLog, diffStat = ( |
931 dlg.getParameters() |
931 dlg.getParameters() |
932 ) |
932 ) |
933 args = self.initCommand("merge") |
933 args = self.initCommand("merge") |
934 if doCommit: |
934 if doCommit: |
949 args.append(commit) |
949 args.append(commit) |
950 |
950 |
951 dia = GitDialog(self.tr('Merging').format(name), self) |
951 dia = GitDialog(self.tr('Merging').format(name), self) |
952 res = dia.startProcess(args, repodir) |
952 res = dia.startProcess(args, repodir) |
953 if res: |
953 if res: |
954 dia.exec_() |
954 dia.exec() |
955 self.checkVCSStatus() |
955 self.checkVCSStatus() |
956 |
956 |
957 def vcsSwitch(self, name): |
957 def vcsSwitch(self, name): |
958 """ |
958 """ |
959 Public method used to switch a working directory to a different |
959 Public method used to switch a working directory to a different |
977 self.gitGetTagsList(repodir), |
977 self.gitGetTagsList(repodir), |
978 self.gitGetBranchesList(repodir), |
978 self.gitGetBranchesList(repodir), |
979 trackingBranchesList=self.gitGetBranchesList( |
979 trackingBranchesList=self.gitGetBranchesList( |
980 repodir, remotes=True), |
980 repodir, remotes=True), |
981 noneLabel=self.tr("Master branch head")) |
981 noneLabel=self.tr("Master branch head")) |
982 if dlg.exec_() == QDialog.Accepted: |
982 if dlg.exec() == QDialog.Accepted: |
983 rev = dlg.getRevision() |
983 rev = dlg.getRevision() |
984 return self.vcsUpdate(name, revision=rev) |
984 return self.vcsUpdate(name, revision=rev) |
985 |
985 |
986 return False |
986 return False |
987 |
987 |
1182 |
1182 |
1183 @param name directory name of the working directory (string) |
1183 @param name directory name of the working directory (string) |
1184 """ |
1184 """ |
1185 from .GitCommandDialog import GitCommandDialog |
1185 from .GitCommandDialog import GitCommandDialog |
1186 dlg = GitCommandDialog(self.commandHistory, name) |
1186 dlg = GitCommandDialog(self.commandHistory, name) |
1187 if dlg.exec_() == QDialog.Accepted: |
1187 if dlg.exec() == QDialog.Accepted: |
1188 command = dlg.getData() |
1188 command = dlg.getData() |
1189 commandList = Utilities.parseOptionString(command) |
1189 commandList = Utilities.parseOptionString(command) |
1190 |
1190 |
1191 # This moves any previous occurrence of these arguments to the head |
1191 # This moves any previous occurrence of these arguments to the head |
1192 # of the list. |
1192 # of the list. |
1205 return |
1205 return |
1206 |
1206 |
1207 dia = GitDialog(self.tr('Git Command'), self) |
1207 dia = GitDialog(self.tr('Git Command'), self) |
1208 res = dia.startProcess(args, repodir) |
1208 res = dia.startProcess(args, repodir) |
1209 if res: |
1209 if res: |
1210 dia.exec_() |
1210 dia.exec() |
1211 |
1211 |
1212 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): |
1212 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): |
1213 """ |
1213 """ |
1214 Public method to get a dialog to enter repository info. |
1214 Public method to get a dialog to enter repository info. |
1215 |
1215 |
1424 @param project reference to the project object |
1424 @param project reference to the project object |
1425 @return flag indicating successful operation (boolean) |
1425 @return flag indicating successful operation (boolean) |
1426 """ |
1426 """ |
1427 from .GitCopyDialog import GitCopyDialog |
1427 from .GitCopyDialog import GitCopyDialog |
1428 dlg = GitCopyDialog(name) |
1428 dlg = GitCopyDialog(name) |
1429 if dlg.exec_() == QDialog.Accepted: |
1429 if dlg.exec() == QDialog.Accepted: |
1430 target, force = dlg.getData() |
1430 target, force = dlg.getData() |
1431 |
1431 |
1432 # step 1: copy the file/directory: |
1432 # step 1: copy the file/directory: |
1433 if os.path.isdir(name): |
1433 if os.path.isdir(name): |
1434 try: |
1434 try: |
1513 return |
1513 return |
1514 |
1514 |
1515 from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
1515 from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
1516 dlg = GitRevisionsSelectionDialog(self.gitGetTagsList(repodir), |
1516 dlg = GitRevisionsSelectionDialog(self.gitGetTagsList(repodir), |
1517 self.gitGetBranchesList(repodir)) |
1517 self.gitGetBranchesList(repodir)) |
1518 if dlg.exec_() == QDialog.Accepted: |
1518 if dlg.exec() == QDialog.Accepted: |
1519 revisions = dlg.getRevisions() |
1519 revisions = dlg.getRevisions() |
1520 if self.diff is None: |
1520 if self.diff is None: |
1521 from .GitDiffDialog import GitDiffDialog |
1521 from .GitDiffDialog import GitDiffDialog |
1522 self.diff = GitDiffDialog(self) |
1522 self.diff = GitDiffDialog(self) |
1523 self.diff.show() |
1523 self.diff.show() |
1597 from .GitRevisionsSelectionDialog import ( |
1597 from .GitRevisionsSelectionDialog import ( |
1598 GitRevisionsSelectionDialog |
1598 GitRevisionsSelectionDialog |
1599 ) |
1599 ) |
1600 dlg = GitRevisionsSelectionDialog(self.gitGetTagsList(repodir), |
1600 dlg = GitRevisionsSelectionDialog(self.gitGetTagsList(repodir), |
1601 self.gitGetBranchesList(repodir)) |
1601 self.gitGetBranchesList(repodir)) |
1602 if dlg.exec_() == QDialog.Accepted: |
1602 if dlg.exec() == QDialog.Accepted: |
1603 rev1, rev2 = dlg.getRevisions() |
1603 rev1, rev2 = dlg.getRevisions() |
1604 elif revisions: |
1604 elif revisions: |
1605 rev1, rev2 = revisions[0], revisions[1] |
1605 rev1, rev2 = revisions[0], revisions[1] |
1606 else: |
1606 else: |
1607 rev1, rev2 = "", "" |
1607 rev1, rev2 = "", "" |
1661 if os.path.splitdrive(repodir)[1] == os.sep: |
1661 if os.path.splitdrive(repodir)[1] == os.sep: |
1662 return |
1662 return |
1663 |
1663 |
1664 from .GitFetchDialog import GitFetchDialog |
1664 from .GitFetchDialog import GitFetchDialog |
1665 dlg = GitFetchDialog(self, repodir) |
1665 dlg = GitFetchDialog(self, repodir) |
1666 if dlg.exec_() == QDialog.Accepted: |
1666 if dlg.exec() == QDialog.Accepted: |
1667 (remote, url, remoteBranches, localBranch, fetchAll, prune, |
1667 (remote, url, remoteBranches, localBranch, fetchAll, prune, |
1668 includeTags) = dlg.getData() |
1668 includeTags) = dlg.getData() |
1669 |
1669 |
1670 args = self.initCommand("fetch") |
1670 args = self.initCommand("fetch") |
1671 args.append('--verbose') |
1671 args.append('--verbose') |
1684 |
1684 |
1685 dia = GitDialog(self.tr('Fetching from a remote Git repository'), |
1685 dia = GitDialog(self.tr('Fetching from a remote Git repository'), |
1686 self) |
1686 self) |
1687 res = dia.startProcess(args, repodir) |
1687 res = dia.startProcess(args, repodir) |
1688 if res: |
1688 if res: |
1689 dia.exec_() |
1689 dia.exec() |
1690 self.checkVCSStatus() |
1690 self.checkVCSStatus() |
1691 |
1691 |
1692 def gitPull(self, name): |
1692 def gitPull(self, name): |
1693 """ |
1693 """ |
1694 Public method used to pull changes from a remote Git repository. |
1694 Public method used to pull changes from a remote Git repository. |
1704 if os.path.splitdrive(repodir)[1] == os.sep: |
1704 if os.path.splitdrive(repodir)[1] == os.sep: |
1705 return False |
1705 return False |
1706 |
1706 |
1707 from .GitPullDialog import GitPullDialog |
1707 from .GitPullDialog import GitPullDialog |
1708 dlg = GitPullDialog(self, repodir) |
1708 dlg = GitPullDialog(self, repodir) |
1709 if dlg.exec_() == QDialog.Accepted: |
1709 if dlg.exec() == QDialog.Accepted: |
1710 remote, url, branches, pullAll, prune = dlg.getData() |
1710 remote, url, branches, pullAll, prune = dlg.getData() |
1711 |
1711 |
1712 args = self.initCommand('pull') |
1712 args = self.initCommand('pull') |
1713 args.append('--no-commit') |
1713 args.append('--no-commit') |
1714 args.append('--verbose') |
1714 args.append('--verbose') |
1744 if os.path.splitdrive(repodir)[1] == os.sep: |
1744 if os.path.splitdrive(repodir)[1] == os.sep: |
1745 return |
1745 return |
1746 |
1746 |
1747 from .GitPushDialog import GitPushDialog |
1747 from .GitPushDialog import GitPushDialog |
1748 dlg = GitPushDialog(self, repodir) |
1748 dlg = GitPushDialog(self, repodir) |
1749 if dlg.exec_() == QDialog.Accepted: |
1749 if dlg.exec() == QDialog.Accepted: |
1750 remote, refspecs, tags, tracking, submodule = dlg.getData() |
1750 remote, refspecs, tags, tracking, submodule = dlg.getData() |
1751 |
1751 |
1752 args = self.initCommand("push") |
1752 args = self.initCommand("push") |
1753 args.append('--verbose') |
1753 args.append('--verbose') |
1754 args.append('--porcelain') |
1754 args.append('--porcelain') |
1763 |
1763 |
1764 dia = GitDialog( |
1764 dia = GitDialog( |
1765 self.tr('Pushing to a remote Git repository'), self) |
1765 self.tr('Pushing to a remote Git repository'), self) |
1766 res = dia.startProcess(args, repodir) |
1766 res = dia.startProcess(args, repodir) |
1767 if res: |
1767 if res: |
1768 dia.exec_() |
1768 dia.exec() |
1769 self.checkVCSStatus() |
1769 self.checkVCSStatus() |
1770 |
1770 |
1771 def gitCommitMerge(self, name): |
1771 def gitCommitMerge(self, name): |
1772 """ |
1772 """ |
1773 Public method to commit a failed merge. |
1773 Public method to commit a failed merge. |
1790 args = self.initCommand("commit") |
1790 args = self.initCommand("commit") |
1791 |
1791 |
1792 dia = GitDialog(self.tr('Committing failed merge'), self) |
1792 dia = GitDialog(self.tr('Committing failed merge'), self) |
1793 res = dia.startProcess(args, repodir, environment=env) |
1793 res = dia.startProcess(args, repodir, environment=env) |
1794 if res: |
1794 if res: |
1795 dia.exec_() |
1795 dia.exec() |
1796 self.committed.emit() |
1796 self.committed.emit() |
1797 self.checkVCSStatus() |
1797 self.checkVCSStatus() |
1798 |
1798 |
1799 def gitCancelMerge(self, name): |
1799 def gitCancelMerge(self, name): |
1800 """ |
1800 """ |
1819 dia = GitDialog( |
1819 dia = GitDialog( |
1820 self.tr('Aborting uncommitted/failed merge'), |
1820 self.tr('Aborting uncommitted/failed merge'), |
1821 self) |
1821 self) |
1822 res = dia.startProcess(args, repodir, False) |
1822 res = dia.startProcess(args, repodir, False) |
1823 if res: |
1823 if res: |
1824 dia.exec_() |
1824 dia.exec() |
1825 res = dia.hasAddOrDelete() |
1825 res = dia.hasAddOrDelete() |
1826 self.checkVCSStatus() |
1826 self.checkVCSStatus() |
1827 return res |
1827 return res |
1828 |
1828 |
1829 def gitApply(self, repodir, patchFile, cached=False, reverse=False, |
1829 def gitApply(self, repodir, patchFile, cached=False, reverse=False, |
1852 dia = GitDialog( |
1852 dia = GitDialog( |
1853 self.tr('Applying patch'), |
1853 self.tr('Applying patch'), |
1854 self) |
1854 self) |
1855 res = dia.startProcess(args, repodir) |
1855 res = dia.startProcess(args, repodir) |
1856 if res: |
1856 if res: |
1857 dia.exec_() |
1857 dia.exec() |
1858 |
1858 |
1859 def gitApplyCheckPatches(self, projectDir, check=False): |
1859 def gitApplyCheckPatches(self, projectDir, check=False): |
1860 """ |
1860 """ |
1861 Public method to apply a list of patch files or check, if they would |
1861 Public method to apply a list of patch files or check, if they would |
1862 apply cleanly. |
1862 apply cleanly. |
1871 if os.path.splitdrive(repodir)[1] == os.sep: |
1871 if os.path.splitdrive(repodir)[1] == os.sep: |
1872 return |
1872 return |
1873 |
1873 |
1874 from .GitPatchFilesDialog import GitPatchFilesDialog |
1874 from .GitPatchFilesDialog import GitPatchFilesDialog |
1875 dlg = GitPatchFilesDialog(repodir, self.__patchCheckData) |
1875 dlg = GitPatchFilesDialog(repodir, self.__patchCheckData) |
1876 if dlg.exec_() == QDialog.Accepted: |
1876 if dlg.exec() == QDialog.Accepted: |
1877 patchFilesList, stripCount, inaccurateEof, recount = dlg.getData() |
1877 patchFilesList, stripCount, inaccurateEof, recount = dlg.getData() |
1878 if patchFilesList: |
1878 if patchFilesList: |
1879 args = self.initCommand("apply") |
1879 args = self.initCommand("apply") |
1880 if check: |
1880 if check: |
1881 args.append("--check") |
1881 args.append("--check") |
1938 if os.path.splitdrive(repodir)[1] == os.sep: |
1938 if os.path.splitdrive(repodir)[1] == os.sep: |
1939 return False |
1939 return False |
1940 |
1940 |
1941 from .GitTagDialog import GitTagDialog |
1941 from .GitTagDialog import GitTagDialog |
1942 dlg = GitTagDialog(self.gitGetTagsList(repodir), revision, tagName) |
1942 dlg = GitTagDialog(self.gitGetTagsList(repodir), revision, tagName) |
1943 if dlg.exec_() == QDialog.Accepted: |
1943 if dlg.exec() == QDialog.Accepted: |
1944 tag, revision, tagOp, tagType, force = dlg.getParameters() |
1944 tag, revision, tagOp, tagType, force = dlg.getParameters() |
1945 else: |
1945 else: |
1946 return False |
1946 return False |
1947 |
1947 |
1948 args = self.initCommand("tag") |
1948 args = self.initCommand("tag") |
2134 |
2134 |
2135 from .GitBranchDialog import GitBranchDialog |
2135 from .GitBranchDialog import GitBranchDialog |
2136 dlg = GitBranchDialog( |
2136 dlg = GitBranchDialog( |
2137 self.gitGetBranchesList(repodir, allBranches=True), |
2137 self.gitGetBranchesList(repodir, allBranches=True), |
2138 revision, branchName, branchOp) |
2138 revision, branchName, branchOp) |
2139 if dlg.exec_() == QDialog.Accepted: |
2139 if dlg.exec() == QDialog.Accepted: |
2140 branchOp, branch, revision, newBranch, remoteBranch, force = ( |
2140 branchOp, branch, revision, newBranch, remoteBranch, force = ( |
2141 dlg.getParameters() |
2141 dlg.getParameters() |
2142 ) |
2142 ) |
2143 else: |
2143 else: |
2144 return False, False |
2144 return False, False |
2195 |
2195 |
2196 dia = GitDialog(self.tr('Branching in the Git repository'), |
2196 dia = GitDialog(self.tr('Branching in the Git repository'), |
2197 self) |
2197 self) |
2198 res = dia.startProcess(args, repodir) |
2198 res = dia.startProcess(args, repodir) |
2199 if res: |
2199 if res: |
2200 dia.exec_() |
2200 dia.exec() |
2201 if branchOp in [GitBranchDialog.CreateSwitchBranch, |
2201 if branchOp in [GitBranchDialog.CreateSwitchBranch, |
2202 GitBranchDialog.CreateTrackingBranch]: |
2202 GitBranchDialog.CreateTrackingBranch]: |
2203 update = dia.hasAddOrDelete() |
2203 update = dia.hasAddOrDelete() |
2204 self.checkVCSStatus() |
2204 self.checkVCSStatus() |
2205 else: |
2205 else: |
2224 |
2224 |
2225 from .GitBranchPushDialog import GitBranchPushDialog |
2225 from .GitBranchPushDialog import GitBranchPushDialog |
2226 dlg = GitBranchPushDialog(self.gitGetBranchesList(repodir), |
2226 dlg = GitBranchPushDialog(self.gitGetBranchesList(repodir), |
2227 self.gitGetRemotesList(repodir), |
2227 self.gitGetRemotesList(repodir), |
2228 delete=True) |
2228 delete=True) |
2229 if dlg.exec_() == QDialog.Accepted: |
2229 if dlg.exec() == QDialog.Accepted: |
2230 branchName, remoteName = dlg.getData()[:2] |
2230 branchName, remoteName = dlg.getData()[:2] |
2231 |
2231 |
2232 args = self.initCommand("push") |
2232 args = self.initCommand("push") |
2233 args.append(remoteName) |
2233 args.append(remoteName) |
2234 args.append(":{0}".format(branchName)) |
2234 args.append(":{0}".format(branchName)) |
2235 |
2235 |
2236 dia = GitDialog(self.tr('Delete Remote Branch'), self) |
2236 dia = GitDialog(self.tr('Delete Remote Branch'), self) |
2237 res = dia.startProcess(args, repodir) |
2237 res = dia.startProcess(args, repodir) |
2238 if res: |
2238 if res: |
2239 dia.exec_() |
2239 dia.exec() |
2240 |
2240 |
2241 def gitShowBranch(self, name): |
2241 def gitShowBranch(self, name): |
2242 """ |
2242 """ |
2243 Public method used to show the current branch of the working directory. |
2243 Public method used to show the current branch of the working directory. |
2244 |
2244 |
2278 return |
2278 return |
2279 |
2279 |
2280 from .GitBundleDialog import GitBundleDialog |
2280 from .GitBundleDialog import GitBundleDialog |
2281 dlg = GitBundleDialog(self.gitGetTagsList(repodir), |
2281 dlg = GitBundleDialog(self.gitGetTagsList(repodir), |
2282 self.gitGetBranchesList(repodir)) |
2282 self.gitGetBranchesList(repodir)) |
2283 if dlg.exec_() == QDialog.Accepted: |
2283 if dlg.exec() == QDialog.Accepted: |
2284 revs = dlg.getData() |
2284 revs = dlg.getData() |
2285 |
2285 |
2286 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
2286 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
2287 None, |
2287 None, |
2288 self.tr("Create Bundle"), |
2288 self.tr("Create Bundle"), |
2319 args.append(rev) |
2319 args.append(rev) |
2320 |
2320 |
2321 dia = GitDialog(self.tr('Create Bundle'), self) |
2321 dia = GitDialog(self.tr('Create Bundle'), self) |
2322 res = dia.startProcess(args, repodir) |
2322 res = dia.startProcess(args, repodir) |
2323 if res: |
2323 if res: |
2324 dia.exec_() |
2324 dia.exec() |
2325 |
2325 |
2326 def gitVerifyBundle(self, projectDir): |
2326 def gitVerifyBundle(self, projectDir): |
2327 """ |
2327 """ |
2328 Public method to verify a bundle file. |
2328 Public method to verify a bundle file. |
2329 |
2329 |
2349 args.append(fname) |
2349 args.append(fname) |
2350 |
2350 |
2351 dia = GitDialog(self.tr('Verify Bundle'), self) |
2351 dia = GitDialog(self.tr('Verify Bundle'), self) |
2352 res = dia.startProcess(args, repodir) |
2352 res = dia.startProcess(args, repodir) |
2353 if res: |
2353 if res: |
2354 dia.exec_() |
2354 dia.exec() |
2355 |
2355 |
2356 def gitBundleListHeads(self, projectDir): |
2356 def gitBundleListHeads(self, projectDir): |
2357 """ |
2357 """ |
2358 Public method to list the heads contained in a bundle file. |
2358 Public method to list the heads contained in a bundle file. |
2359 |
2359 |
2379 args.append(fname) |
2379 args.append(fname) |
2380 |
2380 |
2381 dia = GitDialog(self.tr('List Bundle Heads'), self) |
2381 dia = GitDialog(self.tr('List Bundle Heads'), self) |
2382 res = dia.startProcess(args, repodir) |
2382 res = dia.startProcess(args, repodir) |
2383 if res: |
2383 if res: |
2384 dia.exec_() |
2384 dia.exec() |
2385 |
2385 |
2386 def gitGetBundleHeads(self, repodir, bundleFile): |
2386 def gitGetBundleHeads(self, repodir, bundleFile): |
2387 """ |
2387 """ |
2388 Public method to get a list of heads contained in a bundle file. |
2388 Public method to get a list of heads contained in a bundle file. |
2389 |
2389 |
2439 |
2439 |
2440 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2440 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2441 dlg = GitApplyBundleDataDialog( |
2441 dlg = GitApplyBundleDataDialog( |
2442 self.gitGetBundleHeads(repodir, fname), |
2442 self.gitGetBundleHeads(repodir, fname), |
2443 self.gitGetBranchesList(repodir)) |
2443 self.gitGetBranchesList(repodir)) |
2444 if dlg.exec_() == QDialog.Accepted: |
2444 if dlg.exec() == QDialog.Accepted: |
2445 bundleHead, branch = dlg.getData() |
2445 bundleHead, branch = dlg.getData() |
2446 |
2446 |
2447 args = self.initCommand("fetch") |
2447 args = self.initCommand("fetch") |
2448 args.append('--verbose') |
2448 args.append('--verbose') |
2449 args.append(fname) |
2449 args.append(fname) |
2454 |
2454 |
2455 dia = GitDialog(self.tr('Applying a bundle file (fetch)'), |
2455 dia = GitDialog(self.tr('Applying a bundle file (fetch)'), |
2456 self) |
2456 self) |
2457 res = dia.startProcess(args, repodir) |
2457 res = dia.startProcess(args, repodir) |
2458 if res: |
2458 if res: |
2459 dia.exec_() |
2459 dia.exec() |
2460 res = dia.hasAddOrDelete() |
2460 res = dia.hasAddOrDelete() |
2461 self.checkVCSStatus() |
2461 self.checkVCSStatus() |
2462 |
2462 |
2463 def gitBundlePull(self, projectDir): |
2463 def gitBundlePull(self, projectDir): |
2464 """ |
2464 """ |
2487 |
2487 |
2488 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2488 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2489 dlg = GitApplyBundleDataDialog( |
2489 dlg = GitApplyBundleDataDialog( |
2490 self.gitGetBundleHeads(repodir, fname), |
2490 self.gitGetBundleHeads(repodir, fname), |
2491 self.gitGetBranchesList(repodir)) |
2491 self.gitGetBranchesList(repodir)) |
2492 if dlg.exec_() == QDialog.Accepted: |
2492 if dlg.exec() == QDialog.Accepted: |
2493 bundleHead, branch = dlg.getData() |
2493 bundleHead, branch = dlg.getData() |
2494 |
2494 |
2495 args = self.initCommand("pull") |
2495 args = self.initCommand("pull") |
2496 args.append('--verbose') |
2496 args.append('--verbose') |
2497 args.append(fname) |
2497 args.append(fname) |
2546 from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
2546 from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
2547 dlg = GitRevisionSelectionDialog(self.gitGetTagsList(repodir), |
2547 dlg = GitRevisionSelectionDialog(self.gitGetTagsList(repodir), |
2548 self.gitGetBranchesList(repodir), |
2548 self.gitGetBranchesList(repodir), |
2549 showBranches=showBranches, |
2549 showBranches=showBranches, |
2550 showHead=showHead) |
2550 showHead=showHead) |
2551 if dlg.exec_() == QDialog.Accepted: |
2551 if dlg.exec() == QDialog.Accepted: |
2552 rev = dlg.getRevision() |
2552 rev = dlg.getRevision() |
2553 else: |
2553 else: |
2554 return False |
2554 return False |
2555 |
2555 |
2556 args = self.initCommand("bisect") |
2556 args = self.initCommand("bisect") |
2557 if subcommand == "start_extended": |
2557 if subcommand == "start_extended": |
2558 from .GitBisectStartDialog import GitBisectStartDialog |
2558 from .GitBisectStartDialog import GitBisectStartDialog |
2559 dlg = GitBisectStartDialog() |
2559 dlg = GitBisectStartDialog() |
2560 if dlg.exec_() == QDialog.Accepted: |
2560 if dlg.exec() == QDialog.Accepted: |
2561 bad, good, noCheckout = dlg.getData() |
2561 bad, good, noCheckout = dlg.getData() |
2562 args.append("start") |
2562 args.append("start") |
2563 if noCheckout: |
2563 if noCheckout: |
2564 args.append("--no-checkout") |
2564 args.append("--no-checkout") |
2565 args.append(bad) |
2565 args.append(bad) |
2888 args.append(remoteName) |
2888 args.append(remoteName) |
2889 |
2889 |
2890 dia = GitDialog(self.tr('Show Remote Info'), self) |
2890 dia = GitDialog(self.tr('Show Remote Info'), self) |
2891 res = dia.startProcess(args, repodir, showArgs=False) |
2891 res = dia.startProcess(args, repodir, showArgs=False) |
2892 if res: |
2892 if res: |
2893 dia.exec_() |
2893 dia.exec() |
2894 |
2894 |
2895 def gitShowRemotes(self, projectDir): |
2895 def gitShowRemotes(self, projectDir): |
2896 """ |
2896 """ |
2897 Public method to show available remote repositories. |
2897 Public method to show available remote repositories. |
2898 |
2898 |
2920 if os.path.splitdrive(repodir)[1] == os.sep: |
2920 if os.path.splitdrive(repodir)[1] == os.sep: |
2921 return |
2921 return |
2922 |
2922 |
2923 from .GitAddRemoteDialog import GitAddRemoteDialog |
2923 from .GitAddRemoteDialog import GitAddRemoteDialog |
2924 dlg = GitAddRemoteDialog() |
2924 dlg = GitAddRemoteDialog() |
2925 if dlg.exec_() == QDialog.Accepted: |
2925 if dlg.exec() == QDialog.Accepted: |
2926 name, url = dlg.getData() |
2926 name, url = dlg.getData() |
2927 args = self.initCommand("remote") |
2927 args = self.initCommand("remote") |
2928 args.append("add") |
2928 args.append("add") |
2929 args.append(name) |
2929 args.append(name) |
2930 args.append(url) |
2930 args.append(url) |
2981 if not remoteUrl: |
2981 if not remoteUrl: |
2982 remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) |
2982 remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) |
2983 |
2983 |
2984 from .GitChangeRemoteUrlDialog import GitChangeRemoteUrlDialog |
2984 from .GitChangeRemoteUrlDialog import GitChangeRemoteUrlDialog |
2985 dlg = GitChangeRemoteUrlDialog(remoteName, remoteUrl) |
2985 dlg = GitChangeRemoteUrlDialog(remoteName, remoteUrl) |
2986 if dlg.exec_() == QDialog.Accepted: |
2986 if dlg.exec() == QDialog.Accepted: |
2987 name, url = dlg.getData() |
2987 name, url = dlg.getData() |
2988 if url != remoteUrl: |
2988 if url != remoteUrl: |
2989 args = self.initCommand("remote") |
2989 args = self.initCommand("remote") |
2990 args.append("set-url") |
2990 args.append("set-url") |
2991 args.append(name) |
2991 args.append(name) |
3015 if not remoteUrl: |
3015 if not remoteUrl: |
3016 remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) |
3016 remoteUrl = self.gitGetRemoteUrl(repodir, remoteName) |
3017 |
3017 |
3018 from .GitRemoteCredentialsDialog import GitRemoteCredentialsDialog |
3018 from .GitRemoteCredentialsDialog import GitRemoteCredentialsDialog |
3019 dlg = GitRemoteCredentialsDialog(remoteName, remoteUrl) |
3019 dlg = GitRemoteCredentialsDialog(remoteName, remoteUrl) |
3020 if dlg.exec_() == QDialog.Accepted: |
3020 if dlg.exec() == QDialog.Accepted: |
3021 name, url = dlg.getData() |
3021 name, url = dlg.getData() |
3022 if url != remoteUrl: |
3022 if url != remoteUrl: |
3023 args = self.initCommand("remote") |
3023 args = self.initCommand("remote") |
3024 args.append("set-url") |
3024 args.append("set-url") |
3025 args.append(name) |
3025 args.append(name) |
3068 args.append(remoteName) |
3068 args.append(remoteName) |
3069 |
3069 |
3070 dia = GitDialog(self.tr('Show Remote Info'), self) |
3070 dia = GitDialog(self.tr('Show Remote Info'), self) |
3071 res = dia.startProcess(args, repodir) |
3071 res = dia.startProcess(args, repodir) |
3072 if res: |
3072 if res: |
3073 dia.exec_() |
3073 dia.exec() |
3074 |
3074 |
3075 def gitShortlog(self, projectDir, commit): |
3075 def gitShortlog(self, projectDir, commit): |
3076 """ |
3076 """ |
3077 Public method to show a short log suitable for inclusion in release |
3077 Public method to show a short log suitable for inclusion in release |
3078 announcements. |
3078 announcements. |
3092 args.append(commit) |
3092 args.append(commit) |
3093 |
3093 |
3094 dia = GitDialog(self.tr('Show Shortlog'), self) |
3094 dia = GitDialog(self.tr('Show Shortlog'), self) |
3095 res = dia.startProcess(args, repodir, showArgs=False) |
3095 res = dia.startProcess(args, repodir, showArgs=False) |
3096 if res: |
3096 if res: |
3097 dia.exec_() |
3097 dia.exec() |
3098 |
3098 |
3099 def gitDescribe(self, projectDir, commits): |
3099 def gitDescribe(self, projectDir, commits): |
3100 """ |
3100 """ |
3101 Public method to find the most recent tag reachable from each commit. |
3101 Public method to find the most recent tag reachable from each commit. |
3102 |
3102 |
3133 |
3133 |
3134 res = False |
3134 res = False |
3135 |
3135 |
3136 from .GitCherryPickDialog import GitCherryPickDialog |
3136 from .GitCherryPickDialog import GitCherryPickDialog |
3137 dlg = GitCherryPickDialog(commits) |
3137 dlg = GitCherryPickDialog(commits) |
3138 if dlg.exec_() == QDialog.Accepted: |
3138 if dlg.exec() == QDialog.Accepted: |
3139 commits, cherrypickInfo, signoff, nocommit = ( |
3139 commits, cherrypickInfo, signoff, nocommit = ( |
3140 dlg.getData() |
3140 dlg.getData() |
3141 ) |
3141 ) |
3142 |
3142 |
3143 args = self.initCommand("cherry-pick") |
3143 args = self.initCommand("cherry-pick") |
3151 args.extend(commits) |
3151 args.extend(commits) |
3152 |
3152 |
3153 dia = GitDialog(self.tr('Cherry-pick'), self) |
3153 dia = GitDialog(self.tr('Cherry-pick'), self) |
3154 res = dia.startProcess(args, repodir) |
3154 res = dia.startProcess(args, repodir) |
3155 if res: |
3155 if res: |
3156 dia.exec_() |
3156 dia.exec() |
3157 res = dia.hasAddOrDelete() |
3157 res = dia.hasAddOrDelete() |
3158 self.checkVCSStatus() |
3158 self.checkVCSStatus() |
3159 return res |
3159 return res |
3160 |
3160 |
3161 def gitCherryPickContinue(self, projectDir): |
3161 def gitCherryPickContinue(self, projectDir): |
3181 args.append("--continue") |
3181 args.append("--continue") |
3182 |
3182 |
3183 dia = GitDialog(self.tr('Copy Changesets (Continue)'), self) |
3183 dia = GitDialog(self.tr('Copy Changesets (Continue)'), self) |
3184 res = dia.startProcess(args, repodir, environment=env) |
3184 res = dia.startProcess(args, repodir, environment=env) |
3185 if res: |
3185 if res: |
3186 dia.exec_() |
3186 dia.exec() |
3187 res = dia.hasAddOrDelete() |
3187 res = dia.hasAddOrDelete() |
3188 self.checkVCSStatus() |
3188 self.checkVCSStatus() |
3189 return res |
3189 return res |
3190 |
3190 |
3191 def gitCherryPickQuit(self, projectDir): |
3191 def gitCherryPickQuit(self, projectDir): |
3206 args.append("--quit") |
3206 args.append("--quit") |
3207 |
3207 |
3208 dia = GitDialog(self.tr('Copy Changesets (Quit)'), self) |
3208 dia = GitDialog(self.tr('Copy Changesets (Quit)'), self) |
3209 res = dia.startProcess(args, repodir) |
3209 res = dia.startProcess(args, repodir) |
3210 if res: |
3210 if res: |
3211 dia.exec_() |
3211 dia.exec() |
3212 res = dia.hasAddOrDelete() |
3212 res = dia.hasAddOrDelete() |
3213 self.checkVCSStatus() |
3213 self.checkVCSStatus() |
3214 return res |
3214 return res |
3215 |
3215 |
3216 def gitCherryPickAbort(self, projectDir): |
3216 def gitCherryPickAbort(self, projectDir): |
3232 args.append("--abort") |
3232 args.append("--abort") |
3233 |
3233 |
3234 dia = GitDialog(self.tr('Copy Changesets (Cancel)'), self) |
3234 dia = GitDialog(self.tr('Copy Changesets (Cancel)'), self) |
3235 res = dia.startProcess(args, repodir) |
3235 res = dia.startProcess(args, repodir) |
3236 if res: |
3236 if res: |
3237 dia.exec_() |
3237 dia.exec() |
3238 res = dia.hasAddOrDelete() |
3238 res = dia.hasAddOrDelete() |
3239 self.checkVCSStatus() |
3239 self.checkVCSStatus() |
3240 return res |
3240 return res |
3241 |
3241 |
3242 ########################################################################### |
3242 ########################################################################### |
3295 return False |
3295 return False |
3296 |
3296 |
3297 res = False |
3297 res = False |
3298 from .GitStashDataDialog import GitStashDataDialog |
3298 from .GitStashDataDialog import GitStashDataDialog |
3299 dlg = GitStashDataDialog() |
3299 dlg = GitStashDataDialog() |
3300 if dlg.exec_() == QDialog.Accepted: |
3300 if dlg.exec() == QDialog.Accepted: |
3301 message, keepIndex, untracked = dlg.getData() |
3301 message, keepIndex, untracked = dlg.getData() |
3302 args = self.initCommand("stash") |
3302 args = self.initCommand("stash") |
3303 args.append("save") |
3303 args.append("save") |
3304 if keepIndex: |
3304 if keepIndex: |
3305 args.append("--keep-index") |
3305 args.append("--keep-index") |
3311 args.append(message) |
3311 args.append(message) |
3312 |
3312 |
3313 dia = GitDialog(self.tr('Saving stash'), self) |
3313 dia = GitDialog(self.tr('Saving stash'), self) |
3314 res = dia.startProcess(args, repodir) |
3314 res = dia.startProcess(args, repodir) |
3315 if res: |
3315 if res: |
3316 dia.exec_() |
3316 dia.exec() |
3317 res = dia.hasAddOrDelete() |
3317 res = dia.hasAddOrDelete() |
3318 self.checkVCSStatus() |
3318 self.checkVCSStatus() |
3319 return res |
3319 return res |
3320 |
3320 |
3321 def gitStashBrowser(self, projectDir): |
3321 def gitStashBrowser(self, projectDir): |
3396 args.append(stashName) |
3396 args.append(stashName) |
3397 |
3397 |
3398 dia = GitDialog(self.tr('Restoring stash'), self) |
3398 dia = GitDialog(self.tr('Restoring stash'), self) |
3399 res = dia.startProcess(args, repodir) |
3399 res = dia.startProcess(args, repodir) |
3400 if res: |
3400 if res: |
3401 dia.exec_() |
3401 dia.exec() |
3402 res = dia.hasAddOrDelete() |
3402 res = dia.hasAddOrDelete() |
3403 self.checkVCSStatus() |
3403 self.checkVCSStatus() |
3404 return res |
3404 return res |
3405 |
3405 |
3406 def gitStashPop(self, projectDir, stashName=""): |
3406 def gitStashPop(self, projectDir, stashName=""): |
3436 args.append(stashName) |
3436 args.append(stashName) |
3437 |
3437 |
3438 dia = GitDialog(self.tr('Restoring stash'), self) |
3438 dia = GitDialog(self.tr('Restoring stash'), self) |
3439 res = dia.startProcess(args, repodir) |
3439 res = dia.startProcess(args, repodir) |
3440 if res: |
3440 if res: |
3441 dia.exec_() |
3441 dia.exec() |
3442 res = dia.hasAddOrDelete() |
3442 res = dia.hasAddOrDelete() |
3443 self.checkVCSStatus() |
3443 self.checkVCSStatus() |
3444 return res |
3444 return res |
3445 |
3445 |
3446 def gitStashBranch(self, projectDir, stashName=""): |
3446 def gitStashBranch(self, projectDir, stashName=""): |
3485 args.append(stashName) |
3485 args.append(stashName) |
3486 |
3486 |
3487 dia = GitDialog(self.tr('Creating branch'), self) |
3487 dia = GitDialog(self.tr('Creating branch'), self) |
3488 res = dia.startProcess(args, repodir) |
3488 res = dia.startProcess(args, repodir) |
3489 if res: |
3489 if res: |
3490 dia.exec_() |
3490 dia.exec() |
3491 res = dia.hasAddOrDelete() |
3491 res = dia.hasAddOrDelete() |
3492 self.checkVCSStatus() |
3492 self.checkVCSStatus() |
3493 return res |
3493 return res |
3494 |
3494 |
3495 def gitStashDrop(self, projectDir, stashName=""): |
3495 def gitStashDrop(self, projectDir, stashName=""): |
3530 args.append(stashName) |
3530 args.append(stashName) |
3531 |
3531 |
3532 dia = GitDialog(self.tr('Deleting stash'), self) |
3532 dia = GitDialog(self.tr('Deleting stash'), self) |
3533 res = dia.startProcess(args, repodir) |
3533 res = dia.startProcess(args, repodir) |
3534 if res: |
3534 if res: |
3535 dia.exec_() |
3535 dia.exec() |
3536 return res |
3536 return res |
3537 |
3537 |
3538 def gitStashClear(self, projectDir): |
3538 def gitStashClear(self, projectDir): |
3539 """ |
3539 """ |
3540 Public method to delete all stashes. |
3540 Public method to delete all stashes. |
3558 args.append("clear") |
3558 args.append("clear") |
3559 |
3559 |
3560 dia = GitDialog(self.tr('Deleting all stashes'), self) |
3560 dia = GitDialog(self.tr('Deleting all stashes'), self) |
3561 res = dia.startProcess(args, repodir) |
3561 res = dia.startProcess(args, repodir) |
3562 if res: |
3562 if res: |
3563 dia.exec_() |
3563 dia.exec() |
3564 return res |
3564 return res |
3565 |
3565 |
3566 def gitEditConfig(self, projectDir): |
3566 def gitEditConfig(self, projectDir): |
3567 """ |
3567 """ |
3568 Public method used to edit the repository configuration file. |
3568 Public method used to edit the repository configuration file. |
3594 from .GitUtilities import getConfigPath |
3594 from .GitUtilities import getConfigPath |
3595 cfgFile = getConfigPath() |
3595 cfgFile = getConfigPath() |
3596 if not os.path.exists(cfgFile): |
3596 if not os.path.exists(cfgFile): |
3597 from .GitUserConfigDataDialog import GitUserConfigDataDialog |
3597 from .GitUserConfigDataDialog import GitUserConfigDataDialog |
3598 dlg = GitUserConfigDataDialog() |
3598 dlg = GitUserConfigDataDialog() |
3599 if dlg.exec_() == QDialog.Accepted: |
3599 if dlg.exec() == QDialog.Accepted: |
3600 firstName, lastName, email = dlg.getData() |
3600 firstName, lastName, email = dlg.getData() |
3601 else: |
3601 else: |
3602 firstName, lastName, email = ( |
3602 firstName, lastName, email = ( |
3603 "Firstname", "Lastname", "email_address") |
3603 "Firstname", "Lastname", "email_address") |
3604 try: |
3604 try: |
3632 dia = GitDialog( |
3632 dia = GitDialog( |
3633 self.tr('Showing the combined configuration settings'), |
3633 self.tr('Showing the combined configuration settings'), |
3634 self) |
3634 self) |
3635 res = dia.startProcess(args, repodir, False) |
3635 res = dia.startProcess(args, repodir, False) |
3636 if res: |
3636 if res: |
3637 dia.exec_() |
3637 dia.exec() |
3638 |
3638 |
3639 def gitVerify(self, projectDir): |
3639 def gitVerify(self, projectDir): |
3640 """ |
3640 """ |
3641 Public method to verify the connectivity and validity of objects |
3641 Public method to verify the connectivity and validity of objects |
3642 of the database. |
3642 of the database. |
3658 dia = GitDialog( |
3658 dia = GitDialog( |
3659 self.tr('Verifying the integrity of the Git repository'), |
3659 self.tr('Verifying the integrity of the Git repository'), |
3660 self) |
3660 self) |
3661 res = dia.startProcess(args, repodir, False) |
3661 res = dia.startProcess(args, repodir, False) |
3662 if res: |
3662 if res: |
3663 dia.exec_() |
3663 dia.exec() |
3664 |
3664 |
3665 def gitHouseKeeping(self, projectDir): |
3665 def gitHouseKeeping(self, projectDir): |
3666 """ |
3666 """ |
3667 Public method to cleanup and optimize the local repository. |
3667 Public method to cleanup and optimize the local repository. |
3668 |
3668 |
3683 dia = GitDialog( |
3683 dia = GitDialog( |
3684 self.tr('Performing Repository Housekeeping'), |
3684 self.tr('Performing Repository Housekeeping'), |
3685 self) |
3685 self) |
3686 res = dia.startProcess(args, repodir) |
3686 res = dia.startProcess(args, repodir) |
3687 if res: |
3687 if res: |
3688 dia.exec_() |
3688 dia.exec() |
3689 |
3689 |
3690 def gitStatistics(self, projectDir): |
3690 def gitStatistics(self, projectDir): |
3691 """ |
3691 """ |
3692 Public method to show some statistics of the local repository. |
3692 Public method to show some statistics of the local repository. |
3693 |
3693 |
3758 .format(statistics["size-garbage"])) |
3758 .format(statistics["size-garbage"])) |
3759 info.append("""</table></p>""") |
3759 info.append("""</table></p>""") |
3760 else: |
3760 else: |
3761 info.append(self.tr("<p><b>No statistics available.</b></p>")) |
3761 info.append(self.tr("<p><b>No statistics available.</b></p>")) |
3762 dlg = VcsRepositoryInfoDialog(None, "\n".join(info)) |
3762 dlg = VcsRepositoryInfoDialog(None, "\n".join(info)) |
3763 dlg.exec_() |
3763 dlg.exec() |
3764 |
3764 |
3765 def gitGetArchiveFormats(self, repodir): |
3765 def gitGetArchiveFormats(self, repodir): |
3766 """ |
3766 """ |
3767 Public method to get a list of supported archive formats. |
3767 Public method to get a list of supported archive formats. |
3768 |
3768 |
3809 dlg = GitArchiveDataDialog( |
3809 dlg = GitArchiveDataDialog( |
3810 self.gitGetTagsList(repodir), |
3810 self.gitGetTagsList(repodir), |
3811 self.gitGetBranchesList(repodir, withMaster=True), |
3811 self.gitGetBranchesList(repodir, withMaster=True), |
3812 self.gitGetArchiveFormats(repodir) |
3812 self.gitGetArchiveFormats(repodir) |
3813 ) |
3813 ) |
3814 if dlg.exec_() == QDialog.Accepted: |
3814 if dlg.exec() == QDialog.Accepted: |
3815 commit, archiveFormat, fileName, prefix = dlg.getData() |
3815 commit, archiveFormat, fileName, prefix = dlg.getData() |
3816 args = self.initCommand("archive") |
3816 args = self.initCommand("archive") |
3817 args.append("--format={0}".format(archiveFormat)) |
3817 args.append("--format={0}".format(archiveFormat)) |
3818 args.append("--output={0}".format(fileName)) |
3818 args.append("--output={0}".format(fileName)) |
3819 if prefix: |
3819 if prefix: |
3826 dia = GitDialog( |
3826 dia = GitDialog( |
3827 self.tr('Creating Archive'), |
3827 self.tr('Creating Archive'), |
3828 self) |
3828 self) |
3829 res = dia.startProcess(args, repodir) |
3829 res = dia.startProcess(args, repodir) |
3830 if res: |
3830 if res: |
3831 dia.exec_() |
3831 dia.exec() |
3832 |
3832 |
3833 ########################################################################### |
3833 ########################################################################### |
3834 ## Methods related to submodules. |
3834 ## Methods related to submodules. |
3835 ########################################################################### |
3835 ########################################################################### |
3836 |
3836 |
3848 if os.path.splitdrive(repodir)[1] == os.sep: |
3848 if os.path.splitdrive(repodir)[1] == os.sep: |
3849 return |
3849 return |
3850 |
3850 |
3851 from .GitSubmoduleAddDialog import GitSubmoduleAddDialog |
3851 from .GitSubmoduleAddDialog import GitSubmoduleAddDialog |
3852 dlg = GitSubmoduleAddDialog(self, repodir) |
3852 dlg = GitSubmoduleAddDialog(self, repodir) |
3853 if dlg.exec_() == QDialog.Accepted: |
3853 if dlg.exec() == QDialog.Accepted: |
3854 repo, branch, name, path, force = dlg.getData() |
3854 repo, branch, name, path, force = dlg.getData() |
3855 args = self.initCommand("submodule") |
3855 args = self.initCommand("submodule") |
3856 args.append("add") |
3856 args.append("add") |
3857 if branch: |
3857 if branch: |
3858 args.append("--branch") |
3858 args.append("--branch") |
3869 dia = GitDialog( |
3869 dia = GitDialog( |
3870 self.tr("Add Submodule"), |
3870 self.tr("Add Submodule"), |
3871 self) |
3871 self) |
3872 res = dia.startProcess(args, repodir) |
3872 res = dia.startProcess(args, repodir) |
3873 if res: |
3873 if res: |
3874 dia.exec_() |
3874 dia.exec() |
3875 |
3875 |
3876 def __gitSubmodulesList(self, repodir): |
3876 def __gitSubmodulesList(self, repodir): |
3877 """ |
3877 """ |
3878 Private method to get the data of defined submodules. |
3878 Private method to get the data of defined submodules. |
3879 |
3879 |
3930 |
3930 |
3931 submodulesList = self.__gitSubmodulesList(repodir) |
3931 submodulesList = self.__gitSubmodulesList(repodir) |
3932 if submodulesList: |
3932 if submodulesList: |
3933 from .GitSubmodulesListDialog import GitSubmodulesListDialog |
3933 from .GitSubmodulesListDialog import GitSubmodulesListDialog |
3934 dlg = GitSubmodulesListDialog(submodulesList) |
3934 dlg = GitSubmodulesListDialog(submodulesList) |
3935 dlg.exec_() |
3935 dlg.exec() |
3936 else: |
3936 else: |
3937 E5MessageBox.information( |
3937 E5MessageBox.information( |
3938 None, |
3938 None, |
3939 self.tr("List Submodules"), |
3939 self.tr("List Submodules"), |
3940 self.tr("""No submodules defined for the project.""")) |
3940 self.tr("""No submodules defined for the project.""")) |
3976 paths = [submodule["path"] |
3976 paths = [submodule["path"] |
3977 for submodule in self.__gitSubmodulesList(repodir)] |
3977 for submodule in self.__gitSubmodulesList(repodir)] |
3978 |
3978 |
3979 from .GitListDialog import GitListDialog |
3979 from .GitListDialog import GitListDialog |
3980 dlg = GitListDialog(sorted(paths)) |
3980 dlg = GitListDialog(sorted(paths)) |
3981 if dlg.exec_() == QDialog.Accepted: |
3981 if dlg.exec() == QDialog.Accepted: |
3982 selectedPaths = dlg.getSelection() |
3982 selectedPaths = dlg.getSelection() |
3983 return selectedPaths, True |
3983 return selectedPaths, True |
3984 else: |
3984 else: |
3985 return [], False |
3985 return [], False |
3986 |
3986 |
4007 dia = GitDialog( |
4007 dia = GitDialog( |
4008 self.tr("Initialize Submodules"), |
4008 self.tr("Initialize Submodules"), |
4009 self) |
4009 self) |
4010 res = dia.startProcess(args, repodir) |
4010 res = dia.startProcess(args, repodir) |
4011 if res: |
4011 if res: |
4012 dia.exec_() |
4012 dia.exec() |
4013 |
4013 |
4014 def gitSubmoduleDeinit(self, projectDir): |
4014 def gitSubmoduleDeinit(self, projectDir): |
4015 """ |
4015 """ |
4016 Public method to unregister submodules. |
4016 Public method to unregister submodules. |
4017 |
4017 |
4028 paths = [submodule["path"] |
4028 paths = [submodule["path"] |
4029 for submodule in self.__gitSubmodulesList(repodir)] |
4029 for submodule in self.__gitSubmodulesList(repodir)] |
4030 |
4030 |
4031 from .GitSubmodulesDeinitDialog import GitSubmodulesDeinitDialog |
4031 from .GitSubmodulesDeinitDialog import GitSubmodulesDeinitDialog |
4032 dlg = GitSubmodulesDeinitDialog(paths) |
4032 dlg = GitSubmodulesDeinitDialog(paths) |
4033 if dlg.exec_() == QDialog.Accepted: |
4033 if dlg.exec() == QDialog.Accepted: |
4034 deinitAll, submodulePaths, force = dlg.getData() |
4034 deinitAll, submodulePaths, force = dlg.getData() |
4035 args = self.initCommand("submodule") |
4035 args = self.initCommand("submodule") |
4036 args.append("deinit") |
4036 args.append("deinit") |
4037 if deinitAll: |
4037 if deinitAll: |
4038 args.append("--all") |
4038 args.append("--all") |
4044 dia = GitDialog( |
4044 dia = GitDialog( |
4045 self.tr("Unregister Submodules"), |
4045 self.tr("Unregister Submodules"), |
4046 self) |
4046 self) |
4047 res = dia.startProcess(args, repodir) |
4047 res = dia.startProcess(args, repodir) |
4048 if res: |
4048 if res: |
4049 dia.exec_() |
4049 dia.exec() |
4050 |
4050 |
4051 def gitSubmoduleUpdate(self, projectDir, initialize=False, remote=False): |
4051 def gitSubmoduleUpdate(self, projectDir, initialize=False, remote=False): |
4052 """ |
4052 """ |
4053 Public method to update submodules. |
4053 Public method to update submodules. |
4054 |
4054 |
4079 dia = GitDialog( |
4079 dia = GitDialog( |
4080 self.tr("Update Submodules"), |
4080 self.tr("Update Submodules"), |
4081 self) |
4081 self) |
4082 res = dia.startProcess(args, repodir) |
4082 res = dia.startProcess(args, repodir) |
4083 if res: |
4083 if res: |
4084 dia.exec_() |
4084 dia.exec() |
4085 |
4085 |
4086 def gitSubmoduleUpdateWithOptions(self, projectDir): |
4086 def gitSubmoduleUpdateWithOptions(self, projectDir): |
4087 """ |
4087 """ |
4088 Public method to update submodules offering a dialog to select the |
4088 Public method to update submodules offering a dialog to select the |
4089 update options. |
4089 update options. |
4103 |
4103 |
4104 from .GitSubmodulesUpdateOptionsDialog import ( |
4104 from .GitSubmodulesUpdateOptionsDialog import ( |
4105 GitSubmodulesUpdateOptionsDialog |
4105 GitSubmodulesUpdateOptionsDialog |
4106 ) |
4106 ) |
4107 dlg = GitSubmodulesUpdateOptionsDialog(paths) |
4107 dlg = GitSubmodulesUpdateOptionsDialog(paths) |
4108 if dlg.exec_() == QDialog.Accepted: |
4108 if dlg.exec() == QDialog.Accepted: |
4109 procedure, init, remote, noFetch, force, submodulePaths = ( |
4109 procedure, init, remote, noFetch, force, submodulePaths = ( |
4110 dlg.getData() |
4110 dlg.getData() |
4111 ) |
4111 ) |
4112 |
4112 |
4113 args = self.initCommand("submodule") |
4113 args = self.initCommand("submodule") |
4126 dia = GitDialog( |
4126 dia = GitDialog( |
4127 self.tr("Update Submodules"), |
4127 self.tr("Update Submodules"), |
4128 self) |
4128 self) |
4129 res = dia.startProcess(args, repodir) |
4129 res = dia.startProcess(args, repodir) |
4130 if res: |
4130 if res: |
4131 dia.exec_() |
4131 dia.exec() |
4132 |
4132 |
4133 def gitSubmoduleSync(self, projectDir): |
4133 def gitSubmoduleSync(self, projectDir): |
4134 """ |
4134 """ |
4135 Public method to synchronize submodules. |
4135 Public method to synchronize submodules. |
4136 |
4136 |
4147 paths = [submodule["path"] |
4147 paths = [submodule["path"] |
4148 for submodule in self.__gitSubmodulesList(repodir)] |
4148 for submodule in self.__gitSubmodulesList(repodir)] |
4149 |
4149 |
4150 from .GitSubmodulesSyncDialog import GitSubmodulesSyncDialog |
4150 from .GitSubmodulesSyncDialog import GitSubmodulesSyncDialog |
4151 dlg = GitSubmodulesSyncDialog(paths) |
4151 dlg = GitSubmodulesSyncDialog(paths) |
4152 if dlg.exec_() == QDialog.Accepted: |
4152 if dlg.exec() == QDialog.Accepted: |
4153 submodulePaths, recursive = dlg.getData() |
4153 submodulePaths, recursive = dlg.getData() |
4154 args = self.initCommand("submodule") |
4154 args = self.initCommand("submodule") |
4155 args.append("sync") |
4155 args.append("sync") |
4156 if recursive: |
4156 if recursive: |
4157 args.append("--recursive") |
4157 args.append("--recursive") |
4160 dia = GitDialog( |
4160 dia = GitDialog( |
4161 self.tr("Synchronize Submodules"), |
4161 self.tr("Synchronize Submodules"), |
4162 self) |
4162 self) |
4163 res = dia.startProcess(args, repodir) |
4163 res = dia.startProcess(args, repodir) |
4164 if res: |
4164 if res: |
4165 dia.exec_() |
4165 dia.exec() |
4166 |
4166 |
4167 def gitSubmoduleStatus(self, projectDir): |
4167 def gitSubmoduleStatus(self, projectDir): |
4168 """ |
4168 """ |
4169 Public method to show the status of the submodules. |
4169 Public method to show the status of the submodules. |
4170 |
4170 |
4197 |
4197 |
4198 from .GitSubmodulesSummaryOptionsDialog import ( |
4198 from .GitSubmodulesSummaryOptionsDialog import ( |
4199 GitSubmodulesSummaryOptionsDialog |
4199 GitSubmodulesSummaryOptionsDialog |
4200 ) |
4200 ) |
4201 dlg = GitSubmodulesSummaryOptionsDialog(paths) |
4201 dlg = GitSubmodulesSummaryOptionsDialog(paths) |
4202 if dlg.exec_() == QDialog.Accepted: |
4202 if dlg.exec() == QDialog.Accepted: |
4203 submodulePaths, superProject, index, commit, limit = dlg.getData() |
4203 submodulePaths, superProject, index, commit, limit = dlg.getData() |
4204 args = self.initCommand("submodule") |
4204 args = self.initCommand("submodule") |
4205 args.append("summary") |
4205 args.append("summary") |
4206 if superProject: |
4206 if superProject: |
4207 args.append("--files") |
4207 args.append("--files") |
4219 dia = GitDialog( |
4219 dia = GitDialog( |
4220 self.tr("Submodules Summary"), |
4220 self.tr("Submodules Summary"), |
4221 self) |
4221 self) |
4222 res = dia.startProcess(args, repodir) |
4222 res = dia.startProcess(args, repodir) |
4223 if res: |
4223 if res: |
4224 dia.exec_() |
4224 dia.exec() |
4225 |
4225 |
4226 ########################################################################### |
4226 ########################################################################### |
4227 ## Methods to get the helper objects are below. |
4227 ## Methods to get the helper objects are below. |
4228 ########################################################################### |
4228 ########################################################################### |
4229 |
4229 |