~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: John Arbash Meinel
  • Date: 2006-02-21 16:43:22 UTC
  • mfrom: (1560 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1562.
  • Revision ID: john@arbash-meinel.com-20060221164322-b007aa882582a66e
[merge] bzr.dev, cleanup conflicts, fixup http tests for new TestCase layout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
 
19
__all__ = ['show_bzrdir_info']
 
20
 
19
21
import time
20
22
 
 
23
 
 
24
import bzrlib.diff as diff
21
25
from bzrlib.osutils import format_date
22
 
from bzrlib.workingtree import WorkingTree
 
26
from bzrlib.symbol_versioning import *
23
27
 
24
28
 
25
29
def _countiter(it):
30
34
    return i        
31
35
 
32
36
 
33
 
 
 
37
@deprecated_function(zero_eight)
34
38
def show_info(b):
35
 
    import diff
 
39
    """Please see show_bzrdir_info."""
 
40
    return show_bzrdir_info(b.bzrdir)
 
41
 
 
42
def show_bzrdir_info(a_bzrdir):
 
43
    """Output to stdout the 'info' for a_bzrdir."""
 
44
 
 
45
    working = a_bzrdir.open_workingtree()
 
46
    b = a_bzrdir.open_branch()
36
47
    
37
 
    print 'branch format:', b.control_files.get_utf8(
38
 
        'branch-format').readline().rstrip('\n')
 
48
    if working.bzrdir != b.bzrdir:
 
49
        print 'working tree format:', working._format
 
50
        print 'branch location:', b.bzrdir.root_transport.base
 
51
    try:
 
52
        b._format.get_format_string()
 
53
        format = b._format
 
54
    except NotImplementedError:
 
55
        format = b.bzrdir._format
 
56
    print 'branch format:', format
39
57
 
40
58
    def plural(n, base='', pl=None):
41
59
        if n == 1:
47
65
 
48
66
    count_version_dirs = 0
49
67
 
50
 
    working = b.bzrdir.open_workingtree()
51
68
    basis = working.basis_tree()
52
69
    work_inv = working.inventory
53
70
    delta = diff.compare_trees(basis, working, want_unchanged=True)
 
71
    history = b.revision_history()
54
72
    
55
73
    print
 
74
    if len(history) and working.last_revision() != history[-1]:
 
75
        try:
 
76
            missing_count = len(history) - history.index(working.last_revision())
 
77
        except ValueError:
 
78
            # consider it all out of date
 
79
            missing_count = len(history)
 
80
        print 'Working tree is out of date: missing %d revision%s.' % (
 
81
            missing_count, plural(missing_count))
56
82
    print 'in the working tree:'
57
83
    print '  %8s unchanged' % len(delta.unchanged)
58
84
    print '  %8d modified' % len(delta.modified)
80
106
 
81
107
    print
82
108
    print 'branch history:'
83
 
    history = b.revision_history()
84
109
    revno = len(history)
85
110
    print '  %8d revision%s' % (revno, plural(revno))
86
111
    committers = {}
107
132
    print
108
133
    print 'revision store:'
109
134
    c, t = b.repository.revision_store.total_size()
110
 
    print '  %8d revisions' % c
 
135
    print '  %8d revision%s' % (c, plural(c))
111
136
    print '  %8d kB' % (t/1024)
112
137
 
113
138