955 if not repodir: |
955 if not repodir: |
956 return |
956 return |
957 |
957 |
958 dlg = GitMergeDialog( |
958 dlg = GitMergeDialog( |
959 self.gitGetTagsList(repodir), |
959 self.gitGetTagsList(repodir), |
960 self.gitGetBranchesList(repodir, withMaster=True), |
960 self.gitGetBranchesList(repodir), |
961 self.gitGetCurrentBranch(repodir), |
961 self.gitGetCurrentBranch(repodir), |
962 self.gitGetBranchesList(repodir, remotes=True), |
962 self.gitGetBranchesList(repodir, remotes=True), |
963 ) |
963 ) |
964 if dlg.exec() == QDialog.DialogCode.Accepted: |
964 if dlg.exec() == QDialog.DialogCode.Accepted: |
965 commit, doCommit, commitMessage, addLog, diffStat = dlg.getParameters() |
965 commit, doCommit, commitMessage, addLog, diffStat = dlg.getParameters() |
1007 |
1007 |
1008 dlg = GitRevisionSelectionDialog( |
1008 dlg = GitRevisionSelectionDialog( |
1009 self.gitGetTagsList(repodir), |
1009 self.gitGetTagsList(repodir), |
1010 self.gitGetBranchesList(repodir), |
1010 self.gitGetBranchesList(repodir), |
1011 trackingBranchesList=self.gitGetBranchesList(repodir, remotes=True), |
1011 trackingBranchesList=self.gitGetBranchesList(repodir, remotes=True), |
1012 noneLabel=self.tr("Master branch head"), |
1012 noneLabel=self.tr("Main branch head"), |
1013 ) |
1013 ) |
1014 if dlg.exec() == QDialog.DialogCode.Accepted: |
1014 if dlg.exec() == QDialog.DialogCode.Accepted: |
1015 rev = dlg.getRevision() |
1015 rev = dlg.getRevision() |
1016 return self.vcsUpdate(name, revision=rev) |
1016 return self.vcsUpdate(name, revision=rev) |
1017 |
1017 |
2097 |
2097 |
2098 ########################################################################### |
2098 ########################################################################### |
2099 ## Methods for branch handling. |
2099 ## Methods for branch handling. |
2100 ########################################################################### |
2100 ########################################################################### |
2101 |
2101 |
2102 def gitGetBranchesList( |
2102 def gitGetBranchesList(self, repodir, withMain=False, allBranches=False, remotes=False): |
2103 self, repodir, withMaster=False, allBranches=False, remotes=False |
|
2104 ): |
|
2105 """ |
2103 """ |
2106 Public method to get the list of branches. |
2104 Public method to get the list of branches. |
2107 |
2105 |
2108 @param repodir directory name of the repository (string) |
2106 @param repodir directory name of the repository (string) |
2109 @param withMaster flag indicating to get 'master' as well (boolean) |
2107 @param withMain flag indicating to get 'main' as well (boolean) |
2110 @param allBranches flag indicating to return all branches (boolean) |
2108 @param allBranches flag indicating to return all branches (boolean) |
2111 @param remotes flag indicating to return remote branches only (boolean) |
2109 @param remotes flag indicating to return remote branches only (boolean) |
2112 @return list of branches (list of string) |
2110 @return list of branches (list of string) |
2113 """ |
2111 """ |
2114 args = self.initCommand("branch") |
2112 args = self.initCommand("branch") |
2135 branchesList = [] |
2133 branchesList = [] |
2136 if output: |
2134 if output: |
2137 for line in output.splitlines(): |
2135 for line in output.splitlines(): |
2138 name = line[2:].strip() |
2136 name = line[2:].strip() |
2139 if ( |
2137 if ( |
2140 (name != "master" or withMaster) |
2138 (name not in ("main", "master") or withMain) |
2141 and "->" not in name |
2139 and "->" not in name |
2142 and not name.startswith("(") |
2140 and not name.startswith("(") |
2143 and not name.endswith(")") |
2141 and not name.endswith(")") |
2144 ): |
2142 ): |
2145 branchesList.append(name) |
2143 branchesList.append(name) |
2203 repodir = self.findRepoRoot(dname) |
2201 repodir = self.findRepoRoot(dname) |
2204 if not repodir: |
2202 if not repodir: |
2205 return False, False |
2203 return False, False |
2206 |
2204 |
2207 dlg = GitBranchDialog( |
2205 dlg = GitBranchDialog( |
2208 self.gitGetBranchesList(repodir, withMaster=True, allBranches=True), |
2206 self.gitGetBranchesList(repodir, allBranches=True), |
2209 revision, |
2207 revision, |
2210 branchName, |
2208 branchName, |
2211 branchOp, |
2209 branchOp, |
2212 ) |
2210 ) |
2213 if dlg.exec() == QDialog.DialogCode.Accepted: |
2211 if dlg.exec() == QDialog.DialogCode.Accepted: |
3880 if not repodir: |
3878 if not repodir: |
3881 return |
3879 return |
3882 |
3880 |
3883 dlg = GitArchiveDataDialog( |
3881 dlg = GitArchiveDataDialog( |
3884 self.gitGetTagsList(repodir), |
3882 self.gitGetTagsList(repodir), |
3885 self.gitGetBranchesList(repodir, withMaster=True), |
3883 self.gitGetBranchesList(repodir), |
3886 self.gitGetArchiveFormats(repodir), |
3884 self.gitGetArchiveFormats(repodir), |
3887 ) |
3885 ) |
3888 if dlg.exec() == QDialog.DialogCode.Accepted: |
3886 if dlg.exec() == QDialog.DialogCode.Accepted: |
3889 commit, archiveFormat, fileName, prefix = dlg.getData() |
3887 commit, archiveFormat, fileName, prefix = dlg.getData() |
3890 args = self.initCommand("archive") |
3888 args = self.initCommand("archive") |