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

branch
eric7
changeset 11109
3de1710db709
parent 11090
f5f5f5803935
diff -r 62f50b72fbb7 -r 3de1710db709 src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Thu Dec 19 16:06:08 2024 +0100
+++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Thu Dec 19 19:32:37 2024 +0100
@@ -412,10 +412,20 @@
 
         self.__pullAct = self.__actionsMenu.addAction(
             EricPixmapCache.getIcon("vcsUpdate"),
-            self.tr("Pull Changes"),
-            self.__pullActTriggered,
+            self.tr("Pull Selected Changes"),
+            lambda: self.__pullActTriggered(selectedOnly=True),
+        )
+        self.__pullAct.setToolTip(
+            self.tr("Pull selected changes from a remote repository")
         )
-        self.__pullAct.setToolTip(self.tr("Pull changes from a remote repository"))
+        self.__pullAllAct = self.__actionsMenu.addAction(
+            EricPixmapCache.getIcon("vcsUpdate"),
+            self.tr("Pull All Changes"),
+            lambda: self.__pullActTriggered(selectedOnly=False),
+        )
+        self.__pullAllAct.setToolTip(
+            self.tr("Pull all changes from a remote repository")
+        )
         self.__lfPullAct = self.__actionsMenu.addAction(
             self.tr("Pull Large Files"), self.__lfPullActTriggered
         )
@@ -1616,12 +1626,9 @@
             self.__bookmarkAct.setEnabled(selectedItemsCount == 1)
             self.__bookmarkMoveAct.setEnabled(selectedItemsCount == 1)
 
-            if selectedIncomingItemsCount > 0:
-                self.__pullAct.setText(self.tr("Pull Selected Changes"))
-            else:
-                self.__pullAct.setText(self.tr("Pull Changes"))
             if self.vcs.canPull():
-                self.__pullAct.setEnabled(True)
+                self.__pullAct.setEnabled(selectedIncomingItemsCount > 0)
+                self.__pullAllAct.setEnabled(True)
                 self.__lfPullAct.setEnabled(
                     self.vcs.isExtensionActive("largefiles") and selectedItemsCount > 0
                 )
@@ -1698,7 +1705,6 @@
             ]:
                 act.setEnabled(False)
 
-            self.__pullAct.setText(self.tr("Pull Selected Changes"))
             if self.vcs.canPull() and not bool(self.__bundle):
                 selectedIncomingItemsCount = len(
                     [
@@ -1708,12 +1714,14 @@
                     ]
                 )
                 self.__pullAct.setEnabled(selectedIncomingItemsCount > 0)
+                self.__pullAllAct.setEnabled(True)
                 self.__lfPullAct.setEnabled(
                     self.vcs.isExtensionActive("largefiles")
                     and selectedIncomingItemsCount > 0
                 )
             else:
                 self.__pullAct.setEnabled(False)
+                self.__pullAllAct.setEnabled(False)
                 self.__lfPullAct.setEnabled(False)
 
             self.__unbundleAct.setEnabled(bool(self.__bundle))
@@ -1731,6 +1739,7 @@
                 self.__bookmarkAct,
                 self.__bookmarkMoveAct,
                 self.__pullAct,
+                self.__pullAllAct,
                 self.__lfPullAct,
                 self.__stripAct,
                 self.__gpgSignAct,
@@ -2401,9 +2410,13 @@
             self.vcs.getExtensionObject("largefiles").hgLfPull(revisions=revs)
 
     @pyqtSlot()
-    def __pullActTriggered(self):
+    def __pullActTriggered(self, selectedOnly=False):
         """
-        Private slot to pull changes from a remote repository.
+        Private slot to pull all or selected changes from a remote repository.
+
+        @param selectedOnly flag indicating to pull the selected changes only
+            (defaults to False)
+        @type bool (optional)
         """
         shouldReopen = False
         refresh = False
@@ -2411,15 +2424,16 @@
 
         if self.initialCommandMode in ("log", "full_log", "incoming"):
             revs = []
-            for itm in [
-                item
-                for item in self.logTree.selectedItems()
-                if item.data(0, self.__incomingRole)
-            ]:
-                rev = itm.text(self.RevisionColumn).split(":")[1].strip()
-                if rev:
-                    revs.append(rev)
-            shouldReopen = self.vcs.hgPull(revisions=revs)
+            if selectedOnly:
+                for itm in [
+                    item
+                    for item in self.logTree.selectedItems()
+                    if item.data(0, self.__incomingRole)
+                ]:
+                    rev = itm.text(self.RevisionColumn).split(":")[1].strip()
+                    if rev:
+                        revs.append(rev)
+            shouldReopen = self.vcs.hgPull(revisions=revs, noupdate=bool(revs))
             refresh = True
             if self.initialCommandMode == "incoming":
                 addNext = True

eric ide

mercurial