eric6/Plugins/VcsPlugins/vcsSubversion/SvnStatusMonitorThread.py

changeset 7775
4a1db75550bd
parent 7360
9190402e4505
child 7923
91e843545d9a
equal deleted inserted replaced
7774:9eed155411f0 7775:4a1db75550bd
5 5
6 """ 6 """
7 Module implementing the VCS status monitor thread class for Subversion. 7 Module implementing the VCS status monitor thread class for Subversion.
8 """ 8 """
9 9
10 import re
10 11
11 from PyQt5.QtCore import QRegExp, QProcess 12 from PyQt5.QtCore import QProcess
12 13
13 from VCS.StatusMonitorThread import VcsStatusMonitorThread 14 from VCS.StatusMonitorThread import VcsStatusMonitorThread
14 15
15 import Preferences 16 import Preferences
16 17
30 """ 31 """
31 VcsStatusMonitorThread.__init__(self, interval, project, vcs, parent) 32 VcsStatusMonitorThread.__init__(self, interval, project, vcs, parent)
32 33
33 self.__ioEncoding = Preferences.getSystem("IOEncoding") 34 self.__ioEncoding = Preferences.getSystem("IOEncoding")
34 35
35 self.rx_status1 = QRegExp('(.{8,9})\\s+([0-9-]+)\\s+(.+)\\s*') 36 self.rx_status1 = re.compile('(.{8,9})\\s+([0-9-]+)\\s+(.+)\\s*')
36 self.rx_status2 = QRegExp( 37 self.rx_status2 = re.compile(
37 '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*') 38 '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*')
38 39
39 def _performMonitor(self): 40 def _performMonitor(self):
40 """ 41 """
41 Protected method implementing the monitoring action. 42 Protected method implementing the monitoring action.
74 if finished and process.exitCode() == 0: 75 if finished and process.exitCode() == 0:
75 output = str(process.readAllStandardOutput(), 76 output = str(process.readAllStandardOutput(),
76 self.__ioEncoding, 'replace') 77 self.__ioEncoding, 'replace')
77 states = {} 78 states = {}
78 for line in output.splitlines(): 79 for line in output.splitlines():
79 if self.rx_status1.exactMatch(line): 80 match = (
80 flags = self.rx_status1.cap(1) 81 self.rx_status1.fullmatch(line) or
81 path = self.rx_status1.cap(3).strip() 82 self.rx_status2.fullmatch(line)
82 elif self.rx_status2.exactMatch(line): 83 )
83 flags = self.rx_status2.cap(1) 84 if match is None:
84 path = self.rx_status2.cap(5).strip()
85 else:
86 continue 85 continue
86 elif match.re is self.rx_status1:
87 flags = match.group(1)
88 path = match.group(3).strip()
89 elif match.re is self.rx_status2:
90 flags = match.group(1)
91 path = match.group(5).strip()
87 if ( 92 if (
88 flags[0] in "ACDMR" or 93 flags[0] in "ACDMR" or
89 (flags[0] == " " and flags[-1] == "*") 94 (flags[0] == " " and flags[-1] == "*")
90 ): 95 ):
91 if flags[-1] == "*": 96 if flags[-1] == "*":

eric ide

mercurial