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

branch
eric7
changeset 11080
92cd5f094e7a
parent 10690
fab36645aa7d
child 11082
58838580274e
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgDialog.py	Wed Dec 04 08:20:35 2024 +0100
+++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgDialog.py	Wed Dec 04 08:21:32 2024 +0100
@@ -12,6 +12,7 @@
 
 from eric7 import Preferences, Utilities
 
+from .HgUtilities import parseProgressInfo
 from .Ui_HgDialog import Ui_HgDialog
 
 
@@ -56,6 +57,8 @@
         Private slot called when the process finished or the user pressed
         the button.
         """
+        self.progressWidget.hide()
+
         self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True)
         self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
         self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True)
@@ -95,6 +98,7 @@
         @return flag indicating a successful start of the process
         @rtype bool
         """
+        self.progressWidget.hide()
         self.errorGroup.hide()
         self.inputGroup.hide()
         self.normal = False
@@ -113,6 +117,7 @@
             "unshelve",
             "strip",
             "histedit",
+            "uncommit",
         ] or (
             args[0] in ["pull", "unbundle"]
             and ("--update" in args[1:] or "--rebase" in args[1:])
@@ -168,9 +173,11 @@
         """
         Private slot to show some output.
 
-        @param out output to be shown
+        @param out output sent to the stdout channel
         @type str
         """
+        self.progressWidget.hide()
+
         self.resultbox.insertPlainText(Utilities.filterAnsiSequences(out))
         self.resultbox.ensureCursorVisible()
 
@@ -185,14 +192,26 @@
 
     def __showError(self, out):
         """
-        Private slot to show some error.
+        Private slot to show some error or progress information.
 
-        @param out error to be shown
+        @param out output sent to the stderr channel
         @type str
         """
-        self.errorGroup.show()
-        self.errors.insertPlainText(Utilities.filterAnsiSequences(out))
-        self.errors.ensureCursorVisible()
+        for line in out.splitlines(keepends=True):
+            if line.strip():
+                topic, value, maximum, estimate = parseProgressInfo(line.strip())
+                if topic:
+                    self.topicLabel.setText(topic.capitalize())
+                    self.remainingTimeLabel.setText(
+                        self.tr("Time remaining: {0}").format(estimate)
+                    )
+                    self.progressBar.setMaximum(maximum)
+                    self.progressBar.setValue(value)
+                    self.progressWidget.setVisible(value != maximum)
+                else:
+                    self.errorGroup.show()
+                    self.errors.insertPlainText(Utilities.filterAnsiSequences(line))
+                    self.errors.ensureCursorVisible()
 
         QCoreApplication.processEvents()
 

eric ide

mercurial