Mercurial > hg > easyhg
comparison mainwindow.cpp @ 106:729438d70af8
* Retrieve and store current branch and heads; some refactoring
author | Chris Cannam |
---|---|
date | Thu, 25 Nov 2010 17:54:35 +0000 |
parents | af314dd436d5 |
children | fdca34c989c0 |
comparison
equal
deleted
inserted
replaced
105:1928f9b408e6 | 106:729438d70af8 |
---|---|
164 { | 164 { |
165 QStringList params; | 165 QStringList params; |
166 params << "paths"; | 166 params << "paths"; |
167 runner -> startHgCommand(workFolderPath, params); | 167 runner -> startHgCommand(workFolderPath, params); |
168 runningAction = ACT_PATHS; | 168 runningAction = ACT_PATHS; |
169 } | |
170 } | |
171 | |
172 void MainWindow::hgBranch() | |
173 { | |
174 if (runningAction == ACT_NONE) | |
175 { | |
176 QStringList params; | |
177 params << "branch"; | |
178 runner -> startHgCommand(workFolderPath, params); | |
179 runningAction = ACT_BRANCH; | |
169 } | 180 } |
170 } | 181 } |
171 | 182 |
172 void MainWindow::hgHeads() | 183 void MainWindow::hgHeads() |
173 { | 184 { |
1130 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); | 1141 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); |
1131 enableDisableActions(); | 1142 enableDisableActions(); |
1132 break; | 1143 break; |
1133 } | 1144 } |
1134 | 1145 |
1146 case ACT_BRANCH: | |
1147 currentBranch = runner->getOutput().trimmed(); | |
1148 hgTabs->setBranch(currentBranch); | |
1149 break; | |
1150 | |
1135 case ACT_STAT: | 1151 case ACT_STAT: |
1136 hgTabs -> updateWorkFolderFileList(runner -> getOutput()); | 1152 hgTabs -> updateWorkFolderFileList(runner -> getOutput()); |
1137 updateFileSystemWatcher(); | 1153 updateFileSystemWatcher(); |
1138 break; | 1154 break; |
1139 | 1155 |
1181 } | 1197 } |
1182 break; | 1198 break; |
1183 | 1199 |
1184 case ACT_HEADS: | 1200 case ACT_HEADS: |
1185 { | 1201 { |
1186 QString stdOut = runner -> getOutput(); | 1202 foreach (Changeset *cs, currentHeads) delete cs; |
1187 //!!! hgTabs -> updateLocalRepoHeadsList(stdOut); | 1203 currentHeads.clear(); |
1204 QString output = runner -> getOutput(); | |
1205 DEBUG << "heads output is: " << output << endl; | |
1206 LogList log = LogParser(output).parse(); | |
1207 foreach (LogEntry e, log) { | |
1208 currentHeads.push_back(new Changeset(e)); | |
1209 } | |
1188 } | 1210 } |
1189 break; | 1211 break; |
1190 | 1212 |
1191 case ACT_REMOVE: | 1213 case ACT_REMOVE: |
1192 case ACT_ADD: | 1214 case ACT_ADD: |
1222 break; | 1244 break; |
1223 } | 1245 } |
1224 } | 1246 } |
1225 | 1247 |
1226 | 1248 |
1227 //Typical sequence goes paths -> stat -> heads -> parents -> log | 1249 //Typical sequence goes paths -> branch -> stat -> heads -> parents -> log |
1228 if (runningAction == ACT_PATHS) | 1250 if (runningAction == ACT_PATHS) |
1251 { | |
1252 runningAction = ACT_NONE; | |
1253 hgBranch(); | |
1254 } | |
1255 else if (runningAction == ACT_BRANCH) | |
1229 { | 1256 { |
1230 runningAction = ACT_NONE; | 1257 runningAction = ACT_NONE; |
1231 hgStat(); | 1258 hgStat(); |
1232 } | 1259 } |
1233 else if (runningAction == ACT_STAT) | 1260 else if (runningAction == ACT_STAT) |
1236 hgHeads(); | 1263 hgHeads(); |
1237 } | 1264 } |
1238 else if (runningAction == ACT_HEADS) | 1265 else if (runningAction == ACT_HEADS) |
1239 { | 1266 { |
1240 runningAction = ACT_NONE; | 1267 runningAction = ACT_NONE; |
1241 hgParents(); | 1268 //!!! hgParents(); // skip this, we don't currently use it |
1269 hgLog(); | |
1242 } | 1270 } |
1243 else if (runningAction == ACT_PARENTS) | 1271 else if (runningAction == ACT_PARENTS) |
1244 { | 1272 { |
1245 runningAction = ACT_NONE; | 1273 runningAction = ACT_NONE; |
1246 hgLog(); | 1274 hgLog(); |
1247 } | 1275 } |
1248 else if ((runningAction == ACT_MERGE) && (exitCode != 0)) | 1276 else if ((runningAction == ACT_MERGE) && (exitCode != 0)) |
1249 { | 1277 { |
1250 //If we had a failed merge, offer to retry | 1278 // If we had a failed merge, offer to retry |
1251 if (QMessageBox::Ok == QMessageBox::information(this, tr("Retry merge ?"), tr("Merge attempt failed. retry ?"), QMessageBox::Ok | QMessageBox::Cancel)) | 1279 if (QMessageBox::Ok == QMessageBox::information(this, tr("Retry merge ?"), tr("Merge attempt failed. retry ?"), QMessageBox::Ok | QMessageBox::Cancel)) |
1252 { | 1280 { |
1253 runningAction = ACT_NONE; | 1281 runningAction = ACT_NONE; |
1254 hgRetryMerge(); | 1282 hgRetryMerge(); |
1255 } | 1283 } |