~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Keir Mierle
  • Date: 2006-11-23 18:56:25 UTC
  • mto: (2168.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2171.
  • Revision ID: keir@cs.utoronto.ca-20061123185625-ndto53ylcb8zo1y6
Fix spacing error and add tests for status --short command flag.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
            else:
158
158
                print >> to_file, "C  %s" % conflict
159
159
        if new_is_working_tree and show_pending:
160
 
            show_pending_merges(new, to_file)
 
160
            show_pending_merges(new, to_file, short)
161
161
    finally:
162
162
        wt.unlock()
163
163
 
164
 
def show_pending_merges(new, to_file):
 
164
def show_pending_merges(new, to_file, short=False):
165
165
    """Write out a display of pending merges in a working tree."""
166
166
    parents = new.get_parent_ids()
167
167
    if len(parents) < 2:
169
169
    pending = parents[1:]
170
170
    branch = new.branch
171
171
    last_revision = parents[0]
172
 
    print >>to_file, 'pending merges:'
 
172
    if not short:
 
173
        print >>to_file, 'pending merges:'
173
174
    if last_revision is not None:
174
175
        try:
175
176
            ignore = set(branch.repository.get_ancestry(last_revision))
187
188
            from bzrlib.osutils import terminal_width
188
189
            width = terminal_width()
189
190
            m_revision = branch.repository.get_revision(merge)
190
 
            print >> to_file, ' ', line_log(m_revision, width - 3)
 
191
            if short:
 
192
                print >> to_file, 'P ', line_log(m_revision, width - 3)
 
193
            else:
 
194
                print >> to_file, ' ', line_log(m_revision, width - 3)
191
195
            inner_merges = branch.repository.get_ancestry(merge)
192
196
            assert inner_merges[0] is None
193
197
            inner_merges.pop(0)
196
200
                if mmerge in ignore:
197
201
                    continue
198
202
                mm_revision = branch.repository.get_revision(mmerge)
199
 
                print >> to_file, '   ', line_log(mm_revision, width - 5)
 
203
                if short:
 
204
                    print >> to_file, 'P. ', line_log(mm_revision, width - 5)
 
205
                else:
 
206
                    print >> to_file, '  ', line_log(mm_revision, width - 5)
200
207
                ignore.add(mmerge)
201
208
        except errors.NoSuchRevision:
202
 
            print >> to_file, ' ', merge
 
209
            if short:
 
210
                print >> to_file, 'P ', merge
 
211
            else:
 
212
                print >> to_file, ' ', merge
203
213
        
204
214
def list_paths(header, paths, specific_files, to_file, short_status_letter=''):
205
215
    done_header = False
209
219
        if not short_status_letter and not done_header:
210
220
            print >>to_file, '%s:' % header
211
221
            done_header = True
212
 
        print >>to_file, '%s %s' % (short_status_letter, path)
 
222
        print >>to_file, '%s  %s' % (short_status_letter, path)