~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-05-10 06:54:12 UTC
  • Revision ID: mbp@sourcefrog.net-20050510065412-cd05087d1e4297f7
- Avoid calling Inventory.iter_entries() when finding modified
  files.  Just calculate path for files known to be changed.
- update_cache optionally takes inventory to avoid reading it twice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
485
485
    def run(self):
486
486
        import statcache
487
487
        b = Branch('.')
488
 
        sc = statcache.update_cache(b)
 
488
        inv = b.read_working_inventory()
 
489
        sc = statcache.update_cache(b, inv)
489
490
        basis = b.basis_tree()
490
491
        basis_inv = basis.inventory
491
 
        for path, ie in basis_inv.iter_entries():
492
 
            if ie.kind != 'file':
493
 
                continue
494
 
            cacheentry = sc.get(ie.file_id)
495
 
            if not cacheentry:
496
 
                # deleted
497
 
                continue
 
492
        
 
493
        # We used to do this through iter_entries(), but that's slow
 
494
        # when most of the files are unmodified, as is usually the
 
495
        # case.  So instead we iterate by inventory entry, and only
 
496
        # calculate paths as necessary.
 
497
 
 
498
        for file_id in basis_inv:
 
499
            cacheentry = sc.get(file_id)
 
500
            if not cacheentry:                 # deleted
 
501
                continue
 
502
            ie = basis_inv[file_id]
498
503
            if cacheentry[statcache.SC_SHA1] != ie.text_sha1:
 
504
                path = inv.id2path(file_id)
499
505
                print path
500
506
                
501
507