643
643
self.pb.update("Copying inventory texts", 2)
644
644
total_items, readv_group_iter = self._least_readv_node_readv(inv_nodes)
645
# Only grab the output lines if we will be processing them
646
output_lines = bool(self.revision_ids)
645
647
inv_lines = self._copy_nodes_graph(inventory_index_map,
646
648
self.new_pack._writer, self.new_pack.inventory_index,
647
readv_group_iter, total_items, output_lines=True)
649
readv_group_iter, total_items, output_lines=output_lines)
648
650
if self.revision_ids:
649
651
self._process_inventory_lines(inv_lines)
1926
1928
found_parents[key[0]] = parents
1927
1929
return found_parents
1931
@symbol_versioning.deprecated_method(symbol_versioning.one_four)
1933
def get_revision_graph(self, revision_id=None):
1934
"""Return a dictionary containing the revision graph.
1936
:param revision_id: The revision_id to get a graph from. If None, then
1937
the entire revision graph is returned. This is a deprecated mode of
1938
operation and will be removed in the future.
1939
:return: a dictionary of revision_id->revision_parents_list.
1941
if 'evil' in debug.debug_flags:
1943
"get_revision_graph scales with size of history.")
1944
# special case NULL_REVISION
1945
if revision_id == _mod_revision.NULL_REVISION:
1947
if revision_id is None:
1948
revision_vf = self._get_revision_vf()
1949
return revision_vf.get_graph()
1950
g = self.get_graph()
1951
first = g.get_parent_map([revision_id])
1952
if revision_id not in first:
1953
raise errors.NoSuchRevision(self, revision_id)
1957
NULL_REVISION = _mod_revision.NULL_REVISION
1958
ghosts = set([NULL_REVISION])
1959
for rev_id, parent_ids in g.iter_ancestry([revision_id]):
1960
if parent_ids is None: # This is a ghost
1963
ancestry[rev_id] = parent_ids
1964
for p in parent_ids:
1966
children[p].append(rev_id)
1968
children[p] = [rev_id]
1970
if NULL_REVISION in ancestry:
1971
del ancestry[NULL_REVISION]
1973
# Find all nodes that reference a ghost, and filter the ghosts out
1974
# of their parent lists. To preserve the order of parents, and
1975
# avoid double filtering nodes, we just find all children first,
1977
children_of_ghosts = set()
1978
for ghost in ghosts:
1979
children_of_ghosts.update(children[ghost])
1981
for child in children_of_ghosts:
1982
ancestry[child] = tuple(p for p in ancestry[child]
1929
1986
def has_revisions(self, revision_ids):
1930
1987
"""See Repository.has_revisions()."""
1931
1988
revision_ids = set(revision_ids)