← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~blr/launchpad/bug-1600055-configure-code-remote-username into lp:launchpad

 

Kit Randel has proposed merging lp:~blr/launchpad/bug-1600055-configure-code-remote-username into lp:launchpad.

Commit message:
Add view property to format git ssh url with username.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1600055 in Launchpad itself: "launchpad git config instructions should include your username"
  https://bugs.launchpad.net/launchpad/+bug/1600055

For more details, see:
https://code.launchpad.net/~blr/launchpad/bug-1600055-configure-code-remote-username/+merge/299774

Unless your launchpad username aligns with your local username, or you have configured your lp username in ~/ssh/config, instructions for adding remote without a username are invalid.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~blr/launchpad/bug-1600055-configure-code-remote-username into lp:launchpad.
=== modified file 'lib/lp/code/templates/configure-code-macros.pt'
--- lib/lp/code/templates/configure-code-macros.pt	2016-01-14 13:55:43 +0000
+++ lib/lp/code/templates/configure-code-macros.pt	2016-07-12 06:34:35 +0000
@@ -20,7 +20,7 @@
     command:</p>
     <p>
       <code class="command command-block">
-        git remote add origin <tal:project replace="modules/lp.services.config/config/codehosting/git_ssh_root"/><tal:project replace="context/name"/><br />
+        git remote add origin <span tal:content="string:${view/git_url}"></span><br />
     </code></p>
     <p>&hellip; and push the Git branch to Launchpad with:</p>
     <p>

=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py	2016-04-14 05:16:26 +0000
+++ lib/lp/registry/browser/product.py	2016-07-12 06:34:35 +0000
@@ -42,7 +42,9 @@
 
 
 from operator import attrgetter
+import urlparse
 
+from bzrlib import urlutils
 from bzrlib.revision import NULL_REVISION
 from lazr.delegates import delegate_to
 from lazr.restful.interface import (
@@ -1743,6 +1745,14 @@
                 self.context.pillar))
 
     @property
+    def git_url(self):
+        base_url = urlparse.urlparse(
+            urlutils.join(config.codehosting.git_ssh_root, self.context.name))
+        url = base_url._replace(
+            netloc="{}@{}".format(self.user.name, base_url.hostname))
+        return url.geturl()
+
+    @property
     def next_url(self):
         """Return the next_url.
 


Follow ups