Plugins/PluginVcsMercurial.py

changeset 3004
c4bf32c791d0
parent 2962
d6c9d1ca2da4
child 3022
57179e4cdadd
child 3057
10516539f238
equal deleted inserted replaced
3003:cb43c34239b1 3004:c4bf32c791d0
30 pluginType = "version_control" 30 pluginType = "version_control"
31 pluginTypename = "Mercurial" 31 pluginTypename = "Mercurial"
32 className = "VcsMercurialPlugin" 32 className = "VcsMercurialPlugin"
33 packageName = "__core__" 33 packageName = "__core__"
34 shortDescription = "Implements the Mercurial version control interface." 34 shortDescription = "Implements the Mercurial version control interface."
35 longDescription = """This plugin provides the Mercurial version control interface.""" 35 longDescription = \
36 """This plugin provides the Mercurial version control interface."""
36 pyqtApi = 2 37 pyqtApi = 2
37 # End-Of-Header 38 # End-Of-Header
38 39
39 error = "" 40 error = ""
40 41
67 68
68 def getVcsSystemIndicator(): 69 def getVcsSystemIndicator():
69 """ 70 """
70 Public function to get the indicators for this version control system. 71 Public function to get the indicators for this version control system.
71 72
72 @return dictionary with indicator as key and a tuple with the vcs name (string) 73 @return dictionary with indicator as key and a tuple with the vcs name
73 and vcs display string (string) 74 (string) and vcs display string (string)
74 """ 75 """
75 global pluginTypename 76 global pluginTypename
76 data = {} 77 data = {}
77 exe = 'hg' 78 exe = 'hg'
78 if Utilities.isWindowsPlatform(): 79 if Utilities.isWindowsPlatform():
106 107
107 @param configDlg reference to the configuration dialog (QDialog) 108 @param configDlg reference to the configuration dialog (QDialog)
108 @return reference to the configuration page 109 @return reference to the configuration page
109 """ 110 """
110 global mercurialCfgPluginObject 111 global mercurialCfgPluginObject
111 from VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import MercurialPage 112 from VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import \
113 MercurialPage
112 if mercurialCfgPluginObject is None: 114 if mercurialCfgPluginObject is None:
113 mercurialCfgPluginObject = VcsMercurialPlugin(None) 115 mercurialCfgPluginObject = VcsMercurialPlugin(None)
114 page = MercurialPage(mercurialCfgPluginObject) 116 page = MercurialPage(mercurialCfgPluginObject)
115 return page 117 return page
116 118
117 119
118 def getConfigData(): 120 def getConfigData():
119 """ 121 """
120 Module function returning data as required by the configuration dialog. 122 Module function returning data as required by the configuration dialog.
121 123
122 @return dictionary with key "zzz_mercurialPage" containing the relevant data 124 @return dictionary with key "zzz_mercurialPage" containing the relevant
125 data
123 """ 126 """
124 return { 127 return {
125 "zzz_mercurialPage": \ 128 "zzz_mercurialPage": \
126 [QApplication.translate("VcsMercurialPlugin", "Mercurial"), 129 [QApplication.translate("VcsMercurialPlugin", "Mercurial"),
127 os.path.join("VcsPlugins", "vcsMercurial", "icons", 130 os.path.join("VcsPlugins", "vcsMercurial", "icons",
132 135
133 def prepareUninstall(): 136 def prepareUninstall():
134 """ 137 """
135 Module function to prepare for an uninstallation. 138 Module function to prepare for an uninstallation.
136 """ 139 """
137 if not e5App().getObject("PluginManager").isPluginLoaded("PluginVcsMercurial"): 140 if not e5App().getObject("PluginManager").isPluginLoaded(
141 "PluginVcsMercurial"):
138 Preferences.Prefs.settings.remove("Mercurial") 142 Preferences.Prefs.settings.remove("Mercurial")
139 143
140 144
141 class VcsMercurialPlugin(QObject): 145 class VcsMercurialPlugin(QObject):
142 """ 146 """
165 } 169 }
166 170
167 from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper 171 from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper
168 self.__projectHelperObject = HgProjectHelper(None, None) 172 self.__projectHelperObject = HgProjectHelper(None, None)
169 try: 173 try:
170 e5App().registerPluginObject(pluginTypename, self.__projectHelperObject, 174 e5App().registerPluginObject(
171 pluginType) 175 pluginTypename, self.__projectHelperObject, pluginType)
172 except KeyError: 176 except KeyError:
173 pass # ignore duplicate registration 177 pass # ignore duplicate registration
174 readShortcuts(pluginName=pluginTypename) 178 readShortcuts(pluginName=pluginTypename)
175 179
176 def getProjectHelper(self): 180 def getProjectHelper(self):
203 Public method to retrieve the various settings. 207 Public method to retrieve the various settings.
204 208
205 @param key the key of the value to get 209 @param key the key of the value to get
206 @return the requested setting 210 @return the requested setting
207 """ 211 """
208 if key in ["StopLogOnCopy", "UseLogBrowser", "PullUpdate", "PreferUnbundle", 212 if key in ["StopLogOnCopy", "UseLogBrowser", "PullUpdate",
209 "CreateBackup"]: 213 "PreferUnbundle", "CreateBackup"]:
210 return Preferences.toBool(Preferences.Prefs.settings.value( 214 return Preferences.toBool(Preferences.Prefs.settings.value(
211 "Mercurial/" + key, self.__mercurialDefaults[key])) 215 "Mercurial/" + key, self.__mercurialDefaults[key]))
212 elif key in ["LogLimit", "CommitMessages", "ServerPort"]: 216 elif key in ["LogLimit", "CommitMessages", "ServerPort"]:
213 return int(Preferences.Prefs.settings.value( 217 return int(Preferences.Prefs.settings.value(
214 "Mercurial/" + key, self.__mercurialDefaults[key])) 218 "Mercurial/" + key, self.__mercurialDefaults[key]))

eric ide

mercurial