/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/info.py

Merge from bzr.ab.integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
 
24
24
import bzrlib.diff as diff
 
25
from bzrlib.missing import find_unmerged
25
26
from bzrlib.osutils import format_date
26
27
from bzrlib.symbol_versioning import *
27
28
 
34
35
    return i        
35
36
 
36
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
 
37
47
@deprecated_function(zero_eight)
38
48
def show_info(b):
39
49
    """Please see show_bzrdir_info."""
40
50
    return show_bzrdir_info(b.bzrdir)
41
51
 
 
52
 
42
53
def show_bzrdir_info(a_bzrdir):
43
54
    """Output to stdout the 'info' for a_bzrdir."""
44
55
 
45
56
    working = a_bzrdir.open_workingtree()
46
 
    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
47
68
    
48
69
    if working.bzrdir != b.bzrdir:
49
70
        print 'working tree format:', working._format
55
76
        format = b.bzrdir._format
56
77
    print 'branch format:', format
57
78
 
58
 
    def plural(n, base='', pl=None):
59
 
        if n == 1:
60
 
            return base
61
 
        elif pl != None:
62
 
            return pl
63
 
        else:
64
 
            return 's'
 
79
    if b.get_bound_location():
 
80
        print 'bound to branch:',  b.get_bound_location()
65
81
 
66
82
    count_version_dirs = 0
67
83
 
71
87
    history = b.revision_history()
72
88
    
73
89
    print
 
90
    # Try with inaccessible branch ?
 
91
    master = b.get_master_branch()
 
92
    if master:
 
93
        local_extra, remote_extra = find_unmerged(b, b.get_master_branch())
 
94
        if remote_extra:
 
95
            print 'Branch is out of date: missing %d revision%s.' % (
 
96
                len(remote_extra), plural(len(remote_extra)))
 
97
 
74
98
    if len(history) and working.last_revision() != history[-1]:
75
99
        try:
76
100
            missing_count = len(history) - history.index(working.last_revision())
131
155
 
132
156
    print
133
157
    print 'revision store:'
134
 
    c, t = b.repository.revision_store.total_size()
 
158
    c, t = b.repository._revision_store.total_size(b.repository.get_transaction())
135
159
    print '  %8d revision%s' % (c, plural(c))
136
160
    print '  %8d kB' % (t/1024)
137
161