changeset 156:4999dbf3a266

* Another simplification to refresh logic, and some textual fixes
author Chris Cannam
date Thu, 02 Dec 2010 21:32:04 +0000
parents edab92f3ea0b
children e411bb42d934
files mainwindow.cpp
diffstat 1 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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("<b>Awaiting merge</b> 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("<b>Awaiting merge</b> 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()