2623
2623
result[revision_id] = (_mod_revision.NULL_REVISION,)
2626
def _get_parent_map_no_fallbacks(self, revision_ids):
2627
"""Same as Repository.get_parent_map except doesn't query fallbacks."""
2628
# revisions index works in keys; this just works in revisions
2629
# therefore wrap and unwrap
2632
for revision_id in revision_ids:
2633
if revision_id == _mod_revision.NULL_REVISION:
2634
result[revision_id] = ()
2635
elif revision_id is None:
2636
raise ValueError('get_parent_map(None) is not valid')
2638
query_keys.append((revision_id ,))
2639
vf = self.revisions.without_fallbacks()
2640
for ((revision_id,), parent_keys) in \
2641
vf.get_parent_map(query_keys).iteritems():
2643
result[revision_id] = tuple([parent_revid
2644
for (parent_revid,) in parent_keys])
2646
result[revision_id] = (_mod_revision.NULL_REVISION,)
2626
2649
def _make_parents_provider(self):
2650
if not self._format.supports_external_lookups:
2652
return graph.StackedParentsProvider(_LazyListJoin(
2653
[self._make_parents_provider_unstacked()],
2654
self._fallback_repositories))
2656
def _make_parents_provider_unstacked(self):
2657
return graph.CallableToParentsProviderAdapter(
2658
self._get_parent_map_no_fallbacks)
2629
2660
@needs_read_lock
2630
2661
def get_known_graph_ancestry(self, revision_ids):
4517
4548
except StopIteration:
4518
4549
# No more history
4553
class _LazyListJoin(object):
4554
"""An iterable yielding the contents of many lists as one list.
4556
Each iterator made from this will reflect the current contents of the lists
4557
at the time the iterator is made.
4559
This is used by Repository's _make_parents_provider implementation so that
4562
pp = repo._make_parents_provider() # uses a list of fallback repos
4563
pp.add_fallback_repository(other_repo) # appends to that list
4564
result = pp.get_parent_map(...)
4565
# The result will include revs from other_repo
4568
def __init__(self, *list_parts):
4569
self.list_parts = list_parts
4573
for list_part in self.list_parts:
4574
full_list.extend(list_part)
4575
return iter(full_list)