48 exe = 'hg' |
49 exe = 'hg' |
49 if Utilities.isWindowsPlatform(): |
50 if Utilities.isWindowsPlatform(): |
50 exe += '.exe' |
51 exe += '.exe' |
51 |
52 |
52 data = { |
53 data = { |
53 "programEntry" : True, |
54 "programEntry": True, |
54 "header" : QApplication.translate("VcsMercurialPlugin", |
55 "header": QApplication.translate("VcsMercurialPlugin", |
55 "Version Control - Mercurial"), |
56 "Version Control - Mercurial"), |
56 "exe" : exe, |
57 "exe": exe, |
57 "versionCommand" : 'version', |
58 "versionCommand": 'version', |
58 "versionStartsWith" : 'Mercurial', |
59 "versionStartsWith": 'Mercurial', |
59 "versionPosition" : -1, |
60 "versionPosition": -1, |
60 "version" : "", |
61 "version": "", |
61 "versionCleanup" : (0, -1), |
62 "versionCleanup": (0, -1), |
62 } |
63 } |
63 |
64 |
64 return data |
65 return data |
|
66 |
65 |
67 |
66 def getVcsSystemIndicator(): |
68 def getVcsSystemIndicator(): |
67 """ |
69 """ |
68 Public function to get the indicators for this version control system. |
70 Public function to get the indicators for this version control system. |
69 |
71 |
78 if Utilities.isinpath(exe): |
80 if Utilities.isinpath(exe): |
79 data[".hg"] = (pluginTypename, displayString()) |
81 data[".hg"] = (pluginTypename, displayString()) |
80 data["_hg"] = (pluginTypename, displayString()) |
82 data["_hg"] = (pluginTypename, displayString()) |
81 return data |
83 return data |
82 |
84 |
|
85 |
83 def displayString(): |
86 def displayString(): |
84 """ |
87 """ |
85 Public function to get the display string. |
88 Public function to get the display string. |
86 |
89 |
87 @return display string (string) |
90 @return display string (string) |
107 if mercurialCfgPluginObject is None: |
111 if mercurialCfgPluginObject is None: |
108 mercurialCfgPluginObject = VcsMercurialPlugin(None) |
112 mercurialCfgPluginObject = VcsMercurialPlugin(None) |
109 page = MercurialPage(mercurialCfgPluginObject) |
113 page = MercurialPage(mercurialCfgPluginObject) |
110 return page |
114 return page |
111 |
115 |
|
116 |
112 def getConfigData(): |
117 def getConfigData(): |
113 """ |
118 """ |
114 Module function returning data as required by the configuration dialog. |
119 Module function returning data as required by the configuration dialog. |
115 |
120 |
116 @return dictionary with key "zzz_mercurialPage" containing the relevant data |
121 @return dictionary with key "zzz_mercurialPage" containing the relevant data |
117 """ |
122 """ |
118 return { |
123 return { |
119 "zzz_mercurialPage" : \ |
124 "zzz_mercurialPage": \ |
120 [QApplication.translate("VcsMercurialPlugin", "Mercurial"), |
125 [QApplication.translate("VcsMercurialPlugin", "Mercurial"), |
121 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
126 os.path.join("VcsPlugins", "vcsMercurial", "icons", |
122 "preferences-mercurial.png"), |
127 "preferences-mercurial.png"), |
123 createConfigurationPage, "vcsPage", None], |
128 createConfigurationPage, "vcsPage", None], |
124 } |
129 } |
125 |
130 |
|
131 |
126 def prepareUninstall(): |
132 def prepareUninstall(): |
127 """ |
133 """ |
128 Module function to prepare for an uninstallation. |
134 Module function to prepare for an uninstallation. |
129 """ |
135 """ |
130 if not e5App().getObject("PluginManager").isPluginLoaded("PluginVcsMercurial"): |
136 if not e5App().getObject("PluginManager").isPluginLoaded("PluginVcsMercurial"): |
131 Preferences.Prefs.settings.remove("Mercurial") |
137 Preferences.Prefs.settings.remove("Mercurial") |
132 |
138 |
|
139 |
133 class VcsMercurialPlugin(QObject): |
140 class VcsMercurialPlugin(QObject): |
134 """ |
141 """ |
135 Class implementing the Mercurial version control plugin. |
142 Class implementing the Mercurial version control plugin. |
136 """ |
143 """ |
137 def __init__(self, ui): |
144 def __init__(self, ui): |
142 """ |
149 """ |
143 QObject.__init__(self, ui) |
150 QObject.__init__(self, ui) |
144 self.__ui = ui |
151 self.__ui = ui |
145 |
152 |
146 self.__mercurialDefaults = { |
153 self.__mercurialDefaults = { |
147 "StopLogOnCopy" : True, # used in log browser |
154 "StopLogOnCopy": True, # used in log browser |
148 "UseLogBrowser" : True, |
155 "UseLogBrowser": True, |
149 "LogLimit" : 100, |
156 "LogLimit": 100, |
150 "CommitMessages" : 20, |
157 "CommitMessages": 20, |
151 "PullUpdate" : False, |
158 "PullUpdate": False, |
152 "ServerPort" : 8000, |
159 "ServerPort": 8000, |
153 "ServerStyle" : "", |
160 "ServerStyle": "", |
154 } |
161 } |
155 |
162 |
156 from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper |
163 from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper |
157 self.__projectHelperObject = HgProjectHelper(None, None) |
164 self.__projectHelperObject = HgProjectHelper(None, None) |
158 try: |
165 try: |
159 e5App().registerPluginObject(pluginTypename, self.__projectHelperObject, |
166 e5App().registerPluginObject(pluginTypename, self.__projectHelperObject, |
160 pluginType) |
167 pluginType) |
161 except KeyError: |
168 except KeyError: |
162 pass # ignore duplicate registration |
169 pass # ignore duplicate registration |
163 readShortcuts(pluginName = pluginTypename) |
170 readShortcuts(pluginName=pluginTypename) |
164 |
171 |
165 def getProjectHelper(self): |
172 def getProjectHelper(self): |
166 """ |
173 """ |
167 Public method to get a reference to the project helper object. |
174 Public method to get a reference to the project helper object. |
168 |
175 |
172 |
179 |
173 def activate(self): |
180 def activate(self): |
174 """ |
181 """ |
175 Public method to activate this plugin. |
182 Public method to activate this plugin. |
176 |
183 |
177 @return tuple of reference to instantiated viewmanager and |
184 @return tuple of reference to instantiated viewmanager and |
178 activation status (boolean) |
185 activation status (boolean) |
179 """ |
186 """ |
180 from VcsPlugins.vcsMercurial.hg import Hg |
187 from VcsPlugins.vcsMercurial.hg import Hg |
181 self.__object = Hg(self, self.__ui) |
188 self.__object = Hg(self, self.__ui) |
182 return self.__object, True |
189 return self.__object, True |
201 return int(Preferences.Prefs.settings.value("Mercurial/" + key, |
208 return int(Preferences.Prefs.settings.value("Mercurial/" + key, |
202 self.__mercurialDefaults[key])) |
209 self.__mercurialDefaults[key])) |
203 elif key in ["Commits"]: |
210 elif key in ["Commits"]: |
204 return Preferences.toList(Preferences.Prefs.settings.value( |
211 return Preferences.toList(Preferences.Prefs.settings.value( |
205 "Mercurial/" + key)) |
212 "Mercurial/" + key)) |
206 else: |
213 else: |
207 return Preferences.Prefs.settings.value("Mercurial/" + key) |
214 return Preferences.Prefs.settings.value("Mercurial/" + key) |
208 |
215 |
209 def setPreferences(self, key, value): |
216 def setPreferences(self, key, value): |
210 """ |
217 """ |
211 Public method to store the various settings. |
218 Public method to store the various settings. |