Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 5513
2ccfb5077dd6
parent 5512
f148796813d4
child 5514
1aa13333eb9f
diff -r f148796813d4 -r 2ccfb5077dd6 Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Feb 11 19:47:41 2017 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sun Feb 12 11:40:10 2017 +0100
@@ -372,6 +372,8 @@
         self.actionsButton.setIcon(
             UI.PixmapCache.getIcon("actionsToolButton.png"))
         self.actionsButton.setMenu(self.__actionsMenu)
+        
+        # TODO: add action to apply viewed bundle file
     
     def __actionsMenuHovered(self, action):
         """
@@ -1526,6 +1528,7 @@
                 selectedItemsCount == 1)
             
             self.actionsButton.setEnabled(True)
+        
         elif self.initialCommandMode == "incoming" and self.projectMode:
             for act in [self.__phaseAct, self.__graftAct, self.__mergeAct,
                         self.__tagAct, self.__switchAct, self.__bookmarkAct,
@@ -1557,9 +1560,30 @@
                 self.__fetchAct.setEnabled(False)
             
             self.actionsButton.setEnabled(True)
+        
+        elif self.initialCommandMode == "outgoing" and self.projectMode:
+            for act in [self.__phaseAct, self.__graftAct, self.__mergeAct,
+                        self.__tagAct, self.__switchAct, self.__bookmarkAct,
+                        self.__bookmarkMoveAct, self.__pullAct,
+                        self.__lfPullAct, self.__fetchAct, self.__stripAct,
+                        self.__gpgSignAct, self.__gpgVerifyAct]:
+                act.setEnabled(False)
+            
+            selectedItemsCount = len(self.logTree.selectedItems())
+            if self.vcs.canPush():
+                self.__pushAct.setEnabled(
+                    selectedItemsCount == 1 and
+                    self.logTree.selectedItems()[0].text(self.PhaseColumn) ==
+                    self.phases["draft"])
+                self.__pushAllAct.setEnabled(True)
+            else:
+                self.__pushAct.setEnabled(False)
+                self.__pushAllAct.setEnabled(False)
+            
+            self.__bundleAct.setEnabled(selectedItemsCount > 0)
+        
         else:
             self.actionsButton.setEnabled(False)
-        # TODO: add code to enable menu in incoming / outgoing mode as well
     
     def __updateDetailsAndFiles(self):
         """
@@ -2311,8 +2335,18 @@
                     "all": False,
                 }
         elif self.initialCommandMode == "outgoing":
-            # TODO: implement bundle for outgoing mode
-            pass
+            selectedItems = self.logTree.selectedItems()
+            if len(selectedItems) > 0:
+                revs = []
+                for itm in selectedItems:
+                    rev = itm.text(self.RevisionColumn).split(":", 1)[0]
+                    revs.append(rev.strip())
+                
+                bundleData = {
+                    "revs": revs,
+                    "base": "",
+                    "all": False,
+                }
         
         self.vcs.hgBundle(self.repodir, bundleData=bundleData)
     

eric ide

mercurial