Commits

Yuya Nishihara committed dc36207

fin

Comments (0)

Files changed (2)

ci-checked.diff

-# HG changeset patch
-# Date 1381750666 -32400
-# Parent c4e2817bbe1040fcb101b05361150ab81c7ec602
-status: sync partials table to model on updateModel (fixes #3406)
-
-If partials table has files which are not listed in wctx model, updatePartials
-will write invalid entry to model.checked table.  As a result, checkAllNoneBtn
-no longer work properly.
-
-This adds several assertions to check consistency between model rows and
-checked table.
-
-Eventually partials table will be merged to WctxModel and these assertions
-will be removed.
-
-diff --git a/tortoisehg/hgqt/status.py b/tortoisehg/hgqt/status.py
---- a/tortoisehg/hgqt/status.py
-+++ b/tortoisehg/hgqt/status.py
-@@ -243,6 +243,7 @@ class StatusWidget(QWidget):
-         # selections, in order to simplify refresh.
-         dels = []
-         for file, oldchanges in self.partials.iteritems():
-+            assert file in self.tv.model().checked
-             if oldchanges.excludecount == 0:
-                 self.tv.model().checked[file] = True
-                 dels.append(file)
-@@ -384,6 +385,11 @@ class StatusWidget(QWidget):
-         if self.checkable:
-             self.updateCheckCount()
- 
-+        # remove non-existent file from partials table because model changed
-+        for file in self.partials.keys():
-+            if file not in tm.checked:
-+                del self.partials[file]
-+
-         for col in (COL_PATH, COL_STATUS, COL_MERGE_STATE):
-             w = self.tv.sizeHintForColumn(col)
-             self.tv.setColumnWidth(col, w)
-@@ -768,6 +774,7 @@ class WctxModel(QAbstractTableModel):
- 
-     def check(self, files, state):
-         for f in files:
-+            assert f in checked
-             self.checked[f] = state
-             self.checkToggled.emit(f, state)
-         self.layoutChanged.emit()
-@@ -957,6 +964,7 @@ class WctxModel(QAbstractTableModel):
-         self.reset()
- 
-     def getChecked(self):
-+        assert len(self.checked) == len(self.unfiltered)
-         return self.checked.copy()
- 
- def statusMessage(status, mst, upath):
 mqd-qgotomenu.diff
 mq-finishpatch.diff
 mqd-qfin.diff
-ci-checked.diff
 cmd-filelog.diff
 cmd-filelog-unroll.diff
 cmd-filediff.diff