← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~thumper/launchpad/stack-on-branch-id-alias into lp:launchpad

 

Tim Penhey has proposed merging lp:~thumper/launchpad/stack-on-branch-id-alias into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~thumper/launchpad/stack-on-branch-id-alias/+merge/57621

This branch changes the default stacked on location to use the name independent /+branch-id/%(id)s alias.
-- 
https://code.launchpad.net/~thumper/launchpad/stack-on-branch-id-alias/+merge/57621
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/stack-on-branch-id-alias into lp:launchpad.
=== modified file 'lib/lp/code/xmlrpc/codehosting.py'
--- lib/lp/code/xmlrpc/codehosting.py	2011-04-05 00:50:41 +0000
+++ lib/lp/code/xmlrpc/codehosting.py	2011-04-15 01:47:31 +0000
@@ -320,12 +320,13 @@
         if default_branch is None:
             return
         try:
-            unique_name = default_branch.unique_name
+            branch_id = default_branch.id
         except Unauthorized:
             return
+        path = '/%s/%s' % (BRANCH_ID_ALIAS_PREFIX, branch_id)
         return (
             CONTROL_TRANSPORT,
-            {'default_stack_on': escape('/' + unique_name)},
+            {'default_stack_on': escape(path)},
             trailing_path)
 
     def _translateBranchIdAlias(self, requester, path):

=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
--- lib/lp/code/xmlrpc/tests/test_codehosting.py	2011-04-05 23:53:46 +0000
+++ lib/lp/code/xmlrpc/tests/test_codehosting.py	2011-04-15 01:47:31 +0000
@@ -1067,7 +1067,7 @@
         login(ANONYMOUS)
         self.assertTranslationIsControlDirectory(
             translation,
-            default_stacked_on=branch.unique_name,
+            default_stacked_on="%s/%s" % (BRANCH_ID_ALIAS_PREFIX, branch.id),
             trailing_path='.bzr')
 
     def test_translatePath_control_directory_no_stacked_set(self):
@@ -1093,7 +1093,7 @@
         login(ANONYMOUS)
         self.assertTranslationIsControlDirectory(
             translation,
-            default_stacked_on=branch.unique_name,
+            default_stacked_on="%s/%s" % (BRANCH_ID_ALIAS_PREFIX, branch.id),
             trailing_path='.bzr')
 
     def test_translatePath_control_directory_other_owner(self):
@@ -1105,7 +1105,7 @@
         login(ANONYMOUS)
         self.assertTranslationIsControlDirectory(
             translation,
-            default_stacked_on=branch.unique_name,
+            default_stacked_on="%s/%s" % (BRANCH_ID_ALIAS_PREFIX, branch.id),
             trailing_path='.bzr')
 
     def test_translatePath_control_directory_package_no_focus(self):
@@ -1131,7 +1131,7 @@
         login(ANONYMOUS)
         self.assertTranslationIsControlDirectory(
             translation,
-            default_stacked_on=branch.unique_name,
+            default_stacked_on="%s/%s" % (BRANCH_ID_ALIAS_PREFIX, branch.id),
             trailing_path='.bzr')
 
 

=== modified file 'lib/lp/codehosting/inmemory.py'
--- lib/lp/codehosting/inmemory.py	2011-04-05 01:44:12 +0000
+++ lib/lp/codehosting/inmemory.py	2011-04-15 01:47:31 +0000
@@ -802,9 +802,10 @@
             return
         if not self._canRead(requester, default_branch):
             return
+        path = '/%s/%s' % (BRANCH_ID_ALIAS_PREFIX, default_branch.id)
         return (
             CONTROL_TRANSPORT,
-            {'default_stack_on': escape('/' + default_branch.unique_name)},
+            {'default_stack_on': escape(path)},
             trailing_path)
 
     def _serializeBranch(self, requester_id, branch, trailing_path,