launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03333
[Merge] lp:~thumper/launchpad/update-existing-stacked-branches into lp:launchpad
Tim Penhey has proposed merging lp:~thumper/launchpad/update-existing-stacked-branches into lp:launchpad with lp:~thumper/launchpad/stack-on-branch-id-alias as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~thumper/launchpad/update-existing-stacked-branches/+merge/57803
Update the scripts that the LOSAs use to update the stacked on location.
Add a --id flag to the update script to determine whether to stack on the +branch-id alias or the unique name.
--
https://code.launchpad.net/~thumper/launchpad/update-existing-stacked-branches/+merge/57803
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/update-existing-stacked-branches into lp:launchpad.
=== modified file 'scripts/get-stacked-on-branches.py'
--- scripts/get-stacked-on-branches.py 2010-04-27 19:48:39 +0000
+++ scripts/get-stacked-on-branches.py 2011-04-15 02:25:54 +0000
@@ -11,11 +11,12 @@
Prints the stacked branches in Launchpad to standard output in the following
format:
- <id> <branch_type> <unique_name> <stacked_on_unique_name>
+ <id> <branch_type> <unique_name> <stacked_on_id> <stacked_on_unique_name>
<id> is the database ID of the Branch as a decimal integer.
<branch_type> is the name of the BranchType, e.g. 'HOSTED'.
<unique_name> is the unique_name property of the Branch.
+<stacked_on_id> is the database ID of the Branch.stacked_on branch
<stacked_on_unique_name> is the unique_name property of the Branch.stacked_on
branch.
@@ -49,9 +50,10 @@
"""
execute_zcml_for_scripts()
for db_branch in get_stacked_branches():
- print '%s %s %s %s' % (
+ stacked_on = db_branch.stacked_on
+ print '%s %s %s %s %s' % (
db_branch.id, db_branch.branch_type.name, db_branch.unique_name,
- db_branch.stacked_on.unique_name)
+ stacked_on.id, stacked_on.unique_name)
if __name__ == '__main__':
=== modified file 'scripts/update-stacked-on.py'
--- scripts/update-stacked-on.py 2010-05-19 18:07:56 +0000
+++ scripts/update-stacked-on.py 2011-04-15 02:25:54 +0000
@@ -8,7 +8,7 @@
"""Update stacked_on_location for all Bazaar branches.
Expects standard input of:
- '<id> <branch_type> <unique_name> <stacked_on_unique_name>\n'.
+ '<id> <branch_type> <unique_name> <stacked_on_id> <stacked_on_unique_name>\n'.
Such input can be provided using "get-stacked-on-branches.py".
@@ -29,6 +29,7 @@
from lp.codehosting.vfs import get_rw_server, get_ro_server
from lp.codehosting.bzrutils import get_branch_stacked_on_url
+from lp.code.interfaces.codehosting import BRANCH_ID_ALIAS_PREFIX
from lp.services.scripts.base import LaunchpadScript
@@ -57,6 +58,10 @@
dest="dry_run",
help=("Don't change anything on disk, just go through the "
"motions."))
+ self.parser.add_option(
+ '-i', '--id', default=False, action="store_true",
+ dest="stack_on_id",
+ help=("Stack on the +branch-id alias."))
def main(self):
if self.options.dry_run:
@@ -131,8 +136,12 @@
"""
for branch_info in branches:
(branch_id, branch_type, unique_name,
- stacked_on_name) = branch_info
- stacked_on_location = '/' + stacked_on_name
+ stacked_on_id, stacked_on_name) = branch_info
+ if self.options.stack_on_id:
+ stacked_on_location = '/%s/%s' % (
+ BRANCH_ID_ALIAS_PREFIX, stacked_on_id)
+ else:
+ stacked_on_location = '/' + stacked_on_name
self.updateStackedOn(
branch_id, 'lp-internal:///' + unique_name,
stacked_on_location)