changeset 225:05255f23f2af

* Properly handle the case where the working copy is empty but the repo is not (e.g. just after convert)
author Chris Cannam
date Thu, 06 Jan 2011 11:52:23 +0000
parents 5498774b34c8
children 5978a4b18a89
files filestatuswidget.cpp mainwindow.cpp
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/filestatuswidget.cpp	Wed Jan 05 20:59:48 2011 +0000
+++ b/filestatuswidget.cpp	Thu Jan 06 11:52:23 2011 +0000
@@ -97,8 +97,8 @@
 
     m_descriptions[FileStates::Clean] = tr("You have not changed these files.");
     m_descriptions[FileStates::Modified] = tr("You have changed these files since you last committed them.");
-    m_descriptions[FileStates::Added] = tr("These files will be added to version control next time you commit.");
-    m_descriptions[FileStates::Removed] = tr("These files will be removed from version control next time you commit.<br>"
+    m_descriptions[FileStates::Added] = tr("These files will be added to version control next time you commit them.");
+    m_descriptions[FileStates::Removed] = tr("These files will be removed from version control next time you commit them.<br>"
                                              "They will not be deleted from the local folder.");
     m_descriptions[FileStates::Missing] = tr("These files are recorded in the version control, but absent from your working folder.<br>"
                                              "If you intended to delete them, select them and use Remove to tell the version control system about it.<br>"
--- a/mainwindow.cpp	Wed Jan 05 20:59:48 2011 +0000
+++ b/mainwindow.cpp	Thu Jan 06 11:52:23 2011 +0000
@@ -181,7 +181,8 @@
                          "modify it under the terms of the GNU General Public License as "
                          "published by the Free Software Foundation; either version 2 of the "
                          "License, or (at your option) any later version.  See the file "
-                         "COPYING included with this distribution for more information.</p>"));
+                         "COPYING included with this distribution for more information.</p>"
+                          ));
 }
 
 void MainWindow::clearSelections()
@@ -2023,6 +2024,7 @@
     bool canUpdate = false;
     bool haveMerge = false;
     bool emptyRepo = false;
+    bool noWorkingCopy = false;
     int currentBranchHeads = 0;
 
     if (currentParents.size() == 1) {
@@ -2049,7 +2051,16 @@
             }
         }
     } else if (currentParents.size() == 0) {
-        emptyRepo = true;
+        if (currentHeads.size() == 0) {
+            // No heads -> empty repo
+            emptyRepo = true;
+        } else {
+            // Heads, but no parents -> no working copy, e.g. we have
+            // just converted this repo but haven't updated in it yet.
+            // Uncommon but confusing; probably merits a special case
+            noWorkingCopy = true;
+            canUpdate = true;
+        }
     } else {
         haveMerge = true;
         justMerged = true;
@@ -2073,6 +2084,8 @@
         hgTabs->setState(tr("(Examining repository)"));
     } else if (emptyRepo) {
         hgTabs->setState(tr("Nothing committed to this repository yet"));
+    } else if (noWorkingCopy) {
+        hgTabs->setState(tr("No working copy yet: consider updating"));
     } else if (canMerge) {
         hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText));
     } else if (!hgTabs->getAllUnresolvedFiles().empty()) {