~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/codehosting/branchdistro.py

  • Committer: Danilo Segan
  • Date: 2011-04-22 14:02:29 UTC
  • mto: This revision was merged to the branch mainline in revision 12910.
  • Revision ID: danilo@canonical.com-20110422140229-zhq4d4c2k8jpglhf
Ignore hidden files when building combined JS file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    NotBranchError,
24
24
    NotStacked,
25
25
    )
26
 
from bzrlib.revision import NULL_REVISION
27
26
import transaction
28
27
from zope.component import getUtility
29
28
 
 
29
from canonical.config import config
 
30
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
 
31
from canonical.launchpad.interfaces.lpstorm import IMasterStore
30
32
from lp.code.enums import (
31
33
    BranchLifecycleStatus,
32
34
    BranchType,
41
43
from lp.codehosting.vfs import branch_id_to_path
42
44
from lp.registry.interfaces.distribution import IDistributionSet
43
45
from lp.registry.interfaces.pocket import PackagePublishingPocket
44
 
from lp.services.config import config
45
 
from lp.services.database.lpstorm import IMasterStore
46
46
 
47
47
 
48
48
def switch_branches(prefix, scheme, old_db_branch, new_db_branch):
346
346
            old_db_branch.registrant)
347
347
        new_db_branch.sourcepackage.setBranch(
348
348
            PackagePublishingPocket.RELEASE, new_db_branch,
349
 
            new_db_branch.owner)
 
349
            getUtility(ILaunchpadCelebrities).ubuntu_branches.teamowner)
350
350
        old_db_branch.lifecycle_status = BranchLifecycleStatus.MATURE
351
351
        # switch_branches *moves* the data to locations dependent on the
352
352
        # new_branch's id, so if the transaction was rolled back we wouldn't
356
356
        switch_branches(
357
357
            config.codehosting.mirrored_branches_root,
358
358
            'lp-internal', old_db_branch, new_db_branch)
359
 
        # Directly copy the branch revisions from the old branch to the new
360
 
        # branch.
 
359
        # Directly copy the branch revisions from the old branch to the new branch.
361
360
        store = IMasterStore(BranchRevision)
362
361
        store.execute(
363
362
            """
372
371
        tip_revision = old_db_branch.getTipRevision()
373
372
        new_db_branch.updateScannedDetails(
374
373
            tip_revision, old_db_branch.revision_count)
375
 
        tip_revision_id = (
376
 
            tip_revision.revision_id if tip_revision is not None else
377
 
            NULL_REVISION)
378
374
        new_db_branch.branchChanged(
379
 
            '', tip_revision_id,
 
375
            '', tip_revision.revision_id,
380
376
            old_db_branch.control_format,
381
377
            old_db_branch.branch_format,
382
378
            old_db_branch.repository_format)