~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/update-stacked-on.py

  • Committer: Tim Penhey
  • Date: 2011-04-18 01:44:53 UTC
  • mto: This revision was merged to the branch mainline in revision 12881.
  • Revision ID: tim.penhey@canonical.com-20110418014453-69buhvfwsek212cb
Use the branch_id_alias function, which requires an object with an id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
__metaclass__ = type
22
22
 
23
23
import _pythonpath
 
24
from collections import namedtuple
24
25
import sys
25
26
 
26
27
from bzrlib.bzrdir import BzrDir
29
30
 
30
31
from lp.codehosting.vfs import get_rw_server, get_ro_server
31
32
from lp.codehosting.bzrutils import get_branch_stacked_on_url
32
 
from lp.code.interfaces.codehosting import BRANCH_ID_ALIAS_PREFIX
 
33
from lp.code.interfaces.codehosting import branch_id_alias
33
34
from lp.services.scripts.base import LaunchpadScript
34
35
 
35
36
 
 
37
FakeBranch = namedtuple('FakeBranch', 'id')
 
38
 
 
39
 
36
40
def set_branch_stacked_on_url(bzrdir, stacked_on_url):
37
41
    """Set the stacked_on_location for the branch at 'bzrdir'.
38
42
 
138
142
            (branch_id, branch_type, unique_name,
139
143
             stacked_on_id, stacked_on_name) = branch_info
140
144
            if self.options.stack_on_id:
141
 
                stacked_on_location = '/%s/%s' % (
142
 
                    BRANCH_ID_ALIAS_PREFIX, stacked_on_id)
 
145
                branch = FakeBranch(stacked_on_id)
 
146
                stacked_on_location = branch_id_alias(branch)
143
147
            else:
144
148
                stacked_on_location = '/' + stacked_on_name
145
149
            self.updateStackedOn(