src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

branch
eric7
changeset 11039
aa1bcb26b4b7
parent 10928
46651e194fbe
child 11066
d71eab9be477
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Mon Nov 04 17:03:29 2024 +0100
+++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Tue Nov 05 10:41:51 2024 +0100
@@ -1108,9 +1108,11 @@
         QApplication.processEvents()
 
         with EricOverrideCursor():
+            self.errorGroup.hide()
+            self.errors.clear()
+
             self.buf = []
             self.cancelled = False
-            self.errors.clear()
             self.intercept = False
 
             if noEntries == 0:
@@ -1482,9 +1484,15 @@
         @param out error to be shown
         @type str
         """
-        self.errorGroup.show()
-        self.errors.insertPlainText(out)
-        self.errors.ensureCursorVisible()
+        errLines = [
+            l
+            for l in out.splitlines(keepends=True)
+            if "no such file in rev" not in l
+        ]
+        if errLines:
+            self.errorGroup.show()
+            self.errors.insertPlainText("".join(errLines))
+            self.errors.ensureCursorVisible()
 
     def on_buttonBox_clicked(self, button):
         """
@@ -1954,6 +1962,7 @@
                 self.__getLogEntries(startRev=self.__lastRev - 1)
             else:
                 self.__getLogEntries()
+            self.__generateDiffs()
 
     @pyqtSlot(QDate)
     def on_fromDate_dateChanged(self, date):
@@ -2771,7 +2780,29 @@
             currentItem = selectedItems[0]
             rev2 = currentItem.text(self.RevisionColumn).split(":", 1)[0]
             parents = currentItem.data(0, self.__parentsRole)
-            if len(parents) >= parent:
+            if len(parents) == 0:
+                currentBranch = currentItem.text(self.BranchColumn)
+                itemBelow = self.logTree.itemBelow(currentItem)
+                while (
+                    itemBelow is not None
+                    and itemBelow.text(self.BranchColumn) != currentBranch
+                ):
+                    # try the next one
+                    itemBelow = self.logTree.itemBelow(itemBelow)
+                if itemBelow is None:
+                    self.diffEdit.setPlainText(
+                        self.tr("No differences available. Get some more log entries.")
+                        if self.nextButton.isEnabled()
+                        else self.tr("No differences available.")
+                    )
+                else:
+                    rev1 = itemBelow.text(self.RevisionColumn).split(":", 1)[0]
+
+                    self.__diffGenerator.start(
+                        self.__filename, [rev1, rev2], self.__bundle
+                    )
+
+            elif len(parents) >= parent:
                 self.diffLabel.setText(
                     self.tr("Differences to Parent {0}").format(parent)
                 )

eric ide

mercurial