src/eric7/Plugins/VcsPlugins/vcsGit/git.py

branch
eric7
changeset 10491
acabc60b19a2
parent 10489
1800956305ca
child 10621
f5631f40c4d9
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/git.py	Mon Jan 08 11:14:48 2024 +0100
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/git.py	Mon Jan 08 11:50:27 2024 +0100
@@ -23,7 +23,7 @@
 from eric7.QScintilla.MiniEditor import MiniEditor
 from eric7.SystemUtilities import FileSystemUtilities, PythonUtilities
 from eric7.VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog
-from eric7.VCS.VersionControl import VersionControl
+from eric7.VCS.VersionControl import VersionControl, VersionControlState
 
 from .GitDialog import GitDialog
 
@@ -1068,8 +1068,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]
@@ -1077,7 +1077,7 @@
         dname, fname = self.splitPath(name)
 
         if fname == "." and os.path.exists(os.path.join(dname, self.adminDirOrFile)):
-            return self.canBeCommitted
+            return VersionControlState.Controlled
 
         if name in self.statusCache:
             return self.statusCache[name]
@@ -1113,16 +1113,16 @@
                     if flag not in "?!":
                         if fname == ".":
                             if absname.startswith(dname + os.path.sep):
-                                return self.canBeCommitted
+                                return VersionControlState.Controlled
                             if absname == dname:
-                                return self.canBeCommitted
+                                return VersionControlState.Controlled
                         else:
                             if absname == name:
-                                return self.canBeCommitted
+                                return VersionControlState.Controlled
         else:
-            return self.canBeCommitted
-
-        return self.canBeAdded
+            return VersionControlState.Controlled
+
+        return VersionControlState.Uncontrolled
 
     def vcsAllRegisteredStates(self, names, dname, shortcut=True):  # noqa: U100
         """
@@ -1139,8 +1139,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 dname.endswith(os.sep):
@@ -1149,7 +1149,7 @@
 
         # revert the logic because git status doesn't show unchanged files
         for name in names:
-            names[name] = self.canBeCommitted
+            names[name] = VersionControlState.Controlled
 
         found = False
         for name in self.statusCache:
@@ -1189,19 +1189,21 @@
                             if isDir:
                                 name = name[:-1]
                             if name in names:
-                                names[name] = self.canBeAdded
+                                names[name] = VersionControlState.Uncontrolled
                             if isDir:
                                 # it's a directory
                                 for nname in names:
                                     if nname.startswith(name):
-                                        names[nname] = self.canBeAdded
+                                        names[nname] = VersionControlState.Uncontrolled
                         if flag not in "?!":
-                            self.statusCache[name] = self.canBeCommitted
-                            self.statusCache[dirName] = self.canBeCommitted
+                            self.statusCache[name] = VersionControlState.Controlled
+                            self.statusCache[dirName] = VersionControlState.Controlled
                         else:
-                            self.statusCache[name] = self.canBeAdded
+                            self.statusCache[name] = VersionControlState.Uncontrolled
                             if dirName not in self.statusCache:
-                                self.statusCache[dirName] = self.canBeAdded
+                                self.statusCache[
+                                    dirName
+                                ] = VersionControlState.Uncontrolled
 
         return names
 

eric ide

mercurial