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

branch
eric7
changeset 10491
acabc60b19a2
parent 10441
a79201e0e149
child 10683
779cda568acb
diff -r 527d47826e97 -r acabc60b19a2 src/eric7/Plugins/VcsPlugins/vcsSubversion/subversion.py
--- a/src/eric7/Plugins/VcsPlugins/vcsSubversion/subversion.py	Mon Jan 08 11:14:48 2024 +0100
+++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/subversion.py	Mon Jan 08 11:50:27 2024 +0100
@@ -20,7 +20,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
@@ -702,7 +702,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
@@ -733,7 +734,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)
@@ -801,7 +803,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)
@@ -825,7 +828,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
@@ -1317,8 +1321,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)
@@ -1334,8 +1338,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]
@@ -1343,7 +1347,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]
@@ -1351,10 +1355,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):
         """
@@ -1365,24 +1369,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):
         """
@@ -1399,8 +1403,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:
@@ -1424,8 +1428,8 @@
         @type dict
         @param dname directory to check in
         @type str
-        @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 dname.endswith(os.sep):
@@ -1474,10 +1478,10 @@
                         name = os.path.normcase(path)
                         if flags[0] not in "?I":
                             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
 
@@ -1499,8 +1503,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 not os.path.isdir(os.path.join(dname, self.adminDir)):
@@ -1546,10 +1550,10 @@
                         name = os.path.normcase(path)
                         if flags[0] not in "?I":
                             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