~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Martin Pool
  • Date: 2005-05-03 07:48:35 UTC
  • Revision ID: mbp@sourcefrog.net-20050503074835-0133bd0c16440fcd
doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from osutils import format_date
24
24
 
25
25
def show_info(b):
26
 
    # TODO: Maybe show space used by working tree, versioned files,
27
 
    # unknown files, text store.
28
 
    
29
26
    print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
30
27
 
31
28
    def plural(n, base='', pl=None):
32
29
        if n == 1:
33
30
            return base
34
 
        elif pl is not None:
 
31
        elif pl != None:
35
32
            return pl
36
33
        else:
37
34
            return 's'
51
48
                     ('modified', 'M'), ('added', 'A'), ('removed', 'D'),
52
49
                     ('renamed', 'R'), ('unknown', '?'), ('ignored', 'I'),
53
50
                     ):
54
 
        print '  %5d %s' % (count_status[fs], name)
55
 
    print '  %5d versioned subdirector%s' % (count_version_dirs,
 
51
        print '  %8d %s' % (count_status[fs], name)
 
52
    print '  %8d versioned subdirector%s' % (count_version_dirs,
56
53
                                             plural(count_version_dirs, 'y', 'ies'))
57
54
 
58
55
    print
59
56
    print 'branch history:'
60
57
    history = b.revision_history()
61
58
    revno = len(history)
62
 
    print '  %5d revision%s' % (revno, plural(revno))
 
59
    print '  %8d revision%s' % (revno, plural(revno))
63
60
    committers = Set()
64
61
    for rev in history:
65
62
        committers.add(b.get_revision(rev).committer)
66
 
    print '  %5d committer%s' % (len(committers), plural(len(committers)))
 
63
    print '  %8d committer%s' % (len(committers), plural(len(committers)))
67
64
    if revno > 0:
68
65
        firstrev = b.get_revision(history[0])
69
66
        age = int((time.time() - firstrev.timestamp) / 3600 / 24)
70
 
        print '  %5d day%s old' % (age, plural(age))
 
67
        print '  %8d day%s old' % (age, plural(age))
71
68
        print '   first revision: %s' % format_date(firstrev.timestamp,
72
69
                                                    firstrev.timezone)
73
70
 
78
75
    print
79
76
    print 'text store:'
80
77
    c, t = b.text_store.total_size()
81
 
    print '  %5d file texts' % c
82
 
    print '  %5d kB' % (t/1024)
 
78
    print '  %8d file texts' % c
 
79
    print '  %8d kB' % (t/1024)
83
80
 
84
81
    print
85
82
    print 'revision store:'
86
83
    c, t = b.revision_store.total_size()
87
 
    print '  %5d revisions' % c
88
 
    print '  %5d kB' % (t/1024)
 
84
    print '  %8d revisions' % c
 
85
    print '  %8d kB' % (t/1024)
89
86
 
90
87
 
91
88
    print
92
89
    print 'inventory store:'
93
90
    c, t = b.inventory_store.total_size()
94
 
    print '  %5d inventories' % c
95
 
    print '  %5d kB' % (t/1024)
 
91
    print '  %8d inventories' % c
 
92
    print '  %8d kB' % (t/1024)
96
93