~bjornt/launchpad/revert-production-devel

« back to all changes in this revision

Viewing changes to lib/lp/code/model/tests/test_branchjob.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2010-03-08 22:23:39 UTC
  • mfrom: (7675.2891.5 bug-532290)
  • Revision ID: launchpad@pqm.canonical.com-20100308222339-ss9pw22d0hi3lvaf
[release-critical=flacoste][r=salgado][ui=None][bug=532290] Upgrade
        branches will remove the backup.bzr dir now

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from bzrlib.bzrdir import BzrDirMetaFormat1
18
18
from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack6
19
19
from bzrlib.revision import NULL_REVISION
 
20
from bzrlib.transport import get_transport
20
21
from canonical.testing import DatabaseFunctionalLayer, LaunchpadZopelessLayer
21
22
from sqlobject import SQLObjectNotFound
22
23
import transaction
274
275
            repository_format=RepositoryFormat.BZR_CHK_2A)
275
276
        self.assertRaises(AssertionError, BranchUpgradeJob.create, branch)
276
277
 
 
278
    def test_existing_bzr_backup(self):
 
279
        # If the target branch already has a backup.bzr dir, the upgrade copy
 
280
        # should remove it.
 
281
        self.useBzrBranches()
 
282
        db_branch, tree = self.create_branch_and_tree(
 
283
            hosted=True, format='knit')
 
284
        db_branch.branch_format = BranchFormat.BZR_BRANCH_5
 
285
        db_branch.repository_format = RepositoryFormat.BZR_KNIT_1
 
286
 
 
287
        # Add a fake backup.bzr dir
 
288
        source_branch_transport = get_transport(db_branch.getPullURL())
 
289
        source_branch_transport.mkdir('backup.bzr')
 
290
 
 
291
        job = BranchUpgradeJob.create(db_branch)
 
292
        job.run()
 
293
 
 
294
        new_branch = Branch.open(tree.branch.base)
 
295
        self.assertEqual(
 
296
            new_branch.repository._format.get_format_string(),
 
297
            'Bazaar repository format 2a (needs bzr 1.16 or later)\n')
 
298
 
277
299
 
278
300
class TestRevisionMailJob(TestCaseWithFactory):
279
301
    """Tests for BranchDiffJob."""