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)
199
def get_revision_graph(self, revision_id=None):
200
"""Return a dictionary containing the revision graph.
202
:param revision_id: The revision_id to get a graph from. If None, then
203
the entire revision graph is returned. This is a deprecated mode of
204
operation and will be removed in the future.
205
:return: a dictionary of revision_id->revision_parents_list.
207
if 'evil' in debug.debug_flags:
209
"get_revision_graph scales with size of history.")
210
# special case NULL_REVISION
211
if revision_id == _mod_revision.NULL_REVISION:
213
a_weave = self._get_revision_vf()
214
if revision_id is None:
215
return a_weave.get_graph()
216
if revision_id not in a_weave:
217
raise errors.NoSuchRevision(self, revision_id)
219
# add what can be reached from revision_id
220
return a_weave.get_graph([revision_id])
223
def get_revision_graph_with_ghosts(self, revision_ids=None):
224
"""Return a graph of the revisions with ghosts marked as applicable.
226
:param revision_ids: an iterable of revisions to graph or None for all.
227
:return: a Graph object with the graph reachable from revision_ids.
229
if 'evil' in debug.debug_flags:
231
"get_revision_graph_with_ghosts scales with size of history.")
232
result = deprecated_graph.Graph()
233
vf = self._get_revision_vf()
234
versions = set(vf.versions())
236
pending = set(self.all_revision_ids())
239
pending = set(revision_ids)
240
# special case NULL_REVISION
241
if _mod_revision.NULL_REVISION in pending:
242
pending.remove(_mod_revision.NULL_REVISION)
243
required = set(pending)
246
revision_id = pending.pop()
247
if not revision_id in versions:
248
if revision_id in required:
249
raise errors.NoSuchRevision(self, revision_id)
251
result.add_ghost(revision_id)
252
# mark it as done so we don't try for it again.
253
done.add(revision_id)
255
parent_ids = vf.get_parents_with_ghosts(revision_id)
256
for parent_id in parent_ids:
257
# is this queued or done ?
258
if (parent_id not in pending and
259
parent_id not in done):
261
pending.add(parent_id)
262
result.add_node(revision_id, parent_ids)
263
done.add(revision_id)
266
200
def _get_revision_vf(self):
267
201
""":return: a versioned file containing the revisions."""
268
202
vf = self._revision_store.get_revision_file(self.get_transaction())
271
def _get_history_vf(self):
272
"""Get a versionedfile whose history graph reflects all revisions.
274
For knit repositories, this is the revision knit.
276
return self._get_revision_vf()
278
205
def has_revisions(self, revision_ids):
279
206
"""See Repository.has_revisions()."""