~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-06 07:13:51 UTC
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061006071351-e3fdd47eed1c3e7e
lazy import revisionspec and errors for bzrlib.options

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import sys
18
18
 
19
 
from bzrlib.delta import compare_trees
20
19
from bzrlib.diff import _raise_if_nonexistent
21
20
import bzrlib.errors as errors
22
21
from bzrlib.log import line_log
131
130
            else:
132
131
                new = wt
133
132
        _raise_if_nonexistent(specific_files, old, new)
134
 
        delta = compare_trees(old, new, want_unchanged=show_unchanged,
 
133
        delta = new.changes_from(old, want_unchanged=show_unchanged,
135
134
                              specific_files=specific_files)
136
135
        delta.show(to_file,
137
136
                   show_ids=show_ids,
138
137
                   show_unchanged=show_unchanged)
139
138
 
140
 
        if new_is_working_tree:
141
 
            list_paths('unknown', new.unknowns(), specific_files, to_file)
142
 
            conflict_title = False
143
 
            for conflict in wt.conflicts():
144
 
                if conflict_title is False:
145
 
                    print >> to_file, "conflicts:"
146
 
                    conflict_title = True
147
 
                print >> to_file, "  %s" % conflict
 
139
        list_paths('unknown', new.unknowns(), specific_files, to_file)
 
140
        conflict_title = False
 
141
        # show the new conflicts only for now. XXX: get them from the delta.
 
142
        for conflict in new.conflicts():
 
143
            if conflict_title is False:
 
144
                print >> to_file, "conflicts:"
 
145
                conflict_title = True
 
146
            print >> to_file, "  %s" % conflict
148
147
        if new_is_working_tree and show_pending:
149
148
            show_pending_merges(new, to_file)
150
149
    finally:
152
151
 
153
152
def show_pending_merges(new, to_file):
154
153
    """Write out a display of pending merges in a working tree."""
155
 
    pending = new.pending_merges()
 
154
    parents = new.get_parent_ids()
 
155
    if len(parents) < 2:
 
156
        return
 
157
    pending = parents[1:]
156
158
    branch = new.branch
157
 
    if len(pending) == 0:
158
 
        return
 
159
    last_revision = parents[0]
159
160
    print >>to_file, 'pending merges:'
160
 
    last_revision = branch.last_revision()
161
161
    if last_revision is not None:
162
 
        ignore = set(branch.repository.get_ancestry(last_revision))
 
162
        try:
 
163
            ignore = set(branch.repository.get_ancestry(last_revision))
 
164
        except errors.NoSuchRevision:
 
165
            # the last revision is a ghost : assume everything is new 
 
166
            # except for it
 
167
            ignore = set([None, last_revision])
163
168
    else:
164
169
        ignore = set([None])
165
 
    for merge in new.pending_merges():
 
170
    # TODO: this could be improved using merge_sorted - we'd get the same 
 
171
    # output rather than one level of indent.
 
172
    for merge in pending:
166
173
        ignore.add(merge)
167
174
        try:
168
175
            from bzrlib.osutils import terminal_width
170
177
            m_revision = branch.repository.get_revision(merge)
171
178
            print >> to_file, ' ', line_log(m_revision, width - 3)
172
179
            inner_merges = branch.repository.get_ancestry(merge)
173
 
            assert inner_merges[0] == None
 
180
            assert inner_merges[0] is None
174
181
            inner_merges.pop(0)
175
182
            inner_merges.reverse()
176
183
            for mmerge in inner_merges: