Commits

Yuya Nishihara committed da6e419

doctest done

  • Participants
  • Parent commits 3ffc4ee

Comments (0)

Files changed (1)

File revsetlabeltry.diff

 # HG changeset patch
 # Date 1362903069 -32400
-# Parent b3d24c8e40b5e182f63cd549aefaaff5bb111c53
+# Parent 5334887e01a04842393ac3723bdcbe650906da47
 repofilter: annotate how query text is interpreted (closes #2019)
 
 This shows "Revision Set" or "Keyword Search" in the right corner of the input
 diff --git a/tortoisehg/hgqt/repofilter.py b/tortoisehg/hgqt/repofilter.py
 --- a/tortoisehg/hgqt/repofilter.py
 +++ b/tortoisehg/hgqt/repofilter.py
-@@ -71,6 +71,13 @@ class RepoFilterBar(QToolBar):
+@@ -113,6 +113,13 @@ class RepoFilterBar(QToolBar):
              le.setPlaceholderText(_('### revision set query ###'))
          combo.activated.connect(self.runQuery)
  
          self.clearBtn = QToolButton(self)
          self.clearBtn.setIcon(qtlib.geticon('filedelete'))
          self.clearBtn.setToolTip(_('Clear current query and query text'))
-@@ -147,6 +154,13 @@ class RepoFilterBar(QToolBar):
+@@ -189,6 +196,13 @@ class RepoFilterBar(QToolBar):
          super(RepoFilterBar, self).showEvent(event)
          self.revsetcombo.setFocus()
  
      def openEditor(self):
          query = self._prepareQuery()
          self.entrydlg.entry.setText(query)
-@@ -191,6 +205,43 @@ class RepoFilterBar(QToolBar):
-             query = hglib.tounicode(hgrevset.formatspec('keyword(%s)', s))
-         return query
+@@ -214,6 +228,40 @@ class RepoFilterBar(QToolBar):
+         else:
+             return query
  
 +    @pyqtSlot()
 +    def _updateQueryType(self):
 +        query = unicode(self.revsetcombo.currentText()).strip()
-+        if not query:
++        qtype = _querytype(self._repo, query)
++        if not qtype:
 +            self._revsettypelabel.hide()
 +            self._updateQueryTypeGeometry()
 +            return
 +
-+        if self._isKeywordQuery(query):
-+            qtype = 'K'
-+        else:
-+            qtype = 'R'
 +        name, color, bgcolor = {
-+            'K': (_('Keyword Search'), '#cccccc', '#eeeeee'),
-+            'R': (_('Revision Set'),   '#f6dd82', '#fcf1ca'),
++            'keyword': (_('Keyword Search'), '#cccccc', '#eeeeee'),
++            'revset':  (_('Revision Set'),   '#f6dd82', '#fcf1ca'),
 +            }[qtype]
 +        label = self._revsettypelabel
 +        label.setText(name)