~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: John Arbash Meinel
  • Date: 2008-05-01 17:42:14 UTC
  • mto: This revision was merged to the branch mainline in revision 3407.
  • Revision ID: john@arbash-meinel.com-20080501174214-o12sdv6548vvxems
Pull out terminal width from the inner loop of show_pending_merges

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
 
149
149
def show_pending_merges(new, to_file, short=False):
150
150
    """Write out a display of pending merges in a working tree."""
 
151
    # we need one extra space for terminals that wrap on last char
 
152
    term_width = osutils.terminal_width() - 1
 
153
 
151
154
    parents = new.get_parent_ids()
152
155
    if len(parents) < 2:
153
156
        return
179
182
                merged_graph[next_merge] = [p for p in parent_map[next_merge]
180
183
                                               if p in merge_extra]
181
184
        sorter = tsort.MergeSorter(merged_graph, merge)
 
185
 
182
186
        # Get a handle to all of the revisions we will need
183
 
        width = osutils.terminal_width()
184
187
        try:
185
 
            from bzrlib.osutils import terminal_width
186
 
            width = terminal_width() - 1    # we need one extra space to avoid
187
 
                                            # extra blank lines
188
 
            m_revision = branch.repository.get_revision(merge)
189
188
            revisions = dict((rev.revision_id, rev) for rev in
190
189
                             branch.repository.get_revisions(merge_extra))
191
190
        except errors.NoSuchRevision:
206
205
            else:
207
206
                prefix = '  '
208
207
            to_file.write(prefix)
209
 
            to_file.write(line_log(m_revision, width - len(prefix)))
 
208
            to_file.write(line_log(m_revision, term_width - len(prefix)))
210
209
            to_file.write('\n')
211
210
            for num, mmerge, depth, eom in rev_id_iterator:
212
211
                if mmerge in ignore:
217
216
                else:
218
217
                    prefix = '    '
219
218
                to_file.write(prefix)
220
 
                to_file.write(line_log(mm_revision, width - len(prefix)))
 
219
                to_file.write(line_log(mm_revision, term_width - len(prefix)))
221
220
                to_file.write('\n')