← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/subscribe-branch-owner into lp:launchpad/devel

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/subscribe-branch-owner into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #498637 default subscription is branch creator not branch owner
  https://bugs.launchpad.net/bugs/498637


= Summary =
Fix bug #498637: default subscription is branch creator not branch owner

== Proposed fix ==
Do the initial subscription to the branch owner.

== Pre-implementation notes ==
None.

== Implementation details ==
Nothing interesting.

== Tests ==
bin/test -t  test_createBranch_subscribes_owner

== Demo and Q/A ==
Push up a branch owned by a team.  The branch should have a subscription for
that team.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/code/model/tests/test_branchnamespace.py
  lib/lp/code/model/branchnamespace.py

./lib/lp/code/model/branchnamespace.py
     278: E231 missing whitespace after ','
     516: E301 expected 1 blank line, found 0
-- 
https://code.launchpad.net/~abentley/launchpad/subscribe-branch-owner/+merge/30711
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/subscribe-branch-owner into lp:launchpad/devel.
=== modified file 'lib/lp/code/model/branchnamespace.py'
--- lib/lp/code/model/branchnamespace.py	2010-05-25 04:16:25 +0000
+++ lib/lp/code/model/branchnamespace.py	2010-07-22 20:03:59 +0000
@@ -114,7 +114,7 @@
         # registrant subscription does not cause email to be sent about
         # attribute changes, just merge proposals and code review comments.
         branch.subscribe(
-            registrant,
+            self.owner,
             BranchSubscriptionNotificationLevel.NOEMAIL,
             BranchSubscriptionDiffSize.NODIFF,
             CodeReviewNotificationLevel.FULL,

=== modified file 'lib/lp/code/model/tests/test_branchnamespace.py'
--- lib/lp/code/model/tests/test_branchnamespace.py	2010-05-21 17:04:28 +0000
+++ lib/lp/code/model/tests/test_branchnamespace.py	2010-07-22 20:03:59 +0000
@@ -86,6 +86,15 @@
             BranchLifecycleStatus.EXPERIMENTAL, branch.lifecycle_status)
         self.assertEqual(whiteboard, branch.whiteboard)
 
+    def test_createBranch_subscribes_owner(self):
+        owner = self.factory.makeTeam()
+        namespace = self.getNamespace(owner)
+        branch_name = self.factory.getUniqueString()
+        registrant = owner.teamowner
+        branch = namespace.createBranch(
+            BranchType.HOSTED, branch_name, registrant)
+        self.assertEqual([owner], list(branch.subscribers))
+
     def test_getBranches_no_branches(self):
         # getBranches on an IBranchNamespace returns a result set of branches
         # in that namespace. If there are no branches, the result set is
@@ -1451,8 +1460,8 @@
 
 
 class PolicySimple(BranchVisibilityPolicyTestCase):
-    """Test the visibility policy where the base visibility rule is PUBLIC with
-    one team specified to have PRIVATE branches.
+    """Test the visibility policy where the base visibility rule is PUBLIC
+    with one team specified to have PRIVATE branches.
     """
 
     def setUp(self):
@@ -1496,8 +1505,8 @@
 
 
 class PolicyPrivateOnly(BranchVisibilityPolicyTestCase):
-    """Test the visibility policy where the base visibility rule is PUBLIC with
-    one team specified to have the PRIVATE_ONLY rule.
+    """Test the visibility policy where the base visibility rule is PUBLIC
+    with one team specified to have the PRIVATE_ONLY rule.
 
     PRIVATE_ONLY only stops the user from changing the branch from private to
     public and for branch creation behaves in the same maner as the PRIVATE