eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 7775
4a1db75550bd
parent 7774
9eed155411f0
child 7785
9978016560ec
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py	Sat Oct 10 16:03:53 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py	Sun Oct 11 17:54:52 2020 +0200
@@ -7,15 +7,13 @@
 Module implementing the version control systems interface to Subversion.
 """
 
-
+import re
 import os
 import shutil
 import time
 from urllib.parse import quote
 
-from PyQt5.QtCore import (
-    pyqtSignal, Qt, QRegExp, QDateTime, QCoreApplication
-)
+from PyQt5.QtCore import pyqtSignal, Qt, QDateTime, QCoreApplication
 from PyQt5.QtWidgets import QLineEdit, QDialog, QInputDialog, QApplication
 
 from E5Gui.E5Application import e5App
@@ -918,7 +916,7 @@
         @param noDialog flag indicating quiet operations
         @return flag indicating successfull operation (boolean)
         """
-        rx_prot = QRegExp('(file:|svn:|svn+ssh:|http:|https:).+')
+        rx_prot = re.compile('(file:|svn:|svn+ssh:|http:|https:).+')
         opts = self.options['global']
         res = False
         
@@ -936,14 +934,14 @@
             if not target:
                 return False
         
-        if not rx_prot.exactMatch(target):
+        if rx_prot.fullmatch(target) is None:
             isDir = os.path.isdir(name)
         else:
             isDir = False
         
         if accepted:
             client = self.getClient()
-            if rx_prot.exactMatch(target):
+            if rx_prot.fullmatch(target) is not None:
                 target = self.__svnURL(target)
                 log = "Moving {0} to {1}".format(name, target)
             else:
@@ -969,7 +967,7 @@
             if not noDialog:
                 dlg.finish()
                 dlg.exec()
-            if res and not rx_prot.exactMatch(target):
+            if res and rx_prot.fullmatch(target) is None:
                 if target.startswith(project.getProjectPath()):
                     if isDir:
                         project.moveDirectory(name, target)
@@ -1067,8 +1065,10 @@
             return
         
         if self.otherData["standardLayout"]:
-            rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
-            if not rx_base.exactMatch(reposURL):
+            rx_base = re.compile('(.+)/(trunk|tags|branches).*')
+            
+            match = rx_base.fullmatch(reposURL)
+            if match is None:
                 E5MessageBox.critical(
                     self.__ui,
                     self.tr("Subversion Error"),
@@ -1078,7 +1078,7 @@
                         """ be aborted"""))
                 return
             
-            reposRoot = rx_base.cap(1)
+            reposRoot = match.group(1)
             if tagOp in [1, 4]:
                 url = '{0}/tags/{1}'.format(reposRoot, quote(tag))
             elif tagOp in [2, 8]:
@@ -1207,8 +1207,9 @@
             return False
         
         if self.otherData["standardLayout"]:
-            rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
-            if not rx_base.exactMatch(reposURL):
+            rx_base = re.compile('(.+)/(trunk|tags|branches).*')
+            match = rx_base.fullmatch(reposURL)
+            if match is None:
                 E5MessageBox.critical(
                     self.__ui,
                     self.tr("Subversion Error"),
@@ -1218,7 +1219,7 @@
                         """ be aborted"""))
                 return False
             
-            reposRoot = rx_base.cap(1)
+            reposRoot = match.group(1)
             tn = tag
             if tagType == 1:
                 url = '{0}/tags/{1}'.format(reposRoot, quote(tag))
@@ -1273,12 +1274,12 @@
             self.mergeList[1].remove(urlrev2)
         self.mergeList[1].insert(0, urlrev2)
         
-        rx_rev = QRegExp('\\d+|HEAD|head')
+        rx_rev = re.compile('\\d+|HEAD|head')
         
         cwd = os.getcwd()
         os.chdir(dname)
         recurse = "--non-recursive" not in opts
-        if rx_rev.exactMatch(urlrev1):
+        if bool(rx_rev.fullmatch(urlrev1)):
             if urlrev1 in ["HEAD", "head"]:
                 revision1 = pysvn.Revision(pysvn.opt_revision_kind.head)
                 rev1 = "HEAD"
@@ -1817,14 +1818,14 @@
         @return flag indicating successfull operation (boolean)
         """
         from .SvnCopyDialog import SvnCopyDialog
-        rx_prot = QRegExp('(file:|svn:|svn+ssh:|http:|https:).+')
+        rx_prot = re.compile('(file:|svn:|svn+ssh:|http:|https:).+')
         dlg = SvnCopyDialog(name)
         res = False
         if dlg.exec() == QDialog.Accepted:
             target, force = dlg.getData()
             
             client = self.getClient()
-            if rx_prot.exactMatch(target):
+            if bool(rx_prot.fullmatch(target)):
                 target = self.__svnURL(target)
                 log = "Copying {0} to {1}".format(name, target)
             else:
@@ -1848,7 +1849,7 @@
             dlg.exec()
             if (
                 res and
-                not rx_prot.exactMatch(target) and
+                not bool(rx_prot.fullmatch(target)) and
                 target.startswith(project.getProjectPath())
             ):
                 if os.path.isdir(name):

eric ide

mercurial