# HG changeset patch
# User Chris Cannam
# Date 1291325524 0
# Node ID 4999dbf3a26651147f34ad81eb48c3e71b9a7564
# Parent edab92f3ea0bd14cf9a3d9e18f3543465444b76b
* Another simplification to refresh logic, and some textual fixes
diff -r edab92f3ea0b -r 4999dbf3a266 mainwindow.cpp
--- a/mainwindow.cpp Thu Dec 02 21:13:53 2010 +0000
+++ b/mainwindow.cpp Thu Dec 02 21:32:04 2010 +0000
@@ -1379,6 +1379,8 @@
// Note we want to call enableDisableActions only once, at the end
// of whichever sequence is in use.
+ bool noMore = false;
+
switch (action) {
case ACT_QUERY_PATHS:
@@ -1410,22 +1412,27 @@
hgLog();
} else {
// we're done
- enableDisableActions();
+ noMore = true;
}
break;
case ACT_LOG:
// we're done
- enableDisableActions();
+ noMore = true;
default:
if (shouldHgStat) {
hgQueryPaths();
} else {
- enableDisableActions();
+ noMore = true;
}
break;
}
+
+ if (noMore) {
+ enableDisableActions();
+ hgTabs->updateHistory();
+ }
}
void MainWindow::connectActions()
@@ -1587,13 +1594,15 @@
// A default update makes sense if:
// * there is only one parent and
// * the parent is not one of the current heads
- //!!! test this
+
bool canMerge = false;
bool canUpdate = false;
+ bool haveMerge = false;
+ int currentBranchHeads = 0;
+
if (currentParents.size() == 1) {
+ bool parentIsHead = false;
Changeset *parent = currentParents[0];
- int currentBranchHeads = 0;
- bool parentIsHead = false;
foreach (Changeset *head, currentHeads) {
DEBUG << "head branch " << head->branch() << ", current branch " << currentBranch << endl;
if (head->isOnBranch(currentBranch)) {
@@ -1614,7 +1623,10 @@
DEBUG << "head id = " << h->id() << endl;
}
}
+ } else {
+ haveMerge = true;
}
+
hgMergeAct->setEnabled(localRepoActionsEnabled && canMerge);
hgUpdateAct->setEnabled(localRepoActionsEnabled && canUpdate);
@@ -1626,15 +1638,20 @@
} else {
branchText = tr("branch \"%1\"").arg(currentBranch);
}
- if (canUpdate) {
+
+ //!!! Want "merge failed" report
+
+ if (canMerge) {
+ hgTabs->setState(tr("Awaiting merge on %1").arg(branchText));
+ } else if (haveMerge) {
+ hgTabs->setState(tr("Have merged but not committed on %1").arg(branchText));
+ } else if (canUpdate) {
hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText));
- } else if (canMerge) {
- hgTabs->setState(tr("Awaiting merge on %1").arg(branchText));
+ } else if (currentBranchHeads > 1) {
+ hgTabs->setState(tr("At one of %n heads of %1", "", currentBranchHeads).arg(branchText));
} else {
hgTabs->setState(tr("At the head of %1").arg(branchText));
}
-
- hgTabs->updateHistory();
}
void MainWindow::createActions()