~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

MergeĀ fromĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    return i        
36
36
 
37
37
 
 
38
def plural(n, base='', pl=None):
 
39
    if n == 1:
 
40
        return base
 
41
    elif pl != None:
 
42
        return pl
 
43
    else:
 
44
        return 's'
 
45
 
 
46
 
38
47
@deprecated_function(zero_eight)
39
48
def show_info(b):
40
49
    """Please see show_bzrdir_info."""
41
50
    return show_bzrdir_info(b.bzrdir)
42
51
 
 
52
 
43
53
def show_bzrdir_info(a_bzrdir):
44
54
    """Output to stdout the 'info' for a_bzrdir."""
45
55
 
46
 
    def plural(n, base='', pl=None):
47
 
        if n == 1:
48
 
            return base
49
 
        elif pl != None:
50
 
            return pl
51
 
        else:
52
 
            return 's'
53
 
 
54
56
    working = a_bzrdir.open_workingtree()
55
 
    b = a_bzrdir.open_branch()
 
57
    working.lock_read()
 
58
    try:
 
59
        show_tree_info(working)
 
60
    finally:
 
61
        working.unlock()
 
62
 
 
63
 
 
64
def show_tree_info(working):
 
65
    """Output to stdout the 'info' for working."""
 
66
 
 
67
    b = working.branch
56
68
    
57
69
    if working.bzrdir != b.bzrdir:
58
70
        print 'working tree format:', working._format
143
155
 
144
156
    print
145
157
    print 'revision store:'
146
 
    c, t = b.repository.revision_store.total_size()
 
158
    c, t = b.repository._revision_store.total_size(b.repository.get_transaction())
147
159
    print '  %8d revision%s' % (c, plural(c))
148
160
    print '  %8d kB' % (t/1024)
149
161