/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/repofmt/knitrepo.py

Merge up bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
""")
25
25
from bzrlib import (
26
26
    bzrdir,
27
 
    deprecated_graph,
28
27
    errors,
29
28
    knit,
30
29
    lockable_files,
196
195
        revision_id = osutils.safe_revision_id(revision_id)
197
196
        return self.get_revision_reconcile(revision_id)
198
197
 
199
 
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
200
 
    @needs_read_lock
201
 
    def get_revision_graph(self, revision_id=None):
202
 
        """Return a dictionary containing the revision graph.
203
 
 
204
 
        :param revision_id: The revision_id to get a graph from. If None, then
205
 
        the entire revision graph is returned. This is a deprecated mode of
206
 
        operation and will be removed in the future.
207
 
        :return: a dictionary of revision_id->revision_parents_list.
208
 
        """
209
 
        if 'evil' in debug.debug_flags:
210
 
            mutter_callsite(3,
211
 
                "get_revision_graph scales with size of history.")
212
 
        # special case NULL_REVISION
213
 
        if revision_id == _mod_revision.NULL_REVISION:
214
 
            return {}
215
 
        a_weave = self._get_revision_vf()
216
 
        if revision_id is None:
217
 
            return a_weave.get_graph()
218
 
        if revision_id not in a_weave:
219
 
            raise errors.NoSuchRevision(self, revision_id)
220
 
        else:
221
 
            # add what can be reached from revision_id
222
 
            return a_weave.get_graph([revision_id])
223
 
 
224
 
    @needs_read_lock
225
 
    @symbol_versioning.deprecated_method(symbol_versioning.one_three)
226
 
    def get_revision_graph_with_ghosts(self, revision_ids=None):
227
 
        """Return a graph of the revisions with ghosts marked as applicable.
228
 
 
229
 
        :param revision_ids: an iterable of revisions to graph or None for all.
230
 
        :return: a Graph object with the graph reachable from revision_ids.
231
 
        """
232
 
        if 'evil' in debug.debug_flags:
233
 
            mutter_callsite(3,
234
 
                "get_revision_graph_with_ghosts scales with size of history.")
235
 
        result = deprecated_graph.Graph()
236
 
        vf = self._get_revision_vf()
237
 
        versions = set(vf.versions())
238
 
        if not revision_ids:
239
 
            pending = set(self.all_revision_ids())
240
 
            required = set([])
241
 
        else:
242
 
            pending = set(revision_ids)
243
 
            # special case NULL_REVISION
244
 
            if _mod_revision.NULL_REVISION in pending:
245
 
                pending.remove(_mod_revision.NULL_REVISION)
246
 
            required = set(pending)
247
 
        done = set([])
248
 
        while len(pending):
249
 
            revision_id = pending.pop()
250
 
            if not revision_id in versions:
251
 
                if revision_id in required:
252
 
                    raise errors.NoSuchRevision(self, revision_id)
253
 
                # a ghost
254
 
                result.add_ghost(revision_id)
255
 
                # mark it as done so we don't try for it again.
256
 
                done.add(revision_id)
257
 
                continue
258
 
            parent_ids = vf.get_parents_with_ghosts(revision_id)
259
 
            for parent_id in parent_ids:
260
 
                # is this queued or done ?
261
 
                if (parent_id not in pending and
262
 
                    parent_id not in done):
263
 
                    # no, queue it.
264
 
                    pending.add(parent_id)
265
 
            result.add_node(revision_id, parent_ids)
266
 
            done.add(revision_id)
267
 
        return result
268
 
 
269
198
    def _get_revision_vf(self):
270
199
        """:return: a versioned file containing the revisions."""
271
200
        vf = self._revision_store.get_revision_file(self.get_transaction())
288
217
        reconciler.reconcile()
289
218
        return reconciler
290
219
    
 
220
    @symbol_versioning.deprecated_method(symbol_versioning.one_five)
291
221
    def revision_parents(self, revision_id):
292
222
        return self._get_revision_vf().get_parents(revision_id)
293
223
 
301
231
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
302
232
            parents-in-revision).
303
233
        """
304
 
        assert self.is_locked()
 
234
        if not self.is_locked():
 
235
            raise AssertionError()
305
236
        vf = self._get_revision_vf()
306
237
        for index_version in vf.versions():
307
238
            parents_according_to_index = tuple(vf.get_parents_with_ghosts(
428
359
        """
429
360
        if not _found:
430
361
            format = RepositoryFormat.find_format(a_bzrdir)
431
 
            assert format.__class__ ==  self.__class__
432
362
        if _override_transport is not None:
433
363
            repo_transport = _override_transport
434
364
        else: