launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21219
[Merge] lp:~cjwatson/launchpad/codeimport-git-default-name into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/codeimport-git-default-name into lp:launchpad.
Commit message:
Default the imported Git repository name on Product:+configure-code to the project name.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/codeimport-git-default-name/+merge/310886
In the common case you're importing a repository that corresponds to the upstream project, so we might as well suggest a reasonable default name.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/codeimport-git-default-name into lp:launchpad.
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2016-11-11 14:58:55 +0000
+++ lib/lp/registry/browser/product.py 2016-11-15 14:18:04 +0000
@@ -1787,7 +1787,8 @@
branch_location=self.series.branch,
git_repository_type=LINK_LP,
git_repository_location=repository_set.getDefaultRepository(
- self.context.pillar))
+ self.context.pillar),
+ git_repository_name=self.context.pillar.name)
@property
def git_ssh_url(self):
=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py 2016-11-11 14:58:55 +0000
+++ lib/lp/registry/browser/tests/test_product.py 2016-11-15 14:18:04 +0000
@@ -960,11 +960,13 @@
self.useFixture(GitHostingFixture())
owner = self.factory.makePerson()
project = self.factory.makeProduct(owner=owner)
+ project_name = project.name
browser = self.getBrowser(project, '+configure-code')
browser.getControl('Git', index=0).click()
browser.getControl(
'Import a Git repository hosted somewhere else').click()
- browser.getControl('Git repository name').value = 'imported'
+ self.assertEqual(
+ project_name, browser.getControl('Git repository name').value)
browser.getControl('Git repository URL').value = (
'https://git.example.org/imported')
browser.getControl('Update').click()
@@ -979,6 +981,7 @@
self.assertEqual(RevisionControlSystems.GIT, repo.code_import.rcs_type)
self.assertEqual(
'https://git.example.org/imported', repo.code_import.url)
+ self.assertEqual(project.name, repo.name)
def test_import_git_repository_bad_scheme(self):
self.useFixture(
@@ -989,7 +992,6 @@
browser.getControl('Git', index=0).click()
browser.getControl(
'Import a Git repository hosted somewhere else').click()
- browser.getControl('Git repository name').value = 'imported'
browser.getControl('Git repository URL').value = (
'svn://svn.example.org/imported')
browser.getControl('Update').click()
Follow ups