Angel Ezquerra  committed 39325fb

repofilter: avoid crash when selected revision is not in revset

Since ee3883c13dd64f9132accd0c65aa0c1ea3e03db4 when a query is run and the
filter checkbox is enabled or disabled, the selected revision is remembered.
However, if the selected revision where outside of the revset, this could
potentially result in a crash.

  • Participants
  • Parent commits e882f63
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/

         if self.revset:
             self.repomodel.filterbyrevset = checked
-            selected_rev = self.rev
-            selected_rev_pos = self.revset.index(selected_rev)
-            self.repoview.resetBrowseHistory(self.revset, selected_rev_pos)
+            if self.rev in self.revset:
+                pos = self.revset.index(self.rev)
+            else:
+                pos = 0
+            self.repoview.resetBrowseHistory(self.revset, pos)
     def setOutgoingNodes(self, nodes):