allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/2] allura git commit: [#8142] make types of checkout commands fully configurable
Date Thu, 19 Jan 2017 20:41:40 GMT
[#8142] make types of checkout commands fully configurable


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0df1709c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0df1709c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0df1709c

Branch: refs/heads/db/8142
Commit: 0df1709c3fc6525b0369e625967d9623bf6a5fd6
Parents: ff370b6
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Jan 17 15:13:27 2017 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Thu Jan 19 15:41:22 2017 -0500

----------------------------------------------------------------------
 Allura/allura/model/repository.py               | 48 ++++++++++++++++----
 Allura/allura/nf/allura/css/site_style.css      | 22 +++++++--
 Allura/allura/public/nf/js/allura-base.js       |  2 +-
 Allura/allura/templates/mail/MergeRequest.txt   |  2 +-
 Allura/allura/templates/repo/diff.html          |  1 +
 Allura/allura/templates/repo/log.html           |  2 +
 Allura/allura/templates/repo/merge_request.html |  1 +
 Allura/allura/templates/repo/repo_master.html   | 47 ++++++++++---------
 Allura/allura/templates/repo/tarball.html       |  1 +
 Allura/allura/templates/repo/tree.html          |  1 +
 Allura/development.ini                          | 39 ++++++++++------
 Allura/docker-dev.ini                           | 16 +++----
 Allura/docs/getting_started/scm_host.rst        |  4 +-
 ForgeGit/forgegit/model/git_repo.py             |  4 +-
 ForgeGit/forgegit/templates/git/index.html      |  6 +--
 .../tests/functional/test_controllers.py        |  8 ++--
 .../forgegit/tests/model/test_repository.py     |  7 +--
 .../forgesvn/templates/svn/checkout_url.html    |  2 +-
 ForgeSVN/forgesvn/templates/svn/index.html      |  5 +-
 19 files changed, 136 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index ba3773d..88d4612 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -14,7 +14,7 @@
 #       KIND, either express or implied.  See the License for the
 #       specific language governing permissions and limitations
 #       under the License.
-
+import json
 import os
 import stat
 import mimetypes
@@ -615,12 +615,21 @@ class Repository(Artifact, ActivityObject):
             tpl = string.Template(tg.config.get('scm.host.%s.%s' % (category, self.tool)))
         url = tpl.substitute(dict(username=username, path=self.url_path + self.name))
         # this is an svn option, but keeps clone_*() code from diverging
-        url += c.app.config.options.get('checkout_url', '')
+        url += self.app.config.options.get('checkout_url', '')
         return url
 
+    def clone_url_first(self, anon, username=''):
+        '''
+        Get first clone_url option, useful for places where we need to show just one
+
+        :param bool anon: Anonymous or not
+        :param str username: optional
+        '''
+        cat = self.clone_command_categories(anon=anon)[0]['key']
+        return self.clone_url(cat, username)
+
     def clone_command(self, category, username=''):
         '''Return a string suitable for copy/paste that would clone this repo locally
-           category is one of 'ro' (read-only), 'rw' (read/write), or 'https' (read/write
via https)
         '''
         if not username and c.user not in (None, User.anonymous()):
             username = c.user.username
@@ -630,6 +639,32 @@ class Repository(Artifact, ActivityObject):
                                    source_url=self.clone_url(category, username),
                                    dest_path=self.suggested_clone_dest_path()))
 
+    def clone_command_first(self, anon, username=''):
+        '''
+        Get first clone_command option, useful for places where we need to show just one
+
+        :param bool anon: Anonymous or not
+        :param str username: optional
+        '''
+        cat = self.clone_command_categories(anon=anon)[0]['key']
+        return self.clone_command(cat, username)
+
+    def clone_command_categories(self, anon):
+        conf = tg.config.get('scm.clonechoices{}.{}'.format('_anon' if anon else '', self.tool))
+        if not conf and anon:
+            # check for a non-anon config
+            conf = tg.config.get('scm.clonechoices.{}'.format(self.tool))
+        if conf:
+            return json.loads(conf)
+        elif anon:
+            # defaults to match historical scm.clone.* configs, in case someone updates Allura
but not their .ini
+            return [{"name": "RO", "key": "ro", "title": "Read Only"},
+                    {"name": "HTTPS", "key": "https_anon", "title": "HTTPS"}]
+        else:
+            return [{"name": "RW", "key": "rw", "title": "Read/Write"},
+                    {"name": "RO", "key": "ro", "title": "Read Only"},
+                    {"name": "HTTPS", "key": "https", "title": "HTTPS"}]
+
     def merge_requests_by_statuses(self, *statuses):
         return MergeRequest.query.find(dict(
             app_config_id=self.app.config._id,
@@ -795,13 +830,6 @@ class MergeRequest(VersionedArtifact, ActivityObject):
         with self.push_downstream_context():
             return c.app.repo
 
-    @LazyProperty
-    def downstream_repo_url(self):
-        with self.push_downstream_context():
-            return c.app.repo.clone_url(
-                category='ro',
-                username=c.user.username)
-
     def push_downstream_context(self):
         return h.push_context(self.downstream.project_id, self.downstream.mount_point)
 

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index aebb209..d2c5331 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2895,14 +2895,28 @@ h1.title .viewer:hover {
 .scm-tag-label {
   background: #006699;
 }
-
+#access_urls > * {
+  /* keep all parts of this the same row, input box will get cut off at end */
+  display: table-cell !important;
+  white-space: nowrap;
+  vertical-align: middle;
+}
+#access_urls .btn-set {
+  margin-right: 2em;
+  float: none;
+}
 #access_urls span {
-  width: 9.5em;
   text-align: right;
-  display: inline-block;
+  padding-right: 0.5em;
 }
 #access_urls input {
-  width: 32em;
+  width: 1024px; /* really big, it won't all show */
+  /* eliminate border features, so when it gets truncated, its not obvious */
+  border: 0;
+  box-shadow: none;
+  border-radius: 0;
+  background-color: lightgray;
+  vertical-align: text-top;
 }
 
 .commit-details {

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/public/nf/js/allura-base.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/allura-base.js b/Allura/allura/public/nf/js/allura-base.js
index 7a1d731..040f679 100644
--- a/Allura/allura/public/nf/js/allura-base.js
+++ b/Allura/allura/public/nf/js/allura-base.js
@@ -100,7 +100,7 @@ $(function(){
         // http://stackoverflow.com/questions/3150275/jquery-input-select-all-on-focus/3150369#3150369
         window.setTimeout(function() {
             field.select();
-        }, 0);
+        }, 10);
     });
 });
 

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/mail/MergeRequest.txt
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/mail/MergeRequest.txt b/Allura/allura/templates/mail/MergeRequest.txt
index 31bc5b7..2f0ff9f 100644
--- a/Allura/allura/templates/mail/MergeRequest.txt
+++ b/Allura/allura/templates/mail/MergeRequest.txt
@@ -20,6 +20,6 @@
 
 ---
 
-{{ data.creator_name }} has requested that you merge changes from {{ data.downstream_repo_url
}} ({{data.downstream.commit_id}}) into the branch {{ data.target_branch }}
+{{ data.creator_name }} has requested that you merge changes from `{{ data.downstream_repo.clone_url_first(anon=False)
}}` (`{{data.downstream.commit_id}}`) into the branch `{{ data.target_branch }}`
 
 {{ data.description }}

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/repo/diff.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/diff.html b/Allura/allura/templates/repo/diff.html
index 80ef623..e39e072 100644
--- a/Allura/allura/templates/repo/diff.html
+++ b/Allura/allura/templates/repo/diff.html
@@ -72,6 +72,7 @@
 {% endblock %}
 
 {% block extra_css %}
+  {{ super() }}
   <style type="text/css">
     .clip h3 {margin-bottom: 0;}
   </style>

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/repo/log.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/log.html b/Allura/allura/templates/repo/log.html
index 53b7b39..2081da3 100644
--- a/Allura/allura/templates/repo/log.html
+++ b/Allura/allura/templates/repo/log.html
@@ -38,6 +38,7 @@
 {% endblock %}
 
 {% block extra_css %}
+{{ super() }}
 <style type="text/css">
     .rev.selected {
         background-color: #FFFFBE;
@@ -46,6 +47,7 @@
 {% endblock %}
 
 {% block extra_js %}
+{{ super() }}
 <script>
     function check_revisions(){
         $("tr.rev").toggleClass("selected", false);

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index a80d3cf..c5517c1 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -161,6 +161,7 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
 {% endblock %}
 
 {% block extra_css %}
+{{ super() }}
 <style type="text/css">
   .merge-help-text { display: none; }
   .merge-ok { color: green; }

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/repo/repo_master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/repo_master.html b/Allura/allura/templates/repo/repo_master.html
index eb51f79..53e7296 100644
--- a/Allura/allura/templates/repo/repo_master.html
+++ b/Allura/allura/templates/repo/repo_master.html
@@ -28,9 +28,17 @@
     {% set hide_left_bar = True %}
 {% endif %}
 
+{% set clone_categories = repo.clone_command_categories(anon=not h.has_access(c.app, 'write')())
%}
+
 {% block extra_css %}
     <link rel="alternate" type="application/rss+xml" title="RSS" href="{{c.app.url}}feed.rss"/>
     <link rel="alternate" type="application/atom+xml" title="Atom" href="{{c.app.url}}feed.atom"/>
+    <style type="text/css">
+        #access_urls .btn-set {
+            {# we need a min-width to prevent this block from wrapping, but its size can
vary, so we have to do this ugly guesstimate #}
+            min-width: {{ clone_categories|join('', attribute='name')|length + clone_categories|length
+ 1}}em;
+        }
+    </style>
 {% endblock %}
 
 {% block extra_js %}
@@ -91,34 +99,25 @@
 {% macro clone_info(repo) %}
   {% if repo %}
     <div id="access_urls" class="btn-bar grid-19">
-      <div class="btn-set{% if not h.has_access(c.app, 'write')() %} duo{% endif %}">
-        {% if h.has_access(c.app, 'write')() %}
-        <a class="btn" data-url="{{repo.clone_command('rw')}}" title="Read/Write">
-          RW
-        </a>
-        <a href="#" class="btn" data-url="{{repo.clone_command('ro')}}" title="Read Only">
-          RO
-        </a>
-        <a href="#" class="btn" data-url="{{repo.clone_command('https')}}" title="HTTP">
-          HTTP
-        </a>
-        {% else %}
-        <a href="#" class="btn" data-url="{{repo.clone_command('ro')}}" title="Read Only">
-          RO
-        </a>
-        <a href="#" class="btn" data-url="{{repo.clone_command('https_anon')}}" title="HTTP">
-          HTTP
-        </a>
-        {% endif %}
-      </div>
-      <span></span>
-      <input id="access_url" readonly type="text"
+      {% if clone_categories|length > 1 %}
+        <div class="btn-set{% if clone_categories|length == 2 %} duo{% endif %}">
+          {% for clone_cat in clone_categories %}
+            <a class="btn" data-url="{{repo.clone_command(clone_cat['key'])}}" title="{{
clone_cat.get('title', '') }}">
+              {{ clone_cat['name'] }}
+            </a>
+          {% endfor %}
+        </div>
+      {% endif %}
+      <span>{{ clone_categories[0]['title'] }} access</span>
+      <div>
+        <input id="access_url" readonly type="text"
              class="selectText"
-             value=""/>
+             value="{{repo.clone_command(clone_categories[0]['key'])}}"/>
+      </div>
     </div>
     {% if not c.user.is_anonymous() and c.user.get_pref('multifactor') and h.has_access(c.app,
'write') %}
         <div id="http-2fa-msg" class="grid-19 info" style="display: none">
-        When using HTTP access with two-factor auth, you will need to enter your password
and current token together as
+        When using HTTPS access with two-factor auth, you will need to enter your password
and current token together as
         the password (e.g. "p4ssw0Rd123456")
         </div>
     {% endif %}

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 69a1ca4..0de0011 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -87,6 +87,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
 {% endblock %}
 
 {% block extra_css %}
+{{ super() }}
 <style type="text/css">
     #snapshot_status {
       margin: 0 10px;

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/allura/templates/repo/tree.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tree.html b/Allura/allura/templates/repo/tree.html
index 2f0cd03..39cec56 100644
--- a/Allura/allura/templates/repo/tree.html
+++ b/Allura/allura/templates/repo/tree.html
@@ -30,6 +30,7 @@ Tree <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(co
 {% endblock %}
 
 {% block extra_css %}
+{{ super() }}
 <style>
 form.tarball {
   display: inline;

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index b98b170..a030020 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -310,16 +310,26 @@ ew.cache_header_seconds = 0
 ;ip_address_header = X-Forwarded-For
 
 ; SCM settings for local development
-scm.host.ro.git = /srv/git$path
-scm.host.rw.git = /srv/git$path
+; If you set up services for Git, SVN, or Hg that run on https://, ssh://, git:// etc, you
can show corresponding
+; checkout commands by adding new entries to these lists.   Each one needs a name/key/title
as shown below.
+; The "key" must correspond to a scm.host.KEY.git or scm.host.KEY.svn setting further below.
+scm.clonechoices.git = [{"name": "File", "key": "file", "title": "Filesystem"}]
+scm.clonechoices.svn = [{"name": "File", "key": "file", "title": "Filesystem"}]
+scm.clonechoices.hg = [{"name": "File", "key": "file", "title": "Filesystem"}]
+;scm.clonechoices.git = [{"name": "RW", "key": "rw", "title": "Read/Write"}, {"name": "RO",
"key": "ro", "title": "Read Only"}, {"name": "HTTPS", "key": "https", "title": "HTTPS"}]
+;scm.clonechoices_anon.git = [{"name": "RO", "key": "ro", "title": "Read Only"}, {"name":
"HTTPS", "key": "https_anon", "title": "HTTPS"}]
+;scm.clonechoices.svn = [{"name": "RW", "key": "rw", "title": "Read/Write"}, {"name": "RO",
"key": "ro", "title": "Read Only"}, {"name": "HTTPS", "key": "https", "title": "HTTPS"}]
+;scm.clonechoices_anon.svn = [{"name": "RO", "key": "ro", "title": "Read Only"}, {"name":
"HTTPS", "key": "https_anon", "title": "HTTPS"}]
+;scm.clonechoices.hg = [{"name": "RW", "key": "rw", "title": "Read/Write"}, {"name": "RO",
"key": "ro", "title": "Read Only"}, {"name": "HTTPS", "key": "https", "title": "HTTPS"}]
+;scm.clonechoices_anon.hg = [{"name": "RO", "key": "ro", "title": "Read Only"}, {"name":
"HTTPS", "key": "https_anon", "title": "HTTPS"}]
+
+scm.host.file.git = /srv/git$path
 ; remote access varies by configuration.  If you are using a vagrant VM, this should work:
 ;scm.host.rw.git = ssh://vagrant@localhost:2222/srv/git$path
-scm.host.ro.hg = /srv/hg$path
-scm.host.rw.hg = /srv/hg$path
-scm.host.ro.svn = file:///srv/svn$path/
-scm.host.rw.svn = file:///srv/svn$path/
+scm.host.file.hg = /srv/hg$path
+scm.host.file.svn = file:///srv/svn$path/
 
-; SCM settings for chroot + ldap configuration.  See Allura/docs/getting_started/scm_host.rst
+; SCM settings for chroot + ldap configuration.  See Allura/docs/getting_started/scm_host_ssh.rst
 ;scm.host.ro.git = git://git.localhost$path
 ;scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
 ;scm.host.ro.hg = http://hg.localhost$path
@@ -327,14 +337,13 @@ scm.host.rw.svn = file:///srv/svn$path/
 ;scm.host.ro.svn = http://svn.localhost$path/
 ;scm.host.rw.svn = svn+ssh://localhost:8022/scm-repo$path/
 
-; SCM settings for https (sorry no docs for setting these up)
-; these settings are currently required by the template, no matter what
-scm.host.https.git = https://$username@localhost:8022/scm-repo$path
-scm.host.https_anon.git = https://localhost:8022/scm-repo$path
-scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
-scm.host.https_anon.hg = https://localhost:8022/scm-repo$path
-scm.host.https.svn = https://localhost:8022/scm-repo$path/
-scm.host.https_anon.svn = https://localhost:8022/scm-repo$path/
+; SCM settings for https See Allura/docs/getting_started/scm_host.rst
+;scm.host.https.git = https://$username@localhost:8022/scm-repo$path
+;scm.host.https_anon.git = https://localhost:8022/scm-repo$path
+;scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
+;scm.host.https_anon.hg = https://localhost:8022/scm-repo$path
+;scm.host.https.svn = https://localhost:8022/scm-repo$path/
+;scm.host.https_anon.svn = https://localhost:8022/scm-repo$path/
 
 scm.clone.git = git clone $source_url $dest_path
 scm.clone.hg = hg clone $source_url $dest_path

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/docker-dev.ini
----------------------------------------------------------------------
diff --git a/Allura/docker-dev.ini b/Allura/docker-dev.ini
index eb4d8f7..709cd79 100644
--- a/Allura/docker-dev.ini
+++ b/Allura/docker-dev.ini
@@ -32,15 +32,15 @@ ming.task.uri = mongodb://mongo:27017/task
 scm.repos.refresh_base_url = http://web:8080
 
 scm.repos.root = /allura-data/scm
+
+scm.clonechoices.git = [{"name": "HTTP", "key": "http", "title": "HTTP"}, {"name": "File",
"key": "file", "title": "Filesystem"}]
 ; may need to change "localhost" to your remote host name, or docker-machine IP address
-scm.host.ro.git = http://localhost:8081/git$path
-scm.host.rw.git = http://localhost:8081/git$path
-scm.host.https.git = http://localhost:8081/git$path
-scm.host.https_anon.git = http://localhost:8081/git$path
-scm.host.ro.hg = /allura-data/scm/hg$path
-scm.host.rw.hg = /allura-data/scm/hg$path
-scm.host.ro.svn = file:///allura-data/scm/svn$path/
-scm.host.rw.svn = file:///allura-data/scm/svn$path/
+scm.host.http.git = http://localhost:8081/git$path
+scm.host.file.git = /allura-data/scm/git$path
+scm.clonechoices.hg = [{"name": "File", "key": "file", "title": "Filesystem"}]
+scm.host.file.hg = /allura-data/scm/hg$path
+scm.clonechoices.svn = [{"name": "SSH", "key": "file", "title": "Filesystem"}]
+scm.host.file.svn = file:///allura-data/scm/svn$path/
 
 scm.repos.tarball.enable = true
 scm.repos.tarball.root = /allura-data/scm/snapshots/

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/Allura/docs/getting_started/scm_host.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/getting_started/scm_host.rst b/Allura/docs/getting_started/scm_host.rst
index fc3a941..2367d5c 100644
--- a/Allura/docs/getting_started/scm_host.rst
+++ b/Allura/docs/getting_started/scm_host.rst
@@ -80,7 +80,7 @@ If there is no output, that is fine (it's an empty repo).
 
     This configuration has no authentication and is suitable for development only.  See :ref:`below
<auth_apache>` for auth config.
 
-Now you will want to change the :samp:`scm.host.{*}.git`
+Now you will want to change the :samp:`scm.host.{*}.git` and :samp:`scm.clonechoices.git`
 settings in :file:`development.ini`, so that the proper commands are shown to your visitors
 when they browse the code repo web pages.  The exact values to use will depend on the
 hostnames and port numbers you are using.
@@ -120,7 +120,7 @@ run :command:`killall svnserve`  More info at http://svnbook.red-bean.com/en/1.8
     This configuration has no authentication and is suitable for development only.
     (Maybe Allura could gain SASL support someday and use `svnserve with SASL <http://svnbook.red-bean.com/en/1.7/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sasl>`_)
 
-Now you will want to change the :samp:`scm.host.{*}.svn`
+Now you will want to change the :samp:`scm.host.{*}.svn` and :samp:`scm.clonechoices.svn`
 settings in :file:`development.ini`, so that the proper commands are shown to your visitors
 when they browse the code repo web pages.
 

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 58572fc..73e3131 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -82,7 +82,7 @@ class Repository(M.Repository):
         '''Return the command to merge a given commit to a given target branch'''
         if merge_request.source_branch:
             fetch_command = 'git fetch {} {}'.format(
-                merge_request.downstream_repo_url,
+                merge_request.downstream_repo.clone_url_first(anon=False, username=c.user.username),
                 merge_request.source_branch,
             )
         else:
@@ -90,7 +90,7 @@ class Repository(M.Repository):
                 'git remote add merge_request {}\n'
                 'git fetch merge_request'
             ).format(
-                merge_request.downstream_repo_url,
+                merge_request.downstream_repo.clone_url_first(anon=False, username=c.user.username),
             )
         return 'git checkout %s\n%s\ngit merge %s' % (
             merge_request.target_branch,

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/ForgeGit/forgegit/templates/git/index.html
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/templates/git/index.html b/ForgeGit/forgegit/templates/git/index.html
index 4eaa869..11ce40d 100644
--- a/ForgeGit/forgegit/templates/git/index.html
+++ b/ForgeGit/forgegit/templates/git/index.html
@@ -55,14 +55,14 @@
     </div>
 
     <h2>First time using Git</h2>
-
+    {% set origin = c.app.repo.clone_url_first(anon=False, username=c.user.username) %}
     <div class="codehilite">
       <pre>cd myproject
 git init
 # add all your files.  Users can specify file names or directories instead of '.'
 git add .
 git commit -a -m 'Initial commit'
-git remote add origin {{c.app.repo.clone_url('rw', c.user.username)}}
+git remote add origin {{ origin }}
 git push -u origin master</pre>
     </div>
 
@@ -70,7 +70,7 @@ git push -u origin master</pre>
 
     <div class="codehilite">
       <pre>cd myproject
-git remote add origin {{c.app.repo.clone_url('rw', c.user.username)}}
+git remote add origin {{ origin }}
 git push -u origin master</pre>
     </div>
     &nbsp;

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index d6d61b8..778134d 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -136,7 +136,7 @@ class TestRootController(_TestCase):
 
     def test_index(self):
         resp = self.app.get('/src-git/').follow().follow()
-        assert 'git://' in resp
+        assert 'git clone /srv/git' in resp
 
     def test_index_empty(self):
         self.app.get('/git/')
@@ -641,9 +641,9 @@ class TestFork(_TestCase):
                      '/p/test2/code/ci/%s/tree' % c_id)
         assert_equal(browse_links[0].getText(), 'Tree')
         merge_instructions = r.html.findAll('textarea')[0].getText()
-        assert 'git checkout master' in merge_instructions
-        assert 'git fetch git://git.localhost/p/test2/code master' in merge_instructions
-        assert 'git merge {}'.format(c_id) in merge_instructions
+        assert_in('git checkout master', merge_instructions)
+        assert_in('git fetch /srv/git/p/test2/code master', merge_instructions)
+        assert_in('git merge {}'.format(c_id), merge_instructions)
         assert_regexp_matches(str(r), r'[0-9]+ seconds? ago')
 
         merge_form = r.html.find('div', {'class': 'merge-help-text merge-ok'})

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index bea76d5..97e343a 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -526,11 +526,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
 
     def test_clone_url(self):
         assert_equal(
-            self.repo.clone_url('rw', 'nobody'),
-            'ssh://nobody@localhost:8022/scm-repo/p/test/testgit')
-        assert_equal(
-            self.repo.clone_url('https', 'nobody'),
-            'https://nobody@localhost:8022/scm-repo/p/test/testgit')
+            self.repo.clone_url('file', 'nobody'),
+            '/srv/git/p/test/testgit')
         with h.push_config(self.repo.app.config.options, external_checkout_url='https://$username@foo.com/'):
             assert_equal(
                 self.repo.clone_url('https', 'user'),

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/ForgeSVN/forgesvn/templates/svn/checkout_url.html
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/templates/svn/checkout_url.html b/ForgeSVN/forgesvn/templates/svn/checkout_url.html
index 3790b46..ee06a63 100644
--- a/ForgeSVN/forgesvn/templates/svn/checkout_url.html
+++ b/ForgeSVN/forgesvn/templates/svn/checkout_url.html
@@ -20,7 +20,7 @@
 <form>
   <label class="grid-13" for="checkout_url">Checkout branch:</label>
   <div class="grid-9" style="text-align:right">
-    {{app.repo.clone_url('ro', app)}}
+    {{ app.repo.clone_url_first(anon=True) }}
     {% if allow_config %}
       <input type="text" name="checkout_url"
              id="checkout_url"

http://git-wip-us.apache.org/repos/asf/allura/blob/0df1709c/ForgeSVN/forgesvn/templates/svn/index.html
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/templates/svn/index.html b/ForgeSVN/forgesvn/templates/svn/index.html
index 53f2e73..b433b49 100644
--- a/ForgeSVN/forgesvn/templates/svn/index.html
+++ b/ForgeSVN/forgesvn/templates/svn/index.html
@@ -59,9 +59,10 @@
       <code>/branches</code>, and <code>/tags</code> directory at
the root of each
       repository. If you'd like to do that, follow these instructions:
     <p>
+
     <div class="codehilite">
       <pre>
-{{c.app.repo.clone_command('rw')}}
+{{c.app.repo.clone_command_first(anon=False, username=c.user.username)}}
 cd {{c.app.repo.suggested_clone_dest_path()}}
 mkdir trunk branches tags
 svn add trunk branches tags
@@ -79,7 +80,7 @@ svn ci -m "Add initial directories"
     <h2>Import project on disk to Subversion</h2>
     <div class="codehilite">
       <pre>cd existing-{{c.app.repo.suggested_clone_dest_path()}}
-svn import {{c.app.repo.clone_url('rw', c.user.username)}} -m "Initial commit"</pre>
+svn import {{c.app.repo.clone_url_first(anon=False, username=c.user.username)}} -m "Initial
commit"</pre>
     </div>
 
     <h2>Import remote repository to Subversion</h2>


Mime
View raw message