~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-15 02:16:02 UTC
  • mto: This revision was merged to the branch mainline in revision 12881.
  • Revision ID: tim.penhey@canonical.com-20110415021602-zjofj9gi5hyinel2
Update the stacking fixit scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
"""Update stacked_on_location for all Bazaar branches.
9
9
 
10
10
Expects standard input of:
11
 
    '<id> <branch_type> <unique_name> <stacked_on_unique_name>\n'.
 
11
    '<id> <branch_type> <unique_name> <stacked_on_id> <stacked_on_unique_name>\n'.
12
12
 
13
13
Such input can be provided using "get-stacked-on-branches.py".
14
14
 
29
29
 
30
30
from lp.codehosting.vfs import get_rw_server, get_ro_server
31
31
from lp.codehosting.bzrutils import get_branch_stacked_on_url
 
32
from lp.code.interfaces.codehosting import BRANCH_ID_ALIAS_PREFIX
32
33
from lp.services.scripts.base import LaunchpadScript
33
34
 
34
35
 
57
58
            dest="dry_run",
58
59
            help=("Don't change anything on disk, just go through the "
59
60
                  "motions."))
 
61
        self.parser.add_option(
 
62
            '-i', '--id', default=False, action="store_true",
 
63
            dest="stack_on_id",
 
64
            help=("Stack on the +branch-id alias."))
60
65
 
61
66
    def main(self):
62
67
        if self.options.dry_run:
131
136
        """
132
137
        for branch_info in branches:
133
138
            (branch_id, branch_type, unique_name,
134
 
             stacked_on_name) = branch_info
135
 
            stacked_on_location = '/' + stacked_on_name
 
139
             stacked_on_id, stacked_on_name) = branch_info
 
140
            if self.options.stack_on_id:
 
141
                stacked_on_location = '/%s/%s' % (
 
142
                    BRANCH_ID_ALIAS_PREFIX, stacked_on_id)
 
143
            else:
 
144
                stacked_on_location = '/' + stacked_on_name
136
145
            self.updateStackedOn(
137
146
                branch_id, 'lp-internal:///' + unique_name,
138
147
                stacked_on_location)