~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
                to_file.write("%s %s\n" % (prefix, nonexistent))
157
157
            if (new_is_working_tree and show_pending):
158
158
                show_pending_merges(new, to_file, short, verbose=verbose)
 
159
            if nonexistents:
 
160
                raise errors.PathsDoNotExist(nonexistents)
159
161
        finally:
160
162
            old.unlock()
161
163
            new.unlock()
162
 
            if nonexistents:
163
 
              raise errors.PathsDoNotExist(nonexistents)
164
164
    finally:
165
165
        wt.unlock()
166
166
 
197
197
    if len(parents) < 2:
198
198
        return
199
199
 
200
 
    # we need one extra space for terminals that wrap on last char
201
 
    term_width = osutils.terminal_width() - 1
 
200
    term_width = osutils.terminal_width()
 
201
    if term_width is not None:
 
202
        # we need one extra space for terminals that wrap on last char
 
203
        term_width = term_width - 1
202
204
    if short:
203
205
        first_prefix = 'P   '
204
206
        sub_prefix = 'P.   '
206
208
        first_prefix = '  '
207
209
        sub_prefix = '    '
208
210
 
 
211
    def show_log_message(rev, prefix):
 
212
        if term_width is None:
 
213
            width = term_width
 
214
        else:
 
215
            width = term_width - len(prefix)
 
216
        log_message = log_formatter.log_string(None, rev, width, prefix=prefix)
 
217
        to_file.write(log_message + '\n')
 
218
 
209
219
    pending = parents[1:]
210
220
    branch = new.branch
211
221
    last_revision = parents[0]
213
223
        if verbose:
214
224
            to_file.write('pending merges:\n')
215
225
        else:
216
 
            to_file.write('pending merge tips: (use -v to see all merge revisions)\n')
 
226
            to_file.write('pending merge tips:'
 
227
                          ' (use -v to see all merge revisions)\n')
217
228
    graph = branch.repository.get_graph()
218
229
    other_revisions = [last_revision]
219
230
    log_formatter = log.LineLogFormatter(to_file)
227
238
            continue
228
239
 
229
240
        # Log the merge, as it gets a slightly different formatting
230
 
        log_message = log_formatter.log_string(None, rev,
231
 
                        term_width - len(first_prefix))
232
 
        to_file.write(first_prefix + log_message + '\n')
 
241
        show_log_message(rev, first_prefix)
233
242
        if not verbose:
234
243
            continue
235
244
 
267
276
            if rev is None:
268
277
                to_file.write(sub_prefix + '(ghost) ' + sub_merge + '\n')
269
278
                continue
270
 
            log_message = log_formatter.log_string(None,
271
 
                            revisions[sub_merge],
272
 
                            term_width - len(sub_prefix))
273
 
            to_file.write(sub_prefix + log_message + '\n')
 
279
            show_log_message(revisions[sub_merge], sub_prefix)
274
280
 
275
281
 
276
282
def _filter_nonexistent(orig_paths, old_tree, new_tree):