Merge lp:~twom/launchpad/git-instructions-for-people into lp:launchpad

Proposed by Tom Wardill
Status: Merged
Merged at revision: 18762
Proposed branch: lp:~twom/launchpad/git-instructions-for-people
Merge into: lp:launchpad
Diff against target: 95 lines (+45/-0)
4 files modified
lib/canonical/launchpad/icing/style.css (+4/-0)
lib/lp/code/browser/gitlisting.py (+4/-0)
lib/lp/code/browser/tests/test_gitlisting.py (+26/-0)
lib/lp/code/templates/gitlisting.pt (+11/-0)
To merge this branch: bzr merge lp:~twom/launchpad/git-instructions-for-people
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+353971@code.launchpad.net

Commit message

Add personal git instructions to Person page

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/icing/style.css'
--- lib/canonical/launchpad/icing/style.css 2017-04-18 22:17:00 +0000
+++ lib/canonical/launchpad/icing/style.css 2018-08-29 14:54:36 +0000
@@ -731,6 +731,10 @@
731 background-color: #EEEEEE;731 background-color: #EEEEEE;
732}732}
733733
734p#personal-git-directions pre{
735 max-width: 100%;
736}
737
734/* === Bugs === */738/* === Bugs === */
735739
736tr.buglink-summary td {740tr.buglink-summary td {
737741
=== modified file 'lib/lp/code/browser/gitlisting.py'
--- lib/lp/code/browser/gitlisting.py 2015-09-21 09:59:13 +0000
+++ lib/lp/code/browser/gitlisting.py 2018-08-29 14:54:36 +0000
@@ -104,6 +104,10 @@
104 def repos(self):104 def repos(self):
105 return GitRepositoryBatchNavigator(self, self.repo_collection)105 return GitRepositoryBatchNavigator(self, self.repo_collection)
106106
107 @property
108 def show_personal_directions(self):
109 return self.user == self.context
110
107111
108class TargetGitListingView(BaseGitListingView):112class TargetGitListingView(BaseGitListingView):
109113
110114
=== modified file 'lib/lp/code/browser/tests/test_gitlisting.py'
--- lib/lp/code/browser/tests/test_gitlisting.py 2018-08-23 09:30:24 +0000
+++ lib/lp/code/browser/tests/test_gitlisting.py 2018-08-29 14:54:36 +0000
@@ -348,6 +348,19 @@
348 view = create_initialized_view(self.target, '+git')348 view = create_initialized_view(self.target, '+git')
349 self.assertIsNotNone(find_tag_by_id(view(), 'active-review-count'))349 self.assertIsNotNone(find_tag_by_id(view(), 'active-review-count'))
350350
351 def test_personal_git_instructions_not_present(self):
352 with person_logged_in(self.owner):
353 view = create_initialized_view(
354 self.target, '+git', principal=self.owner)
355 self.assertIsNone(
356 find_tag_by_id(view(), 'personal-git-directions'))
357
358 def test_personal_link(self):
359 with person_logged_in(self.owner):
360 view = create_initialized_view(
361 self.target, '+git', principal=self.owner)
362 self.assertFalse(view.show_personal_directions)
363
351364
352class TestPersonProductGitListingView(TestPersonTargetGitListingView,365class TestPersonProductGitListingView(TestPersonTargetGitListingView,
353 TestCaseWithFactory):366 TestCaseWithFactory):
@@ -487,6 +500,19 @@
487 self.context = self.user = self.owner = self.factory.makePerson()500 self.context = self.user = self.owner = self.factory.makePerson()
488 self.target = self.branch_target = None501 self.target = self.branch_target = None
489502
503 def test_personal_git_instructions_present(self):
504 with person_logged_in(self.owner):
505 view = create_initialized_view(
506 self.owner, '+git', principal=self.owner)
507 self.assertIsNotNone(
508 find_tag_by_id(view(), 'personal-git-directions'))
509
510 def test_personal_link(self):
511 with person_logged_in(self.owner):
512 view = create_initialized_view(
513 self.owner, '+git', principal=self.owner)
514 self.assertTrue(view.show_personal_directions)
515
490516
491class TestDistributionGitListingView(TestPlainGitListingView,517class TestDistributionGitListingView(TestPlainGitListingView,
492 TestCaseWithFactory):518 TestCaseWithFactory):
493519
=== modified file 'lib/lp/code/templates/gitlisting.pt'
--- lib/lp/code/templates/gitlisting.pt 2018-08-22 14:04:22 +0000
+++ lib/lp/code/templates/gitlisting.pt 2018-08-29 14:54:36 +0000
@@ -55,6 +55,17 @@
55 <span class="see-all" tal:condition="view/show_bzr_link">55 <span class="see-all" tal:condition="view/show_bzr_link">
56 <a tal:attributes="href context/fmt:url:code/+branches">View Bazaar branches</a>56 <a tal:attributes="href context/fmt:url:code/+branches">View Bazaar branches</a>
57 </span>57 </span>
58
59 <p id="personal-git-directions" tal:condition="view/show_personal_directions">
60 You can create new personal repositories by pushing an existing git repository
61 to Launchpad with the following commands:
62 <br />
63 <pre class="command subordinate">
64git remote add origin git+ssh://<tal:name replace="view/user/name"/>@git.launchpad.net/~<tal:name replace="view/user/name"/>/+git/<em>REPOSITORY_NAME</em>
65git push --set-upstream origin master
66 </pre>
67 </p>
68
58 <tal:default-repository69 <tal:default-repository
59 condition="view/default_git_repository"70 condition="view/default_git_repository"
60 define="repository view/default_git_repository">71 define="repository view/default_git_repository">