~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revfile.py

  • Committer: Martin Pool
  • Date: 2005-08-12 15:57:15 UTC
  • Revision ID: mbp@sourcefrog.net-20050812155715-439db90266e45011
- Add Revfile.check() method

Show diffs side-by-side

added added

removed removed

Lines of Context:
473
473
        for idx in range(len(self)):
474
474
            t += len(self.get(idx))
475
475
        return t
 
476
 
 
477
 
 
478
    def check(self, pb=None):
 
479
        """Extract every version and check its hash."""
 
480
        total = len(self)
 
481
        for i in range(total):
 
482
            if pb:
 
483
                pb.update("check revision", i, total)
 
484
            # the get method implicitly checks the SHA-1
 
485
            self.get(i)
 
486
        if pb:
 
487
            pb.clear()
476
488
        
477
489
 
478
490
 
540
552
        print ro().total_text_size()
541
553
    elif cmd == 'last':
542
554
        print len(ro())-1
 
555
    elif cmd == 'check':
 
556
        import bzrlib.progress
 
557
        pb = bzrlib.progress.ProgressBar()
 
558
        ro().check(pb)
543
559
    else:
544
560
        sys.stderr.write("unknown command %r\n" % cmd)
545
561
        return 1