src/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py

branch
eric7
changeset 10491
acabc60b19a2
parent 10439
21c28b0f9e41
child 10517
aecd5a8c958c
--- a/src/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py	Mon Jan 08 11:14:48 2024 +0100
+++ b/src/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py	Mon Jan 08 11:50:27 2024 +0100
@@ -25,7 +25,7 @@
 from eric7.EricWidgets import EricMessageBox
 from eric7.EricWidgets.EricApplication import ericApp
 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
-from eric7.VCS.VersionControl import VersionControl
+from eric7.VCS.VersionControl import VersionControl, VersionControlState
 
 from .SvnDialog import SvnDialog
 from .SvnUtilities import amendConfig, createDefaultConfig, getConfigPath
@@ -754,7 +754,8 @@
                     return  # oops, project is not version controlled
             while os.path.normcase(dname) != os.path.normcase(repodir) and (
                 os.path.normcase(dname) not in self.statusCache
-                or self.statusCache[os.path.normcase(dname)] == self.canBeAdded
+                or self.statusCache[os.path.normcase(dname)]
+                == VersionControlState.Uncontrolled
             ):
                 # add directories recursively, if they aren't in the
                 # repository already
@@ -785,7 +786,8 @@
                         and (d not in tree2 + tree)
                         and (
                             os.path.normcase(d) not in self.statusCache
-                            or self.statusCache[os.path.normcase(d)] == self.canBeAdded
+                            or self.statusCache[os.path.normcase(d)]
+                            == VersionControlState.Uncontrolled
                         )
                     ):
                         tree2.append(d)
@@ -867,7 +869,8 @@
                         and (d not in tree)
                         and (
                             os.path.normcase(d) not in self.statusCache
-                            or self.statusCache[os.path.normcase(d)] == self.canBeAdded
+                            or self.statusCache[os.path.normcase(d)]
+                            == VersionControlState.Uncontrolled
                         )
                     ):
                         tree.append(d)
@@ -891,7 +894,8 @@
                         return  # oops, project is not version controlled
                 while (os.path.normcase(dname) != os.path.normcase(repodir)) and (
                     os.path.normcase(dname) not in self.statusCache
-                    or self.statusCache[os.path.normcase(dname)] == self.canBeAdded
+                    or self.statusCache[os.path.normcase(dname)]
+                    == VersionControlState.Uncontrolled
                 ):
                     # add directories recursively, if they aren't in the
                     # repository already
@@ -1483,8 +1487,8 @@
 
         @param name filename to check
         @type str
-        @return registered state (one of canBeCommited and canBeAdded)
-        @rtype int
+        @return registered state
+        @rtype VersionControlState
         """
         if self.__wcng:
             return self.__vcsRegisteredState_wcng(name)
@@ -1500,8 +1504,8 @@
 
         @param name filename to check
         @type str
-        @return registered state (one of canBeCommited and canBeAdded)
-        @rtype int
+        @return registered state
+        @rtype VersionControlState
         """
         if name.endswith(os.sep):
             name = name[:-1]
@@ -1509,7 +1513,7 @@
         dname, fname = self.splitPath(name)
 
         if fname == "." and os.path.isdir(os.path.join(dname, self.adminDir)):
-            return self.canBeCommitted
+            return VersionControlState.Controlled
 
         if name in self.statusCache:
             return self.statusCache[name]
@@ -1517,10 +1521,10 @@
         name = os.path.normcase(name)
         states = {name: 0}
         states = self.vcsAllRegisteredStates(states, dname, False)
-        if states[name] == self.canBeCommitted:
-            return self.canBeCommitted
+        if states[name] == VersionControlState.Controlled:
+            return VersionControlState.Controlled
         else:
-            return self.canBeAdded
+            return VersionControlState.Uncontrolled
 
     def __vcsRegisteredState_wc(self, name):
         """
@@ -1531,24 +1535,24 @@
 
         @param name filename to check
         @type str
-        @return registered state (one of canBeCommited and canBeAdded)
-        @rtype int
+        @return registered state
+        @rtype VersionControlState
         """
         dname, fname = self.splitPath(name)
 
         if fname == ".":
             if os.path.isdir(os.path.join(dname, self.adminDir)):
-                return self.canBeCommitted
+                return VersionControlState.Controlled
             else:
-                return self.canBeAdded
+                return VersionControlState.Uncontrolled
 
         name = os.path.normcase(name)
         states = {name: 0}
         states = self.vcsAllRegisteredStates(states, dname, False)
-        if states[name] == self.canBeCommitted:
-            return self.canBeCommitted
+        if states[name] == VersionControlState.Controlled:
+            return VersionControlState.Controlled
         else:
-            return self.canBeAdded
+            return VersionControlState.Uncontrolled
 
     def vcsAllRegisteredStates(self, names, dname, shortcut=True):
         """
@@ -1565,8 +1569,8 @@
         @type str
         @param shortcut flag indicating a shortcut should be taken
         @type bool
-        @return the received dictionary completed with a combination of
-            canBeCommited and canBeAdded or None in order to signal an error
+        @return the received dictionary completed with the VCS state or None in
+            order to signal an error
         @rtype dict
         """
         if self.__wcng:
@@ -1592,8 +1596,8 @@
         @type str
         @param shortcut flag indicating a shortcut should be taken
         @type bool
-        @return the received dictionary completed with a combination of
-            canBeCommited and canBeAdded or None in order to signal an error
+        @return the received dictionary completed with the VCS state or None in
+            order to signal an error
         @rtype dict
         """
         from .SvnDialogMixin import SvnDialogMixin
@@ -1633,26 +1637,27 @@
                     name = os.path.normcase(file.path)
                     if self.__isVersioned(file):
                         if name in names:
-                            names[name] = self.canBeCommitted
+                            names[name] = VersionControlState.Controlled
                             dn = name
                             while os.path.splitdrive(dn)[1] != os.sep and dn != repodir:
                                 dn = os.path.dirname(dn)
                                 if (
                                     dn in self.statusCache
-                                    and self.statusCache[dn] == self.canBeCommitted
+                                    and self.statusCache[dn]
+                                    == VersionControlState.Controlled
                                 ):
                                     break
-                                self.statusCache[dn] = self.canBeCommitted
-                        self.statusCache[name] = self.canBeCommitted
+                                self.statusCache[dn] = VersionControlState.Controlled
+                        self.statusCache[name] = VersionControlState.Controlled
                         if dirs:
                             for d in dirs:
                                 if name.startswith(d):
-                                    names[d] = self.canBeCommitted
-                                    self.statusCache[d] = self.canBeCommitted
+                                    names[d] = VersionControlState.Controlled
+                                    self.statusCache[d] = VersionControlState.Controlled
                                     dirs.remove(d)
                                     break
                     else:
-                        self.statusCache[name] = self.canBeAdded
+                        self.statusCache[name] = VersionControlState.Uncontrolled
 
         return names
 
@@ -1674,8 +1679,8 @@
         @type str
         @param shortcut flag indicating a shortcut should be taken
         @type bool
-        @return the received dictionary completed with a combination of
-            canBeCommited and canBeAdded or None in order to signal an error
+        @return the received dictionary completed with the VCS state or None in
+            order to signal an error
         @rtype dict
         """
         from .SvnDialogMixin import SvnDialogMixin
@@ -1711,10 +1716,10 @@
                     name = os.path.normcase(file.path)
                     if self.__isVersioned(file):
                         if name in names:
-                            names[name] = self.canBeCommitted
-                        self.statusCache[name] = self.canBeCommitted
+                            names[name] = VersionControlState.Controlled
+                        self.statusCache[name] = VersionControlState.Controlled
                     else:
-                        self.statusCache[name] = self.canBeAdded
+                        self.statusCache[name] = VersionControlState.Uncontrolled
 
         return names
 

eric ide

mercurial