eric6/Plugins/VcsPlugins/vcsSubversion/SvnChangeListsDialog.py

changeset 7775
4a1db75550bd
parent 7360
9190402e4505
child 7923
91e843545d9a
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnChangeListsDialog.py	Sat Oct 10 16:03:53 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnChangeListsDialog.py	Sun Oct 11 17:54:52 2020 +0200
@@ -7,10 +7,10 @@
 Module implementing a dialog to browse the change lists.
 """
 
-
+import re
 import os
 
-from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QRegExp, QTimer
+from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer
 from PyQt5.QtWidgets import (
     QDialog, QDialogButtonBox, QListWidgetItem, QLineEdit
 )
@@ -48,12 +48,12 @@
         self.process.readyReadStandardOutput.connect(self.__readStdout)
         self.process.readyReadStandardError.connect(self.__readStderr)
         
-        self.rx_status = QRegExp(
+        self.rx_status = re.compile(
             '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*')
         # flags (8 or 9 anything), revision, changed rev, author, path
-        self.rx_status2 = QRegExp('(.{8,9})\\s+(.+)\\s*')
+        self.rx_status2 = re.compile('(.{8,9})\\s+(.+)\\s*')
         # flags (8 or 9 anything), path
-        self.rx_changelist = QRegExp('--- \\S+ .([\\w\\s]+).:\\s+')
+        self.rx_changelist = re.compile('--- \\S+ .([\\w\\s]+).:\\s+')
         # three dashes, Changelist (translated), quote,
         # changelist name, quote, :
     
@@ -186,32 +186,33 @@
                 s = str(self.process.readLine(),
                         Preferences.getSystem("IOEncoding"),
                         'replace')
-                if (
-                    self.currentChangelist != "" and
-                    self.rx_status.exactMatch(s)
-                ):
-                    file = self.rx_status.cap(5).strip()
-                    filename = file.replace(self.path + os.sep, "")
-                    if filename not in self.changeListsDict[
-                        self.currentChangelist
-                    ]:
-                        self.changeListsDict[self.currentChangelist].append(
-                            filename)
-                elif (
-                    self.currentChangelist != "" and
-                    self.rx_status2.exactMatch(s)
-                ):
-                    file = self.rx_status2.cap(2).strip()
-                    filename = file.replace(self.path + os.sep, "")
-                    if filename not in self.changeListsDict[
-                        self.currentChangelist
-                    ]:
-                        self.changeListsDict[self.currentChangelist].append(
-                            filename)
-                elif self.rx_changelist.exactMatch(s):
-                    self.currentChangelist = self.rx_changelist.cap(1)
-                    if self.currentChangelist not in self.changeListsDict:
-                        self.changeListsDict[self.currentChangelist] = []
+                match = (
+                    self.rx_status.fullmatch(s) or
+                    self.rx_status2.fullmatch(s)
+                )
+                if self.currentChangelist != "" and match is not None:
+                    if match.re is self.rx_status:
+                        file = match.group(5).strip()
+                        filename = file.replace(self.path + os.sep, "")
+                        if filename not in self.changeListsDict[
+                            self.currentChangelist
+                        ]:
+                            self.changeListsDict[
+                                self.currentChangelist].append(filename)
+                    else:
+                        file = match.group(2).strip()
+                        filename = file.replace(self.path + os.sep, "")
+                        if filename not in self.changeListsDict[
+                            self.currentChangelist
+                        ]:
+                            self.changeListsDict[
+                                self.currentChangelist].append(filename)
+                else:
+                    match = self.rx_changelist.fullmatch(s)
+                    if match is not None:
+                        self.currentChangelist = match.group(1)
+                        if self.currentChangelist not in self.changeListsDict:
+                            self.changeListsDict[self.currentChangelist] = []
         
     def __readStderr(self):
         """

eric ide

mercurial