/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/status.py

  • Committer: Kent Gibson
  • Date: 2007-03-07 14:49:00 UTC
  • mfrom: (2324 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2350.
  • Revision ID: warthog618@gmail.com-20070307144900-6bt7twg47zul3w0w
merged bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
140
140
                    raise errors.BzrCommandError(str(e))
141
141
            else:
142
142
                new = wt
143
 
        _raise_if_nonexistent(specific_files, old, new)
144
 
        if short:
145
 
            specific_file_ids = tree.find_ids_across_trees(specific_files,
146
 
                (old, new), require_versioned=False)
147
 
            changes = new._iter_changes(old, show_unchanged,
148
 
                                        specific_file_ids)
149
 
            reporter = _mod_delta.ChangeReporter(old.inventory,
150
 
                output_file=to_file)
151
 
            _mod_delta.report_changes(changes, reporter)
152
 
        else:
153
 
            delta = new.changes_from(old, want_unchanged=show_unchanged,
154
 
                                  specific_files=specific_files)
155
 
            delta.show(to_file,
156
 
                       show_ids=show_ids,
157
 
                       show_unchanged=show_unchanged,
158
 
                       short_status=short)
159
 
        if not versioned:
160
 
            short_status_letter = '? '
161
 
            if not short:
162
 
                short_status_letter = ''
163
 
            list_paths('unknown', new.unknowns(), specific_files, to_file,
164
 
                       short_status_letter)
165
 
        conflict_title = False
166
 
        # show the new conflicts only for now. XXX: get them from the delta.
167
 
        for conflict in new.conflicts():
168
 
            if not short and conflict_title is False:
169
 
                print >> to_file, "conflicts:"
170
 
                conflict_title = True
 
143
        old.lock_read()
 
144
        new.lock_read()
 
145
        try:
 
146
            _raise_if_nonexistent(specific_files, old, new)
 
147
            want_unversioned = not versioned
171
148
            if short:
172
 
                prefix = 'C  '
 
149
                changes = new._iter_changes(old, show_unchanged, specific_files,
 
150
                    require_versioned=False, want_unversioned=want_unversioned)
 
151
                reporter = _mod_delta.ChangeReporter(output_file=to_file,
 
152
                    unversioned_filter=new.is_ignored)
 
153
                _mod_delta.report_changes(changes, reporter)
173
154
            else:
174
 
                prefix = ' '
175
 
            print >> to_file, "%s %s" % (prefix, conflict)
176
 
        if new_is_working_tree and show_pending:
177
 
            show_pending_merges(new, to_file, short)
 
155
                delta = new.changes_from(old, want_unchanged=show_unchanged,
 
156
                                      specific_files=specific_files,
 
157
                                      want_unversioned=want_unversioned)
 
158
                # filter out unknown files. We may want a tree method for
 
159
                # this
 
160
                delta.unversioned = [unversioned for unversioned in
 
161
                    delta.unversioned if not new.is_ignored(unversioned[0])]
 
162
                delta.show(to_file,
 
163
                           show_ids=show_ids,
 
164
                           show_unchanged=show_unchanged,
 
165
                           short_status=False)
 
166
            conflict_title = False
 
167
            # show the new conflicts only for now. XXX: get them from the delta.
 
168
            for conflict in new.conflicts():
 
169
                if not short and conflict_title is False:
 
170
                    print >> to_file, "conflicts:"
 
171
                    conflict_title = True
 
172
                if short:
 
173
                    prefix = 'C  '
 
174
                else:
 
175
                    prefix = ' '
 
176
                print >> to_file, "%s %s" % (prefix, conflict)
 
177
            if new_is_working_tree and show_pending:
 
178
                show_pending_merges(new, to_file, short)
 
179
        finally:
 
180
            old.unlock()
 
181
            new.unlock()
178
182
    finally:
179
183
        wt.unlock()
180
184
 
230
234
            else:
231
235
                prefix = ' '
232
236
            print >> to_file, prefix, merge
233
 
        
234
 
def list_paths(header, paths, specific_files, to_file, short_status_letter=''):
235
 
    done_header = False
236
 
    for path in paths:
237
 
        if specific_files and not is_inside_any(specific_files, path):
238
 
            continue
239
 
        if not short_status_letter and not done_header:
240
 
            print >>to_file, '%s:' % header
241
 
            done_header = True
242
 
        print >>to_file, '%s  %s' % (short_status_letter, path)