Commits

Yuya Nishihara  committed 6120a0f

guess: try to abort RenameSearchThread by exception on cancel (fixes #1990)

similar._findexactmatches and _findsimilarmatches may take a long time if
repository has many files.

  • Participants
  • Parent commits 20603ae
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/guess.py

 
 from mercurial import hg, ui, mdiff, similar, patch
 
-from tortoisehg.util import hglib, shlib
+from tortoisehg.util import hglib, shlib, thread2
 
 from tortoisehg.hgqt.i18n import _
 from tortoisehg.hgqt import qtlib, htmlui, cmdui
         try:
             try:
                 self.search(self.repo)
+            except KeyboardInterrupt:
+                pass
             except Exception, e:
                 self.showMessage.emit(hglib.tounicode(str(e)))
         finally:
             self.threadid = None
 
     def cancel(self):
+        tid = self.threadid
+        if tid is None:
+            return
         self.stopped = True
+        try:
+            thread2._async_raise(tid, KeyboardInterrupt)
+        except ValueError:
+            pass
 
     def search(self, repo):
         wctx = repo[None]