Commits

Anonymous committed 0778379 Merge

merge stable back into default

  • Participants
  • Parent commits 5eebee9, 24ab527

Comments (0)

Files changed (2)

File hgviewlib/qt4/hgrepomodel.py

     def __len__(self):
         return len(self._files)
 
+    def __contains__(self, filename):
+        return filename in self._filesdict
+
     def rowCount(self, parent=None):
         return len(self)
 

File hgviewlib/qt4/hgrepoviewer.py

                 self.statusBar().showMessage,
                 Qt.QueuedConnection)
 
-        self.filelistmodel = HgFileListModel(self.repo)
+        self.filelistmodel = HgFileListModel(self.repo, parent=self)
 
     def setupModels(self, fromhead=None):
         self.create_models(fromhead)
                 return
             rev = view.revFromindex(indexes[0])
         ctx = self.repomodel.repo[rev]
+        filename = self.tableView_filelist.currentFile() # save before refresh
         self.textview_status.setContext(ctx)
         if self.repomodel.show_hidden:
             self.textview_header.excluded = ()
         self.textview_header.displayRevision(ctx)
         self.filelistmodel.setSelectedRev(ctx)
         if len(self.filelistmodel):
-            self.tableView_filelist.selectRow(0)
+            if filename not in self.filelistmodel:
+                filename = self.filelistmodel.file(0)
+            self.tableView_filelist.selectFile(filename)
+            self.tableView_filelist.file_selected[str].emit(
+                filename)
 
     def goto(self, rev):
         if len(self.tableView_revisions.model().graph):