Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

menuthg: remove registry key reading code

Delay promoted items reading until a menu is allocated.

Changeset 59638a981e9f

Parent 52799c003972

by Steve Borho

Changes to one file · Browse files at 59638a981e9f Showing diff from parent 52799c003972 Diff from another changeset...

 
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
171
172
173
 
 
 
 
 
 
 
174
175
176
177
 
 
178
179
180
 
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
17
 
152
153
154
155
156
157
158
159
160
161
162
163
 
 
164
165
166
167
168
@@ -12,25 +12,6 @@
 from tortoisehg.util.i18n import _ as gettext  from tortoisehg.util import cachethg, paths, hglib   -promoted = [] -try: - from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx - try: - hkey = OpenKey(HKEY_CURRENT_USER, r"Software\TortoiseHg") - pl = QueryValueEx(hkey, 'PromotedItems')[0] - for item in pl.split(','): - item = item.strip() - if item: promoted.append(str(item)) - except EnvironmentError: - promoted = ['commit', 'log'] -except ImportError: - # fallback method for non-win32 platforms - u = ui.ui() - pl = u.config('tortoisehg', 'promoteditems', 'commit') - for item in pl.split(','): - item = item.strip() - if item: promoted.append(str(item)) -  def _(msgid):   return {'id': msgid, 'str': gettext(msgid)}   @@ -171,10 +152,17 @@
  self.ui = ui   self.name = name   self.sep = [False] + self.promoted = [] + pl = self.ui.config('tortoisehg', 'promoteditems', 'commit') + for item in pl.split(','): + item = item.strip() + if item: + self.promoted.append(str(item)) +     def add_menu(self, hgcmd, icon=None, state=True): - global promoted, thgcmenu - if hgcmd in promoted: + global thgcmenu + if hgcmd in self.promoted:   pos = 0   else:   pos = 1