~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

 * bzr add now lists how many files were ignored per glob.  add --verbose
   lists the specific files.  (Aaron Bentley)

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
 
 
21
19
import time
22
20
 
23
 
 
24
 
import bzrlib.diff as diff
25
21
from bzrlib.osutils import format_date
26
 
from bzrlib.symbol_versioning import *
27
22
 
28
23
 
29
24
def _countiter(it):
34
29
    return i        
35
30
 
36
31
 
37
 
@deprecated_function(zero_eight)
 
32
 
38
33
def show_info(b):
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()
 
34
    import diff
47
35
    
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
 
36
    print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
57
37
 
58
38
    def plural(n, base='', pl=None):
59
39
        if n == 1:
65
45
 
66
46
    count_version_dirs = 0
67
47
 
68
 
    basis = working.basis_tree()
 
48
    basis = b.basis_tree()
 
49
    working = b.working_tree()
69
50
    work_inv = working.inventory
70
51
    delta = diff.compare_trees(basis, working, want_unchanged=True)
71
 
    history = b.revision_history()
72
52
    
73
53
    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))
82
54
    print 'in the working tree:'
83
55
    print '  %8s unchanged' % len(delta.unchanged)
84
56
    print '  %8d modified' % len(delta.modified)
106
78
 
107
79
    print
108
80
    print 'branch history:'
 
81
    history = b.revision_history()
109
82
    revno = len(history)
110
83
    print '  %8d revision%s' % (revno, plural(revno))
111
84
    committers = {}
112
85
    for rev in history:
113
 
        committers[b.repository.get_revision(rev).committer] = True
 
86
        committers[b.get_revision(rev).committer] = True
114
87
    print '  %8d committer%s' % (len(committers), plural(len(committers)))
115
88
    if revno > 0:
116
 
        firstrev = b.repository.get_revision(history[0])
 
89
        firstrev = b.get_revision(history[0])
117
90
        age = int((time.time() - firstrev.timestamp) / 3600 / 24)
118
91
        print '  %8d day%s old' % (age, plural(age))
119
92
        print '   first revision: %s' % format_date(firstrev.timestamp,
120
93
                                                    firstrev.timezone)
121
94
 
122
 
        lastrev = b.repository.get_revision(history[-1])
 
95
        lastrev = b.get_revision(history[-1])
123
96
        print '  latest revision: %s' % format_date(lastrev.timestamp,
124
97
                                                    lastrev.timezone)
125
98
 
131
104
 
132
105
    print
133
106
    print 'revision store:'
134
 
    c, t = b.repository.revision_store.total_size()
135
 
    print '  %8d revision%s' % (c, plural(c))
 
107
    c, t = b.revision_store.total_size()
 
108
    print '  %8d revisions' % c
136
109
    print '  %8d kB' % (t/1024)
137
110
 
138
111