5 |
5 |
6 """ |
6 """ |
7 Module implementing the subversion repository browser dialog. |
7 Module implementing the subversion repository browser dialog. |
8 """ |
8 """ |
9 |
9 |
10 |
10 import re |
11 import os |
11 import os |
12 |
12 |
|
13 from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QProcess |
13 from PyQt5.QtWidgets import ( |
14 from PyQt5.QtWidgets import ( |
14 QHeaderView, QLineEdit, QDialog, QApplication, QDialogButtonBox, |
15 QHeaderView, QLineEdit, QDialog, QDialogButtonBox, QTreeWidgetItem |
15 QTreeWidgetItem |
|
16 ) |
16 ) |
17 from PyQt5.QtCore import QTimer, QProcess, QRegExp, Qt, pyqtSlot |
|
18 |
17 |
19 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
20 from E5Gui.E5OverrideCursor import E5OverrideCursorProcess |
19 from E5Gui.E5OverrideCursor import E5OverrideCursorProcess |
21 |
20 |
22 from .Ui_SvnRepoBrowserDialog import Ui_SvnRepoBrowserDialog |
21 from .Ui_SvnRepoBrowserDialog import Ui_SvnRepoBrowserDialog |
66 |
65 |
67 self.__urlRole = Qt.UserRole |
66 self.__urlRole = Qt.UserRole |
68 self.__ignoreExpand = False |
67 self.__ignoreExpand = False |
69 self.intercept = False |
68 self.intercept = False |
70 |
69 |
71 self.__rx_dir = QRegExp( |
70 self.__rx_dir = re.compile( |
72 r"""\s*([0-9]+)\s+(\w+)\s+""" |
71 r"""\s*([0-9]+)\s+(\w+)\s+""" |
73 r"""((?:\w+\s+\d+|[0-9.]+\s+\w+)\s+[0-9:]+)\s+(.+)\s*""") |
72 r"""((?:\w+\s+\d+|[0-9.]+\s+\w+)\s+[0-9:]+)\s+(.+)\s*""") |
74 self.__rx_file = QRegExp( |
73 self.__rx_file = re.compile( |
75 r"""\s*([0-9]+)\s+(\w+)\s+([0-9]+)\s""" |
74 r"""\s*([0-9]+)\s+(\w+)\s+([0-9]+)\s""" |
76 r"""((?:\w+\s+\d+|[0-9.]+\s+\w+)\s+[0-9:]+)\s+(.+)\s*""") |
75 r"""((?:\w+\s+\d+|[0-9.]+\s+\w+)\s+[0-9:]+)\s+(.+)\s*""") |
77 |
76 |
78 def closeEvent(self, e): |
77 def closeEvent(self, e): |
79 """ |
78 """ |
400 |
399 |
401 while self.__process.canReadLine(): |
400 while self.__process.canReadLine(): |
402 s = str(self.__process.readLine(), |
401 s = str(self.__process.readLine(), |
403 Preferences.getSystem("IOEncoding"), |
402 Preferences.getSystem("IOEncoding"), |
404 'replace') |
403 'replace') |
405 if self.__rx_dir.exactMatch(s): |
404 match = ( |
406 revision = self.__rx_dir.cap(1) |
405 self.__rx_dir.fullmatch(s) or |
407 author = self.__rx_dir.cap(2) |
406 self.__rx_file.fullmatch(s) |
408 date = self.__rx_dir.cap(3) |
407 ) |
409 name = self.__rx_dir.cap(4).strip() |
408 if match is None: |
|
409 continue |
|
410 elif match.re is self.__rx_dir: |
|
411 revision = match.group(1) |
|
412 author = match.group(2) |
|
413 date = match.group(3) |
|
414 name = match.group(4).strip() |
410 if name.endswith("/"): |
415 if name.endswith("/"): |
411 name = name[:-1] |
416 name = name[:-1] |
412 size = "" |
417 size = "" |
413 nodekind = "dir" |
418 nodekind = "dir" |
414 if name == ".": |
419 if name == ".": |
415 continue |
420 continue |
416 elif self.__rx_file.exactMatch(s): |
421 elif match.re is self.__rx_file: |
417 revision = self.__rx_file.cap(1) |
422 revision = match.group(1) |
418 author = self.__rx_file.cap(2) |
423 author = match.group(2) |
419 size = self.__rx_file.cap(3) |
424 size = match.group(3) |
420 date = self.__rx_file.cap(4) |
425 date = match.group(4) |
421 name = self.__rx_file.cap(5).strip() |
426 name = match.group(5).strip() |
422 nodekind = "file" |
427 nodekind = "file" |
423 else: |
428 |
424 continue |
|
425 url = "{0}/{1}".format(self.repoUrl, name) |
429 url = "{0}/{1}".format(self.repoUrl, name) |
426 self.__generateItem( |
430 self.__generateItem( |
427 name, revision, author, size, date, nodekind, url) |
431 name, revision, author, size, date, nodekind, url) |
428 |
432 |
429 def __readStderr(self): |
433 def __readStderr(self): |