1061
1061
deltas=True, parents=True)
1062
1062
output_knit = knit.KnitVersionedFile('reconcile-texts',
1063
1063
self._pack_collection.transport,
1064
1065
index=knit_index,
1065
1066
access_method=_PackAccess(
1066
1067
{self.new_pack.text_index:self.new_pack.access_tuple()},
1705
1706
self.repo._revision_knit = knit.KnitVersionedFile(
1706
1707
'revisions', self.transport.clone('..'),
1707
1708
self.repo.control_files._file_mode,
1709
create=False, access_mode=self.repo._access_mode(),
1709
1710
index=knit_index, delta=False, factory=knit.KnitPlainFactory(),
1710
1711
access_method=self.repo._pack_collection.revision_index.knit_access)
1711
1712
return self.repo._revision_knit
1723
1724
self.repo._signature_knit = knit.KnitVersionedFile(
1724
1725
'signatures', self.transport.clone('..'),
1725
1726
self.repo.control_files._file_mode,
1727
create=False, access_mode=self.repo._access_mode(),
1727
1728
index=knit_index, delta=False, factory=knit.KnitPlainFactory(),
1728
1729
access_method=self.repo._pack_collection.signature_index.knit_access)
1729
1730
return self.repo._signature_knit
1812
1813
return knit.KnitVersionedFile(
1813
1814
'inventory', self.transport.clone('..'),
1814
1815
self.repo.control_files._file_mode,
1816
create=False, access_mode=self.repo._access_mode(),
1816
1817
index=knit_index, delta=True, factory=knit.KnitPlainFactory(),
1817
1818
access_method=self.repo._pack_collection.inventory_index.knit_access)
1848
1849
def _abort_write_group(self):
1849
1850
self._pack_collection._abort_write_group()
1852
def _access_mode(self):
1853
"""Return 'w' or 'r' for depending on whether a write lock is active.
1855
This method is a helper for the Knit-thunking support objects.
1857
if self.is_write_locked():
1851
1861
def _find_inconsistent_revision_parents(self):
1852
1862
"""Find revisions with incorrectly cached parents.
1918
1928
found_parents[key[0]] = parents
1919
1929
return found_parents
1921
@symbol_versioning.deprecated_method(symbol_versioning.one_four)
1923
def get_revision_graph(self, revision_id=None):
1924
"""Return a dictionary containing the revision graph.
1926
:param revision_id: The revision_id to get a graph from. If None, then
1927
the entire revision graph is returned. This is a deprecated mode of
1928
operation and will be removed in the future.
1929
:return: a dictionary of revision_id->revision_parents_list.
1931
if 'evil' in debug.debug_flags:
1933
"get_revision_graph scales with size of history.")
1934
# special case NULL_REVISION
1935
if revision_id == _mod_revision.NULL_REVISION:
1937
if revision_id is None:
1938
revision_vf = self._get_revision_vf()
1939
return revision_vf.get_graph()
1940
g = self.get_graph()
1941
first = g.get_parent_map([revision_id])
1942
if revision_id not in first:
1943
raise errors.NoSuchRevision(self, revision_id)
1947
NULL_REVISION = _mod_revision.NULL_REVISION
1948
ghosts = set([NULL_REVISION])
1949
for rev_id, parent_ids in g.iter_ancestry([revision_id]):
1950
if parent_ids is None: # This is a ghost
1953
ancestry[rev_id] = parent_ids
1954
for p in parent_ids:
1956
children[p].append(rev_id)
1958
children[p] = [rev_id]
1960
if NULL_REVISION in ancestry:
1961
del ancestry[NULL_REVISION]
1963
# Find all nodes that reference a ghost, and filter the ghosts out
1964
# of their parent lists. To preserve the order of parents, and
1965
# avoid double filtering nodes, we just find all children first,
1967
children_of_ghosts = set()
1968
for ghost in ghosts:
1969
children_of_ghosts.update(children[ghost])
1971
for child in children_of_ghosts:
1972
ancestry[child] = tuple(p for p in ancestry[child]
1976
1931
def has_revisions(self, revision_ids):
1977
1932
"""See Repository.has_revisions()."""
1978
1933
revision_ids = set(revision_ids)
2111
2066
repo_transport,
2112
2067
prefixed=False,
2113
2068
file_mode=control_files._file_mode,
2114
versionedfile_class=knit.make_file_knit,
2069
versionedfile_class=knit.KnitVersionedFile,
2115
2070
versionedfile_kwargs={'factory': knit.KnitPlainFactory()},
2122
2077
file_mode=control_files._file_mode,
2123
2078
prefixed=False,
2125
versionedfile_class=knit.make_file_knit,
2080
versionedfile_class=knit.KnitVersionedFile,
2126
2081
versionedfile_kwargs={'delta': False,
2127
2082
'factory': knit.KnitPlainFactory(),
2131
2086
return KnitRevisionStore(versioned_file_store)
2135
2090
return self._get_versioned_file_store('knits',
2138
versionedfile_class=knit.make_file_knit,
2093
versionedfile_class=knit.KnitVersionedFile,
2139
2094
versionedfile_kwargs={
2140
2095
'create_parent_dir': True,
2141
2096
'delay_create': True,