Continued implementing support for the Mercurial Shelve extension.

Thu, 20 Feb 2014 19:51:30 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 20 Feb 2014 19:51:30 +0100
changeset 3290
dbb53746813f
parent 3289
164cef18fd11
child 3291
58e95eea9b6d

Continued implementing support for the Mercurial Shelve extension.

Plugins/VcsPlugins/vcsMercurial/HgDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/ShelveExtension/ProjectHelper.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/ShelveExtension/__init__.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
eric5.e4p file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/HgDialog.py	Thu Feb 20 19:09:31 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgDialog.py	Thu Feb 20 19:51:30 2014 +0100
@@ -118,7 +118,7 @@
         self.__hasAddOrDelete = False
         if args[0] in ["fetch", "qpush", "qpop", "qgoto", "rebase",
                        "transplant", "update", "import", "revert",
-                       "graft"] or \
+                       "graft", "shelve", "unshelve"] or \
            (args[0] in ["pull", "unbundle"] and
                 ("--update" in args[1:] or "--rebase" in args[1:])):
             self.__updateCommand = True
--- a/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py	Thu Feb 20 19:09:31 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py	Thu Feb 20 19:51:30 2014 +0100
@@ -45,6 +45,7 @@
         from .GpgExtension.ProjectHelper import GpgProjectHelper
         from .TransplantExtension.ProjectHelper import TransplantProjectHelper
         from .RebaseExtension.ProjectHelper import RebaseProjectHelper
+        from .ShelveExtension.ProjectHelper import ShelveProjectHelper
         self.__extensions = {
             "bookmarks": BookmarksProjectHelper(),
             "mq": QueuesProjectHelper(),
@@ -53,6 +54,7 @@
             "gpg": GpgProjectHelper(),
             "transplant": TransplantProjectHelper(),
             "rebase": RebaseProjectHelper(),
+            "shelve": ShelveProjectHelper(),
         }
         
         self.__extensionMenuTitles = {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/ProjectHelper.py	Thu Feb 20 19:51:30 2014 +0100
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the shelve extension project helper.
+"""
+
+from PyQt4.QtGui import QMenu
+
+from ..HgExtensionProjectHelper import HgExtensionProjectHelper
+
+from .shelve import Shelve
+
+
+class ShelveProjectHelper(HgExtensionProjectHelper):
+    """
+    Class implementing the queues extension project helper.
+    """
+    def __init__(self):
+        """
+        Constructor
+        """
+        super().__init__()
+    
+    def initActions(self):
+        """
+        Public method to generate the action objects.
+        """
+    
+    def initMenu(self, mainMenu):
+        """
+        Public method to generate the extension menu.
+        
+        @param mainMenu reference to the main menu (QMenu)
+        @return populated menu (QMenu)
+        """
+        menu = QMenu(self.menuTitle(), mainMenu)
+        menu.setTearOffEnabled(True)
+        
+        return menu
+    
+    def menuTitle(self):
+        """
+        Public method to get the menu title.
+        
+        @return title of the menu (string)
+        """
+        return self.tr("Shelve")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/__init__.py	Thu Feb 20 19:51:30 2014 +0100
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Package implementing the shelve extension support interface.
+"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py	Thu Feb 20 19:51:30 2014 +0100
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the shelve extension interface.
+"""
+
+from ..HgExtension import HgExtension
+##from ..HgDialog import HgDialog
+
+
+class Shelve(HgExtension):
+    """
+    Class implementing the shelve extension interface.
+    """
+    def __init__(self, vcs):
+        """
+        Constructor
+        
+        @param vcs reference to the Mercurial vcs object
+        """
+        super().__init__(vcs)
+    
+    def shutdown(self):
+        """
+        Public method used to shutdown the shelve interface.
+        """
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Feb 20 19:09:31 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Feb 20 19:51:30 2014 +0100
@@ -136,6 +136,7 @@
         from .GpgExtension.gpg import Gpg
         from .TransplantExtension.transplant import Transplant
         from .RebaseExtension.rebase import Rebase
+        from .ShelveExtension.shelve import Shelve
         self.__extensions = {
             "bookmarks": Bookmarks(self),
             "mq": Queues(self),
@@ -144,6 +145,7 @@
             "gpg": Gpg(self),
             "transplant": Transplant(self),
             "rebase": Rebase(self),
+            "shelve": Shelve(self),
         }
     
     def getPlugin(self):
@@ -1892,7 +1894,8 @@
         if self.getPlugin().getPreferences("UseLogBrowser"):
             if self.logBrowserIncoming is None:
                 from .HgLogBrowserDialog import HgLogBrowserDialog
-                self.logBrowserIncoming = HgLogBrowserDialog(self, mode="incoming")
+                self.logBrowserIncoming = HgLogBrowserDialog(
+                    self, mode="incoming")
             self.logBrowserIncoming.show()
             self.logBrowserIncoming.start(name)
         else:
@@ -1911,7 +1914,8 @@
         if self.getPlugin().getPreferences("UseLogBrowser"):
             if self.logBrowserOutgoing is None:
                 from .HgLogBrowserDialog import HgLogBrowserDialog
-                self.logBrowserOutgoing = HgLogBrowserDialog(self, mode="outgoing")
+                self.logBrowserOutgoing = HgLogBrowserDialog(
+                    self, mode="outgoing")
             self.logBrowserOutgoing.show()
             self.logBrowserOutgoing.start(name)
         else:
@@ -3382,10 +3386,15 @@
         extensionName = extensionName.strip()
         isActive = extensionName in self.__activeExtensions
         if isActive and \
-                extensionName == "transplant" and \
+            extensionName == "transplant" and \
                 self.version >= (2, 3):
             # transplant extension is deprecated as of Mercurial 2.3.0
             isActive = False
+        if isActive and \
+            extensionName == "shelve" and \
+                self.version < (2, 8):
+            # shelve extension was added as of Mercurial 2.8.0
+            isActive = False
         
         return isActive
     
--- a/eric5.e4p	Thu Feb 20 19:09:31 2014 +0100
+++ b/eric5.e4p	Thu Feb 20 19:51:30 2014 +0100
@@ -1112,6 +1112,9 @@
     <Source>UtilitiesPython2/pyflakes/__init__.py</Source>
     <Source>UtilitiesPython2/pyflakes/checker.py</Source>
     <Source>UtilitiesPython2/pyflakes/messages.py</Source>
+    <Source>Plugins/VcsPlugins/vcsMercurial/ShelveExtension/__init__.py</Source>
+    <Source>Plugins/VcsPlugins/vcsMercurial/ShelveExtension/shelve.py</Source>
+    <Source>Plugins/VcsPlugins/vcsMercurial/ShelveExtension/ProjectHelper.py</Source>
   </Sources>
   <Forms>
     <Form>PyUnit/UnittestDialog.ui</Form>

eric ide

mercurial