Commits

Anonymous committed 5198dfa

matching: do not crash on ParseError

Catch error.ParseError that happens when the user types an invalid revset on
the 'Find revisions matching' editbox of the matching dialog.

Comments (0)

Files changed (1)

tortoisehg/hgqt/matching.py

             return
         except (error.LookupError, error.RepoLookupError, error.RepoError):
             pass
+
         # If we get this far, assume we are matching a revision set
+        validrevset = False
         try:
             func = revset.match(self.repo.ui, new_rev)
             rset = [c for c in func(self.repo, range(len(self.repo)))]
             else:
                 self.rev_to_match_info_lbl.setText(_('Revision to Match:'))
                 csinfo_update(rset[0])
-            self.match_btn.setEnabled(True)
+            validrevset = True
         except (error.LookupError, error.RepoLookupError):
             csinfo_set_text(_('<b>Unknown revision!</b>'))
             self.match_btn.setDisabled(True)
+        except (error.ParseError):
+            csinfo_set_text(_('<b>Parse Error!</b>'))
+        self.match_btn.setDisabled(validrevset)
 
     def match(self):
         self.saveSettings()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.