1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Steve Borho  committed a1c9e8a

repoview: filter browse history using graph contents

  • Participants
  • Parent commits 8fac583
  • Branches stable

Comments (0)

Files changed (2)

File tortoisehg/hgqt/repoview.py

View file
  • Ignore whitespace
         self._in_history = False
         model.layoutChanged.connect(self.resetDelegate)
 
-    def resetBrowseHistory(self, revs, rev_pos=0):
-        self._rev_history = revs[:]
-        self._rev_pos = rev_pos-1
+    def resetBrowseHistory(self, revs, reselrev=None):
+        graph = self.model().graph
+        self._rev_history = [r for r in revs if r in graph.nodesdict]
+        if reselrev is not None and reselrev in self._rev_history:
+            self._rev_pos = self._rev_history.index(reselrev)
+        else:
+            self._rev_pos = -1
         self.forward()
 
     def resetDelegate(self):

File tortoisehg/hgqt/repowidget.py

View file
  • Ignore whitespace
         if self.revset:
             self.repomodel.filterbyrevset = checked
             self.reload()
-            if self.rev in self.revset:
-                pos = self.revset.index(self.rev)
-            else:
-                pos = 0
-            self.repoview.resetBrowseHistory(self.revset, pos)
+            self.repoview.resetBrowseHistory(self.revset, self.rev)
 
     def setOutgoingNodes(self, nodes):
         self.filterbar.revsetle.setText('outgoing()')
         self.branch = branch
         self.repomodel.setBranch(branch=branch, allparents=allparents)
         self.titleChanged.emit(self.title())
+        if self.revset:
+            self.repoview.resetBrowseHistory(self.revset, self.rev)
 
     ##
     ## Workbench methods