Commits

Steve Borho committed d8960bd

history: change 'Rev Range' to 'Revision Set', use mercurial.revset

The documentation will need to be updated.

Comments (0)

Files changed (1)

tortoisehg/hgtk/history.py

 import atexit
 
 from mercurial import ui, hg, cmdutil, commands, extensions, util, match, url
-from mercurial import error
+from mercurial import error, revset
 
 from tortoisehg.util.i18n import _
 from tortoisehg.util import hglib
         self.buttons['custom'] = self.custombutton
 
         self.filtercombo = gtk.combo_box_new_text()
-        self.filtercombo_entries = [_('Rev Range'), _('File Patterns'),
+        self.filtercombo_entries = [_('Revision Set'), _('File Patterns'),
                   _('Keywords'), _('Date'), _('User')]
         try:
             enclist = repo.ui.configlist('tortoisehg', 'fsencodings')
         self.activate_filter(text, mode)
 
     def check_filter_text(self, text, mode):
+        ret = True
         if not text:
             return False
         elif mode == 0:
             try:
-                cmdutil.revrange(self.repo, [text])
+                func = revset.match(text)
+                func(self.repo, range(0, 1))
+                l = []
+                for c in func(self.repo, range(len(self.repo))):
+                    l.append(c)
+                if not l:
+                    gdialog.Prompt(_('No matches'),
+                                   _('No revisions matched search'), self).run()
+                    return False
+                ret = l
             except Exception, e:
-                gdialog.Prompt(_('Invalid revision range'),
-                               str(e), self).run()
+                gdialog.Prompt(_('Invalid revision set'), str(e), self).run()
                 return False
         elif mode == 3:
             try:
                 gdialog.Prompt(_('Invalid date specification'),
                                str(e), self).run()
                 return False
-        return True
+        return ret
 
     def activate_filter(self, text, mode):
-        if not self.check_filter_text(text, mode):
+        ret = self.check_filter_text(text, mode)
+        if not ret:
             return
         opts = {}
         if mode == MODE_REVRANGE:
-            opts['revlist'] = cmdutil.revrange(self.repo, [text])
+            opts['revlist'] = ret
             name = 'revrange'
         elif mode == MODE_FILEPATS:
             opts['pats'] = [w.strip() for w in text.split(',')]