/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Aaron Bentley
  • Date: 2007-12-20 15:21:48 UTC
  • mfrom: (3134 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3135.
  • Revision ID: abentley@panoramicfeedback.com-20071220152148-rn32up72gm3gankf
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib import (
25
25
        debug,
 
26
        graph,
26
27
        pack,
27
28
        ui,
28
29
        )
29
 
from bzrlib.graph import Graph
30
30
from bzrlib.index import (
31
31
    GraphIndex,
32
32
    GraphIndexBuilder,
48
48
    lockable_files,
49
49
    lockdir,
50
50
    osutils,
 
51
    symbol_versioning,
51
52
    transactions,
52
53
    xml5,
53
54
    xml6,
81
82
        CommitBuilder.__init__(self, repository, parents, config,
82
83
            timestamp=timestamp, timezone=timezone, committer=committer,
83
84
            revprops=revprops, revision_id=revision_id)
84
 
        self._file_graph = Graph(
 
85
        self._file_graph = graph.Graph(
85
86
            repository._pack_collection.text_index.combined_index)
86
87
 
87
88
    def _add_text_to_weave(self, file_id, new_lines, parents, nostore_sha):
107
108
        CommitBuilder.__init__(self, repository, parents, config,
108
109
            timestamp=timestamp, timezone=timezone, committer=committer,
109
110
            revprops=revprops, revision_id=revision_id)
110
 
        self._file_graph = Graph(
 
111
        self._file_graph = graph.Graph(
111
112
            repository._pack_collection.text_index.combined_index)
112
113
 
113
114
    def _add_text_to_weave(self, file_id, new_lines, parents, nostore_sha):
1894
1895
            pb.finished()
1895
1896
        return result
1896
1897
 
 
1898
    @symbol_versioning.deprecated_method(symbol_versioning.one_one)
1897
1899
    def get_parents(self, revision_ids):
1898
 
        """See StackedParentsProvider.get_parents.
1899
 
        
 
1900
        """See graph._StackedParentsProvider.get_parents."""
 
1901
        parent_map = self.get_parent_map(revision_ids)
 
1902
        return [parent_map.get(r, None) for r in revision_ids]
 
1903
 
 
1904
    def get_parent_map(self, keys):
 
1905
        """See graph._StackedParentsProvider.get_parent_map
 
1906
 
1900
1907
        This implementation accesses the combined revision index to provide
1901
1908
        answers.
1902
1909
        """
1903
1910
        self._pack_collection.ensure_loaded()
1904
1911
        index = self._pack_collection.revision_index.combined_index
1905
 
        search_keys = set()
1906
 
        for revision_id in revision_ids:
1907
 
            if revision_id != _mod_revision.NULL_REVISION:
1908
 
                search_keys.add((revision_id,))
1909
 
        found_parents = {_mod_revision.NULL_REVISION:[]}
 
1912
        keys = set(keys)
 
1913
        if _mod_revision.NULL_REVISION in keys:
 
1914
            keys.discard(_mod_revision.NULL_REVISION)
 
1915
            found_parents = {_mod_revision.NULL_REVISION:[]}
 
1916
        else:
 
1917
            found_parents = {}
 
1918
        search_keys = set((revision_id,) for revision_id in keys)
1910
1919
        for index, key, value, refs in index.iter_entries(search_keys):
1911
1920
            parents = refs[0]
1912
1921
            if not parents:
1914
1923
            else:
1915
1924
                parents = tuple(parent[0] for parent in parents)
1916
1925
            found_parents[key[0]] = parents
1917
 
        result = []
1918
 
        for revision_id in revision_ids:
1919
 
            try:
1920
 
                result.append(found_parents[revision_id])
1921
 
            except KeyError:
1922
 
                result.append(None)
1923
 
        return result
 
1926
        return found_parents
1924
1927
 
1925
1928
    def _make_parents_provider(self):
1926
 
        return self
 
1929
        return graph.CachingParentsProvider(self)
1927
1930
 
1928
1931
    def _refresh_data(self):
1929
1932
        if self._write_lock_count == 1 or (
2126
2129
 
2127
2130
 
2128
2131
class RepositoryFormatKnitPack1(RepositoryFormatPack):
2129
 
    """A no-subtrees parameterised Pack repository.
 
2132
    """A no-subtrees parameterized Pack repository.
2130
2133
 
2131
2134
    This format was introduced in 0.92.
2132
2135
    """
2156
2159
 
2157
2160
 
2158
2161
class RepositoryFormatKnitPack3(RepositoryFormatPack):
2159
 
    """A subtrees parameterised Pack repository.
 
2162
    """A subtrees parameterized Pack repository.
2160
2163
 
2161
2164
    This repository format uses the xml7 serializer to get:
2162
2165
     - support for recording full info about the tree root
2198
2201
 
2199
2202
 
2200
2203
class RepositoryFormatKnitPack4(RepositoryFormatPack):
2201
 
    """A rich-root, no subtrees parameterised Pack repository.
 
2204
    """A rich-root, no subtrees parameterized Pack repository.
2202
2205
 
2203
2206
    This repository format uses the xml6 serializer to get:
2204
2207
     - support for recording full info about the tree root