Fixed an issue in the Mercurial plug-in parsing the status data. 5_4_x

Sat, 05 Jul 2014 12:23:15 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 05 Jul 2014 12:23:15 +0200
branch
5_4_x
changeset 3672
01e4aee3c3ee
parent 3661
9f5d0a07e69b
child 3680
d60e61ef6642

Fixed an issue in the Mercurial plug-in parsing the status data.
(grafted from e8a37c412d287aab9f5c36de313f00da9b8cf7ae)

Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
diff -r 9f5d0a07e69b -r 01e4aee3c3ee Plugins/VcsPlugins/vcsMercurial/hg.py
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Jul 03 19:02:29 2014 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Jul 05 12:23:15 2014 +0200
@@ -1115,17 +1115,18 @@
         
         if output:
             for line in output.splitlines():
-                flag, path = line.split(" ", 1)
-                absname = os.path.join(repodir, os.path.normcase(path))
-                if flag not in "?I":
-                    if fname == '.':
-                        if absname.startswith(dname + os.path.sep):
-                            return self.canBeCommitted
-                        if absname == dname:
-                            return self.canBeCommitted
-                    else:
-                        if absname == name:
-                            return self.canBeCommitted
+                if line and line[0] in "MARC!?I":
+                    flag, path = line.split(" ", 1)
+                    absname = os.path.join(repodir, os.path.normcase(path))
+                    if flag not in "?I":
+                        if fname == '.':
+                            if absname.startswith(dname + os.path.sep):
+                                return self.canBeCommitted
+                            if absname == dname:
+                                return self.canBeCommitted
+                        else:
+                            if absname == name:
+                                return self.canBeCommitted
         
         return self.canBeAdded
     
@@ -1186,28 +1187,29 @@
             if output:
                 dirs = [x for x in names.keys() if os.path.isdir(x)]
                 for line in output.splitlines():
-                    flag, path = line.split(" ", 1)
-                    name = os.path.normcase(os.path.join(repodir, path))
-                    dirName = os.path.dirname(name)
-                    if name.startswith(dname):
+                    if line and line[0] in "MARC!?I":
+                        flag, path = line.split(" ", 1)
+                        name = os.path.normcase(os.path.join(repodir, path))
+                        dirName = os.path.dirname(name)
+                        if name.startswith(dname):
+                            if flag not in "?I":
+                                if name in names:
+                                    names[name] = self.canBeCommitted
+                                if dirName in names:
+                                    names[dirName] = self.canBeCommitted
+                                if dirs:
+                                    for d in dirs:
+                                        if name.startswith(d):
+                                            names[d] = self.canBeCommitted
+                                            dirs.remove(d)
+                                            break
                         if flag not in "?I":
-                            if name in names:
-                                names[name] = self.canBeCommitted
-                            if dirName in names:
-                                names[dirName] = self.canBeCommitted
-                            if dirs:
-                                for d in dirs:
-                                    if name.startswith(d):
-                                        names[d] = self.canBeCommitted
-                                        dirs.remove(d)
-                                        break
-                    if flag not in "?I":
-                        self.statusCache[name] = self.canBeCommitted
-                        self.statusCache[dirName] = self.canBeCommitted
-                    else:
-                        self.statusCache[name] = self.canBeAdded
-                        if dirName not in self.statusCache:
-                            self.statusCache[dirName] = self.canBeAdded
+                            self.statusCache[name] = self.canBeCommitted
+                            self.statusCache[dirName] = self.canBeCommitted
+                        else:
+                            self.statusCache[name] = self.canBeAdded
+                            if dirName not in self.statusCache:
+                                self.statusCache[dirName] = self.canBeAdded
         
         return names
     

eric ide

mercurial