Logo Search packages:      
Sourcecode: rabbitvcs version File versions  Download package

def RabbitVCS::RabbitVCS::update_file_info (   self,
  item 
)


C{update_file_info} is called only when:

  - When you enter a directory (once for each item but only when the
    item was modified since the last time it was listed)
  - When you refresh (once for each item visible)
  - When an item viewable from the current window is created or modified
  
This is insufficient for our purpose because:

  - You're not notified about items you don't see (which is needed to 
    keep the emblem for the directories above the item up-to-date)

@type   item: NautilusVFSFile
@param  item: 

Definition at line 219 of file RabbitVCS.py.

00219                                     :
        """
        
        C{update_file_info} is called only when:
        
          - When you enter a directory (once for each item but only when the
            item was modified since the last time it was listed)
          - When you refresh (once for each item visible)
          - When an item viewable from the current window is created or modified
          
        This is insufficient for our purpose because:
        
          - You're not notified about items you don't see (which is needed to 
            keep the emblem for the directories above the item up-to-date)
        
        @type   item: NautilusVFSFile
        @param  item: 
        
        """
        if not self.valid_uri(item.get_uri()): return
        path = realpath(unicode(gnomevfs.get_local_path_from_uri(item.get_uri()), "utf-8"))
        
        # log.debug("update_file_info() called for %s" % path)
        
        # Always replace the item in the table with the one we receive, because
        # for example if an item is deleted and recreated the NautilusVFSFile
        # we had before will be invalid (think pointers and such).
        self.nautilusVFSFile_table[path] = item
        
        # This check should be pretty obvious :-)
        # TODO: how come the statuses for a few directories are incorrect
        # when we remove this line (detected as working copies, even though
        # they are not)? That shouldn't happen.
        is_in_a_or_a_working_copy = self.vcs_client.is_in_a_or_a_working_copy(path)
        if not is_in_a_or_a_working_copy: return
        
        # Do our magic...
        
        # I have added extra logic in cb_status, using a list
        # (paths_from_callback) that should allow us to work around this for
        # now. But it'd be good to have an actual status monitor. 
        
        # Useful for figuring out order of calls. See "cb_status".
        # log.debug("%s: In update_status" % threading.currentThread())
        
        found = False
        
        with self.callback_paths_lock:
            
            for idx in xrange(len(self.paths_from_callback)):
                found = (str(self.paths_from_callback[idx][0]) == str(path))
                if found: break
            
            if found: # We're here because we were triggered by a callback
                (cb_path, single_status, summary) = self.paths_from_callback[idx]
                del self.paths_from_callback[idx]
        
        # Don't bother the checker if we already have the info from a callback
        
        if not found:
            (single_status, summary) = \
                self.status_checker.check_status(path,
                                                 recurse=True,
                                                 summary=True,
                                                 callback=True,
                                                 invalidate=self.always_invalidate)

        # log.debug("US Thread: %s" % threading.currentThread())
                
        # summary = get_summarized_status_both(path, statuses)
        # single_status = {path: statuses[path]}
        
#        from pprint import pformat
#        log.debug("\n\tExtension: asked for summary [%s]\n\tGot paths:\n%s" % (path, pformat(summary.keys())))
#        log.debug("\n\tExtension: asked for single [%s]\n\tGot paths:\n%s" % (path, pformat(single_status.keys())))

        # TODO: using pysvn directly because I don't like the current
        # SVN class.
        client = pysvn.Client()
        client_info = client.info(path)

        assert summary.has_key(path), "Path [%s] not in status summary!" % summary
        assert single_status.has_key(path), "Path [%s] not in single status!" % path

        # if bool(int(settings.get("general", "enable_attributes"))): self.update_columns(item, path, single_status, client_info)
        if bool(int(settings.get("general", "enable_emblems"))): self.update_status(item, path, summary, client_info)
        
    def update_columns(self, item, path, statuses, client_info):


Generated by  Doxygen 1.6.0   Back to index