~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revfile.py

  • Committer: mbp at sourcefrog
  • Date: 2005-04-09 05:49:27 UTC
  • Revision ID: mbp@sourcefrog.net-20050409054927-721ecf60a1ed0dc21dde4705
Revfile: new command total-text-size

Show diffs side-by-side

added added

removed removed

Lines of Context:
401
401
                         "       revfile add\n"
402
402
                         "       revfile add-delta BASE\n"
403
403
                         "       revfile get IDX\n"
404
 
                         "       revfile find-sha HEX\n")
 
404
                         "       revfile find-sha HEX\n"
 
405
                         "       revfile total-text-size\n")
405
406
        return 1
406
407
 
407
 
 
408
 
    # TODO: Something to show compression ratio, e.g. total size of
409
 
    # all files vs size of index and data files.
410
 
        
411
 
 
412
408
    if cmd == 'add':
413
409
        new_idx = r.add(sys.stdin.read())
414
410
        print new_idx
442
438
            return 1
443
439
        else:
444
440
            print idx
445
 
            
 
441
    elif cmd == 'total-text-size':
 
442
        t = 0L
 
443
        for idx in range(len(r)):
 
444
            t += len(r.get(idx))
 
445
        print t
446
446
    else:
447
447
        sys.stderr.write("unknown command %r\n" % cmd)
448
448
        return 1