~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-10-15 16:32:29 UTC
  • mfrom: (1731.1.67 unique-root)
  • Revision ID: pqm@pqm.ubuntu.com-20061015163229-648b1f2ebe692136
New trees have unique root ids

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for bzrdir implementations - tests a bzrdir format."""
18
18
 
19
19
from cStringIO import StringIO
 
20
import errno
20
21
import os
21
22
from stat import S_ISDIR
22
23
import sys
536
537
        repo = dir.create_repository()
537
538
        repo.fetch(tree.branch.repository)
538
539
        self.assertTrue(repo.has_revision('1'))
 
540
        try:
 
541
            self.assertIs(dir.open_branch().last_revision(), None)
 
542
        except errors.NotBranchError:
 
543
            pass
539
544
        target = self.sproutOrSkip(dir, self.get_url('target'))
540
545
        self.assertNotEqual(dir.transport.base, target.transport.base)
 
546
        # testing inventory isn't reasonable for repositories
541
547
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
542
548
                                    ['./.bzr/repository/inventory.knit',
 
549
                                     './.bzr/inventory'
543
550
                                     ])
 
551
        try:
 
552
            # If we happen to have a tree, we'll guarantee everything
 
553
            # except for the tree root is the same.
 
554
            inventory_f = file(dir.transport.base+'inventory', 'rb')
 
555
            self.assertContainsRe(inventory_f.read(), 
 
556
                                  '<inventory file_id="TREE_ROOT[^"]*"'
 
557
                                  ' format="5">\n</inventory>\n')
 
558
            inventory_f.close()
 
559
        except IOError, e:
 
560
            if e.errno != errno.ENOENT:
 
561
                raise
544
562
 
545
563
    def test_sprout_bzrdir_with_repository_to_shared(self):
546
564
        tree = self.make_branch_and_tree('commit_tree')