eric6/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py

changeset 7774
9eed155411f0
parent 7771
787a6b3f8c9f
child 7780
41420f82c0ac
equal deleted inserted replaced
7773:fe42bd17d4fe 7774:9eed155411f0
8 """ 8 """
9 9
10 10
11 import pysvn 11 import pysvn
12 12
13 from PyQt5.QtCore import QMutexLocker, Qt, pyqtSlot 13 from PyQt5.QtCore import Qt, pyqtSlot
14 from PyQt5.QtWidgets import ( 14 from PyQt5.QtWidgets import (
15 QHeaderView, QDialog, QApplication, QDialogButtonBox, QTreeWidgetItem 15 QHeaderView, QDialog, QApplication, QDialogButtonBox, QTreeWidgetItem
16 ) 16 )
17 17
18 from E5Gui import E5MessageBox 18 from E5Gui import E5MessageBox
19 from E5Gui.E5OverrideCursor import E5OverrideCursor 19 from E5Gui.E5OverrideCursor import E5OverrideCursor
20
21 from E5Utilities.E5MutexLocker import E5MutexLocker
20 22
21 from .SvnUtilities import formatTime 23 from .SvnUtilities import formatTime
22 from .SvnDialogMixin import SvnDialogMixin 24 from .SvnDialogMixin import SvnDialogMixin
23 25
24 from .Ui_SvnRepoBrowserDialog import Ui_SvnRepoBrowserDialog 26 from .Ui_SvnRepoBrowserDialog import Ui_SvnRepoBrowserDialog
152 """ 154 """
153 if parent is None: 155 if parent is None:
154 parent = self.repoTree 156 parent = self.repoTree
155 157
156 with E5OverrideCursor(): 158 with E5OverrideCursor():
157 locker = QMutexLocker(self.vcs.vcsExecutionMutex)
158 try: 159 try:
159 try: 160 with E5MutexLocker(self.vcs.vcsExecutionMutex):
160 entries = self.client.list(url, recurse=False) 161 entries = self.client.list(url, recurse=False)
161 firstTime = parent == self.repoTree 162 firstTime = parent == self.repoTree
162 for dirent, _lock in entries: 163 for dirent, _lock in entries:
163 if ( 164 if (
164 (firstTime and dirent["path"] != url) or 165 (firstTime and dirent["path"] != url) or
165 (parent != self.repoTree and dirent["path"] == url) 166 (parent != self.repoTree and dirent["path"] == url)
166 ): 167 ):
167 continue 168 continue
168 if firstTime: 169 if firstTime:
169 if dirent["repos_path"] != "/": 170 if dirent["repos_path"] != "/":
170 repoUrl = dirent["path"].replace( 171 repoUrl = dirent["path"].replace(
171 dirent["repos_path"], "") 172 dirent["repos_path"], "")
172 else: 173 else:
173 repoUrl = dirent["path"] 174 repoUrl = dirent["path"]
174 if repoUrl != url: 175 if repoUrl != url:
175 self.__ignoreExpand = True 176 self.__ignoreExpand = True
176 itm = self.__generateItem( 177 itm = self.__generateItem(
177 parent, "/", "", "", 0, "", 178 parent, "/", "", "", 0, "",
178 pysvn.node_kind.dir, repoUrl) 179 pysvn.node_kind.dir, repoUrl)
179 itm.setExpanded(True) 180 itm.setExpanded(True)
180 parent = itm 181 parent = itm
181 urlPart = repoUrl 182 urlPart = repoUrl
182 for element in ( 183 for element in (
183 dirent["repos_path"].split("/")[:-1] 184 dirent["repos_path"].split("/")[:-1]
184 ): 185 ):
185 if element: 186 if element:
186 urlPart = "{0}/{1}".format(urlPart, 187 urlPart = "{0}/{1}".format(urlPart,
187 element) 188 element)
188 itm = self.__generateItem( 189 itm = self.__generateItem(
189 parent, element, "", "", 0, "", 190 parent, element, "", "", 0, "",
190 pysvn.node_kind.dir, urlPart) 191 pysvn.node_kind.dir, urlPart)
191 itm.setExpanded(True) 192 itm.setExpanded(True)
192 parent = itm 193 parent = itm
193 self.__ignoreExpand = False 194 self.__ignoreExpand = False
194 itm = self.__generateItem( 195 itm = self.__generateItem(
195 parent, dirent["repos_path"], 196 parent, dirent["repos_path"],
196 dirent["created_rev"], dirent["last_author"], 197 dirent["created_rev"], dirent["last_author"],
197 dirent["size"], dirent["time"], dirent["kind"], 198 dirent["size"], dirent["time"], dirent["kind"],
198 dirent["path"]) 199 dirent["path"])
199 self.__resort() 200 self.__resort()
200 self.__resizeColumns() 201 self.__resizeColumns()
201 except pysvn.ClientError as e: 202 except pysvn.ClientError as e:
202 self.__showError(e.args[0]) 203 self.__showError(e.args[0])
203 except AttributeError: 204 except AttributeError:
204 self.__showError( 205 self.__showError(
205 self.tr("The installed version of PySvn should be " 206 self.tr("The installed version of PySvn should be "
206 "1.4.0 or better.")) 207 "1.4.0 or better."))
207 finally:
208 locker.unlock()
209 208
210 def __normalizeUrl(self, url): 209 def __normalizeUrl(self, url):
211 """ 210 """
212 Private method to normalite the url. 211 Private method to normalite the url.
213 212

eric ide

mercurial