Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable TortoiseHgOverlayServer: upgrade context menu once for a major release

Changeset e964c1700832

Parent a6a6677f570c

by Steve Borho

Changes to one file · Browse files at e964c1700832 Showing diff from parent a6a6677f570c Diff from another changeset...

 
270
271
272
 
273
274
275
 
278
279
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
282
283
 
270
271
272
273
274
275
276
 
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
@@ -270,6 +270,7 @@
 def get_config():   show_taskbaricon = True   hgighlight_taskbaricon = True + version2cmenu = False   try:   from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx   hkey = OpenKey(HKEY_CURRENT_USER, r'Software\TortoiseHg') @@ -278,6 +279,24 @@
  except EnvironmentError: pass   try: hgighlight_taskbaricon = QueryValueEx(hkey, 'HighlightTaskbarIcon')[0] in t   except EnvironmentError: pass + + # Upgrade user's context menu, once per major release + try: version2cmenu = QueryValueEx(hkey, 'ContextMenuVersion')[0] == '2' + except EnvironmentError: pass + try: + if not version2cmenu: + from _winreg import CreateKey, SetValueEx, REG_SZ + try: promoted = QueryValueEx(hkey, 'PromotedItems')[0] + except EnvironmentError: promoted = '' + plist = [i.strip() for i in promoted.split(',')] + hkey = CreateKey(HKEY_CURRENT_USER, r'Software\TortoiseHg') + if u'log' in plist: + idx = plist.index(u'log') + plist[idx] = u'workbench' + SetValueEx(hkey, 'PromotedItems', 0, REG_SZ, ','.join(plist)) + SetValueEx(hkey, 'ContextMenuVersion', 0, REG_SZ, '2') + except EnvironmentError: + pass   except (ImportError, WindowsError):   pass   return (show_taskbaricon, hgighlight_taskbaricon)