/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: 2008-02-24 16:42:13 UTC
  • mfrom: (3234 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3235.
  • Revision ID: aaron@aaronbentley.com-20080224164213-eza1lzru5bwuwmmj
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1648
1648
    def _abort_write_group(self):
1649
1649
        # FIXME: just drop the transient index.
1650
1650
        # forget what names there are
1651
 
        self._new_pack.abort()
1652
 
        self._remove_pack_indices(self._new_pack)
1653
 
        self._new_pack = None
 
1651
        if self._new_pack is not None:
 
1652
            self._new_pack.abort()
 
1653
            self._remove_pack_indices(self._new_pack)
 
1654
            self._new_pack = None
1654
1655
        self.repo._text_knit = None
1655
1656
 
1656
1657
    def _commit_write_group(self):
1912
1913
        keys = set(keys)
1913
1914
        if _mod_revision.NULL_REVISION in keys:
1914
1915
            keys.discard(_mod_revision.NULL_REVISION)
1915
 
            found_parents = {_mod_revision.NULL_REVISION:[]}
 
1916
            found_parents = {_mod_revision.NULL_REVISION:()}
1916
1917
        else:
1917
1918
            found_parents = {}
1918
1919
        search_keys = set((revision_id,) for revision_id in keys)
1925
1926
            found_parents[key[0]] = parents
1926
1927
        return found_parents
1927
1928
 
 
1929
    def has_revisions(self, revision_ids):
 
1930
        """See Repository.has_revisions()."""
 
1931
        revision_ids = set(revision_ids)
 
1932
        result = revision_ids.intersection(
 
1933
            set([None, _mod_revision.NULL_REVISION]))
 
1934
        revision_ids.difference_update(result)
 
1935
        index = self._pack_collection.revision_index.combined_index
 
1936
        keys = [(revision_id,) for revision_id in revision_ids]
 
1937
        result.update(node[1][0] for node in index.iter_entries(keys))
 
1938
        return result
 
1939
 
1928
1940
    def _make_parents_provider(self):
1929
1941
        return graph.CachingParentsProvider(self)
1930
1942
 
2043
2055
    # Set this attribute in derived clases to control the _serializer that the
2044
2056
    # repository objects will have passed to their constructor.
2045
2057
    _serializer = None
 
2058
    # External references are not supported in pack repositories yet.
 
2059
    supports_external_lookups = False
2046
2060
 
2047
2061
    def _get_control_store(self, repo_transport, control_files):
2048
2062
        """Return the control store for this repository."""
2237
2251
    def get_format_description(self):
2238
2252
        """See RepositoryFormat.get_format_description()."""
2239
2253
        return "Packs containing knits with rich root support\n"
 
2254
 
 
2255
 
 
2256
class RepositoryFormatPackDevelopment0(RepositoryFormatPack):
 
2257
    """A no-subtrees development repository.
 
2258
 
 
2259
    This format should be retained until the second release after bzr 1.0.
 
2260
 
 
2261
    No changes to the disk behaviour from pack-0.92.
 
2262
    """
 
2263
 
 
2264
    repository_class = KnitPackRepository
 
2265
    _commit_builder_class = PackCommitBuilder
 
2266
    _serializer = xml5.serializer_v5
 
2267
 
 
2268
    def _get_matching_bzrdir(self):
 
2269
        return bzrdir.format_registry.make_bzrdir('development0')
 
2270
 
 
2271
    def _ignore_setting_bzrdir(self, format):
 
2272
        pass
 
2273
 
 
2274
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
 
2275
 
 
2276
    def get_format_string(self):
 
2277
        """See RepositoryFormat.get_format_string()."""
 
2278
        return "Bazaar development format 0 (needs bzr.dev from before 1.3)\n"
 
2279
 
 
2280
    def get_format_description(self):
 
2281
        """See RepositoryFormat.get_format_description()."""
 
2282
        return ("Development repository format, currently the same as "
 
2283
            "pack-0.92\n")
 
2284
 
 
2285
    def check_conversion_target(self, target_format):
 
2286
        pass
 
2287
 
 
2288
 
 
2289
class RepositoryFormatPackDevelopment0Subtree(RepositoryFormatPack):
 
2290
    """A subtrees development repository.
 
2291
 
 
2292
    This format should be retained until the second release after bzr 1.0.
 
2293
 
 
2294
    No changes to the disk behaviour from pack-0.92-subtree.
 
2295
    """
 
2296
 
 
2297
    repository_class = KnitPackRepository
 
2298
    _commit_builder_class = PackRootCommitBuilder
 
2299
    rich_root_data = True
 
2300
    supports_tree_reference = True
 
2301
    _serializer = xml7.serializer_v7
 
2302
 
 
2303
    def _get_matching_bzrdir(self):
 
2304
        return bzrdir.format_registry.make_bzrdir(
 
2305
            'development0-subtree')
 
2306
 
 
2307
    def _ignore_setting_bzrdir(self, format):
 
2308
        pass
 
2309
 
 
2310
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
 
2311
 
 
2312
    def check_conversion_target(self, target_format):
 
2313
        if not target_format.rich_root_data:
 
2314
            raise errors.BadConversionTarget(
 
2315
                'Does not support rich root data.', target_format)
 
2316
        if not getattr(target_format, 'supports_tree_reference', False):
 
2317
            raise errors.BadConversionTarget(
 
2318
                'Does not support nested trees', target_format)
 
2319
            
 
2320
    def get_format_string(self):
 
2321
        """See RepositoryFormat.get_format_string()."""
 
2322
        return ("Bazaar development format 0 with subtree support "
 
2323
            "(needs bzr.dev from before 1.3)\n")
 
2324
 
 
2325
    def get_format_description(self):
 
2326
        """See RepositoryFormat.get_format_description()."""
 
2327
        return ("Development repository format, currently the same as "
 
2328
            "pack-0.92-subtree\n")
 
2329
 
 
2330