← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/branch-rewrite-http into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/branch-rewrite-http into lp:launchpad.

Commit message:
Ensure that branch-rewrite always forwards private branches through to loggerhead, even on port 80.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/branch-rewrite-http/+merge/221490

Ensure that branch-rewrite always forwards private branches through to loggerhead, even on port 80.
-- 
https://code.launchpad.net/~wgrant/launchpad/branch-rewrite-http/+merge/221490
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/branch-rewrite-http into lp:launchpad.
=== modified file 'lib/lp/codehosting/tests/test_rewrite.py'
--- lib/lp/codehosting/tests/test_rewrite.py	2012-09-18 19:41:02 +0000
+++ lib/lp/codehosting/tests/test_rewrite.py	2014-05-30 07:39:19 +0000
@@ -257,19 +257,26 @@
     layer = DatabaseFunctionalLayer
 
     def test_script(self):
-        branches = [
+        # The .bzr subdirectory of all public branch types gets mapped
+        # to the internal by-ID branch store, but everything else, and
+        # all private branch requests, go through to loggerhead.
+        bs = [
             self.factory.makeProductBranch(),
             self.factory.makePersonalBranch(),
             self.factory.makePackageBranch()]
-        input_lines = [
-            "/%s/.bzr/README" % branch.unique_name for branch in branches] + [
-            "/%s/changes" % branch.unique_name for branch in branches]
-        expected_lines = [
-            'file:///var/tmp/bazaar.launchpad.dev/mirrors/%s/.bzr/README'
-            % branch_id_to_path(branch.id)
-            for branch in branches] + [
-            'http://localhost:8080/%s/changes' % branch.unique_name
-            for branch in branches]
+        privbranch = removeSecurityProxy(
+            self.factory.makeProductBranch(
+                information_type=InformationType.USERDATA))
+        allbs = bs + [privbranch]
+        input_lines = (
+            ["/%s/.bzr/README" % branch.unique_name for branch in allbs]
+            + ["/%s/changes" % branch.unique_name for branch in allbs])
+        expected_lines = (
+            ['file:///var/tmp/bazaar.launchpad.dev/mirrors/%s/.bzr/README'
+             % branch_id_to_path(branch.id) for branch in bs]
+            + ['http://localhost:8080/%s/.bzr/README' % privbranch.unique_name]
+            + ['http://localhost:8080/%s/changes' % b.unique_name for b in bs]
+            + ['http://localhost:8080/%s/changes' % privbranch.unique_name])
         transaction.commit()
         script_file = os.path.join(
             config.root, 'scripts', 'branch-rewrite.py')
@@ -287,7 +294,7 @@
         # connected to the database, or edit a branch name that has already
         # been rewritten, both are rewritten successfully.
         new_branch = self.factory.makeAnyBranch()
-        edited_branch = removeSecurityProxy(branches[0])
+        edited_branch = removeSecurityProxy(bs[0])
         edited_branch.name = self.factory.getUniqueString()
         transaction.commit()
 

=== modified file 'scripts/branch-rewrite.py'
--- scripts/branch-rewrite.py	2013-01-07 02:40:55 +0000
+++ scripts/branch-rewrite.py	2014-05-30 07:39:19 +0000
@@ -77,4 +77,4 @@
 
 if __name__ == '__main__':
     BranchRewriteScript("branch-rewrite", dbuser='branch-rewrite').run(
-        isolation='autocommit')
+        isolation='autocommit', use_web_security=True)


Follow ups