src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnStatusMonitorThread.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnStatusMonitorThread.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnStatusMonitorThread.py	Wed Jul 13 14:55:47 2022 +0200
@@ -20,27 +20,29 @@
     """
     Class implementing the VCS status monitor thread class for Subversion.
     """
+
     def __init__(self, interval, project, vcs, parent=None):
         """
         Constructor
-        
+
         @param interval new interval in seconds (integer)
         @param project reference to the project object (Project)
         @param vcs reference to the version control object
         @param parent reference to the parent object (QObject)
         """
         VcsStatusMonitorThread.__init__(self, interval, project, vcs, parent)
-        
+
         self.__ioEncoding = Preferences.getSystem("IOEncoding")
-        
-        self.rx_status1 = re.compile('(.{8,9})\\s+([0-9-]+)\\s+(.+)\\s*')
+
+        self.rx_status1 = re.compile("(.{8,9})\\s+([0-9-]+)\\s+(.+)\\s*")
         self.rx_status2 = re.compile(
-            '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*')
-    
+            "(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*"
+        )
+
     def _performMonitor(self):
         """
         Protected method implementing the monitoring action.
-        
+
         This method populates the statusList member variable
         with a list of strings giving the status in the first column and the
         path relative to the project directory starting with the third column.
@@ -56,33 +58,33 @@
             <li>"!" path is missing</li>
             <li>" " path is back at normal</li>
         </ul>
-        
+
         @return tuple of flag indicating successful operation (boolean) and
             a status message in case of non successful operation (string)
         """
         self.shouldUpdate = False
-        
+
         process = QProcess()
         args = []
-        args.append('status')
+        args.append("status")
         if not Preferences.getVCS("MonitorLocalStatus"):
-            args.append('--show-updates')
-        args.append('--non-interactive')
-        args.append('.')
+            args.append("--show-updates")
+        args.append("--non-interactive")
+        args.append(".")
         process.setWorkingDirectory(self.projectDir)
-        process.start('svn', args)
+        process.start("svn", args)
         procStarted = process.waitForStarted(5000)
         if procStarted:
             finished = process.waitForFinished(300000)
             if finished and process.exitCode() == 0:
-                output = str(process.readAllStandardOutput(),
-                             self.__ioEncoding, 'replace')
+                output = str(
+                    process.readAllStandardOutput(), self.__ioEncoding, "replace"
+                )
                 states = {}
                 for line in output.splitlines():
-                    match = (
-                        self.rx_status1.fullmatch(line) or
-                        self.rx_status2.fullmatch(line)
-                    )
+                    match = self.rx_status1.fullmatch(
+                        line
+                    ) or self.rx_status2.fullmatch(line)
                     if match is None:
                         continue
                     elif match.re is self.rx_status1:
@@ -92,16 +94,16 @@
                         flags = match.group(1)
                         path = match.group(5).strip()
                     if (
-                        flags[0] in "ACDMR?!" or
-                        (flags[0] == " " and flags[-1] == "*") or
-                        flags[1] in "CM"
+                        flags[0] in "ACDMR?!"
+                        or (flags[0] == " " and flags[-1] == "*")
+                        or flags[1] in "CM"
                     ):
                         if flags[-1] == "*":
                             status = "U"
                         else:
                             status = flags[0]
                         if status == "C" or flags[1] == "C":
-                            status = "Z"    # give it highest priority
+                            status = "Z"  # give it highest priority
                         elif status == "D":
                             status = "O"
                         if status == "U":
@@ -112,28 +114,28 @@
                         states[name] = status
                         try:
                             if self.reportedStates[name] != status:
-                                self.statusList.append(
-                                    "{0} {1}".format(status, name))
+                                self.statusList.append("{0} {1}".format(status, name))
                         except KeyError:
-                            self.statusList.append(
-                                "{0} {1}".format(status, name))
+                            self.statusList.append("{0} {1}".format(status, name))
                 for name in list(self.reportedStates.keys()):
                     if name not in states:
                         self.statusList.append("  {0}".format(name))
                 self.reportedStates = states
                 return True, self.tr(
-                    "Subversion status checked successfully (using svn)")
+                    "Subversion status checked successfully (using svn)"
+                )
             else:
                 process.kill()
                 process.waitForFinished()
                 return (
                     False,
-                    str(process.readAllStandardError(),
+                    str(
+                        process.readAllStandardError(),
                         Preferences.getSystem("IOEncoding"),
-                        'replace')
+                        "replace",
+                    ),
                 )
         else:
             process.kill()
             process.waitForFinished()
-            return False, self.tr(
-                "Could not start the Subversion process.")
+            return False, self.tr("Could not start the Subversion process.")

eric ide

mercurial