예제 #1
0
 def finish_upgrade(self):
     """Create an upgraded version of self.branch in self.target_dir."""
     with read_locked(self.bzr_branch):
         repository = self.get_bzrdir().open_repository()
         self.add_upgraded_branch()
         repository.fetch(self.bzr_branch.repository)
     self.swap_in()
     branch_changed(self.branch)
예제 #2
0
 def finish_upgrade(self):
     """Create an upgraded version of self.branch in self.target_dir."""
     with read_locked(self.bzr_branch):
         repository = self.get_bzrdir().open_repository()
         self.add_upgraded_branch()
         repository.fetch(self.bzr_branch.repository)
     self.swap_in()
     branch_changed(self.branch)
예제 #3
0
 def test_start_all_upgrades(self):
     """Start all upgrades starts upgrading all branches."""
     upgrader = self.prepare()
     branch_changed(upgrader.branch, upgrader.bzr_branch)
     Upgrader.start_all_upgrades(upgrader.target_dir, upgrader.logger)
     upgraded = upgrader.get_bzrdir().open_repository()
     self.assertIs(RepositoryFormat2a, upgraded._format.__class__)
     self.assertEqual('foo',
                      upgraded.get_revision('prepare-commit').message)
예제 #4
0
 def prepare(self):
     """Prepare to run the script."""
     self.useBzrBranches(direct_database=True)
     branch, tree = self.create_branch_and_tree(format='pack-0.92')
     tree.commit('foo', committer='*****@*****.**')
     with person_logged_in(branch.owner):
         branch_changed(branch, tree.branch)
     target = self.useFixture(TempDir(
         rootdir=dirname(config.codehosting.mirrored_branches_root))).path
     upgrader = Upgrader(branch, target, logging.getLogger(), tree.branch)
     return upgrader
예제 #5
0
 def test_finish_all_upgrades(self):
     """Finish all upgrades behaves as expected."""
     upgrader = self.prepare()
     branch_changed(upgrader.branch, upgrader.bzr_branch)
     upgrader.start_upgrade()
     Upgrader.finish_all_upgrades(upgrader.target_dir, upgrader.logger)
     upgraded = upgrader.branch.getBzrBranch()
     self.assertIs(RepositoryFormat2a,
                   upgraded.repository._format.__class__)
     self.assertEqual(
         'foo',
         upgraded.repository.get_revision('prepare-commit').message)