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

Proposed by Tom Wardill on 2018-08-29
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 2018-08-29 Approve on 2018-08-29
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.
Colin Watson (cjwatson) :
review: Needs Fixing
18766. By Tom Wardill on 2018-08-29

Prefer 'personal' over 'junk'

18767. By Tom Wardill on 2018-08-29

Use two commands rather than one

18768. By Tom Wardill on 2018-08-29

wordsmith the instructions

18769. By Tom Wardill on 2018-08-29

Title case for launchpad

Colin Watson (cjwatson) :
review: Approve
18770. By Tom Wardill on 2018-08-29

Use a <pre> rather than multiple <tt>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/style.css'
2--- lib/canonical/launchpad/icing/style.css 2017-04-18 22:17:00 +0000
3+++ lib/canonical/launchpad/icing/style.css 2018-08-29 14:54:36 +0000
4@@ -731,6 +731,10 @@
5 background-color: #EEEEEE;
6 }
7
8+p#personal-git-directions pre{
9+ max-width: 100%;
10+}
11+
12 /* === Bugs === */
13
14 tr.buglink-summary td {
15
16=== modified file 'lib/lp/code/browser/gitlisting.py'
17--- lib/lp/code/browser/gitlisting.py 2015-09-21 09:59:13 +0000
18+++ lib/lp/code/browser/gitlisting.py 2018-08-29 14:54:36 +0000
19@@ -104,6 +104,10 @@
20 def repos(self):
21 return GitRepositoryBatchNavigator(self, self.repo_collection)
22
23+ @property
24+ def show_personal_directions(self):
25+ return self.user == self.context
26+
27
28 class TargetGitListingView(BaseGitListingView):
29
30
31=== modified file 'lib/lp/code/browser/tests/test_gitlisting.py'
32--- lib/lp/code/browser/tests/test_gitlisting.py 2018-08-23 09:30:24 +0000
33+++ lib/lp/code/browser/tests/test_gitlisting.py 2018-08-29 14:54:36 +0000
34@@ -348,6 +348,19 @@
35 view = create_initialized_view(self.target, '+git')
36 self.assertIsNotNone(find_tag_by_id(view(), 'active-review-count'))
37
38+ def test_personal_git_instructions_not_present(self):
39+ with person_logged_in(self.owner):
40+ view = create_initialized_view(
41+ self.target, '+git', principal=self.owner)
42+ self.assertIsNone(
43+ find_tag_by_id(view(), 'personal-git-directions'))
44+
45+ def test_personal_link(self):
46+ with person_logged_in(self.owner):
47+ view = create_initialized_view(
48+ self.target, '+git', principal=self.owner)
49+ self.assertFalse(view.show_personal_directions)
50+
51
52 class TestPersonProductGitListingView(TestPersonTargetGitListingView,
53 TestCaseWithFactory):
54@@ -487,6 +500,19 @@
55 self.context = self.user = self.owner = self.factory.makePerson()
56 self.target = self.branch_target = None
57
58+ def test_personal_git_instructions_present(self):
59+ with person_logged_in(self.owner):
60+ view = create_initialized_view(
61+ self.owner, '+git', principal=self.owner)
62+ self.assertIsNotNone(
63+ find_tag_by_id(view(), 'personal-git-directions'))
64+
65+ def test_personal_link(self):
66+ with person_logged_in(self.owner):
67+ view = create_initialized_view(
68+ self.owner, '+git', principal=self.owner)
69+ self.assertTrue(view.show_personal_directions)
70+
71
72 class TestDistributionGitListingView(TestPlainGitListingView,
73 TestCaseWithFactory):
74
75=== modified file 'lib/lp/code/templates/gitlisting.pt'
76--- lib/lp/code/templates/gitlisting.pt 2018-08-22 14:04:22 +0000
77+++ lib/lp/code/templates/gitlisting.pt 2018-08-29 14:54:36 +0000
78@@ -55,6 +55,17 @@
79 <span class="see-all" tal:condition="view/show_bzr_link">
80 <a tal:attributes="href context/fmt:url:code/+branches">View Bazaar branches</a>
81 </span>
82+
83+ <p id="personal-git-directions" tal:condition="view/show_personal_directions">
84+ You can create new personal repositories by pushing an existing git repository
85+ to Launchpad with the following commands:
86+ <br />
87+ <pre class="command subordinate">
88+git 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>
89+git push --set-upstream origin master
90+ </pre>
91+ </p>
92+
93 <tal:default-repository
94 condition="view/default_git_repository"
95 define="repository view/default_git_repository">