~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:48:34 UTC
  • Revision ID: mbp@sourcefrog.net-20050510064834-83b4dc606b48aa87
- new command 'bzr modified' to exercise the statcache

Show diffs side-by-side

added added

removed removed

Lines of Context:
453
453
        show_diff(Branch('.'), revision, file_list)
454
454
 
455
455
 
 
456
        
 
457
 
 
458
 
456
459
class cmd_deleted(Command):
457
460
    """List files deleted in the working tree.
458
461
 
475
478
                else:
476
479
                    print path
477
480
 
 
481
 
 
482
class cmd_modified(Command):
 
483
    """List files modified in working tree."""
 
484
    hidden = True
 
485
    def run(self):
 
486
        import statcache
 
487
        b = Branch('.')
 
488
        sc = statcache.update_cache(b)
 
489
        basis = b.basis_tree()
 
490
        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
 
498
            if cacheentry[statcache.SC_SHA1] != ie.text_sha1:
 
499
                print path
 
500
                
 
501
        
 
502
 
478
503
class cmd_root(Command):
479
504
    """Show the tree root directory.
480
505