Commits

Yuya Nishihara committed 61044c3

guess: keep similarity as raw value for sorting (fixes #1332)

This changes getRow() to return similarity as float instead of str, but it
isn't used and should break nothing.

  • Participants
  • Parent commits 6d70226
  • Branches stable

Comments (0)

Files changed (1)

tortoisehg/hgqt/guess.py

         QAbstractTableModel.__init__(self, parent)
         self.rows = []
         self.headers = (_('Source'), _('Dest'), _('% Match'))
+        self.displayformats = (hglib.tounicode, hglib.tounicode,
+                               lambda s: '%d%%' % (s * 100))
 
     def rowCount(self, parent):
         return len(self.rows)
             return QVariant()
         if role == Qt.DisplayRole:
             s = self.rows[index.row()][index.column()]
-            return QVariant(hglib.tounicode(s))
+            f = self.displayformats[index.column()]
+            return QVariant(f(s))
         '''
         elif role == Qt.TextColorRole:
             src, dst, pct = self.rows[index.row()]
                 return
             old, new = o.path(), n.path()
             exacts.append(old)
-            self.match.emit([old, new, '100%'])
+            self.match.emit([old, new, 1.0])
         if self.minpct == 1.0:
             return
         removed = [r for r in removed if r.path() not in exacts]
         for o, n, s in gen:
             if self.stopped:
                 return
-            old, new, sim = o.path(), n.path(), '%d%%' % (s*100)
+            old, new, sim = o.path(), n.path(), s
             self.match.emit([old, new, sim])
 
 def run(ui, *pats, **opts):