Commits

Tom Burdick  committed 09c94e9

fix the status and diff views to work

  • Participants
  • Parent commits b6ee1e8

Comments (0)

Files changed (5)

File cutehg/history.py

         ''' show the serve dialog, notably if the user closes it the server keeps running
         the next time the dialog is show it will show the server is running still
         '''
-
 if __name__ == "__main__":
     import os
     import sys

File cutehg/views/diffview.py

             if rev1 is something and rev2 is none, the diff between rev1 and its first parent is shown
             if rev1 and rev2 are something then the diff between the two is shown
         '''
-
-        print "updating"
         self.model = DiffModel(self._ui, self._repo, rev1, rev2, filename, self)
         assert self.connect(self.model, QtCore.SIGNAL("fillFinished()"), self.displayDiff)
         assert self.connect(self.model, QtCore.SIGNAL("selectionChanged(int)"), self.onSelectionChanged)

File cutehg/views/models/diffmodel.py

                 ctx = self._repo[self._rev2]
                 node2 = ctx.node()
 
-        it = patch.diff(self._repo, node1, node2, match=m, opts=patch.diffopts(self._ui, opts))
+        print str(self._rev1)
+        print str(self._rev2)
+        it = patch.diff(self._repo, node2, node1, match=m, opts=patch.diffopts(self._ui, opts))
         
         for chunk in it:
             items.append(DiffItem(chunk))

File cutehg/views/models/statusmodel.py

 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from PyQt4 import QtCore, QtGui
-from mercurial import ui, repo, cmdutil
+from mercurial import ui, repo, cmdutil, context
 
 def background_color(original, hue):
     saturation = 35
         self._repo.invalidate()
 
         items = []
-        node1 = self._rev1
-        node2 = self._rev2
+        node1, node2 = [None, None]
+        print self._rev2
+        if self._rev1:
+            ctx = self._repo[self._rev1]
+            node1 = ctx.node()
+            if not self._rev2:
+                realparents = ctx.parents()
+                if realparents:
+                    node2 = realparents[0].node()
+            elif isinstance(self._rev2, str):
+                ctx = self._repo[self._rev2]
+                node2 = ctx.node()
+            else:
+                node2 = self._rev2.node()
 
-        matcher = cmdutil.match(self._repo, None, dict())
+        matcher = cmdutil.match(self._repo, [], {})
         modified, added, removed, deleted, unknown, ignored, clean = [
             n for n in self._repo.status(node1=node1, node2=node2,
                                  match=matcher,

File cutehg/views/statusview.py

         self.update(rev)
 
     def update(self, rev=None):
+        self.models = []
+        self.stateFilters = []
         parents = []
         realparents = parents
         if rev:
         self.models.append(StatusModel(self._ui, self._repo, rev, parents[0] , self))
         assert self.connect(self.models[0], QtCore.SIGNAL("fillFinished()"), self.resizeTable1Cells)
         if len(parents) > 1:
-            self.model.append(StatusModel(self._ui, self._repo, rev, parents[1], self))
+            self.models.append(StatusModel(self._ui, self._repo, rev, parents[1], self))
             assert self.connect(self.models[1], QtCore.SIGNAL("fillFinished()"), self.resizeTable2Cells)
 
         for model in self.models:
         if len(realparents) > 1:
             self.parent2Label.setText(str(realparents[1]))
             self.parent2TableView.setModel(self.stateFilters[1])
+            self.parent2Container.setVisible(True)
         else:
             self.parent2Container.setVisible(False)
 
 
         self.resizeTable1Cells()
         self.resizeTable2Cells()
+        self.resetStateFilter()
 
 
     def resizeTable1Cells(self):
         self.parent2TableView.resizeColumnsToContents()
         headerView = self.parent2TableView.horizontalHeader()
         headerView.setStretchLastSection(True)
+    
+    def resetStateFilter(self):
+        self._showStates = ['M', 'A', 'R',  '?', '!']
+
+        exp = "["
+        for char in self._showStates:
+            exp = exp + char 
+        exp = exp + "]"
+
+        for proxy in self.stateFilters:
+            proxy.setFilterRegExp(exp)
 
     def updateStateFilter(self, state, char):
         addchar = False