~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: John Arbash Meinel
  • Date: 2007-07-25 21:26:30 UTC
  • mto: (2592.3.51 repository)
  • mto: This revision was merged to the branch mainline in revision 2653.
  • Revision ID: john@arbash-meinel.com-20070725212630-31m6ichxpr1f8mlk
Avoid set.difference_update(other) because it is slow when other is big.
Also, use a_weave.get_graph() rather than re-implementing it in
knitrepo.py. Further, don't call get_graph() if you aren't going to use it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
            return {}
147
147
        revision_id = osutils.safe_revision_id(revision_id)
148
148
        a_weave = self._get_revision_vf()
149
 
        entire_graph = a_weave.get_graph()
150
149
        if revision_id is None:
151
150
            return a_weave.get_graph()
152
151
        elif revision_id not in a_weave:
153
152
            raise errors.NoSuchRevision(self, revision_id)
154
153
        else:
155
154
            # add what can be reached from revision_id
156
 
            result = {}
157
 
            pending = set([revision_id])
158
 
            while len(pending) > 0:
159
 
                node = pending.pop()
160
 
                result[node] = tuple(a_weave.get_parents(node))
161
 
                for revision_id in result[node]:
162
 
                    if revision_id not in result:
163
 
                        pending.add(revision_id)
164
 
            return result
 
155
            return a_weave.get_graph([revision_id])
165
156
 
166
157
    @needs_read_lock
167
158
    def get_revision_graph_with_ghosts(self, revision_ids=None):