101
102
self._commit_builder_class = _commit_builder_class
102
103
self._serializer = _serializer
103
104
self._reconcile_fixes_text_parents = True
105
control_store.get_scope = self.get_transaction
106
text_store.get_scope = self.get_transaction
107
_revision_store.get_scope = self.get_transaction
105
109
def _warn_if_deprecated(self):
106
110
# This class isn't deprecated
195
197
revision_id = osutils.safe_revision_id(revision_id)
196
198
return self.get_revision_reconcile(revision_id)
198
@symbol_versioning.deprecated_method(symbol_versioning.one_four)
200
def get_revision_graph(self, revision_id=None):
201
"""Return a dictionary containing the revision graph.
203
:param revision_id: The revision_id to get a graph from. If None, then
204
the entire revision graph is returned. This is a deprecated mode of
205
operation and will be removed in the future.
206
:return: a dictionary of revision_id->revision_parents_list.
208
if 'evil' in debug.debug_flags:
210
"get_revision_graph scales with size of history.")
211
# special case NULL_REVISION
212
if revision_id == _mod_revision.NULL_REVISION:
214
a_weave = self._get_revision_vf()
215
if revision_id is None:
216
return a_weave.get_graph()
217
if revision_id not in a_weave:
218
raise errors.NoSuchRevision(self, revision_id)
220
# add what can be reached from revision_id
221
return a_weave.get_graph([revision_id])
224
@symbol_versioning.deprecated_method(symbol_versioning.one_three)
225
def get_revision_graph_with_ghosts(self, revision_ids=None):
226
"""Return a graph of the revisions with ghosts marked as applicable.
228
:param revision_ids: an iterable of revisions to graph or None for all.
229
:return: a Graph object with the graph reachable from revision_ids.
231
if 'evil' in debug.debug_flags:
233
"get_revision_graph_with_ghosts scales with size of history.")
234
result = deprecated_graph.Graph()
235
vf = self._get_revision_vf()
236
versions = set(vf.versions())
238
pending = set(self.all_revision_ids())
241
pending = set(revision_ids)
242
# special case NULL_REVISION
243
if _mod_revision.NULL_REVISION in pending:
244
pending.remove(_mod_revision.NULL_REVISION)
245
required = set(pending)
248
revision_id = pending.pop()
249
if not revision_id in versions:
250
if revision_id in required:
251
raise errors.NoSuchRevision(self, revision_id)
253
result.add_ghost(revision_id)
254
# mark it as done so we don't try for it again.
255
done.add(revision_id)
257
parent_ids = vf.get_parents_with_ghosts(revision_id)
258
for parent_id in parent_ids:
259
# is this queued or done ?
260
if (parent_id not in pending and
261
parent_id not in done):
263
pending.add(parent_id)
264
result.add_node(revision_id, parent_ids)
265
done.add(revision_id)
268
200
def _get_revision_vf(self):
269
201
""":return: a versioned file containing the revisions."""
270
202
vf = self._revision_store.get_revision_file(self.get_transaction())
369
303
file_mode=control_files._file_mode,
372
versionedfile_class=knit.KnitVersionedFile,
306
versionedfile_class=knit.make_file_knit,
373
307
versionedfile_kwargs={'delta':False,
374
308
'factory':knit.KnitPlainFactory(),