~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-07 10:45:44 UTC
  • mfrom: (2321.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070307104544-59e3e6358e4bdb29
(robertc) Merge dirstate and subtrees. (Robert Collins, Martin Pool, Aaaron Bentley, John A Meinel, James Westby)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
from bzrlib import (
 
18
    bzrdir,
18
19
    errors,
19
20
    graph,
20
21
    knit,
23
24
    osutils,
24
25
    transactions,
25
26
    xml5,
26
 
    xml6,
 
27
    xml7,
27
28
    )
28
29
 
29
30
from bzrlib.decorators import needs_read_lock, needs_write_lock
203
204
        return self._get_revision_vf().get_parents(revision_id)
204
205
 
205
206
 
206
 
class KnitRepository2(KnitRepository):
207
 
    """"""
 
207
class KnitRepository3(KnitRepository):
 
208
 
208
209
    def __init__(self, _format, a_bzrdir, control_files, _revision_store,
209
210
                 control_store, text_store):
210
211
        KnitRepository.__init__(self, _format, a_bzrdir, control_files,
211
212
                              _revision_store, control_store, text_store)
212
 
        self._serializer = xml6.serializer_v6
 
213
        self._serializer = xml7.serializer_v7
213
214
 
214
215
    def deserialise_inventory(self, revision_id, xml):
215
216
        """Transform the xml into an inventory object. 
374
375
    This format was introduced in bzr 0.8.
375
376
    """
376
377
 
 
378
    def __ne__(self, other):
 
379
        return self.__class__ is not other.__class__
 
380
 
377
381
    def get_format_string(self):
378
382
        """See RepositoryFormat.get_format_string()."""
379
383
        return "Bazaar-NG Knit Repository Format 1"
386
390
        pass
387
391
 
388
392
 
389
 
class RepositoryFormatKnit2(RepositoryFormatKnit):
 
393
class RepositoryFormatKnit3(RepositoryFormatKnit):
390
394
    """Bzr repository knit format 2.
391
395
 
392
 
    THIS FORMAT IS EXPERIMENTAL
393
396
    This repository format has:
394
397
     - knits for file texts and inventory
395
398
     - hash subdirectory based stores.
399
402
     - an optional 'shared-storage' flag
400
403
     - an optional 'no-working-trees' flag
401
404
     - a LockDir lock
402
 
     - Support for recording full info about the tree root
403
 
 
 
405
     - support for recording full info about the tree root
 
406
     - support for recording tree-references
404
407
    """
405
 
    
 
408
 
 
409
    repository_class = KnitRepository3
406
410
    rich_root_data = True
407
 
 
408
 
    def get_format_string(self):
409
 
        """See RepositoryFormat.get_format_string()."""
410
 
        return "Bazaar Knit Repository Format 2\n"
411
 
 
412
 
    def get_format_description(self):
413
 
        """See RepositoryFormat.get_format_description()."""
414
 
        return "Knit repository format 2"
 
411
    support_tree_reference = True
 
412
 
 
413
    def _get_matching_bzrdir(self):
 
414
        return bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
 
415
 
 
416
    def _ignore_setting_bzrdir(self, format):
 
417
        pass
 
418
 
 
419
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
415
420
 
416
421
    def check_conversion_target(self, target_format):
417
422
        if not target_format.rich_root_data:
418
423
            raise errors.BadConversionTarget(
419
424
                'Does not support rich root data.', target_format)
 
425
        if not getattr(target_format, 'support_tree_reference', False):
 
426
            raise errors.BadConversionTarget(
 
427
                'Does not support nested trees', target_format)
 
428
            
 
429
    def get_format_string(self):
 
430
        """See RepositoryFormat.get_format_string()."""
 
431
        return "Bazaar Knit Repository Format 3 (bzr 0.15)\n"
 
432
 
 
433
    def get_format_description(self):
 
434
        """See RepositoryFormat.get_format_description()."""
 
435
        return "Knit repository format 3"
420
436
 
421
437
    def open(self, a_bzrdir, _found=False, _override_transport=None):
422
438
        """See RepositoryFormat.open().
437
453
        text_store = self._get_text_store(repo_transport, control_files)
438
454
        control_store = self._get_control_store(repo_transport, control_files)
439
455
        _revision_store = self._get_revision_store(repo_transport, control_files)
440
 
        return KnitRepository2(_format=self,
441
 
                               a_bzrdir=a_bzrdir,
442
 
                               control_files=control_files,
443
 
                               _revision_store=_revision_store,
444
 
                               control_store=control_store,
445
 
                               text_store=text_store)
 
456
        return self.repository_class(_format=self,
 
457
                                     a_bzrdir=a_bzrdir,
 
458
                                     control_files=control_files,
 
459
                                     _revision_store=_revision_store,
 
460
                                     control_store=control_store,
 
461
                                     text_store=text_store)