diff hgtabwidget.cpp @ 163:5c262ac73948

* First cut of work on merge/resolve logic
author Chris Cannam
date Fri, 03 Dec 2010 19:35:04 +0000
parents 6bcb4a4d6521
children 4bad3c5c053a
line wrap: on
line diff
--- a/hgtabwidget.cpp	Fri Dec 03 14:43:32 2010 +0000
+++ b/hgtabwidget.cpp	Fri Dec 03 19:35:04 2010 +0000
@@ -78,7 +78,9 @@
 
 void HgTabWidget::setCurrent(QStringList ids, QString branch)
 {
-    m_historyWidget->setCurrent(ids, branch, canCommit());
+    bool showUncommitted = false;
+    if (canRevert()) showUncommitted = true;
+    m_historyWidget->setCurrent(ids, branch, showUncommitted);
 }
 
 void HgTabWidget::updateHistory()
@@ -86,16 +88,25 @@
     m_historyWidget->update();
 }
 
+bool HgTabWidget::canDiff() const
+{
+    if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
+    return m_fileStatusWidget->haveChangesToCommit() ||
+        !m_fileStatusWidget->getAllUnresolvedFiles().empty();
+}
+
 bool HgTabWidget::canCommit() const
 {
     if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
-    return m_fileStatusWidget->haveChangesToCommit();
+    return m_fileStatusWidget->haveChangesToCommit() &&
+        m_fileStatusWidget->getAllUnresolvedFiles().empty();
 }
 
 bool HgTabWidget::canRevert() const
 {
+    if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
     return m_fileStatusWidget->haveChangesToCommit() ||
-        !m_fileStatusWidget->getSelectedRevertableFiles().empty();
+        !m_fileStatusWidget->getAllUnresolvedFiles().empty();
 }
 
 bool HgTabWidget::canAdd() const
@@ -113,9 +124,9 @@
     return true;
 }
 
-bool HgTabWidget::canDoDiff() const
+bool HgTabWidget::canResolve() const
 {
-    return canCommit();
+    return !m_fileStatusWidget->getSelectedUnresolvedFiles().empty();
 }
 
 QStringList HgTabWidget::getAllSelectedFiles() const
@@ -158,6 +169,16 @@
     return m_fileStatusWidget->getSelectedRemovableFiles();
 }
 
+QStringList HgTabWidget::getAllUnresolvedFiles() const
+{
+    return m_fileStatusWidget->getAllUnresolvedFiles();
+}
+
+QStringList HgTabWidget::getSelectedUnresolvedFiles() const
+{
+    return m_fileStatusWidget->getSelectedUnresolvedFiles();
+}
+
 void HgTabWidget::updateWorkFolderFileList(QString fileList)
 {
     m_fileStates.parseStates(fileList);