Mercurial > hg > easyhg
comparison src/mainwindow.cpp @ 519:000f13faa089
Bookmarks are now displayed -- but exactly like tags, so far, there's no differentiation yet
author | Chris Cannam |
---|---|
date | Tue, 08 Nov 2011 16:42:09 +0000 |
parents | 5c846f3c9244 |
children | a17c06f773cd |
comparison
equal
deleted
inserted
replaced
518:5c846f3c9244 | 519:000f13faa089 |
---|---|
319 | 319 |
320 QStringList params; | 320 QStringList params; |
321 params << "branch"; | 321 params << "branch"; |
322 m_runner->requestAction(HgAction(ACT_QUERY_BRANCH, m_workFolderPath, params)); | 322 m_runner->requestAction(HgAction(ACT_QUERY_BRANCH, m_workFolderPath, params)); |
323 */ | 323 */ |
324 } | |
325 | |
326 void MainWindow::hgQueryBookmarks() | |
327 { | |
328 QStringList params; | |
329 params << "bookmarks"; | |
330 m_runner->requestAction(HgAction(ACT_QUERY_BOOKMARKS, m_workFolderPath, params)); | |
324 } | 331 } |
325 | 332 |
326 void MainWindow::hgQueryHeadsActive() | 333 void MainWindow::hgQueryHeadsActive() |
327 { | 334 { |
328 QStringList params; | 335 QStringList params; |
2193 case ACT_CHGSETDIFF: | 2200 case ACT_CHGSETDIFF: |
2194 // external program, unlikely to be anything useful in stderr | 2201 // external program, unlikely to be anything useful in stderr |
2195 // and some return with failure codes when something as basic | 2202 // and some return with failure codes when something as basic |
2196 // as the user closing the window via the wm happens | 2203 // as the user closing the window via the wm happens |
2197 return; | 2204 return; |
2205 case ACT_QUERY_BOOKMARKS: | |
2206 // probably just means we have an old Hg version: simply don't | |
2207 // display bookmarks | |
2208 return; | |
2198 case ACT_MERGE: | 2209 case ACT_MERGE: |
2199 case ACT_RETRY_MERGE: | 2210 case ACT_RETRY_MERGE: |
2200 MoreInformationDialog::information | 2211 MoreInformationDialog::information |
2201 (this, tr("Merge"), tr("Merge failed"), | 2212 (this, tr("Merge"), tr("Merge failed"), |
2202 tr("Some files were not merged successfully.<p>You can Merge again to repeat the interactive merge; use Revert to abandon the merge entirely; or edit the files that are in conflict in an editor and, when you are happy with them, choose Mark Resolved in each file's right-button menu."), | 2213 tr("Some files were not merged successfully.<p>You can Merge again to repeat the interactive merge; use Revert to abandon the merge entirely; or edit the files that are in conflict in an editor and, when you are happy with them, choose Mark Resolved in each file's right-button menu."), |
2225 output); | 2236 output); |
2226 } | 2237 } |
2227 | 2238 |
2228 void MainWindow::commandCompleted(HgAction completedAction, QString output) | 2239 void MainWindow::commandCompleted(HgAction completedAction, QString output) |
2229 { | 2240 { |
2241 std::cerr << "commandCompleted: " << completedAction.action << std::endl; | |
2242 | |
2230 restoreFileSystemWatcher(); | 2243 restoreFileSystemWatcher(); |
2231 HGACTIONS action = completedAction.action; | 2244 HGACTIONS action = completedAction.action; |
2232 | 2245 |
2233 if (action == ACT_NONE) return; | 2246 if (action == ACT_NONE) return; |
2247 | |
2248 output.replace("\r\n", "\n"); | |
2234 | 2249 |
2235 bool headsChanged = false; | 2250 bool headsChanged = false; |
2236 QStringList oldHeadIds; | 2251 QStringList oldHeadIds; |
2237 | 2252 |
2238 switch (action) { | 2253 switch (action) { |
2280 | 2295 |
2281 case ACT_QUERY_BRANCH: | 2296 case ACT_QUERY_BRANCH: |
2282 m_currentBranch = output.trimmed(); | 2297 m_currentBranch = output.trimmed(); |
2283 break; | 2298 break; |
2284 | 2299 |
2300 case ACT_QUERY_BOOKMARKS: | |
2301 { | |
2302 m_bookmarks.clear(); | |
2303 QStringList outList = output.split('\n', QString::SkipEmptyParts); | |
2304 foreach (QString line, outList) { | |
2305 QStringList items = line.split(' ', QString::SkipEmptyParts); | |
2306 if (items[0] == "*") { | |
2307 if (items.size() == 3) { | |
2308 m_bookmarks[items[2]].push_back(items[1]); | |
2309 } | |
2310 } else { | |
2311 if (items.size() == 2) { | |
2312 m_bookmarks[items[1]].push_back(items[0]); | |
2313 } | |
2314 } | |
2315 } | |
2316 m_hgTabs->setBookmarks(m_bookmarks); | |
2317 break; | |
2318 } | |
2319 | |
2285 case ACT_STAT: | 2320 case ACT_STAT: |
2286 m_lastStatOutput = output; | 2321 m_lastStatOutput = output; |
2287 updateFileSystemWatcher(); | 2322 updateFileSystemWatcher(); |
2288 break; | 2323 break; |
2289 | 2324 |
2434 break; | 2469 break; |
2435 | 2470 |
2436 case ACT_DIFF_SUMMARY: | 2471 case ACT_DIFF_SUMMARY: |
2437 { | 2472 { |
2438 // Output has log info first, diff following after a blank line | 2473 // Output has log info first, diff following after a blank line |
2439 output.replace("\r\n", "\n"); | |
2440 QStringList olist = output.split("\n\n", QString::SkipEmptyParts); | 2474 QStringList olist = output.split("\n\n", QString::SkipEmptyParts); |
2441 if (olist.size() > 1) output = olist[1]; | 2475 if (olist.size() > 1) output = olist[1]; |
2442 | 2476 |
2443 Changeset *cs = (Changeset *)completedAction.extraData; | 2477 Changeset *cs = (Changeset *)completedAction.extraData; |
2444 if (cs) { | 2478 if (cs) { |
2493 default: | 2527 default: |
2494 break; | 2528 break; |
2495 } | 2529 } |
2496 | 2530 |
2497 // Sequence when no full log required: | 2531 // Sequence when no full log required: |
2498 // paths -> branch -> stat -> resolve-list -> heads -> | 2532 // paths -> branch -> stat -> bookmarks -> resolve-list -> heads -> |
2499 // incremental-log (only if heads changed) -> parents | 2533 // incremental-log (only if heads changed) -> parents |
2500 // | 2534 // |
2501 // Sequence when full log required: | 2535 // Sequence when full log required: |
2502 // paths -> branch -> stat -> resolve-list -> heads -> parents -> log | 2536 // paths -> branch -> stat -> bookmarks -> resolve-list -> heads -> |
2537 // parents -> log | |
2503 // | 2538 // |
2504 // Note we want to call enableDisableActions only once, at the end | 2539 // Note we want to call enableDisableActions only once, at the end |
2505 // of whichever sequence is in use. | 2540 // of whichever sequence is in use. |
2506 | 2541 |
2507 bool noMore = false; | 2542 bool noMore = false; |
2528 hgQueryPaths(); | 2563 hgQueryPaths(); |
2529 } | 2564 } |
2530 break; | 2565 break; |
2531 | 2566 |
2532 case ACT_QUERY_PATHS: | 2567 case ACT_QUERY_PATHS: |
2568 // NB this call is duplicated in hgQueryPaths | |
2533 hgQueryBranch(); | 2569 hgQueryBranch(); |
2534 break; | 2570 break; |
2535 | 2571 |
2536 case ACT_QUERY_BRANCH: | 2572 case ACT_QUERY_BRANCH: |
2573 // NB this call is duplicated in hgQueryBranch | |
2537 hgStat(); | 2574 hgStat(); |
2538 break; | 2575 break; |
2539 | 2576 |
2540 case ACT_STAT: | 2577 case ACT_STAT: |
2578 hgQueryBookmarks(); | |
2579 break; | |
2580 | |
2581 case ACT_QUERY_BOOKMARKS: | |
2541 hgResolveList(); | 2582 hgResolveList(); |
2542 break; | 2583 break; |
2543 | 2584 |
2544 case ACT_RESOLVE_LIST: | 2585 case ACT_RESOLVE_LIST: |
2545 hgQueryHeadsActive(); | 2586 hgQueryHeadsActive(); |
2546 break; | 2587 break; |
2547 | 2588 |
2548 case ACT_QUERY_HEADS_ACTIVE: | 2589 case ACT_QUERY_HEADS_ACTIVE: |