← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/git-create-owner-default into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/git-create-owner-default into lp:launchpad.

Commit message:
When creating a target default repository, set it as the owner-target default as well if possible.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-create-owner-default/+merge/257628

Pushing a repository that will be owned by $owner to /$project should, I think, set that as the owner-target default as well, otherwise it feels rather odd for it to be /$project but not /~$owner/$project.  I've been meaning to fix this for a while, but we should nail this kind of thing down before we go live.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-create-owner-default into lp:launchpad.
=== modified file 'lib/lp/code/xmlrpc/git.py'
--- lib/lp/code/xmlrpc/git.py	2015-04-28 04:48:55 +0000
+++ lib/lp/code/xmlrpc/git.py	2015-04-28 11:19:52 +0000
@@ -127,9 +127,11 @@
                 if owner is None:
                     self.repository_set.setDefaultRepository(
                         target, new_repository)
-                else:
+                if (owner is not None or
+                    self.repository_set.getDefaultRepositoryForOwner(
+                        repository_owner, target) is None):
                     self.repository_set.setDefaultRepositoryForOwner(
-                        owner, target, new_repository)
+                        repository_owner, target, new_repository)
 
             repository_name = namespace.findUnusedName(target.name)
             return namespace, repository_name, default_func

=== modified file 'lib/lp/code/xmlrpc/tests/test_git.py'
--- lib/lp/code/xmlrpc/tests/test_git.py	2015-04-28 04:48:55 +0000
+++ lib/lp/code/xmlrpc/tests/test_git.py	2015-04-28 11:19:52 +0000
@@ -578,7 +578,7 @@
         project = self.factory.makeProduct(owner=requester)
         repository = self.assertCreates(requester, u"/%s" % project.name)
         self.assertTrue(repository.target_default)
-        self.assertFalse(repository.owner_default)
+        self.assertTrue(repository.owner_default)
 
     def test_translatePath_create_package_default_denied(self):
         # A repository cannot (yet) be created and immediately set as the


Follow ups