/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: John Arbash Meinel
  • Date: 2008-05-01 20:04:37 UTC
  • mto: This revision was merged to the branch mainline in revision 3407.
  • Revision ID: john@arbash-meinel.com-20080501200437-yfprhb36wggjq50n
a little bit more cleanup, change how ghosts are handled

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
        are considered ghosts should not be present in the map.
160
160
    :return: An the iterator from MergeSorter.iter_topo_order()
161
161
    """
 
162
    # MergeSorter requires that all nodes be present in the graph, so get rid
 
163
    # of any references pointing outside of this graph.
162
164
    parent_graph = {}
163
165
    for revision_id in revision_ids:
164
166
        if revision_id not in parent_map: # ghost
199
201
            rev = branch.repository.get_revisions([merge])[0]
200
202
        except errors.NoSuchRevision:
201
203
            # If we are missing a revision, just print out the revision id
202
 
            to_file.write(first_prefix + merge + '\n')
 
204
            to_file.write(first_prefix + '(ghost) ' + merge + '\n')
203
205
            other_revisions.append(merge)
204
206
            continue
205
207
 
211
213
        # last committed revision.
212
214
        merge_extra = graph.find_unique_ancestors(merge, other_revisions)
213
215
        other_revisions.append(merge)
214
 
        # Now that we have the revisions, we need to sort them to get a proper
215
 
        # listing. We want to sort in reverse topological order (which
216
 
        # MergeSorter gives us). MergeSorter requires that there are no
217
 
        # dangling references, though, so clean up the graph to point to only
218
 
        # present nodes.
219
216
        merge_extra.discard(_mod_revision.NULL_REVISION)
220
217
 
221
218
        # Get a handle to all of the revisions we will need
223
220
            revisions = dict((rev.revision_id, rev) for rev in
224
221
                             branch.repository.get_revisions(merge_extra))
225
222
        except errors.NoSuchRevision:
226
 
            # If we are missing a revision, just print out the revision id
227
 
            to_file.write(first_prefix + merge + '\n')
228
 
        else:
229
 
            # Display the revisions brought in by this merge.
230
 
            rev_id_iterator = _get_sorted_revisions(merge, merge_extra,
231
 
                                branch.repository.get_parent_map(merge_extra))
232
 
            # Skip the first node
233
 
            num, first, depth, eom = rev_id_iterator.next()
234
 
            if first != merge:
235
 
                raise AssertionError('Somehow we misunderstood how'
236
 
                    ' iter_topo_order works %s != %s' % (first, merge))
237
 
            for num, sub_merge, depth, eom in rev_id_iterator:
238
 
                if sub_merge in ignore:
239
 
                    continue
240
 
                log_message = log_formatter.log_string(None,
241
 
                                revisions[sub_merge],
242
 
                                term_width - len(sub_prefix))
243
 
                to_file.write(sub_prefix + log_message + '\n')
 
223
            # One of the sub nodes is a ghost, check each one
 
224
            revisions = {}
 
225
            for revision_id in merge_extra:
 
226
                try:
 
227
                    rev = branch.repository.get_revisions(merge_extra)[0]
 
228
                except errors.NoSuchRevision:
 
229
                    revisions[revision_id] = None
 
230
                else:
 
231
                    revisions[revision_id] = rev
 
232
 
 
233
        # Display the revisions brought in by this merge.
 
234
        rev_id_iterator = _get_sorted_revisions(merge, merge_extra,
 
235
                            branch.repository.get_parent_map(merge_extra))
 
236
        # Skip the first node
 
237
        num, first, depth, eom = rev_id_iterator.next()
 
238
        if first != merge:
 
239
            raise AssertionError('Somehow we misunderstood how'
 
240
                ' iter_topo_order works %s != %s' % (first, merge))
 
241
        for num, sub_merge, depth, eom in rev_id_iterator:
 
242
            if sub_merge in ignore:
 
243
                continue
 
244
            rev = revisions[sub_merge]
 
245
            if rev is None:
 
246
                to_file.write(sub_prefix + '(ghost) ' + sub_merge + '\n')
 
247
                continue
 
248
            log_message = log_formatter.log_string(None,
 
249
                            revisions[sub_merge],
 
250
                            term_width - len(sub_prefix))
 
251
            to_file.write(sub_prefix + log_message + '\n')