Commits

Steve Borho committed 374d40d

status: keep track of file currently displayed in diffmodel

This bug had been with us for quite a while.

Closes #1137, #1143

  • Participants
  • Parent commits c4fe584
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgtk/status.py

         self.mode = 'status'
         self.ready = False
         self.filechunks = {}
+        self.diffmodelfile = None
         self.status = (None,) * 7
         self.status_error = None
         self.preview_tab_name_label = None
             if row[FM_PARTIAL_SELECTED]:
                 self.update_hunk_model(i, self.filetree)
                 self.diffmodel.clear()
+                self.diffmodelfile = None
 
         # recover selections
         firstrow = None
             self.preview_text.set_buffer(gtk.TextBuffer())
             if not is_merge:
                 self.diffmodel.clear()
+                self.diffmodelfile = None
 
         self.filetree.show()
         if self.mode == 'commit':
         chunks = self.filechunks[wfile]
         for chunk in chunks:
             chunk.active = selected
+        if wfile != self.diffmodelfile:
+            return
         for n, chunk in enumerate(chunks):
             if n == 0:
                 continue
         # Read this file's diffs into hunk selection model
         wfile = self.filemodel[path][FM_PATH]
         self.diffmodel.clear()
+        self.diffmodelfile = wfile
         if not self.is_merge():
             self.append_diff_hunks(wfile)
             if len(self.diffmodel):