10 |
10 |
11 import os |
11 import os |
12 |
12 |
13 import pysvn |
13 import pysvn |
14 |
14 |
15 from PyQt5.QtCore import QMutexLocker, Qt |
15 from PyQt5.QtCore import Qt |
16 from PyQt5.QtWidgets import ( |
16 from PyQt5.QtWidgets import ( |
17 QHeaderView, QDialog, QDialogButtonBox, QTreeWidgetItem |
17 QHeaderView, QDialog, QDialogButtonBox, QTreeWidgetItem |
18 ) |
18 ) |
|
19 |
|
20 from E5Utilities.E5MutexLocker import E5MutexLocker |
19 |
21 |
20 from .SvnDialogMixin import SvnDialogMixin |
22 from .SvnDialogMixin import SvnDialogMixin |
21 from .Ui_SvnBlameDialog import Ui_SvnBlameDialog |
23 from .Ui_SvnBlameDialog import Ui_SvnBlameDialog |
22 |
24 |
23 import Preferences |
25 import Preferences |
65 self.errorGroup.hide() |
67 self.errorGroup.hide() |
66 self.activateWindow() |
68 self.activateWindow() |
67 |
69 |
68 dname, fname = self.vcs.splitPath(fn) |
70 dname, fname = self.vcs.splitPath(fn) |
69 |
71 |
70 locker = QMutexLocker(self.vcs.vcsExecutionMutex) |
|
71 cwd = os.getcwd() |
72 cwd = os.getcwd() |
72 os.chdir(dname) |
73 os.chdir(dname) |
73 try: |
74 try: |
74 annotations = self.client.annotate(fname) |
75 with E5MutexLocker(self.vcs.vcsExecutionMutex): |
75 locker.unlock() |
76 annotations = self.client.annotate(fname) |
76 for annotation in annotations: |
77 for annotation in annotations: |
77 author = annotation["author"] |
78 author = annotation["author"] |
78 line = annotation["line"] |
79 line = annotation["line"] |
79 self.__generateItem( |
80 self.__generateItem( |
80 annotation["revision"].number, author, |
81 annotation["revision"].number, author, |
81 annotation["number"] + 1, line) |
82 annotation["number"] + 1, line) |
82 except pysvn.ClientError as e: |
83 except pysvn.ClientError as e: |
83 locker.unlock() |
|
84 self.__showError(e.args[0] + '\n') |
84 self.__showError(e.args[0] + '\n') |
85 self.__finish() |
85 self.__finish() |
86 os.chdir(cwd) |
86 os.chdir(cwd) |
87 |
87 |
88 def __finish(self): |
88 def __finish(self): |