21
from bzrlib import errors, inventory, knit, lru_cache, osutils, trace
22
from bzrlib import revision as _mod_revision
28
revision as _mod_revision,
25
33
class _TreeShim(object):
159
167
:param repository: the target repository
171
self._use_known_graph = True
162
172
self._supports_chks = getattr(repo._format, 'supports_chks', False)
164
174
def expects_rich_root(self):
355
365
parents=rev.parent_ids, config=None, timestamp=rev.timestamp,
356
366
timezone=rev.timezone, committer=rev.committer,
357
367
revprops=rev.properties, revision_id=rev.revision_id)
368
if self._graph is None and self._use_known_graph:
369
if (getattr(_mod_graph, 'GraphThunkIdsToKeys', None) is None
370
or getattr(_mod_graph.KnownGraph, 'add_node', None) is None):
371
self._use_known_graph = False
373
self._graph = self.repo.revisions.get_known_graph_ancestry(
374
[(r,) for r in rev.parent_ids])
375
if self._graph is not None:
376
orig_heads = builder._heads
377
def thunked_heads(file_id, revision_ids):
378
# self._graph thinks in terms of keys, not ids, so translate
380
# old_res = orig_heads(file_id, revision_ids)
381
if len(revision_ids) < 2:
382
res = set(revision_ids)
384
res = set([h[0] for h in
385
self._graph.heads([(r,) for r in revision_ids])])
387
# import pdb; pdb.set_trace()
389
builder._heads = thunked_heads
359
391
if rev.parent_ids:
360
392
basis_rev_id = rev.parent_ids[0]
379
411
rev.inv_sha1 = builder.inv_sha1
380
412
builder.repository.add_revision(builder._new_revision_id, rev,
381
413
builder.new_inventory, builder._config)
414
if self._graph is not None:
415
# TODO: Use StaticTuple and .intern() for these things
416
self._graph.add_node((builder._new_revision_id,),
417
[(p,) for p in rev.parent_ids])
383
419
if signature is not None:
384
420
raise AssertionError('signatures not guaranteed yet')