Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

cachethg: simplfy config reading and use dict.get

Changeset fc3985a1726b

Parent f94b04920147

by Simon Heimberg

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

 
94
95
96
97
98
99
100
101
102
103
104
 
 
 
 
 
105
106
107
 
142
143
144
145
146
147
148
 
149
150
151
 
94
95
96
 
 
 
 
 
 
 
 
97
98
99
100
101
102
103
104
 
139
140
141
 
 
 
 
142
143
144
145
@@ -94,14 +94,11 @@
  repo = hg.repository(ui.ui(), path=root)   print "hg.repository() took %d ticks" % (GetTickCount() - tc1)   # check if to display overlay icons in this repo - global_opts = ui.ui().configlist('tortoisehg', 'overlayicons', []) - repo_opts = repo.ui.configlist('tortoisehg', 'overlayicons', []) - - print "%s: global overlayicons = " % path, global_opts - print "%s: repo overlayicons = " % path, repo_opts - is_netdrive = thgutil.netdrive_status(path) is not None - if (is_netdrive and 'localdisks' in global_opts) \ - or 'False' in repo_opts: + overlayopt = repo.ui.config('tortoisehg', 'overlayicons', ' ').lower() + print "%s: repo overlayicons = " % path, overlayopt + if overlayopt == 'localdisk': + overlayopt = bool(thgutil.netdrive_status(path)) + if not overlayopt or overlayopt in 'false off no'.split():   print "%s: overlayicons disabled" % path   overlay_cache = {None: None}   cache_tick_count = GetTickCount() @@ -142,10 +139,7 @@
  for f in grp:   fpath = os.path.join(root, os.path.normpath(f))   overlay_cache[fpath] = st - if path in overlay_cache: - status = overlay_cache[path] - else: - status = overlay_cache[path] = UNKNOWN + status = overlay_cache.get(path, UNKNOWN)   print "%s: %s" % (path, status)   cache_tick_count = GetTickCount()   return status