~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Martin Pool
  • Date: 2005-05-09 03:11:21 UTC
  • Revision ID: mbp@sourcefrog.net-20050509031121-9378b17cb31eaa7f
- bzr status now optionally takes filenames to check

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
    """
95
95
    from osutils import format_date
96
96
    from errors import BzrCheckError
97
 
    from diff import compare_trees
 
97
    from diff import compare_inventories
98
98
    from textui import show_status
 
99
    from inventory import Inventory
99
100
 
100
101
    if to_file == None:
101
102
        import sys
114
115
    branch._need_readlock()
115
116
    precursor = None
116
117
    if verbose:
117
 
        from tree import EmptyTree
118
 
        prev_tree = EmptyTree()
 
118
        prev_inv = Inventory()
119
119
    for revno, revision_id in which_revs():
120
120
        print >>to_file,  '-' * 60
121
121
        print >>to_file,  'revno:', revno
140
140
        # Don't show a list of changed files if we were asked about
141
141
        # one specific file.
142
142
 
143
 
        if verbose:
144
 
            this_tree = branch.revision_tree(revision_id)
145
 
            delta = compare_trees(prev_tree, this_tree, want_unchanged=False)
146
 
            delta.show(to_file, show_ids)
147
 
            prev_tree = this_tree
 
143
        if verbose and not filename:
 
144
            this_inv = branch.get_inventory(rev.inventory_id)
 
145
            delta = compare_inventories(prev_inv, this_inv)
 
146
 
 
147
            if delta.removed:
 
148
                print >>to_file, 'removed files:'
 
149
                for path, fid in delta.removed:
 
150
                    if show_ids:
 
151
                        print >>to_file, '  %-30s %s' % (path, fid)
 
152
                    else:
 
153
                        print >>to_file, ' ', path
 
154
            if delta.added:
 
155
                print >>to_file, 'added files:'
 
156
                for path, fid in delta.added:
 
157
                    if show_ids:
 
158
                        print >>to_file, '  %-30s %s' % (path, fid)
 
159
                    else:
 
160
                        print >>to_file, '  ' + path
 
161
            if delta.renamed:
 
162
                print >>to_file, 'renamed files:'
 
163
                for oldpath, newpath, fid in delta.renamed:
 
164
                    if show_ids:
 
165
                        print >>to_file, '  %s => %s %s' % (oldpath, newpath, fid)
 
166
                    else:
 
167
                        print >>to_file, '  %s => %s' % (oldpath, newpath)
 
168
            if delta.modified:
 
169
                print >>to_file, 'modified files:'
 
170
                for path, fid in delta.modified:
 
171
                    if show_ids:
 
172
                        print >>to_file, '  %-30s %s' % (path, fid)
 
173
                    else:
 
174
                        print >>to_file, '  ' + path
 
175
 
 
176
            prev_inv = this_inv
148
177
 
149
178
        precursor = revision_id
150
179