Exemplo n.º 1
0
    def test_lock_file(self):
        # old format branches use a special lock file on sftp.
        b = self.make_branch('', format=BzrDirFormat6())
        b = branch.Branch.open(self.get_url())
        self.assertPathExists('.bzr/')
        self.assertPathExists('.bzr/branch-format')
        self.assertPathExists('.bzr/branch-lock')

        self.assertPathDoesNotExist('.bzr/branch-lock.write-lock')
        b.lock_write()
        self.assertPathExists('.bzr/branch-lock.write-lock')
        b.unlock()
        self.assertPathDoesNotExist('.bzr/branch-lock.write-lock')
Exemplo n.º 2
0
 def test_same_lockfiles_between_tree_repo_branch(self):
     # this checks that only a single lockfiles instance is created
     # for format 6 objects
     dir = BzrDirFormat6().initialize(self.get_url())
     def check_dir_components_use_same_lock(dir):
         ctrl_1 = dir.open_repository().control_files
         ctrl_2 = dir.open_branch().control_files
         ctrl_3 = dir.open_workingtree()._control_files
         self.assertTrue(ctrl_1 is ctrl_2)
         self.assertTrue(ctrl_2 is ctrl_3)
     check_dir_components_use_same_lock(dir)
     # and if we open it normally.
     dir = controldir.ControlDir.open(self.get_url())
     check_dir_components_use_same_lock(dir)
Exemplo n.º 3
0
 def test_upgrade_v6_to_meta_no_workingtree(self):
     # Some format6 branches do not have checkout files. Upgrading
     # such a branch to metadir must not setup a working tree.
     self.build_tree_contents(_upgrade1_template)
     upgrade.upgrade('.', BzrDirFormat6())
     t = self.get_transport('.')
     t.delete_multi(['.bzr/pending-merges', '.bzr/inventory'])
     self.assertFalse(t.has('.bzr/stat-cache'))
     t.delete_tree('backup.bzr.~1~')
     # At this point, we have a format6 branch without checkout files.
     upgrade.upgrade('.', bzrdir.BzrDirMetaFormat1())
     # The upgrade should not have set up a working tree.
     control = controldir.ControlDir.open('.')
     self.assertFalse(control.has_workingtree())
     # We have covered the scope of this test, we may as well check that
     # upgrade has not eaten our data, even if it's a bit redundant with
     # other tests.
     self.assertIsInstance(control._format, bzrdir.BzrDirMetaFormat1)
     b = control.open_branch()
     self.addCleanup(b.lock_read().unlock)
     self.assertEquals(b._revision_history(),
        ['[email protected]',
         '[email protected]'])
Exemplo n.º 4
0
 def test_supports_external_lookups(self):
     control = BzrDirFormat6().initialize(self.get_url())
     repo = RepositoryFormat6().initialize(control)
     self.assertFalse(repo._format.supports_external_lookups)
Exemplo n.º 5
0
 def test_no_ancestry_weave(self):
     control = BzrDirFormat6().initialize(self.get_url())
     repo = RepositoryFormat6().initialize(control)
     # We no longer need to create the ancestry.weave file
     # since it is *never* used.
     self.assertRaises(NoSuchFile, control.transport.get, 'ancestry.weave')
Exemplo n.º 6
0
 def test_attribute__fetch_reconcile(self):
     """Weave repositories need a reconcile after fetch."""
     control = BzrDirFormat6().initialize(self.get_url())
     repo = RepositoryFormat6().initialize(control)
     self.assertEqual(True, repo._format._fetch_reconcile)
Exemplo n.º 7
0
 def test_attribute__fetch_uses_deltas(self):
     """Weaves do not reuse deltas."""
     control = BzrDirFormat6().initialize(self.get_url())
     repo = RepositoryFormat6().initialize(control)
     self.assertEqual(False, repo._format._fetch_uses_deltas)
Exemplo n.º 8
0
 def test_attribute__fetch_order(self):
     """Weaves need topological data insertion."""
     control = BzrDirFormat6().initialize(self.get_url())
     repo = RepositoryFormat6().initialize(control)
     self.assertEqual('topological', repo._format._fetch_order)
 def testMirrorWeaveAsWeave(self):
     # Create a source branch in weave format, and check that the mirror is
     # in weave format.
     self._testMirrorWithFormats(RepositoryFormat6(), BzrDirFormat6())
Exemplo n.º 10
0
 def test_supports_bzrdir_6(self):
     url = self.get_url()
     bdir = BzrDirFormat6().initialize(url)
     bdir.create_repository()
     BzrBranchFormat4().initialize(bdir)
Exemplo n.º 11
0
    def test_info_locking_oslocks(self):
        if sys.platform == "win32":
            self.skip("don't use oslocks on win32 in unix manner")
        # This test tests old (all-in-one, OS lock using) behaviour which
        # simply cannot work on windows (and is indeed why we changed our
        # design. As such, don't try to remove the thisFailsStrictLockCheck
        # call here.
        self.thisFailsStrictLockCheck()

        tree = self.make_branch_and_tree('branch',
                                         format=BzrDirFormat6())

        # Test all permutations of locking the working tree, branch and repository
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
        # implemented by raising NotImplementedError and get_physical_lock_status()
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
        # W B R

        # U U U
        out, err = self.run_bzr('info -v branch')
        self.assertEqualDiff(
"""Standalone tree (format: weave)
Location:
  branch root: %s

Format:
       control: All-in-one format 6
  working tree: Working tree format 2
        branch: Branch format 4
    repository: %s

In the working tree:
         0 unchanged
         0 modified
         0 added
         0 removed
         0 renamed
         0 unknown
         0 ignored
         0 versioned subdirectories

Branch history:
         0 revisions

Repository:
         0 revisions
""" % ('branch', tree.branch.repository._format.get_format_description(),
       ), out)
        self.assertEqual('', err)
        # L L L
        tree.lock_write()
        out, err = self.run_bzr('info -v branch')
        self.assertEqualDiff(
"""Standalone tree (format: weave)
Location:
  branch root: %s

Format:
       control: All-in-one format 6
  working tree: Working tree format 2
        branch: Branch format 4
    repository: %s

In the working tree:
         0 unchanged
         0 modified
         0 added
         0 removed
         0 renamed
         0 unknown
         0 ignored
         0 versioned subdirectories

Branch history:
         0 revisions

Repository:
         0 revisions
""" % ('branch', tree.branch.repository._format.get_format_description(),
       ), out)
        self.assertEqual('', err)
        tree.unlock()
Exemplo n.º 12
0
 def test_needs_conversion(self):
     # format 6 dirs need an conversion if they are not the default.
     dir = BzrDirFormat6().initialize(self.get_url())
     self.assertTrue(dir.needs_format_conversion(
         bzrdir.BzrDirFormat.get_default_format()))
Exemplo n.º 13
0
 def test_can_convert(self):
     # format 6 dirs are convertable
     dir = BzrDirFormat6().initialize(self.get_url())
     self.assertTrue(dir.can_convert_format())
Exemplo n.º 14
0
 def __init__(self):
     super(WorkingTreeFormat2, self).__init__()
     from bzrlib.plugins.weave_fmt.bzrdir import BzrDirFormat6
     self._matchingbzrdir = BzrDirFormat6()
Exemplo n.º 15
0
 def create_format2_tree(self, url):
     return self.make_branch_and_tree(
         url, format=BzrDirFormat6())