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

nautilus: use cachethg for iconoverlay

shows icons for directories now!

Changeset a45ccedd74b7

Parent 8603b0542197

by Simon Heimberg

Changes to 2 files · Browse files at a45ccedd74b7 Showing diff from parent 8603b0542197 Diff from another changeset...

 
36
37
38
 
39
40
41
 
113
114
115
116
117
118
119
 
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
 
 
 
 
 
 
 
 
 
 
 
264
265
266
267
268
269
270
 
271
272
273
274
275
276
 
277
278
279
 
303
304
305
306
 
307
308
309
 
36
37
38
39
40
41
42
 
114
115
116
 
117
118
119
 
233
234
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
237
238
239
240
241
242
243
244
245
246
247
248
 
249
250
251
 
252
253
 
 
 
 
 
254
255
256
257
 
281
282
283
 
284
285
286
287
@@ -36,6 +36,7 @@
 nofilecmds = 'about serve synch repoconfig userconfig merge unmerge'.split()  nocachecmds = 'about serve repoconfig userconfig'.split()   +  class HgExtension(nautilus.MenuProvider,   nautilus.ColumnProvider,   nautilus.InfoProvider, @@ -113,7 +114,6 @@
  self.cacherepo = None   return None   -#start dialogs   def run_dialog(self, menuitem, hgcmd, cwd = None):   '''   hgcmd - hgproc subcommand @@ -233,47 +233,25 @@
  "Version control status"),     def _get_file_status(self, repo, localpath): - emblem = None - status = '?' - - # This is not what the API is optimized for, but this appears - # to work efficiently enough - matcher = match.always(repo.root, localpath) - changes = repo.dirstate.status(matcher, True, True, True) - (lookup, modified, added, removed, deleted, unknown, - ignored, clean) = changes - - if localpath in clean: - emblem = 'default' - status = 'clean' - elif localpath in modified: - emblem = 'cvs-modified' - status = 'modified' - elif localpath in added: - emblem = 'cvs-aded' - status = 'added' - elif localpath in unknown: - emblem = 'new' - status = 'unrevisioned' - elif localpath in ignored: - status = 'ignored' - elif localpath in deleted: - # Should be hard to reach this state - emblem = 'stockmail-priority-high' - status = 'deleted' + from tortoise import cachethg + cachestate = cachethg.get_state(localpath, repo) + cache2state = {cachethg.UNCHANGED: ('default', 'clean'), + cachethg.ADDED: ('cvs-aded', 'added'), + cachethg.MODIFIED: ('cvs-modified', 'modified'), + cachethg.UNKNOWN: ('new', 'unrevisioned'), + cachethg.IGNORED: (None, 'ignored'), + cachethg.NOT_IN_REPO: (None, '')} + emblem, status = cache2state.get(cachestate) + if status == None: + status = '?'   return emblem, status   -   def update_file_info(self, file):   '''Return emblem and hg status for this file'''   path = self.get_path_for_vfs_file(file) - if path is None or file.is_directory(): + if not path:   return - repo = self.get_repo_for_path(path) - if repo is None: - return - localpath = path[len(repo.root)+1:] - emblem, status = self._get_file_status(repo, localpath) + emblem, status = self._get_file_status(self.cacherepo, path)   if emblem is not None:   file.add_emblem(emblem)   file.add_string_attribute('hg_status', status) @@ -303,7 +281,7 @@
  if repo is None:   return   localpath = path[len(repo.root)+1:] - emblem, status = self._get_file_status(repo, localpath) + emblem, status = self._get_file_status(repo, path)     # Get the information from Mercurial   ctx = repo.changectx(None).parents()[0]
 
169
170
171
 
 
 
 
 
 
 
172
173
 
169
170
171
172
173
174
175
176
177
178
179
180
@@ -169,5 +169,12 @@
  path = os.environ.get('TORTOISEHG_PATH', defpath)   return os.path.isdir(path) and path or os.path.dirname(path)   + def netdrive_status(drive): + """ + return True if a network drive is accessible (connected, ...), + or None if <drive> is not a network drive + """ + return None +   def icon_to_bitmap(iconPathName):   pass