← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Tom Wardill has proposed merging lp:~twom/launchpad/git-instructions-for-people into lp:launchpad.

Commit message:
Add personal git instructions to Person page

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1590560 in Launchpad itself: "Should include instructions on how to create a git repository on user's code page"
  https://bugs.launchpad.net/launchpad/+bug/1590560

For more details, see:
https://code.launchpad.net/~twom/launchpad/git-instructions-for-people/+merge/353971
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~twom/launchpad/git-instructions-for-people into lp:launchpad.
=== 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 13:32:04 +0000
@@ -104,6 +104,10 @@
     def repos(self):
         return GitRepositoryBatchNavigator(self, self.repo_collection)
 
+    @property
+    def show_junk_directions(self):
+        return self.user == self.context
+
 
 class TargetGitListingView(BaseGitListingView):
 

=== 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 13:32:04 +0000
@@ -348,6 +348,13 @@
         view = create_initialized_view(self.target, '+git')
         self.assertIsNotNone(find_tag_by_id(view(), 'active-review-count'))
 
+    def test_personal_git_instructions_not_present(self):
+        with person_logged_in(self.owner):
+            view = create_initialized_view(
+                self.target, '+git', principal=self.owner)
+            self.assertIsNone(
+                find_tag_by_id(view(), 'junk-branch-directions'))
+
 
 class TestPersonProductGitListingView(TestPersonTargetGitListingView,
                                       TestCaseWithFactory):
@@ -487,6 +494,13 @@
         self.context = self.user = self.owner = self.factory.makePerson()
         self.target = self.branch_target = None
 
+    def test_personal_git_instructions_present(self):
+        with person_logged_in(self.owner):
+            view = create_initialized_view(
+                self.owner, '+git', principal=self.owner)
+            self.assertIsNotNone(
+                find_tag_by_id(view(), 'junk-branch-directions'))
+
 
 class TestDistributionGitListingView(TestPlainGitListingView,
                                      TestCaseWithFactory):

=== 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 13:32:04 +0000
@@ -55,6 +55,14 @@
     <span class="see-all" tal:condition="view/show_bzr_link">
       <a tal:attributes="href context/fmt:url:code/+branches">View Bazaar branches</a>
     </span>
+
+    <p id="junk-branch-directions" tal:condition="view/show_junk_directions">
+      You can push (upload) personal branches (those not related to a project)
+      with the following command:
+      <br />
+      <tt class="command">git push --set-upstream git+ssh://<tal:name replace="view/user/name"/>@git.launchpad.net/~<tal:name replace="view/user/name"/>/+git/<em>REPOSITORY_NAME</em> master</tt>
+    </p>
+
     <tal:default-repository
         condition="view/default_git_repository"
         define="repository view/default_git_repository">


Follow ups