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

branch
eric7
changeset 9421
989ee2535d59
parent 9413
80c06d472826
child 9473
3f23dbf37dbe
diff -r 92810aebc909 -r 989ee2535d59 src/eric7/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py	Tue Oct 18 17:48:03 2022 +0200
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitBlameDialog.py	Wed Oct 19 13:39:16 2022 +0200
@@ -49,12 +49,13 @@
         self.vcs = vcs
 
         self.__blameRe = re.compile(
-            r"""\^?([0-9a-fA-F]+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2})\s+"""
+            r"""([?^*]?)([0-9a-fA-F]+)\s+\((.+)\s+(\d{4}-\d{2}-\d{2})\s+"""
             r"""(\d{2}:\d{2}):\d{2}\s+[+-]\d{4}\s+(\d+)\)\s?(.*)"""
         )
-        # commit - author - date - time - lineno. - text
+        # marker - commit - author - date - time - lineno. - text
 
         self.blameList.headerItem().setText(self.blameList.columnCount(), "")
+        self.blameList.headerItem().setText(0, " ")
         font = Preferences.getEditorOtherFonts("MonospacedFont")
         self.blameList.setFont(font)
 
@@ -82,11 +83,14 @@
 
         e.accept()
 
-    def start(self, fn):
+    def start(self, fn, skiplist=""):
         """
         Public slot to start the blame command.
 
-        @param fn filename to show the blame for (string)
+        @param fn filename to show the blame for
+        @type str
+        @param skiplist name of a skip list file
+        @type str
         """
         self.blameList.clear()
 
@@ -108,6 +112,8 @@
             "--abbrev={0}".format(self.vcs.getPlugin().getPreferences("CommitIdLength"))
         )
         args.append("--date=iso")
+        if skiplist:
+            args.extend(["--ignore-revs-file", skiplist])
         args.append(fn)
 
         self.process.kill()
@@ -181,22 +187,35 @@
         """
         self.blameList.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents)
 
-    def __generateItem(self, commitId, author, date, time, lineno, text):
+    def __generateItem(self, mark, commitId, author, date, time, lineno, text):
         """
         Private method to generate a blame item in the annotation list.
 
-        @param commitId commit identifier (string)
-        @param author author of the change (string)
-        @param date date of the change (string)
-        @param time time of the change (string)
-        @param lineno line number of the change (string)
-        @param text name (path) of the tag (string)
+        @param mark mark character
+        @type str
+        @param commitId commit identifier
+        @type str
+        @param author author of the change
+        @type str
+        @param date date of the change
+        @type str
+        @param time time of the change
+        @type str
+        @param lineno line number of the change
+        @type str
+        @param text text line of the file
+        @type str
         """
         itm = QTreeWidgetItem(
-            self.blameList, [commitId, author, date, time, lineno, text]
+            self.blameList, [mark, commitId, author, date, time, lineno, text]
         )
-        itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
-        itm.setTextAlignment(4, Qt.AlignmentFlag.AlignRight)
+        itm.setTextAlignment(0, Qt.AlignmentFlag.AlignHCenter)
+        itm.setTextAlignment(5, Qt.AlignmentFlag.AlignRight)
+
+        if mark == "?":
+            itm.setToolTip(0, self.tr("Changed by skipped commit"))
+        elif mark == "*":
+            itm.setToolTip(0, self.tr("Commit cannot be skipped"))
 
     def __readStdout(self):
         """
@@ -213,8 +232,8 @@
             ).strip()
             match = self.__blameRe.match(line)
             if match is not None:
-                commitId, author, date, time, lineno, text = match.groups()
-                self.__generateItem(commitId, author, date, time, lineno, text)
+                mark, commitId, author, date, time, lineno, text = match.groups()
+                self.__generateItem(mark, commitId, author, date, time, lineno, text)
 
     def __readStderr(self):
         """

eric ide

mercurial